Skip to content

Commit 44df5ff

Browse files
committed
feat(prompt-variance): permit necessary rereads, discourage redundant loops
1 parent 081c161 commit 44df5ff

2 files changed

Lines changed: 39 additions & 2 deletions

File tree

‎packages/prompt-variance/src/index.ts‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,16 @@ export {
1717
// padding whitespace), so no exact tool fingerprint repeats 3x and the shared
1818
// threshold guard stays silent. This forbids that specific variation
1919
// (muse-rule precedent, CL-7869); no signature normalization ships in
20-
// first-party code. Named export rather than a family row: it travels the
20+
// first-party code. The re-read bullet is narrowed, not absolute (CL-9921):
21+
// it discourages redundant unchanged re-read loops while permitting
22+
// necessary re-reads (unread pages, changed content, targeted uncertainty
23+
// resolution, compaction-lost evidence) with a stated reason and bounded
24+
// scope. Named export rather than a family row: it travels the
2125
// ModelFamilyPolicy.promptResidual seam, composed over the gpt narrate note.
2226
export const astraResidual: string =
2327
"Tool discipline (gpt-6-astra worker):\n" +
2428
"- Never re-issue a tool call that repeats a prior call with only trivial argument changes (path prefix, offset, limit, whitespace).\n" +
25-
"- Never re-read a file you have already read this session.";
29+
"- Avoid re-reading content you already have; do not loop full-file re-reads that add no new information.\n" +
30+
"- A re-read is permitted when it adds information: unread pages (a new offset/limit range), content that changed since the last read, a targeted re-read to resolve a specific uncertainty, or evidence lost to compaction.\n" +
31+
"- A necessary re-read states its reason and bounded scope first (path, range, and the question it answers) and does not restart a broad investigation.\n" +
32+
"- Boundary: the same path with default offset/limit after a full read is redundant; the same path with a new page range or after an edit is necessary.";
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { describe, expect, test } from "bun:test";
2+
import { ASTRA_PROMPT_RESIDUAL } from "./model-family-policy.js";
3+
4+
// CL-9921: the astra residual permits necessary re-reads while still
5+
// discouraging redundant unchanged re-read loops. Each test names the
6+
// scripted scenario the wording must allow (or, for the negative
7+
// control, keep forbidding).
8+
describe("astra necessary-reread guidance (CL-9921)", () => {
9+
test("changed-file scenario: re-reading content that changed since the last read is permitted", () => {
10+
expect(ASTRA_PROMPT_RESIDUAL).toContain("changed since");
11+
});
12+
13+
test("paginated-report scenario: reading unread pages is permitted", () => {
14+
expect(ASTRA_PROMPT_RESIDUAL).toContain("unread pages");
15+
});
16+
17+
test("compacted-evidence scenario: targeted re-reads that resolve uncertainty or recover compaction-lost evidence are permitted, with a stated reason and bounded scope", () => {
18+
expect(ASTRA_PROMPT_RESIDUAL).toContain("uncertainty");
19+
expect(ASTRA_PROMPT_RESIDUAL).toContain("compaction");
20+
expect(ASTRA_PROMPT_RESIDUAL).toContain("reason and bounded scope");
21+
});
22+
23+
test("unchanged-repetition negative control: unchanged full-file re-read loops stay discouraged, the absolute ban is gone, and the boundary is stated", () => {
24+
expect(ASTRA_PROMPT_RESIDUAL).toContain("full-file re-read");
25+
expect(ASTRA_PROMPT_RESIDUAL).toContain("Boundary");
26+
expect(ASTRA_PROMPT_RESIDUAL).not.toContain(
27+
"Never re-read a file you have already read",
28+
);
29+
});
30+
});

0 commit comments

Comments
 (0)