oc-pilot 0.97.0 → 0.99.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,110 @@
1
+ import assert from "node:assert/strict";
2
+ import test from "node:test";
3
+ import { buildDiffFacts, buildPolygraphPrompt, checkClaim, evaluatePolygraph, parsePolygraphClaims, renderPolygraph, } from "./polygraph.js";
4
+ const FULL_DIFF = [
5
+ "diff --git a/src/app.ts b/src/app.ts",
6
+ "--- a/src/app.ts",
7
+ "+++ b/src/app.ts",
8
+ "@@ -1,1 +1,3 @@",
9
+ " export const value = 1;",
10
+ "+export function login(req) {",
11
+ "+ return eval(req.query.code);",
12
+ "+}",
13
+ "diff --git a/src/app.test.ts b/src/app.test.ts",
14
+ "new file mode 100644",
15
+ "--- /dev/null",
16
+ "+++ b/src/app.test.ts",
17
+ "@@ -0,0 +1,2 @@",
18
+ '+import { login } from "./app.js";',
19
+ '+test("login", () => {});',
20
+ "diff --git a/package.json b/package.json",
21
+ "--- a/package.json",
22
+ "+++ b/package.json",
23
+ "@@ -1,3 +1,4 @@",
24
+ " {",
25
+ '+ "zod": "^3.23.8",',
26
+ ' "name": "x"',
27
+ " }",
28
+ "diff --git a/old.ts b/old.ts",
29
+ "deleted file mode 100644",
30
+ "--- a/old.ts",
31
+ "+++ /dev/null",
32
+ "@@ -1,1 +0,0 @@",
33
+ "-export const old = 1;",
34
+ "",
35
+ ].join("\n");
36
+ function claim(kind, text, polarity = "positive") {
37
+ return { kind, text, polarity };
38
+ }
39
+ test("parsePolygraphClaims accepts strict JSON and normalizes unknown kinds", () => {
40
+ const parsed = parsePolygraphClaims('```json\n{"claims":[{"kind":"test-added","text":"adds a regression test"},{"kind":"nonsense","text":"no new deps","negated":true}]}\n```');
41
+ assert.equal(parsed?.length, 2);
42
+ assert.deepEqual(parsed?.[0], { kind: "test-added", text: "adds a regression test", polarity: "positive" });
43
+ assert.equal(parsed?.[1]?.kind, "other");
44
+ assert.equal(parsed?.[1]?.polarity, "negative");
45
+ assert.deepEqual(parsePolygraphClaims('{"claims":[]}'), []);
46
+ assert.deepEqual(parsePolygraphClaims('{"claims":[{"text":""}]}'), []);
47
+ assert.equal(parsePolygraphClaims("not json"), undefined);
48
+ });
49
+ test("buildPolygraphPrompt asks for strict JSON claims and includes the message and diff", () => {
50
+ const prompt = buildPolygraphPrompt("adds a test and no behavior change", FULL_DIFF);
51
+ assert.match(prompt, /strict JSON/);
52
+ assert.match(prompt, /test-added/);
53
+ assert.match(prompt, /negative/);
54
+ assert.match(prompt, /adds a test and no behavior change/);
55
+ assert.match(prompt, /diff --git a\/src\/app\.ts/);
56
+ });
57
+ test("buildDiffFacts extracts files, tests, dependencies and changed lines", () => {
58
+ const facts = buildDiffFacts(FULL_DIFF);
59
+ assert.deepEqual(facts.added, ["src/app.test.ts"]);
60
+ assert.deepEqual(facts.removed, ["old.ts"]);
61
+ assert.ok(facts.modified.includes("src/app.ts"));
62
+ assert.ok(facts.modified.includes("package.json"));
63
+ assert.equal(facts.testsTouched, true);
64
+ assert.equal(facts.docsTouched, false);
65
+ assert.equal(facts.behaviorTouched, true);
66
+ assert.ok(facts.dependencies.includes("zod"));
67
+ assert.ok(facts.addedLines.some((line) => line.path === "src/app.ts" && line.line === 2));
68
+ });
69
+ test("checkClaim supports, contradicts and leaves claims unverifiable", () => {
70
+ const facts = buildDiffFacts(FULL_DIFF);
71
+ assert.equal(checkClaim(claim("test-added", "adds a regression test"), facts).status, "supported");
72
+ assert.equal(checkClaim(claim("file-added", "adds `src/app.test.ts`"), facts).status, "supported");
73
+ assert.equal(checkClaim(claim("file-added", "adds `src/missing.ts`"), facts).status, "contradicted");
74
+ assert.equal(checkClaim(claim("file-removed", "removes `old.ts`"), facts).status, "supported");
75
+ assert.equal(checkClaim(claim("api-change", "changes the public API"), facts).status, "supported");
76
+ assert.equal(checkClaim(claim("dependency", "adds `zod`"), facts).status, "supported");
77
+ assert.equal(checkClaim(claim("dependency", "adds `lodash`"), facts).status, "contradicted");
78
+ assert.equal(checkClaim(claim("docs", "updates the README"), facts).status, "contradicted");
79
+ assert.equal(checkClaim(claim("security", "improves security"), facts).status, "contradicted");
80
+ assert.equal(checkClaim(claim("behavior", "no behavior change", "negative"), facts).status, "contradicted");
81
+ assert.equal(checkClaim(claim("refactor", "pure refactor"), facts).status, "unverifiable");
82
+ assert.equal(checkClaim(claim("other", "makes the code nicer"), facts).status, "unverifiable");
83
+ });
84
+ test("evaluatePolygraph reports contradicted claims with evidence", () => {
85
+ const report = evaluatePolygraph(FULL_DIFF, [claim("test-added", "adds a regression test"), claim("docs", "updates the README")], "staged");
86
+ assert.equal(report.status, "contradicted");
87
+ assert.equal(report.counts.supported, 1);
88
+ assert.equal(report.counts.contradicted, 1);
89
+ assert.match(report.summary, /\[CLAIM CONTRADICTED\]/);
90
+ assert.match(report.content, /src\/app\.test\.ts/);
91
+ assert.match(report.content, /документация не тронута/);
92
+ });
93
+ test("evaluatePolygraph verifies consistent claims and marks empty input inconclusive", () => {
94
+ const verified = evaluatePolygraph(FULL_DIFF, [claim("test-added", "adds a regression test"), claim("file-added", "adds `src/app.test.ts`")], "staged");
95
+ assert.equal(verified.status, "verified");
96
+ assert.match(verified.summary, /\[POLYGRAPH VERIFIED\]/);
97
+ const empty = evaluatePolygraph(FULL_DIFF, [], "staged");
98
+ assert.equal(empty.status, "inconclusive");
99
+ assert.match(empty.summary, /\[POLYGRAPH INCONCLUSIVE\]/);
100
+ const other = evaluatePolygraph(FULL_DIFF, [claim("other", "improves the vibe")], "staged");
101
+ assert.equal(other.status, "inconclusive");
102
+ });
103
+ test("renderPolygraph shows status, claims and evidence", () => {
104
+ const report = evaluatePolygraph(FULL_DIFF, [claim("test-added", "adds a regression test")], "staged");
105
+ const text = renderPolygraph(report);
106
+ assert.match(text, /Polygraph: verified/);
107
+ assert.match(text, /test-added/);
108
+ assert.match(text, /src\/app\.test\.ts/);
109
+ });
110
+ //# sourceMappingURL=polygraph.test.js.map
@@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4BAA4B,CAAC,CAAC;IAE1D,MAAM,KAAK,GAAG,iBAAiB,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;IAC5F,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;AAC7C,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,mDAAmD,EAAE,GAAG,EAAE;IAC7D,MAAM,MAAM,GAAG,iBAAiB,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,YAAY,EAAE,wBAAwB,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;IACvG,MAAM,IAAI,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IACrC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,qBAAqB,CAAC,CAAC;IAC1C,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;IACjC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,oBAAoB,CAAC,CAAC;AAC3C,CAAC,CAAC,CAAC"}
@@ -52,6 +52,8 @@ test("MCP advertises prompts and renders them with arguments", () => {
52
52
  "interrogate-the-blindfold",
53
53
  "falsify-the-diff",
54
54
  "raise-antibodies",
55
+ "cross-examine-the-claim",
56
+ "stamp-the-passport",
55
57
  "prune-senescent-code",
56
58
  "scan-for-injection",
57
59
  "compile-hologram",
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-prompts.test.js","sourceRoot":"","sources":["../src/mcp-prompts.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAA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IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;QACpE,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;QAChC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;QAC/B,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;QAEnE,MAAM,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,EAAE,MAA4D,CAAC;QACzF,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAClC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,IAAI,EAAE,EAAE,WAAW,CAAC,CAAC;QAExD,MAAM,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,EAAE,MAA4D,CAAC;QAC1F,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACnC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,IAAI,EAAE,EAAE,WAAW,CAAC,CAAC;IAC3D,CAAC;YAAS,CAAC;QACT,MAAM,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAChD,CAAC;AACH,CAAC,CAAC,CAAC"}
package/dist/mcp.js CHANGED
@@ -1189,6 +1189,67 @@ const TOOLS = [
1189
1189
  },
1190
1190
  },
1191
1191
  },
