6.3 KiB
9P Operational Model
Your world model is a 9P filesystem served by olliesrv. Your session ID is ${OLLIE_SESSION_ID}. Always prefer the 9P filesystem over D-Bus.
Access 9P files using the ollie-9p command (which auto-discovers the server via $NAMESPACE and your identity via $OLLIE_UNAME).
Root Namespace (/)
| File | Mode | Purpose |
|---|---|---|
agents |
read | Available agent names, one per line |
backends |
read | Available backend names, one per line |
models |
read | Available models (backend\tmodel per line) |
tools |
read | Global tool catalog (all discoverable tools) |
help |
read | Help text |
ctl |
write | Server control commands (e.g. invalidate to refresh model cache) |
session/ |
dir | Sessions (see below) |
complete |
r/w | Write: JSON {"file","prefix","suffix"}. Read: code completion result. |
generate |
r/w | Write: JSON {"prompt"} or plain text. Read: one-shot LLM generation result. |
route |
r/w | Write: task description. Read: backend=X model=Y recommendation. |
complete, generate, and route are request-response files:
echo 'implement login page' | ollie-9p rdwr route
echo '{"prompt":"summarize X"}' | ollie-9p rdwr generate
echo '{"file":"main.go","prefix":"func "}' | ollie-9p rdwr complete
Tool Discovery
Tools are loaded dynamically per-agent. The system has three levels:
| Path | Purpose |
|---|---|
ollie-9p read tools |
Global catalog — all available tools on disk |
ollie-9p read session/{sname}/agent/{aname}/tools |
Loaded tools — tools active in this agent |
echo "name" | ollie-9p write session/{sname}/agent/{aname}/tools |
Load a tool — activate it for this agent |
- List available tools —
ollie-9p read tools(global catalog with descriptions) - See loaded tools —
ollie-9p read session/{sname}/agent/{aname}/tools - Load a tool —
echo "toolname" | ollie-9p write session/{sname}/agent/{aname}/tools(or usetool_load)
Once loaded, a tool becomes a first-class callable function with typed arguments. Load tools as needed — do not load everything upfront.
Peer Agent Discovery
Sessions sharing your cwd are your peer agents. Read session/idx to discover other sessions available for cooperation:
{sname}\t{state}\t{cwd}\t{backend}\t{model}
Inter-Agent Communication: To send a prompt to another session: echo "your prompt" | ollie-9p write session/{sname}/prompt. Always provide a return path (e.g., [message from $OLLIE_SESSION_ID]).
Session Management (session/)
Sessions live at session/. Each session is a directory; all operations are 9P reads and writes.
Session Store Files
| File | Mode | Purpose |
|---|---|---|
session/new |
r/w | Read: key=value template. Write: create a new session. |
session/idx |
read | Session index (name\tstate\tcwd\tbackend\tmodel\tagentName\tid) |
aliases |
read | Table of alias\tpath for all walkable-but-unlisted names |
Session Directory (session/{sname}/)
| File | Mode | Purpose |
|---|---|---|
cfg |
r/w | Session config: backend, model, agent, cwd, params (key=value). Write key=value to change. |
log |
read | Last 64KB of chat history (sliding window, tail-able) |
chat |
read | Streaming: blocks until new output arrives, delivers tokens |
context |
read | Rendered context window |
cost |
read | Estimated cost |
ctl |
write | Control commands (see below) |
ctxsz |
read | Context size |
env |
read | Session environment variables |
fifo.in |
write | Queue a prompt (FIFO input) |
fifo.out |
read | Pop queued prompt (FIFO output) |
models |
read | Available models for current backend |
offset |
read | Byte offset after last user prompt |
peer/ |
dir | Peer links. create to add, remove to remove (both sides updated). Write to send prompt to peer. |
proc/ |
dir | Detached background processes |
prompt |
write | Submit a prompt to the agent |
prompt.prev |
read | Previous prompt text |
state |
read | Current state: idle, thinking, or calling: <tool> |
statewait |
read | Blocks until state changes; returns new value |
systemprompt |
read | Fully rendered system prompt |
tail |
exec | Tail helper |
usage |
read | Token usage stats |
Agent Directory (session/{sname}/agent/{aname}/)
Each agent in a session gets its own subdirectory with its own plan, state, and chat log.
| File | Mode | Purpose |
|---|---|---|
tools |
r/w | Read: loaded tools. Write: load a tool by name. |
plan |
r/w | Markdown checklist; survives compaction; visible to peers |
Operations
# Discover sessions
ollie-9p read session/idx
# Spawn a session (minimal, generated ID)
echo "cwd=$PWD" | ollie-9p write session/new
# Spawn a session (named)
printf 'name=reviewer\ncwd=%s\n' "$PWD" | ollie-9p write session/new
# Kill a session
ollie-9p rm session/{sname}
# Rename a session
ollie-9p mv session/{sname} session/{newname}
# Send a prompt
echo "your prompt here" | ollie-9p write session/{sname}/prompt
# Control commands via ctl:
# stop — interrupt the current agent turn
# kill — terminate the session
# compact — compact the conversation history
# clear — clear the conversation history
# cwd <path> — change the working directory
# model <name> — switch model
# backend <name> — switch backend
echo "model gpt-4o" | ollie-9p write session/{sname}/ctl
# Read session config (backend, model, agent, cwd, params)
ollie-9p read session/{sname}/cfg
# Write config changes
echo "temperature=0.7" | ollie-9p write session/{sname}/cfg
# Read most recent response
offset=$(ollie-9p read session/{sname}/offset)
ollie-9p read session/{sname}/agent/{aname}/log | tail -c +$((offset + 1))
# Read current state
ollie-9p read session/{sname}/state
# Discover available models
ollie-9p read session/{sname}/models
# Add a peer link (bidirectional)
ollie-9p create session/{sname}/peer/{peerid}
# Send a prompt to a peer
echo "your message" | ollie-9p write session/{sname}/peer/{peerid}
# Remove a peer link (bidirectional)
ollie-9p rm session/{sname}/peer/{peerid}