@motivation-labs/crosscheck 0.3.1-beta.e808b4b.0 → 0.4.1-beta.1216e4e.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 (107) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +260 -50
  3. package/README.zh.md +294 -0
  4. package/assets/logo.png +0 -0
  5. package/crosscheck.config.example.yml +117 -5
  6. package/dist/__tests__/backtrace.test.d.ts +2 -0
  7. package/dist/__tests__/backtrace.test.d.ts.map +1 -0
  8. package/dist/__tests__/backtrace.test.js +158 -0
  9. package/dist/__tests__/backtrace.test.js.map +1 -0
  10. package/dist/__tests__/issue.test.d.ts +2 -0
  11. package/dist/__tests__/issue.test.d.ts.map +1 -0
  12. package/dist/__tests__/issue.test.js +244 -0
  13. package/dist/__tests__/issue.test.js.map +1 -0
  14. package/dist/__tests__/loader.test.d.ts +2 -0
  15. package/dist/__tests__/loader.test.d.ts.map +1 -0
  16. package/dist/__tests__/loader.test.js +131 -0
  17. package/dist/__tests__/loader.test.js.map +1 -0
  18. package/dist/__tests__/optimize.test.js +17 -3
  19. package/dist/__tests__/optimize.test.js.map +1 -1
  20. package/dist/ck.d.ts +3 -0
  21. package/dist/ck.d.ts.map +1 -0
  22. package/dist/ck.js +8 -0
  23. package/dist/ck.js.map +1 -0
  24. package/dist/cli.js +21 -4
  25. package/dist/cli.js.map +1 -1
  26. package/dist/commands/diagnose.d.ts +1 -0
  27. package/dist/commands/diagnose.d.ts.map +1 -1
  28. package/dist/commands/diagnose.js +14 -0
  29. package/dist/commands/diagnose.js.map +1 -1
  30. package/dist/commands/init.d.ts.map +1 -1
  31. package/dist/commands/init.js +67 -32
  32. package/dist/commands/init.js.map +1 -1
  33. package/dist/commands/issue.d.ts +23 -0
  34. package/dist/commands/issue.d.ts.map +1 -0
  35. package/dist/commands/issue.js +284 -0
  36. package/dist/commands/issue.js.map +1 -0
  37. package/dist/commands/review.d.ts.map +1 -1
  38. package/dist/commands/review.js +12 -6
  39. package/dist/commands/review.js.map +1 -1
  40. package/dist/commands/serve.d.ts +7 -1
  41. package/dist/commands/serve.d.ts.map +1 -1
  42. package/dist/commands/serve.js +152 -34
  43. package/dist/commands/serve.js.map +1 -1
  44. package/dist/commands/status.d.ts.map +1 -1
  45. package/dist/commands/status.js +1 -0
  46. package/dist/commands/status.js.map +1 -1
  47. package/dist/commands/watch.d.ts +7 -1
  48. package/dist/commands/watch.d.ts.map +1 -1
  49. package/dist/commands/watch.js +394 -127
  50. package/dist/commands/watch.js.map +1 -1
  51. package/dist/config/loader.d.ts +10 -0
  52. package/dist/config/loader.d.ts.map +1 -1
  53. package/dist/config/loader.js +196 -0
  54. package/dist/config/loader.js.map +1 -1
  55. package/dist/config/schema.d.ts +490 -35
  56. package/dist/config/schema.d.ts.map +1 -1
  57. package/dist/config/schema.js +80 -5
  58. package/dist/config/schema.js.map +1 -1
  59. package/dist/github/client.d.ts +26 -0
  60. package/dist/github/client.d.ts.map +1 -1
  61. package/dist/github/client.js +159 -2
  62. package/dist/github/client.js.map +1 -1
  63. package/dist/github/detector.d.ts +9 -2
  64. package/dist/github/detector.d.ts.map +1 -1
  65. package/dist/github/detector.js +86 -10
  66. package/dist/github/detector.js.map +1 -1
  67. package/dist/github/webhook.d.ts +6 -2
  68. package/dist/github/webhook.d.ts.map +1 -1
  69. package/dist/lib/backtrace.d.ts +20 -0
  70. package/dist/lib/backtrace.d.ts.map +1 -0
  71. package/dist/lib/backtrace.js +75 -0
  72. package/dist/lib/backtrace.js.map +1 -0
  73. package/dist/lib/board.d.ts +54 -0
  74. package/dist/lib/board.d.ts.map +1 -0
  75. package/dist/lib/board.js +406 -0
  76. package/dist/lib/board.js.map +1 -0
  77. package/dist/lib/log-analysis.d.ts +17 -0
  78. package/dist/lib/log-analysis.d.ts.map +1 -0
  79. package/dist/lib/log-analysis.js +72 -0
  80. package/dist/lib/log-analysis.js.map +1 -0
  81. package/dist/lib/runner.d.ts +10 -1
  82. package/dist/lib/runner.d.ts.map +1 -1
  83. package/dist/lib/runner.js +130 -52
  84. package/dist/lib/runner.js.map +1 -1
  85. package/dist/lib/verdict.d.ts +1 -0
  86. package/dist/lib/verdict.d.ts.map +1 -1
  87. package/dist/lib/verdict.js +27 -7
  88. package/dist/lib/verdict.js.map +1 -1
  89. package/dist/lib/workflow.d.ts +14 -14
  90. package/dist/lib/workflow.d.ts.map +1 -1
  91. package/dist/lib/workflow.js +22 -5
  92. package/dist/lib/workflow.js.map +1 -1
  93. package/dist/reviewers/claude.d.ts +1 -1
  94. package/dist/reviewers/claude.d.ts.map +1 -1
  95. package/dist/reviewers/claude.js +4 -6
  96. package/dist/reviewers/claude.js.map +1 -1
  97. package/dist/reviewers/codex.d.ts +2 -2
  98. package/dist/reviewers/codex.d.ts.map +1 -1
  99. package/dist/reviewers/codex.js +17 -8
  100. package/dist/reviewers/codex.js.map +1 -1
  101. package/dist/reviewers/fix.d.ts +5 -0
  102. package/dist/reviewers/fix.d.ts.map +1 -0
  103. package/dist/reviewers/fix.js +87 -0
  104. package/dist/reviewers/fix.js.map +1 -0
  105. package/get-started.md +1020 -0
  106. package/get-started.zh.md +838 -0
  107. package/package.json +9 -4
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 Motivation Labs
3
+ Copyright (c) 2025–2026 Motivation Labs LLC.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,103 +1,313 @@
1
+ <div align="right">
2
+ <h5><a href="./README.zh.md">🌏 &nbsp;中文</a></h5>
3
+ </div>
4
+
5
+ <p align="center">
6
+ <img src="./assets/logo.png" alt="crosscheck" width="160" />
7
+ </p>
8
+
9
+ <p align="center"><em>Building crosscheck with crosscheck.</em></p>
10
+
1
11
  # crosscheck
