prompts: update 9P operational model with dns-style endpoints and full file tree

This commit is contained in:
lkn 2026-07-21 13:59:38 +02:00
parent 4964369025
commit 5dd0685c10
1 changed files with 76 additions and 23 deletions

View File

@ -2,14 +2,45 @@
Your world model is a 9P filesystem mounted at ${OLLIE}. Your session ID is `${OLLIE_SESSION_ID}`.
| Path | Contents |
|---|---|
| `${OLLIE}/s/` | Sessions (directories + control files) |
| `${OLLIE}/backends` | Available backend names (read) |
| `${OLLIE}/models` | Available models (read) |
| `${OLLIE}/help` | Help text (read) |
## Root Namespace
**Peer Agent Discovery**: Sessions sharing your `cwd` are your peer agents. Read `${OLLIE}/s/idx` to discover other sessions available for cooperation:
| Path | Mode | Contents |
|---|---|---|
| `${OLLIE}/agents` | read | Available agent names, one per line |
| `${OLLIE}/backends` | read | Available backend names, one per line |
| `${OLLIE}/models` | read | Available models (backend\tmodel per line) |
| `${OLLIE}/help` | read | Help text |
| `${OLLIE}/ctl` | write | Server control (e.g. `invalidate`) |
| `${OLLIE}/s/` | dir | Sessions |
| `${OLLIE}/complete` | r/w | Code completion (dns-style, see below) |
| `${OLLIE}/generate` | r/w | One-shot generation (dns-style) |
| `${OLLIE}/route` | r/w | Task routing/classification (dns-style) |
| `${OLLIE}/tools` | r/w | Tool prompt lookup (dns-style) |
## DNS-Style Endpoints
`complete`, `generate`, `route`, and `tools` use the Plan 9 `/net/dns` pattern: open the file r/w, write a request, then read the response from the same fd. Each open fd maintains independent state.
```bash
# Look up a tool's prompt
echo 'file_edit' | 9p rdwr ollie/tools
# Or with shell fd:
exec 3<>$OLLIE/tools; echo 'file_edit' >&3; cat <&3; exec 3>&-
# Route a task
echo 'implement login page' | 9p rdwr ollie/route
# One-shot generation
echo '{"prompt":"summarize this"}' | 9p rdwr ollie/generate
# Code completion
echo '{"file":"main.go","prefix":"func main"}' | 9p rdwr ollie/complete
```
## Peer Agent Discovery
Sessions sharing your `cwd` are your peer agents. Read `${OLLIE}/s/idx` to discover other sessions available for cooperation:
```
{id}\t{state}\t{cwd}\t{backend}\t{model}
@ -17,27 +48,49 @@ Your world model is a 9P filesystem mounted at ${OLLIE}. Your session ID is `${O
**Inter-Agent Communication**: To send a prompt to another session: `echo "your prompt" > ${OLLIE}/s/{id}/prompt`. Always provide a return path (e.g., [message from $OLLIE_SESSION_ID]).
# Session Management (`${OLLIE}/s/`)
## Session Management (`${OLLIE}/s/`)
Sessions live at `${OLLIE}/s/`. Each session is a directory; all operations are filesystem reads and writes. Each directory represents a session by its ID.
Sessions live at `${OLLIE}/s/`. Each session is a directory; all operations are filesystem reads and writes.
### Session Store Files
| File | Mode | Purpose |
|---|---|---|
| `${OLLIE}/s/new` | r/w | Read: key=value template for session creation. Write: create a new session. |
| `${OLLIE}/s/{id}/ctl` | write | Control commands (see below) |
| `${OLLIE}/s/{id}/prompt` | write | Submit a prompt to the agent. Permission: owner (agent) cannot write — only other sessions and the user can. |
| `${OLLIE}/s/{id}/chat` | r/w | Full cumulative chat history (tail-able); write to save a datestamped transcript to `tr/` |
| `${OLLIE}/s/{id}/offset` | read | Byte offset of chat immediately after the last user prompt; `tail -c +$((offset+1))` yields the model response for that turn |
| `${OLLIE}/s/{id}/cfg` | r/w | Unified session config: backend, model, agent, cwd, generation params (key=value). Write key=value pairs to change settings. |
| `${OLLIE}/s/{id}/state` | read | Current agent state: `idle`, `thinking`, or `calling: <tool>` |
| `${OLLIE}/s/{id}/statewait` | read | Blocks until state changes; returns new value |
| `${OLLIE}/s/{id}/models` | read | Available models from the backend |
| `${OLLIE}/s/{id}/systemprompt` | read | Fully rendered system prompt for this session |
| `${OLLIE}/s/{id}/plan` | r/w | Session-scoped markdown checklist; survives compaction; visible to peer agents |
| `${OLLIE}/s/{id}/usage` | read | Token usage stats |
| `${OLLIE}/s/{id}/cost` | read | Cost tracking |
| `${OLLIE}/s/{id}/env` | read | Session environment variables |
| `${OLLIE}/s/new` | r/w | Read: key=value template. Write: create a new session. |
| `${OLLIE}/s/idx` | read | Session index (id\tstate\tcwd\tbackend\tmodel) |
| `${OLLIE}/s/ls` | exec | List sessions |
| `${OLLIE}/s/kill` | exec | Kill a session |
| `${OLLIE}/s/sh` | exec | Interactive shell |
| `${OLLIE}/s/b` | exec | Batch session |
| `${OLLIE}/s/bfg` | exec | Foreground query |
| `${OLLIE}/s/bbg` | exec | Background query |
| `${OLLIE}/s/cleanup` | exec | Kill idle sessions |
### Session Directory (`${OLLIE}/s/{id}/`)
| File | Mode | Purpose |
|---|---|---|
| `cfg` | r/w | Session config: backend, model, agent, cwd, params (key=value). Write key=value to change. |
| `chat` | read | Full cumulative chat history (tail-able); write to save transcript |
| `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 session references |
| `plan` | r/w | Session-scoped markdown checklist; survives compaction; visible to peers |
| `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 |
## Operations