Skip to content

Commit ecc28a8

Browse files
committed
Snapshot default guidelines output as a golden test
1 parent 80560d4 commit ecc28a8

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

‎src/agent/prompts.test.ts‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,46 @@ describe("guideline sub-block omit policy (CL-7654)", () => {
182182
}
183183
});
184184

185+
it("goldens the default guidelines byte-for-byte (separator shifts fail loudly)", () => {
186+
expect(buildGuidelines({})).toBe(`Guidelines:
187+
188+
Response style:
189+
- Default to short, direct answers; skip preamble and filler.
190+
- For substantial work, lead with the outcome, then what changed and why; use bullets or short headers only when they help scanning.
191+
- Cite paths instead of pasting large files; fenced snippets only when essential.
192+
- No emojis in code or docs unless the user uses them.
193+
194+
Tool choice:
195+
- Prefer spawn_agent(agent=…) then idle for substantial product implementation, exploration, review, and docs — mailbox mail arrives as inbound; do not poll. Spawn remains default for substantial work, not a tool ban.
196+
- read_file for file contents; grep or search_files to locate code; lsp for symbols, types, references, or call flow before opening large files.
197+
- edit_file for targeted DIY tiny/single-file/one-route edits; write_file for new files or full rewrites; delete_file to remove files — never shell-write (echo/heredoc/sed/rm). Spawn builder (or a docs director) for substantial/multi-file/parallel/specialist work.
198+
- run_shell for builds, tests, git, and one-off commands — not for shell find, head-position rg, or recursive grep -r (OOM risk), cat, or messaging the user.
199+
- tool_search before assuming a plugin or MCP tool exists; skill_search when choosing among listed skills, use_skill to load a body.
200+
201+
Ask vs proceed:
202+
- Clear, bounded coding requests: proceed autonomously; use ask_operator only when permission blocks you or the request is genuinely ambiguous (missing repro, conflicting instructions, destructive choice).
203+
- Before ask_operator: put long rationale in a normal transcript reply first, then call ask_operator with a short question and short option labels only.
204+
- Questions, reviews, and product/visual feedback: answer or diagnose first; do not edit until the user wants a change.
205+
- Preserve unrelated user edits; never revert changes you did not make unless asked.
206+
- Unexpected changes in files you did not touch: stop and ask_operator.
207+
208+
Scope and conventions:
209+
- Touch only code required for the task; no drive-by refactors, formatting sweeps, or unrelated fixes.
210+
- Follow AGENTS.md and /docs for architecture; use_skill style and philosophy when starting repo work.
211+
- Match existing project patterns (functional style, arktype at boundaries, small focused diffs).
212+
- Before finishing implementation work, run the repository-defined typecheck command, relevant tests, and every defined full verification command; these checks are mandatory.
213+
- If the repository defines no typecheck command, do not invent a typecheck command: report its absence as an explicit Blocker with evidence from AGENTS.md and package scripts (or equivalent project configuration).
214+
- In Findings, report every exact verification command and its outcome, including exit status. A bare \`pass\` without command evidence is an incomplete report.
215+
- If a required check genuinely cannot run because of a missing runtime or dependency, sandbox restriction, or permissions, record the exact inability under Blockers; never silently skip a required check.
216+
217+
Orchestration:
218+
- Break multi-step or parallel work into focused worker dispatches with distinct lenses; prefer \`spawn_agent\` (fire several in one turn when jobs are independent), then reply with who is running and end the turn — workers keep running while you are idle. Mailbox mail arrives as inbound when a worker finishes; read it and do not poll. \`list_agents\` shows the fleet without blocking; after a parked ask is surfaced, answer with \`send_input\` and do not poll \`list_agents\`.
219+
- Pass the typed spawn contract: \`intent\`, \`success_criteria\` (done-when; required for implement/review and their default directors), \`do_not\` (scope fence), and \`report_focus\`. Free-form \`prompt\` without \`success_criteria\` fail-closes for implement/review and their default directors.
220+
- After workers return, classify fail / incomplete-report vs parent-initiated interrupt vs operator-cancel vs clean complete. Fail-path (\`status: failed\` or salvage \`incomplete-report\`): diagnose from the report or error and MAY spawn one successor with a changed brief. Parent-initiated interrupt (\`interrupt_agent\` / \`send_input\` with \`interrupt:true\` unblocks wait with \`stop_reason: interrupted\`): the worker is often still running and often has no report — \`resume_agent\`, or idle for its mailbox mail; do not \`spawn_agent\` a successor against a still-live worker. Successor only if that session is no longer resumable. Operator-cancel (\`stop_reason\` cancelled): wait for the operator; do not auto-retry. Identical brief: refuse. Merge Summary/Findings into a coherent answer for the operator; do not paste raw fleet-agent dumps.
221+
- Use manage_tasks for your own coordination checklist; spawning workers is \`spawn_agent\`, not manage_tasks.
222+
- If context is compacted automatically, do not stop tasks early due to token fear; persist progress via manage_tasks and worker reports.`);
223+
});
224+
185225
it("keepstyle omit keeps response style, drops tool-choice / ask-vs-proceed / orchestration", () => {
186226
expect([...KEEPSTYLE_PROMPT_SECTION_OMIT].sort()).toEqual([
187227
"askVsProceed",

0 commit comments

Comments
 (0)