@akagilnc/pi-workflow-roles 0.1.5015 → 0.1.5063

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.
Files changed (95) hide show
  1. package/README.md +2 -2
  2. package/README.zh-CN.md +2 -2
  3. package/THIRD_PARTY_NOTICES.md +8 -8
  4. package/dist/acp-host/production-host.js +525 -978
  5. package/dist/headless-host/description.js +0 -2
  6. package/dist/headless-host/production-host.js +528 -1014
  7. package/dist/host-descriptions.js +2 -3
  8. package/dist/migrate-book-topology.js +7 -12
  9. package/dist/packaged-role-registry.js +20 -18
  10. package/dist/pi/role-turn-host.js +3 -27
  11. package/dist/public-cli/cli.js +23 -2
  12. package/dist/public-cli/countersign-run.js +13 -8
  13. package/dist/public-cli/instruction-seat-run.js +75 -107
  14. package/dist/public-cli/invocation.js +13 -32
  15. package/dist/public-cli/machine-method-skills.js +150 -0
  16. package/dist/public-cli/main.js +549 -679
  17. package/dist/public-cli/post-admission.js +10 -5
  18. package/dist/public-cli/registry.js +2 -1
  19. package/dist/public-cli/run-lifecycle.js +12 -15
  20. package/dist/public-cli/seat-ticket-binding.js +5 -8
  21. package/dist/public-cli/settlement.js +12 -99
  22. package/dist/public-cli/turn-request.js +16 -8
  23. package/dist/public-role-summons.js +8 -3
  24. package/package.json +5 -1
  25. package/resources/countersign-ticket-issue.md +5 -0
  26. package/resources/diarist-collect.md +1 -0
  27. package/resources/secretariat-ticket-identity.md +15 -0
  28. package/scripts/build-package.mjs +1 -6
  29. package/src/headless-host/description.ts +0 -3
  30. package/src/headless-host/role-turn-host.ts +2 -23
  31. package/src/host-contracts.ts +2 -23
  32. package/src/host-descriptions.ts +2 -3
  33. package/src/packaged-role-registry.ts +17 -16
  34. package/src/pi/adapter.ts +0 -27
  35. package/src/pi/role-turn-host.ts +3 -31
  36. package/src/public-cli/cli.ts +24 -2
  37. package/src/public-cli/countersign-run.ts +17 -10
  38. package/src/public-cli/instruction-seat-run.ts +75 -105
  39. package/src/public-cli/invocation.ts +10 -38
  40. package/src/public-cli/machine-method-skills.ts +153 -0
  41. package/src/public-cli/post-admission.ts +12 -6
  42. package/src/public-cli/registry.ts +1 -0
  43. package/src/public-cli/run-lifecycle.ts +12 -13
  44. package/src/public-cli/seat-ticket-binding.ts +5 -8
  45. package/src/public-cli/settlement.ts +6 -138
  46. package/src/public-cli/turn-request.ts +24 -16
  47. package/src/public-role-summons.ts +16 -3
  48. package/src/reviewer-role.ts +1 -12
  49. package/src/role-envelope.ts +0 -13
  50. package/src/role-runtime-dependencies.ts +0 -13
  51. package/src/role-runtime.ts +4 -56
  52. package/src/worker-role.ts +1 -81
  53. package/dist/method-host-plugin/.claude-plugin/plugin.json +0 -5
  54. package/dist/method-host-plugin/skills/ak-cross-m-review/CONTEXT.md +0 -48
  55. package/dist/method-host-plugin/skills/ak-cross-m-review/LICENSE +0 -21
  56. package/dist/method-host-plugin/skills/ak-cross-m-review/SKILL.md +0 -170
  57. package/dist/method-host-plugin/skills/ak-cross-m-review/prompts/cmr-completeness.md +0 -118
  58. package/dist/method-host-plugin/skills/ak-cross-m-review/prompts/cmr-reviewer.md +0 -128
  59. package/dist/method-host-plugin/skills/ak-cross-m-review/provenance.json +0 -41
  60. package/dist/method-host-plugin/skills/diagnosing-bugs/SKILL.md +0 -134
  61. package/dist/method-host-plugin/skills/diagnosing-bugs/agents/openai.yaml +0 -3
  62. package/dist/method-host-plugin/skills/diagnosing-bugs/provenance.json +0 -31
  63. package/dist/method-host-plugin/skills/diagnosing-bugs/scripts/hitl-loop.template.sh +0 -41
  64. package/dist/method-host-plugin/skills/resolving-merge-conflicts/SKILL.md +0 -14
  65. package/dist/method-host-plugin/skills/resolving-merge-conflicts/agents/openai.yaml +0 -3
  66. package/dist/method-host-plugin/skills/resolving-merge-conflicts/provenance.json +0 -26
  67. package/dist/method-host-plugin/skills/tdd/SKILL.md +0 -38
  68. package/dist/method-host-plugin/skills/tdd/agents/openai.yaml +0 -3
  69. package/dist/method-host-plugin/skills/tdd/mocking.md +0 -59
  70. package/dist/method-host-plugin/skills/tdd/provenance.json +0 -36
  71. package/dist/method-host-plugin/skills/tdd/tests.md +0 -77
  72. package/dist/package-resources/method-skill.js +0 -259
  73. package/resources/method-host-plugin/.claude-plugin/plugin.json +0 -5
  74. package/resources/methods/ak-cross-m-review/CONTEXT.md +0 -48
  75. package/resources/methods/ak-cross-m-review/LICENSE +0 -21
  76. package/resources/methods/ak-cross-m-review/SKILL.md +0 -170
  77. package/resources/methods/ak-cross-m-review/prompts/cmr-completeness.md +0 -118
  78. package/resources/methods/ak-cross-m-review/prompts/cmr-reviewer.md +0 -128
  79. package/resources/methods/ak-cross-m-review/provenance.json +0 -41
  80. package/resources/methods/diagnosing-bugs/SKILL.md +0 -134
  81. package/resources/methods/diagnosing-bugs/agents/openai.yaml +0 -3
  82. package/resources/methods/diagnosing-bugs/provenance.json +0 -31
  83. package/resources/methods/diagnosing-bugs/scripts/hitl-loop.template.sh +0 -41
  84. package/resources/methods/resolving-merge-conflicts/SKILL.md +0 -14
  85. package/resources/methods/resolving-merge-conflicts/agents/openai.yaml +0 -3
  86. package/resources/methods/resolving-merge-conflicts/provenance.json +0 -26
  87. package/resources/methods/tdd/SKILL.md +0 -38
  88. package/resources/methods/tdd/agents/openai.yaml +0 -3
  89. package/resources/methods/tdd/mocking.md +0 -59
  90. package/resources/methods/tdd/provenance.json +0 -36
  91. package/resources/methods/tdd/tests.md +0 -77
  92. package/src/canonical-skill-binding.ts +0 -118
  93. package/src/host-native-method.ts +0 -185
  94. package/src/package-resources/method-skill-binding.ts +0 -60
  95. package/src/package-resources/method-skill.ts +0 -363
@@ -39,7 +39,6 @@ import {
39
39
  import { engineSessionMaterialFromOptions } from "./package-resources/engine-material.ts";
40
40
  import { registerEngineDetourTool } from "./engine-detour-tool.ts";
41
41
  import { createReceiptDeliveryPolicy, NO_RECEIPT_LIFECYCLE_ENTRY_TYPE, RECEIPT_DELIVERY_PROMPT } from "./receipt-delivery-policy.ts";
42
- import type { AnyCanonicalSkillBinding } from "./canonical-skill-binding.ts";
43
42
  import type { CollectorClock } from "./collector-evidence.ts";
44
43
  import type { CollectorGitHubTransport } from "./collector-github.ts";
45
44
  import {
@@ -251,13 +250,8 @@ import {
251
250
  FIXER_FLAG_DEFINITIONS,
252
251
  FIXER_OUTPUT_TOOL_NAME,
253
252
  FIXER_PHASES,
254
- type CoderSkillExpansionEvidenceMissingResult,
255
253
  } from "./worker-role.ts";
256
254
 
257
- /** One envelope map for Gatekeeper non-pass and other correct submission rejects (#525). */
258
- type SubmissionNonPassResult =
259
- | SubmissionGateNonPassResult
260
- | CoderSkillExpansionEvidenceMissingResult;
261
255
  import { JUDGE_OUTPUT_TOOL_NAME } from "./package-contracts/judge-output.ts";
262
256
  import { REVIEWER_OUTPUT_TOOL_NAME } from "./package-contracts/reviewer-output.ts";
263
257
  import { DOCTOR_OUTPUT_TOOL_NAME } from "./doctor-contracts.ts";
@@ -340,13 +334,10 @@ export {
340
334
  } from "./reviewer-role.ts";
341
335
  export {
342
336
  CODER_OUTPUT_TOOL_NAME,
343
- CODER_SKILL_EXPANSION_EVIDENCE_MISSING_CODE,
344
- CoderSkillExpansionEvidenceMissingError,
345
337
  FIXER_FLAG_DEFINITIONS,
346
338
  FIXER_OUTPUT_TOOL_NAME,
347
339
  FIXER_PHASES,
348
340
  type CoderOutput,
349
- type CoderSkillExpansionEvidenceMissingResult,
350
341
  type FixerOutput,
351
342
  type WorkerOutput,
352
343
  } from "./worker-role.ts";
@@ -510,9 +501,6 @@ export type RoleRuntimeDependencies = {
510
501
  createCollectorClock?(): CollectorClock;
511
502
  createNavigatorAttendance?(options: { context: HostContext; role: string; phase: NavigatorPhase; subjectKey: string; subject: string; authority: string; contextError?: unknown; invocationId: string; onEvent: (event: import("./navigator-attendance.ts").NavigatorEvent, report: import("./navigator-attendance.ts").NavigatorReport) => void | Promise<void> }): NavigatorAttendanceDependency | Promise<NavigatorAttendanceDependency>;
512
503
  loadNavigatorWorkContext?(options: { context: HostContext; role: string; phase: NavigatorPhase; getFlag?: (name: string) => unknown }): Promise<NavigatorWorkContext>;
513
- loadCanonicalSkillBinding?(
514
- name: "tdd" | "ak-cross-m-review",
515
- ): Promise<AnyCanonicalSkillBinding>;
516
504
  activationClock?(): string;
517
505
  activationTraceWriter?: (record: ActivationTraceRecord) => void | Promise<void>;
518
506
  /** Wall-clock ISO timestamps for tool-execution observation records; defaults to activationClock/Date. */
@@ -1267,9 +1255,6 @@ export function createRoleRuntimeExtension(
1267
1255
  let roleReferenceMaterials = "";
1268
1256
  /** Live Reviewer parent activation for envelope agent_start prompt assembly. */
1269
1257
  let activeReviewerParent: ReviewerActivation | undefined;
1270
- /** Envelope-owned Reviewer Skill expansion state (ADR 0018 — not a role-module facade). */
1271
- let reviewerOriginalRequest: string | undefined;
1272
- let reviewerExpansionCaptured = false;
1273
1258
  let navigatorAttendance: NavigatorAttendanceDependency | undefined;
1274
1259
  // #351: session-lifecycle owner for periodic OAuth refresh (orthogonal to role admission).
1275
1260
  let pendingNavigatorPresentation: { event: import("./navigator-attendance.ts").NavigatorEvent; report: import("./navigator-attendance.ts").NavigatorReport } | undefined;
@@ -1280,7 +1265,7 @@ export function createRoleRuntimeExtension(
1280
1265
  /** toolCallId → fact+evidence; one-shot projected onto durable tool_result (#475). */
1281
1266
  const pendingInfrastructureFailures = new Map<string, PendingInfrastructureFailure>();
1282
1267
  // Envelope-owned execute→tool_result bridge for submission non-pass (ADR 0018 / #525).
1283
- const pendingSubmissionNonPassByToolCallId = new Map<string, SubmissionNonPassResult>();
1268
+ const pendingSubmissionNonPassByToolCallId = new Map<string, SubmissionGateNonPassResult>();
1284
1269
  const pendingPriorGatePassByToolCallId = new Map<string, unknown>();
1285
1270
  let engineDetourRegistered = false;
1286
1271
  // #288 primary-session thin adapter. The policy is the sole budget owner;
@@ -1377,23 +1362,9 @@ export function createRoleRuntimeExtension(
1377
1362
  () => receiptDelivery.recordAccepted(),
1378
1363
  settleNavigatorProjection,
1379
1364
  );
1380
- roleHost.on("input", (event) => {
1381
- const text = event.text;
1365
+ roleHost.on("input", (_event) => {
1382
1366
  const role = roleHost.getFlag(ROLE_FLAG.name);
1383
1367
  if (role !== undefined && !admitted) return { action: "handled" as const };
1384
- // Reviewer: recover original request; Pi argv may already carry native form.
1385
- if (
1386
- admitted
1387
- && activeReviewerParent !== undefined
1388
- && selectedRole === role
1389
- && reviewerOriginalRequest === undefined
1390
- ) {
1391
- reviewerOriginalRequest =
1392
- roleHost.capabilities?.skillOriginalRequest?.(
1393
- activeReviewerParent.skillBinding.name,
1394
- text,
1395
- ) ?? text;
1396
- }
1397
1368
  return { action: "continue" as const };
1398
1369
  });
1399
1370
  // Reference law/guides use the existing typed reading-material channel;
@@ -1447,17 +1418,8 @@ export function createRoleRuntimeExtension(
1447
1418
  }
1448
1419
  }
1449
1420
  navigatorAttendance?.prepare();
1450
- // Envelope-owned Reviewer expansion capture + parent prompt assembly (no role-module callback).
1421
+ // Reviewer parent prompt assembly.
1451
1422
  if (activeReviewerParent !== undefined && selectedRole === role) {
1452
- if (!reviewerExpansionCaptured) {
1453
- if (reviewerOriginalRequest !== undefined) {
1454
- activeReviewerParent.skillBinding.captureExpansion(
1455
- roleHost.capabilities?.skillExpansion(prompt),
1456
- reviewerOriginalRequest,
1457
- );
1458
- }
1459
- reviewerExpansionCaptured = true;
1460
- }
1461
1423
  return {
1462
1424
  systemPrompt: assembleReviewerParentSystemPrompt({
1463
1425
  baseSystemPrompt: event.systemPrompt,
@@ -1747,7 +1709,7 @@ export function createRoleRuntimeExtension(
1747
1709
  }
1748
1710
  failInfrastructure(error, ctx);
1749
1711
  },
1750
- bindSubmissionNonPass(toolCallId: string, result: SubmissionNonPassResult): void {
1712
+ bindSubmissionNonPass(toolCallId: string, result: SubmissionGateNonPassResult): void {
1751
1713
  pendingSubmissionNonPassByToolCallId.set(toolCallId, result);
1752
1714
  },
1753
1715
  bindPriorGatePass(toolCallId: string, receipt: unknown): void {
@@ -1785,12 +1747,6 @@ export function createRoleRuntimeExtension(
1785
1747
  }
1786
1748
  return dependencies.loadCoderTask(path);
1787
1749
  },
1788
- ...(dependencies.loadCanonicalSkillBinding === undefined
1789
- ? {}
1790
- : {
1791
- loadCanonicalSkillBinding: (name: "tdd") =>
1792
- dependencies.loadCanonicalSkillBinding!(name),
1793
- }),
1794
1750
  },
1795
1751
  hostActions,
1796
1752
  );
@@ -1798,12 +1754,6 @@ export function createRoleRuntimeExtension(
1798
1754
  roleHost,
1799
1755
  {
1800
1756
  loadSoul: () => requireRoleSoul("reviewer"),
1801
- async loadCanonicalSkillBinding(name) {
1802
- if (dependencies.loadCanonicalSkillBinding === undefined) {
1803
- throw new Error("Reviewer runtime dependencies are not configured");
1804
- }
1805
- return dependencies.loadCanonicalSkillBinding(name);
1806
- },
1807
1757
  },
1808
1758
  hostActions,
1809
1759
  );
@@ -2091,8 +2041,6 @@ export function createRoleRuntimeExtension(
2091
2041
  activeReviewerParent = undefined;
2092
2042
  activeCollector = undefined;
2093
2043
  collectorFirstDispatchDone = false;
2094
- reviewerOriginalRequest = undefined;
2095
- reviewerExpansionCaptured = false;
2096
2044
  receiptDelivery = createReceiptDeliveryPolicy();
2097
2045
  noReceiptRecorded = false;
2098
2046
  observationFace.reset();
@@ -2,12 +2,7 @@ import type { RoleHost, HostContext, HostToolResult, HostGatekeeperActions } fro
2
2
  import { Type, type Static } from "typebox";
3
3
  import { openToolObjectFromUnion } from "./open-tool-schema.ts";
4
4
  import { withTerminatingOutputDeclarations } from "./package-contracts/terminating-infrastructure.ts";
5
- import { CorrectableSubmissionError } from "./submission-correctable-error.ts";
6
5
 
7
- import type {
8
- AnyCanonicalSkillBinding,
9
- CanonicalSkillBinding,
10
- } from "./canonical-skill-binding.ts";
11
6
  import { readableGateItem } from "./readable-gate-item.ts";
12
7
  import { projectGatekeeperEscalation } from "./audit-escalation.ts";
13
8
  import { GatekeeperDecisionError, ParentQueueReaskError } from "./submission-errors.ts";
@@ -112,25 +107,6 @@ function isWorkerPhase(value: unknown): value is WorkerPhase {
112
107
 
113
108
  export type WorkerRoleHostActions = HostGatekeeperActions;
114
109
 
115
- /** Stable code for completed apply without host skill-expansion capability evidence (#525). */
116
- export const CODER_SKILL_EXPANSION_EVIDENCE_MISSING_CODE =
117
- "coder_skill_expansion_evidence_missing" as const;
118
-
119
- export type CoderSkillExpansionEvidenceMissingResult = {
120
- readonly code: typeof CODER_SKILL_EXPANSION_EVIDENCE_MISSING_CODE;
121
- };
122
-
123
- /** Correct completed rejection — not infrastructure; projected via submission non-pass bridge. */
124
- export class CoderSkillExpansionEvidenceMissingError extends CorrectableSubmissionError {
125
- readonly code = CODER_SKILL_EXPANSION_EVIDENCE_MISSING_CODE;
126
- readonly result: CoderSkillExpansionEvidenceMissingResult;
127
- constructor() {
128
- super("Coder completed requires host skill-expansion capability evidence");
129
- this.name = "CoderSkillExpansionEvidenceMissingError";
130
- this.result = Object.freeze({ code: CODER_SKILL_EXPANSION_EVIDENCE_MISSING_CODE });
131
- }
132
- }
133
-
134
110
  export type FixerRoleDependencies = {
135
111
  loadSoul(): Promise<string>;
136
112
  loadPacket(path: string): Promise<string>;
@@ -139,9 +115,6 @@ export type FixerRoleDependencies = {
139
115
  export type CoderRoleDependencies = {
140
116
  loadSoul(): Promise<string>;
141
117
  loadTask(path: string): Promise<string>;
142
- loadCanonicalSkillBinding?(
143
- name: "tdd",
144
- ): Promise<AnyCanonicalSkillBinding>;
145
118
  };
146
119
 
147
120
  export type WorkerRoleRuntime = {
@@ -374,10 +347,6 @@ export function createCoderRoleRuntime(
374
347
  let soul: string | undefined;
375
348
  let task: string | undefined;
376
349
  let phase: WorkerPhase | undefined;
377
- let binding: CanonicalSkillBinding<"tdd"> | undefined;
378
- let tddInvocationInjected = false;
379
- let originalRequest: string | undefined;
380
- let expansionPending = false;
381
350
  let lifecycleRegistered = false;
382
351
  const submissionGate = createWorkerSubmissionGate();
383
352
 
@@ -393,11 +362,6 @@ export function createCoderRoleRuntime(
393
362
 
394
363
  return {
395
364
  async activate(ctx) {
396
- // Each activation owns its own Skill capture state; prior-session flags must
397
- // not authorize a later apply completed (same RoleHost, sequential activate).
398
- tddInvocationInjected = false;
399
- originalRequest = undefined;
400
- expansionPending = false;
401
365
  soul = (await dependencies.loadSoul()).trim();
402
366
  if (soul.length === 0) throw new Error("Coder soul is empty");
403
367
  const selectedPhase = pi.getFlag("ak-coder-phase");
@@ -413,24 +377,6 @@ export function createCoderRoleRuntime(
413
377
  }
414
378
  task = (await dependencies.loadTask(taskPath)).trim();
415
379
  if (task.length === 0) throw new Error("Coder task is empty");
416
- binding = undefined;
417
- if (phase === "apply") {
418
- if (dependencies.loadCanonicalSkillBinding === undefined) {
419
- throw new Error("Coder canonical Skill binding loader is not configured");
420
- }
421
- try {
422
- const loaded = await dependencies.loadCanonicalSkillBinding("tdd");
423
- if (loaded.name !== "tdd") {
424
- throw new Error(
425
- "Canonical Skill binding loader returned ak-cross-m-review for tdd",
426
- );
427
- }
428
- binding = loaded;
429
- } catch (error) {
430
- if (ctx === undefined) throw error;
431
- hostActions.failInfrastructure(error, ctx);
432
- }
433
- }
434
380
 
435
381
  if (!lifecycleRegistered) {
436
382
  lifecycleRegistered = true;
@@ -447,7 +393,7 @@ export function createCoderRoleRuntime(
447
393
  const output = validateWorkerOutput(parameters, phase, "Coder");
448
394
  const status = requireReadableWorkerStatus(output);
449
395
  // #836: skill-expansion evidence rejection deleted (陛下「2.4/5 删」).
450
- // Skill still ships with the package (ADR 0052); code no longer refuses on it.
396
+ // Missing method Skills do not reject a receipt.
451
397
  assertAcceptableThroughHost(
452
398
  submissionGate,
453
399
  status,
@@ -490,34 +436,8 @@ export function createCoderRoleRuntime(
490
436
  };
491
437
  },
492
438
  });
493
- pi.on("input", (event) => {
494
- if (phase !== "apply" || tddInvocationInjected) {
495
- return { action: "continue" as const };
496
- }
497
- tddInvocationInjected = true;
498
- expansionPending = true;
499
- // Original request via host capability when Pi argv already carries native form;
500
- // non-pi keeps plain original bytes (no consumer trim; #822 r3 / reviewer-aligned).
501
- // Role never emits or parses `/skill:` (ADR 0082).
502
- originalRequest = binding === undefined
503
- ? event.text
504
- : (pi.capabilities?.skillOriginalRequest?.(binding.name, event.text)
505
- ?? event.text);
506
- return { action: "continue" as const };
507
- });
508
439
  pi.on("before_agent_start", (event, ctx) => {
509
440
  if (soul === undefined) throw new Error("将作监职分未装载");
510
- if (phase === "apply") {
511
- if (binding === undefined) {
512
- hostActions.failInfrastructure(
513
- new Error("Coder canonical tdd Skill binding was not initialized"),
514
- ctx,
515
- );
516
- }
517
- if (expansionPending) {
518
- expansionPending = false;
519
- }
520
- }
521
441
  return {
522
442
  systemPrompt:
523
443
  `${event.systemPrompt}\n\n<coder_soul>\n${soul}\n</coder_soul>\n\n<coder_phase>\n${phase ?? ""}\n</coder_phase>\n\n<coder_task>\n${task ?? ""}\n</coder_task>`,
@@ -1,5 +0,0 @@
1
- {
2
- "name": "ak-methods",
3
- "version": "0.0.0",
4
- "description": "ak-roles packaged role method skills"
5
- }
@@ -1,48 +0,0 @@
1
- # ak-cross-m-review
2
-
3
- Local, pre-PR review gate: two independent lenses against a pinned diff, one verdict each; a single lens runs in the invoking session, `all` runs both as parallel sub-agent legs. `SKILL.md` plus the selected lens prompt is the complete active authority; this file is vocabulary only.
4
-
5
- ## Language
6
-
7
- **Fixed target**:
8
- The pinned base-to-HEAD snapshot under review, resolved to two literal SHAs
9
- before anything is dispatched.
10
- _Avoid_: range, worktree diff, working changes
11
-
12
- **Authority set**:
13
- The ordered sources that govern the review — user decisions first, then
14
- ratified ADRs / specs, then repository contracts.
15
- _Avoid_: spec (alone), reference docs
16
-
17
- **Lens**:
18
- One review question with its own prompt file — `completeness` (was the
19
- authority delivered?) or `correctness` (is what exists right?).
20
- _Avoid_: axis, gate, mode, pass
21
-
22
- **Leg**:
23
- One independent sub-agent running exactly one lens inside an independent copy of the target at `PRE_HEAD`, dispatched only by `all`; the copy is provided by the harness when it can, otherwise created by the caller. A single-lens invocation has no leg: the invoking session applies the lens itself.
24
- _Avoid_: panel, member, reviewer squad, vendor leg
25
-
26
- **Candidate**:
27
- An evidence-backed claim a leg submits for judgment; never a verdict.
28
- _Avoid_: finding (before judgment), vote
29
-
30
- **Judge**:
31
- The invoking session, which verifies each candidate against the fixed target
32
- and authority set and disposes it as live or refuted.
33
- _Avoid_: orchestrator, runner, merger
34
-
35
- **Verdict**:
36
- The single terminal line a lens ends with, labelled by lens
37
- (`CMR-VERDICT: completeness=…` / `CMR-VERDICT: correctness=…`).
38
- _Avoid_: gate result, concur, convergence
39
-
40
- **Preset**:
41
- A named wrapper skill that invokes the engine with one lens and returns its
42
- report unchanged.
43
- _Avoid_: gate skill, entry point
44
-
45
- **Review only**:
46
- The outcome boundary — the invocation reports and stops; the caller owns every
47
- repair, commit, retry, and later review.
48
- _Avoid_: read-only (that is a filesystem property, not this boundary)
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Akagi
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,170 +0,0 @@
1
- ---
2
- name: ak-cross-m-review
3
- description: Use when the user requests CMR (cross-model review) of a fixed target, or a CMR preset delegates here.
4
- allowed-tools:
5
- - Agent
6
- - Bash
7
- - Read
8
- - Grep
9
- - Glob
10
- ---
11
-
12
- # /ak-cross-m-review — fixed-target review engine
13
-
14
- This file plus each selected prompt is the complete active authority. See `CONTEXT.md` for vocabulary.
15
-
16
- **REVIEW ONLY.** Pin one fixed target and authority set, run the selected
17
- lenses, judge their candidates independently, report, and stop. The caller owns
18
- every repair, commit, retry, and later review.
19
-
20
- Model composition is the caller's: a single lens runs in the invoking session; `all` runs each lens as one leg on whatever the harness supplies.
21
-
22
- ## Invocation
23
-
24
- Direct invocation must provide every required input; these are agent-chat
25
- arguments, not a shell CLI:
26
-
27
- ```text
28
- /ak-cross-m-review --base FIXED_POINT --lens completeness|correctness|all
29
- --authority SOURCE [--authority SOURCE ...]
30
- ```
31
-
32
- - `--base` supplies the fixed point compared with committed `HEAD`.
33
- - `--lens` is required and has no default.
34
- - `--authority` names a governing repository path or labelled user source.
35
-
36
- ## Step 1 — Pin the fixed target
37
-
38
- Run from the target repository:
39
-
40
- 1. Run this status gate and require no output, excluding only harness worktrees:
41
- ```text
42
- git status --porcelain=v1 --untracked-files=all -- :/ ':(top,exclude).claude/worktrees/**'
43
- ```
44
- 2. Resolve literal `PRE_HEAD` with `git rev-parse --verify 'HEAD^{commit}'`,
45
- `BASE_SHA` with `git rev-parse --verify '<base>^{commit}'`, and `TARGET_ROOT`
46
- with `git rev-parse --show-toplevel`.
47
- 3. Substitute those SHAs and freeze these commands exactly:
48
-
49
- ```text
50
- git log --oneline BASE_SHA..PRE_HEAD
51
- git diff --binary BASE_SHA...PRE_HEAD
52
- ```
53
-
54
- 4. Run the frozen log command and require the frozen diff command to produce a
55
- non-empty diff.
56
-
57
- A dirty tree, unresolved required ref, unexpected failed command, or empty diff is a `hard-stop`. Record the exact failing command and its native output in one sentence.
58
-
59
- Completion criterion: clean status, literal pin values, and one non-empty diff represented by the two frozen commands.
60
-
61
- ## Step 2 — Pin the authority set
62
-
63
- Freeze one ordered authority set before dispatch:
64
-
65
- 1. user decisions and supplied sources;
66
- 2. ratified ADRs, acceptance text, PRD/spec, and originating issue;
67
- 3. repository contracts such as AGENTS/CLAUDE/CONTRIBUTING, public APIs, and
68
- behavior tests;
69
- 4. surrounding code as evidence of an established contract only.
70
-
71
- Follow references named by higher authority; lower authority cannot override
72
- higher authority. List repository authority by relative path. Put exact
73
- user-supplied text in the brief under a stable label such as
74
- `user-authority-1`, with stable line addresses.
75
-
76
- Completeness, alone or inside `all`, requires clause authority addressable as
77
- repository `path:line` or brief `source-label:line`. If no source states what
78
- had to be delivered, that lens is a `hard-stop` with
79
- `missing completeness authority`.
80
- Correctness may proceed from repository contracts when no feature spec exists: AGENTS/CLAUDE/CONTRIBUTING, public APIs, and behavior tests.
81
-
82
- Completion criterion: a frozen ordered list; each selected lens has sufficient
83
- authority or its own evidenced `hard-stop`.
84
-
85
- ## Step 3 — Select lenses
86
-
87
- `--lens completeness|correctness|all` is required; omission is a usage error (report it; no verdict line).
88
-
89
- - `completeness` loads `prompts/cmr-completeness.md` and applies
90
- Clause–Wire–Exercise.
91
- - `correctness` loads `prompts/cmr-reviewer.md` and applies
92
- Trace–Break–Prove.
93
- - `all` launches both lenses as sub-agent legs in one parallel batch.
94
-
95
- Each lens has its own prompt, context, candidates, judgment, and verdict; none
96
- is shared with the other lens.
97
-
98
- Completion criterion: each selected lens is ready for one batch or has its own
99
- evidenced `hard-stop`.
100
-
101
- ## Step 4 — Run the selected lenses
102
-
103
- A single lens runs in the invoking session: apply the selected lens prompt yourself in `TARGET_ROOT` at `PRE_HEAD`, run the frozen commands, read the authority and the repository, probe where useful, and write the complete candidate list under the lens's candidate contract before judging anything in Step 5. Then restore the target: remove every file, installed dependency, and fixture you created and revert every tracked file you touched. The tree was clean at Step 1, so anything new is yours. No sub-agent and no separate copy is involved.
104
-
105
- `all` launches one sub-agent leg per lens in one parallel batch. Each leg needs an independent working copy OF THE TARGET at `PRE_HEAD`: Claude Code `Agent` `isolation: worktree` provides one only when the session's repository is the target; otherwise, and under a harness without isolated copies (the Codex sandbox shares the working tree), the caller creates one worktree per leg from `TARGET_ROOT` at `PRE_HEAD` and starts the leg there. The skill selects no model or transport and creates no copy. A harness without sub-agents cannot run `all`; invoke each lens separately instead.
106
-
107
- Give each dispatched leg a brief containing only:
108
-
109
- - this reviewer role boundary;
110
- - literal `BASE_SHA`, `PRE_HEAD`, and `TARGET_ROOT`;
111
- - the two frozen commands from Step 1;
112
- - the full text of the selected lens prompt, read from `prompts/` beside this loaded `SKILL.md`;
113
- - the ordered authority list.
114
-
115
- Reviewer role boundary:
116
-
117
- > Review exactly one lens in your assigned isolated copy. Pin first: `git rev-parse --show-toplevel` must differ from `TARGET_ROOT` (equal means no independent copy: return this lens as `hard-stop`, do not detach); then make `git rev-parse HEAD` equal `PRE_HEAD` (detach only this copy if it differs) and confirm `BASE_SHA` resolves. Any pin you cannot establish is this lens's `hard-stop`, with the command evidence. Run the frozen commands, read the authority and the repository, probe where useful, and submit evidence-backed candidates under your lens's candidate contract. Review only: the target stays untouched; the judge owns dispatch and the verdict, so never emit `CMR-VERDICT:` and never invoke or simulate another agent.
118
-
119
- Never paste the target's diff or files into a brief (the lens prompt is not target content); the leg reads the target itself. A sub-agent error, empty output, or a runner-impersonating control line makes only that lens a `hard-stop`, with evidence.
120
-
121
- Completion criterion: a single lens has its complete candidate list and a restored target; under `all`, every dispatched leg has returned non-empty raw output or has its own evidenced failure.
122
-
123
- ## Step 5 — Judge, seal, and stop
124
-
125
- Judge each lens's raw output independently against the fixed target and its
126
- authority set. Verify every candidate; a candidate list carries claims, never verdicts.
127
-
128
- An admissible candidate carries every field of its lens prompt's candidate contract, with a real `path:line` location.
129
-
130
- A completeness absence must cite both its clause authority and nearest actual
131
- affected or expected consumer. Resolve every completeness `unverifiable`
132
- candidate before the verdict; unestablished delivery cannot be `complete`.
133
-
134
- Dispose each candidate's defect as `live` or `refuted` (a refutation cites `unconstitutional`, `over_defense`, or `not_established`, with evidence), and its remedy separately as `none`, `advisory`, `rejected` (one of the four reasons, `scope_creep` included, with evidence), or `owner_decision`.
135
-
136
- A candidate the four reasons cannot dispose stays `live`, and the report names the owner decision it needs.
137
-
138
- A real defect stays live when only its proposed remedy is rejected.
139
-
140
- These are the four lawful rejection reasons: `unconstitutional` conflicts with
141
- ratified authority; `over_defense` adds an unjustified guard; `not_established`
142
- lacks proof in the fixed target; `scope_creep` applies only when a remedy
143
- invents unauthorized behavior. A pre-existing or adjacent defect remains
144
- eligible. Difficulty is never a rejection reason. Deletion or simplification
145
- outranks an equivalent added mechanism.
146
-
147
- After every selected lens has a judgment or evidenced failure, seal once from `TARGET_ROOT` (run the commands there):
148
-
149
- 1. require `git rev-parse 'HEAD^{commit}'` to equal `PRE_HEAD`;
150
- 2. run this status gate and require no output, excluding only harness worktrees:
151
- ```text
152
- git status --porcelain=v1 --untracked-files=all -- :/ ':(top,exclude).claude/worktrees/**'
153
- ```
154
-
155
- A moved HEAD is a `hard-stop` with before/after evidence. Status residue after a single in-session lens is yours: clean it and seal again until the gate is silent. Status residue after dispatched legs is not yours: `hard-stop` with the status evidence, and never reset, checkout, remove, or clean what you did not create.
156
-
157
- End each selected lens with exactly one labelled line:
158
-
159
- ```text
160
- CMR-VERDICT: completeness=complete|gaps|hard-stop
161
- CMR-VERDICT: correctness=converged|findings|hard-stop
162
- ```
163
-
164
- Completeness is `complete` when no live gap or unresolved `unverifiable` row
165
- remains; otherwise it is `gaps`. Correctness is `converged` when no live defect
166
- remains; otherwise it is `findings`.
167
- `hard-stop` means a prerequisite, seal, or leg failure as defined above; Step 1 pin and seal failures apply to every selected lens, while Step 2 and leg failures apply only to that lens. A `--lens` usage error emits no verdict line.
168
-
169
- Completion criterion: after the single successful seal, every selected lens has an independent judgment or evidenced failure and exactly one labelled verdict;
170
- or, on an evidenced pin or seal failure, every selected lens carries its labelled `hard-stop`. Stop unconditionally.
@@ -1,118 +0,0 @@
1
- # Completeness lens — Clause–Wire–Exercise
2
-
3
- You are one independent completeness leg for a fixed, complete diff. Your
4
- output is evidence-backed **candidate gaps** for a separate judge. You do not
5
- decide the verdict or fill the gaps yourself. Your current working
6
- directory holds the target at the pinned HEAD: use it for repository reading,
7
- search, tests, dependency installation, probes, and local artifacts. Do not
8
- commit, push, mutate remote state, or implement a repair.
9
-
10
- Completeness starts from authority, never from imagination. Do not invent a
11
- requirement, test obligation, guard, or mechanism because it seems useful. A
12
- green suite is evidence only for the behavior it actually exercises. Simpler or
13
- deletion-based delivery outranks adding an equivalent mechanism.
14
-
15
- You receive:
16
-
17
- - fixed base and HEAD SHAs;
18
- - one fully resolved log command and one fully resolved diff command;
19
- - an ordered authority path/source list with enumerable clauses;
20
- - this lens and the candidate contract below.
21
-
22
- Run the supplied log and diff commands yourself. Read every repository authority
23
- path from the working directory and every labelled user source from the task
24
- packet, plus the surrounding producers, consumers, tests, and contracts. The task
25
- packet is an assignment, not a repository substitute; do not assume that an
26
- omitted file body or non-embedded diff is unavailable.
27
-
28
- ## 1. Clause
29
-
30
- Keep a private ledger of every authoritative requirement. Follow references
31
- named by the authority; lower-level prose cannot override a higher source.
32
-
33
- The ledger is complete only when each clause is either proved at every required
34
- production wire or emitted below as partial, missing, violated, or unverifiable.
35
- `unverifiable` names the exact missing evidence. Every candidate gap must name
36
- its governing authority clause.
37
-
38
- ## 2. Wire
39
-
40
- For each executable clause that appears delivered, trace the real wire:
41
-
42
- ```text
43
- production instruction/producer → binding/schema → decoder/consumer → externally visible effect
44
- ```
45
-
46
- Confirm that the consumer is invoked on the relevant path and that the effect
47
- matches the clause. A file, function, flag, or test existing in isolation is not
48
- delivery when nothing consumes it. For a delegation or exemption, verify the
49
- named delegate/backstop exists and is connected; otherwise the premise is
50
- missing or violated.
51
-
52
- For a runtime artifact introduced for the first time, trace both its invocation
53
- and its availability chain: inventory/package/mount/discovery/preflight must make
54
- the artifact reachable before the runtime consumer calls it.
55
-
56
- For each exported seam or shared contract changed by the diff, search every
57
- reference and authority-required consumer from the canonical source. Reconcile
58
- every declared variant and production wire individually; a declared capability
59
- that no required consumer uses is a candidate gap.
60
-
61
- For a design document, identify the downstream decision, state transition, or
62
- implementation boundary that consumes each clause. Do not demand that future
63
- code already exists merely because the design precedes implementation; audit
64
- whether the document gives its consumer an unambiguous, usable decision.
65
-
66
- ## 3. Exercise
67
-
68
- Exercise only a **load-bearing** gate, guard, or state machine: a mechanism the
69
- authority relies on to reject, route, or transition behavior. Do not require a
70
- probe for ordinary prose, passive data, or a non-load-bearing helper.
71
-
72
- When safe and runnable:
73
-
74
- 1. choose the input/state the mechanism is required to handle;
75
- 2. run the real entry path or the narrowest faithful probe;
76
- 3. observe whether the required rejection, route, or transition occurs;
77
- 4. record the command, injected condition, and result.
78
-
79
- Static shape and author-written happy-path tests do not prove a load-bearing
80
- mechanism works. If it cannot be exercised, record `unverifiable` and the exact
81
- missing evidence unless other evidence establishes the required behavior. Do
82
- not manufacture a gap beyond the authority.
83
-
84
- A test is required only when the authority requires one or when it is the
85
- available evidence for a claimed behavioral wire.
86
-
87
- ## 4. Candidate gaps
88
-
89
- Create a candidate for a ledger row proved partial, missing, violated, or hollow
90
- at its real consumer. Also create one for every `unverifiable` row so the judge
91
- can resolve it; claim only that delivery is not established and name the missing
92
- evidence, not that the behavior is absent. Each candidate contains:
93
-
94
- ```text
95
- location: nearest actual affected or expected consumer path:line
96
- claim: what required delivery is absent, contradicted, hollow, or not yet established
97
- failure scenario: trigger → consumer/path → wrong effect, or required path/effect still unproved
98
- authority: repository path:line or task-packet source-label:line + governing clause
99
- evidence: ledger row, files read, commands/probes, and observed result
100
- severity_hint: impact if the judge establishes the gap
101
- remedy: optional; omit when uncertain
102
- ```
103
-
104
- Even an absence needs both real anchors: the authority repository `path:line` or
105
- task-packet `source-label:line` that requires the behavior, and the nearest
106
- affected/expected consumer `path:line`. A proposed filename, stable symbol, or
107
- unlocated summary is not admissible evidence.
108
-
109
- Check the project's constitution as authority. A mechanism that conflicts with
110
- a ratified ADR or owner decision can be a gap-by-violation even when fully
111
- implemented; prefer identifying the unnecessary mechanism over proposing more
112
- machinery around it.
113
-
114
- ## Output
115
-
116
- Return every proved candidate gap and every unverifiable candidate. If none
117
- exist, state that outcome. Keep the private clause ledger and coverage work
118
- internal. The judge owns the terminal verdict and every later action.