@dzhechkov/skills-feature-adr 1.3.26 → 1.3.30

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.
package/README.md CHANGED
@@ -106,6 +106,41 @@ ARCHITECTURE → IMPLEMENTATION → CODE → QE → FLEET QE
106
106
  # Full protocols + 6 extra skills, up to 7 fleet QE agents
107
107
  ```
108
108
 
109
+ ### Codex model routing (optional)
110
+
111
+ If [Codex](https://developers.openai.com/codex) is installed + logged in, the pipeline can route work to
112
+ Codex — **always asking first, always with a Claude fallback** (it never blocks on Codex). Three opt-in
113
+ knobs (via the workflow `args`, or offered interactively at the planning checkpoint):
114
+
115
+ | Knob | Step | What it does |
116
+ |---|---|---|
117
+ | `planner: 'codex'` | 6 Plan | plan on Codex's top model (Claude fallback) |
118
+ | `coder: 'codex-fallback'` | 7 Code | Claude first; **if the Claude Code limit is exhausted mid-run → retry on Codex** |
119
+ | `qeReviewer: 'codex-fallback'` | 8 QE/tests | same fallback for the review/testing stage |
120
+ | `codexModel: 'auto'` | — | which Codex model (`auto` default (Codex self-selects) · or an id your account exposes (e.g. `gpt-5.5`)) |
121
+
122
+ **Scenario — never stall on a rate limit:** a long L/XL feature hits the Claude Code session limit while
123
+ writing code. Without this the run stalls; with `coder: 'codex-fallback'` the pipeline logs *"Claude
124
+ unavailable (limit?) — falling back to Codex auto"* and finishes the code + tests on Codex, no
125
+ restart and no lost work.
126
+
127
+ ```bash
128
+ # Headless login on a VPS (no browser):
129
+ codex login --device-auth # prints a code + URL you approve on another device
130
+ # — or —
131
+ printenv OPENAI_API_KEY | codex login --with-api-key
132
+ ```
133
+
134
+ ```js
135
+ // ultracode (the deterministic workflow form): plan on Codex, code+QE fall back to Codex on Claude-limit:
136
+ Workflow({ scriptPath: '.claude/workflows/feature-adr.js',
137
+ args: { slug: 'add-oauth', description: '…', tier: 'M',
138
+ planner: 'codex', coder: 'codex-fallback', qeReviewer: 'codex-fallback', codexModel: 'auto' } }) // 'auto' = Codex picks top; or pin e.g. 'gpt-5.5'
139
+ ```
140
+
141
+ Omit the Codex knobs entirely for today's all-Claude behavior. The run result reports
142
+ `plannerUsed` / `coderUsed` / `qeReviewerUsed` / `codexModel` so you can see who did what.
143
+
109
144
  ---
110
145
 
111
146
  ## Spec-Driven Development (SDD)
@@ -170,6 +170,27 @@ for load-bearing judgment). Models are **overridable defaults**.
170
170
  > steps and compare reward patterns / rework counts vs your `sonnet` baseline. This table is a
171
171
  > starting heuristic, not a benchmark — tune per project.
172
172
 
173
+ ### Codex routing (optional — cross-model + limit resilience)
174
+
175
+ In the **ultracode workflow form**, feature-adr can hand steps to [Codex](https://developers.openai.com/codex)
176
+ — opt-in, always with a Claude fallback (never blocks). Two reasons teams turn it on:
177
+
178
+ 1. **Cross-model planning** — plan Step 6 on Codex's top model: `planner: 'codex'`.
179
+ 2. **Never stall on a rate limit** — the killer feature: `coder: 'codex-fallback'` +
180
+ `qeReviewer: 'codex-fallback'`. Claude writes the code/tests as usual; but if a long L/XL run hits
181
+ the **Claude Code session limit mid-Step-7/8**, the pipeline auto-retries that step on Codex
182
+ (`auto` by default) instead of stalling — no restart, no lost work.
183
+
184
+ ```bash
185
+ # one-time headless login (VPS, no browser):
186
+ codex login --device-auth # approve the printed code+URL on your phone/laptop
187
+
188
+ # then, when launching a run, pass the knobs (or accept the interactive pre-flight offer):
189
+ # planner: 'codex' | coder: 'codex-fallback' | qeReviewer: 'codex-fallback' | codexModel: 'auto'
190
+ ```
191
+
192
+ Omit the knobs for the all-Claude default. Full reference: `.claude/rules/feature-adr-ultracode.md`.
193
+
173
194
  ---
174
195
 
175
196
  ## 7. QE modes cheat-sheet
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dzhechkov/skills-feature-adr",
3
- "version": "1.3.26",
3
+ "version": "1.3.30",
4
4
  "description": "Adaptive Feature Development skill pack for Claude Code — 11-step pipeline with Complexity Router (S/M/L/XL), ADR-driven architecture, 15 agentic-qe skills, multi-agent fleet QE. Supports --full-qe, --full-qe-extended, --with-learning, and --knowledge-extractor modes.",
5
5
  "bin": {
6
6
  "skills-feature-adr": "./bin/cli.js"
@@ -25,22 +25,54 @@ The pipeline ALWAYS runs the feature-adr Pattern memory loop **in-process** —
25
25
  - **Step 0** recalls learned patterns (`dz recall`) → folds the top ones into requirements/ADR as `{LEARNED_PATTERNS}` + records the recalled count in the live panel (`dz statusline --fa-record`).
26
26
  - **Step 8** teaches the durable lessons back (`dz teach`) + records the stored count. The loop pays off (recall) and grows (teach) every run.
27
27
 
28
- ## Optional Codex planner (opt-in, pre-flight ASK)
28
+ ## Optional Codex routing (opt-in, pre-flight ASK)
29
29
 
30
- feature-adr can route the **planning step (Step 6)** to Codex's top model instead of Claude. It is
31
- **opt-in and graceful**: absent/declined/failed → the default Claude planner runs (the pipeline never
32
- blocks on Codex).
30
+ feature-adr can route work to Codex's models. **All of it is opt-in and graceful** absent / declined /
31
+ Codex-unavailable → the default Claude agent runs; the pipeline NEVER blocks on Codex. Three knobs, all
32
+ overridable via `args`:
33
33
 
34
- Pre-flight, BEFORE launching a feature-adr run, detect Codex readiness:
34
+ | Knob (`args.*`) | Step | Values | Effect |
35
+ |---|---|---|---|
36
+ | `planner` | 6 (Plan) | `claude` (default) · `codex` | `codex` → Step-6 plans on Codex, Claude fallback |
37
+ | `coder` | 7 (Code) | `claude` (default) · `codex` · `codex-fallback` | `codex-fallback` → Claude first, **on limit-exhaustion (null) → Codex** |
38
+ | `qeReviewer` | 8 (QE/tests) | `claude` (default) · `codex` · `codex-fallback` | same fallback, for the QE/testing stage |
39
+ | `codexModel` | — | `auto` (default — Codex self-selects the top available) · or a specific id your account exposes (e.g. `gpt-5.5`, `gpt-5.4`) | which Codex model to use |
40
+
41
+ The result reports `plannerUsed` / `coderUsed` / `qeReviewerUsed` / `codexModel` so you can see who did what.
42
+
43
+ **Pre-flight — detect + ASK (do this BEFORE launching a run):**
44
+ ```bash
45
+ node "<codex-plugin>/scripts/codex-companion.mjs" setup --json # → { "ready": true }
35
46
  ```
36
- node "<codex-plugin>/scripts/codex-companion.mjs" setup --json → { ready: true }
47
+ If `ready`, ASK the user once (skip all of this if not ready Claude does everything):
48
+ 1. *"Plan (Step 6) on the top Codex model?"* → set `planner: 'codex'`.
49
+ 2. *"Fall back to Codex for code + tests/QE (Step 7/8) if the Claude Code limit is exhausted?"* →
50
+ set `coder: 'codex-fallback'`, `qeReviewer: 'codex-fallback'`.
51
+ 3. *"Which Codex model?"* (`auto` — Codex self-selects — or a specific id your account exposes; model ids are account/version-specific, so verify via the runtime rather than assuming) → **write it into codex config so the
52
+ `codex:codex-rescue` runtime picks it up**, then pass `codexModel`:
53
+ ```bash
54
+ printf '\nmodel = "gpt-5.5"\n' >> ~/.codex/config.toml # pin a REAL id your account has (auto = default; verify: ask the codex runtime what -m ids it accepts)
55
+ ```
56
+ For the interactive SKILL (plain `/feature-adr`), make the same three offers at the planning checkpoint.
57
+
58
+ **Scenario (the reason this exists):** a long L/XL run hits the Claude Code session limit mid-Step-7.
59
+ Without this, the Code agent returns null and the run stalls. With `coder: 'codex-fallback'`, feature-adr
60
+ detects the null, logs *"Claude unavailable (limit?) — falling back to Codex auto"*, and finishes
61
+ the code + tests on Codex — no restart, no lost work.
62
+
63
+ **Example invocations:**
64
+ ```js
65
+ // Plan on Codex, code+QE fall back to Codex only if Claude runs out, auto:
66
+ Workflow({ scriptPath: '.claude/workflows/feature-adr.js',
67
+ args: { slug: 'add-x', description: '…', tier: 'M',
68
+ planner: 'codex', coder: 'codex-fallback', qeReviewer: 'codex-fallback', codexModel: 'auto' } }) // 'auto' = Codex picks top; or pin e.g. 'gpt-5.5'
69
+
70
+ // All-Claude (the default — omit the Codex knobs entirely):
71
+ Workflow({ scriptPath: '.claude/workflows/feature-adr.js', args: { slug: 'add-x', description: '…', tier: 'M' } })
37
72
  ```
38
- If `ready`, **ASK the user once**: *"Use the top Codex model for the planning step?"* On yes, pass
39
- `args.planner: 'codex'` (the workflow routes Step 6 to the `codex:codex-rescue` agentType, with a
40
- Claude fallback and `plannerUsed` in the result). On no / not-ready, omit `planner` (Claude plans).
41
- For the interactive SKILL (plain `/feature-adr`), make the same offer at the planning checkpoint.
42
- Codex needs a headless login on a VPS: `codex login --device-auth` (code + URL) or
43
- `printenv OPENAI_API_KEY | codex login --with-api-key`.
73
+
74
+ **Headless Codex login on a VPS (no browser):** `codex login --device-auth` (prints a code + URL you
75
+ approve on another device) or `printenv OPENAI_API_KEY | codex login --with-api-key`.
44
76
 
45
77
  ## Hybrid checkpoints (router decides)
46
78
 
@@ -355,11 +355,25 @@ Step 0 (Complexity Router) checks:
355
355
  description, code, tier, stopAfter, repo, dzBin } })`. Hybrid checkpoints: S/M autonomous; L/XL return