2
12
 
3
- Cross-vendor AI code review orchestrator. When Claude Code opens a PR, Codex reviews it. When Codex opens a PR, Claude reviews it. Runs locally using your existing subscriptions — no separate API billing required.
13
+ **A lightweight orchestration layer that makes your AI coding agents review each other's work then fix it.**
14
+
15
+ When Claude Code opens a PR, Codex reviews it. When Codex opens a PR, Claude reviews it. If issues are found on a Claude-authored PR, Claude commits fixes and pushes them back. All of this runs on your laptop, against your existing subscriptions, with a single command.
4
16
 
5
- ```bash
6
- npm install -g @motivation-labs/crosscheck # stable
7
- npm install -g @motivation-labs/crosscheck@beta # latest features
8
- crosscheck init
9
- crosscheck review https://github.com/owner/repo/pull/123 --reviewer codex
10
17
  ```
18
+ GitHub PR → crosscheck watch → AI review posted → fixes committed
19
+ ```
20
+
21
+ > Inspired by [Symphony](https://github.com/openai/symphony) — OpenAI's spec-driven multi-agent framework. Where Symphony coordinates agents at the product level, crosscheck stays at the level engineers already live in: pull requests, diffs, and code review. No new abstractions — just the CR + fix loop, automated.
11
22
 
12
23
  ---
13
24
 
14
- **[→ Full documentation: get-started.md](./get-started.md)**
25
+ ## Why
15
26
 
16
- Covers prerequisites, install, all commands and flags, full config reference, and how it works under the hood.
27
+ Coding agents ship fast. They also make confident, plausible mistakes. The fix isn't a human reviewer on every AI-authored PR — it's the *other* AI reviewing it. Claude and Codex have complementary blind spots; cross-vendor review catches more issues than either model alone, without adding human latency to every commit.
28
+
29
+ crosscheck wires that loop:
30
+
31
+ | | |
32
+ |---|---|
33
+ | **Local execution, always listening** | Runs on your machine. `crosscheck watch` opens a tunnel and keeps running. No cloud, no infra, no SaaS. |
34
+ | **Subscription-funded** | Uses `claude` and `codex` CLIs against your existing Claude Pro/Max and ChatGPT Plus/Pro plans. No per-token API billing. Reviews are free once you're subscribed. |
35
+ | **Cross-vendor by default** | Claude reviews Codex PRs; Codex reviews Claude PRs. Each model brings different training and different failure modes. The overlap is where bugs hide. |
36
+ | **Self-improving** | `crosscheck diagnose` surfaces failure patterns from logs. `crosscheck optimize` feeds them to your AI and updates reviewer instructions automatically. |
17
37
 
18
38
  ---
19
39
 
20
40
  ## Quick start
21
41
 
22
- **1. Install CLIs and authenticate**
23
-
24
42
  ```bash
