oc-pilot 0.95.0 → 0.96.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,211 @@
1
+ import { mkdirSync, writeFileSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { runShellCommand } from "./command.js";
4
+ import { PilotError } from "./errors.js";
5
+ import { runGit } from "./git.js";
6
+ import { createShadow, writeShadowDiff } from "./shadow.js";
7
+ const TEST_FILE = ".oc-pilot/skeptic.test.mjs";
8
+ const DEFAULT_TIMEOUT_MS = 120_000;
9
+ const MAX_OUTPUT = 6_000;
10
+ function cap(output) {
11
+ return output.length > MAX_OUTPUT ? output.slice(-MAX_OUTPUT) : output;
12
+ }
13
+ export function parseSkepticHypothesis(text) {
14
+ const start = text.indexOf("{");
15
+ const end = text.lastIndexOf("}");
16
+ if (start === -1 || end <= start)
17
+ return undefined;
18
+ let parsed;
19
+ try {
20
+ parsed = JSON.parse(text.slice(start, end + 1));
21
+ }
22
+ catch {
23
+ return undefined;
24
+ }
25
+ if (!parsed || typeof parsed !== "object")
26
+ return undefined;
27
+ const record = parsed;
28
+ const test = typeof record.test === "string" ? record.test.trim() : "";
29
+ const reason = typeof record.reason === "string" ? record.reason.trim() : "";
30
+ if (!test || !reason)
31
+ return undefined;
32
+ return { test, reason };
33
+ }
34
+ export function buildSkepticPrompt(diff, context) {
35
+ return [
36
+ "You are a skeptic. A diff is proposed, and your job is to falsify it with one executable test.",
37
+ "Write a minimal self-contained ESM test for Node.js 22 using node:test and node:assert/strict.",
38
+ "The test will be written to .oc-pilot/skeptic.test.mjs inside a git worktree where the diff is applied.",
39
+ "It must fail because of the diff and pass on the unmodified HEAD. Import project files with relative paths.",
40
+ "If the project is TypeScript, import a built dist file or assert on source text; do not assume a transpiler.",
41
+ "No new dependencies, no network, no writes outside the test, one focused test.",
42
+ context ? `Extra context from the author:\n${context}` : "",
43
+ "Return strict JSON only, with no markdown and no prose outside the object:",
44
+ '{"test":"import test from \\"node:test\\";\\nimport assert from \\"node:assert/strict\\";\\n...","reason":"why this test fails on the diff"}',
45
+ "If you cannot write a test that distinguishes the diff from HEAD, return an empty test and explain why.",
46
+ "",
47
+ "DIFF:",
48
+ diff,
49
+ ]
50
+ .filter((line) => line.length > 0)
51
+ .join("\n");
52
+ }
53
+ export function renderSkeptic(report) {
54
+ const lines = [`Skeptic: ${report.status}`, `Source: ${report.source}`];
55
+ if (report.hypothesis)
56
+ lines.push(`Hypothesis: ${report.hypothesis.reason}`);
57
+ if (report.testFile)
58
+ lines.push(`Test: ${report.testFile}`);
59
+ if (report.testOutput) {
60
+ lines.push("Output:");
61
+ lines.push(report.testOutput.trimEnd());
62
+ }
63
+ lines.push(report.summary);
64
+ return `${lines.join("\n")}\n`;
65
+ }
66
+ function testCommand(command, testFile) {
67
+ const template = command?.trim() || "node --test {file}";
68
+ return template.includes("{file}") ? template.replace("{file}", testFile) : `${template} ${testFile}`;
69
+ }
70
+ function looksBroken(output) {
71
+ return /ERR_MODULE_NOT_FOUND|Cannot find module|ERR_UNKNOWN_FILE_EXTENSION|SyntaxError:/.test(output);
72
+ }
73
+ function writeTest(shadowDir, hypothesis) {
74
+ const dir = join(shadowDir, ".oc-pilot");
75
+ mkdirSync(dir, { recursive: true });
76
+ writeFileSync(join(shadowDir, TEST_FILE), `${hypothesis.test.trimEnd()}\n`, "utf8");
77
+ }
78
+ function applyDiff(shadowDir, patch) {
79
+ const check = runGit(["apply", "--check", patch], shadowDir);
80
+ if (check.status !== 0)
81
+ return check.stderr.trim() || check.stdout.trim() || "git apply --check failed";
82
+ const apply = runGit(["apply", patch], shadowDir);
83
+ if (apply.status !== 0)
84
+ return apply.stderr.trim() || apply.stdout.trim() || "git apply failed";
85
+ return undefined;
86
+ }
87
+ /** Runs the generated test on the diff and then on clean HEAD to prove it discriminates. */
88
+ export async function runSkeptic(cwd, diff, hypothesis, options = {}) {
89
+ const started = Date.now();
90
+ const timeoutMs = Math.max(1_000, Math.min(600_000, options.timeoutMs ?? DEFAULT_TIMEOUT_MS));
91
+ const command = testCommand(options.command, TEST_FILE);
92
+ const temp = writeShadowDiff(diff);
93
+ const diffShadow = createShadow(cwd);
94
+ let diffOutput = "";
95
+ try {
96
+ const applyError = applyDiff(diffShadow.dir, temp.path);
97
+ if (applyError) {
98
+ return {
99
+ source: "diff",
100
+ status: "error",
101
+ summary: `[SKEPTIC ERROR]: diff не применился в shadow worktree: ${applyError}`,
102
+ hypothesis,
103
+ durationMs: Date.now() - started,
104
+ };
105
+ }
106
+ writeTest(diffShadow.dir, hypothesis);
107
+ const run = await runShellCommand(command, diffShadow.dir, { timeoutMs });
108
+ diffOutput = run.output;
109
+ if (run.timedOut) {
110
+ return {
111
+ source: "diff",
112
+ status: "error",
113
+ summary: `[SKEPTIC ERROR]: тест не завершился за ${String(timeoutMs)} мс.`,
114
+ hypothesis,
115
+ testFile: TEST_FILE,
116
+ testOutput: cap(diffOutput),
117
+ durationMs: Date.now() - started,
118
+ };
119
+ }
120
+ if (run.exitCode === 0) {
121
+ return {
122
+ source: "diff",
123
+ status: "clean",
124
+ summary: "[SKEPTIC CLEAN]: предложенный тест проходит на diff, гипотеза не подтверждена.",
125
+ hypothesis,
126
+ testFile: TEST_FILE,
127
+ testOutput: cap(diffOutput),
128
+ durationMs: Date.now() - started,
129
+ };
130
+ }
131
+ if (looksBroken(diffOutput)) {
132
+ return {
133
+ source: "diff",
134
+ status: "error",
135
+ summary: "[SKEPTIC ERROR]: сгенерированный тест не запустился.",
136
+ hypothesis,
137
+ testFile: TEST_FILE,
138
+ testOutput: cap(diffOutput),
139
+ durationMs: Date.now() - started,
140
+ };
141
+ }
142
+ }
143
+ finally {
144
+ diffShadow.cleanup();
145
+ temp.cleanup();
146
+ }
147
+ const cleanShadow = createShadow(cwd);
148
+ try {
149
+ writeTest(cleanShadow.dir, hypothesis);
150
+ const clean = await runShellCommand(command, cleanShadow.dir, { timeoutMs });
151
+ if (clean.timedOut) {
152
+ return {
153
+ source: "diff",
154
+ status: "error",
155
+ summary: `[SKEPTIC ERROR]: тест на HEAD не завершился за ${String(timeoutMs)} мс.`,
156
+ hypothesis,
157
+ testFile: TEST_FILE,
158
+ testOutput: cap(clean.output),
159
+ durationMs: Date.now() - started,
160
+ };
161
+ }
162
+ if (clean.exitCode === 0) {
163
+ return {
164
+ source: "diff",
165
+ status: "bug",
166
+ summary: "[SKEPTIC BUG]: тест падает на diff и проходит на HEAD. Гипотеза подтверждена.",
167
+ hypothesis,
168
+ testFile: TEST_FILE,
169
+ testOutput: cap(diffOutput),
170
+ durationMs: Date.now() - started,
171
+ };
172
+ }
173
+ if (looksBroken(clean.output)) {
174
+ return {
175
+ source: "diff",
176
+ status: "error",
177
+ summary: "[SKEPTIC ERROR]: сгенерированный тест не запустился на HEAD.",
178
+ hypothesis,
179
+ testFile: TEST_FILE,
180
+ testOutput: cap(clean.output),
181
+ durationMs: Date.now() - started,
182
+ };
183
+ }
184
+ return {
185
+ source: "diff",
186
+ status: "unfalsifiable",
187
+ summary: "[SKEPTIC UNFALSIFIABLE]: тест падает и на diff, и на HEAD, поэтому не доказывает дефект.",
188
+ hypothesis,
189
+ testFile: TEST_FILE,
190
+ testOutput: cap(diffOutput),
191
+ durationMs: Date.now() - started,
192
+ };
193
+ }
194
+ finally {
195
+ cleanShadow.cleanup();
196
+ }
197
+ }
198
+ export function parseSkepticTimeout(raw) {
199
+ if (raw === undefined || raw.trim() === "")
200
+ return undefined;
201
+ const match = /^(\d+(?:\.\d+)?)(ms|s)?$/i.exec(raw.trim());
202
+ if (!match?.[1]) {
203
+ throw new PilotError(`Некорректный таймаут: ${raw}`, {
204
+ hint: "Используйте 120s, 500ms или миллисекунды.",
205
+ exitCode: 2,
206
+ });
207
+ }
208
+ const value = Number(match[1]);
209
+ return Math.round(match[2]?.toLowerCase() === "ms" ? value : value * 1000);
210
+ }
211
+ //# sourceMappingURL=skeptic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skeptic.js","sourceRo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;QACD,OAAO;YACL,MAAM,EAAE,MAAM;YACd,MAAM,EAAE,eAAe;YACvB,OAAO,EAAE,0FAA0F;YACnG,UAAU;YACV,QAAQ,EAAE,SAAS;YACnB,UAAU,EAAE,GAAG,CAAC,UAAU,CAAC;YAC3B,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO;SACjC,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,WAAW,CAAC,OAAO,EAAE,CAAC;IACxB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,GAAuB;IACzD,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,OAAO,SAAS,CAAC;IAC7D,MAAM,KAAK,GAAG,2BAA2B,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;IAC3D,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAChB,MAAM,IAAI,UAAU,CAAC,yBAAyB,GAAG,EAAE,EAAE;YACnD,IAAI,EAAE,2CAA2C;YACjD,QAAQ,EAAE,CAAC;SACZ,CAAC,CAAC;IACL,CAAC;IACD,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/B,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;AAC7E,CAAC"}
@@ -0,0 +1,106 @@
1
+ import assert from "node:assert/strict";
2
+ import { spawnSync } from "node:child_process";
3
+ import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
4
+ import { tmpdir } from "node:os";
5
+ import { join } from "node:path";
6
+ import test from "node:test";
7
+ import { buildSkepticPrompt, parseSkepticHypothesis, parseSkepticTimeout, renderSkeptic, runSkeptic, } from "./skeptic.js";
8
+ function git(args, cwd) {
9
+ const result = spawnSync("git", args, { cwd, encoding: "utf8" });
10
+ if (result.status !== 0)
11
+ throw new Error(`git ${args.join(" ")} failed: ${result.stderr}`);
12
+ return result.stdout;
13
+ }
14
+ function makeRepo() {
15
+ const dir = mkdtempSync(join(tmpdir(), "oc-pilot-skeptic-"));
16
+ git(["init", "-q"], dir);
17
+ git(["config", "user.email", "test@example.com"], dir);
18
+ git(["config", "user.name", "Test"], dir);
19
+ git(["config", "core.autocrlf", "false"], dir);
20
+ writeFileSync(join(dir, "app.mjs"), "export const value = 1;\n", "utf8");
21
+ git(["add", "."], dir);
22
+ git(["commit", "-m", "init"], dir);
23
+ writeFileSync(join(dir, "app.mjs"), "export const value = 2;\n", "utf8");
24
+ const diff = git(["diff", "--", "app.mjs"], dir);
25
+ return { dir, diff };
26
+ }
27
+ function hypothesis(assertion) {
28
+ return {
29
+ test: [
30
+ 'import test from "node:test";',
31
+ 'import assert from "node:assert/strict";',
32
+ 'import { value } from "../app.mjs";',
33
+ `test("value", () => { assert.equal(value, ${assertion}); });`,
34
+ "",
35
+ ].join("\n"),
36
+ reason: `value should be ${assertion}`,
37
+ };
38
+ }
39
+ test("parseSkepticHypothesis accepts strict JSON and rejects incomplete output", () => {
40
+ assert.deepEqual(parseSkepticHypothesis('```json\n{"test":"x","reason":"y"}\n```'), { test: "x", reason: "y" });
41
+ assert.equal(parseSkepticHypothesis("not json"), undefined);
42
+ assert.equal(parseSkepticHypothesis('{"test":"","reason":"y"}'), undefined);
43
+ assert.equal(parseSkepticHypothesis('{"test":"x"}'), undefined);
44
+ });
45
+ test("buildSkepticPrompt asks for one executable Node test and includes the diff", () => {
46
+ const prompt = buildSkepticPrompt("diff --git a/x b/x", "checkout flow");
47
+ assert.match(prompt, /node:test/);
48
+ assert.match(prompt, /node:assert\/strict/);
49
+ assert.match(prompt, /strict JSON/);
50
+ assert.match(prompt, /checkout flow/);
51
+ assert.match(prompt, /diff --git a\/x b\/x/);
52
+ });
53
+ test("renderSkeptic shows status, hypothesis and output", () => {
54
+ const report = {
55
+ source: "staged",
56
+ status: "bug",
57
+ summary: "[SKEPTIC BUG]",
58
+ hypothesis: { test: "x", reason: "value is wrong" },
59
+ testFile: ".oc-pilot/skeptic.test.mjs",
60
+ testOutput: "boom",
61
+ durationMs: 12,
62
+ };
63
+ const text = renderSkeptic(report);
64
+ assert.match(text, /Skeptic: bug/);
65
+ assert.match(text, /value is wrong/);
66
+ assert.match(text, /boom/);
67
+ });
68
+ test("parseSkepticTimeout accepts seconds and milliseconds", () => {
69
+ assert.equal(parseSkepticTimeout(undefined), undefined);
70
+ assert.equal(parseSkepticTimeout("120s"), 120_000);
71
+ assert.equal(parseSkepticTimeout("500ms"), 500);
72
+ assert.throws(() => parseSkepticTimeout("soon"), /Некорректный таймаут/);
73
+ });
74
+ test("runSkeptic reports a clean hypothesis when the test passes on the diff", async () => {
75
+ const repo = makeRepo();
76
+ try {
77
+ const report = await runSkeptic(repo.dir, repo.diff, hypothesis("2"), { timeoutMs: 20_000 });
78
+ assert.equal(report.status, "clean", report.summary);
79
+ assert.equal(report.testFile, ".oc-pilot/skeptic.test.mjs");
80
+ }
81
+ finally {
82
+ rmSync(repo.dir, { recursive: true, force: true });
83
+ }
84
+ });
85
+ test("runSkeptic confirms a bug when the test fails on the diff and passes on HEAD", async () => {
86
+ const repo = makeRepo();
87
+ try {
88
+ const report = await runSkeptic(repo.dir, repo.diff, hypothesis("1"), { timeoutMs: 20_000 });
89
+ assert.equal(report.status, "bug", report.summary);
90
+ assert.match(report.summary, /\[SKEPTIC BUG\]/);
91
+ }
92
+ finally {
93
+ rmSync(repo.dir, { recursive: true, force: true });
94
+ }
95
+ });
96
+ test("runSkeptic calls a test that fails on both trees unfalsifiable", async () => {
97
+ const repo = makeRepo();
98
+ try {
99
+ const report = await runSkeptic(repo.dir, repo.diff, hypothesis("999"), { timeoutMs: 20_000 });
100
+ assert.equal(report.status, "unfalsifiable", report.summary);
101
+ }
102
+ finally {
103
+ rmSync(repo.dir, { recursive: true, force: true });
104
+ }
105
+ });
106
+ //# sourceMappingURL=skeptic.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skeptic.test.js","sourceRoot":"","sources":["../../src/core/skeptic.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,mBAAmB,EACnB,aAAa,EACb,UAAU,GAEX,MAAM,cAAc,CAAC;AAEtB,SAAS,GAAG,CAAC,IAAc,EAAE,GAAW;IACtC,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;IACjE,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;IAC3F,OAAO,MAAM,CAAC,MAAM,CAAC;AACvB,CAAC;AAED,SAAS,QAAQ;IACf,MAAM,GAAG,GAAG,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,mBAAmB,CAAC,CAAC,CAAC;IAC7D,GAAG,CAAC,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;IACzB,GAAG,CAAC,CAAC,QAAQ,EAAE,YAAY,EAAE,kBAAkB,CAAC,EAAE,GAAG,CAAC,CAAC;IACvD,GAAG,CAAC,CAAC,QAAQ,EA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,EAAE,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;QACnD,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;IAClD,CAAC;YAAS,CAAC;QACT,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACrD,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,gEAAgE,EAAE,KAAK,IAAI,EAAE;IAChF,MAAM,IAAI,GAAG,QAAQ,EAAE,CAAC;IACxB,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,KAAK,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,CAAC;QAC/F,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IAC/D,CAAC;YAAS,CAAC;QACT,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACrD,CAAC;AACH,CAAC,CAAC,CAAC"}
@@ -50,6 +50,7 @@ test("MCP advertises prompts and renders them with arguments", () => {
50
50
  "stress-the-chamber",
51
51
  "release-the-butterfly",
52
52
  "interrogate-the-blindfold",
53
+ "falsify-the-diff",
53
54
  "prune-senescent-code",
54
55
  "scan-for-injection",
55
56
  "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,EA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+ description: "Turn a review opinion into an executable proof: ask the model for one minimal test that fails on the proposed diff, apply the diff in a shadow worktree, run the test on the diff and on clean HEAD, and return clean, bug, unfalsifiable or error. Model-backed, read-only and not a proof of absence.",
1154
+ annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
1155
+ inputSchema: {
1156
+ type: "object",
1157
+ additionalProperties: false,
1158
+ properties: {
1159
+ diff: { type: "string", description: "Unified diff text; omit to use the project's git diff" },
1160
+ base: { type: "string" },
1161
+ staged: { type: "boolean" },
1162
+ unstaged: { type: "boolean" },
1163
+ include_untracked: { type: "boolean" },
1164
+ command: { type: "string", description: "Test command with {file}; default node --test {file}" },
1165
+ context: { type: "string", description: "Extra context for the hypothesis" },
1166
+ timeout_ms: { type: "integer", minimum: 1000, maximum: 600000, description: "Per-run timeout (default 120000)" },
1167
+ ...RESULT_PROPERTIES,
1168
+ },
1169
+ },
1170
+ },
1151
1171
  {
1152
1172
  name: "apoptosis",
1153
1173
  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.",
@@ -1320,6 +1340,14 @@ const PROMPTS = [
1320
1340
  { name: "context", description: "What the change is supposed to do", required: false },
1321
1341
  ],
1322
1342
  },
1343
+ {
1344
+ name: "falsify-the-diff",
1345
+ title: "Falsify the diff with a test",
1346
+ description: "Ask the model for one executable test that should fail on the proposed change, then run it in a shadow worktree against both the diff and clean HEAD.",
1347
+ arguments: [
1348
+ { name: "context", description: "What the change is supposed to do", required: false },
1349
+ ],
1350
+ },
1323
1351
  {
1324
1352
  name: "prune-senescent-code",
1325
1353
  title: "Prune senescent AI code",
@@ -3137,6 +3165,37 @@ async function callBlindfold(input, cwd) {
3137
3165
  args.push("--dry-run");
3138
3166
  return toToolResult(await runCli(args, cwd));
3139
3167
  }
3168
+ async function callSkeptic(input, cwd) {
3169
+ const temp = new TempFiles();
3170
+ try {
3171
+ const args = ["skeptic", "--json"];
3172
+ const diff = stringArg(input, "diff");
3173
+ if (diff)
3174
+ args.push("--diff", temp.write("skeptic.diff", diff));
3175
+ const base = baseArg(input);
3176
+ if (base)
3177
+ args.push("--base", base);
3178
+ if (booleanArg(input, "staged"))
3179
+ args.push("--staged");
3180
+ if (booleanArg(input, "unstaged"))
3181
+ args.push("--unstaged");
3182
+ if (booleanArg(input, "include_untracked"))
3183
+ args.push("--include-untracked");
3184
+ const command = stringArg(input, "command");
3185
+ if (command)
3186
+ args.push("--command", command);
3187
+ const context = stringArg(input, "context");
3188
+ if (context)
3189
+ args.push("--context", context);
3190
+ const timeout = integerArg(input, "timeout_ms");
3191
+ if (timeout !== undefined)
3192
+ args.push("--test-timeout", `${String(timeout)}ms`);
3193
+ return toToolResult(await runCli(args, cwd));
3194
+ }
3195
+ finally {
3196
+ temp.cleanup();
3197
+ }
3198
+ }
3140
3199
  async function callApoptosis(input, cwd) {
3141
3200
  const action = stringArg(input, "action") ?? "scan";
3142
3201
  const args = ["apoptosis", action, "--json"];
@@ -3458,6 +3517,8 @@ async function dispatchTool(name, input, cwd, readOnly) {
3458
3517
  return callButterfly(input, cwd);
3459
3518
  case "blindfold":
3460
3519
  return callBlindfold(input, cwd);
3520
+ case "skeptic":
3521
+ return callSkeptic(input, cwd);
3461
3522
  case "apoptosis":
3462
3523
  return callApoptosis(input, cwd);
3463
3524
  case "scan_injection":
@@ -3537,6 +3598,9 @@ function summarizeResult(value) {
3537
3598
  if (typeof value.status === "string" && Array.isArray(value.removed) && typeof value.summary === "string") {
3538
3599
  return `oc-pilot: apoptosis ${value.status}, ${String(value.removed.length)} removed`;
3539
3600
  }
3601
+ if (typeof value.status === "string" && typeof value.summary === "string" && typeof value.durationMs === "number" && value.hypothesis) {
3602
+ return `oc-pilot: skeptic ${value.status}`;
3603
+ }
3540
3604
  if (typeof value.status === "string" && Array.isArray(value.mapping) && typeof value.summary === "string") {
3541
3605
  return `oc-pilot: blindfold ${value.status}, ${String(value.mapping.length)} hidden identifier(s)`;
3542
3606
  }
@@ -3796,6 +3860,8 @@ function promptBody(name, args) {
3796
3860
  return `Call the oc-pilot "butterfly" tool with the project test command, seed=42, fail_rate=0.1, latency_rate=0.05, latency_ms=3000, broken_json_rate=0.02 and fs_fail_rate=0.05. Read the injected fault counts and the exit code. If the tests fail, find the code path that did not handle the injected 500, timeout, broken JSON or EIO and add the missing try/catch, timeout or fallback; do not lower the rates, widen the scope to hide the fault or delete the test. If the tests pass, say that this is one deterministic chaos run, not proof that every path is safe. Never claim the tool patches native or arbitrary database drivers reliably.${suffix}`;
3797
3861
  case "interrogate-the-blindfold":
3798
3862
  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}`;
3863
+ case "falsify-the-diff":
3864
+ 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}`;
3799
3865
  case "prune-senescent-code":
3800
3866
  return `Call the oc-pilot "apoptosis" tool with action=scan first. Report every [Senescent] entry with file, symbol, age and reference count, and explain that an expired marker plus zero references is the only reason it is a candidate. Do not delete anything without explicit user approval. If approved, call action=apply with confirm=true and the project test command; apply runs in a shadow worktree and lands the diff only if tests pass. If tests fail, report the failure and keep the working tree unchanged. Never remove a function that still has references, never shorten the lifespan to force a candidate, and never claim that deletion is safe without the green test run.${suffix}`;
3801
3867
  case "scan-for-injection":