From 5a946a6729c8a1f1986c30805c2a877a73228a40 Mon Sep 17 00:00:00 2001 From: Ollie Agent Date: Tue, 4 Aug 2026 21:32:26 +0200 Subject: [PATCH] fs: wire up compact/clear ctl commands through HandleCommand MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit prompts: remove session operational model (9P/DBus prompt blocks) compact and clear were dead-code comments in writeAgentCtl. Wire them through agent.HandleCommand so they actually execute. Fix context: use ctx.Session.Ctx() instead of context.Background() for proper lifecycle cancellation. Delete session_9p.md and session_dbus.md — no longer referenced. --- fs/handlers.go | 4 ++-- prompts/prompts.go | 26 ++++---------------------- 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/fs/handlers.go b/fs/handlers.go index 3905785..c28691f 100644 --- a/fs/handlers.go +++ b/fs/handlers.go @@ -636,9 +636,9 @@ func writeAgentCtl(ctx HandlerCtx, data []byte) error { case "stop": ctx.Agent.Interrupt(agent.ErrInterrupted) case "compact": - // Compact is handled via agent command mechanism + ctx.Agent.HandleCommand(ctx.Session.Ctx(), "/compact") case "clear": - // Clear is handled via agent command mechanism + ctx.Agent.HandleCommand(ctx.Session.Ctx(), "/clear") case "backend": // Backend selection via cfg case "model": diff --git a/prompts/prompts.go b/prompts/prompts.go index f5028fc..5f9dab2 100644 --- a/prompts/prompts.go +++ b/prompts/prompts.go @@ -12,12 +12,6 @@ import ( //go:embed system_prompt.md var DefaultSystemPrompt string -//go:embed session_9p.md -var Session9P string - -//go:embed session_dbus.md -var SessionDBus string - // Environment renders the environment context block with live values. @@ -41,22 +35,10 @@ Tools run in a sandbox with restricted filesystem access. Unexpected permission // OperationalModel returns the appropriate operational model text based on flags. func OperationalModel(enable9P, enableDBus bool, envVars map[string]string) string { - expand := func(s string) string { - return os.Expand(s, func(key string) string { - if v, ok := envVars[key]; ok { - return v - } - return os.Getenv(key) - }) - } - var parts []string - if enable9P { - parts = append(parts, expand(Session9P)) - } - if enableDBus { - parts = append(parts, expand(SessionDBus)) - } - return strings.Join(parts, "\n") + _ = enable9P + _ = enableDBus + _ = envVars + return "" } // ResolveSystemPrompt expands env vars in overridePath, then tries to read the