Skip to content

Slim Buzz agent context - #6128

Closed
salman1993 wants to merge 3 commits into
mainfrom
codex/slim-agent-context
Closed

Slim Buzz agent context#6128
salman1993 wants to merge 3 commits into
mainfrom
codex/slim-agent-context

Conversation

@salman1993

@salman1993 salman1993 commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Why

Every agent turn loaded a ~16 KB prompt that was mostly procedure for tasks the turn wasn't doing. The goal isn't fewer tokens — it's a base prompt with only what an agent needs on every turn, and everything else loaded on demand.

What changed

Split into three layers. The base prompt keeps the session model, turn contract, messaging rules, and a list of buzz command groups. buzz-cli/SKILL.md is now just a router. Seven references (messaging, agents, repositories, memory, recovery, contracts, workspace) hold the details and are read one at a time.

What stays in the base prompt is based on whether the agent could find the reference when it needs it. Two cases can't be deferred: silent failures (--content 'a\nb' posts literal backslashes and succeeds, so nothing tells the agent to go read anything) and context loss (a compaction wipes out the reasoning that would say "read the recovery doc"). Rules that surface through a failed command are safe to defer.

[Context] now gives a command instead of instructions. Was four sentences of IMPORTANT: prose; now Reply: buzz messages send --channel <uuid> --reply-to <id> --content <message>. Event blocks drop what the batch already says once — channel identity, npub next to hex, and h/p/thread-e tags that are already parsed into Thread: and Mentions:. Unknown tags are kept as Metadata:.

Skill description says what it does, not what it isn't. Retrieval matches on that field. The "don't load this for ordinary replies" instruction lives in the base prompt instead.

Nest installs and version-refreshes the references next to SKILL.md, with the existing 0700 permissions and per-provider symlinks. Workspace AGENTS.md points at the references instead of repeating them.

Not in this PR

Memory injection is unchanged — engram_fetch.rs, pool.rs, and config.rs are identical to main. An earlier revision made the no-core onboarding nudge fire once per agent process. That changes injection semantics, not prompt content, so it should be reviewed separately.

Risk

Medium — this changes the prompt and per-turn event context for every managed agent. Reply, mention, and multiline rules stay inline. Prompt contract tests check the base prompt keeps its key rules and defers the rest; installer tests cover the reference tree, permissions, and version refresh. No relay protocol or event schema changes.

Main risk is under-loading: an agent not realizing it needs a reference. Worth watching in practice.

Signed-off-by: Salman Mohammed <smohammed@squareup.com>
Signed-off-by: Salman Mohammed <smohammed@squareup.com>
Revert engram_fetch.rs, pool.rs, and config.rs to main. The
once-per-agent-process onboarding latch was a change to memory
injection semantics, not to prompt content, and belongs in its own
PR where the session-invalidation behavior can be reviewed on its
own terms. This also drops a stale --no-memory doc comment that
described the intermediate no-nudge behavior.

Restore two rules to the always-on base prompt. Both guard states
in which the agent cannot discover a reference: an unreported todo
is a silent stall, and a context compaction destroys the reasoning
that would tell the agent to go read recovery guidance.

The todo rule is worded as "before you start" rather than the
original "before sending the pickup acknowledgment" so it does not
contradict the messaging rule that silence beats an
acknowledgement-only message.

Signed-off-by: Salman Mohammed <smohammed@squareup.com>
@salman1993

Copy link
Copy Markdown
Contributor Author

closing this PR since it didn't improve the benchmark, see results in #6161

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant