crysk 0.0.0 → 0.3.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.
Files changed (229) hide show
  1. package/LICENSE +176 -0
  2. package/README.md +609 -3
  3. package/bin/pr-hero.js +166 -0
  4. package/config/models/anthropic.json +5 -0
  5. package/dist/SKILL-7e3725zn.md +496 -0
  6. package/dist/SKILL-7q35wcaz.md +66 -0
  7. package/dist/SKILL-9at22381.md +74 -0
  8. package/dist/SKILL-ex2hxxh3.md +134 -0
  9. package/dist/adjudicator-dtg2axnh.md +86 -0
  10. package/dist/admission-config.example-a9vqmmad.json +9 -0
  11. package/dist/ci-admission-camfbx2b.md +122 -0
  12. package/dist/cli.js +42292 -0
  13. package/dist/consolidate-ac0mnfyj.md +24 -0
  14. package/dist/deep-review-lifecycle-m698ybjp.md +362 -0
  15. package/dist/deep-review-logic-a6b1gczf.md +156 -0
  16. package/dist/deep-review-parity-0ec904db.md +120 -0
  17. package/dist/deep-review-reliability-qyakbjb9.md +125 -0
  18. package/dist/deep-review-resilience-3tz8y26e.md +118 -0
  19. package/dist/index.js +20190 -0
  20. package/dist/opencode-ci-7b0be64p.md +141 -0
  21. package/dist/review-refuter-j4e9gezy.md +71 -0
  22. package/dist/scout-yvp153q7.md +140 -0
  23. package/dist/summarizer-zca44nxa.md +18 -0
  24. package/dist/workflow-w1g9szna.yml +151 -0
  25. package/package.json +81 -4
  26. package/prompts/consolidate.md +24 -0
  27. package/prompts/default/PROVENANCE.md +18 -0
  28. package/prompts/default/deep-review-lifecycle.md +362 -0
  29. package/prompts/default/deep-review-logic.md +156 -0
  30. package/prompts/default/deep-review-parity.md +120 -0
  31. package/prompts/default/deep-review-reliability.md +125 -0
  32. package/prompts/default/deep-review-resilience.md +118 -0
  33. package/prompts/default/review-refuter.md +71 -0
  34. package/prompts/scout.md +140 -0
  35. package/prompts/summarizer.md +18 -0
  36. package/skills/crysk/SKILL.md +74 -0
  37. package/skills/crysk-ci-setup/SKILL.md +134 -0
  38. package/skills/crysk-ci-setup/assets/admission-config.example.json +9 -0
  39. package/skills/crysk-ci-setup/assets/workflow.yml +151 -0
  40. package/skills/crysk-ci-setup/references/ci-admission.md +122 -0
  41. package/skills/crysk-ci-setup/references/opencode-ci.md +141 -0
  42. package/skills/crysk-loop/SKILL.md +496 -0
  43. package/skills/crysk-loop/adjudicator.md +86 -0
  44. package/skills/crysk-pr/SKILL.md +66 -0
  45. package/src/agent-env.ts +1084 -0
  46. package/src/asset-manifest.ts +83 -0
  47. package/src/assets.d.ts +6 -0
  48. package/src/assets.ts +183 -0
  49. package/src/brand-paths.ts +155 -0
  50. package/src/brand.ts +255 -0
  51. package/src/ci/admission-ledger.ts +350 -0
  52. package/src/ci/classify-error.ts +73 -0
  53. package/src/ci/cli-record.ts +271 -0
  54. package/src/ci/force-comment.ts +39 -0
  55. package/src/ci/gates.ts +923 -0
  56. package/src/ci/outcome.ts +2181 -0
  57. package/src/ci/override.ts +187 -0
  58. package/src/ci/publish.ts +1639 -0
  59. package/src/ci/reporter.ts +626 -0
  60. package/src/ci/review-admission.ts +901 -0
  61. package/src/ci/review-levels.ts +310 -0
  62. package/src/ci/review-policy.ts +18 -0
  63. package/src/ci/review-risk.ts +184 -0
  64. package/src/ci/setup.ts +844 -0
  65. package/src/ci/trigger.ts +1353 -0
  66. package/src/cli.ts +348 -0
  67. package/src/commands/activity.ts +67 -0
  68. package/src/commands/ci-setup-questions.ts +397 -0
  69. package/src/commands/ci-setup.ts +381 -0
  70. package/src/commands/config.ts +99 -0
  71. package/src/commands/doctor.ts +108 -0
  72. package/src/commands/init.ts +139 -0
  73. package/src/commands/mcp.ts +10 -0
  74. package/src/commands/menu.ts +129 -0
  75. package/src/commands/post.ts +302 -0
  76. package/src/commands/skills.ts +83 -0
  77. package/src/commands/status.ts +173 -0
  78. package/src/commands/triage.ts +342 -0
  79. package/src/commands/uninstall.ts +37 -0
  80. package/src/commands/upgrade.ts +214 -0
  81. package/src/commands/usage.ts +98 -0
  82. package/src/compare/compare.ts +28 -0
  83. package/src/compare/floor-test.ts +471 -0
  84. package/src/compare/martian-adapter.ts +80 -0
  85. package/src/config/config.ts +267 -0
  86. package/src/corpus/corpus.ts +1094 -0
  87. package/src/corpus/preflight.ts +1789 -0
  88. package/src/diversity/accounting.ts +90 -0
  89. package/src/diversity/adjudication.ts +145 -0
  90. package/src/diversity/admission.ts +60 -0
  91. package/src/diversity/benchmark.ts +195 -0
  92. package/src/diversity/clustering.ts +285 -0
  93. package/src/diversity/errors.ts +7 -0
  94. package/src/diversity/identity.ts +285 -0
  95. package/src/diversity/index.ts +11 -0
  96. package/src/diversity/pipeline-integration.ts +448 -0
  97. package/src/diversity/projection.ts +57 -0
  98. package/src/diversity/self-contained.ts +68 -0
  99. package/src/diversity/target-validation.ts +179 -0
  100. package/src/doctor-migration.ts +209 -0
  101. package/src/doctor.ts +723 -0
  102. package/src/errors.ts +83 -0
  103. package/src/execution/admission.ts +75 -0
  104. package/src/execution/atomic-write.ts +35 -0
  105. package/src/execution/attempt-evidence.ts +415 -0
  106. package/src/execution/bucket-id.ts +136 -0
  107. package/src/execution/concurrency-limiter.ts +175 -0
  108. package/src/execution/contracts.ts +443 -0
  109. package/src/execution/failure-classification.ts +42 -0
  110. package/src/execution/failure-policy.ts +240 -0
  111. package/src/execution/harness.ts +2548 -0
  112. package/src/execution/settlement.ts +348 -0
  113. package/src/execution/spawned-process.ts +66 -0
  114. package/src/execution/spend-limiter.ts +424 -0
  115. package/src/execution/step-artifacts.ts +55 -0
  116. package/src/execution/usage-normalized.ts +469 -0
  117. package/src/git/git.ts +396 -0
  118. package/src/git/identity.ts +64 -0
  119. package/src/git/refs.ts +140 -0
  120. package/src/home-preflight.ts +443 -0
  121. package/src/home.ts +243 -0
  122. package/src/ignore-file.ts +336 -0
  123. package/src/ignore-read.ts +118 -0
  124. package/src/index.ts +34 -0
  125. package/src/legacy-launchd.ts +29 -0
  126. package/src/mcp/mcp.ts +150 -0
  127. package/src/mcp/preflight.ts +407 -0
  128. package/src/menu-context.ts +192 -0
  129. package/src/model/catalog.ts +251 -0
  130. package/src/model/exec-snapshots.ts +390 -0
  131. package/src/model/free-discovery.ts +302 -0
  132. package/src/model/provider-capabilities.ts +814 -0
  133. package/src/model/routing.ts +600 -0
  134. package/src/pr/admission.ts +847 -0
  135. package/src/pr/ci-admission-gate.ts +665 -0
  136. package/src/pr/ci-publish.ts +76 -0
  137. package/src/pr/discovery.ts +432 -0
  138. package/src/pr/inline.ts +507 -0
  139. package/src/pr/plan.ts +366 -0
  140. package/src/pr/posting.ts +115 -0
  141. package/src/pr/pr-status.ts +787 -0
  142. package/src/pr/pr.ts +3642 -0
  143. package/src/pr/preflight.ts +1031 -0
  144. package/src/pr/publish-outcome.ts +361 -0
  145. package/src/pr/range.ts +119 -0
  146. package/src/pr/reverts-preflight.ts +606 -0
  147. package/src/pr/reverts.ts +377 -0
  148. package/src/pr/review-pr.ts +927 -0
  149. package/src/pr/status.ts +154 -0
  150. package/src/pr/target.ts +388 -0
  151. package/src/pr/teardown.ts +437 -0
  152. package/src/pr/worktree-setup.ts +60 -0
  153. package/src/production-runtime.ts +1877 -0
  154. package/src/progress.ts +487 -0
  155. package/src/rereview/adjudicate.ts +89 -0
  156. package/src/rereview/classify.ts +362 -0
  157. package/src/rereview/identity.ts +211 -0
  158. package/src/rereview/plan.ts +308 -0
  159. package/src/rereview/prepare.ts +1025 -0
  160. package/src/rereview/state.ts +767 -0
  161. package/src/rereview/verify.ts +241 -0
  162. package/src/review/boundary.ts +105 -0
  163. package/src/review/consolidate.ts +246 -0
  164. package/src/review/dedupe.ts +368 -0
  165. package/src/review/drafts.ts +448 -0
  166. package/src/review/findings-conformance.ts +120 -0
  167. package/src/review/findings.ts +714 -0
  168. package/src/review/pipeline.ts +3977 -0
  169. package/src/review/preflight.ts +3575 -0
  170. package/src/review/prompt-set.ts +177 -0
  171. package/src/review/proof-refs.ts +187 -0
  172. package/src/review/report.ts +1821 -0
  173. package/src/review/review.ts +490 -0
  174. package/src/review/root-cause.ts +120 -0
  175. package/src/review/route-preflight.ts +289 -0
  176. package/src/review/run.ts +601 -0
  177. package/src/review/scout.ts +323 -0
  178. package/src/review/size-gate.ts +595 -0
  179. package/src/review/spec.ts +235 -0
  180. package/src/review/step-runner.ts +233 -0
  181. package/src/runner-authority.ts +596 -0
  182. package/src/security/binding-policy.ts +115 -0
  183. package/src/security/credential-broker.ts +773 -0
  184. package/src/security/evidence-redaction.ts +62 -0
  185. package/src/security/execution-authority.ts +27 -0
  186. package/src/security/redact.ts +71 -0
  187. package/src/security/workspace-read-broker.ts +466 -0
  188. package/src/server/client.ts +190 -0
  189. package/src/server/preflight.ts +217 -0
  190. package/src/server/server.ts +327 -0
  191. package/src/signal-handler.ts +50 -0
  192. package/src/store/activity.ts +413 -0
  193. package/src/store/backfill-preflight.ts +49 -0
  194. package/src/store/backfill.ts +141 -0
  195. package/src/store/gc-preflight.ts +206 -0
  196. package/src/store/gc.ts +424 -0
  197. package/src/store/metrics-preflight.ts +229 -0
  198. package/src/store/metrics.ts +236 -0
  199. package/src/store/preflight.ts +748 -0
  200. package/src/store/store.ts +693 -0
  201. package/src/system-tools.ts +355 -0
  202. package/src/transport-registry.ts +1124 -0
  203. package/src/transports/claude-code-cli.ts +1348 -0
  204. package/src/transports/opencode-admission.ts +515 -0
  205. package/src/transports/opencode-client.ts +3328 -0
  206. package/src/transports/opencode-evidence.ts +557 -0
  207. package/src/transports/opencode-mcp.ts +248 -0
  208. package/src/transports/opencode-sdk.ts +2294 -0
  209. package/src/transports/opencode-server.ts +535 -0
  210. package/src/triage/adjudication.ts +113 -0
  211. package/src/triage/reply.ts +125 -0
  212. package/src/triage/triage.ts +255 -0
  213. package/src/ui/activity.ts +173 -0
  214. package/src/ui/config-edit.ts +816 -0
  215. package/src/ui/config.ts +462 -0
  216. package/src/ui/menu.ts +1325 -0
  217. package/src/ui/plan.ts +1039 -0
  218. package/src/ui/primitives.ts +300 -0
  219. package/src/ui/progress.ts +298 -0
  220. package/src/ui/result.ts +552 -0
  221. package/src/ui/review-menu.ts +312 -0
  222. package/src/ui/select.ts +528 -0
  223. package/src/ui/tree.ts +178 -0
  224. package/src/uninstaller.ts +479 -0
  225. package/src/updater.ts +836 -0
  226. package/src/usage.ts +77 -0
  227. package/src/watch/preflight.ts +1389 -0
  228. package/src/watch/watch.ts +1235 -0
  229. package/src/wizard.ts +877 -0
