field note 011 · 2026-08-24 · agents, context
we pointed the agent at the right project, and it loaded none of it
our assistant told a client channel it couldn't reach a monitoring box it had logged into twenty minutes earlier. it had been handed none of what it knew about that box, and the first fix broke again one directory down.
the setup
we run one agent that answers in slack and telegram for several clients. each reply is a persistent session on the software development kit (sdk) that powers claude code, running on our homelab box. it has shell access, so it can ssh into things, and it has a memory directory per project: short notes on which hosts exist, how to reach them, and where the keys live.
at first every session ran from one directory, our assistant's own repo, with no project settings loaded at all. so a question from a client channel started with no idea that client's servers existed. it could find its way to a box by luck and log in, and then twenty minutes later tell the same channel it had no way to reach it. the knowledge was on disk the whole time, under a different project's name.
the obvious fix is routing: map each slack workspace to its project directory and start the session there. claude code keys both its project docs and its memory directory off the working directory, so standing in the right folder should bring the right context with it. we shipped that on 2026-08-18. the first live test came back with the context missing.
why routing did nothing
two things, both easy to reintroduce.
- a custom system prompt replaces the preset. the sdk ships a default system prompt, and that preset is the code that finds the project's
CLAUDE.mdand injects the memory index. we passed our ownsystem_promptstring (persona, voice, the rules for posting as someone), which swapped out the whole preset. the session stood in the right folder and was told nothing about it. setting_sources=["project"]only looks for a project doc in the working directory itself. some of our routes point at a container: a folder that holds several repos, each with its own doc one level down. at the container level there's nothing to find.
neither one errors. the agent answers fluently either way, and the failure only shows when it confidently denies something it can do.
so we stopped relying on the preset. fourteen minutes after routing went live, a small function read the routed project's doc and memory index from disk and appended them to our own prompt, with a fixed size budget and one instruction: don't claim you lack access to something described here without trying it first. it doesn't depend on sdk internals staying put, which we liked.