@magnusekdahl/parallix 1.1.0 → 1.2.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 (68) hide show
  1. package/config/integration-pipelines.json +9 -0
  2. package/config/workflow.config.schema.json +12 -0
  3. package/docs/adr/0032-mission-refinement-state-and-usage-budget-signals.md +10 -8
  4. package/docs/adr/0036-mission-sizing-and-dependency-wave-heuristics.md +14 -12
  5. package/docs/adr/0041-integration-pipeline-gates.md +1 -1
  6. package/docs/adr/0047-per-mission-change-size-budget.md +161 -0
  7. package/docs/adr/index.md +1 -0
  8. package/docs/use-cases.md +44 -0
  9. package/lib/agents/agents.js +149 -100
  10. package/lib/agents/claude-telemetry.js +14 -10
  11. package/lib/agents/claude.js +32 -11
  12. package/lib/agents/codex-telemetry.js +32 -19
  13. package/lib/agents/codex.js +36 -11
  14. package/lib/agents/limit-hit.js +42 -25
  15. package/lib/agents/mistral-telemetry.js +1 -1
  16. package/lib/agents/mistral.js +13 -3
  17. package/lib/agents/opencode-export.js +11 -5
  18. package/lib/agents/opencode-telemetry.js +75 -90
  19. package/lib/agents/opencode.js +86 -29
  20. package/lib/agents/stage-telemetry.js +3 -7
  21. package/lib/commands/active.js +139 -94
  22. package/lib/commands/checkpoint.js +3 -1
  23. package/lib/commands/config.js +5 -3
  24. package/lib/commands/coverage-gate.js +17 -10
  25. package/lib/commands/diff.js +11 -5
  26. package/lib/commands/draft.js +95 -55
  27. package/lib/commands/handoff.js +253 -65
  28. package/lib/commands/integrate.js +288 -188
  29. package/lib/commands/mission-start.js +39 -34
  30. package/lib/commands/rebase.js +32 -21
  31. package/lib/commands/repair-handoff.js +21 -18
  32. package/lib/commands/resolve-conflict.js +5 -2
  33. package/lib/commands/review.js +1 -0
  34. package/lib/commands/setup-review.js +1 -0
  35. package/lib/commands/stats-backfill.js +50 -41
  36. package/lib/commands/stats.js +653 -204
  37. package/lib/commands/status.js +33 -28
  38. package/lib/core/fmt.js +58 -15
  39. package/lib/core/git.js +7 -5
  40. package/lib/core/gitignore.js +6 -4
  41. package/lib/core/mission-utils.js +161 -88
  42. package/lib/core/nels.js +199 -0
  43. package/lib/core/persistent-data-migration.js +55 -23
  44. package/lib/core/product-config.js +44 -23
  45. package/lib/core/runtime-matrix.js +15 -2
  46. package/lib/core/spawn-tee.js +40 -13
  47. package/lib/core/state-map.js +32 -13
  48. package/lib/core/storage.js +19 -5
  49. package/lib/core/subagent-limit.js +28 -0
  50. package/lib/core/verification.js +29 -12
  51. package/lib/review/rebase.js +11 -3
  52. package/lib/review/review-adapter.js +93 -6
  53. package/lib/review/review-artifacts.js +89 -23
  54. package/lib/review/review-commands.js +139 -45
  55. package/lib/review/review-events.js +103 -52
  56. package/lib/review/review-loop.js +117 -87
  57. package/lib/review/review-polling.js +25 -5
  58. package/lib/review/review-prompts.js +36 -5
  59. package/lib/review/review-state.js +39 -15
  60. package/lib/tools/backlog.js +162 -71
  61. package/lib/tools/forgejo.js +290 -129
  62. package/lib/tools/gatekeeper.js +15 -0
  63. package/lib/tools/redgreen.js +220 -0
  64. package/lib/tools/sessions.js +12 -5
  65. package/lib/tools/setup-review.js +170 -70
  66. package/package.json +11 -3
  67. package/prompts/draft.md +6 -0
  68. package/templates/mission-scaffold.md +1 -1
@@ -0,0 +1,9 @@
1
+ {
2
+ "gates": {
3
+ "lib": {
4
+ "command": "./scripts/verify-local.sh static-analysis",
5
+ "order": 1,
6
+ "run_last": false
7
+ }
8
+ }
9
+ }
@@ -89,6 +89,18 @@
89
89
  "type": "object",
90
90
  "description": "Optional per-agent-family LLM model override, keyed by agent family name (e.g. codex, claude, gemini, glm, mistral, custom). Each value is the model identifier passed to that agent's CLI. A family that is not listed sends no model parameter, so the agent uses its own default. There is no 'default' key.",
91
91
  "additionalProperties": { "type": "string" }
92
+ },
93
+ "subagents": {
94
+ "type": "object",
95
+ "description": "Operational limits for subagent spawning within an agent.",
96
+ "additionalProperties": false,
97
+ "properties": {
98
+ "maxParallel": {
99
+ "type": ["integer", "null"],
100
+ "minimum": 0,
101
+ "description": "Maximum number of parallel subagent forks. When unset, null, or zero, no limit is applied."
102
+ }
103
+ }
92
104
  }
93
105
  }
94
106
  }
@@ -55,22 +55,23 @@ Also adopt one explicit place for selection metadata:
55
55
 
56
56
  `## Refinement Signals` must contain:
57
57
 