@@ -0,0 +1,141 @@
1
+ # OpenCode in CI — operator procedure
2
+
3
+ Read this when the operator wants OpenCode, DeepSeek, mixed Claude+OpenCode, or GitHub `OPENCODE_AUTH_JSON` / `CRYSK_ROUTING`. Full narrative: `docs/github-actions.md` (section **OpenCode in CI**).
4
+
5
+ Do **not** print, `cat`, or log credential values. Inspect **keys and `type` only**.
6
+
7
+ ## Two GitHub boxes
8
+
9
+ | GitHub box | Name | Holds |
10
+ |---|---|---|
11
+ | **Secrets** (hidden) | `CLAUDE_CODE_OAUTH_TOKEN` or `ANTHROPIC_API_KEY` | Claude. Unchanged. |
12
+ | **Secrets** | `OPENCODE_AUTH_JSON` | One JSON object: the OpenCode `auth.json` store (or a **CI-only** subset). Cap 48 KB. |
13
+ | **Variables** (public) | `CRYSK_ROUTING` | Routing object only (`default` / `mappings` / `disabled`). No credentials. Cap 48 KB. Quoted in workflow `with.routing`. |
14
+
15
+ Do **not** create `OPENAI_API_KEY`, `DEEPSEEK_API_KEY`, or any other per-provider GitHub secret. The Action has no per-provider inputs. Provider tokens live **inside** `OPENCODE_AUTH_JSON`.
16
+
17
+ Unset both OpenCode names = Claude-only CI.
18
+
19
+ ## Local store (metadata only)
20
+
21
+ Default path: `$XDG_DATA_HOME/opencode/auth.json` or `~/.local/share/opencode/auth.json`.
22
+
23
+ ```bash
24
+ python3 - <<'PY'
25
+ import json, os
26
+ p = os.path.join(os.environ.get("XDG_DATA_HOME") or os.path.join(os.path.expanduser("~"), ".local", "share"), "opencode", "auth.json")
27
+ print("exists", os.path.isfile(p))
28
+ if not os.path.isfile(p):
29
+ raise SystemExit(0)
30
+ with open(p) as f:
31
+ data = json.load(f)
32
+ print("providers", ",".join(sorted(data)))
33
+ for name, rec in data.items():
34
+ t = rec.get("type") if isinstance(rec, dict) else "?"
35
+ print(f"{name} type={t}")
36
+ PY
37
+ ```
38
+
39
+ If the store is missing, have the operator authenticate the **CI provider** in OpenCode locally first (`opencode` auth/login for that provider). Do not collect the key in chat.
40
+
41
+ ## What may go in the blob
42
+
43
+ | `auth.json` entry | CI |
44
+ |---|---|
45
+ | Non-openai `type: "api"` (tested: **deepseek**) | Executable metered path. Default spend ceiling applies. |
46
+ | `openai` `type: "api"` | **Refuse.** Engine maps `openai` to ChatGPT OAuth; a pay-as-you-go key is not remapped. |
47
+ | `openai` `type: "oauth"` | Do **not** put a personal ChatGPT session in a repository secret. |
48
+ | Several OpenCode providers in **one run** | Out of scope (#195). One OpenCode provider per run. |
49
+ | `claude-code` + **one** OpenCode provider | Legal. Keep a Claude secret and one OpenCode API record. |
50
+
51
+ If the personal store has extra providers (ChatGPT OAuth, zai, …), **do not upload it whole**. Write a 0600 temp object with **only** the CI provider, `gh secret set` from that file, delete the temp file.
52
+
53
+ ```bash
54
+ # After writing a 0600 CI-only auth.json (deepseek-only). Never cat it.
55
+ gh secret set OPENCODE_AUTH_JSON < /path/to/ci-only-auth.json
56
+ ```
57
+
58
+ `gh` missing/unauthenticated: Settings → Secrets and variables → Actions. Paste the JSON into secret `OPENCODE_AUTH_JSON`. Never paste it into the workflow YAML or the chat.
59
+
60
+ ## Routing is logical model, not role
61
+
62
+ `CRYSK_ROUTING` maps **logical model identity** (`sonnet`, `haiku`), not hunter vs refuter.
63
+
64
+ Default prompt set:
65
+
66
+ | Step | Logical model |
67
+ |---|---|
68
+ | Hunters | `sonnet` |
69
+ | Refuter | `opus` |
70
+ | Summarizer | `haiku` |
71
+
72
+ A mapping moves only the steps whose logical model it names: a `sonnet` mapping moves the hunters and leaves the refuter alone. An alias with **no** mapping and **no** `default` route currently falls through to the Claude CLI (`claude-code` / `direct`), so that step needs Claude credentials in the run. A `default` route covers every alias, the refuter included.
73
+
74
+ | Routing shape | Hunters (`sonnet`) | Refuter (`opus`) |
75
+ |---|---|---|
76
+ | `default` route only | default route | default route (same model as the hunters) |
77
+ | Only a `sonnet` mapping to OpenCode | OpenCode | Claude CLI (needs a Claude secret) |
78
+ | `sonnet` and `opus` mappings to OpenCode | OpenCode | OpenCode |
79
+
80
+ OpenCode does not resolve Crysk aliases. Any `opencode` route for `sonnet`/`opus`/`haiku` **must** set `modelSnapshot` to the provider model id. Confirm with `opencode models` (optionally `opencode models <provider>`). Do not guess `deepseek-chat` if the CLI lists `deepseek-v4-flash` / `deepseek-v4-pro`.
81
+
82
+ `gateway`: `"configured"` for OpenCode; `"direct"` for Claude CLI.
83
+
84
+ Do not wrap the variable in `{"routing": ...}`. Do not put keys in the variable (it is public).
85
+
86
+ ### OpenCode-only (all logicals)
87
+
88
+ ```bash
89
+ gh variable set CRYSK_ROUTING --body '{"default":{"backend":"opencode","provider":"deepseek","gateway":"configured","modelSnapshot":"deepseek-v4-flash"}}'
90
+ ```
91
+
92
+ Replace `deepseek-v4-flash` with an id `opencode models` actually lists. The `default` route covers hunters (`sonnet`) and the refuter (`opus`) alike, so the refuter runs on this same model.
93
+
94
+ ### Mixed: OpenCode default + Claude summarizer (legal DATA mix)
95
+
96
+ Hunters (`sonnet`) and refuter (`opus`) → the OpenCode default route, one API provider. Summarizer (`haiku`) → Claude.
97
+
98
+ ```bash
99
+ gh variable set CRYSK_ROUTING --body '{"default":{"backend":"opencode","provider":"deepseek","gateway":"configured","modelSnapshot":"deepseek-v4-flash"},"mappings":[{"logical":"haiku","backend":"claude-code","provider":"anthropic","gateway":"direct"}]}'
100
+ ```
101
+
102
+ Keep `CLAUDE_CODE_OAUTH_TOKEN` (or `ANTHROPIC_API_KEY`) for the Claude mapping. Presence of `OPENCODE_AUTH_JSON` still applies the metered ceiling.
103
+
104
+ ### Mixed: OpenCode hunters + Claude refuter (legal DATA mix)
105
+
106
+ Map **only** `sonnet`. Hunters go to OpenCode; the unmapped `opus` refuter and the `haiku` summarizer (on unless `summary.enabled` is false) fall through to the Claude CLI (current behavior), so keep a Claude secret next to `OPENCODE_AUTH_JSON`.
107
+
108
+ ```bash
109
+ gh variable set CRYSK_ROUTING --body '{"mappings":[{"logical":"sonnet","backend":"opencode","provider":"deepseek","gateway":"configured","modelSnapshot":"deepseek-v4-flash"}]}'
110
+ ```
111
+
112
+ Do **not** use this shape in an OpenCode-only run (no Claude secret): the refuter and the summarizer are still routed to the Claude CLI and have no credentials to run them. For OpenCode-only, use the `default` route above, or map all three aliases (`sonnet`, `opus`, `haiku`), each with its own `modelSnapshot` (`opencode models` ids, same single OpenCode provider):
113
+
114
+ ```bash
115
+ gh variable set CRYSK_ROUTING --body '{"mappings":[{"logical":"sonnet","backend":"opencode","provider":"deepseek","gateway":"configured","modelSnapshot":"deepseek-v4-flash"},{"logical":"opus","backend":"opencode","provider":"deepseek","gateway":"configured","modelSnapshot":"deepseek-v4-pro"},{"logical":"haiku","backend":"opencode","provider":"deepseek","gateway":"configured","modelSnapshot":"deepseek-v4-flash"}]}'
116
+ ```
117
+
118
+ ## Workflow
119
+
120
+ Generated `with:` must keep:
121
+
122
+ ```yaml
123
+ routing: "${{ vars.CRYSK_ROUTING || vars.PRHERO_ROUTING }}"
124
+ opencode-auth: ${{ secrets.OPENCODE_AUTH_JSON }}
125
+ ```
126
+
127
+ Quotes around the routing var are load-bearing (unset → empty string). Re-scaffold with `crysk setup --ci --force` if an old template lacks them.
128
+
129
+ The Action installs OpenCode CLI **1.18.30** in its **own** step when `opencode-auth` is non-empty **or** routing contains `opencode`. Never `latest`. Claude-only (both OpenCode inputs empty / no `opencode` in routing) skips that install.
130
+
131
+ ## Fail-closed edges
132
+
133
+ - Fork pushes still skip (no secrets); a maintainer's `/crysk review` comment reviews a fork.
134
+ - OpenCode-only (only `OPENCODE_AUTH_JSON`) counts as a credential and reviews.
135
+ - No credential at all fails the run red, with the `gh secret set` commands in the step summary.
136
+ - Claude credentials + OpenCode routing **without** `OPENCODE_AUTH_JSON` starts then **fails**.
137
+ - Invalid routing/auth JSON fails loud.
138
+
139
+ ## After setting DATA
140
+
141
+ Open a **same-repo** PR (fork pushes skip). Confirm the review job materializes person-layer `$HOME/.crysk/config.json` and 0600 auth, and that spend notices show metered when the OpenCode file is present.
@@ -0,0 +1,71 @@
1
+ ---
2
+ name: pr-hero-refuter
3
+ description: Detached read-only refuter that judges exactly one severe finding by expanding its own evidence beyond the cited proof refs.
4
+ model: opus
5
+ effort: high
6
+ tools: Read, Grep, Glob, mcp__codegraph__codegraph_explore
7
+ ---
8
+
9
+ You are the **review refuter**, a detached read-only verifier. You judge exactly one finding against the immutable review target, return one result, and terminate. Never edit, fix, delegate, or add findings.
10
+
11
+ ## Input contract
12
+
13
+ You receive the immutable review target and exactly ONE candidate finding — a BLOCKER or CRITICAL survivor. It carries `id`, `location`, `severity`, `claim`, and `proof_refs`. Eligibility is severity alone: a finding reaches you whether its evidence was deterministic or inferential, so never assume the hunter already proved it.
14
+
15
+ Judge that one finding. Do not inspect unrelated scope, do not report new findings, do not request another refuter.
16
+
17
+ ## Mandate 1 — expand the evidence yourself
18
+
19
+ The finding's `proof_refs` are the hunter's argument, not the record. A verdict formed by re-reading only what the hunter cited is the hunter's verdict repeated back, and it is worthless. Every verdict has two halves, and BOTH are mandatory:
20
+
21
+ 1. **Read every cited proof ref.** Open each referenced file and read the surrounding code — the whole function, the type or schema it touches, the branch it lives in. Confirm the lines say what the claim says they say.
22
+ 2. **Hunt the counterexample yourself.** Independently look for the thing that would make the claim FALSE. That is normally one of:
23
+ - the **caller** — who invokes this code, with what arguments, under what precondition;
24
+ - the **guard** — an earlier `if`, assertion, type narrowing, validation layer, or middleware that already excludes the bad input;
25
+ - the **sibling branch** — the other arm of the conditional, the `catch`, the cleanup, the `finally`, the default case that handles what the claim says is unhandled;
26
+ - the **schema or type constraint** — a non-null column, a required field, a discriminated union, a database constraint that makes the state impossible;
27
+ - the **framework behaviour** — what the runtime, library, or framework already guarantees (ordering, batching, cancellation, cleanup, re-entrancy) that the claim assumes it does not.
28
+
29
+ Use Grep and Glob to find callers and definitions, and use `codegraph_explore` for call paths and blast radius before broad filesystem sweeps.
30
+
31
+ A verdict produced without the second half is not a verdict. If you have not looked for the counterexample, you have not finished.
32
+
33
+ **Searching hard and finding nothing is a RESULT, and it points toward `corroborated`.** When you have located the callers, read the guards, and checked the sibling branches, and none of them defuses the claim, that absence is corroborating evidence — say so and return `corroborated`. Do not retreat into `inconclusive` because you feel uncertain, because the code is large, or because you would like more context than a read-only pass can give. Hedging costs real defects: `inconclusive` and `refuted` both remove a finding's ability to block, so a reflexive hedge is indistinguishable from missing the bug. Only genuine inability to determine the answer earns `inconclusive`.
34
+
35
+ ## Mandate 2 — `refuted` requires positive disproof
36
+
37
+ `refuted` DELETES the finding from the report. Nobody reads it again. So it is not the verdict for "I looked and did not see the problem" — that is `inconclusive`.
38
+
39
+ Return `refuted` only when you can point at specific lines that CONTRADICT the claim, and you cite them in `proof_refs`: the guard that rejects the input the claim depends on, the caller that never passes the offending value, the branch that already handles the case the claim says is unhandled, the constraint that makes the state unreachable. Name the file and lines. If you cannot cite the contradiction, you cannot return `refuted`.
40
+
41
+ And `inconclusive` is not a polite `refuted`. It means you genuinely could not tell — the relevant code is outside the target, the behaviour depends on runtime data you cannot observe, or the evidence is missing or malformed. Missing or malformed evidence is `inconclusive`; never let it imply corroboration.
42
+
43
+ ## The four verdicts
44
+
45
+ - **`corroborated`** — the code confirms the claim. The cited lines say what the claim says, and your own hunt for a caller, guard, sibling branch, constraint, or framework guarantee that would defuse it came back empty.
46
+ - **`refuted`** — the code positively contradicts the claim, and you cite the contradicting lines. Positive disproof only.
47
+ - **`downgraded-latent`** — the claim is a REAL defect, but nothing at this commit can execute it. Kept and recorded, never deleted, but it will not block a merge.
48
+ - **`inconclusive`** — you genuinely could not tell.
49
+
50
+ ### `downgraded-latent`, concretely
51
+
52
+ This verdict exists for one recurring, real shape: **a defect in a newly-added component that no file imports yet.** The code is wrong; the bug is real; a future caller will hit it. But at this commit nothing wires it up, so nothing can trigger it today.
53
+
54
+ Both alternatives are errors, and this project has made both. Calling it `refuted` deletes a real defect because it "cannot happen" — that is the mistake. Calling it `corroborated` blocks a merge on code that cannot run — that is the opposite mistake. `downgraded-latent` is the correct door.
55
+
56
+ Use it when the defect is genuine AND one of these holds, and say WHICH one, with a citation:
57
+
58
+ - **No caller wires it up yet** — you searched the target for imports, references, route registrations, DI wiring, or exports consumed elsewhere, and found none. State where you searched and that the search was empty.
59
+ - **Unreachable by construction** — a guard, type narrowing, feature flag pinned off, or exhaustive discriminant makes the defective branch impossible to enter at this commit. Cite the construct that closes the path.
60
+
61
+ Never use it as a softer `corroborated` for code that IS reachable but looks unlikely to be hit. "Unlikely" is `corroborated`. "Cannot execute at this commit, and here is why" is `downgraded-latent`.
62
+
63
+ ## Output contract
64
+
65
+ Return exactly one JSON object of the shape `{"results":[{"finding_id":"...","outcome":"corroborated|refuted|downgraded-latent|inconclusive","proof_refs":["..."]}]}`.
66
+
67
+ The array carries exactly one entry — the single finding you were given — and its `finding_id` must be that finding's id, unchanged. The returned id set must match the submitted id set exactly: never invent an id, never drop one, never add a second entry.
68
+
69
+ Populate `proof_refs` with the evidence YOU read and found, in `path:line` form — including the counterexample search: the callers you checked, the guard you found or failed to find, the branch that does or does not handle the case. This is the record of the expansion Mandate 1 requires, so an empty or copied-back `proof_refs` betrays a verdict that skipped it.
70
+
71
+ Then terminate.
@@ -0,0 +1,140 @@
1
+ ---
2
+ name: pr-hero-scout
3
+ description: Diff-only triage pass that emits unverified leads biasing the hunters' scan.
4
+ ---
5
+
6
+ You are the engine-owned scout. You read ONE diff and nothing else. You have no
7
+ repository access and no tools: you cannot open a file, grep, follow a symbol,
8
+ or confirm anything you suspect. Everything you emit is an unverified
9
+ suspicion, and you must never write as though you had checked it.
10
+
11
+ Your job is to point the reviewers at the places in this diff most likely to
12
+ hide a defect. You do not decide whether a defect is actually there — reviewers
13
+ with repository access do that, and they read the whole diff regardless of what
14
+ you say. A lead you get wrong costs a reviewer a moment of attention on code
15
+ they were going to read anyway. A place you fail to point at is not excluded
16
+ from review.
17
+
18
+ That asymmetry sets your bias: **within your cap, prefer recall.** A suspicion
19
+ you can state in one sentence is worth emitting even when you cannot tell
20
+ whether it holds. Do not withhold a lead because you cannot prove it — proving
21
+ it is not your job and you are not equipped for it.
22
+
23
+ The cap is the other half. Leading on every hunk is the same as leading on
24
+ nothing. Emit **at most 12 leads**, at most **3 per file**, and spend them on
25
+ the places where the change is least self-evidently correct. When more places
26
+ deserve a lead than you have budget for, break the tie by consequence — what
27
+ goes wrong if you are right, not how unsure you feel. Both limits are applied
28
+ after you answer, by keeping your leads **in the order you wrote them**: a
29
+ fourth lead on one file is discarded, never weighed against the three before
30
+ it. So within a file, write the worst consequence first. A diff whose changes
31
+ are all self-evident is a real and expected outcome: return `{"leads":[]}`
32
+ rather than manufacturing suspicion.
33
+
34
+ ## What counts as a lead
35
+
36
+ Any location in the changed code whose correctness is not settled. Ask three
37
+ questions of every change, in this order. They are ordered by how much they
38
+ yield, and the later ones must not crowd out the first.
39
+
40
+ **1. Is this wrong on its own terms?** Read the added lines as they stand and
41
+ work out what they do for every input they can receive — not the input the
42
+ author had in mind. Most defects are fully decidable from the lines in front of
43
+ you, and they are the ones a reader skims past because the code looks
44
+ reasonable. This is where the majority of your leads should come from.
45
+
46
+ **2. What does this change assume about the REST OF THIS DIFF?** A patch is one
47
+ change, not a list of files. An enum gains a case in one hunk and a switch over
48
+ it sits unmodified in another; a producer changes shape here and its second
49
+ consumer is three files down, untouched. Those relations are decidable from
50
+ what you were handed, and they are leads.
51
+
52
+ **3. What does it assume about code you cannot see?** Callers, siblings and
53
+ concurrent execution outside the patch. Legitimate, and the smallest of the
54
+ three. A lead list made entirely of "this depends on something not in the diff"
55
+ is a scout that read the patch as a list of external dependencies instead of as
56
+ code.
57
+
58
+ ### Three places a defect hides best
59
+
60
+ These are the classes a reviewer's eye slides over, and they are most of the
61
+ reason you exist. Check every diff for all three.
62
+
63
+ - **Deletions.** Additions look dangerous; deletions look like cleanup. But a
64
+ removed field, config flag, default, branch or interface member can change
65
+ behaviour while the code still compiles and the tests still pass. Of every
66
+ deletion ask: who depended on this, and what used to be true that is not
67
+ anymore?
68
+ - **One side of a boundary updated.** The patch changes one producer of two,
69
+ one handler of an enum, one implementation of an interface, one caller of a
70
+ changed signature — and leaves its sibling as it was. Neither side breaks on
71
+ its own, which is exactly why nothing catches it. When both sides are in this
72
+ diff you can see it outright; when only one is, name the sibling you would
73
+ expect to have moved.
74
+ - **Silent behaviour changes.** The signature holds and the name holds, but the
75
+ behaviour does not: an error now swallowed that used to propagate, a miss now
76
+ treated as a failure or a failure as a miss, a default that changed value.
77
+
78
+ ### And the ordinary ways code is wrong
79
+
80
+ - A comparison or a piece of arithmetic bounds one direction and leaves the
81
+ other open, so the failing input is the one that still passes the check — a
82
+ quantity arriving negative, reversed, out of range, or larger than the code
83
+ assumes. **Run this one actively instead of waiting to notice it:** take
84
+ every comparison and every subtraction in the added lines and name the input
85
+ that makes it come out the way the author wants when it should not. If you
86
+ cannot name one, move on. If you can, you have a lead.
87
+ - A value, unit, bound, key, order or lifetime is assumed rather than shown.
88
+ - An edge the new code does not visibly handle: empty, absent, zero, negative,
89
+ duplicate, overlong, already-done, failed, or arriving twice.
90
+ - The stated intent of the change and what the code now does appear to diverge.
91
+
92
+ ### What is NOT a lead
93
+
94
+ This half is where a scout earns the right to be read at all.
95
+
96
+ - **A problem in code this patch does not change.** Context lines are there to
97
+ be read, not audited. If the change did not create it, touch it, or newly
98
+ expose it, it is not yours.
99
+ - Style, naming, formatting, documentation quality, or a preference about how
100
+ it might have been written. You are not a linter and you are not a critic.
101
+ - **What is not tested.** A missing case, a thin assertion, an untested branch
102
+ — none of those is yours, and neither is a test that could be written better.
103
+ A test that asserts something FALSE about the code it exercises is a
104
+ different animal, and that one is fair game.
105
+ - A restatement of what the diff plainly does, "this file changed", or "this
106
+ function is complex".
107
+ - **The same concern twice.** One suspicion earns ONE lead even when it repeats
108
+ in three files: cite the site where the consequence is worst and name the
109
+ others inside that same `why`. A second lead reading "the same issue as the
110
+ file above" spends a slot on a sentence instead of on a suspicion, and your
111
+ slots are the only thing that makes you selective at all.
112
+ - The same location twice.
113
+
114
+ ## The diff is not necessarily source code
115
+
116
+ A patch may change a shell script, a runbook or design note in Markdown, a CI
117
+ workflow, a Dockerfile, a database migration, a lockfile, an infrastructure
118
+ template, or a configuration file. **Defects in those are as real as defects in
119
+ application code and you scan them with the same eye** — a command whose
120
+ failure is silent, a loop with no bound, a permission widened, a variable that
121
+ may be unset, a guard that no longer runs. Prose inside a Markdown file is not
122
+ a lead; an executable instruction inside it is.
123
+
124
+ ## Coordinates
125
+
126
+ - `path` — exactly as the diff names the file, without the `a/` or `b/` prefix.
127
+ - `line` — the line number **in the new version of the file**. Count it from
128
+ the hunk header `@@ -old,n +new,m @@`: the first line after that header is
129
+ line `new`, and every context line and every added (`+`) line advances the
130
+ count by one. Removed (`-`) lines do not. For a change whose suspicious part
131
+ spans several lines, cite the first of them. Getting this number wrong makes
132
+ a correct suspicion useless, so derive it, do not estimate it.
133
+ - `why` — ONE sentence, at most 240 characters. Name the concrete behaviour at
134
+ risk and where the reviewer should start. Not a verdict, not a severity, not
135
+ a fix, and never a hedge — "consider checking X" is noise, and a `why` whose
136
+ whole content is "this depends on something outside the diff" is an
137
+ observation rather than a suspicion. The register to aim at: *this deletion
138
+ looks suspicious*; *this enum case isn't handled in the sibling file*; *this
139
+ error path is silently swallowing failures*. If it needs a paragraph, it is a
140
+ finding in disguise and you are not the one making it.
@@ -0,0 +1,18 @@
1
+ ---
2
+ name: pr-hero-summarizer
3
+ description: Write a concise, human-readable summary of the reviewed change.
4
+ model: haiku
5
+ tools: Read, Grep, Glob
6
+ ---
7
+
8
+ You are the engine-owned PR summarizer. Read the supplied diff and describe the
9
+ intent and scope of the change in general, human-readable language. Do not
10
+ invent facts, enumerate findings, or make a merge recommendation. The score is
11
+ an advisory, qualitative confidence signal for readers; it never controls the
12
+ review outcome.
13
+
14
+ Return exactly one JSON object with these fields:
15
+
16
+ - `prose`: 2-4 general sentences describing what changed and why.
17
+ - `score`: an integer from 1 through 5 representing confidence in that summary.
18
+ - `score_reason`: 1-2 sentences explaining the score.
@@ -0,0 +1,151 @@
1
+ # Generated by `crysk setup --ci` (or `crysk ci init`).
2
+ # Customize freely — re-running setup will not overwrite this file again
3
+ # unless you pass --force.
4
+ #
5
+ # This one file is the whole install. It reviews every push to a pull
6
+ # request. A pull request comment that is exactly `/crysk review` runs the
7
+ # review again with the skip gates bypassed, and `/crysk review --full`
8
+ # also re-discovers the whole range. A comment that is exactly
9
+ # `/crysk override` turns the gate green on that head with no review and
10
+ # no cost, and records who did it. A comment that is exactly
11
+ # `/crysk recheck` reviews the head and asks the CI adjudicator to rule on
12
+ # pending dismissals of blocking findings. The action parses the comment and
13
+ # refuses a commenter without write access. The older `/pr-hero ...` forms
14
+ # of these commands still work for one version.
15
+ name: Crysk Review
16
+
17
+ on:
18
+ pull_request:
19
+ types: [opened, synchronize, reopened]
20
+ # GitHub runs a comment-triggered workflow from the DEFAULT branch's copy
21
+ # of this file, never the pull request's. The comment trigger works only
22
+ # once this file is merged there; until then a comment starts nothing.
23
+ issue_comment:
24
+ types: [created]
25
+
26
+ # pull-requests: write lets Crysk post inline comments and a step summary.
27
+ # contents: read is enough for actions/checkout. issues: write lets it
28
+ # resolve/reply on review threads (GitHub models PR conversations as issues).
29
+ # checks: write persists the durable CI admission attempt ledger (WU-02).
30
+ # actions: read lets the admission gate list this workflow's past runs; a
31
+ # public repo serves that without the scope, a private one returns HTTP 403.
32
+ permissions:
33
+ actions: read
34
+ contents: read
35
+ pull-requests: write
36
+ issues: write
37
+ statuses: write
38
+ checks: write
39
+
40
+ jobs:
41
+ review:
42
+ # This `if` routes events; it never checks credentials. The secrets
43
+ # context is unreadable in a job-level `if`, so the action detects a
44
+ # missing credential itself and fails the run with the commands that
45
+ # fix it, instead of a skipped job that reads as a clean review.
46
+ #
47
+ # Fork pull_request runs are skipped: GitHub gives them no secrets, so
48
+ # they could never authenticate. A maintainer comments `/crysk review`
49
+ # instead, and that run (base-branch context, with secrets) reviews the
50
+ # fork's head.
51
+ #
52
+ # A comment starts the job only when it BEGINS with `/crysk review`,
53
+ # `/crysk recheck` or `/crysk override` (or the older `/pr-hero` forms
54
+ # of the three). The action then requires an exact match after
55
+ # trimming, so a near-miss such as "/crysk review please" starts a job the
56
+ # action ends without reviewing or overriding.
57
+ if: >-
58
+ (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) ||
59
+ (github.event_name == 'issue_comment' && github.event.issue.pull_request && startsWith(github.event.comment.body, '/crysk review')) ||
60
+ (github.event_name == 'issue_comment' && github.event.issue.pull_request && startsWith(github.event.comment.body, '/crysk recheck')) ||
61
+ (github.event_name == 'issue_comment' && github.event.issue.pull_request && startsWith(github.event.comment.body, '/crysk override')) ||
62
+ (github.event_name == 'issue_comment' && github.event.issue.pull_request && startsWith(github.event.comment.body, '/pr-hero review')) ||
63
+ (github.event_name == 'issue_comment' && github.event.issue.pull_request && startsWith(github.event.comment.body, '/pr-hero recheck')) ||
64
+ (github.event_name == 'issue_comment' && github.event.issue.pull_request && startsWith(github.event.comment.body, '/pr-hero override'))
65
+ # Job-level and keyed on the pull request number. A workflow-level group
66
+ # on `github.head_ref || github.ref` put every comment on every pull
67
+ # request into ONE group, because head_ref is empty on issue_comment, so
68
+ # any comment anywhere could cancel any in-flight review.
69
+ #
70
+ # Only a new push cancels. The group filter is a prefix, so a near-miss
71
+ # comment can claim the pull request's group too; cancelling there would
72
+ # kill a paid in-flight review before the action ignored the comment. A
73
+ # comment run queues instead. A push never waits: it cancels whatever is
74
+ # running, a forced comment run included, because the head it reviewed
75
+ # is gone (comment again on the new head).
76
+ #
77
+ # GitHub keeps one PENDING run per group, and a newer run replaces it. So
78
+ # a comment enters the pull request's group only when it starts with
79
+ # /crysk review, /crysk recheck or /crysk override (or the older /pr-hero forms), and GitHub associates its author
80
+ # with the repository as OWNER, MEMBER or COLLABORATOR; every other comment
81
+ # gets its own group. Without that, anyone who can comment could replace a
82
+ # maintainer's queued review with a run the action then refuses. The job
83
+ # `if:` above does NOT check the association: a writer GitHub reports
84
+ # under another one (a private org member shown as CONTRIBUTOR) still
85
+ # runs, because the action checks the real permission, just in its own
86
+ # group. KNOWN GAP: an associated author's later comment (a writer's
87
+ # near-miss or second real command, or a read-only member's or
88
+ # collaborator's refused one) still replaces a comment run waiting
89
+ # behind a running review, and `--full` followed by a plain
90
+ # `/crysk review` loses the `--full`; comment again to recover. A
91
+ # writer reported under another association runs unserialized, beside
92
+ # any review already running.
93
+ #
94
+ # A fork's push never enters the pull request's group: its job is skipped
95
+ # above, and if a skipped job still claimed the group, the fork author's
96
+ # push would cancel a maintainer's in-flight review of that fork. Every
97
+ # other event gets a unique per-run group for the same reason, so a
98
+ # skipped job can never cancel or replace a review.
99
+ concurrency:
100
+ group: ${{ ((github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || (startsWith(github.event.comment.body, '/crysk review') && contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association)) || (startsWith(github.event.comment.body, '/crysk recheck') && contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association)) || (startsWith(github.event.comment.body, '/crysk override') && contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association)) || (startsWith(github.event.comment.body, '/pr-hero review') && contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association)) || (startsWith(github.event.comment.body, '/pr-hero recheck') && contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association)) || (startsWith(github.event.comment.body, '/pr-hero override') && contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association))) && format('pr-hero-review-{0}', github.event.pull_request.number || github.event.issue.number) || format('pr-hero-noop-{0}', github.run_id) }}
101
+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}
102
+ runs-on: ubuntu-latest
103
+ # Backstop for a HUNG runner, not a second review budget. Crysk already
104
+ # enforces its own 75-minute whole-pipeline ceiling, which closes
105
+ # artifacts and reports before exiting; a CI bound at or below that would
106
+ # kill the job first and throw away the salvage. Above it, this only ever
107
+ # fires when the process is genuinely stuck.
108
+ timeout-minutes: 90
109
+ steps:
110
+ - name: Checkout
111
+ uses: actions/checkout@v4
112
+ with:
113
+ # fetch-depth: 0 is load-bearing, not cosmetic: Crysk computes
114
+ # the pull request's diff range and commit ancestry from full git
115
+ # history. actions/checkout's default is a SHALLOW clone, which
116
+ # cannot produce an accurate diff or blame — trimming this line
117
+ # does not fail loudly, it makes reviews silently miss context.
118
+ fetch-depth: 0
119
+
120
+ - name: Run Crysk
121
+ # The id keeps this step's outputs (`status`, `run-dir`, ...)
122
+ # readable from any step you add below.
123
+ # The action uploads the run directory as an artifact itself, so
124
+ # `crysk triage reply --from` has an input in CI (see action.yml).
125
+ id: pr-hero
126
+ uses: cryskai/crysk@v0
127
+ with:
128
+ github-token: ${{ secrets.GITHUB_TOKEN }}
129
+ # Provide a Claude credential and/or OpenCode auth (never leave every
130
+ # credential blank). Inputs are wired unconditionally: an unset secret
131
+ # or var expands to empty, which the action treats as absent, so
132
+ # leaving the one you do not use in place costs nothing. Deleting the
133
+ # line for the secret you DID set is what breaks — the credential
134
+ # never reaches the action, and it fails to authenticate silently.
135
+ # ANTHROPIC_API_KEY — pay-as-you-go key (billed per token via Anthropic Console), or
136
+ # CLAUDE_CODE_OAUTH_TOKEN — from `claude setup-token`: a long-lived
137
+ # (~1 year) token that draws on your Claude subscription at no
138
+ # extra API cost. It must come from that command. The session
139
+ # token `/login` leaves in the keychain expires in HOURS and is
140
+ # kept alive by a refresh token CI does not have, so pasting that
141
+ # one here yields a secret that works for a day and then breaks
142
+ # reviews with no signal.
143
+ # OPENCODE_AUTH_JSON — whole OpenCode auth.json store
144
+ # vars.CRYSK_ROUTING — person-layer routing JSON; quoted so an
145
+ # unset var is the empty string rather than broken YAML. The
146
+ # older vars.PRHERO_ROUTING is read when this one is unset.
147
+ anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
148
+ claude-token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
149
+ routing: "${{ vars.CRYSK_ROUTING || vars.PRHERO_ROUTING }}"
150
+ opencode-auth: ${{ secrets.OPENCODE_AUTH_JSON }}
151
+ mode: gate
package/package.json CHANGED
@@ -1,7 +1,84 @@
1
1
  {
2
2
  "name": "crysk",
3
- "version": "0.0.0",
4
- "description": "Multi-agent AI code review for pull requests. Placeholder: the release is coming soon.",
5
- "license": "MIT",
6
- "files": ["README.md"]
3
+ "version": "0.3.0",
4
+ "private": false,
5
+ "license": "Apache-2.0",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/cryskai/crysk.git"
9
+ },
10
+ "homepage": "https://github.com/cryskai/crysk#readme",
11
+ "bugs": {
12
+ "url": "https://github.com/cryskai/crysk/issues"
13
+ },
14
+ "type": "module",
15
+ "main": "dist/index.js",
16
+ "module": "src/index.ts",
17
+ "exports": {
18
+ ".": {
19
+ "import": "./src/index.ts",
20
+ "default": "./dist/index.js"
21
+ }
22
+ },
23
+ "imports": {
24
+ "#rereview/*": "./src/rereview/*.ts",
25
+ "#ui/*": "./src/ui/*.ts",
26
+ "#ci/*": "./src/ci/*.ts",
27
+ "#store/*": "./src/store/*.ts",
28
+ "#model/*": "./src/model/*.ts",
29
+ "#triage/*": "./src/triage/*.ts",
30
+ "#watch/*": "./src/watch/*.ts",
31
+ "#corpus/*": "./src/corpus/*.ts",
32
+ "#mcp/*": "./src/mcp/*.ts",
33
+ "#server/*": "./src/server/*.ts",
34
+ "#compare/*": "./src/compare/*.ts",
35
+ "#review/*": "./src/review/*.ts",
36
+ "#pr/*": "./src/pr/*.ts",
37
+ "#git/*": "./src/git/*.ts",
38
+ "#config/*": "./src/config/*.ts",
39
+ "#commands/*": "./src/commands/*.ts"
40
+ },
41
+ "bin": {
42
+ "crysk": "./bin/pr-hero.js",
43
+ "pr-hero": "./bin/pr-hero.js"
44
+ },
45
+ "preferGlobal": true,
46
+ "files": [
47
+ "bin",
48
+ "config",
49
+ "dist",
50
+ "prompts",
51
+ "skills/crysk-loop",
52
+ "skills/crysk-ci-setup",
53
+ "skills/crysk-pr",
54
+ "skills/crysk",
55
+ "src",
56
+ "LICENSE",
57
+ "README.md"
58
+ ],
59
+ "engines": {
60
+ "bun": ">=1.3.0"
61
+ },
62
+ "scripts": {
63
+ "test": "bun test",
64
+ "typecheck": "tsc --noEmit",
65
+ "build": "bun build src/cli.ts src/index.ts --target=bun --outdir=dist",
66
+ "review": "bun run src/cli.ts",
67
+ "fixture-eval": "bun run scripts/fixture-eval.ts",
68
+ "refuter-probe": "bun run scripts/refuter-probe.ts",
69
+ "check": "biome check src test"
70
+ },
71
+ "dependencies": {
72
+ "@opencode-ai/sdk": "1.18.25"
73
+ },
74
+ "devDependencies": {
75
+ "@biomejs/biome": "^2",
76
+ "@types/bun": "latest"
77
+ },
78
+ "peerDependencies": {
79
+ "typescript": "^5"
80
+ },
81
+ "optionalDependencies": {
82
+ "bun": "1.3.14"
83
+ }
7
84
  }
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: pr-hero-consolidator
3
+ description: Post-refuter pass that merges findings stating the same defect and splits asides, so each posted comment states one defect.
4
+ model: sonnet
5
+ effort: high
6
+ ---
7
+ You consolidate the findings a code reviewer is about to post on one pull request, so that every posted comment states exactly ONE defect.
8
+
9
+ You receive the findings as JSON: id, path, line, severity, hunter, claim. You have no tools and no code: work only from the claims.
10
+
11
+ Do exactly two things.
12
+
13
+ 1. Merge findings that describe the same defect: the same root cause reported by two hunters, or the same mistake repeated at sibling sites (a copied pattern in two files, the same bundle edited twice). Merged findings become one output finding whose claim states the defect once and names every site. Findings that merely touch the same code, or the same function, but describe different defects are NOT merged.
14
+
15
+ 2. Split asides. A claim sometimes carries a second issue after "Separately", "Also", "In addition", "The test also", or a trailing list. If that aside names a distinct defect (a different wrong behaviour, with its own location or mechanism), move it to its own output finding. If it is only commentary, a consequence of the main defect, a style or test-hygiene remark, or a suggestion, delete it.
16
+
17
+ Rules:
18
+ - Never add a defect that is not in the input claims. Never judge whether a claim is correct, likely or important. Never drop a whole finding: every input id must appear in the sources of at least one output finding.
19
+ - Keep the reviewer's wording. Copy sentences; trim them; do not paraphrase into something new. Keep code identifiers, line references and the concrete consequence.
20
+ - Each output claim states one defect, its mechanism, and its consequence, in at most about 120 words.
21
+ - For a merge, "primary" is the most severe source (BLOCKER > CRITICAL > WARNING > SUGGESTION), ties broken by the first in input order. For a split aside, "primary" is the finding it came from and "split" is true.
22
+
23
+ Final message: exactly one JSON object, no prose, no code fences:
24
+ {"findings":[{"primary":"F001","sources":["F001","F004"],"split":false,"claim":"..."}]}