25
- # crosscheck
43
+ # 1. Install crosscheck and the agent CLIs
26
44
  npm install -g @motivation-labs/crosscheck
45
+ npm install -g @anthropic-ai/claude-code && claude # Claude Pro/Max subscription
46
+ npm install -g @openai/codex && codex login --device-auth # ChatGPT Plus/Pro subscription
47
+ brew install gh && gh auth login # GitHub CLI
48
+
49
+ # 2. Check your environment
50
+ crosscheck init
51
+
52
+ # 3. Test against a single PR
53
+ crosscheck review https://github.com/your-org/repo/pull/42
54
+
55
+ # 4. Run continuously
56
+ crosscheck watch
57
+ ```
58
+
59
+ `crosscheck watch` opens a `localhost.run` SSH tunnel (no install, no account), auto-registers a GitHub webhook, and starts listening. GitHub delivers PR events; crosscheck routes them to the right reviewer.
60
+
61
+ ---
62
+
63
+ ## How it works
64
+
65
+ ```
66
+ ┌────────────────────────────────────────────────────────────────┐
67
+ │ Your laptop │
68
+ │ │
69
+ │ crosscheck watch │
70
+ │ ├── SSH tunnel (localhost.run) ◄──── GitHub webhook │
71
+ │ ├── Webhook server (:7891) │
72
+ │ └── PR handler │
73
+ │ ├── detect origin (Claude Code? Codex? other?) │
74
+ │ ├── clone PR branch │
75
+ │ ├── run reviewer (cross-vendor assignment) │
76
+ │ ├── post review comment │
77
+ │ └── post-review auto-fix │
78
+ │ ├── authoring vendor reads review comment │
79
+ │ └── opens fix PR targeting original branch │
80
+ └────────────────────────────────────────────────────────────────┘
81
+ ```
82
+
83
+ **Routing** uses a four-signal chain: PR body patterns → commit `Co-Authored-By:` trailers → branch prefix (`claude/` or `codex/`) → `author_routes` config fallback. `Generated with [Claude Code]` → Codex reviews. `Generated with [OpenAI Codex]` → Claude reviews. `allowed_authors` restricts reviews to your agent accounts.
84
+
85
+ **Post-review auto-fix** runs after the review when issues are found. The vendor that authored the PR (`fixer: same-as-author`) reads its own review comment and opens a new fix PR targeting the original branch. You review and merge the fix PR — the original PR then updates automatically. Controlled by `post_review.auto_fix` in your config.
86
+
87
+ **The feedback loop** closes via `crosscheck diagnose` → `crosscheck optimize`. Failure patterns and quality signals from `~/.crosscheck/logs/` feed back into improved reviewer instructions — no manual config editing required.
88
+
89
+ ---
90
+
91
+ ## watch output
92
+
93
+ ```
94
+ $ crosscheck watch
27
95
 
28
- # Claude Code uses your claude.ai Pro/Max subscription
29
- npm install -g @anthropic-ai/claude-code && claude
96
+ "Move fast and review things."
30
97
 
31
- # Codex — uses your ChatGPT Plus/Pro subscription
32
- npm install -g @openai/codex && codex login --device-auth
98
+ crosscheck watch
33
99
 
34
- # GitHub CLI
35
- brew install gh && gh auth login
100
+ repos your-org/your-repo
101
+ mode cross-vendor
102
+ quality balanced
103
+ auto-fix on_issues · same-as-author · pull_request
104
+ config ./crosscheck.config.yml ← edit to change above
105
+
106
+ ✓ tunnel ready: https://abc123.lhr.life
107
+ ✓ webhook registered for your-org/your-repo
108
+ Waiting for PR events — Ctrl+C to stop.
109
+
110
+ PR #47 opened: add retry logic for flaky network calls
111
+ origin=claude reviewer=codex
112
+ codex reviewing... (12s)
113
+ review complete (12s)
114
+ posted → github.com/your-org/your-repo/pull/47
115
+ NEEDS WORK
116
+ auto-fix claude fixing...
117
+ fix PR #48 opened → github.com/your-org/your-repo/pull/48
118
+
119
+ PR #49 opened: implement caching layer
120
+ origin=codex reviewer=claude
121
+ claude reviewing... (18s)
122
+ review complete (18s)
123
+ posted → github.com/your-org/your-repo/pull/49
124
+ APPROVE
36
125
  ```
37
126
 
38
- **2. Set env vars**
127
+ ---
128
+
129
+ ## Commands
39
130
 
40
131
  ```bash