58
- - `Estimated agent % usage limit`: one of `0-25%`, `25-50%`, `50-75%`, `75-100%`, `100%+`
58
+ - `Predicted NEL bucket`: one of `Small (0–80)`, `Medium (81–235)`, `Large (235+)` per ADR 0047
59
59
  - `Confidence`: `High`, `Medium`, or `Low`
60
60
  - `Selection note`: `activate as-is`, `split first`, or `defer`, with one short reason
61
61
  - `Main drivers`: the 2-4 factors driving the estimate
62
62
 
63
- Interpretation rule for `% usage limit`:
63
+ Interpretation rule for NEL bucket:
64
64
 
65
- - it is an approximate share of a meaningful AI-assisted execution budget under the current repo workflow
65
+ - it is an approximate measure of engineering change volume (insertions + deletions, whitespace-ignored) for the mission's merge diff against the primary branch
66
66
  - it may reflect scope breadth, trust-tier sensitivity, validation burden, review/handoff overhead, context churn, and cross-surface coupling
67
67
  - it is a selection aid, not a delivery promise or pseudo-scientific schedule estimate
68
+ - NEL is computed by the reusable `nels` module (`lib/core/nels.js`) which excludes workflow/bookkeeping files per ADR 0047
68
69
 
69
70
  Default activation guidance:
70
71
 
71
- - `0-25%` or `25-50%`: normally safe to activate as-is when confidence is not low
72
- - `50-75%`: split first unless the mission is unusually high leverage and already sharply bounded
73
- - `75-100%` or `100%+`: defer or split before activation under normal conditions
72
+ - `Small (0–80)`: normally safe to activate as-is when confidence is not low
73
+ - `Medium (81–235)`: split first unless the mission is unusually high leverage and already sharply bounded
74
+ - `Large (235+)`: defer or split before activation under normal conditions
74
75
  - if confidence is `Low`, keep refining instead of treating the estimate as reliable enough for pickup
75
76
 
76
77
  Current rollout blocker:
@@ -84,14 +85,14 @@ Current rollout blocker:
84
85
 
85
86
  - The workflow now distinguishes "not ready yet" from "ready, but not yet started."
86
87
  - Mission comparison becomes more deliberate because shovel-ready candidates can be compared without immediately activating them.
87
- - The `% usage limit` signal is lightweight enough to aid selection without creating a second planning system.
88
+ - The NEL bucket signal is lightweight enough to aid selection without creating a second planning system.
88
89
  - `MISSION.md` remains the detailed execution contract while Backlog stays the current-state surface.
89
90
 
90
91
  ### Negative
91
92
 
92
93
  - The lifecycle gains one more state conceptually, so operators must learn one more transition.
93
94
  - Some older workflow docs and historical artifacts will continue to mention the earlier five-state model.
94
- - `% usage limit` still depends on judgment and may drift if agents stop recording the main drivers behind the estimate.
95
+ - NEL bucket estimates still depend on judgment and may drift if agents stop recording the main drivers behind the estimate.
95
96
 
96
97
  ## Alternatives Considered
97
98
 
@@ -132,4 +133,5 @@ Negative:
132
133
  ## Links
133
134
 
134
135
  - [ADR 0026](0026-ai-task-state-and-agent-recovery-surface.md)
136
+ - [ADR 0047: Per-Mission Change Size Budget](0047-per-mission-change-size-budget.md) — NEL bucket definitions and exclusion globs
135
137
  - [Mission](../missions/2026/task-024-mission-complexity-estimation/MISSION.md)
@@ -18,21 +18,21 @@ Introduce three sizing tracks and a dependency-wave planning heuristic.
18
18
 
19
19
  ### 1. Sizing Tracks
20
20
 
21
- | Track | Scope | Process | Agent Budget |
22
- |-------|-------|---------|--------------|
23
- | **Quick Flow** | < 3 files, < 2h estimated, or docs-only. | Minimal `MISSION.md` (Goal, Why Now, Refinement Signals, Gates). Skip detailed checkpoints if straightforward. | < 10% of agent limit |
24
- | **Full Method** | > 3 files, complex logic, or > 2h. | Standard `MISSION.md` with all sections. Detailed checkpoints. Mandatory external review (C2 review remains required for sensitive scopes per AGENTS.md). | 10-50% of agent limit |
25
- | **Multi-Wave** | Very large, high risk, or complex dependencies. | Split into multiple `Full Method` missions (waves). | Total > 50% (requiring split) |
21
+ | Track | Scope | Process | NEL Budget |
22
+ |-------|-------|---------|------------|
23
+ | **Quick Flow** | < 3 files, < 2h estimated, or docs-only. | Minimal `MISSION.md` (Goal, Why Now, Refinement Signals, Gates). Skip detailed checkpoints if straightforward. | 0–80 NEL (Small) |
24
+ | **Full Method** | > 3 files, complex logic, or > 2h. | Standard `MISSION.md` with all sections. Detailed checkpoints. Mandatory external review (C2 review remains required for sensitive scopes per AGENTS.md). | 81–235 NEL (Medium) |
25
+ | **Multi-Wave** | Very large, high risk, or complex dependencies. | Split into multiple `Full Method` missions (waves). | 235+ NEL (Large) |
26
26
 
27
- ### 2. "Too Large" Thresholds by Agent
27
+ ### 2. "Too Large" Thresholds
28
28
 
