ccgx-workflow 2.4.1 → 2.5.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 (46) hide show
  1. package/README.md +134 -277
  2. package/README.zh-CN.md +134 -272
  3. package/dist/chunks/version-build.mjs +1 -1
  4. package/dist/cli.mjs +1 -1
  5. package/dist/index.d.mts +709 -16
  6. package/dist/index.d.ts +709 -16
  7. package/dist/index.mjs +1061 -30
  8. package/dist/shared/{ccgx-workflow.j1spUsik.mjs → ccgx-workflow.CdHnJLak.mjs} +106 -22
  9. package/package.json +1 -1
  10. package/templates/commands/agents/code-fixer.md +6 -6
  11. package/templates/commands/agents/phase-runner.md +46 -14
  12. package/templates/commands/agents/plan-checker.md +10 -0
  13. package/templates/commands/analyze.md +66 -25
  14. package/templates/commands/autonomous.md +428 -225
  15. package/templates/commands/cancel.md +9 -0
  16. package/templates/commands/codex-exec.md +12 -11
  17. package/templates/commands/context.md +14 -0
  18. package/templates/commands/debate.md +10 -6
  19. package/templates/commands/execute.md +76 -28
  20. package/templates/commands/optimize.md +53 -25
  21. package/templates/commands/plan.md +78 -28
  22. package/templates/commands/review.md +26 -19
  23. package/templates/commands/spec-impl.md +68 -127
  24. package/templates/commands/spec-plan.md +61 -82
  25. package/templates/commands/spec-research.md +35 -92
  26. package/templates/commands/spec-review.md +34 -119
  27. package/templates/commands/status.md +1 -0
  28. package/templates/commands/team-exec.md +45 -13
  29. package/templates/commands/team.md +64 -167
  30. package/templates/commands/test.md +56 -34
  31. package/templates/commands/verify-work.md +36 -13
  32. package/templates/commands/verify.md +35 -0
  33. package/templates/commands/workflow.md +22 -37
  34. package/templates/hooks/ccg-loop-detector.cjs +39 -8
  35. package/templates/hooks/ccg-statusline.js +142 -2
  36. package/templates/hooks/ccg-stop-gate.cjs +248 -19
  37. package/templates/hooks/ccg-subagent-context.cjs +505 -0
  38. package/templates/scripts/ccg-state-lock.cjs +510 -0
  39. package/templates/scripts/ccg-team-schedule.cjs +328 -0
  40. package/templates/scripts/ccgx-call-plugin.mjs +494 -141
  41. package/templates/scripts/invoke-model.mjs +28 -1
  42. package/templates/scripts/task-store.cjs +614 -0
  43. package/templates/skills/tools/verify-change/SKILL.md +7 -0
  44. package/templates/skills/tools/verify-module/SKILL.md +7 -0
  45. package/templates/skills/tools/verify-quality/SKILL.md +7 -0
  46. package/templates/skills/tools/verify-security/SKILL.md +8 -0
