Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/loop/prompts.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { REVIEW_FAIL, REVIEW_PASS } from "./constants";

const NEWLINE_RE = /\r?\n/;
const SPAWN_TEAM_WITH_WORKTREE_ISOLATION =
"Spawn a team of agents with worktree isolation.";

const hasProofInTask = (task: string, proof: string): boolean => {
const proofLines = proof
Expand Down Expand Up @@ -47,7 +49,7 @@ export const buildWorkPrompt = (
}

parts.push(
`Spawn a team of agents. When all work is verified and once you have a proof that the task is completed, append "${doneSignal}" on its own final line.`
`${SPAWN_TEAM_WITH_WORKTREE_ISOLATION} When all work is verified and once you have a proof that the task is completed, append "${doneSignal}" on its own final line.`
);
return parts.join("\n\n");
};
Expand All @@ -71,7 +73,7 @@ export const buildReviewPrompt = (
`If the work is complete, end with "${REVIEW_PASS}" on its own final line.`
);
parts.push(
`Spawn a team of agents. Do not use "${doneSignal}" in your final line.`
`${SPAWN_TEAM_WITH_WORKTREE_ISOLATION} Do not use "${doneSignal}" in your final line.`
);
return parts.join("\n\n");
};
2 changes: 2 additions & 0 deletions tests/loop/prompts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ test("buildWorkPrompt keeps task, optional sections, and done instruction", () =
expect(prompt).toContain(
'append "<promise>DONE</promise>" on its own final line.'
);
expect(prompt).toContain("worktree isolation");
});

test("buildWorkPrompt does not duplicate proof when task already contains it", () => {
Expand All @@ -52,5 +53,6 @@ test("buildReviewPrompt includes pass and fail instructions and verification", (
expect(prompt).toContain(`end with "${REVIEW_FAIL}" on its own final line`);
expect(prompt).toContain(`end with "${REVIEW_PASS}" on its own final line`);
expect(prompt).toContain("Proof requirements:\nmust pass ci");
expect(prompt).toContain("worktree isolation");
expect(prompt).toContain('Do not use "<done/>" in your final line.');
});