29
- A mission is "Too Large" if its `Estimated agent % usage limit` exceeds the following thresholds per session/work-unit:
29
+ A mission is "Too Large" for single-wave execution when its predicted NEL bucket exceeds the following thresholds:
30
30
 
31
- - **Claude**: > 50% of daily limit.
32
- - **Codex**: > 25% of weekly limit.
33
- - **Gemini**: > 50% of the reasonable session/context budget (approx. 50k-100k tokens for execution).
31
+ - **Small (0–80 NEL)**: suitable for Quick Flow; no decomposition needed.
32
+ - **Medium (81–235 NEL)**: suitable for Full Method; consider splitting if dependencies are complex.
33
+ - **Large (235+ NEL)**: MUST be split into dependency waves before activation.
34
34
 
35
- Missions exceeding these thresholds MUST be split into dependency waves before activation.
35
+ These thresholds are derived from empirical terciles in task-1355 data (n=29 missions) as documented in ADR 0047. Missions exceeding these thresholds MUST be split into dependency waves before activation.
36
36
 
37
37
  ### 3. Dependency-Wave Heuristic
38
38
 
@@ -70,10 +70,12 @@ Agents MUST assign themselves to a task in `Backlog.md` before beginning work in
70
70
  - Improved visibility of parallel work via mandatory assignment.
71
71
 
72
72
  ### Negative
73
+
73
74
  - Requires upfront estimation effort during the `draft` phase.
74
- - Agents must learn to judge their own usage limits accurately.
75
+ - Agents must estimate NEL buckets, which requires understanding the exclusion rules from ADR 0047.
75
76
 
76
77
  ## Links
77
78
  - [ADR 0032](0032-mission-refinement-state-and-usage-budget-signals.md)
79
+ - [ADR 0047: Per-Mission Change Size Budget](0047-per-mission-change-size-budget.md) — NEL bucket definitions and exclusion globs
78
80
  - [MISSION_FLOW.md](../../MISSION_FLOW.md)
79
81
  - [AGENTS.md](../../AGENTS.md)
@@ -145,7 +145,7 @@ Option B (Forgejo Actions) would require runner credentials for docker push and
145
145
 
146
146
  ## Deliverables
147
147
 
148
- 1. **Repo-side config:** `config/integration-pipelines.json` with entries for `server`, `auth-server`, `web-client`, `web-e2e`; `web-e2e` carries `run_last: true`
148
+ 1. **Repo-side config:** `config/integration-pipelines.json` with entries for `server`, `auth-server`, `web-client`, `web-e2e`; `web-e2e` carries `run_last: true`. Task-1362 added a `lib` entry mapping to `./scripts/verify-local.sh static-analysis` as a required gate for `lib/` changes.
149
149
  2. **Change detection:** Compute the set of top-level dirs touched by `mission/<slug>` vs the primary branch
150
150
  3. **Dispatch in `scripts/verify-local.sh`:** New `gate_integrate()` function and `integrate` area in the case statement
151
151
  4. **`node workflow integrate` preflight:** Calls the new `integrate` area as part of `printIntegrationPreflight`