package/README.md CHANGED
@@ -5,33 +5,15 @@
5
5
  [![npm version](https://img.shields.io/npm/v/ccgx-workflow.svg)](https://www.npmjs.com/package/ccgx-workflow)
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
7
7
  [![Claude Code](https://img.shields.io/badge/Claude%20Code-Compatible-green.svg)](https://claude.ai/code)
8
- [![Tests](https://img.shields.io/badge/Tests-1309%20passed-brightgreen.svg)]()
8
+ [![Tests](https://img.shields.io/badge/Tests-1772%20passed-brightgreen.svg)]()
9
9
 
10
10
  [简体中文](./README.zh-CN.md) | English
11
11
 
12
12
  </div>
13
13
 
14
- > **Project Lineage**
15
- >
16
- > `ccgx-workflow` is a deep rewrite of [`ccg-workflow`](https://www.npmjs.com/package/ccg-workflow) v3.x.
17
- > The original project went unmaintained after 2026-05 (the original author's
18
- > GitHub homepage went offline), leaving its multi-model collaboration users
19
- > exposed to drift. This project re-architected from the ground up:
20
- > fresh-context subagent protocols, Plan-Critic-Verify quality tiers,
21
- > OS-level three-layer process isolation, broker tx_id anti-drift,
22
- > and 8 plugin patches with a one-shot repatch script.
23
- >
24
- > The `/ccg:*` slash command palette is **gesture-compatible** with the
25
- > original — but the underlying architecture has been completely replaced.
26
- > Original copyright is preserved under MIT, see [LICENSE](./LICENSE).
27
-
28
- ---
29
-
30
14
  ## What Is It
31
15
 
32
- A multi-model collaboration system where Claude Code orchestrates Codex (backend) and Gemini (frontend). Frontend tasks auto-route to Gemini, backend tasks to Codex, Claude handles orchestration and code review.
33
-
34
- External models have **no write access** — they only return patches; Claude reviews before applying.
16
+ A multi-model collaboration system where Claude Code orchestrates Codex (backend) and Gemini (frontend). Frontend tasks auto-route to Gemini, backend tasks to Codex; Claude handles orchestration and code review. External models have **no write access** — they only return patches; Claude reviews before applying.
35
17
 
36
18
  ```
37
19
  Claude Code (Orchestrator)
@@ -46,15 +28,24 @@ Codex Gemini
46
28
  Unified Patch
47
29
  ```
48
30
 
31
+ > **Lineage**: `ccgx-workflow` is a ground-up rewrite of [`ccg-workflow`](https://www.npmjs.com/package/ccg-workflow), branched from its v3.x line in 2026-05. Upstream remains independently maintained and has continued publishing since the split; the two projects have evolved separately. The `/ccg:*` command palette stays gesture-compatible; the architecture underneath has been fully replaced. Original copyright is preserved under MIT, see [LICENSE](./LICENSE).
32
+ > Deep-dive comparison: [docs/VS-CCG-WORKFLOW.md](./docs/VS-CCG-WORKFLOW.md) · Migration guide: [MIGRATION-FROM-CCG-WORKFLOW.md](./MIGRATION-FROM-CCG-WORKFLOW.md)
33
+
34
+ ---
35
+
49
36
  ## Core Features
50
37
 
51
- - **Zero-config model routing** — Frontend → Gemini / Backend → Codex, dispatched by phase frontmatter `Type:` field. No manual switching.
52
- - **~30 `/ccg:*` slash commands** — Planning, execution, git workflow, code review, autonomous long-runs, async job triplet.
53
- - **Three-tier quality gates** — `--quality=fast|triple|debate` toggles Plan-Critic-Verify collaboration depth.
38
+ - **Zero-config model routing** — Frontend → Gemini / Backend → Codex, dispatched by phase frontmatter `Type:` field; routing configurable at init.
39
+ - **30 `/ccg:*` slash commands** — Planning, execution, review, autonomous long runs, async job triplet, OPSX spec-driven flows, Agent Teams, git tools.
40
+ - **7 passive hooks** — Statusline, context monitor, session memory, loop detector, skill router, stop gate, subagent context injection; zero config after install.
41
+ - **Three-tier quality gates + Gates Taxonomy** — `--quality=fast|triple|debate` toggles Plan-Critic-Verify depth; an 11-gate registry with requirements-coverage checking and advance/revise/escalate arbitration.
42
+ - **Autonomous native Workflow orchestration** — Roadmap-driven background long runs with `--resume` checkpoint recovery; legacy wave-parallel mode kept behind `--legacy`.
43
+ - **`review --fix` auto-retry convergence loop** — Fix → automatic re-review → pass once no Critical remains; escalation is the only ask-user exit.
44
+ - **Task persistence container** — `.context/tasks/<id>/task.json` (frozen schema v1) + derived `STATE.json` projection, surfaced in the statusline. The statusline STATE segment only has content after a task container is explicitly created via `task-store.cjs create` (current workflows do not auto-create one).
45
+ - **team-exec wave scheduling** — Task-level topological waves + file-overlap splitting + O_EXCL state locks + per-wave cross-phase regression gate.
54
46
  - **Fresh-context subagent protocol** — `phase-runner` / `code-fixer` / `debug-session-manager` keep main-thread context ≤15%; the orchestrator only consumes ≤200-token summaries.
55
- - **OS-level three-layer process isolation** — `Bash(claude -p --agent ccg/phase-runner)` replaces in-process sidechain; treats main-process RSS leak.
56
- - **OPSX spec-driven** — Integrates [OPSX](https://github.com/fission-ai/opsx) to convert vague requirements into verifiable constraints, eliminating AI improvisation.
57
- - **Plugin-first with wrapper fallback** — Uses official codex/gemini plugins when available; falls back to `codeagent-wrapper`.
47
+ - **OPSX spec-driven** — Integrates [OpenSpec (OPSX)](https://github.com/Fission-AI/OpenSpec) to convert vague requirements into verifiable constraints.
48
+ - **Plugin-first, per-model fallback** — Uses codex/gemini Claude Code plugins when present (Channel A); each model independently degrades to a Node-shim CLI path (Channel B) never all-or-nothing.
58
49
 
59
50
  ---
60
51
 
@@ -66,14 +57,10 @@ Codex Gemini
66
57
  |------------|----------|-------|
67
58
  | **Node.js 20+** | Yes | `ora@9.x` requires Node ≥ 20 |
68
59
  | **Claude Code CLI** | Yes | [Install guide](#install-claude-code) |
69
- | **jq** | Yes | Used for auto-authorization hook ([install](#install-jq)) |
70
60
  | **codex access** | **One of** | `codex@openai-codex` plugin (recommended) **OR** `npm i -g @openai/codex` |
71
- | **gemini access** | **One of** | `gemini@google-gemini` plugin (recommended) **OR** `npm i -g @google/gemini-cli` |
61
+ | **gemini access** | **One of** | `gemini@gemini-ccgx` fork plugin (recommended) **OR** upstream `gemini@google-gemini` + repatch **OR** `npm i -g @google/gemini-cli` |
72
62
 
73
- > **Why "one of"**: ccgx-workflow prefers the plugin path (one-click install in Claude Code,
74
- > integrated auth). When the plugin is absent it falls back to spawning the standalone CLI
75
- > via `~/.claude/bin/codeagent-wrapper`. Without **either**, `/ccg:*` commands that invoke
76
- > codex/gemini fail with exit 127 + a friendly install hint.
63
+ > **Why "one of"**: ccgx-workflow prefers the plugin path (one-click install in Claude Code, integrated auth). When a plugin is absent, only that model falls back to spawning the standalone CLI via the `~/.claude/bin/codeagent-wrapper` Node shim. Without **either** path, `/ccg:*` commands that invoke codex/gemini exit 127 with an install hint.
77
64
 
78
65
  ### Installation
79
66
 
@@ -81,23 +68,7 @@ Codex Gemini
81
68
  npx ccgx-workflow
82
69
  ```
83
70
 
84
- First run prompts for language (English / Chinese), API provider, MCP tooling — all interactive. CLI command name remains `ccg` (preserves muscle memory for legacy users).
85
-
86
- ### Install jq
87
-
88
- ```bash
89
- # macOS
90
- brew install jq
91
-
92
- # Linux (Debian/Ubuntu)
93
- sudo apt install jq
94
-
95
- # Linux (RHEL/CentOS)
96
- sudo yum install jq
97
-
98
- # Windows
99
- choco install jq # or: scoop install jq
100
- ```
71
+ First run prompts for language (English / Chinese), API provider, MCP tooling — all interactive. The CLI command name remains `ccg` (preserves muscle memory for legacy users).
101
72
 
102
73
  ### Install Claude Code
103
74
 
@@ -111,269 +82,134 @@ Supports npm / homebrew / curl / powershell / cmd.
111
82
 
112
83
  ## Enabling Multi-Model Collaboration (codex / gemini access)
113
84
 
114
- ccgx-workflow needs codex + gemini access via **one of two paths** for each:
115
-
116
- ### Path A — Claude Code plugins (recommended)
85
+ ### codex plugin (recommended) or CLI
117
86
 
118
- Run inside Claude Code:
87
+ Inside Claude Code:
119
88
 
120
89
  ```
121
90
  /plugin install codex@openai-codex
122
- /plugin install gemini@google-gemini
123
91
  ```
124
92
 
125
- One-click install, integrated auth via Claude Code. Templates spawn plugin
126
- agents (`Agent(codex:codex-rescue)` / `Agent(gemini:gemini-rescue)`) directly,
127
- no shim involved.
128
-
129
- ### Path B — standalone CLI fallback
93
+ Or the standalone CLI:
130
94
 
131
95
  ```bash
132
- # codex CLI
133
96
  npm i -g @openai/codex
134
97
  codex login
135
-
136
- # gemini CLI
137
- npm i -g @google/gemini-cli
138
- gemini auth login
139
98
  ```
140
99
 
141
- When the plugin is absent, templates fall back to invoking the CLI through
142
- `~/.claude/bin/codeagent-wrapper` (a Node shim that wraps `codex` / `gemini`).
143
- You handle key configuration manually.
144
-
145
- ### Mix and match
100
+ ### gemini ccgx fork plugin (recommended)
146
101
 
147
- You can use plugin for codex + CLI for gemini, or vice versa. ccgx-workflow
148
- detects each independently and picks the best available path per call site.
149
-
150
- The `@` suffix is the marketplace identifier. If a marketplace isn't configured, run `/help plugin` inside Claude Code to see local marketplace management commands, or refer to [Claude Code plugin docs](https://docs.claude.com/en/docs/claude-code/plugins).
151
-
152
- > Upstream plugin repos (for troubleshooting / issue reports):
153
- > - **codex**: `openai-codex` marketplace (Claude Code official)
154
- > - **gemini**: [sakibsadmanshajib/gemini-plugin-cc](https://github.com/sakibsadmanshajib/gemini-plugin-cc)
155
-
156
- ### Verify
102
+ The recommended gemini path is the ccgx-maintained fork [`wzyxdwll/gemini-plugin-cc`](https://github.com/wzyxdwll/gemini-plugin-cc) (plugin `gemini@gemini-ccgx`, v1.2.0; requires Node.js ≥ 18.18 and a Google account or `GEMINI_API_KEY`):
157
103
 
158
104
  ```bash
159
- ls ~/.claude/plugins/cache/openai-codex/codex/
160
- ls ~/.claude/plugins/cache/google-gemini/gemini/
161
- # Should show version directories (e.g. 1.0.4 / 1.0.1)
105
+ # In a terminal
106
+ claude plugin marketplace add wzyxdwll/gemini-plugin-cc
107
+ claude plugin install gemini@gemini-ccgx
162
108
  ```
163
109
 
164
- ### ⚠️ Gemini plugin Windows Known Issues (patch strongly recommended)
110
+ Then inside Claude Code: `/reload-plugins` and `/gemini:setup`.
165
111
 
166
- `gemini@google-gemini` v1.0.1 has **8 spawn sites missing `windowsHide: true`** on Windows, causing:
112
+ What the fork adds over the upstream plugin:
167
113
 
168
- - Brief cmd black flashes that steal application focus on every plugin call (high-frequency)
169
- - ENOENT errors when ACP broker spawns `gemini.cmd` (serialized as `[object Object]` by plugin error handlers)
170
- - Flashes during broker daemon startup, `gemini --version` health checks, `taskkill`, `where gemini`, etc.
114
+ - **All recorded patches permanently merged** (the full P-series — IDs are non-contiguous, up to P-21 — plus W1/W2 and I1/I2, incl. `windowsHide` on every Windows spawn site) — no repatch step, survives plugin updates.
115
+ - **`gemini-batch.mjs` ACP bypass** — drives the gemini CLI in batch mode via stdin + `--output-format json`, skipping the ACP broker / named-pipe transport entirely; measured: a trivial task went from 5+ min silent hang to 29 s clean exit with zero orphan MCP children.
116
+ - **Dual-layer timeouts + Windows process-tree kill** — `--idle-timeout-ms` (opt-in) + 2 h wall-time cap; `taskkill /T /F` cleans the `cmd.exe → gemini.cmd → node` chain.
117
+ - **`~/.gemini/.env` auth bridge** — carries `GEMINI_API_KEY` etc. past the gemini-cli 0.42 folder-trust gate in untrusted directories (opt-out: `GEMINI_COMPANION_NO_ENV_BRIDGE`).
118
+ - **ACP stability patches** — broker watchdog, per-method client timeouts, broker idle auto-exit, `broker/ready` handshake.
119
+ - **`--allowed-mcp-server-names` passthrough** — suppresses settings.json MCP merging on the ACP path, saving 30–60 s Windows cold start.
171
120
 
172
- **ccgx-workflow ships a one-shot repatch script** (idempotent, re-runnable):
121
+ #### Alternative: upstream plugin + repatch
173
122
 
174
123
  ```bash
175
- node ~/.claude/.ccg/scripts/repatch-gemini-plugin.mjs
124
+ claude plugin marketplace add sakibsadmanshajib/gemini-plugin-cc
125
+ claude plugin install gemini@google-gemini
176
126
  ```
177
127
 
178
- Behavior:
179
- 1. Auto-locates plugin version directory
180
- 2. Probes each patch site (string match)
181
- 3. Already-patched sites: `[SKIP]`; unpatched sites: `[APPLY]`
182
- 4. Prints broker-daemon-restart command on completion
183
-
184
- ⚠️ **Important**: After every `claude plugin update gemini@google-gemini`, the plugin update overwrites cache — **rerun the patch script**.
185
-
186
- ⚠️ **Restart broker daemon after patching** (old daemon still runs unpatched code):
128
+ Upstream v1.0.1 has **8 spawn sites missing `windowsHide: true`** on Windows (cmd window flashes, focus stealing, ENOENT from the ACP broker). If — and only if — you use the upstream plugin, run the bundled repatch script after install **and after every plugin update** (updates overwrite the cache):
187
129
 
188
- ```powershell
189
- # Windows PowerShell
190
- Get-CimInstance Win32_Process -Filter "Name='node.exe'" |
191
- Where-Object { $_.CommandLine -match 'acp-broker' } |
192
- ForEach-Object { Stop-Process -Id $_.ProcessId -Force }
130
+ ```bash
131
+ # The script ships inside the npm package at templates/scripts/repatch-gemini-plugin.mjs
132
+ # With a global install:
133
+ node "$(npm root -g)/ccgx-workflow/templates/scripts/repatch-gemini-plugin.mjs"
193
134
  ```
194
135
 
195
- Or simpler: `/plugin disable gemini@google-gemini` then `/plugin enable gemini@google-gemini`.
196
-
197
- Root causes, temporary patches, and upstream paths for all 8 issues are documented in [`.ccg-migration/PLUGIN-PATCHES.md`](./.ccg-migration/PLUGIN-PATCHES.md). Upstream PR is in progress; once merged, the patch becomes a no-op.
198
-
199
- ---
200
-
201
- ## Relationship to ccg-workflow
136
+ The script is idempotent: patched sites print `[SKIP]`, unpatched sites `[APPLY]`; restart the broker daemon afterwards (or `/plugin disable` + `/plugin enable`). Root causes and patch details: [`.ccg-migration/PLUGIN-PATCHES.md`](./.ccg-migration/PLUGIN-PATCHES.md). As of this writing, none of the recorded issues have been fixed upstream.
202
137
 
203
- ccgx-workflow is **not a fork**. The upstream `ccg-workflow` public release line stopped at v3.x and has been unmaintained since 2026-05. ccgx-workflow v1.0 was redesigned from scratch on top of v3.x (~3 days / 92 commits / 1141 new tests of dense iteration before stabilization).
138
+ #### CLI fallback
204
139
 
205
- ### What's New (vs v3.x)
140
+ ```bash
141
+ npm i -g @google/gemini-cli
142
+ gemini # first interactive launch walks through Google account auth; or set GEMINI_API_KEY
143
+ ```
206
144
 
207
- #### 🆕 New Commands
145
+ ### Mix, match, and verify
208
146
 
209
- | Command | Description |
210
- |---------|-------------|
211
- | `/ccg:debate` | **Multi-round debate primitive** — codex propose ↔ gemini challenge ↔ codex respond, cap N rounds, schema-enforced retry protocol |
212
- | `/ccg:status [job-id]` | **Async job triplet** — dashboard mode aggregates multi-phase progress / `--wait --timeout-ms` blocking / `--tail` streaming + 3-class stuck warnings |
213
- | `/ccg:status --cancel <phase-id>` | Single-phase cooperative cancel + grace + kill-tree (Windows `taskkill /T /F` + POSIX `setsid` process group) |
214
- | `/ccg:result <job-id>` | Final verdict / summary / artifacts; main thread receives ≤200-token summary |
215
- | `/ccg:cancel <job-id>` | Abort active job: write `cancel.flag` cooperative → 5s grace → kill-tree |
216
- | `/ccg:verify --gate=<name>` | **Unified verify entry** — consolidates v3.x's 4 separate `verify-{change,quality,security,module}` commands; `--gate=all` orchestrates all gates |
217
- | `/ccg:verify-work` | **Session-based UAT + cold-start smoke injection** — UAT.md persists across `/clear` via frontmatter; git diff scans server/db/migrations to auto-inject cold-start tests |
218
-
219
- #### 🚀 Enhanced Commands
220
-
221
- | Command | v3.x | ccgx-workflow |
222
- |---------|------|---------------|
223
- | `/ccg:autonomous` | Sequential phases | **Wave topological parallelism** + cascade skip + max-concurrent batching; `--quality=fast/triple/debate` three-tier gates + per-phase frontmatter override |
224
- | `/ccg:review` | Dual-model review | Adds `--fix --auto` worktree-isolated closed-loop fix (4-step transactional cleanup) |
225
- | `/ccg:debug` | Single-step diagnosis | Manager + debugger **two-tier fresh-context** — multi-round falsifiable hypotheses + persistent session in `.context/debug/<slug>.md` |
226
- | `/ccg:team` | 4 separate commands | 8-phase unified workflow + 7-role orchestration + Evaluator-Optimizer feedback loop (up to 2 auto-fix rounds for Critical) |
227
-
228
- #### 🤖 New Agents (vs v3.x's 7)
229
-
230
- **Fresh-context protocol group** (4 agents; main thread receives ≤200-token summary):
231
-
232
- | Agent | Role |
233
- |-------|------|
234
- | `phase-runner` | Autonomous long-run phase implementer — `Bash(claude -p --agent ccg/phase-runner)` spawns OS-level subprocess; stream-json output flows to `.context/jobs/<id>/progress.jsonl` |
235
- | `code-fixer` | review --fix closed-loop — git worktree isolation + 3-layer verification + atomic commit |
236
- | `debug-session-manager` | Debug multi-round orchestrator — runs hypothesis loop in isolated context |
237
- | `debugger` | Scientific-method hypothesis constructor — diagnostic specialist scheduled by manager |
238
-
239
- **Specialist matrix** (8 agents, role × layer 2D dispatch):
240
-
241
- | Agent | Role |
242
- |-------|------|
243
- | `assumptions-analyzer` | Assumption interrogator — enforces first-principles, lists evidence-free inferences and gaps |
244
- | `pattern-mapper` | Codebase pattern scanner — gives builders precise "copy from here" anchors before implementation |
245
- | `plan-checker` | Plan validator — 5-dimension GSD-derived strong checks + max-3-loop convergence; BLOCKERs return to planner |
246
- | `nyquist-auditor` | Deep auditor — focuses on boundary conditions, concurrency races, error propagation chains, resource leaks |
247
- | `verifier` | Delivery verifier — line-by-line requirement checklist, PASS/FAIL/PARTIAL matrix + Level 4 data-flow (FLOWING/STATIC/DISCONNECTED/HOLLOW_PROP) |
248
- | `integration-checker` | Cross-module interface contract — finds format drift, stale callers, orphan exports |
249
- | `framework-selector` | Tech stack selection review — current vs proposal contrast, must verify current can't solve before adopting proposal |
250
- | `eval-auditor` | Evaluation closed-loop audit — sampling / control / metric gaming / falsifiability checks |
251
-
252
- Plus the 7 core agents inherited from v3.x design (planner / ui-ux-designer / init-architect / get-current-datetime / team-architect / team-qa / team-reviewer), ccgx-workflow has **19 sub-agents total**.
253
-
254
- #### 🔧 New Mechanisms / Infrastructure
255
-
256
- | Mechanism | Description |
257
- |-----------|-------------|
258
- | **Three-tier quality gates** | `--quality=fast` (2 waves: impl + verify) / `triple` (4 waves: plan + critic + impl + verify, default) / `debate` (7 waves: + 3-round propose-challenge-respond, cap 3) |
259
- | **Wave topological scheduling** | Kahn topological partition + cascade skip + max-concurrent batching; 30-40% wall-clock reduction; `--sequential` opt-out |
260
- | **OS-level 3-layer process isolation** | Main `claude.exe` → `Bash(claude -p)` subprocess → optional plugin process group; treats v3.x main-process RSS leak (uni-iam workload measured at 23GB → ccgx target < 8GB) |
261
- | **Broker tx_id anti-drift** | Each spawn injects `CCG_BROKER_TX_ID` (`crypto.randomUUID`); 8-field strict schema in broker.log; 100k spawns 0 collisions / 2k concurrent 0 misattribution (measured) |
262
- | **`context_budget` frontmatter hard-cap** | 4 main orchestrators declare `context_budget: orchestrator-15`; forbidden to slurp builder stdout |
263
- | **`.context/<phase>/{CONTEXT,SUMMARY}.md`** | Phase-scoped state machine; main thread reads frontmatter only (< 200 tokens/phase) |
264
- | **`.context/codebase/` 7-file contract** | codebase-mapper agent 4-way parallel scan (STACK/INTEGRATIONS/ARCHITECTURE/STRUCTURE/CONVENTIONS/TESTING/CONCERNS) |
265
- | **Silent fallback governance** | verify wave Bash-direct invocation (architectural elimination) + debate retry protocol schema enforcement (4 violation classes: parse-failed / insufficient-attempts / missing-reason / silent-success) |
266
- | **Scope reduction detection** | plan-checker dim 7b — detects "v1 / simplified / static-first / wire-up-later" keywords + 80% overlap match against original requirements; BLOCKER on mismatch |
267
- | **commit-msg-review git hook** | Opt-in pre-commit-msg hook with 3 heuristics (filename ⊆ staged / phase tag ↔ staged paths / op type ↔ diff) |
268
- | **ground-truth-sampler** | autonomous startup samples plugin/skill/agent list to `.context/ground-truth/latest.json`; phase-runner prompt enforces Read |
269
- | **interface-auditor specialist** | autonomous verify wave (triple/debate tiers) adds 3rd spawn — 5 checks: SSoT-violation / leftover / magic-string-vs-ground-truth / unverified assumption / API drift |
270
- | **Gemini plugin Windows repatch** | `~/.claude/.ccg/scripts/repatch-gemini-plugin.mjs` — one-shot patch for 8 spawn bugs, idempotent and re-runnable |
271
- | **Auto-generated fixtures** | `scripts/regen-fixtures.ts` + `tests/fixtures/ground-truth/*.sample.json`; prevents inline mock drift from real interfaces |
272
- | **pipeline-check helper** | `pnpm pack` + tarball audit + missing-file detection; prevents "templates in git but missing from npm tarball" incidents |
273
-
274
- #### 📦 Skill Ecosystem
275
-
276
- ccgx-workflow inherits the **Skill Registry** mechanism (frontmatter-driven auto command generation) with:
277
-
278
- - **Quality gates** — 4: verify-{change, quality, security, module} (still callable as skills after merging into `/ccg:verify`)
279
- - **Tool skills** — 6: gen-docs / health / map-codebase / extract-learnings / forensics / override-refusal
280
- - **Domain knowledge bundles** — 10 categories, ~21 SKILL.md (security / architecture / devops / ai / development / frontend-design, etc.; all `user-invocable: false`, keyword-routed auto-Read)
281
- - **Impeccable UI/UX toolkit** — 20 (adapt / animate / arrange / audit / bolder / clarify / colorize / critique / delight / distill / extract / harden / normalize / onboard / optimize / overdrive / polish / quieter / typeset, etc.; optional install)
282
- - **scrapling**: web scraping with Cloudflare / WAF bypass
283
- - **orchestration/multi-agent**: coordination SKILL
284
-
285
- Total: **47 SKILL.md files** + 50+ supporting markdowns = 100+ skill files.
286
-
287
- ### Comparison Table
288
-
289
- Core differences at a glance:
290
-
291
- | Dimension | `ccg-workflow` v3.x | `ccgx-workflow` v1.0 |
292
- |-----------|----------------------|----------------------|
293
- | Maintenance | Stalled after 2026-05; author offline | Actively maintained; PRs welcome |
294
- | Main-thread context | No explicit budget | `context_budget` frontmatter hard-cap + fresh-context subagent protocol |
295
- | Multi-model gates | Single orchestration | **Three-tier flag** `--quality=fast/triple/debate` (Plan-Critic-Verify) |
296
- | Autonomous long-runs | Sequential phases | **Wave topological parallel** + cascade skip + cap scheduling |
297
- | Process isolation | In-process sidechain | **OS-level 3 layers** (`Bash(claude -p)` subprocess + plugin process group) |
298
- | Broker anti-drift | — | **broker tx_id** crypto sign + 8-field strict schema |
299
- | Gemini Windows patch | Manual edit of 8 source sites | **Built-in one-shot repatch script**, idempotent |
300
- | Silent fallback | — | verify wave Bash-direct invocation + debate retry protocol schema enforcement |
301
- | Test count | 168 | **1309** |
302
- | Command palette | 35 (incl. deprecated) | ~30 (consolidated) |
303
- | Subagents | 7 | **19** (4 fresh-context + 8 specialist matrix + others) |
304
- | Binary dependency | Go binary 16.3 MB | **Node single-file ~200 KB** |
305
- | License | MIT | MIT (dual copyright: original author + maintainer) |
306
- | `/ccg:*` palette | — | **Fully compatible** — zero migration cost |
307
-
308
- ### Migration
309
-
310
- See [MIGRATION-FROM-CCG-WORKFLOW.md](./MIGRATION-FROM-CCG-WORKFLOW.md). One-liner:
147
+ Detection is **per-model**: you can run codex via plugin and gemini via CLI, or vice versa — a missing plugin degrades only that model to Channel B. To check which channel you are on:
311
148
 
312
149
  ```bash
313
- npm uninstall -g ccg-workflow # if installed globally
314
- npx ccgx-workflow # reinitialize
150
+ node ~/.claude/.ccg/scripts/check-plugins.cjs
151
+ # exit 0 = both plugins installed (Channel A)
152
+ # exit 1 = at least one missing (Channel B fallback for that model)
153
+ # exit 2 = plugin registry unreadable (Channel B)
315
154
  ```
316
155
 
317
- `/ccg:*` commands, `.context/` state, `.ccg/roadmap.md` are all preserved no code changes or project state rebuild required.
156
+ The `@` suffix is the marketplace identifier. If a marketplace isn't configured, run `/help plugin` inside Claude Code, or see the [Claude Code plugin docs](https://docs.claude.com/en/docs/claude-code/plugins).
318
157
 
319
158
  ---
320
159
 
321
160
  ## Commands
322
161
 
162
+ `Codex` / `Gemini` below reflect the default routing; both are configurable at init.
163
+
323
164
  ### Development Workflow
324
165
 
325
166
  | Command | Description | Models |
326
167
  |---------|-------------|--------|
327
- | `/ccg:workflow` | Full 6-phase workflow (auto-routes frontend/backend) | Codex + Gemini |
328
- | `/ccg:plan` | Multi-model planning (Phase 1-2) | Codex + Gemini |
329
- | `/ccg:execute` | Multi-model execution (Phase 3-5) | Codex + Gemini + Claude |
330
- | `/ccg:codex-exec` | Codex full execution (plan code review) | Codex + multi-model review |
331
- | `/ccg:autonomous` | Cross-phase long-run (`--quality=fast/triple/debate`) | phase-runner + Plan-Critic-Verify |
332
- | `/ccg:context` | Project context management (.context/ init, log, compress, history) | Claude |
333
- | `/ccg:enhance` | Built-in prompt enhancement | Claude |
168
+ | `/ccg:workflow` | Full multi-model dev workflow (research → ideate → plan → execute → optimize → review); auto-routes frontend → Gemini, backend → Codex | Codex + Gemini |
169
+ | `/ccg:plan` | Multi-model planning context retrieval + dual-model analysis → step-by-step implementation plan | Codex + Gemini |
170
+ | `/ccg:execute` | Multi-model execution prototype per plan → Claude refactors and lands → multi-model audit | Codex + Gemini + Claude |
171
+ | `/ccg:codex-exec` | Codex executes a `/ccg:plan` output end-to-end (MCP search + code + tests), with multi-model review | Codex + multi-model review |
172
+ | `/ccg:autonomous` | Cross-phase long run: roadmap → native Workflow serial orchestration (background + checkpoint resume); `--legacy` falls back to wave-parallel prompt rotation | phase-runner |
173
+ | `/ccg:context` | Project context management init `.context/`, decision log, compress/archive, history | Claude |
174
+ | `/ccg:enhance` | Built-in prompt enhancement — vague requirements → structured task description | Claude |
334
175
 
335
176
  ### Analysis & Quality
336
177
 
337
178
  | Command | Description | Models |
338
179
  |---------|-------------|--------|
339
- | `/ccg:analyze` | Technical analysis | Codex + Gemini |
340
- | `/ccg:debug` | Diagnosis + fix (manager + debugger fresh-context two-tier) | debug-session-manager |
341
- | `/ccg:optimize` | Performance optimization | Codex + Gemini |
342
- | `/ccg:test` | Test generation | Auto-routed |
343
- | `/ccg:review` | Code review (auto git diff + `--fix --auto` worktree closed loop) | Codex + Gemini + code-fixer |
344
- | `/ccg:verify --gate=<change\|quality\|security\|module\|all>` | Unified verify gate | Claude |
345
- | `/ccg:verify-work` | Orchestrator + session-based UAT + cold-start smoke | Claude |
346
- | `/ccg:debate` | Multi-round propose/challenge/respond primitive (cap N rounds) | Codex + Gemini |
180
+ | `/ccg:analyze` | Parallel technical analysis — Codex backend view + Gemini frontend view, cross-validated synthesis | Codex + Gemini |
181
+ | `/ccg:debug` | Multi-model debugging (manager + debugger two-tier fresh-context) — scientific-method hypothesis chain + persistent session + cap-3 escalation | debug-session-manager |
182
+ | `/ccg:optimize` | Performance optimization — Codex backend + Gemini frontend | Codex + Gemini |
183
+ | `/ccg:test` | Test generation — auto-routes Codex backend tests / Gemini frontend tests | Auto-routed |
184
+ | `/ccg:review` | Code review auto git diff with no args, dual-model cross-validation; `--adversarial` adds adversarial review; `--fix` closed-loop fixing | Codex + Gemini + code-fixer |
185
+ | `/ccg:verify --gate=<change\|quality\|security\|module>` | Unified verify gate — routes to the matching skill per `--gate`; `--all` is equivalent to verify-work | Claude |
186
+ | `/ccg:verify-work` | Session-based UAT workflow — UAT.md state file + cold-start smoke auto-injection + automatic diagnose-plan-fix convergence loop | Orchestrator |
187
+ | `/ccg:debate` | Native multi-round debate primitive — codex propose ↔ gemini challenge ↔ codex respond; caps at N rounds or stops when the challenger reports no critical | Codex + Gemini |
347
188
 
348
189
  ### Async Job Triplet
349
190
 
350
191
  | Command | Description |
351
192
  |---------|-------------|
352
- | `/ccg:status [job-id]` | List or query job (`--wait --timeout-ms` blocking; dashboard mode) |
353
- | `/ccg:status --tail <job-id>` | stream-json + single-line overwrite + 3-class stuck warnings |
354
- | `/ccg:status --cancel <phase-id>` | Single-phase cooperative cancel + grace + kill-tree |
355
- | `/ccg:result <job-id>` | Final verdict / summary / artifacts |
356
- | `/ccg:cancel <job-id>` | Abort active job |
193
+ | `/ccg:status [job-id]` | Background job observability — list / query / blocking wait / dashboard / tail streaming / stuck detection / per-phase cancel |
194
+ | `/ccg:result <job-id>` | Final result reads `.context/jobs/<id>/result.md`, outputs a ≤200-token summary |
195
+ | `/ccg:cancel <job-id>` | Abort active job — write `cancel.flag` (cooperative) → 5 s grace kill-tree |
357
196
 
358
197
  ### OPSX Spec-Driven
359
198
 
360
199
  | Command | Description |
361
200
  |---------|-------------|
362
- | `/ccg:spec-init` | Initialize OPSX environment |
363
- | `/ccg:spec-research` | Requirements → constraints |
364
- | `/ccg:spec-plan` | Constraints → zero-decision plan |
365
- | `/ccg:spec-impl` | Execute plan + archive |
366
- | `/ccg:spec-review` | Dual-model cross-review |
201
+ | `/ccg:spec-init` | Initialize the OpenSpec (OPSX) environment + verify multi-model MCP tooling |
202
+ | `/ccg:spec-research` | Requirements → constraint set (parallel exploration + OPSX proposal) |
203
+ | `/ccg:spec-plan` | Multi-model analysis ambiguity elimination → zero-decision executable plan |
204
+ | `/ccg:spec-impl` | Execute per spec + multi-model collaboration + archive |
205
+ | `/ccg:spec-review` | Dual-model cross-review (standalone tool, usable anytime) |
367
206
 
368
207
  ### Agent Teams
369
208
 
370
209
  | Command | Description |
371
210
  |---------|-------------|
372
- | `/ccg:team` | **Unified workflow (recommended)** 8-phase 7-role end-to-end |
373
- | `/ccg:team research <args>` | Requirements constraints |
374
- | `/ccg:team plan <args>` | Constraints → parallel impl plan |
375
- | `/ccg:team review [git-range]` | Dual-model cross-review |
376
- | `/ccg:team-exec` | Spawn Builder teammates for parallel coding |
211
+ | `/ccg:team` | 8-phase enterprise workflow — unified 7-role orchestration, with `research` / `plan` / `review` subcommand routing |
212
+ | `/ccg:team-exec` | Parallel implementation reads the plan file, spawns Builder teammates to write code in parallel |
377
213
 
378
214
  > **Prerequisite**: Enable `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` in `settings.json`.
379
215
 
@@ -381,16 +217,16 @@ npx ccgx-workflow # reinitialize
381
217
 
382
218
  | Command | Description |
383
219
  |---------|-------------|
384
- | `/ccg:commit` | Smart conventional commit |
385
- | `/ccg:rollback` | Interactive rollback |
386
- | `/ccg:clean-branches` | Clean merged branches |
387
- | `/ccg:worktree` | Worktree management |
220
+ | `/ccg:commit` | Smart git commit — analyzes changes, generates Conventional Commit messages, suggests splits |
221
+ | `/ccg:rollback` | Interactive git rollback — safely roll a branch back to a historical version, reset/revert modes |
222
+ | `/ccg:clean-branches` | Clean git branches — safely removes merged or stale branches, dry-run by default |
223
+ | `/ccg:worktree` | Git worktree management — creates under `../.ccg/<project>/`, with IDE integration and content migration |
388
224
 
389
225
  ### Project Setup
390
226
 
391
227
  | Command | Description |
392
228
  |---------|-------------|
393
- | `/ccg:init` | Initialize project CLAUDE.md |
229
+ | `/ccg:init` | Initialize project AI context — generates root-level and module-level CLAUDE.md indexes |
394
230
 
395
231
  ---
396
232
 
@@ -400,29 +236,43 @@ npx ccgx-workflow # reinitialize
400
236
 
401
237
  ```
402
238
  ~/.claude/
403
- ├── commands/ccg/ # ~30 slash commands
404
- ├── agents/ccg/ # 19 sub-agents
405
- ├── skills/ccg/ # Quality gates + 10 domain bundles + impeccable + orchestration
406
- ├── bin/codeagent-wrapper # Fallback path (when plugins absent)
239
+ ├── commands/ccg/ # 30 core slash commands + Skill-Registry-generated ones
240
+ ├── agents/ccg/ # 21 sub-agents
241
+ ├── skills/ccg/ # Quality gates + 10 domain bundles + impeccable + orchestration
242
+ ├── hooks/ # 7 passive hooks
243
+ │ ├── ccg-statusline.js # Statusline: model / context / git branch / session
244
+ │ ├── ccg-context-monitor.js # PostToolUse: warns at ≤35% / ≤25% remaining context
245
+ │ ├── ccg-session-state.cjs # SessionStart: injects ≤200-token project memory
246
+ │ ├── ccg-loop-detector.cjs # UserPromptSubmit: repeated-question loop detection
247
+ │ ├── ccg-skill-router.cjs # UserPromptSubmit: domain keyword → skill path injection
248
+ │ ├── ccg-stop-gate.cjs # Stop/SubagentStop: warns about active background jobs
249
+ │ └── ccg-subagent-context.cjs # PreToolUse(Task|Agent): injects phase spec, ≤2048 chars
250
+ ├── bin/codeagent-wrapper # Channel B shim → forwards to invoke-model.mjs
407
251
  └── .ccg/
408
252
  ├── config.toml
409
253
  ├── scripts/
410
- └── repatch-gemini-plugin.mjs # one-shot patch
254
+ ├── invoke-model.mjs # Channel B fallback implementation (Node ESM)
255
+ │ ├── ccgx-call-plugin.mjs # Channel A spawn safety layer (no shell escaping)
256
+ │ ├── check-plugins.cjs # Channel A/B preflight detection
257
+ │ ├── ccg-phase-runner-launcher.mjs # Supervised launcher for /ccg:autonomous
258
+ │ ├── spec-suggestion.cjs # RFC-9 Spec Evolution candidate extraction
259
+ │ ├── task-store.cjs # .context/tasks container + STATE.json CLI
260
+ │ ├── ccg-team-schedule.cjs # team-exec topological wave exporter
261
+ │ └── ccg-state-lock.cjs # O_EXCL file-lock CLI (merge-summary / locked-write)
411
262
  └── prompts/
412
- ├── codex/ # 6 Codex expert prompts
413
- └── gemini/ # 7 Gemini expert prompts
263
+ ├── claude/ # 6 Claude expert prompts
264
+ ├── codex/ # 6 Codex expert prompts
265
+ └── gemini/ # 7 Gemini expert prompts
414
266
  ```
415
267
 
416
268
  ### Environment Variables
417
269
 
418
- In `~/.claude/settings.json` under `"env"`:
270
+ In `~/.claude/settings.json` under `"env"`. These only take effect on **Channel B** (the wrapper / `invoke-model.mjs` path):
419
271
 
420
272
  | Variable | Description | Default | When to change |
421
273
  |----------|-------------|---------|----------------|
422
- | `CODEAGENT_POST_MESSAGE_DELAY` | Wait after Codex completion (sec) | `5` | Set to `1` if Codex hangs |
423
- | `CODEX_TIMEOUT` | wrapper execution timeout (sec) | `7200` | Increase for very long tasks |
424
- | `BASH_DEFAULT_TIMEOUT_MS` | Claude Code Bash timeout (ms) | `120000` | Increase if commands time out |
425
- | `BASH_MAX_TIMEOUT_MS` | Claude Code Bash max timeout (ms) | `600000` | Increase for long builds |
274
+ | `CODEAGENT_POST_MESSAGE_DELAY` | Wait after Codex completion (sec); invalid values fall back to 5, capped at 60 | `5` | Set to `1` if Codex hangs |
275
+ | `CODEX_TIMEOUT` | Execution timeout (sec) | `7200` | Increase for very long tasks |
426
276
 
427
277
  ### MCP
428
278
 
@@ -430,12 +280,19 @@ In `~/.claude/settings.json` under `"env"`:
430
280
  npx ccgx-workflow menu # Select "Configure MCP"
431
281
  ```
432
282
 
433
- **Code retrieval** (pick one):
434
- - **fast-context** (recommended) — Windsurf Fast Context, AI-powered, no full-repo indexing
435
- - **ace-tool** `search_context` ([official](https://augmentcode.com/) / [community proxy](https://acemcp.heroman.wtf/))
436
- - **ContextWeaver** — Local hybrid search, requires SiliconFlow API Key (free)
283
+ Options offered by the init checkbox (defaults reflect `ccg init`):
284
+
285
+ | Option | Default | Notes |
286
+ |--------|---------|-------|
287
+ | **ace-tool** | ✅ checked | `search_context` code retrieval; retrieval provider priority 1 |
288
+ | **fast-context** | unchecked | AI-driven semantic search; priority 2 |
289
+ | **context7** | ✅ checked | Free, library documentation lookup |
290
+ | **grok-search** | unchecked | Web search; requires API key (asks for `GROK_API_URL`/`GROK_API_KEY`, optional TAVILY/FIRECRAWL keys) |
291
+ | **contextweaver** | unchecked | SiliconFlow embedding retrieval; requires API key; priority 3 |
292
+
293
+ If no retrieval provider is selected, MCP retrieval is skipped.
437
294
 
438
- **Optional**: Context7 (auto-installed, library docs) / Playwright / DeepWiki / Exa.
295
+ Additional auxiliary MCPs (Playwright / DeepWiki / Exa) can be installed anytime via `npx ccgx-workflow menu` → "Configure MCP" → auxiliary tools.
439
296
 
440
297
  ---
441
298
 
@@ -455,23 +312,23 @@ npm uninstall -g ccgx-workflow # global npm users need this extra step
455
312
 
456
313
  ## FAQ
457
314
 
458
- ### Codex CLI 0.80.0 process does not exit
315
+ ### Codex CLI process does not exit
459
316
 
460
- In `--json` mode, Codex doesn't auto-exit after output completion.
317
+ In `--json` mode, some Codex CLI versions (e.g. 0.80.0) don't auto-exit after output completion. Only affects Channel B (CLI fallback).
461
318
 
462
319
  **Fix**: Set `CODEAGENT_POST_MESSAGE_DELAY=1`.
463
320
 
464
321
  ### I'm coming from ccg-workflow — does ccgx-workflow drop in?
465
322
 
466
- Yes. `/ccg:*` palette is fully compatible. `.context/` state and `.ccg/roadmap.md` are preserved. See [MIGRATION-FROM-CCG-WORKFLOW.md](./MIGRATION-FROM-CCG-WORKFLOW.md).
323
+ Yes. The `/ccg:*` palette is fully compatible; `.context/` state and `.ccg/roadmap.md` are preserved. See [MIGRATION-FROM-CCG-WORKFLOW.md](./MIGRATION-FROM-CCG-WORKFLOW.md) and the [deep comparison](./docs/VS-CCG-WORKFLOW.md).
467
324
 
468
325
  ### Why is the CLI command `ccg` and not `ccgx`?
469
326
 
470
- Preserving `ccg` keeps legacy aliases, scripts, and docs working with zero changes — `/ccg:*` palette and the `ccg` CLI are both muscle memory. The package name `ccgx-workflow` exists to disambiguate the npm namespace; the CLI binary remains `ccg`.
327
+ Preserving `ccg` keeps legacy aliases, scripts, and docs working with zero changes — the `/ccg:*` palette and the `ccg` CLI are both muscle memory. The package name `ccgx-workflow` exists to disambiguate the npm namespace; the CLI binary remains `ccg`.
471
328
 
472
- ### What happens to the Gemini patch when upstream fixes it?
329
+ ### Fork plugin (`gemini@gemini-ccgx`) vs upstream (`gemini@google-gemini`) which one?
473
330
 
474
- ccgx-workflow tracks upstream plugin versions. Once fixes land upstream, the repatch script auto-skips already-fixed sites via probe detection (`[SKIP]`) no side effects. A ccgx-workflow release will mark "upstream fixed, patch is now a no-op" at that point.
331
+ Use the fork. All recorded patches (the non-contiguous P-series up to P-21, plus W1/W2 and I1/I2) are merged into the fork as permanent commits, so no repatch step is needed and plugin updates don't undo fixes. The fork also adds the `gemini-batch.mjs` ACP bypass, dual-layer timeouts with process-tree kill, and the `~/.gemini/.env` auth bridge. The upstream plugin still works, but you must rerun the repatch script after every plugin update — and as of this writing upstream has fixed none of the recorded issues. Details: [`.ccg-migration/PLUGIN-PATCHES.md`](./.ccg-migration/PLUGIN-PATCHES.md).
475
332
 
476
333
  ---
477
334
 
@@ -498,4 +355,4 @@ MIT — see [LICENSE](./LICENSE) (dual copyright: original author fengshao1227 +
498
355
 
499
356
  ---
500
357
 
501
- v1.0.0 | [Issues](https://github.com/wzyxdwll/ccgx-workflow/issues) | [Migration from ccg-workflow](./MIGRATION-FROM-CCG-WORKFLOW.md)
358
+ v2.5.0 | [Issues](https://github.com/wzyxdwll/ccgx-workflow/issues) | [Comparison with ccg-workflow](./docs/VS-CCG-WORKFLOW.md) | [Migration from ccg-workflow](./MIGRATION-FROM-CCG-WORKFLOW.md)