diff --git a/AGENTS.md b/AGENTS.md index 668d292..428fa93 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -92,7 +92,7 @@ just test-remote - Tool scripts: emit structured output (`STATUS=ok`, `STATUS=error`). Image/LSP tools return JSON content blocks. - Prompts: markdown, concise, example-driven. Follow the pattern in existing `tools-*.md` files. ## Architecture (key concepts) -1. **One integration surface: 9P filesystem (sessions at `session/{id}/agent/{aid}/`). Tools, skills, memory on physical filesystem via env vars. +1. **One integration surface: 9P filesystem (sessions at `session/{id}/agent/{aname}/`). Tools, skills, memory on physical filesystem via env vars. 2. **Agent loop** (`agent/loop.go`): Streaming LLM call → parse tool calls → dispatch → loop until no more tool calls or max steps. 3. **Tool dispatch** (`toolsrv/`): `shell` is built-in. All others are external scripts resolved from `OLLIE_TOOLS_PATH`. 4. **Sandbox** (`sandbox/`): Landlock-based. Config in `sandbox/*.yaml` defines filesystem access per profile. diff --git a/data/prompts/session-9p.md b/data/prompts/session-9p.md index df1fc76..825f313 100644 --- a/data/prompts/session-9p.md +++ b/data/prompts/session-9p.md @@ -34,12 +34,12 @@ 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/{id}/agent/{aid}/tools` | **Loaded tools** — tools active in this agent | -| `echo "name" \| ollie-9p write session/{id}/agent/{aid}/tools` | **Load a tool** — activate it for this agent | +| `ollie-9p read session/{id}/agent/{aname}/tools` | **Loaded tools** — tools active in this agent | +| `echo "name" \| ollie-9p write session/{id}/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/{id}/agent/{aid}/tools` -- **Load a tool** — `echo "toolname" | ollie-9p write session/{id}/agent/{aid}/tools` (or use `tool_load`) +- **See loaded tools** — `ollie-9p read session/{id}/agent/{aname}/tools` +- **Load a tool** — `echo "toolname" | ollie-9p write session/{id}/agent/{aname}/tools` (or use `tool_load`) Once loaded, a tool becomes a first-class callable function with typed arguments. Load tools as needed — do not load everything upfront. @@ -91,7 +91,7 @@ Sessions live at `session/`. Each session is a directory; all operations are 9P | `tail` | exec | Tail helper | | `usage` | read | Token usage stats | -### Agent Directory (`session/{id}/agent/{aid}/`) +### Agent Directory (`session/{id}/agent/{aname}/`) Each agent in a session gets its own subdirectory with its own plan, state, and chat log. @@ -139,7 +139,7 @@ echo "temperature=0.7" | ollie-9p write session/{id}/cfg # Read most recent response offset=$(ollie-9p read session/{id}/offset) -ollie-9p read session/{id}/agent/{aid}/log | tail -c +$((offset + 1)) +ollie-9p read session/{id}/agent/{aname}/log | tail -c +$((offset + 1)) # Read current state ollie-9p read session/{id}/state diff --git a/doc/architecture.md b/doc/architecture.md index 9d19a98..5a89041 100644 --- a/doc/architecture.md +++ b/doc/architecture.md @@ -216,7 +216,7 @@ Agent configs declare prompts as a JSON array of shell commands. Each command is │ ├── elevate per-session elevation policy │ └── agent/ │ ├── new write config to create agent (rdwr) - │ └── {aid}/ + │ └── {aname}/ │ ├── prompt submit a prompt │ ├── prompt.prev last submitted prompt │ ├── fifo.in queue a prompt diff --git a/doc/evolution.md b/doc/evolution.md index c0f384d..26ea11f 100644 --- a/doc/evolution.md +++ b/doc/evolution.md @@ -220,7 +220,7 @@ Eliminated accumulated abstractions that no longer served a purpose. of `rootState.sessions`. Broke D-Bus ListSessions and GUI session restore. ### Frontends - **acme**: paths updated `s/` → `session/`, agent files route through - `session/{id}/agent/{aid}/`. + `session/{id}/agent/{aname}/`. - **ellie.el**: same path migration, added `ellie--agent-dir` for agent ID discovery. - **KDE GUI**: no changes needed (D-Bus operates on Go objects, not paths). @@ -233,7 +233,7 @@ session/ │ ├── plan session-scoped markdown checklist │ ├── env session environment │ └── agent/ -│ └── {aid}/ +│ └── {aname}/ │ ├── cfg session configuration (key=value) │ ├── ctl control commands │ ├── state current state @@ -606,7 +606,7 @@ The KDE frontend received extensive updates across both days: │ ├── elevate per-session elevation policy │ └── agent/ │ ├── new write config to create agent (rdwr) - │ └── {aid}/ + │ └── {aname}/ │ ├── prompt, prompt.prev, fifo.in, fifo.out │ ├── chat (streaming), log (64KB window) │ ├── state, statewait (blocking) @@ -700,7 +700,7 @@ The most radical simplification yet: **zero tools compiled into the Go binary.** **Before**: `tools/builtin/builtins.go` returned four Go-compiled handlers (`shell`, `reasoning_think`, `tool_list`, `tool_load`, `tool_active`). These were hard-linked into every agent's tool definition, consuming LLM context slots even when unused. The tool registry was a two-tier system: built-in handlers (Go code, always available) + script tools (loaded on demand via `tool_load`). -**After**: `tools/builtin/` was removed entirely — `builtins.go` last returned `nil`. All tools are loaded through a single convergent path: writing the tool name to `session/{id}/agent/{aid}/tools`. The `shell` and `reasoning_think` tools are now external scripts (`data/tools/shell`, `data/tools/reasoning_think`) with `.meta` sidecars — identical to `file_read`, `file_grep`, or any other tool. +**After**: `tools/builtin/` was removed entirely — `builtins.go` last returned `nil`. All tools are loaded through a single convergent path: writing the tool name to `session/{id}/agent/{aname}/tools`. The `shell` and `reasoning_think` tools are now external scripts (`data/tools/shell`, `data/tools/reasoning_think`) with `.meta` sidecars — identical to `file_read`, `file_grep`, or any other tool. ### Unified tool loading diff --git a/doc/multi-agent.md b/doc/multi-agent.md index 3c6bac8..08dfdbe 100644 --- a/doc/multi-agent.md +++ b/doc/multi-agent.md @@ -19,13 +19,13 @@ to its `name` file moves the entire directory subtree. | `/session/{name}/env` | Session environment variables | | `/session/{name}/id` | Immutable session UUID | | `/session/{name}/name` | Mutable session name (write to rename) | -| `/session/{name}/agent/{aid}/prompt` | Submit a prompt | -| `/session/{name}/agent/{aid}/chat` | Streaming chat log (blocking read) | -| `/session/{name}/agent/{aid}/cfg` | Agent config KV: backend, model, agent, cwd, params | -| `/session/{name}/agent/{aid}/statewait` | **Blocking read** — returns when state changes | -| `/session/{name}/agent/{aid}/ctl` | Control commands: `stop`, `kill`, `compact`, `rn ` | -| `/session/{name}/agent/{aid}/id` | Immutable agent ID (uname) | -| `/session/{name}/agent/{aid}/name` | Mutable display name (write to rename) | +| `/session/{name}/agent/{aname}/prompt` | Submit a prompt | +| `/session/{name}/agent/{aname}/chat` | Streaming chat log (blocking read) | +| `/session/{name}/agent/{aname}/cfg` | Agent config KV: backend, model, agent, cwd, params | +| `/session/{name}/agent/{aname}/statewait` | **Blocking read** — returns when state changes | +| `/session/{name}/agent/{aname}/ctl` | Control commands: `stop`, `kill`, `compact`, `rn ` | +| `/session/{name}/agent/{aname}/id` | Immutable agent ID (uname) | +| `/session/{name}/agent/{aname}/name` | Mutable display name (write to rename) | Global request-response files provide stateless operations without sessions: @@ -41,7 +41,7 @@ Global namespaces are shared across all sessions: |------|---------| | `/session/idx` | Session index (id, state, cwd, backend, model) | | `/session/{name}/plan` | Shared session-scoped checklist | -| `/session/{name}/agent/{aid}/chat` | Full chat history (searchable) | +| `/session/{name}/agent/{aname}/chat` | Full chat history (searchable) | ## Spawning Agents @@ -84,7 +84,7 @@ flowchart TB ``` A root agent reasons about a task and delegates subtasks to workers. Workers -report back via their chat history; the conductor reads `/session/{name}/agent/{aid}/chat` after +report back via their chat history; the conductor reads `/session/{name}/agent/{aname}/chat` after `statewait` unblocks. ```sh diff --git a/prompts/session_9p.md b/prompts/session_9p.md index d357129..a984fe2 100644 --- a/prompts/session_9p.md +++ b/prompts/session_9p.md @@ -40,9 +40,9 @@ echo '{"file":"main.go","prefix":"func "}' | ollie-9p rdwr complete | `env` | read | Session environment variables | | `agent/` | dir | Agents within this session | -## Agent Directory (`session/{sid}/agent/{aid}/`) +## Agent Directory (`session/{sid}/agent/{aname}/`) -Each agent has its own directory. The `{aid}` is the agent's numeric ID (stable, used for permissions). +Each agent has its own directory. The `{aname}` is the agent's numeric ID (stable, used for permissions). | File | Mode | Purpose | |---|---|---| @@ -89,30 +89,30 @@ ollie-9p mv session/{sid} session/{newname} # Read session plan ollie-9p read session/{sid}/plan -# --- Agent operations (from within session/{sid}/agent/{aid}/) --- +# --- Agent operations (from within session/{sid}/agent/{aname}/) --- # Send a prompt -echo "fix the bug" | ollie-9p write session/{sid}/agent/{aid}/prompt +echo "fix the bug" | ollie-9p write session/{sid}/agent/{aname}/prompt # Read state -ollie-9p read session/{sid}/agent/{aid}/state +ollie-9p read session/{sid}/agent/{aname}/state # Read chat -ollie-9p read session/{sid}/agent/{aid}/chat +ollie-9p read session/{sid}/agent/{aname}/chat # Control commands -echo "stop" | ollie-9p write session/{sid}/agent/{aid}/ctl -echo "model gpt-4o" | ollie-9p write session/{sid}/agent/{aid}/ctl -echo "compact" | ollie-9p write session/{sid}/agent/{aid}/ctl +echo "stop" | ollie-9p write session/{sid}/agent/{aname}/ctl +echo "model gpt-4o" | ollie-9p write session/{sid}/agent/{aname}/ctl +echo "compact" | ollie-9p write session/{sid}/agent/{aname}/ctl # Read/write config -ollie-9p read session/{sid}/agent/{aid}/cfg -echo "temperature=0.7" | ollie-9p write session/{sid}/agent/{aid}/cfg +ollie-9p read session/{sid}/agent/{aname}/cfg +echo "temperature=0.7" | ollie-9p write session/{sid}/agent/{aname}/cfg # Read latest response -offset=$(ollie-9p read session/{sid}/agent/{aid}/offset) -ollie-9p read session/{sid}/agent/{aid}/chat | tail -c +$((offset + 1)) +offset=$(ollie-9p read session/{sid}/agent/{aname}/offset) +ollie-9p read session/{sid}/agent/{aname}/chat | tail -c +$((offset + 1)) # Load a tool -echo "file_read" | ollie-9p write session/{sid}/agent/{aid}/tools +echo "file_read" | ollie-9p write session/{sid}/agent/{aname}/tools ``` diff --git a/prompts/system_prompt.md b/prompts/system_prompt.md index 43162db..a04a594 100644 --- a/prompts/system_prompt.md +++ b/prompts/system_prompt.md @@ -26,9 +26,9 @@ You have autonomous access to tools and skills. Proactively load what you need Tools are loaded into your session at startup (configured in the agent's `autoLoad` list). Additional tools can be loaded dynamically via the 9P filesystem: -- **List available tools** — write to `session/{id}/agent/{aid}/tools` (empty string lists all) -- **Load a tool** — write the tool name to `session/{id}/agent/{aid}/tools` -- **See loaded tools** — read from `session/{id}/agent/{aid}/tools` +- **List available tools** — write to `session/{id}/agent/{aname}/tools` (empty string lists all) +- **Load a tool** — write the tool name to `session/{id}/agent/{aname}/tools` +- **See loaded tools** — read from `session/{id}/agent/{aname}/tools` Once loaded, a tool becomes a first-class function. Call it directly by name with JSON arguments matching its schema. @@ -53,7 +53,7 @@ Skills are markdown modules that provide specialized domain knowledge, conventio **Procedure** — before reaching for `shell`, follow this sequence: 1. **Is a loaded tool already fit for purpose?** If so, use it directly. -2. **Search available tools** — check `session/{id}/agent/{aid}/tools` (read) to see what's available. Load any missing tool by writing its name there. +2. **Search available tools** — check `session/{id}/agent/{aname}/tools` (read) to see what's available. Load any missing tool by writing its name there. 3. **Only if no tool exists** for the operation, fall back to `shell`. **Common mappings** (not exhaustive):