@@ -0,0 +1,161 @@
1
+ # ADR 0047: Estimate Mission Size in Net Engineering Lines, Not Agent-Usage %
2
+
3
+ **Status:** Accepted
4
+ **Date:** 2026-06-27
5
+ **Task:** task-1355 (research; depends on the task-1267 hypothesis)
6
+
7
+ ## Context
8
+
9
+ [task-1267](../../backlog/tasks/task-1267%20-%20Hypothesis-reduce-mission-size-to-increase-quality-controls.md)
10
+ hypothesized that smaller missions correlate with fewer defects and proposed a
11
+ flat **<1000-row ceiling**. task-1355 researched this against this repository's own
12
+ archived missions. The full reproducible dataset and method are in
13
+ [`missions/task-1355/data/dataset.md`](../../missions/task-1355/data/dataset.md);
14
+ the analysis is in [`missions/task-1355/findings.md`](../../missions/task-1355/findings.md).
15
+ Every quantitative claim in that research was re-verified against `git log` while
16
+ authoring this ADR (line counts, review rounds, correlations, terciles all
17
+ reproduce exactly), so the decisions below rest on measured data.
18
+
19
+ ### Today missions are estimated in the wrong unit
20
+
21
+ Per [ADR 0032](0032-mission-refinement-state-and-usage-budget-signals.md) and
22
+ [ADR 0036](0036-mission-sizing-and-dependency-wave-heuristics.md), a mission's
23
+ draft-time size signal is **"Estimated agent % usage limit"** (e.g. "25–50%"). That
24
+ unit is agent-specific, non-portable across models, untethered from the artifact a
25
+ reviewer actually reads, and impossible to verify after the fact — there is no
26
+ ground truth to compare a "%-usage" estimate against, so it can never be calibrated.
27
+
28
+ ### Not all lines are equal
29
+
30
+ Parallix missions are line-heavy by construction. Each mission emits `MISSION.md`,
31
+ per-checkpoint `CP-*.md`, `review-state.json`, and `review-events/*` files. These are
32
+ **administrative bookkeeping**, not delivery. The risk a reviewer must reason about
33
+ lives in the **engineering change** the mission ships — code and tests — not in its
34
+ workflow paperwork or prose.
35
+
36
+ Conflating them produces an actively misleading metric. Counting *total* commit lines
37
+ correlates with review rounds at **+0.65**, much stronger than the engineering change
38
+ alone (**+0.39**) — but this is **reverse causation, not signal**: every review round
39
+ writes more `review-events/*` files into the same squash commit, so a mission that was
40
+ hard to review mechanically grows its own line count. Any size signal must therefore
41
+ exclude administrative and documentation lines, or it measures the workflow rather than
42
+ the work.
43
+
44
+ ## Decision
45
+
46
+ **Change the basis on which missions estimate their size, from agent-usage % to a
47
+ predicted count of Net Engineering Lines (NEL), expressed as one of three buckets.
48
+ Then capture the actual NEL at handoff so the draft estimate can, for the first time,
49
+ be checked for reliability.** This ADR records the design and the data-gathering plan;
50
+ it does **not** yet impose any gate or breach action — see "Why no enforcement yet".
51
+
52
+ ### 1. The metric — Net Engineering Lines (NEL)
53
+
54
+ **NEL = insertions + deletions in code and test files**, computed `-w`
55
+ (whitespace-insensitive), **excluding**:
56
+
57
+ - workflow/process bookkeeping — `missions/**`, `backlog/**`, `review-*`, `*CP-*`;
58
+ - documentation — `**/*.md`, `docs/**`;
59
+ - generated / vendored — `package-lock.json`, `coverage/**`, and other lockfiles/build output.
60
+
61
+ "Net Engineering Lines" is chosen as the name precisely to make the exclusions
62
+ self-evident: *engineering* (code and tests, not prose), *net* (the diff, not the
63
+ whole tree). It is the only one of task-1355's four candidate metrics that has both a
64
+ usable correlation with review rework and **zero new tooling** — it is computable from
65
+ `git diff --numstat` today:
66
+
67
+ | Candidate | Correlation w/ review rounds (Pearson/Spearman) | Tooling | Verdict |
68
+ |---|---|---|---|
69
+ | **Net Engineering Lines** | **+0.39 / +0.37** | none | **Chosen** |
70
+ | Files touched | +0.15 / +0.21 | none | weak signal |
71
+ | Hunks (`@@`) | +0.06 / +0.27 | none | weakest |
72
+ | Cyclomatic complexity delta | not measurable in-repo | high (AST) | deferred (see Future Work) |
73
+
74
+ ### 2. The draft estimate — a NEL bucket, replacing "% usage"
75
+
76
+ At draft, the `MISSION.md` size signal becomes a **predicted NEL bucket**, replacing
77
+ "Estimated agent % usage limit". The buckets are the empirical risk terciles found in
78
+ this repo's archived missions (see §4):
79
+
80
+ | Bucket | Predicted NEL | Observed rework rate in this repo (review round ≥ 3) |
81
+ |---|---|---|
82
+ | **Small** | 0–80 | 11% |
83
+ | **Medium** | 81–235 | 22% |
84
+ | **Large** | 235+ | 73% |
85
+
86
+ ### 3. The actual — capture NEL at handoff
87
+
88
+ At handoff the **actual** NEL is computed from the merge diff (exact, cheap,
89
+ tamper-evident) and recorded alongside the draft bucket. This produces, per mission, a
90
+ `(predicted bucket, actual NEL, actual bucket, review rounds)` record — the
91
+ prediction-vs-actual series the workflow has never had.
92
+
93
+ ### 4. Why these buckets — the data
94
+
95
+ Binning the 29 archived missions into terciles by NEL, against the share needing
96
+ rework (`review round ≥ 3`):
97
+
98
+ | Bucket | NEL range | mean review rounds | % needing rework |
99
+ |---|---|--:|--:|
100
+ | small | 0–79 | 1.89 | **11%** |
101
+ | medium | 92–235 | 2.00 | **22%** |
102
+ | large | 270–1106 | 3.91 | **73%** |
103
+
104
+ Missions above ~270 NEL needed rework **73%** of the time vs **11%** below ~80 — a
105
+ ~6.6× higher rate, concentrated at the small→large boundary. The bucket edges (80, 235)
106
+ sit at these tercile boundaries. Note this places the risk inflection far below
107
+ task-1267's proposed 1000-row ceiling, so a 1000-line wall would have missed the entire
108
+ elevated-risk band.
109
+
110
+ ### Why no enforcement yet — calibrate before you gate
111
+
112
+ task-1355 found the workflow has **no calibration data**: it never recorded a predicted
113
+ size, so there has never been a way to know whether an up-front estimate is trustworthy.
114
+ The findings show good reasons to doubt it — task-1360 shipped 1106 NEL but approved in
115
+ **1 round** (a mechanical ESLint cleanup), while task-1332 shipped only 105 NEL but took
116
+ **5 rounds** (small but hard) — i.e. whether a mission is large or *hard* depends on
117
+ facts discovered during implementation.
118
+
119
+ Gating on an uncalibrated estimate would therefore fire on noise. So this ADR
120
+ deliberately stops at **changing the unit and gathering the data**. A threshold and a
121
+ breach action (escalate review depth, force decomposition, block, etc.) are **deferred
122
+ to a follow-up decision** that will be made only once the draft NEL bucket is shown to
123
+ be a reliable estimator of the actual bucket. The whole point of capturing
124
+ `(predicted, actual)` pairs now is to make that future decision evidence-based instead
125
+ of guessed.
126
+
127
+ ## Consequences
128
+
129
+ ### Positive
130
+ - Size is estimated in a **portable, verifiable** unit (lines of engineering change)
131
+ instead of an agent-specific, uncheckable "% usage".
132
+ - The signal measures **delivery risk**, not workflow paperwork; the +0.65 total-line
133
+ confound is designed out by construction.
134
+ - For the first time the workflow accumulates **prediction-vs-actual** data, so the
135
+ reliability of up-front sizing becomes an observable fact rather than an assumption.
136
+ - Zero new tooling — NEL is computable from `git diff --numstat` today.
137
+ - No disruption: nothing is blocked or escalated yet, so a wrong bucket costs nothing.
138
+
139
+ ### Negative / Limitations
140
+ - The bucket edges (80 / 235) are provisional — n=29, single repo — and should be
141
+ re-tuned as the corpus grows.
142
+ - NEL excludes documentation, so it **under-counts docs-heavy deliverables** (e.g.
143
+ research/ADR missions). This is an accepted trade-off for now: such missions carry
144
+ little executable-defect risk. Revisit if doc-only missions prove risky.
145
+ - NEL is gameable at the margin (padding logic with dead code); since nothing is gated
146
+ on it yet, this is not yet a concern.
147
+
148
+ ### Future Work
149
+ - Once enough `(predicted, actual)` pairs exist, **assess whether the draft NEL bucket
150
+ is a reliable estimator** of the actual bucket — this is the trigger for a follow-up
151
+ ADR on enforcement (threshold + breach action).
152
+ - Add a **cyclomatic-complexity-delta** metric once AST tooling lands; evaluate it
153
+ against NEL on a larger sample.
154
+
155
+ ## Links
156
+ - [task-1267 hypothesis](../../backlog/tasks/task-1267%20-%20Hypothesis-reduce-mission-size-to-increase-quality-controls.md)
157
+ - [Research findings (task-1355)](../../missions/task-1355/findings.md)
158
+ - [Reproducible dataset](../../missions/task-1355/data/dataset.md)
159
+ - [ADR 0032](0032-mission-refinement-state-and-usage-budget-signals.md) — amended: this ADR replaces the "% usage limit" draft signal with a NEL bucket.
160
+ - [ADR 0036](0036-mission-sizing-and-dependency-wave-heuristics.md) — amended: "Too Large" sizing is restated in NEL rather than agent-usage %.
161
+ - Implementation: [task-1379](../../backlog/tasks/task-1379%20-%20Replace-agent-usage-size-signal-with-Net-Engineering-Lines-NEL-bucket-capture-actual-at-handoff.md) (replace the % usage signal with a NEL bucket; capture actual NEL at handoff).
package/docs/adr/index.md CHANGED
@@ -15,6 +15,7 @@ ADR 0023 remains in WrGroceries and is cross-referenced here instead of copied.
15
15
  - `docs/adr/0044-workflow-distribution-model.md` — parallix productization path with `px` naming, runtime/target-state boundary, and a 5-alternative decision matrix; Accepted (2026-06-22, task-1331) on the near-term local npm tarball / global `px` install stance
