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
10 changes: 7 additions & 3 deletions src/agent/prompts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ function expectVerificationGuidance(prompt: string): void {
expect(prompt).not.toMatch(/relevant checks .*when practical/i);
}

// Module-scope snapshot of the repeated no-arg discipline builder. The block
// is static text for absent input, so the no-arg calls below share one value.
const PROMPT_DISCIPLINE_BLOCK = buildPromptDisciplineBlock();

describe("buildPromptDisciplineBlock", () => {
it("references only tool names that exist in the registration source", () => {
for (const name of REFERENCED_TOOL_NAMES) {
Expand All @@ -53,18 +57,18 @@ describe("buildPromptDisciplineBlock", () => {
});

it("is tight: roughly 15-25 lines", () => {
const lines = buildPromptDisciplineBlock().split("\n");
const lines = PROMPT_DISCIPLINE_BLOCK.split("\n");
expect(lines.length).toBeGreaterThanOrEqual(15);
expect(lines.length).toBeLessThanOrEqual(30);
});

it("uses prohibition form, not preference form", () => {
const block = buildPromptDisciplineBlock();
const block = PROMPT_DISCIPLINE_BLOCK;
expect(block).not.toMatch(/\bprefer\b/i);
});

it("contains the load-bearing prohibitions", () => {
const block = buildPromptDisciplineBlock();
const block = PROMPT_DISCIPLINE_BLOCK;
// Dedicated tools over shell.
expect(block).toContain("run_shell");
expect(block).toContain("cat/head/tail");
Expand Down
225 changes: 111 additions & 114 deletions src/prompts.test.ts

Large diffs are not rendered by default.

Loading
Loading