356
356
  after the Plan phase for your steer. See `.claude/rules/feature-adr-ultracode.md`.
357
357
 
358
- **Optional Codex planner (opt-in).** When Codex is installed + logged in (`codex login --device-auth`
359
- on a headless VPS, or `printenv OPENAI_API_KEY | codex login --with-api-key`), the pipeline can route the
360
- **planning step to Codex's top model**. It ALWAYS asks first a pre-flight *"Use the top Codex model for
361
- planning?"* — and falls back to Claude if you decline or Codex is unavailable (never blocks). ultracode:
362
- pass `args.planner: 'codex'`. Plain `/feature-adr`: the same offer appears at the planning checkpoint.
358
+ **Optional Codex routing (opt-in).** When Codex is installed + logged in (`codex login --device-auth`
359
+ on a headless VPS, or `printenv OPENAI_API_KEY | codex login --with-api-key`), the pipeline can route work
360
+ to Codex always ASKING first, always with a Claude fallback (never blocks):
361
+
362
+ - **Planning (Step 6)** on Codex's top model → `args.planner: 'codex'`.
363
+ - **Code (Step 7) + tests/QE (Step 8) FALLBACK** → `args.coder: 'codex-fallback'`, `args.qeReviewer:
364
+ 'codex-fallback'`: Claude runs first, and only if the **Claude Code limit is exhausted mid-run** (the
365
+ agent returns null) does the SAME task retry on Codex — so a long build never stalls on a rate limit.
366
+ - **Model choice** → `args.codexModel` (`auto` default (Codex self-selects) · or an id your account exposes (e.g. `gpt-5.5`)).
367
+
368
+ *Scenario:* an L/XL run hits the session limit during coding → with `coder: 'codex-fallback'` feature-adr
369
+ logs *"Claude unavailable (limit?) — falling back to Codex auto"* and finishes on Codex, no restart.
370
+
371
+ *Example:* `Workflow({ scriptPath: '.claude/workflows/feature-adr.js', args: { slug, description, tier:
372
+ 'M', planner: 'codex', coder: 'codex-fallback', qeReviewer: 'codex-fallback', codexModel: 'auto' } }) // 'auto' = Codex picks top; or pin e.g. 'gpt-5.5'`.
373
+
374
+ Pre-flight, if Codex is `ready` (`codex-companion setup --json`), the orchestrator asks these three
375
+ before launching; plain `/feature-adr` offers the same at the planning checkpoint. Omit the Codex knobs
376
+ for today's all-Claude behavior. See `.claude/rules/feature-adr-ultracode.md`.
363
377
 
