Skip to content

Commit 0e7935f

Browse files
committed
feat(agent): merge grok ceremony lines into the one residual
1 parent ec02a7e commit 0e7935f

2 files changed

Lines changed: 34 additions & 7 deletions

File tree

‎src/agent/model-family-policy.ts‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,34 @@ const MUSE_POLICY: Omit<ModelFamilyPolicy, "family"> = {
109109
toolDisciplineRules: MUSE_TOOL_DISCIPLINE_RULES,
110110
};
111111

112+
// Single grok prompt residual (CL-8296): the finish-bias bullets plus the
113+
// three ceremony lines from the CL-7768 design (no git, no pre-plan, verify
114+
// once), merged into one block with no line twice. The don't re-read idea
115+
// appears exactly once (the "re-open paths" bullet) — it is not repeated.
116+
// Grok-only: detectModelFamily has no glm family, so per the <30min rule no
117+
// GLM row ships here. The text lives here once; buildGrokLeafAntiThrashNote
118+
// (prompts.ts) returns it verbatim, so the prompt carries exactly one grok
119+
// residual and the sibling CL-8297 hook resolves to the same block.
120+
const GROK_PROMPT_RESIDUAL = [
121+
"Finish bias (xAI / Grok worker):",
122+
"- Once you can answer the dispatch brief, prefer the structured report over another speculative tool call.",
123+
"- If the next call would only re-open paths you already read, write the report instead.",
124+
"- When the dispatch brief's done-definition is met, write the report envelope instead of making one more search or micro-edit.",
125+
"- Route file and web work through the dedicated tools, never run_shell — mining showed grok reaching for shell first when a typed tool already covered the job.",
126+
"- Never run git add, git commit, git stash, or any other state-changing git command unless the user asks.",
127+
"- Do not narrate a plan before acting on a small task; act, then report.",
128+
"- Verify with the test command once at the end, not after every edit.",
129+
].join("\n");
130+
131+
/**
132+
* Minimal per-family prompt residual hook. The sibling CL-8297 owns the
133+
* canonical hook; this local copy keeps the branch self-contained so tests
134+
* pass standalone — the two reconcile when CL-8297 lands.
135+
*/
136+
export function promptResidual(family: ModelFamily): string {
137+
return family === "grok" ? GROK_PROMPT_RESIDUAL : "";
138+
}
139+
112140
export function resolveModelFamilyPolicy(input: {
113141
providerName: string;
114142
model?: string;

‎src/agent/prompts.ts‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
buildWorkerContract,
1212
buildWorkerToolNames,
1313
} from "./worker-contract.js";
14+
import { promptResidual } from "./model-family-policy.js";
1415

1516
// Advertise every gated core tool when the caller has no session-start facts
1617
// (tests, ad-hoc prompt previews) — except wait_agents, which is mount-gated:
@@ -511,14 +512,12 @@ export function buildSubAgentReportContract(
511512
// Tiny residual for Grok/xAI workers: mining showed higher tools-only thrash
512513
// than Codex on the same harness. Shared thrash harness + spawn contracts do
513514
// the structural work; this is only a finish-bias nudge, not a full rewrite.
515+
// Single source of truth is the promptResidual("grok") block in
516+
// model-family-policy.ts (CL-8296 merged the three ceremony lines into it);
517+
// this composes that block verbatim so the prompt carries one grok residual
518+
// with no line twice.
514519
export function buildGrokLeafAntiThrashNote(): string {
515-
return [
516-
"Finish bias (xAI / Grok worker):",
517-
"- Once you can answer the dispatch brief, prefer the structured report over another speculative tool call.",
518-
"- If the next call would only re-open paths you already read, write the report instead.",
519-
"- When the dispatch brief's done-definition is met, write the report envelope instead of making one more search or micro-edit.",
520-
"- Route file and web work through the dedicated tools, never run_shell — mining showed grok reaching for shell first when a typed tool already covered the job.",
521-
].join("\n");
520+
return promptResidual("grok");
522521
}
523522

524523
export function buildSubAgentSystemPrompt(

0 commit comments

Comments
 (0)