16
16
  - `docs/adr/0045-parallax-branch-model.md` — Two integration modes (trunk-based and feature-branch), Forgejo as PR viewer only, `review` remote wiring, and branch naming conventions
17
17
  - `docs/adr/0046-npm-publish-process-and-security.md` — Adopt public npm registry publication for `@magnusekdahl/parallix` alongside the local tarball path; zero-dependency security posture, manual publish process, and rollback considerations
18
+ - `docs/adr/0047-per-mission-change-size-budget.md` — Change the mission size-estimation basis from agent-usage % to **Net Engineering Lines (NEL)** — code+test diff, excluding docs and workflow/admin bookkeeping (the +0.65 reverse-causation confound). Draft estimate becomes a NEL bucket (0–80 / 81–235 / 235+, the empirical risk terciles); capture actual NEL at handoff to calibrate the estimate. No enforcement until the draft bucket is shown reliable.
18
19
 
19
20
  ## Cross-reference
20
21
  - `docs/adr/0023-ai-sdlc-configuration.md` remains in WrGroceries at `/home/magnus/code/visualBoard-task-1302/docs/adr/0023-ai-sdlc-configuration.md`.
package/docs/use-cases.md CHANGED
@@ -57,6 +57,34 @@ Each use case carries the four required parts: **(P) persona/buyer**, **(B) befo
57
57
  - **(E)** `lib/commands/stats.js:14` (legacy 5-col schema), `:21-30` (extended schema). Tested: `test/stats.test.js` — `upsertStatsRow writes the workflow stats schema and updates existing missions idempotently`, `task-1314: upsertStatsRow keys on (repo, mission, stage) so same mission in different repos stays distinct`. The kind of agent-comparison this enables is demonstrated in `../visualBoard/docs/missions/2026/task-1023/RETROSPECTIVE_P5.md:198-243` (per-family PRs, reviews/PR, durations).
58
58
  - **(C)** **Partial.** Schema and CSV upsert are tested, but the value is bounded: the richest per-agent comparison in the evidence came from Forgejo PR data, not `stats.csv`, and two of four families record honest zeros for token usage (`opencode`/local custom and `mistral`/vibe telemetry are zeroed by design, per `README.md:230-231` describing `opencode-telemetry.js`/`mistral-telemetry.js`). So cross-agent *cost/value* comparison is complete only for `codex` and `claude` today.
59
59
 
