Prompt surface review

Rendering what an agent actually reads, the layering model, the structural rules, and the review pass in order.

What it is

The workflow for reviewing or engineering beebox's agent-facing prompt surface — the agent guide, chat/reactor system prompts, schema instructions, box skills, and rules. Read this when auditing the assembled prompt stack for overlap/redundancy/staleness/contradiction, checking what an agent actually sees in some situation, or after any change to prompt-generating code. Prompt lenses is the companion lens catalog for the hunt step. (For routing a single new instruction to the right box surface, use the bbx-context skill.)

The prompts are how every agent comes to understand Bee Box — what it is, what its role is, what the rules are. They are generated code (src/core/agent-guide/, src/core/chat/session/prompts.ts, src/core/reactor/prompts.ts, schema instructions, src/core/box/guidance-sync/skills/content.ts), assembled into a per-situation context stack. Review the assembled stack, not the source files: judge what an agent actually reads, end to end.

See the assembled context

cd beebox
pnpm agent-context --list                                  # the known situations
pnpm agent-context chat --box ~/src/boxes/test1            # full chat stack, layer by layer
pnpm agent-context reactor --box ~/src/boxes/test1 --card-type recipe
pnpm agent-context chat --box ~/src/boxes/test1 --skill calendar --output scratch/ctx.md

Each report shows every layer with its loading class and word count, plus the always-loaded total. pnpm prompt-report is the complementary flat inventory of every prompt in the system; agent-context is the per-situation composition.

Boxes go stale. The box-side layers (AGENTS.md, agent guide, skills, rules) are what bbx init last wrote — re-run bbx init on the box after changing generator code, or the report shows the old world. That staleness being visible is a feature, not a bug.

The layering model

Every agent's context is a stack; each layer has a loading class:

  1. Identity prompt (always) — per situation: chat, chat-thread, reactor, procedure. Says what the agent is and covers only that situation's surface.
  2. Box knowledge (always) — box AGENTS.md → compiled briefing + the agent guide. Loaded by every agent; the scarcest budget.
  3. Situational — schema instructions for the card types in play, .claude/rules/ path globs, the per-turn <chat-app> snapshot.
  4. On-demand — skill bodies, the package docs (node_modules/beebox/box-docs/*) and box-compiled docs (_content/docs/generated/*), guide cards the agent is pointed at.

Skills: description and body

Skills are two things at once: the description is always-loaded (it's the trigger) and must be pure routing — no mechanics; the body is on-demand and owns its domain's mechanics. A guide mention of a skill's domain is usually the first overlap — the description is the pointer. Name a skill rather than its SKILL.md path: a Read of the file and an invocation each load the body, so the agent can pay for it twice.

The guide/skill boundary

The guide/skill boundary is read vs. write: the always-loaded guide keeps the query surface (bbx calendar [timespan]); the skill owns authoring mechanics (VTIMEZONE, conflict resolution).

Principles

What a review hunts for (cost per bit, corrective framing, dated language, self-contradiction, examples that earn their place) is in the lens catalog.

Writing rules that get followed

The lens catalog covers giving reasons, earning examples, and separating hard rules from defaults. In addition:

When a rule on the correct tier is still ignored, the agent is usually rationalizing past it:

Review pass, in order

  1. Render the stacks (agent-context per situation) and read each end-to-end as the agent.
  2. Hunt: overlap (same concept taught twice), contradiction, dated language, claims unverified against code, weight (cost-per-bit), missing role framing. Prompt lenses is the full lens catalog for this step.
  3. Fix at the canonical home; turn the duplicate sites into cross-references (SECTION / xref).
  4. Re-render; compare layer word counts before/after.
  5. New conventions get knowledge audits; run them before calling the work done.
  6. Re-run bbx init on live boxes so the change actually ships.

Prior art: plans/prompt-surface-cleanup-evaluation.md is the worked example of a full-surface review (what was found, what each fix traded against).

Invariants: session/prompt cache

Two things any prompt-surface edit has to respect: