prompts: rewrite session_9p.md to use ollie-9p CLI
Replace all raw filesystem operations (echo > file, cat file, exec fd<>) with ollie-9p commands (read, write, rdwr, create, remove). Remove /home/lkn/mnt/ollie prefix — ollie-9p handles server discovery.
This commit is contained in:
parent
47c4890037
commit
216a774477
|
|
@ -1,8 +1,8 @@
|
|||
# 9P Operational Model
|
||||
|
||||
Your world model is a 9P filesystem mounted at ${OLLIE}. Your session ID is `${OLLIE_SESSION_ID}`. Always prefer the 9P filesystem over D-Bus.
|
||||
Your world model is a 9P filesystem. Your session ID is `${OLLIE_SESSION_ID}`. Use `ollie-9p` for all filesystem operations.
|
||||
|
||||
## Root Namespace (`${OLLIE}/`)
|
||||
## Root Namespace
|
||||
|
||||
| File | Mode | Purpose |
|
||||
|---|---|---|
|
||||
|
|
@ -11,55 +11,60 @@ Your world model is a 9P filesystem mounted at ${OLLIE}. Your session ID is `${O
|
|||
| `models` | read | Available models (backend\tmodel per line) |
|
||||
| `help` | read | Help text |
|
||||
| `ctl` | write | Server control commands (e.g. `invalidate` to refresh model cache) |
|
||||
| `s/` | dir | Sessions (see below) |
|
||||
| `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. Open one r/w, write a query, then read the response from the same fd:
|
||||
|
||||
`complete`, `generate`, and `route` are request-response files:
|
||||
|
||||
```bash
|
||||
# Pick a backend+model for a task
|
||||
exec 3<>$OLLIE/route; echo 'implement login page' >&3; cat <&3; exec 3>&-
|
||||
echo 'implement login page' | ollie-9p rdwr route
|
||||
# → returns "backend=anthropic model=claude-sonnet-4-20250514"
|
||||
|
||||
# Generate text (one-shot, no session)
|
||||
exec 3<>$OLLIE/generate; echo '{"prompt":"summarize X"}' >&3; cat <&3; exec 3>&-
|
||||
echo '{"prompt":"summarize X"}' | ollie-9p rdwr generate
|
||||
# → returns the generated text
|
||||
|
||||
# Get a code completion
|
||||
exec 3<>$OLLIE/complete; echo '{"file":"main.go","prefix":"func "}' >&3; cat <&3; exec 3>&-
|
||||
echo '{"file":"main.go","prefix":"func "}' | ollie-9p rdwr complete
|
||||
# → returns completion candidates
|
||||
```
|
||||
|
||||
## Peer Agent Discovery
|
||||
|
||||
Sessions sharing your `cwd` are your peer agents. Read `${OLLIE}/session/idx` to discover other sessions available for cooperation:
|
||||
Sessions sharing your `cwd` are your peer agents. Read `session/idx` to discover other sessions available for cooperation:
|
||||
|
||||
```
|
||||
{id}\t{state}\t{cwd}\t{backend}\t{model}
|
||||
```
|
||||
|
||||
**Inter-Agent Communication**: To send a prompt to another session: `echo "your prompt" > ${OLLIE}/session/{id}/prompt`. Always provide a return path (e.g., [message from $OLLIE_SESSION_ID]).
|
||||
**Inter-Agent Communication**: To send a prompt to another session:
|
||||
```bash
|
||||
echo "your prompt" | ollie-9p write session/{id}/prompt
|
||||
```
|
||||
Always provide a return path (e.g., [message from $OLLIE_SESSION_ID]).
|
||||
|
||||
## Session Management (`${OLLIE}/session/`)
|
||||
## Session Management (`session/`)
|
||||
|
||||
Sessions live at `${OLLIE}/session/`. Each session is a directory; all operations are filesystem reads and writes.
|
||||
Sessions live at `session/`. Each session is a directory; all operations go through `ollie-9p`.
|
||||
|
||||
### Session Store Files
|
||||
|
||||
| File | Mode | Purpose |
|
||||
|---|---|---|
|
||||
| `${OLLIE}/session/new` | r/w | Read: key=value template. Write: create a new session. |
|
||||
| `${OLLIE}/session/idx` | read | Session index (id\tstate\tcwd\tbackend\tmodel) |
|
||||
| `${OLLIE}/session/ls` | exec | List sessions |
|
||||
| `${OLLIE}/session/kill` | exec | Kill a session |
|
||||
| `${OLLIE}/session/sh` | exec | Interactive shell |
|
||||
| `${OLLIE}/session/b` | exec | Batch session |
|
||||
| `${OLLIE}/session/bfg` | exec | Foreground query |
|
||||
| `${OLLIE}/session/bbg` | exec | Background query |
|
||||
| `${OLLIE}/session/cleanup` | exec | Kill idle sessions |
|
||||
| `session/new` | r/w | Read: key=value template. Write: create a new session. |
|
||||
| `session/idx` | read | Session index (id\tstate\tcwd\tbackend\tmodel) |
|
||||
| `session/ls` | exec | List sessions |
|
||||
| `session/kill` | exec | Kill a session |
|
||||
| `session/sh` | exec | Interactive shell |
|
||||
| `session/b` | exec | Batch session |
|
||||
| `session/bfg` | exec | Foreground query |
|
||||
| `session/bbg` | exec | Background query |
|
||||
| `session/cleanup` | exec | Kill idle sessions |
|
||||
|
||||
### Session Directory (`${OLLIE}/session/{id}/`)
|
||||
### Session Directory (`session/{id}/`)
|
||||
|
||||
| File | Mode | Purpose |
|
||||
|---|---|---|
|
||||
|
|
@ -92,25 +97,25 @@ Sessions live at `${OLLIE}/session/`. Each session is a directory; all operation
|
|||
|
||||
```bash
|
||||
# Discover sessions
|
||||
cat $OLLIE/session/idx
|
||||
ollie-9p read session/idx
|
||||
|
||||
# Discover sessions in same cwd
|
||||
grep "$PWD" $OLLIE/session/idx
|
||||
ollie-9p read session/idx | grep "$PWD"
|
||||
|
||||
# Spawn a session (minimal, generated ID)
|
||||
echo "cwd=$PWD" > $OLLIE/session/new
|
||||
echo "cwd=$PWD" | ollie-9p write session/new
|
||||
|
||||
# Spawn a session (named)
|
||||
printf 'name=reviewer\ncwd=%s\n' "$PWD" > $OLLIE/session/new
|
||||
printf 'name=reviewer\ncwd=%s\n' "$PWD" | ollie-9p write session/new
|
||||
|
||||
# Kill a session
|
||||
rm -r $OLLIE/session/{id}
|
||||
ollie-9p remove session/{id}
|
||||
|
||||
# Rename a session
|
||||
echo "rn newname" > $OLLIE/session/{id}/ctl
|
||||
echo "rn newname" | ollie-9p write session/{id}/ctl
|
||||
|
||||
# Send a prompt
|
||||
echo "your prompt here" > $OLLIE/session/{id}/prompt
|
||||
echo "your prompt here" | ollie-9p write session/{id}/prompt
|
||||
|
||||
# Control commands via ctl:
|
||||
# stop — interrupt the current agent turn
|
||||
|
|
@ -121,30 +126,30 @@ echo "your prompt here" > $OLLIE/session/{id}/prompt
|
|||
# cwd <path> — change the working directory
|
||||
# model <name> — switch model
|
||||
# backend <name> — switch backend
|
||||
echo "model gpt-4o" > $OLLIE/session/{id}/ctl
|
||||
echo "model gpt-4o" | ollie-9p write session/{id}/ctl
|
||||
|
||||
# Read session config (backend, model, agent, cwd, params)
|
||||
cat $OLLIE/session/{id}/cfg
|
||||
ollie-9p read session/{id}/cfg
|
||||
|
||||
# Write config changes
|
||||
echo "temperature=0.7" > $OLLIE/session/{id}/cfg
|
||||
echo "temperature=0.7" | ollie-9p write session/{id}/cfg
|
||||
|
||||
# Read most recent response
|
||||
offset=$(cat $OLLIE/session/{id}/offset)
|
||||
tail -c +$((offset + 1)) $OLLIE/session/{id}/chat
|
||||
offset=$(ollie-9p read session/{id}/offset)
|
||||
ollie-9p read session/{id}/chat | tail -c +$((offset + 1))
|
||||
|
||||
# Read current state
|
||||
cat $OLLIE/session/{id}/state
|
||||
ollie-9p read session/{id}/state
|
||||
|
||||
# Discover available models
|
||||
cat $OLLIE/session/{id}/models
|
||||
ollie-9p read session/{id}/models
|
||||
|
||||
# Add a peer link (bidirectional)
|
||||
touch $OLLIE/session/{id}/peer/{peerid}
|
||||
ollie-9p create session/{id}/peer/{peerid}
|
||||
|
||||
# Send a prompt to a peer
|
||||
echo "your message" > $OLLIE/session/{id}/peer/{peerid}
|
||||
echo "your message" | ollie-9p write session/{id}/peer/{peerid}
|
||||
|
||||
# Remove a peer link (bidirectional)
|
||||
rm $OLLIE/session/{id}/peer/{peerid}
|
||||
ollie-9p remove session/{id}/peer/{peerid}
|
||||
```
|
||||
|
|
|
|||
Reference in New Issue