41
- export GITHUB_TOKEN=ghp_... # needs repo + pull-requests:write scope
42
- export CROSSCHECK_WEBHOOK_SECRET=secret # any random string
132
+ crosscheck init # check prerequisites, write starter config
133
+ crosscheck review <pr-url> # one-shot review of a specific PR
134
+ crosscheck watch # local dev — tunnel + auto-webhook + listening
135
+ crosscheck serve # always-on — fixed port, register webhook once
136
+ crosscheck status # auth state, config, log summary, CLI versions
137
+ crosscheck diagnose # surface failure patterns from review logs
138
+ crosscheck optimize [--apply] # update reviewer instructions from diagnose output
139
+ crosscheck impact [--money] # time saved, issues caught, code quality trends
140
+ ```
141
+
142
+ ---
143
+
144
+ ## Configuration
145
+
146
+ Config lives at `~/.crosscheck/config.yml` by default — persistent across all projects, no per-repo file needed. Run `crosscheck init` to generate it. Project-local `crosscheck.config.yml` overrides the global config when present.
147
+
148
+ ```yaml
149
+ # Which repos/orgs to watch (at least one required)
150
+ orgs:
151
+ - your-org # covers every repo in the org
152
+
153
+ # Only review PRs from these GitHub accounts
154
+ # Auto-filled with your login by `crosscheck init` or first `crosscheck watch`
155
+ routing:
156
+ allowed_authors:
157
+ - your-github-login # auto-detected from gh auth
158
+
159
+ # Review depth
160
+ quality:
161
+ tier: balanced # fast | balanced | thorough
162
+
163
+ # Optional spend cap
164
+ budget:
165
+ per_review_usd: 2.0
166
+ codex_monthly_usd: 50
167
+
168
+ # Tunnel backend (watch mode only)
169
+ # localhost.run — zero install, reconnects automatically (default)
170
+ # smee — stable channel URL, queues events while offline
171
+ tunnel:
172
+ backend: localhost.run
173
+
174
+ # Post-review auto-fix — opens a fix PR when issues are found
175
+ post_review:
176
+ auto_fix:
177
+ enabled: true
178
+ trigger: on_issues # on_issues | always | never
179
+ min_severity: warning # error | warning | info
180
+ fixer: same-as-author # the vendor that wrote the PR also fixes it
181
+ delivery:
182
+ mode: pull_request # pull_request | commit | comment
43
183
  ```
44
184
 
45
- **3. Init and test**
185
+ Full configuration reference: [get-started.md](./get-started.md)
186
+
187
+ ---
188
+
189
+ ## Self-improving reviews
190
+
191
+ Every review outcome is logged to `~/.crosscheck/logs/YYYY-MM-DD.ndjson`. Over time, patterns emerge — which commands the reviewer tries to run (and fails), verdict distributions, review duration trends.
46
192
 
47
193
  ```bash
48
- crosscheck init
49
- crosscheck review https://github.com/owner/repo/pull/123 --reviewer codex
194
+ # See what's going wrong
195
+ $ crosscheck diagnose
196
+
197
+ crosscheck diagnose (2026-01-01 → 2026-05-08 · 3 log files)
198
+
199
+ Reviews 47 total — 28 APPROVE 14 NEEDS WORK 5 BLOCK
200
+ Failure rate codex 12% / claude 4%
201
+
202
+ Suggestions
203
+ ─────────────────────────────────────────────────────────────
204
+ ✦ codex runs `npm test` during review (7 occurrences)
205
+ → add to instructions: "Do not run npm, tsc, or test commands."
206
+ ✦ 3 reviews timed out on large PRs (>400 lines changed)
207
+ → consider quality.tier: fast for PRs above a size threshold
208
+
209
+ # Apply the suggested fixes automatically
210
+ $ crosscheck optimize --apply
211
+ agent claude (lower failure rate: 4% vs codex 12%)
212
+ writing ~/.crosscheck/instructions.md
213
+ + Do not run npm, tsc, jest, or any build/test commands.
214
+ + Flag PRs over 400 lines changed as too large to review thoroughly.
215
+ done
216
+
217
+ # Measure the compounding value
218
+ $ crosscheck impact --money
219
+
220
+ crosscheck impact (all time · 47 reviews)
221
+
222
+ Time saved
223
+ ──────────────────────────────────────────────
224
+ Reviews run 47
225
+ Avg AI review time ~14 min
226
+ Assumed human time 60 min ⓘ
227
+ Total time saved ~43 h
228
+
229
+ Issues caught
230
+ ──────────────────────────────────────────────
231
+ APPROVE 28 (60%)
232
+ NEEDS WORK 14 (30%) ← actionable feedback
233
+ BLOCK 5 (11%) ← potential bugs / breaking changes
234
+ Total issues caught 19
235
+
236
+ Estimated value: ~$8,450
237
+ (43h × $150/hr + 19 issues × $150/issue)
50
238
  ```
51
239
 
52
- **4. Run continuously**
240
+ ---
241
+
242
+ ## Deployment
243
+
244
+ ### Laptop — `crosscheck watch`
245
+
246
+ Zero configuration. SSH tunnel through `localhost.run` handles NAT — no port-forwarding, no cloud account. If the tunnel goes silent without exiting, the health check detects it within ~2 minutes and forces a reconnect + webhook re-registration.
53
247
 
54
248
  ```bash