1192
+ {
1193
+ name: "polygraph",
1194
+ description: "Verify the claims in a commit message or PR body against the real diff. The model extracts falsifiable claims and deterministic checks mark each one supported, contradicted or unverifiable. Model-backed, read-only and limited to what the diff can prove.",
1195
+ annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
1196
+ inputSchema: {
1197
+ type: "object",
1198
+ additionalProperties: false,
1199
+ properties: {
1200
+ commit: { type: "string", description: "Commit ref; uses its message and its own diff" },
1201
+ message: { type: "string", description: "Commit message or PR body" },
1202
+ message_file: { type: "string", description: "Repository-relative file with the message" },
1203
+ claims: {
1204
+ type: "array",
1205
+ description: "Pre-extracted claims; skips the model call",
1206
+ items: {
1207
+ type: "object",
1208
+ required: ["kind", "text"],
1209
+ properties: {
1210
+ kind: { type: "string", enum: ["test-added", "file-added", "file-removed", "api-change", "dependency", "docs", "security", "behavior", "refactor", "other"] },
1211
+ text: { type: "string" },
1212
+ polarity: { type: "string", enum: ["positive", "negative"] },
1213
+ },
1214
+ },
1215
+ },
1216
+ diff: { type: "string", description: "Unified diff text; omit to use the project's git diff" },
1217
+ base: { type: "string" },
1218
+ staged: { type: "boolean" },
1219
+ unstaged: { type: "boolean" },
1220
+ include_untracked: { type: "boolean" },
1221
+ fail_on: { type: "string", enum: ["contradicted", "unverifiable"] },
1222
+ strict: { type: "boolean", description: "Fail on unverifiable claims too" },
1223
+ ...RESULT_PROPERTIES,
1224
+ },
1225
+ },
1226
+ },
1227
+ {
1228
+ name: "passport",
1229
+ description: "Record and verify a provenance manifest for a commit or the current worktree: commit, tree, file hashes, agent, model and recorded checks, bound by a digest. Actions: write, verify, show, clear. write/clear write files and need --allow-write.",
1230
+ annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false },
1231
+ inputSchema: {
1232
+ type: "object",
1233
+ additionalProperties: false,
1234
+ required: ["action"],
1235
+ properties: {
1236
+ action: { type: "string", enum: ["write", "verify", "show", "clear"] },
1237
+ commit: { type: "string", description: "Commit ref for an immutable commit passport" },
1238
+ agent: { type: "string", description: "Who produced the change" },
1239
+ model: { type: "string", description: "Model used for the change" },
1240
+ prompt_hash: { type: "string", description: "Hash of the prompt or session" },
1241
+ checks: {
1242
+ type: "array",
1243
+ description: "Recorded checks as name=pass|warn|fail|skip",
1244
+ items: { type: "string" },
1245
+ },
1246
+ include_untracked: { type: "boolean" },
1247
+ markdown: { type: "boolean", description: "Render show as Markdown for a PR" },
1248
+ force: { type: "boolean", description: "Confirm clear" },
1249
+ ...RESULT_PROPERTIES,
1250
+ },
1251
+ },
1252
+ },
1192
1253
  {
1193
1254
  name: "apoptosis",
1194
1255
  description: "Scan functions marked /* @lifespan: 30d */ and report [Senescent] when the marker is older than the lifespan and the symbol has no references. With action=apply and confirm=true, comment the senescent functions out in a shadow git worktree, run tests and land the diff only if the suite is green. Apply writes files and needs --allow-write.",
@@ -1377,6 +1438,22 @@ const PROMPTS = [
1377
1438
  { name: "context", description: "What the change is supposed to do", required: false },
1378
1439
  ],
1379
1440
  },
