remove session_dbus and session_9p, merge 9P filesystem into system_prompt

This commit is contained in:
Ollie Agent 2026-08-04 20:20:30 +02:00
parent 491f259a2b
commit 5c0e6b7a58
3 changed files with 111 additions and 276 deletions

View File

@ -1,118 +0,0 @@
# 9P Operational Model
Your world model is a 9P filesystem. Your session ID is `${OLLIE_SESSION_ID}`. Use `ollie-9p` for all filesystem operations.
## 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) |
| `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:
```bash
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
```
## Session Management (`session/`)
| File | Mode | Purpose |
|---|---|---|
| `session/new` | r/w | Write key=value to 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 |
|---|---|---|
| `plan` | r/w | Session-scoped markdown checklist; survives compaction |
| `env` | read | Session environment variables |
| `agent/` | dir | Agents within this session |
## Agent Directory (`session/{sname}/agent/{aname}/`)
Each agent has its own directory. The `{aname}` is the agent's numeric ID (stable, used for permissions).
| File | Mode | Purpose |
|---|---|---|
| `prompt` | write | Submit a prompt to this agent |
| `prompt.prev` | read | Previous prompt text |
| `fifo.in` | write | Queue a prompt (FIFO input) |
| `fifo.out` | read | Pop queued prompt (FIFO output) |
| `chat` | read | Agent conversation history (tail-able) |
| `offset` | read | Byte offset after last user prompt |
| `state` | read | Current state: `idle`, `thinking`, or `calling: <tool>` |
| `statewait` | read | Blocks until state changes; returns new value |
| `cfg` | r/w | Agent config: backend, model, cwd, params (key=value) |
| `ctl` | write | Control: stop, compact, clear, model, backend, cwd |
| `usage` | read | Token usage stats |
| `cost` | read | Estimated cost |
| `ctxsz` | read | Context size |
| `models` | read | Available models for current backend |
| `systemprompt` | read | Fully rendered system prompt |
| `context` | read | Rendered context window |
| `tools` | r/w | Write tool name to load. Read: list all available tools |
| `tools.loaded`| read | Currently loaded tools |
| `tools.rev` | read | Revision counter — bumps each time a tool is loaded |
| `react` | write | Send a reaction to the last response |
| `reactions` | read | Reaction history |
| `tail` | exec | Tail helper |
| `proc/` | dir | Detached background processes |
## Operations
```bash
# Discover sessions
ollie-9p read session/idx
# Spawn a session
echo "cwd=$PWD" | ollie-9p write session/new
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}
# Read session plan
ollie-9p read session/{sname}/plan
# --- Agent operations (from within session/{sname}/agent/{aname}/) ---
# Send a prompt
echo "fix the bug" | ollie-9p write session/{sname}/agent/{aname}/prompt
# Read state
ollie-9p read session/{sname}/agent/{aname}/state
# Read chat
ollie-9p read session/{sname}/agent/{aname}/chat
# Control commands
echo "stop" | ollie-9p write session/{sname}/agent/{aname}/ctl
echo "model gpt-4o" | ollie-9p write session/{sname}/agent/{aname}/ctl
echo "compact" | ollie-9p write session/{sname}/agent/{aname}/ctl
# Read/write config
ollie-9p read session/{sname}/agent/{aname}/cfg
echo "temperature=0.7" | ollie-9p write session/{sname}/agent/{aname}/cfg
# Read latest response
offset=$(ollie-9p read session/{sname}/agent/{aname}/offset)
ollie-9p read session/{sname}/agent/{aname}/chat | tail -c +$((offset + 1))
# Load a tool
echo "file_read" | ollie-9p write session/{sname}/agent/{aname}/tools
```

View File

@ -1,158 +0,0 @@
# D-Bus Operational Model
Fallback interface when 9P is unavailable. If the 9P filesystem is mounted, use it instead.
The `org.ollie.SessionManager` D-Bus service runs on the session bus. Your session ID is `${OLLIE_SESSION_ID}`.
**Service coordinates:**
- Service: `org.ollie.SessionManager`
- Object: `/org/ollie/SessionManager`
- Interface: `org.ollie.SessionManager`
**Data directories** (local filesystem, read-only to the agent):
- `~/.config/ollie/prompts/` — Prompt templates
- `~/.config/ollie/skills/` — Domain-specific knowledge files
- `~/.config/ollie/tools/` — Tool scripts
- `~/.config/ollie/memory/` — Persistent memory files
- `~/.config/ollie/agents/` — Agent definitions (JSON)
**Peer Agent Discovery**: Use `ListSessions` to discover other active sessions:
```sh
dbus-send --session --dest=org.ollie.SessionManager --type=method_call --print-reply \
/org/ollie/SessionManager org.ollie.SessionManager.ListSessions
```
Each entry: `id\tstate\tmodel\tagent`
**Inter-Agent Communication**: Use `PeerSubmit` to send a prompt to another session. Always provide a return path (e.g., [message from $OLLIE_SESSION_ID]).
## Methods
All session operations go through the D-Bus interface.
### Session Lifecycle
| Method | Args | Returns | Purpose |
|---|---|---|---|
| `CreateSession` | cwd, backend, model, agent, system_prompt, remote | session_id | Create a new session |
| `ListSessions` | — | array of "id\tstate\tmodel\tagent" | Discover sessions |
| `KillSession` | session_id | bool | Terminate a session |
| `RenameSession` | session_id, new_name | bool | Rename a session |
### Agent Interaction
| Method | Args | Returns | Purpose |
|---|---|---|---|
| `Submit` | session_id, prompt | bool | Submit a prompt to an agent |
| `Interrupt` | session_id | bool | Interrupt current agent turn |
| `Compact` | session_id | bool | Compact conversation history |
| `ClearContext` | session_id | bool | Clear conversation history |
### Session State
| Method | Args | Returns | Purpose |
|---|---|---|---|
| `GetState` | session_id | state | Current state: `idle`, `thinking`, `calling: <tool>` |
| `GetChat` | session_id, offset | text, new_offset | Read chat output from byte offset |
| `GetConfig` | session_id | key=value text | Read session config (model, backend, agent, cwd, state) |
| `SetConfig` | session_id, key, value | bool | Change a config setting (model, cwd) |
| `GetContext` | session_id | JSONL | Full conversation context as JSONL messages |
| `GetContextSize` | session_id | string | Context token size |
| `GetUsage` | session_id | string | Token usage stats |
| `GetCost` | session_id | string | Cost tracking |
| `GetEnv` | session_id | key=value text | Session environment variables |
| `GetPlan` | session_id | string | Read session plan |
| `SetPlan` | session_id, plan | bool | Write session plan |
| `GetSystemPrompt` | session_id | string | Rendered system prompt |
| `GetPreviousPrompt` | session_id | string | Previous prompt text |
### Peers
| Method | Args | Returns | Purpose |
|---|---|---|---|
| `PeerAdd` | session_id, peer_id | bool | Add bidirectional peer link (both sides updated) |
| `PeerRemove` | session_id, peer_id | bool | Remove bidirectional peer link (both sides updated) |
| `PeerList` | session_id | array of peer_ids | List peers |
| `PeerSubmit` | session_id, peer_id, prompt | bool | Send prompt to peer |
### Detached Processes
| Method | Args | Returns | Purpose |
|---|---|---|---|
| `DetachProcess` | session_id | bool | Detach current running process to background |
| `ListDetached` | session_id | array of "pid\tcmd\tstarted\tstatus" | List background processes |
| `SignalDetached` | session_id, pid, signal | bool | Send signal (TERM, KILL) to detached process |
| `GetDetachedOutput` | session_id, pid | string | Read output from detached process |
| `DismissDetached` | session_id, pid | bool | Dismiss a finished detached process |
### Global Services
| Method | Args | Returns | Purpose |
|---|---|---|---|
| `ListBackends` | — | array of names | Available backends |
| `ListModels` | session_id | array of names | Models for session's backend |
| `ListAgents` | — | array of names | Available agent definitions |
| `Generate` | prompt, system, backend, model | string | One-shot LLM generation (no session needed) |
| `Route` | task, backend | "backend=X model=Y" | Pick a backend+model for a task |
| `Complete` | cwd, file, prefix, suffix, context | string | Code completion |
## Signals
| Signal | Args | Purpose |
|---|---|---|
| `SessionCreated` | session_id | New session appeared |
| `SessionKilled` | session_id | Session terminated |
| `SessionRenamed` | old_id, new_id | Session renamed |
| `StateChanged` | session_id, state | Agent state transition |
| `ChatUpdated` | session_id, offset, text | New chat output available |
| `ProcessDetached` | session_id | A process was detached |
| `ProcessExited` | session_id, pid, exit_code | A detached process finished |
## Operations
```bash
# Discover sessions
dbus-send --session --dest=org.ollie.SessionManager --type=method_call --print-reply \
/org/ollie/SessionManager org.ollie.SessionManager.ListSessions
# Create a session
dbus-send --session --dest=org.ollie.SessionManager --type=method_call --print-reply \
/org/ollie/SessionManager org.ollie.SessionManager.CreateSession \
string:"$PWD" string:"" string:"" string:"default" string:"" string:""
# Submit a prompt
dbus-send --session --dest=org.ollie.SessionManager --type=method_call \
/org/ollie/SessionManager org.ollie.SessionManager.Submit \
string:"SESSION_ID" string:"your prompt here"
# Get chat output (use gdbus for multi-return)
gdbus call --session --dest org.ollie.SessionManager \
--object-path /org/ollie/SessionManager \
--method org.ollie.SessionManager.GetChat "SESSION_ID" 0
# One-shot generation (no session)
gdbus call --session --dest org.ollie.SessionManager \
--object-path /org/ollie/SessionManager \
--method org.ollie.SessionManager.Generate "summarize this" "" "" ""
# Route a task
gdbus call --session --dest org.ollie.SessionManager \
--object-path /org/ollie/SessionManager \
--method org.ollie.SessionManager.Route "implement login page" ""
# Code completion
gdbus call --session --dest org.ollie.SessionManager \
--object-path /org/ollie/SessionManager \
--method org.ollie.SessionManager.Complete "$PWD" "main.go" "func " "" ""
# Send prompt to peer
dbus-send --session --dest=org.ollie.SessionManager --type=method_call \
/org/ollie/SessionManager org.ollie.SessionManager.PeerSubmit \
string:"MY_SESSION" string:"PEER_SESSION" string:"your prompt"
# Kill a session
dbus-send --session --dest=org.ollie.SessionManager --type=method_call \
/org/ollie/SessionManager org.ollie.SessionManager.KillSession \
string:"SESSION_ID"
```

View File

@ -107,3 +107,114 @@ The user can react to your previous response with an emoji. Reactions appear in
- 🤔 — confused — The response was unclear or confusing.
The reaction counters are tracked as `positiveReactions` and `negativeReactions` on the session state. A high ratio of negative:positive indicates you need to change approach. Do not acknowledge reactions verbally. Silently adjust your behavior. Multiple negative reactions in a row mean you are fundamentally on the wrong track.
# 9P Filesystem
Your world model is a 9P filesystem. Your session ID is `${OLLIE_SESSION_ID}`. Use `ollie-9p` for all filesystem operations.
## 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) |
| `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:
```bash
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
```
## Session Management (`session/`)
| File | Mode | Purpose |
|---|---|---|
| `session/new` | r/w | Write key=value to 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 |
|---|---|---|
| `plan` | r/w | Session-scoped markdown checklist; survives compaction |
| `env` | read | Session environment variables |
| `agent/` | dir | Agents within this session |
## Agent Directory (`session/{sname}/agent/{aname}/`)
Each agent has its own directory. The `{aname}` is the agent's numeric ID (stable, used for permissions).
| File | Mode | Purpose |
|---|---|---|
| `prompt` | write | Submit a prompt to this agent |
| `prompt.prev` | read | Previous prompt text |
| `fifo.in` | write | Queue a prompt (FIFO input) |
| `fifo.out` | read | Pop queued prompt (FIFO output) |
| `chat` | read | Agent conversation history (tail-able) |
| `offset` | read | Byte offset after last user prompt |
| `state` | read | Current state: `idle`, `thinking`, or `calling: <tool>` |
| `statewait` | read | Blocks until state changes; returns new value |
| `cfg` | r/w | Agent config: backend, model, cwd, params (key=value) |
| `ctl` | write | Control: stop, compact, clear, model, backend, cwd |
| `usage` | read | Token usage stats |
| `cost` | read | Estimated cost |
| `ctxsz` | read | Context size |
| `models` | read | Available models for current backend |
| `systemprompt` | read | Fully rendered system prompt |
| `context` | read | Rendered context window |
| `tools` | r/w | Write tool name to load. Read: list all available tools |
| `tools.loaded`| read | Currently loaded tools |
| `tools.rev` | read | Revision counter — bumps each time a tool is loaded |
| `react` | write | Send a reaction to the last response |
| `reactions` | read | Reaction history |
| `tail` | exec | Tail helper |
| `proc/` | dir | Detached background processes |
## Operations
```bash
# Spawn a session
echo "cwd=$PWD" | ollie-9p write session/new
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 "fix the bug" | ollie-9p write session/{sname}/agent/{aname}/prompt
# Read state
ollie-9p read session/{sname}/agent/{aname}/state
# Read chat
ollie-9p read session/{sname}/agent/{aname}/chat
# Control commands
echo "stop" | ollie-9p write session/{sname}/agent/{aname}/ctl
echo "model gpt-4o" | ollie-9p write session/{sname}/agent/{aname}/ctl
echo "compact" | ollie-9p write session/{sname}/agent/{aname}/ctl
# Read/write config
ollie-9p read session/{sname}/agent/{aname}/cfg
echo "temperature=0.7" | ollie-9p write session/{sname}/agent/{aname}/cfg
# Read latest response
offset=$(ollie-9p read session/{sname}/agent/{aname}/offset)
ollie-9p read session/{sname}/agent/{aname}/chat | tail -c +$((offset + 1))
# Load a tool
echo "file_read" | ollie-9p write session/{sname}/agent/{aname}/tools
```