60
+ ### UC-7 — Review an agent's whole mission as one branch diff, in your own tool or a PR web view
61
+
62
+ - **(P)** Operator/reviewer who has to read what an AI agent actually changed before approving a merge, and wants it in the diff tool they already trust (delta/difftastic/vimdiff) or a browser PR view — not a wall of inline terminal text.
63
+ - **(B)** *Before:* you reconstruct an agent's work by hand — `git log`, ad-hoc `git diff main`, guessing the base branch, scrolling raw diff through a default pager. *After:* `px diff [<slug>]` resolves the mission worktree and the correct base, computes `primary..HEAD`, and launches your configured specialized diff tool (`git difftool` when `diff.tool` is set, otherwise a non-default `pager.diff`/`core.pager` such as delta or difftastic); when the review provider is Forgejo, the same change is also viewable as a PR in the browser.
64
+ - **(E)** `px diff` is a registered command: `index.js:39` (command list), `:158` (dispatch), `:224` (help text). Implementation: `lib/commands/diff.js:42-43` (base resolution → `primary..HEAD`), `:89-93` (`git difftool` when `diff.tool` configured), `:97-111` (specialized `pager.diff`/`core.pager` path), `:51-68` (rejects plain `less`/`cat`/`more`, accepts delta/difft/diff-so-fancy). Forgejo PR web view: `lib/tools/forgejo.js:170,178` (`getPrStatus` surfaces `pr.html_url`), reached via `lib/review/review-adapter.js:56,83`. Tested: `test/diff.test.js` — `node parallix diff resolves correct target branches`, `node parallix diff detects pager.diff`, `node parallix diff detects core.pager`; Forgejo PR flows in `test/forgejo.test.js`.
65
+ - **(C)** **Confirmed** for the `px diff` mechanic — base resolution and specialized-tool launch are tested code. The Forgejo PR-viewer half is **Partial**: it only renders when the review provider is Forgejo and a Forgejo instance is reachable (`review-adapter.js` no-ops to a "skipped" status otherwise), so position UC-7 as "local mission-branch diff in your own tool, *plus* an optional PR web view when Forgejo is configured."
66
+
67
+ ### UC-8 — Sustain feature-scale mission throughput at roughly the rate of a dedicated AI factory
68
+
69
+ - **(P)** Operator/buyer judging whether the Parallix workflow actually moves more work than a serial single-agent setup, and how it compares to a purpose-built agent factory.
70
+ - **(B)** *Before:* "AI makes me faster" is a vibe with no denominator. *After:* completed missions are counted directly from `stats.csv`, giving a defensible per-week figure that can be compared like-for-like against both a human baseline and an external automated factory.
71
+ - **(E)** Measured ceiling: **58 completed missions in a 15-day window = ~27 missions/week** (`~3.86/day`), counted from `stats.csv` via `node workflow stats` (`../visualBoard/docs/missions/2026/task-1247/research.md:51-57`). The Q2 normalization shows the acceleration that produced it: P5 total `2.96/day`, P6 total `3.29/day`, with user-value delivery at `0.44/day` (P5) and `0.48/day` (P6) over a `0.28/day` human baseline (`../visualBoard/docs/missions/2026/task-1099/RETROSPECTIVE_Q2_2026.md:18-23`). **Reconciling the operator's ~30/week:** the operator's reported ~30 missions/week is the same completed-mission metric as the measured 58-missions/15-day window (~27/week), reported at the recent peak; it sits just above the highest measured 15-day window and within the sampling error of a 15-day count, so the honest framing is "~27/week measured, ~30/week at recent peak," not a single rounded "30." The like-for-like external comparison: an upstream AI factory (`you-agent-factory`) shipped ~26–35 PRD-scale mission-equivalents/week against Parallix's ~27/week — **roughly parity (~1×) on feature-scale work** (`research.md:70-75`).
72
+ - **(C)** **Partial.** The throughput is real and counted from telemetry, but it is **measured-but-caveated**: the figure is completed-mission throughput (not user-value-only delivery, which is `0.44–0.54/day`), it carried 85% AI-SDLC overhead in P5/P6 and only 7% C2 review coverage (`EVALUATION_SUMMARY.md:66`), and the parity comparison is low-medium confidence (where to draw the PRD/micro-task line — `research.md:75`). Do not state "~30/week" without the ~27/week measured anchor and these caveats.
73
+
74
+ ### UC-9 — Start a mission from a feature branch, not just from main
75
+
76
+ - **(P)** Developer mid-way through a feature branch who wants to hand a sub-task to an agent without first merging or rebasing onto main, and without the agent's mission branch silently forking from the wrong base.
77
+ - **(B)** *Before:* tools that assume every branch cuts from `main` either refuse to start on a feature branch or cut the agent's branch from the wrong base, so the diff is polluted with unrelated `main` changes. *After:* `draft` detects whatever branch HEAD is on at draft time, records it as the mission's base, cuts the `mission/<slug>` branch from that recorded base, and writes a machine-readable `Base-Branch:` line into MISSION.md so later steps resolve against the right base.
78
+ - **(E)** `lib/commands/draft.js:173-188` (detect the branch HEAD is on; a non-primary feature branch is recorded as the mission base), `:223` (pass `baseBranch: recordedBase` to branch creation), `:411-430` (`ensureMissionBranch` cuts from the recorded base, falling back to `getPrimaryBranch()` at `:428` for a primary/detached launch — byte-identical to legacy single-branch behaviour), `:439-468` (`ensureMissionBaseBranchRecorded` writes/idempotently maintains the `Base-Branch:` line). Primary-branch resolution: `lib/core/mission-utils.js:67-99` (`getPrimaryBranch`). Tested: `test/draft.test.js` — `ensureMissionBranch creates the mission branch from the recorded feature base`, `ensureMissionBaseBranchRecorded inserts a machine-readable Base-Branch line under the title`, `ensureMissionBaseBranchRecorded replaces a stale Base-Branch line in place`.
79
+ - **(C)** **Confirmed** — feature-base detection, the branch cut from the recorded base, and the idempotent `Base-Branch:` recording are all covered by named passing tests. Note this is not a separate code path: it is the *same* draft flow with explicit base-branch resolution, which falls back to primary-branch behaviour when launched from main.
80
+
81
+ ### UC-10 — Catch agent mistakes with your standard QA gates before a human reviews
82
+
83
+ - **(P)** Lead who knows AI agents introduce lint slips, type errors, and test-hygiene violations, and wants those caught by automated QA *before* burning reviewer attention on them.
84
+ - **(B)** *Before:* an agent's change reaches review with mechanical defects (unused vars, `==` vs `===`, untyped JS, skipped/forced tests) that a human reviewer wastes time flagging. *After:* a configured verification gate runs static analysis as a hard checkpoint — ESLint at `--max-warnings 0`, `tsc --checkJs`, and a test-hygiene scan — so agent-introduced defects fail the gate before review.
85
+ - **(E)** Gate script: `scripts/verify-local.sh:14-44` (`static-analysis` runs ESLint `--max-warnings 0` on `lib/`, `tsc --checkJs --noEmit`, then `test-hygiene.sh`; each stage fails the gate on error), `:47-64` (`docs` subcommand verifies required docs exist). ESLint ruleset enforcing the checks: `.eslintrc.cjs:10-19` (`no-unused-vars`, `eqeqeq`, `no-var`, `valid-typeof`, etc., all `error`). The gate is a configurable adapter command with `{{area}}` substitution and a no-op default so any repo can wire its own runner: `lib/core/verification.js:5-12` (no-op notice), `:26-32` (substitution), `:35` (`runVerificationGate`); this repo wires `npm test` (`workflow.config.json:14`). Tested: `test/verification.test.js` — `runVerificationGate is a no-op pass when no command is configured`, `runVerificationGate executes the configured command via bash`.
86
+ - **(C)** **Confirmed** — the gate script stages, adapter resolution, `{{area}}` substitution, and no-op default are all tested code. UC-10 is the *agent-error-reduction* angle (QA gates catch agent mistakes before review); it is deliberately distinct from UC-5, which is the *CI-adoption* angle (run your existing gate verbatim rather than replumb it).
87
+
60
88
  ---