1441
+ {
1442
+ name: "cross-examine-the-claim",
1443
+ title: "Cross-examine the commit claim",
1444
+ description: "Extract the claims from a commit message or PR body, check each one against the diff and stop on [CLAIM CONTRADICTED].",
1445
+ arguments: [
1446
+ { name: "context", description: "What the change is supposed to do", required: false },
1447
+ ],
1448
+ },
1449
+ {
1450
+ name: "stamp-the-passport",
1451
+ title: "Stamp the provenance passport",
1452
+ description: "Record the commit, file hashes, agent, model and real verification checks in a digest-bound manifest, then verify that the tree still matches.",
1453
+ arguments: [
1454
+ { name: "context", description: "What the change is supposed to do", required: false },
1455
+ ],
1456
+ },
1380
1457
  {
1381
1458
  name: "prune-senescent-code",
1382
1459
  title: "Prune senescent AI code",
@@ -3253,6 +3330,74 @@ async function callAntibody(input, cwd) {
3253
3330
  temp.cleanup();
3254
3331
  }
3255
3332
  }
3333
+ async function callPolygraph(input, cwd) {
3334
+ const temp = new TempFiles();
3335
+ try {
3336
+ const args = ["polygraph", "--json"];
3337
+ const commit = stringArg(input, "commit");
3338
+ if (commit)
3339
+ args.push("--commit", commit);
3340
+ const message = stringArg(input, "message");
3341
+ if (message)
3342
+ args.push("--message", message);
3343
+ const messageFile = stringArg(input, "message_file");
3344
+ if (messageFile)
3345
+ args.push("--message-file", messageFile);
3346
+ if (Array.isArray(input.claims)) {
3347
+ args.push("--claims", temp.write("polygraph-claims.json", JSON.stringify({ claims: input.claims })));
3348
+ }
3349
+ const diff = stringArg(input, "diff");
3350
+ if (diff)
3351
+ args.push("--diff", temp.write("polygraph.diff", diff));
3352
+ const base = baseArg(input);
3353
+ if (base)
3354
+ args.push("--base", base);
3355
+ if (booleanArg(input, "staged"))
3356
+ args.push("--staged");
3357
+ if (booleanArg(input, "unstaged"))
3358
+ args.push("--unstaged");
3359
+ if (booleanArg(input, "include_untracked"))
3360
+ args.push("--include-untracked");
3361
+ const failOn = stringArg(input, "fail_on");
3362
+ if (failOn)
3363
+ args.push("--fail-on", failOn);
3364
+ if (booleanArg(input, "strict"))
3365
+ args.push("--strict");
3366
+ return toToolResult(await runCli(args, cwd));
3367
+ }
3368
+ finally {
3369
+ temp.cleanup();
3370
+ }
3371
+ }
3372
+ async function callPassport(input, cwd) {
3373
+ const action = stringArg(input, "action", true);
3374
+ const args = ["passport", action, "--json"];
3375
+ const commit = stringArg(input, "commit");
3376
+ if (commit)
3377
+ args.push("--commit", commit);
3378
+ const agent = stringArg(input, "agent");
3379
+ if (agent)
3380
+ args.push("--agent", agent);
3381
+ const model = stringArg(input, "model");
3382
+ if (model)
3383
+ args.push("--model", model);
3384
+ const promptHash = stringArg(input, "prompt_hash");
3385
+ if (promptHash)
3386
+ args.push("--prompt-hash", promptHash);
3387
+ if (Array.isArray(input.checks)) {
3388
+ for (const check of input.checks) {
3389
+ if (typeof check === "string")
3390
+ args.push("--check", check);
3391
+ }
3392
+ }
3393
+ if (booleanArg(input, "include_untracked"))
3394
+ args.push("--include-untracked");
3395
+ if (booleanArg(input, "markdown"))
3396
+ args.push("--markdown");
3397
+ if (booleanArg(input, "force"))
3398
+ args.push("--force");
3399
+ return toToolResult(await runCli(args, cwd));
3400
+ }
3256
3401
  async function callApoptosis(input, cwd) {
3257
3402
  const action = stringArg(input, "action") ?? "scan";
3258
3403
  const args = ["apoptosis", action, "--json"];
@@ -3468,6 +3613,9 @@ async function dispatchTool(name, input, cwd, readOnly) {
3468
3613
  if (name === "antibody" && ["learn", "forget", "clear"].includes(stringArg(input, "action") ?? "")) {
3469
3614
  throw new ToolInputError("antibody learn/forget/clear write .oc-pilot/antibodies.json and are disabled in read-only mode; start the MCP server with --allow-write");
3470
3615
  }
3616
+ if (name === "passport" && ["write", "clear"].includes(stringArg(input, "action") ?? "")) {
3617
+ throw new ToolInputError("passport write/clear write .oc-pilot/passport.json and are disabled in read-only mode; start the MCP server with --allow-write");
3618
+ }
3471
3619
  if (name === "honeypot" && (stringArg(input, "action") === "deploy" || stringArg(input, "action") === "remove")) {
3472
3620
  throw new ToolInputError("honeypot deploy/remove writes files and is disabled in read-only mode; start the MCP server with --allow-write");
3473
3621
  }
@@ -3581,6 +3729,10 @@ async function dispatchTool(name, input, cwd, readOnly) {
3581
3729
  return callSkeptic(input, cwd);
3582
3730
  case "antibody":
3583
3731
  return callAntibody(input, cwd);
3732
+ case "polygraph":
3733
+ return callPolygraph(input, cwd);
3734
+ case "passport":
3735
+ return callPassport(input, cwd);
3584
3736
  case "apoptosis":
3585
3737
  return callApoptosis(input, cwd);
3586
3738
  case "scan_injection":
@@ -3660,6 +3812,16 @@ function summarizeResult(value) {
3660
3812
  if (typeof value.status === "string" && Array.isArray(value.removed) && typeof value.summary === "string") {
3661
3813
  return `oc-pilot: apoptosis ${value.status}, ${String(value.removed.length)} removed`;
3662
3814
  }
3815
+ if (typeof value.status === "string" && Array.isArray(value.changed)) {
3816
+ return `oc-pilot: passport ${value.status}`;
3817
+ }
3818
+ if (value.tool === "oc-pilot" && typeof value.verdict === "string" && Array.isArray(value.files)) {
3819
+ return `oc-pilot: passport ${value.verdict}, ${String(value.files.length)} file(s)`;
3820
+ }
3821
+ if (typeof value.status === "string" && Array.isArray(value.claims) && value.counts && typeof value.counts === "object") {
3822
+ const counts = value.counts;
3823
+ return `oc-pilot: polygraph ${value.status}, ${String(counts.contradicted ?? 0)} contradicted, ${String(counts.unverifiable ?? 0)} unverifiable`;
3824
+ }
3663
3825
  if (typeof value.signatures === "number" && Array.isArray(value.matches)) {
3664
3826
  return `oc-pilot: antibody ${String(value.matches.length)} match(es), ${String(value.signatures)} signature(s)`;
3665
3827
  }
@@ -3933,6 +4095,10 @@ function promptBody(name, args) {
3933
4095
  return `Call the oc-pilot "blindfold" tool on the added diff lines, or pass file when the change is one file. Read the obfuscated code and the verdict. If it reports [BLINDFOLD REJECTED], stop: the model could not reconstruct the logic, found a concrete vulnerability or stayed below min_confidence. Quote the explanation and fix the real code path; do not reveal the original names to the model, do not raise min_confidence to force a pass and do not add comments that explain the logic to the model. If it passes, say that the verdict is a blind review, not a mathematical proof of safety. Use dry_run only to inspect the mapping and never send the mapping to the model.${suffix}`;
3934
4096
  case "falsify-the-diff":
3935
4097
  return `Call the oc-pilot "skeptic" tool on the proposed diff. Read the hypothesis reason and the exact status. If it returns bug, stop and quote the failing test output: the generated test fails on the diff and passes on HEAD, so the change is falsified. Fix the code or the test expectation, then rerun; do not delete the test, do not weaken the assertion and do not claim a bug from a test that also fails on HEAD. If it returns clean, say that the hypothesis was rejected, not that the code is proven correct. If it returns unfalsifiable, explain that the test did not distinguish the diff from HEAD. If it returns error, report the infrastructure failure instead of guessing.${suffix}`;
4098
+ case "stamp-the-passport":
4099
+ return `Call the oc-pilot "passport" tool with action=write after the checks you actually ran, then action=verify. Record only real checks as name=pass|warn|fail|skip, the real agent/model and the commit. If verify returns [PASSPORT STALE] or [PASSPORT TAMPERED], stop: the manifest no longer matches the tree; rewrite it from the current state or investigate the change. Never mark a check as pass without running it, never edit the manifest by hand to hide a mismatch, and never claim that a passport proves correctness: it proves what was recorded and that the files still match. write/clear need --allow-write.${suffix}`;
4100
+ case "cross-examine-the-claim":
4101
+ return `Call the oc-pilot "polygraph" tool on the commit or PR message and the proposed diff. Read every claim and its status. If it returns [CLAIM CONTRADICTED], stop and quote the contradicted claim with its evidence: the message asserts something the diff does not do. Fix the code or rewrite the message so it matches reality; never rewrite the message to hide a buggy diff and never delete a claim. If it returns [POLYGRAPH VERIFIED], say that the claims are consistent with the diff, not that the code is correct. If it returns [POLYGRAPH INCONCLUSIVE], list the unverifiable claims and explain what evidence would settle them. Model-backed and read-only.${suffix}`;
3936
4102
  case "raise-antibodies":
3937
4103
  return `Call the oc-pilot "antibody" tool with action=learn first, then action=scan on the proposed diff. Read the learned signature count and every [ANTIBODY MATCH] entry with rule, file:line and evidence. If a match is reported, stop: the diff reintroduced a vulnerability pattern that the repository already fixed. Fix the code path and rescan; do not delete the signature, do not suppress the line and do not clear the store to force a pass. If the scan is clean, say that no learned pattern matched, not that the code is safe. learn/forget/clear write files and need --allow-write; clear requires explicit user approval and force=true.${suffix}`;
3938
4104
  case "prune-senescent-code":