From bc4c27b602294387e4f07c62713a1065c8b968ad Mon Sep 17 00:00:00 2001 From: Ollie Agent Date: Mon, 3 Aug 2026 01:06:16 +0200 Subject: [PATCH] demote plan from session level to agent level plan now lives at session/{id}/agent/{aid}/plan instead of session/{id}/plan. Moved the Leaf declaration from fs/sessionfiles.go to fs/agentfiles.go. Updated both prompt docs to match. --- data/prompts/agent-coding.md | 2 +- data/prompts/session-9p.md | 9 ++++++++- fs/agentfiles.go | 18 ++++++++++++++++++ fs/sessionfiles.go | 26 -------------------------- 4 files changed, 27 insertions(+), 28 deletions(-) diff --git a/data/prompts/agent-coding.md b/data/prompts/agent-coding.md index 55d8bdd..8c4c82d 100644 --- a/data/prompts/agent-coding.md +++ b/data/prompts/agent-coding.md @@ -5,7 +5,7 @@ You are a coding agent. - Before non-trivial tasks: inspect, plan, act, verify, update plan. - Verify means: run the build, run affected tests. Not "looks right to me". - Keep plans short, explicit, and task-focused. -- Use `${OLLIE}/session/${OLLIE_SESSION_ID}/plan` for multi-step work. +- Use `${OLLIE}/session/${OLLIE_SESSION_ID}/agent/${OLLIE_AGENT_NAME}/plan` for multi-step work. - Update the plan after major progress, blockers, or changes in approach. # Constraints diff --git a/data/prompts/session-9p.md b/data/prompts/session-9p.md index 2935885..73a4980 100644 --- a/data/prompts/session-9p.md +++ b/data/prompts/session-9p.md @@ -77,7 +77,6 @@ Sessions live at `session/`. Each session is a directory; all operations are 9P | `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. | -| `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 | @@ -87,6 +86,14 @@ 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}/`) + +Each agent in a session gets its own subdirectory with its own plan, state, and chat log. + +| File | Mode | Purpose | +|---|---|---| +| `plan` | r/w | Markdown checklist; survives compaction; visible to peers | + ## Operations ```bash diff --git a/fs/agentfiles.go b/fs/agentfiles.go index cd070c7..227249b 100644 --- a/fs/agentfiles.go +++ b/fs/agentfiles.go @@ -168,6 +168,24 @@ func listAgents(ctx HandlerCtx) ([]FsNodeDecl, error) { return []byte(fmt.Sprintf("%d\n", al.ChatOffset)), nil })), + // plan — agent plan (markdown checklist, survives compaction) + Leaf("plan", 0666, + Read(func(_ HandlerCtx) ([]byte, error) { + al.mu.RLock() + data := make([]byte, len(al.plan)) + copy(data, al.plan) + al.mu.RUnlock() + return data, nil + }), + Write(func(_ HandlerCtx, data []byte) error { + al.mu.Lock() + al.plan = make([]byte, len(data)) + copy(al.plan, data) + al.mu.Unlock() + return nil + }), + ), + // cfg — agent config (backend, model, etc.) Leaf("cfg", 0666, Read(func(_ HandlerCtx) ([]byte, error) { diff --git a/fs/sessionfiles.go b/fs/sessionfiles.go index 8f69a2b..5aceab7 100644 --- a/fs/sessionfiles.go +++ b/fs/sessionfiles.go @@ -42,32 +42,6 @@ func listSessions(ctx HandlerCtx) ([]FsNodeDecl, error) { }), ), - // plan — session plan - Leaf("plan", 0666, - Read(func(_ HandlerCtx) ([]byte, error) { - al := s.AgentLog() - if al == nil { - return nil, nil - } - al.mu.RLock() - data := make([]byte, len(al.plan)) - copy(data, al.plan) - al.mu.RUnlock() - return data, nil - }), - Write(func(_ HandlerCtx, data []byte) error { - al := s.AgentLog() - if al == nil { - return nil - } - al.mu.Lock() - al.plan = make([]byte, len(data)) - copy(al.plan, data) - al.mu.Unlock() - return nil - }), - ), - // name — mutable session name Leaf("name", 0666, Read(func(_ HandlerCtx) ([]byte, error) {