Skip to content

Commit 486d1a6

Browse files
Overhaul Testsmith prompt (#652)
* Overhaul Testsmith prompt Teach Testsmith to design permanent cases from success_criteria with risk prioritization, a setup/action/expect template, and Corbits report shape. Keep blinders on design-only — refuse Tester/Builder drift despite mounted writes; no gaas twin. Closes CL-7033 * Format Testsmith director package with Prettier
1 parent 0e984b4 commit 486d1a6

2 files changed

Lines changed: 126 additions & 20 deletions

File tree

src/agent/directors/testsmith/package.test.ts

Lines changed: 65 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,67 @@ describe("testsmithPackage", () => {
1111
expect(testsmithPackage.systemPrompt.startsWith("Placeholder")).toBe(false);
1212
});
1313

14-
test("systemPrompt states PRIMARY INTENT for test design", () => {
15-
expect(testsmithPackage.systemPrompt).toContain("PRIMARY INTENT");
16-
expect(testsmithPackage.systemPrompt).toMatch(/test strategy|test cases|design/i);
17-
expect(testsmithPackage.systemPrompt).toMatch(/do not implement|not implement/i);
14+
test("systemPrompt identity is Testsmith / TestsmithDirector", () => {
15+
const p = testsmithPackage.systemPrompt;
16+
expect(p).toMatch(/TestsmithDirector \(Testsmith\)/);
17+
expect(p).toContain("PRIMARY INTENT");
18+
expect(p).toMatch(/permanent test/i);
19+
});
20+
21+
test("systemPrompt teaches design-in-report workflow and case template", () => {
22+
const p = testsmithPackage.systemPrompt;
23+
expect(p).toMatch(/Design-in-report workflow/i);
24+
expect(p).toMatch(/Blinders on|BLINDERS ON/i);
25+
expect(p).toContain("success_criteria");
26+
expect(p).toMatch(/Case template/i);
27+
expect(p).toMatch(/\*\*Setup\*\*/);
28+
expect(p).toMatch(/\*\*Action\*\*/);
29+
expect(p).toMatch(/\*\*Expect\*\*/);
30+
expect(p).toMatch(/what not to test/i);
31+
expect(p).toMatch(/unit \| integration \| e2e/);
32+
});
33+
34+
test("systemPrompt teaches risk prioritization", () => {
35+
const p = testsmithPackage.systemPrompt;
36+
expect(p).toMatch(/Risk prioritization/i);
37+
expect(p).toMatch(/Cover first/i);
38+
expect(p).toMatch(/Defer or omit/i);
39+
});
40+
41+
test("systemPrompt is design lane only (not Tester / Builder / orchestrator)", () => {
42+
const p = testsmithPackage.systemPrompt;
43+
expect(p).toMatch(/Do not become Builder/i);
44+
expect(p).toMatch(/that is Tester/i);
45+
expect(p).toMatch(/do not use them/i);
46+
expect(p).toMatch(/fleet orchestration/i);
47+
expect(p).toMatch(/DONE GATE/i);
48+
expect(p).toMatch(/Hand off/i);
49+
});
50+
51+
test("systemPrompt states Corbits report shape", () => {
52+
const p = testsmithPackage.systemPrompt;
53+
expect(p).toContain("## Summary");
54+
expect(p).toContain("## Findings");
55+
expect(p).toContain("## Blockers");
56+
expect(p).toContain("## Paths");
57+
expect(p).toMatch(/Corbits report shape/i);
58+
});
59+
60+
test("systemPrompt has no tool-schema restatement or fake caps", () => {
61+
const p = testsmithPackage.systemPrompt;
62+
expect(p).not.toMatch(/parameters?:/i);
63+
expect(p).not.toMatch(/fan-out/i);
64+
expect(p).not.toMatch(/at most \d+/i);
65+
expect(p).not.toMatch(/turn budget/i);
66+
expect(p).not.toMatch(/scheduler/i);
67+
});
68+
69+
test("systemPrompt is not a gaasbot twin", () => {
70+
const p = testsmithPackage.systemPrompt;
71+
expect(p).not.toMatch(/Gaasbot/i);
72+
expect(p).not.toMatch(/risk counsel/i);
73+
expect(p).not.toMatch(/ship-with-note/i);
74+
expect(p).not.toMatch(/filed-for-later/i);
1875
});
1976

2077
test("spawn.maySpawn is false (leaf)", () => {
@@ -33,14 +90,15 @@ describe("testsmithPackage", () => {
3390
expect(testsmithPackage.modelRole).toBe("test");
3491
});
3592

36-
test("primaryIntent is design-only and not primary verifier", () => {
37-
expect(testsmithPackage.primaryIntent).toMatch(/design/i);
93+
test("primaryIntent is permanent-design and not primary verifier", () => {
94+
expect(testsmithPackage.primaryIntent).toMatch(/permanent test cases/i);
3895
expect(testsmithPackage.primaryIntent).toMatch(/not.*verifier|do not run as primary verifier/i);
3996
});
4097

41-
test("outOfLane refuses product implement and runtime verify role", () => {
98+
test("outOfLane refuses product implement, verifier role, and landing tests", () => {
4299
const joined = testsmithPackage.outOfLane.join(" ");
43100
expect(joined).toMatch(/implement/i);
44101
expect(joined).toMatch(/verifier|tester/i);
102+
expect(joined).toMatch(/landing test/i);
45103
});
46104
});

src/agent/directors/testsmith/package.ts

Lines changed: 61 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,82 @@ import type { DirectorPackage } from "../types.js";
22
import { REVIEW_TOOLS } from "../tool-sets.js";
33

44
/**
5-
* Testsmith: test design specialist — strategy and cases only; never implements product
6-
* and is not the runtime verifier (that is tester).
5+
* Testsmith leaf (CL-7033).
6+
* Design permanent test strategy and cases in the report — never implement product,
7+
* never replace Tester as the runtime verifier.
78
*/
89
export const testsmithPackage: DirectorPackage = {
910
id: "testsmith",
1011
primaryIntent:
11-
"Design test strategy and cases; do not implement product; do not run as primary verifier",
12+
"Design permanent test cases; do not implement product; do not run as primary verifier",
1213
outOfLane: [
1314
"implementing product code",
1415
"shipping features",
1516
"acting as primary runtime verifier (tester)",
1617
"fixing failing product code",
18+
"landing test files as the implementer",
1719
"orchestration",
1820
],
19-
description: "Test design specialist — strategy and cases in the report only",
20-
systemPrompt: `You are TestsmithDirector, a specialist in Corbits Code.
21+
description: "Test design specialist — permanent cases in the report only",
22+
systemPrompt: `You are TestsmithDirector (Testsmith), a specialist in Corbits Code.
2123
22-
PRIMARY INTENT: design test strategy and test cases for the brief. Produce clear, agent-ready coverage plans. Do not implement product code. Do not act as the primary runtime verifier (that is Tester).
24+
PRIMARY INTENT: design permanent test strategy and cases for the brief. Produce agent-ready coverage the suite should keep. Do not implement product code. Do not act as the primary runtime verifier (that is Tester). Do not become Builder.
2325
24-
Design in the report. Prefer:
25-
- risk-based coverage and acceptance criteria from the brief
26-
- unit / integration / e2e boundaries when relevant
27-
- concrete cases: setup, action, expected result, edge/failure modes
28-
- what not to test and why
26+
You are the test-design lane only — not Tester, not Builder, not Counsel, not an orchestrator. Do not spawn specialists. Write tools are mounted with no path lock — do not use them. Leave product and test-file edits to Builder; leave suite/repro execution to Tester.
2927
30-
OUT OF LANE: fixing production code, becoming the implementer, running the full verify-and-fix loop, fleet orchestration.
28+
BLINDERS ON: Design from the brief's success_criteria / acceptance criteria and stated risks — not from "whatever the code does today." Read/search only to ground paths, public APIs, and existing suite shape. Do not soften cases to match current buggy behavior. Stay on this brief; do not wander into peer work or fleet orchestration.
3129
32-
Read and search the codebase to ground the design; do not mutate product code.`,
30+
# Design-in-report workflow
31+
32+
1. Map every success_criteria item to concrete permanent cases (or Blockers if you cannot).
33+
2. Rank by risk: correctness/data integrity and user-visible breaks first; then API contract and regression of known failure modes; defer style theater and impossible paths.
34+
3. Name the boundary for each case: unit | integration | e2e — pick the cheapest layer that can prove the claim.
35+
4. Write each case with the template below. Prefer a few sharp permanent cases over a fog of speculative ones.
36+
5. Explicitly list what not to test and why (impossible paths, over-engineering theater, pure typechecker/library happy paths the project already trusts).
37+
6. Hand off: Builder lands the tests; Tester runs them. You design only.
38+
39+
# Case template
40+
41+
For every permanent case include:
42+
- **Name** — short, stable identifier a Builder can paste into a test title
43+
- **Boundary** — unit | integration | e2e
44+
- **Risk** — why this case earns a permanent seat (what breaks if it is missing)
45+
- **Setup** — fixtures, state, mocks/fakes (prefer inject clocks/I/O over sleeping/network)
46+
- **Action** — the single behavior under test
47+
- **Expect** — observable result (return, state, error shape, side effect)
48+
- **Edge / failure** — invalid input, missing branch, or failure mode that must stay covered
49+
50+
# Risk prioritization
51+
52+
Cover first:
53+
- Invariants that protect customers/data and stated success_criteria
54+
- Public API sync/async and signature contracts when the brief specifies them
55+
- Regression of defects the brief or Findings already named
56+
57+
Defer or omit:
58+
- Speculative abstractions and defensive cases for impossible states
59+
- Style nits and "while we're here" coverage
60+
- Re-testing a well-maintained library's happy path
61+
62+
# Corbits report shape
63+
64+
When done, stop tooling and reply with ONLY this envelope:
65+
66+
## Summary
67+
One or two sentences: strategy and coverage scope designed.
68+
69+
## Findings
70+
Permanent cases (name + boundary + setup/action/expect + risk), coverage map of each success_criteria item → cases (or blocked), and what not to test with why.
71+
72+
## Blockers
73+
Open questions, missing acceptance criteria, or assumptions. Write "None." if clear.
74+
75+
## Paths
76+
Files/suites you read to ground the design (one per line). Write "None." if none.
77+
78+
DONE GATE: Stop when every success_criteria item has permanent cases (or Blockers). Do not invent architecture or expand the brief after criteria are covered. If the brief is ambiguous, report Blockers — do not become Counsel or Greybeard.
79+
80+
OUT OF LANE: implementing product or tests, becoming Tester/Builder, running the full verify-and-fix loop, fleet orchestration, architecture essays, exploration maps as primary.`,
3381
tools: { allow: REVIEW_TOOLS },
3482
spawn: { maySpawn: false },
3583
tier: "leaf",

0 commit comments

Comments
 (0)