61
89
 
62
90
  ## 2. Ranking — top 3 for immediate public positioning
@@ -69,6 +97,8 @@ Ranked by *credibility as a public claim given cited evidence*, each naming the
69
97
  | **2** | UC-2 Usage-limit auto-failover across families | Manually restarting with a different model when you hit a cap | Family-specific limit detection → timed blocklist → retry-next-eligible is a tested control loop (`limit-hit.js:8-36`, `test/agents-limit-hit.test.js`), not a retry button. |
70
98
  | **3** | UC-4 Second review gate (prefers a different agent family, with same-family fallback) | Single-agent self-review, or waiting on a human PR reviewer | A self-approval is *code-blocked* and rerouted to a different family or human (`review-commands.js:902`), and reviewer selection actively excludes the implementer family (`review-loop.js:427`). (Marked Partial — there is a documented same-family fallback at `review-loop.js:484-485`, so this is "forces a second *attempt*," not "guarantees a different agent or coverage.") |
71
99
 
100
+ **Re-evaluation with UC-7 through UC-10 (task-1378):** the four new use cases were scored against the top-3 and **none displaces UC-1/UC-2/UC-4.** UC-8 (throughput) is the same measured story as UC-1, not an independent claim — it sharpens UC-1's denominator (~27/week measured, parity with an external AI factory) rather than competing with it. UC-7 (`px diff`/PR view) and UC-10 (QA gates) are Confirmed but are convenience/adoption features whose competing tools (any diff viewer; any CI lint gate) make them weak *public differentiators*. UC-9 (feature-branch start) is Confirmed and fairly distinctive but narrow, and ranks below UC-2's failover control loop on credibility-as-a-public-claim. The table therefore retains UC-1, UC-2, UC-4.
101
+
72
102
  **Genericness check (value-bar §3):** strike "Parallix" and substitute any other AI coding tool — rank 1 fails to read identically because the +57% to +107% user-value figures, and the later +1,280% completed-mission figure, are specific repository data; rank 2 fails because per-family limit regexes + timed blocklist is a named tested behavior, not a generic "retry"; rank 3 fails because a code-level self-approval block is specific behavior, not a slogan.
73
103
 
74
104
  **Feature-list strike check (value-bar §1):** removing every Parallix-internal noun still leaves a user situation in each top-3: (1) "run several AI agents on one repo at once without them overwriting each other"; (2) "when one provider hits its cap mid-task, continue on another automatically"; (3) "a second review pass by a preferentially different AI is forced before the author's own approval counts (though same-family fallback applies when no other agent is available)."