364
378
  ### Pattern memory loop (self-learning — runs in ALL modes)
365
379
 
@@ -1,7 +1,7 @@
1
1
  export const meta = {
2
2
  name: 'feature-adr',
3
- description: 'Canonical /feature-adr --full-qe-extended pipeline as a reusable workflow: router+RECALL then design(ADR, applies learned patterns) then plan then code then agentic-qe QE+TEACH, producing features/<slug>/00-09 artifacts. MANDATORY in-process self-learning loop (Step-0 recall, apply, Step-8 teach). OPTIONAL Codex planner (args.planner=codex Step-6 routed to codex:codex-rescue top model, graceful fallback to Claude). Hybrid checkpoints (S/M autonomous; L/XL stop-after-plan).',
4
- whenToUse: 'ultracode + a feature implementation. Invoke via Workflow({scriptPath:".claude/workflows/feature-adr.js", args:{slug, description, code, tier, stopAfter, planner}}) instead of an ad-hoc orchestration, so every feature ships with an ADR + inline agentic-qe QE + self-learning.',
3
+ description: 'Canonical /feature-adr --full-qe-extended pipeline as a reusable workflow: router+RECALL then design(ADR, applies learned patterns) then plan then code then agentic-qe QE+TEACH, producing features/<slug>/00-09 artifacts. MANDATORY in-process self-learning loop (Step-0 recall, apply, Step-8 teach). OPTIONAL Codex routing: args.planner=codex (Step-6), args.coder/qeReviewer='codex-fallback' (Step-7/8 fall back to Codex when Claude limits exhaust; args.codexModel default 'auto' (Codex self-selects top; account-specific)). Hybrid checkpoints (S/M autonomous; L/XL stop-after-plan).',
4
+ whenToUse: 'ultracode + a feature implementation. Invoke via Workflow({scriptPath:".claude/workflows/feature-adr.js", args:{slug, description, code, tier, stopAfter, planner, coder, qeReviewer, codexModel}}) instead of an ad-hoc orchestration, so every feature ships with an ADR + inline agentic-qe QE + self-learning.',
5
5
  phases: [
6
6
  { title: 'Router', detail: 'Step 0 - classify + self-learning recall' },
7
7
  { title: 'Design', detail: 'Steps 1-5 - requirements, ADR, QCSD, architecture (tier-gated)' },
@@ -86,14 +86,47 @@ if (stopHere) {
86
86
  return { tier: tier, phase: 'checkpoint-after-plan', artifactsDir: FDIR, planner: (plan ? plan.planner : null), plan: (plan ? plan.summary : null), note: 'L/XL checkpoint - review the ADR + plan, then re-invoke with args.stopAfter="none" to implement + QE.' }
87
87
  }
88
88
 
89
- // Step 7: Code
89
+ // Codex fallback config (opt-in). CODER/QE_REVIEWER ∈ 'claude'|'codex'|'codex-fallback'. On
90
+ // 'codex-fallback' the Claude agent runs FIRST; if it returns null (e.g. the Claude Code session limit
91
+ // is exhausted mid-code/mid-QE — exactly the failure we hit before), the SAME task is retried on the
92
+ // codex:codex-rescue runtime. args.codexModel is DEFAULT 'auto' (Codex self-selects the top model
93
+ // available to the account — model ids are account/version-specific and move ahead of any static
94
+ // default, so 'auto' is the portable choice). To hard-pin a specific id (e.g. this account's top is
95
+ // gpt-5.5), the orchestrator writes it into ~/.codex/config.toml at pre-flight; the hint below only nudges.
96
+ const CODEX_MODEL = A.codexModel || 'auto'
97
+ const CODEX_HINT = ' (If you are the Codex runtime, prefer the ' + CODEX_MODEL + ' model.)'
98
+ const CODER = (A.coder === 'codex' || A.coder === 'codex-fallback') ? A.coder : 'claude'
99
+ const QE_REVIEWER = (A.qeReviewer === 'codex' || A.qeReviewer === 'codex-fallback') ? A.qeReviewer : 'claude'
100
+
101
+ // Step 7: Code (optional Codex fallback on Claude-limit exhaustion)
90
102
  phase('Code')
91
- const code = await agent('Step 7 (Code) of /feature-adr for "' + DESC + '" (' + SLUG + '). Implement the feature per the plan + ADR + architecture in ' + FDIR + '. Write the ACTUAL production code + its tests (mirror the closest existing implementation named in research/architecture). Follow repo conventions; build must pass. Write a change manifest ' + FDIR + '/07_code_changes/change_manifest.md listing every file touched. Return wrote[] (incl. real source files) + summary.', { label: 'code', phase: 'Code', schema: ARTIFACT, effort: 'high' })
103
+ const codePrompt = 'Step 7 (Code) of /feature-adr for "' + DESC + '" (' + SLUG + '). Implement the feature per the plan + ADR + architecture in ' + FDIR + '. Write the ACTUAL production code + its tests (mirror the closest existing implementation named in research/architecture). Follow repo conventions; build must pass. Write a change manifest ' + FDIR + '/07_code_changes/change_manifest.md listing every file touched. Return wrote[] (incl. real source files) + summary.'
104
+ let code = null
105
+ let coderUsed = 'claude'
106
+ if (CODER !== 'codex') {
107
+ code = await agent(codePrompt, { label: 'code', phase: 'Code', schema: ARTIFACT, effort: 'high' })
108
+ if (code) coderUsed = 'claude'
109
+ }
110
+ if (code === null && (CODER === 'codex' || CODER === 'codex-fallback')) {
111
+ if (CODER === 'codex-fallback') log('Code: Claude unavailable (limit?) — falling back to Codex ' + CODEX_MODEL)
112
+ const codexCode = await agent(codePrompt + CODEX_HINT, { label: 'code:codex', phase: 'Code', agentType: 'codex:codex-rescue' })
113
+ if (codexCode) { code = { wrote: [FDIR + '/07_code_changes/change_manifest.md'], summary: String(codexCode).slice(0, 500) }; coderUsed = CODER === 'codex' ? 'codex' : 'codex-fallback' }
114
+ }
92
115
 
93
116
  // Step 8: QE (brutal-honesty, agentic-qe) + MANDATORY teach
94
117
  phase('QE')
95
118
  const qePrompt = 'Step 8 (QE - brutal-honesty review, agentic-qe) of /feature-adr for "' + DESC + '" (' + SLUG + '). Adversarially review the SHIPPED code (read it): correctness, edge cases, error handling, and the LOAD-BEARING property the ADR named (ASSERT it has a test - the recurring lesson). Grade A/B/C/D honestly. Assess code-test adequacy + doc-test presence. List CONFIRMED gaps with severity. Write ' + FDIR + '/08_qe_report.md. MANDATORY SELF-LEARNING STORE (close the loop, never skip): via Bash run `dz teach "<a durable reusable lesson from this feature - a rule/pattern/pitfall, NOT a checkpoint echo>" --reward <0.7-0.95> --domain <area>` for each genuine lesson (1-3 max, high-signal), then run `' + DZ + ' statusline --fa-record --slug ' + SLUG + ' --step "Step 8 QE" --recalled 3 --stored <count taught> --mode ' + MODE + ' --project ' + REPO + '` (run it verbatim via Bash, do not skip). Do NOT teach trivia or invent gaps. Return {grade, gaps, codeTestsAdequate, docTestsPresent}.'
96
- const qe = await agent(qePrompt, { label: 'qe:brutal', phase: 'QE', agentType: 'qe-code-reviewer', schema: QE })
119
+ let qe = null
120
+ let qeReviewerUsed = 'claude'
121
+ if (QE_REVIEWER !== 'codex') {
122
+ qe = await agent(qePrompt, { label: 'qe:brutal', phase: 'QE', agentType: 'qe-code-reviewer', schema: QE })
123
+ if (qe) qeReviewerUsed = 'claude'
124
+ }
125
+ if (qe === null && (QE_REVIEWER === 'codex' || QE_REVIEWER === 'codex-fallback')) {
126
+ if (QE_REVIEWER === 'codex-fallback') log('QE: Claude unavailable (limit?) — falling back to Codex ' + CODEX_MODEL)
127
+ const codexQe = await agent(qePrompt + CODEX_HINT, { label: 'qe:codex', phase: 'QE', agentType: 'codex:codex-rescue' })
128
+ if (codexQe) { qe = { grade: 'codex-review', gaps: [], codeTestsAdequate: null, docTestsPresent: null, summary: String(codexQe).slice(0, 500) }; qeReviewerUsed = QE_REVIEWER === 'codex' ? 'codex' : 'codex-fallback' }
129
+ }
97
130
 
98
131
  // Step 9: Fleet QE (L/XL)
99
132
  let fleet = 'skipped (S/M)'
@@ -119,6 +152,9 @@ return {
119
152
  docTestsPresent: qe ? qe.docTestsPresent : null,
120
153
  fleetQE: fleet,
121
154
  plannerUsed: plan ? plan.planner : null,
155
+ coderUsed: coderUsed,
156
+ qeReviewerUsed: qeReviewerUsed,
157
+ codexModel: CODEX_MODEL,
122
158
  selfLearning: 'recall@Step0 + teach@Step8 (mandatory)',
123
159
  promiseTags: tags,
124
160
  }