55
- # Local dev — tunnels via localhost.run (SSH), auto-registers webhook
56
249
  crosscheck watch
250
+ # → opens tunnel, registers webhook, starts listening
251
+ ```
252
+
253
+ ### Server — `crosscheck serve`
254
+
255
+ Bind to a fixed port on a machine with a public IP. Register the webhook once.
57
256
 
58
- # Always-on machine — listens on fixed port, you register webhook once
257
+ ```bash
59
258
  crosscheck serve
259
+ # → listens on :7891, you register https://your-server/webhook manually
60
260
  ```
61
261
 
62
- ---
262
+ ### smee.io — stable relay (optional)
63
263
 
64
- ## Goals
264
+ `localhost.run` drops events if your laptop is offline when a PR opens. [smee.io](https://smee.io) queues them and replays on reconnect — useful when the reviewer machine isn't always on.
65
265
 
66
- - **Use your existing subscriptions** — no per-token API billing; runs `claude` and `codex` CLIs locally
67
- - **Zero infrastructure** — a single command on any machine with both CLIs installed
68
- - **Config-as-code**one flat YAML file, readable and writable by coding agents
69
- - **Two deployment modes** — `watch` for laptops, `serve` for always-on machines
266
+ ```bash
267
+ npm install -g smee-client
268
+ # Visit https://smee.io/new copy the channel URL
269
+ ```
70
270
 
71
- ## Non-goals
271
+ ```yaml
272
+ # ~/.crosscheck/config.yml
273
+ tunnel:
274
+ backend: smee
275
+ smee_channel: https://smee.io/your-channel-id
276
+ ```
72
277
 
73
- - Not a replacement for human code review
74
- - Not a merge gate — posts comments, does not block PRs
75
- - Not a hosted service — runs on your machine, against your CLIs
278
+ crosscheck registers the webhook automatically on first `watch` start — no manual webhook setup needed.
76
279
 
77
280
  ---
78
281
 
79
282
  ## Requirements
80
283
 
81
- | Dependency | Why it's needed | Install |
82
- |---|---|---|
83
- | Node.js 18+ | Runs crosscheck itself | [nodejs.org](https://nodejs.org) |
84
- | Claude Code CLI | Performs AI code review on Codex PRs | `npm install -g @anthropic-ai/claude-code` |
85
- | Codex CLI | Performs AI code review on Claude PRs | `npm install -g @openai/codex` |
86
- | GitHub CLI (`gh`) | Clones PR branches, posts review comments, registers webhooks | `brew install gh` |
87
- | `GITHUB_TOKEN` | Authenticates GitHub API calls (webhook registration, comment posting) | [github.com/settings/tokens](https://github.com/settings/tokens) — needs `repo` + `write:org` scopes |
284
+ | | Minimum |
285
+ |---|---|
286
+ | Node.js | 18+ |
287
+ | Claude Code CLI | latest `npm install -g @anthropic-ai/claude-code` |
288
+ | Codex CLI | latest `npm install -g @openai/codex` |
289
+ | GitHub CLI | 2.65+ `brew install gh` |
88
290
 
89
- ### `watch` mode only
291
+ `GITHUB_TOKEN` is derived automatically when `gh auth login` has been run. No manual export required.
90
292
 
91
- `watch` mode needs a public URL so GitHub can deliver webhook events to your laptop. Since laptops are behind NAT, a tunnel is required. crosscheck uses `localhost.run` — no install, no account, just SSH (pre-installed on macOS/Linux):
293
+ ---
92
294
 
93
- ```
94
- GitHub → ssh tunnel → localhost:7891
95
- ```
295
+ ## Documentation
296
+
297
+ | | |
298
+ |---|---|
299
+ | **[get-started.md](./get-started.md)** | Full setup guide — prerequisites, all commands and flags, complete config reference, how it works, FAQ |
300
+ | **[crosscheck.config.example.yml](./crosscheck.config.example.yml)** | Annotated config file with every option |
301
+ | **[AGENT.md](./AGENT.md)** | Harness document used by `crosscheck optimize` — how the AI improves reviewer instructions |
302
+
303
+ ---
304
+
305
+ ## Contributing
96
306
 
97
- No tunnel is needed for `serve` mode, which assumes the machine already has a publicly reachable IP.
307
+ Issues and PRs welcome at [github.com/Motivation-Labs/crosscheck](https://github.com/Motivation-Labs/crosscheck).
98
308
 
99
309
  ---
100
310
 
101
311
  ## License
102
312
 
103
- MIT
313
+ [MIT](./LICENSE) — Copyright (c) 2025–2026 Motivation Labs LLC.
package/README.zh.md ADDED
@@ -0,0 +1,294 @@
1
+ <div align="right">
2
+ <h5><a href="./README.md">🌐 &nbsp;English</a></h5>
3
+ </div>
4
+
5
+ <p align="center">
6
+ <img src="./assets/logo.png" alt="crosscheck" width="160" />
7
+ </p>
8
+
9
+ # crosscheck
10
+
11
+ **一个轻量级编排层,让你的 AI 编程助手互相审查代码——并自动修复问题。**
12
+
13
+ 当 Claude Code 提交 PR 时,由 Codex 审查;当 Codex 提交 PR 时,由 Claude 审查。发现问题后,原作者 Agent 提交修复并推送回去。这一切都在你的本地机器上运行,使用你已有的订阅,一条命令即可启动。
14
+
15
+ ```
16
+ GitHub PR → crosscheck watch → AI 审查意见发布 → 修复提交
17
+ ```
18
+
19
+ > 灵感来自 [Symphony](https://github.com/openai/symphony) —— OpenAI 的规范驱动多智能体框架。Symphony 在产品/交付层面协调 Agent,而 crosscheck 保持在工程师最熟悉的工作层面:Pull Request、代码差异和 Code Review。无需引入新的抽象概念——只是将 CR + 修复的工作流程自动化。
20
+
21
+ ---
22
+
23
+ ## 为什么选择 crosscheck
24
+
25
+ AI 编程助手提交代码的速度很快,但也会自信地犯下看似合理的错误。解决方案不是让人类审查每一个 AI 提交的 PR——而是让*另一个* AI 来审查。Claude 和 Codex 有互补的盲点,跨供应商审查比任何单一模型都能发现更多问题,同时不会给每次提交增加人工审查的延迟。
26
+
27
+ crosscheck 将这个闭环连接起来:
28
+
29
+ | | |
30
+ |---|---|
31
+ | **本地执行,持续监听** | 在你的机器上运行。`crosscheck watch` 打开隧道后持续运行,无需云服务、基础设施或 SaaS。 |
32
+ | **订阅驱动,无额外计费** | 调用 `claude` 和 `codex` 命令行工具,使用你已有的 Claude Pro/Max 和 ChatGPT Plus/Pro 订阅。无需按 token 付费,订阅后审查完全免费。 |
33
+ | **默认跨供应商** | Claude 审查 Codex 的 PR;Codex 审查 Claude 的 PR。每个模型有不同的训练数据和不同的故障模式,交叉点正是 Bug 藏身之处。 |
34
+ | **持续自我优化** | `crosscheck diagnose` 从日志中发现失败模式,`crosscheck optimize` 将这些模式反馈给 AI,自动更新审查指令。 |
35
+
36
+ ---
37
+
38
+ ## 快速开始
39
+
40
+ ```bash
41
+ # 1. 安装 crosscheck 及 Agent CLI
42
+ npm install -g @motivation-labs/crosscheck
43
+ npm install -g @anthropic-ai/claude-code && claude # 需要 Claude Pro/Max 订阅
44
+ npm install -g @openai/codex && codex login --device-auth # 需要 ChatGPT Plus/Pro 订阅
45
+ brew install gh && gh auth login # GitHub CLI
46
+
47
+ # 2. 检查运行环境
48
+ crosscheck init
49
+
50
+ # 3. 对单个 PR 进行测试
51
+ crosscheck review https://github.com/your-org/repo/pull/42
52
+
53
+ # 4. 持续运行
54
+ crosscheck watch
55
+ ```
56
+
57
+ `crosscheck watch` 会通过 `localhost.run` 建立 SSH 隧道(无需安装任何软件,无需账号),自动注册 GitHub Webhook,然后开始监听。GitHub 推送 PR 事件后,crosscheck 将其路由到正确的审查者。
58
+
59
+ ---
60
+
61
+ ## 工作原理
62
+
63
+ ```
64
+ ┌────────────────────────────────────────────────────────────────┐
65
+ │ 你的笔记本 │
66
+ │ │
67
+ │ crosscheck watch │
68
+ │ ├── SSH 隧道 (localhost.run) ◄──── GitHub Webhook │
69
+ │ ├── Webhook 服务器 (:7891) │
70
+ │ └── PR 处理器 │
71
+ │ ├── 识别来源 (Claude Code? Codex? 其他?) │
72
+ │ ├── 克隆 PR 分支 │
73
+ │ ├── 运行审查者 (跨供应商分配) │
74
+ │ ├── 发布审查评论 │
75
+ │ └── 地址步骤 (修复问题,推送 [crosscheck] 提交) │
76
+ └────────────────────────────────────────────────────────────────┘
77
+ ```
78
+
79
+ **路由** 基于 PR 正文的匹配模式。`Generated with [Claude Code]` → 由 Codex 审查;`Generated with [OpenAI Codex]` → 由 Claude 审查。`allowed_authors` 字段将审查限制在你的 Agent 账号提交的 PR 上。
80
+
81
+ **地址步骤**(可选,通过工作流配置启用)在审查完成后运行。原作者 Agent 读取自己的审查评论并将修复提交回 PR 分支,提交前缀为 `[crosscheck]`,每个 PR 最多提交 5 次修复。
82
+
83
+ **反馈闭环** 通过 `crosscheck diagnose` → `crosscheck optimize` 实现。`~/.crosscheck/logs/` 中的失败模式和质量信号会自动反馈为更好的审查指令,无需手动编辑配置。
84
+
85
+ ---
86
+
87
+ ## watch 运行输出示例
88
+
89
+ ```
90
+ $ crosscheck watch
91
+
92
+ "Move fast and review things."
93
+
94
+ crosscheck watch
95
+
96
+ repos your-org/your-repo
97
+ mode cross-vendor
98
+ quality balanced
99
+ config ./crosscheck.config.yml ← 编辑此文件可修改配置
100
+
101
+ ✓ 隧道已就绪: https://abc123.lhr.life
102
+ ✓ 已为 your-org/your-repo 注册 Webhook
103
+ 等待 PR 事件 — 按 Ctrl+C 停止。
104
+
105
+ PR #47 opened: add retry logic for flaky network calls
106
+ origin=claude reviewer=codex
107
+ codex reviewing... (12s)
108
+ review complete (12s)
109
+ posted → github.com/your-org/your-repo/pull/47
110
+ NEEDS WORK
111
+
112
+ PR #48 opened: implement caching layer
113
+ origin=codex reviewer=claude
114
+ claude reviewing... (18s)
115
+ review complete (18s)
116
+ posted → github.com/your-org/your-repo/pull/48
117
+ APPROVE
118
+ ```
119
+
120
+ ---
121
+
122
+ ## 命令列表
123
+
124
+ ```bash
125
+ crosscheck init # 检查环境,生成初始配置文件
126
+ crosscheck review <pr-url> # 对指定 PR 进行一次性审查
127
+ crosscheck watch # 本地开发模式——隧道 + 自动 Webhook + 监听
128
+ crosscheck serve # 常驻模式——固定端口,手动注册 Webhook
129
+ crosscheck status # 查看认证状态、配置、日志摘要、CLI 版本
130
+ crosscheck diagnose # 从审查日志中提取失败模式
131
+ crosscheck optimize [--apply] # 根据 diagnose 输出更新审查指令
132
+ crosscheck impact [--money] # 节省时间、发现问题、代码质量趋势报告
133
+ ```
134
+
135
+ ---
136
+
137
+ ## 配置说明
138
+
139
+ `crosscheck.config.yml` 位于项目根目录,AI 编程助手可以直接读取和修改它。
140
+
141
+ ```yaml
142
+ # 监听的组织/仓库(至少配置一项)
143
+ orgs:
144
+ - your-org # 覆盖该组织下的所有仓库
145
+
146
+ # 仅审查这些 GitHub 账号提交的 PR
147
+ routing:
148
+ allowed_authors:
149
+ - your-claude-bot-account
150
+ - your-codex-bot-account
151
+
152
+ # 审查深度
153
+ quality:
154
+ tier: balanced # fast(快速)| balanced(均衡)| thorough(深度)
155
+
156
+ # 可选费用上限
157
+ budget:
158
+ per_review_usd: 2.0
159
+ codex_monthly_usd: 50
160
+
161
+ # 隧道后端(仅 watch 模式使用)
162
+ # localhost.run — 无需安装,自动重连(默认)
163
+ # smee — 稳定的频道 URL,离线时事件排队
164
+ tunnel:
165
+ backend: localhost.run
166
+ ```
167
+
168
+ 完整配置参考:[get-started.zh.md](./get-started.zh.md)
169
+
170
+ ---
171
+
172
+ ## 持续自我优化
173
+
174
+ 每次审查结果都会记录到 `~/.crosscheck/logs/YYYY-MM-DD.ndjson`。随着时间推移,规律会逐渐显现——审查者尝试运行(并失败)的命令、判断分布、审查时长趋势。
175
+
176
+ ```bash
177
+ # 查看问题所在
178
+ $ crosscheck diagnose
179
+
180
+ crosscheck diagnose (2026-01-01 → 2026-05-08 · 3 个日志文件)
181
+
182
+ 审查总计 47 次 — 28 APPROVE 14 NEEDS WORK 5 BLOCK
183
+ 失败率 codex 12% / claude 4%
184
+
185
+ 建议
186
+ ─────────────────────────────────────────────────────────────
187
+ ✦ codex 在审查时尝试运行 `npm test`(7 次)
188
+ → 在 instructions 中添加:"不要运行 npm、tsc 或测试命令。"
189
+ ✦ 3 次审查在大型 PR(>400 行改动)上超时
190
+ → 考虑为超过一定大小的 PR 设置 quality.tier: fast
191
+
192
+ # 自动应用修复建议
193
+ $ crosscheck optimize --apply
194
+ agent claude(失败率更低:4% vs codex 12%)
195
+ 正在写入 ~/.crosscheck/instructions.md
196
+ + 不要运行 npm、tsc、jest 或任何构建/测试命令。
197
+ + 将超过 400 行改动的 PR 标记为过大,无法进行深度审查。
198
+ 完成
199
+
200
+ # 量化累计价值
201
+ $ crosscheck impact --money
202
+
203
+ crosscheck impact (全部时间 · 47 次审查)
204
+
205
+ 节省时间
206
+ ──────────────────────────────────────────────
207
+ 审查次数 47
208
+ AI 平均审查时间 ~14 分钟
209
+ 人工预估时间 60 分钟 ⓘ
210
+ 共节省时间 ~43 小时
211
+
212
+ 发现问题
213
+ ──────────────────────────────────────────────
214
+ APPROVE 28 (60%)
215
+ NEEDS WORK 14 (30%) ← 可操作的反馈
216
+ BLOCK 5 (11%) ← 潜在 Bug / 破坏性变更
217
+ 共发现问题 19
218
+
219
+ 估算价值: ~$8,450
220
+ (43h × $150/hr + 19 个问题 × $150/个)
221
+ ```
222
+
223
+ ---
224
+
225
+ ## 部署方式
226
+
227
+ ### 笔记本 — `crosscheck watch`
228
+
229
+ 零配置。通过 `localhost.run` 建立 SSH 隧道处理 NAT 穿透,无需端口转发,无需云账号。如果隧道静默断开,健康检查会在约 2 分钟内检测到并强制重连 + 重新注册 Webhook。
230
+
231
+ ```bash
232
+ crosscheck watch
233
+ # → 打开隧道,注册 Webhook,开始监听
234
+ ```
235
+
236
+ ### 服务器 — `crosscheck serve`
237
+
238
+ 绑定到具有公网 IP 的机器上的固定端口,手动注册一次 Webhook 即可。
239
+
240
+ ```bash
241
+ crosscheck serve
242
+ # → 监听 :7891,手动注册 https://your-server/webhook
243
+ ```
244
+
245
+ ### smee.io — 稳定中继(可选)
246
+
247
+ 当笔记本离线时,`localhost.run` 会丢失事件。[smee.io](https://smee.io) 会将事件排队,在重新连接后回放——适合审查机器不总是在线的团队。
248
+
249
+ ```bash
250
+ npm install -g smee-client
251
+ # 访问 https://smee.io/new — 复制频道 URL
252
+ ```
253
+
254
+ ```yaml
255
+ # crosscheck.config.yml
256
+ tunnel:
257
+ backend: smee
258
+ smee_channel: https://smee.io/your-channel-id
259
+ ```
260
+
261
+ ---
262
+
263
+ ## 系统要求
264
+
265
+ | | 最低版本 |
266
+ |---|---|
267
+ | Node.js | 18+ |
268
+ | Claude Code CLI | 最新版 — `npm install -g @anthropic-ai/claude-code` |
269
+ | Codex CLI | 最新版 — `npm install -g @openai/codex` |
270
+ | GitHub CLI | 2.65+ — `brew install gh` |
271
+
272
+ 运行 `gh auth login` 后,`GITHUB_TOKEN` 会自动获取,无需手动导出。
273
+
274
+ ---
275
+
276
+ ## 文档
277
+
278
+ | | |
279
+ |---|---|
280
+ | **[get-started.zh.md](./get-started.zh.md)** | 完整安装指南——前置条件、所有命令与参数、完整配置参考、工作原理、常见问题 |
281
+ | **[crosscheck.config.example.yml](./crosscheck.config.example.yml)** | 带注释的配置文件示例(每个选项均有说明) |
282
+ | **[AGENT.md](./AGENT.md)** | `crosscheck optimize` 使用的 Harness 文档——AI 如何优化审查指令 |
283
+
284
+ ---
285
+
286
+ ## 参与贡献
287
+
288
+ 欢迎提交 Issue 和 PR:[github.com/Motivation-Labs/crosscheck](https://github.com/Motivation-Labs/crosscheck)
289
+
290
+ ---
291
+
292
+ ## 许可证
293
+
294
+ [MIT](./LICENSE) — Copyright (c) 2025–2026 Motivation Labs LLC.
Binary file