@@ -95,6 +125,16 @@ The two weakest use cases and the single strongest objection a skeptical senior
95
125
  *Objection:* "Your richest agent comparison (`RETROSPECTIVE_P5.md:198-243`) came from Forgejo PR data, not `stats.csv`, and two of four families log zero tokens by design. So 'know which agent pays off' is true only for codex and claude — the CSV alone can't make the buyer's decision you imply."
96
126
  *How the evidence answers it:* It partially answers. The schema and idempotent upsert are tested (`test/stats.test.js`), so the *plumbing* claim holds; but the *decision-grade comparison* claim is bounded to families with structured telemetry. UC-6 is marked **Partial** with that boundary stated, and it is deliberately excluded from the top-3.
97
127
 
128
+ ### New objections raised by UC-7 through UC-10 (task-1378)
129
+
130
+ 3. **UC-8 (throughput) is UC-1's number wearing a second hat — and "~30/week" inflates it.**
131
+ *Objection:* "You list a separate 'velocity' use case, but its evidence is the same `58 missions/15 days` figure UC-1 already cites, and you headline the operator's `~30/week` when the measured window is `~27/week`. That's double-counting one result and rounding it up."
132
+ *How the evidence answers it:* It concedes both points by construction. UC-8 is marked **Partial** and explicitly excluded from the ranking *because* it is the same measured story as UC-1, not an independent claim; the §2 re-evaluation states this. The `~30/week` is presented only alongside the `~27/week` measured anchor (`research.md:51-57`) as a recent-peak report within a 15-day sample's error, never as a standalone number.
133
+
134
+ 4. **UC-10 (QA gates) is just UC-5 (adopt your CI) renamed.**
135
+ *Objection:* "Both use cases point at the same `verification.js` adapter and `verify-local.sh`. Splitting 'adopt your gate' from 'catch agent errors' is positioning, not capability."
136
+ *How the evidence answers it:* The mechanism is indeed shared (`lib/core/verification.js:35`, `scripts/verify-local.sh`), and this is stated in UC-10's confidence line. The distinction is the *buyer's reason*: UC-5 sells "you don't have to replumb verification to adopt the workflow"; UC-10 sells "the gate that runs is a defect filter on agent output before review." Same code, two different purchase motivations — which is why UC-10 stays out of the top-3 rather than being claimed as a new mechanism.
137
+
98
138
  ---
99
139
 
100
140
  ## 5. Limitations & honesty constraints (carried into any downstream positioning)
@@ -102,4 +142,8 @@ The two weakest use cases and the single strongest objection a skeptical senior
102
142
  - Throughput framing is permitted **only** with the cited observed ranges and their metric labels: `0.44-0.58/day` over a `0.28/day` baseline for user-value throughput, or `58 missions / 15 days` (`~27/week`, `~3.86/day`) for later completed-mission throughput. Do not blur those into one number. All such framing must travel with its caveats (34% overhead in the early summary, 7% C2 coverage, METR −19%/model-currency, P5 erosion under 85% AI-SDLC mix). A bare "2× faster" is a defect.
103
143
  - The README is treated as the artifact under test, never as proof — every value claim above is anchored to code/tests/configs/measured retro data.
104
144
  - visualBoard's human baseline carries acknowledged confounds (2022 codebase was simpler); rate comparisons are directional (`EVALUATION_SUMMARY.md:9`). The latest metrics-bearing retro is `../visualBoard/docs/missions/2026/task-1099/RETROSPECTIVE_Q2_2026.md`, which reports P4 `0.54/day`, P5 `0.44/day`, and P6 `0.48/day`.
145
+ - **UC-7 (px diff / PR view):** the `px diff` mechanic is fully local and Confirmed, but the browser PR-review half depends on a reachable **Forgejo** instance with the review provider set to forgejo; with any other provider the adapter no-ops to a "skipped" status (`lib/review/review-adapter.js:16`). Position the PR-web-view as conditional, not always-on. `px diff` also requires the operator to have a specialized diff tool configured in Git — it deliberately fails rather than fall back to a plain pager (`lib/commands/diff.js:113-116`).
146
+ - **UC-8 (velocity):** the only permitted throughput figures are `~27/week` measured (`58 missions / 15 days`) and `~0.44–0.54/day` user-value; the operator's `~30/week` may appear **only** as a recent-peak report stated next to the `~27/week` anchor, never alone. It carries every UC-1 caveat (85% AI-SDLC overhead, 7% C2 coverage, different mission-output metrics) and the parity-with-`you-agent-factory` comparison is low-medium confidence (`research.md:75`).
147
+ - **UC-9 (feature-branch start):** this is **not a separate code path** — it is the standard `draft` flow with explicit base-branch resolution that falls back to primary-branch behaviour when launched from main (`lib/commands/draft.js:428`). Do not position it as a distinct "feature-branch mode."
148
+ - **UC-10 (QA gates):** the gate is only as strong as what each repo configures; the default adapter is a documented **no-op pass** (`lib/core/verification.js:5-12`), so "catches agent errors" is true only when a real gate command (like this repo's `npm test` or `verify-local.sh static-analysis`) is wired. It shares its mechanism with UC-5 and must not be claimed as a second, independent capability.
105
149
  - History coverage backing this analysis: parallix — 14 `MISSION.md` files + 25 backlog tasks (≥10 ✓); visualBoard — `EVALUATION_SUMMARY.md`, `RETROSPECTIVE.md`, `BENCHMARK.md`, `RETROSPECTIVE_P5.md` among 18 retro files (≥3 ✓).