@event4u/agent-config 9.1.0 → 9.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +38 -234
  3. package/README.md +1 -1
  4. package/dist/agent-src/commands/fix/route.md +49 -0
  5. package/dist/agent-src/commands/fix.md +4 -2
  6. package/dist/agent-src/commands/implement-ticket.md +2 -0
  7. package/dist/agent-src/commands/review/changes.md +22 -0
  8. package/dist/agent-src/commands/tdd/green.md +32 -0
  9. package/dist/agent-src/commands/tdd/red.md +33 -0
  10. package/dist/agent-src/commands/tdd/refactor.md +31 -0
  11. package/dist/agent-src/commands/tdd.md +50 -0
  12. package/dist/agent-src/contexts/communication/rules-auto/guidelines-mechanics.md +1 -0
  13. package/dist/agent-src/contexts/execution/subagent-modes-detail.md +41 -6
  14. package/dist/agent-src/contexts/execution/subagent-spawn-contract.md +81 -2
  15. package/dist/agent-src/contexts/execution/verify-budget.md +15 -0
  16. package/dist/agent-src/rules/architecture.md +7 -0
  17. package/dist/agent-src/rules/cross-source-consistency.md +92 -0
  18. package/dist/agent-src/rules/delegation-policy.md +1 -1
  19. package/dist/agent-src/skills/estimate-ticket/SKILL.md +2 -0
  20. package/dist/agent-src/skills/fe-design/SKILL.md +1 -0
  21. package/dist/agent-src/skills/feature-planning/SKILL.md +1 -1
  22. package/dist/agent-src/skills/judge-code-quality/SKILL.md +1 -0
  23. package/dist/agent-src/skills/persona-improvement/SKILL.md +81 -0
  24. package/dist/agent-src/skills/po-discovery/SKILL.md +2 -0
  25. package/dist/agent-src/skills/react-shadcn-ui/SKILL.md +10 -0
  26. package/dist/agent-src/skills/refine-ticket/SKILL.md +7 -0
  27. package/dist/agent-src/skills/roadmap-writing/SKILL.md +14 -0
  28. package/dist/agent-src/skills/subagent-orchestration/SKILL.md +38 -28
  29. package/dist/agent-src/skills/subagent-orchestration/evals/evals.json +18 -0
  30. package/dist/agent-src/skills/subagent-orchestration/prompts/README.md +3 -2
  31. package/dist/agent-src/skills/subagent-orchestration/prompts/adversarial-verification-council.md +79 -0
  32. package/dist/agent-src/skills/subagent-orchestration/schemas/adversarial-findings.json +56 -0
  33. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  34. package/dist/discovery/deprecation-report.md +1 -1
  35. package/dist/discovery/discovery-manifest.json +205 -29
  36. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  37. package/dist/discovery/discovery-manifest.summary.md +5 -5
  38. package/dist/discovery/orphan-report.md +1 -1
  39. package/dist/discovery/packs.json +19 -11
  40. package/dist/discovery/trust-report.md +4 -4
  41. package/dist/discovery/workspaces.json +16 -8
  42. package/dist/install/install.mjs +9 -0
  43. package/dist/mcp/registry-manifest.json +3 -3
  44. package/dist/router.json +1 -1
  45. package/dist/server/schemas/settings.js +5 -0
  46. package/dist/server/schemas/settings.js.map +1 -1
  47. package/docs/CLAIMS.md +10 -3
  48. package/docs/architecture.md +4 -4
  49. package/docs/archive/CHANGELOG-pre-9.2.0.md +276 -0
  50. package/docs/benchmark.md +24 -0
  51. package/docs/command-flows.md +9 -3
  52. package/docs/contracts/command-clusters.md +2 -1
  53. package/docs/decisions/ADR-122-adversarial-verification-council.md +136 -0
  54. package/docs/decisions/INDEX.md +1 -0
  55. package/docs/design/adversarial-council-eval.md +106 -0
  56. package/docs/development.md +10 -1
  57. package/docs/featured-skills.md +2 -2
  58. package/docs/getting-started-by-role.md +1 -1
  59. package/docs/getting-started.md +1 -1
  60. package/docs/governance-advantage.md +1 -1
  61. package/docs/guidelines/agent-infra/cross-source-consistency-mechanics.md +109 -0
  62. package/docs/guidelines/component-oriented-and-oop-development.md +181 -0
  63. package/docs/proof.md +7 -7
  64. package/package.json +3 -2
  65. package/src/config/agent-settings.template.yml +42 -0
  66. package/src/scripts/_lib/adversarial_council_gate.test.ts +112 -0
  67. package/src/scripts/_lib/adversarial_council_gate.ts +98 -0
  68. package/src/scripts/_lib/adversarial_reconcile.test.ts +197 -0
  69. package/src/scripts/_lib/adversarial_reconcile.ts +187 -0
  70. package/src/scripts/_lib/verify_budget.ts +4 -1
  71. package/src/scripts/ai_council/prompts.ts +7 -0
  72. package/src/scripts/hook_manifest.yaml +17 -6
  73. package/src/scripts/install-hooks.sh +32 -17
  74. package/src/scripts/pr_url_reminder_hook.ts +177 -0
  75. package/src/scripts/schemas/agent-settings.schema.json +11 -0
  76. package/src/server/schemas/settings.ts +9 -0
@@ -0,0 +1,50 @@
1
+ ---
2
+ model_tier: medium
3
+ name: tdd
4
+ disable-model-invocation: true
5
+ argument-hint: "[red|green|refactor] [behavior | args]"
6
+ pack: engineering-base
7
+ tier: 2
8
+ visibility: internal
9
+ description: TDD orchestrator — routes to red (failing test), green (minimum code), refactor (clean while green)
10
+ cluster: tdd
11
+ type: orchestrator
12
+ auto_detect: true
13
+ suggestion:
14
+ eligible: true
15
+ trigger_description: "write the failing test first, make the test pass, refactor while green"
16
+ trigger_context: "user is driving a change test-first and names a TDD phase"
17
+ workspaces:
18
+ - agent-config-maintainer
19
+ packs:
20
+ - meta
21
+ ---
22
+
23
+ # /tdd
24
+
25
+ Thin ergonomic split over the [`test-driven-development`](../../skills/test-driven-development/SKILL.md)
26
+ skill — one sub-command per phase of that skill's mode contract. **No logic
27
+ lives here**; each sub loads the skill and drives its named phase.
28
+
29
+ ## Sub-commands
30
+
31
+ | Sub-command | Routes to | Purpose |
32
+ |---|---|---|
33
+ | `/tdd red` | `commands/tdd/red.md` | Design → Test-Red: enumerate cases, write ONE failing test, watch it fail at an assertion |
34
+ | `/tdd green` | `commands/tdd/green.md` | Implement: write the minimum code to pass; no test edits |
35
+ | `/tdd refactor` | `commands/tdd/refactor.md` | Refactor: clean up while the test stays green |
36
+
37
+ ## Dispatch
38
+
39
+ 1. Parse `/tdd <sub> [args]`. Explicit sub → route. Otherwise infer the phase
40
+ from observable state via the skill's mode-inference table (no test yet →
41
+ red; test failing at an assertion → green; green + defect → red again).
42
+ 2. Load [`test-driven-development`](../../skills/test-driven-development/SKILL.md)
43
+ and drive ONLY the named phase, honoring that phase's Forbidden block.
44
+ 3. LOW confidence / bare `/tdd` → show the three-row menu and ask.
45
+
46
+ ## Rules
47
+
48
+ - **One phase per turn.** Do NOT chain red→green→refactor silently — each sub is one turn.
49
+ - **No logic duplication.** The behavior is the skill's; these commands only select the phase.
50
+ - **Do NOT commit or push.**
@@ -10,6 +10,7 @@ before writing or reviewing code); this file is the catalog.
10
10
  | File | Topic |
11
11
  |---|---|
12
12
  | `code-clarity.md` | Cross-language clarity rules — inline single-use values, carve-outs (side effects, loops, type narrowing, debugger) |
13
+ | `component-oriented-and-oop-development.md` | Reuse-first components (FE) + OOP-where-it-reduces-complexity (backend); carve-out index; bounded by the anti-over-engineering anchors |
13
14
 
14
15
  ## PHP (`docs/guidelines/php/`)
15
16
 
@@ -1,10 +1,11 @@
1
- # Subagent Modes — worktree + live-app-judge detail
1
+ # Subagent Modes — worktree + live-app-judge + adversarial-council detail
2
2
 
3
- Extended detail for the two heaviest [`subagent-orchestration`](../../skills/subagent-orchestration/SKILL.md)
4
- modes — `do-in-worktrees` (mode 7) and `do-with-live-app-judge` (mode 8).
5
- Split out of the skill body to keep it under the size budget; the mode list,
6
- selection rules, and the six common modes stay inline in the skill. Pull this
7
- when you actually dispatch one of these two modes.
3
+ Extended detail for the heaviest [`subagent-orchestration`](../../skills/subagent-orchestration/SKILL.md)
4
+ modes — `do-in-worktrees` (mode 7), `do-with-live-app-judge` (mode 8), and
5
+ `adversarial-verification-council` (mode 9). Split out of the skill body to keep
6
+ it under the size budget; the mode list, selection rules, and the six common
7
+ modes stay inline in the skill. Pull this when you actually dispatch one of these
8
+ modes.
8
9
 
9
10
  ## Mode 7 — do-in-worktrees
10
11
 
@@ -82,3 +83,37 @@ Rules:
82
83
  mechanism for this mode's judge once dependable screenshot tooling lands.
83
84
  Recorded from road-to-opt-design-polish; gate it behind the same
84
85
  `verdict_changed_outcome` adoption evidence above.
86
+
87
+ ## Mode 9 — adversarial-verification-council (gated — opt-in, advisory)
88
+
89
+ A panel of N (default 2) **distinct-model** skeptics red-teams a real,
90
+ already-verified change through the `judge-*` lenses. Each skeptic is prompted to
91
+ *break* the change, returns a structured findings array (+ optional refutations),
92
+ and the returns are reconciled by
93
+ [`_lib/adversarial_reconcile.ts`](../../../scripts/_lib/adversarial_reconcile.ts)
94
+ into one [`adversarial-findings.json`](../../../skills/subagent-orchestration/schemas/adversarial-findings.json)
95
+ envelope. Scope: defect **finding coverage**, not a go/no-go decision (that is
96
+ mode 6). Full contract: ADR-122; skeptic prompt:
97
+ [`prompts/adversarial-verification-council.md`](../../../skills/subagent-orchestration/prompts/adversarial-verification-council.md).
98
+
99
+ | When to use | When not | Model pairing |
100
+ |---|---|---|
101
+ | High-risk change (security, tenant, migration, public API) where finding coverage matters, opted-in | Default flow, routine change, `subagents.adversarial_council: off`, or a plain go/no-go (use mode 6) | skeptics = ≥2 distinct models; cross-*vendor* for the registered claim + high-risk tier; cross-model Iron Law across all |
102
+
103
+ Invariants:
104
+
105
+ - **Advisory only — never auto-gates the change (Hard Floor).** The reconciler
106
+ ranks and annotates findings; a human decides what is actionable.
107
+ - **Default-off.** `subagents.adversarial_council` (`off|ask|on`, default `off`).
108
+ Fires only on an explicit high-risk change under an opted-in setting.
109
+ - **Cross-model Iron Law** across all skeptics; the registered finding-coverage
110
+ claim and the high-risk tier require cross-*vendor* skeptics (the backed
111
+ `cross-vendor-parity` signal is provider-level).
112
+ - **Reconciliation is deterministic TS with tests** — dedup, severity-quorum
113
+ confidence, false-positive suppression (demote, never drop). Never
114
+ LLM-computed prose (ADR-122 anti-lesson).
115
+ - **N cap** from the verify budget; no daemon / no persistent runtime; each
116
+ skeptic return uses the `subagent-status.json` envelope before reconciliation.
117
+ - **Prove-or-drop.** The mode stays default-off until the
118
+ `adversarial-council-finding-coverage` claim is `backed` by the two-stage
119
+ residual-detection benchmark (roadmap Phase 4); honest-null keeps it inert.
@@ -41,11 +41,90 @@ private-data leg stays narrow: the composer rejects inline bodies (multi-line /
41
41
  oversized entries), accepts only ref-like tokens, and caps the count. Anything
42
42
  dropped is recorded in `warnings` and surfaced — never silently widened.
43
43
 
44
+ ## Bundle resolver — bind to the existing surfaces
45
+
46
+ The brief is **resolved**, not hand-built. `resolveBundle(slice)` maps a task
47
+ slice to a concrete bundle by selecting from what the package already ships — no
48
+ parallel registry:
49
+
50
+ - **Role-profile via reused `judge-*` lenses** — a review slice → `judge-code-quality`,
51
+ security → `judge-security-auditor`, tests → `judge-test-coverage`, bug-hunt →
52
+ `judge-bug-hunter`. The lens rides as the leading persona so the subagent loads it.
53
+ - **Role-mode** per slice kind (review → `reviewer`, tests → `tester`, plan → `planner`, …).
54
+ - **Tier** per slice kind (`lite|medium|high`), consumed by `subagent-routing`.
55
+ - **Knowledge refs** filtered by the **ADR-100 guard** (`filterKnowledgeByPolicy`):
56
+ a cross-project bundle drops `proprietary` refs; the drop is recorded.
57
+
58
+ Every resolved bundle emits an auditable `(role_mode, judge_lens, tier,
59
+ knowledge_ref_count, dropped_proprietary)` signature (`bundleAuditLine`) into the
60
+ [`orchestration-telemetry`](orchestration-telemetry.md) object — counts + ids
61
+ only, never bodies.
62
+
44
63
  ## Reference implementation
45
64
 
46
65
  [`src/scripts/_lib/subagent_spawn.ts`](../../../../src/scripts/_lib/subagent_spawn.ts)
47
- (`composeSpawnBrief`), covered by
48
- [`tests/scripts/_lib_subagent_spawn.test.ts`](../../../../tests/scripts/_lib_subagent_spawn.test.ts).
66
+ (`composeSpawnBrief`) + [`src/scripts/_lib/subagent_bundle.ts`](../../../../src/scripts/_lib/subagent_bundle.ts)
67
+ (`resolveBundle`, `filterKnowledgeByPolicy`, `bundleAuditLine`), covered by
68
+ [`tests/scripts/_lib_subagent_spawn.test.ts`](../../../../tests/scripts/_lib_subagent_spawn.test.ts)
69
+ + [`tests/scripts/_lib_subagent_bundle.test.ts`](../../../../tests/scripts/_lib_subagent_bundle.test.ts).
70
+
71
+ ## Worker-prompt rules — verbatim at spawn
72
+
73
+ Relocated from the `subagent-orchestration` skill body (road-to-feedback-9.2.0
74
+ Phase 2, size-budget split). Every dispatched worker prompt obeys these rules —
75
+ they prevent the two classic handoff failures: lossy re-summarization dropping
76
+ the user's requirements, and over-scripted prompts that break on first
77
+ contingency.
78
+
79
+ - **(a) User constraints verbatim.** Pass the user's
80
+ constraints/exclusions/preferences into the worker prompt **verbatim** — never
81
+ a paraphrase (a paraphrase silently drops requirements).
82
+ - **(b) Describe the goal, don't script the approach.** State the outcome and
83
+ let the worker choose the path; over-scripting breaks on contingencies.
84
+ - **(c) Translate environment paths.** Orchestrator-local paths do not exist in
85
+ the worker's sandbox — resolve/translate them at spawn.
86
+ - **(d) Pre-declared check-in conditions.** The worker names, at spawn time, the
87
+ conditions under which it will halt and ask ("if login required", "if
88
+ multiple candidates found") — so interrupts are predictable, not surprises.
89
+ - **(e) Attach relevant knowledge — read-only (road-to-opt-subagent-harvest
90
+ P3).** Before dispatch, look up the slice's key identifiers via
91
+ `memory_lookup` / the knowledge cards and attach the top hits to the
92
+ worker prompt AS LEADS — labelled per the source-discovery discipline
93
+ (negative facts + pointers durable; positive structure = hypothesis to
94
+ re-confirm, never a build input). The WRITE half stays forbidden: a
95
+ subagent's output is never auto-persisted into memory — promotion is
96
+ always the human-gated flow (ADR-098 floor). Auto-surface, never
97
+ auto-write.
98
+
99
+ ## Hand-off worked examples — step N output feeds step N+1
100
+
101
+ Relocated from the `subagent-orchestration` skill (ecosystem-harvest ergonomics
102
+ U4, size-budget split). Ordered modes (`do-in-steps`) pass each step's return
103
+ as the next step's context; the failure this prevents is re-deriving state the
104
+ previous step established, or dropping a decision it made.
105
+
106
+ **Ordered chain (do-in-steps).** Step 1 returns a structured result; step 2's
107
+ worker prompt embeds it verbatim as "context from step 1", never a paraphrase:
108
+
109
+ ```
110
+ Step 1 (analyze) → returns: { entrypoints: [...], risk_notes: "..." }
111
+ Step 2 (implement) worker prompt:
112
+ "Context from step 1 (verbatim, do not re-derive):
113
+ entrypoints = [...]; risk_notes = '...'
114
+ Your task: <goal>. Use the entrypoints above; do not re-scan."
115
+ Step 3 (verify) worker prompt:
116
+ "Context: step 2 changed <files>. Assert <invariant>."
117
+ ```
118
+
119
+ **Fan-out → synthesis (do-in-parallel + a synthesis step).** Each parallel
120
+ worker returns one envelope; the synthesis step receives ALL of them as an
121
+ ordered list and is told what to reconcile ("merge the N findings; a finding
122
+ present in ≥2 returns is high-confidence"). The synthesis prompt names the
123
+ cross-item comparison — it does not just concatenate.
124
+
125
+ The rule both encode: **the receiving prompt embeds the prior return verbatim
126
+ and states what to do with it** — the same verbatim-first discipline as the
127
+ worker-prompt rules above, applied across a step boundary.
49
128
 
50
129
  ## Related
51
130
 
@@ -30,6 +30,20 @@ verification recorded as `none`, or a non-trivial change verified only
30
30
  deterministically, is a **gap** that is surfaced to the user — it never passes
31
31
  silently. This is the audit-visible enforcement of the Iron Law.
32
32
 
33
+ ## Opt-in escalation — adversarial verification council (default-off)
34
+
35
+ For an explicitly high-risk change (security, tenant, migration, public API)
36
+ AND `subagents.adversarial_council != off`, the verify step MAY escalate from a
37
+ single cross-model judge to the **adversarial-verification-council** panel
38
+ (subagent-orchestration Mode 9, ADR-122) — recorded as `verify_mode: council`.
39
+
40
+ This escalation is **strictly opt-in and advisory**: it never fires when the
41
+ setting is `off` (the default), and the panel finds defects but **never
42
+ auto-gates the change** (Hard Floor). It replaces neither the deterministic
43
+ floor nor the standard judge — it adds finding-coverage on top for changes where
44
+ a single judge is too easy to fool. Stays default-off until the
45
+ `adversarial-council-finding-coverage` claim is `backed` (prove-or-drop).
46
+
33
47
  ## Why this does not weaken the floor
34
48
 
35
49
  `deterministic` is still verification — a real diff + dry-run + structural
@@ -48,3 +62,4 @@ small to carry risk, where the deterministic check is sufficient evidence.
48
62
  - [`verify-before-complete`](../../rules/verify-before-complete.md) — the Iron Law this preserves.
49
63
  - [`subagent-orchestration`](../../skills/subagent-orchestration/SKILL.md) — the cross-model judge law.
50
64
  - [`orchestration-telemetry`](orchestration-telemetry.md) — where `verify_mode` is recorded.
65
+ - [`subagent-response-contract`](subagent-response-contract.md) — a low-confidence mutating finding forces the full judge path (`forcesJudge`).
@@ -38,6 +38,13 @@ Fires on new files, classes, controllers, modules, or any structural decision ab
38
38
  → Symfony: see [`symfony-workflow`](../skills/symfony-workflow/SKILL.md).
39
39
  → Next.js / TypeScript backends: see [`nextjs-patterns`](../skills/nextjs-patterns/SKILL.md).
40
40
 
41
+ ## Reusable components + object-oriented design
42
+
43
+ - **Think in reusable units** — decompose UI into composable components; reuse the project's primitives / shared abstractions before building; extract a new unit only when the same shape repeats (audit existing first, per [`ui-audit-gate`](ui-audit-gate.md)).
44
+ - **Object-oriented where it reduces complexity** — in an object-oriented / class-based codebase, encapsulation, single responsibility, composition over inheritance, behavior-rich domain objects, and design patterns *where they earn their place* are the high-priority default — never speculative abstraction, and never imposed on a functional / pipeline codebase (detect + defer to its paradigm). Bounded by [`minimal-safe-diff`](minimal-safe-diff.md) + [`senior-engineering-discipline`](senior-engineering-discipline.md), which **win on conflict**: a reviewer should be able to name the concrete duplication or second axis of change the abstraction removes (rule of thumb: two real repetitions before you extract).
45
+
46
+ Full standard — split FE / backend, with the stack carve-out index and the anti-over-engineering deference: [`component-oriented-and-oop-development`](../docs/guidelines/component-oriented-and-oop-development.md).
47
+
41
48
  ## Architectural Decision Records (ADRs)
42
49
 
43
50
  When a structural decision is non-trivial (kernel membership, contract change, library swap,
@@ -0,0 +1,92 @@
1
+ ---
2
+ type: "auto"
3
+ tier: "2a"
4
+ description: "Two sources disagree (ticket text vs mockup, spec silent on a needed behavior, spec vs code) → surface + ask before proceeding, never silently guess"
5
+ triggers:
6
+ - keyword: "ticket"
7
+ - keyword: "refine"
8
+ - keyword: "acceptance criteria"
9
+ - keyword: "AC"
10
+ - keyword: "mockup"
11
+ - keyword: "screenshot"
12
+ - keyword: "attachment"
13
+ - keyword: "roadmap"
14
+ - keyword: "estimate"
15
+ - phrase: "plan this ticket"
16
+ - phrase: "refine this ticket"
17
+ - phrase: "is this ticket clear"
18
+ - phrase: "implement the ticket"
19
+ applies_to_user_types:
20
+ - "developer"
21
+ - "founder"
22
+ - "consultant"
23
+ routes_to:
24
+ - "guideline:agent-infra/cross-source-consistency-mechanics"
25
+ workspaces: [engineering, product]
26
+ packs: [engineering-base, product-basic]
27
+ ---
28
+
29
+ # Cross-Source Consistency
30
+
31
+ When the agent works from **more than one source** — ticket text, an attached
32
+ image / mockup / screenshot, the spec, the codebase — those sources can
33
+ disagree. The failure this rule prevents: the agent notices (or should notice)
34
+ the disagreement, picks one reading, and proceeds silently — **even when its
35
+ pick is correct**. A good guess on a real contradiction still robs the user of
36
+ the decision that was theirs to make.
37
+
38
+ ## The Iron Law
39
+
40
+ ```
41
+ TWO PRESENT SOURCES DISAGREE → SURFACE THE DISCREPANCY AND ASK BEFORE PROCEEDING.
42
+ A SILENT GUESS ON A REAL CONTRADICTION IS A VIOLATION — EVEN IF THE GUESS IS RIGHT.
43
+ AN INFERRED-BUT-UNSPECIFIED BEHAVIOR IS A SCOPE EXPANSION: ASK, NEVER ADD IT SILENTLY.
44
+ OBVIOUS-TO-THE-AGENT ≠ IN-SCOPE.
45
+ ```
46
+
47
+ ## What counts as a discrepancy
48
+
49
+ - **(a) text ↔ image** — ticket text contradicts an attached mockup / screenshot / diagram (canonical case: text says "show birthdays **today**", the mockup shows a birthday from two days ago).
50
+ - **(b) silent-but-needed** — the spec is silent on a behavior that is clearly required (a weekend/holiday shift, an empty state, an error path). Surface it and ask **before** implementing — do not expand scope on a plausible inference (canonical case: the spec specifies weekend-shifting only; the agent also adds public-holiday shifting without asking).
51
+ - **(c) spec ↔ codebase/reality** — the spec contradicts what the code actually does or what a real source shows.
52
+ - **(d) intra-ticket** — the acceptance criteria, description, and comments contradict each other.
53
+
54
+ ## When it fires — and when NOT
55
+
56
+ **Fires** while planning, refining, estimating, roadmapping, or implementing from
57
+ a ticket/spec that carries a second source (an attachment, a code reality, or an
58
+ internal contradiction), gated by `consistency.cross_source` in
59
+ `.agent-settings.yml` (`on` default · `auto` = high-confidence only · `off` = inert).
60
+
61
+ **Does NOT fire** on a single clear source with no second source to compare
62
+ against (that is plain vagueness — it belongs to `ask-when-uncertain`), on
63
+ trivial edits, or when the user has already resolved the discrepancy this turn.
64
+
65
+ ## How to surface it (subordinate to the ask discipline)
66
+
67
+ - **Subordinate to [`ask-when-uncertain`](ask-when-uncertain.md).** Fold the
68
+ discrepancy into the SAME turn's single question — batch all discrepancies for
69
+ one artefact into ONE numbered-options block. Never emit a second question
70
+ block; one-question-per-turn holds.
71
+ - **Defer to [`scope-control`](scope-control.md)** as the permission authority
72
+ for the type-(b) silent-scope-expansion case.
73
+ - **Precedes [`design-fidelity`](design-fidelity.md).** This rule fires first,
74
+ at decision time ("text says X, the mockup says Y — which wins?"); once the
75
+ user resolves it, `design-fidelity` governs build-time 1:1 fidelity.
76
+ - **Pass the [`no-cheap-questions`](no-cheap-questions.md) Pre-Send Self-Check.**
77
+ Fire only on a genuine contradiction or silent-scope-expansion carrying a real
78
+ trade-off — never a content-free "are you sure?". Under an autonomous mandate a
79
+ detected discrepancy is a blocking decision and is NOT suppressed, but an
80
+ off-hand non-contradiction must not become a continuation prompt.
81
+
82
+ The taxonomy, the scan procedure, the confidence-tiered noise control, worked
83
+ examples, and the precedence table live in
84
+ [`cross-source-consistency-mechanics`](../docs/guidelines/agent-infra/cross-source-consistency-mechanics.md).
85
+
86
+ ## See also
87
+
88
+ - [`ask-when-uncertain`](ask-when-uncertain.md) — the one-question-per-turn ask discipline this folds into (missing info → ask; this adds conflicting present sources → ask).
89
+ - [`scope-control`](scope-control.md) — the permission authority for the silent-scope-expansion (type b) case.
90
+ - [`design-fidelity`](design-fidelity.md) — governs build-time fidelity once a text↔image conflict is resolved.
91
+ - [`active-remediation`](active-remediation.md) — the never-silently-ignore ladder this rule mirrors for source discrepancies.
92
+ - [`no-cheap-questions`](no-cheap-questions.md) — the floor the discrepancy ask must clear.
@@ -90,7 +90,7 @@ primitive → run in-session (clean no-op).
90
90
 
91
91
  ## See also
92
92
 
93
- - [`subagent-orchestration`](../skills/subagent-orchestration/SKILL.md) — the form gate + 8 modes this selects.
93
+ - [`subagent-orchestration`](../skills/subagent-orchestration/SKILL.md) — the form gate + 9 modes this selects.
94
94
  - [`subagent-boundary`](../docs/contracts/subagent-boundary.md) — what a subagent owns vs never owns (task-meaning, memory, pack-surface, safety-floor bypass).
95
95
  - [`auto-orchestration-activation`](../contexts/execution/auto-orchestration-activation.md) — the gate.
96
96
  - [`reasoning-orchestrator`](../skills/reasoning-orchestrator/SKILL.md) — RDP dispatch, now gated here.
@@ -77,6 +77,8 @@ If the ticket scores low on estimability (vague AC, no out-of-scope,
77
77
  no mention of deps), set `uncertainty = Underspecified` and
78
78
  emit a single-line redirect to `/refine-ticket` at the top of the output.
79
79
 
80
+ A **cross-source discrepancy** (per [`cross-source-consistency`](../../rules/cross-source-consistency.md), gated by `consistency.cross_source`) — ticket text contradicting an attached mockup, or a clearly-needed-but-unstated behavior (weekend/holiday shift) — is not estimable as-is: it hides an open scope decision. Raise `uncertainty` and name the discrepancy in the redirect rather than sizing over a contradiction.
81
+
80
82
  ### 3. Apply sizing heuristics
81
83
 
82
84
  Score across four axes; each axis contributes to the final size:
@@ -98,6 +98,7 @@ React island vs. Vue SFC) is the apply-step's concern, not this skill's.
98
98
  - **Compose with reusable UI components** for shared shells, headers, fields.
99
99
  - **Use the project's library primitives first** — never rebuild what the design system already provides (audit findings tell you which).
100
100
  - **Extract when used 3+ times** — DRY applies to UI too.
101
+ - **Component workshop when the project is large enough** — for a real, growing shared-component library, isolate and document each reusable component in a component workshop so it stays discoverable and reused, not re-invented; skip it for a small surface of one-offs. Tool-specific setup is a carve-out (Storybook et al.) — see the implementation skill (e.g. [`react-shadcn-ui`](../react-shadcn-ui/SKILL.md) § Component workshop), never a generic mandate.
101
102
 
102
103
  ## Form Design
103
104
 
@@ -28,7 +28,7 @@ Do NOT use when:
28
28
 
29
29
  ## Procedure: Plan a feature
30
30
 
31
- 1. **Gather requirements** — What problem does this solve? Who benefits? What's the expected outcome?
31
+ 1. **Gather requirements** — What problem does this solve? Who benefits? What's the expected outcome? Run a **cross-source discrepancy scan** (per [`cross-source-consistency`](../../rules/cross-source-consistency.md), gated by `consistency.cross_source`): where the source ticket carries text + an attachment/mockup, or leaves a clearly-needed behavior unstated (weekend/holiday shift, empty/error state, timezone), surface the conflict/gap as an *Open question* before drafting phases — an inferred behavior is a scope expansion to confirm, not to bake in. See [`cross-source-consistency-mechanics`](../../../docs/guidelines/agent-infra/cross-source-consistency-mechanics.md).
32
32
  2. **Analyze scope** — Which modules, routes, models, services are affected?
33
33
  3. **Write the plan** — Create a feature plan document (see template below).
34
34
  4. **Verify** — Confirm all affected areas are identified, no missing dependencies.
@@ -63,6 +63,7 @@ if the neighbors are unfashionable.
63
63
  | **Comments** | Explain *why*, not *what*. Remove comments that restate the code |
64
64
  | **Error-shape consistency** | Exceptions/results follow the same pattern as the rest of the module |
65
65
  | **Public surface** | New public API matches module's existing style and is minimal |
66
+ | **Reuse & OO shape** | A new unit reinvents a component/abstraction the codebase already has (should compose/reuse instead); OR encapsulation/composition would genuinely cut complexity here (anemic object mutated from outside; an `if`/`switch` on a type-discriminator that a polymorphic shape would absorb) — flag **only where the duplication/branch is already present** (never "could grow later"), **in the codebase's own paradigm** (don't push a class onto functional code), never speculative abstraction (`minimal-safe-diff` wins on conflict) |
66
67
 
67
68
  ### 3. Filter out linter-land
68
69
 
@@ -0,0 +1,81 @@
1
+ ---
2
+ model_tier: inherit
3
+ name: persona-improvement
4
+ description: "ONLY when the user explicitly asks to refine a persona from recent corrections — persona analog of skill-improvement-pipeline; tightens a persona's Unique Questions, governance-gated."
5
+ domain: process
6
+ execution:
7
+ type: assisted
8
+ handler: internal
9
+ allowed_tools: []
10
+ workspaces:
11
+ - agent-config-maintainer
12
+ packs:
13
+ - meta
14
+ requires_skills:
15
+ - persona-governance
16
+ ---
17
+
18
+ # persona-improvement
19
+
20
+ The persona analog of [`skill-improvement-pipeline`](../skill-improvement-pipeline/SKILL.md):
21
+ feed a persona a sample of recent corrections/failures where its review lens
22
+ **should** have caught something and didn't, and tighten its `Unique Questions`
23
+ so the lens fires next time. Access ergonomics, not new capability — it only
24
+ sharpens an existing persona, never creates one.
25
+
26
+ ## When to use
27
+
28
+ - The user explicitly says "improve / refine this persona" or "the <persona> lens keeps missing X".
29
+ - A correction sample exists (review misses, repeated feedback) that a persona's questions should have surfaced.
30
+
31
+ Do NOT use for:
32
+
33
+ - Creating a new persona (that is `persona-governance` + the authoring flow).
34
+ - Editing a persona's identity/scope (a breaking change → new id per `persona-governance`).
35
+ - A one-off miss with no pattern — one anecdote is not a refinement signal.
36
+
37
+ ## Procedure
38
+
39
+ 1. **Gather the correction sample.** Collect the recent misses/corrections tied
40
+ to this persona's domain (from the conversation, feedback notes, or a review
41
+ log). If fewer than ~3 distinct misses, STOP — no pattern yet; say so.
42
+ 2. **Locate the gap.** For each miss, name the question the persona *should* have
43
+ asked that would have surfaced it. Cluster the misses into ≤ 2 recurring gaps.
44
+ 3. **Propose tightened `Unique Questions`.** Rewrite or add questions that close
45
+ the gaps — concrete and answerable-from-the-diff, not vague ("does this add a
46
+ second branch on the same enum?" beats "is the design good?"). Keep the
47
+ section ≥ 3 questions (`persona-governance` schema floor).
48
+ 4. **Governance gate (mandatory).** Before writing, confirm with
49
+ [`persona-governance`](../../rules/persona-governance.md): the edit is a
50
+ same-id refinement (not a scope/identity change — those need a new id); the
51
+ persona keeps ≥ 1 skill citation; the file still passes the skill linter
52
+ (tier/wing/section/line budget). A scope change is out of scope for this loop.
53
+ 5. **Apply + verify.** Edit only the `Unique Questions` section; run
54
+ `./scripts-run src/scripts/skill_linter` on the persona file and confirm
55
+ 0 errors; show the before/after questions.
56
+
57
+ ## Output format
58
+
59
+ 1. **Correction sample** — the ≥ 3 misses, one line each.
60
+ 2. **Gaps** — the ≤ 2 recurring gaps the misses cluster into.
61
+ 3. **Before/after `Unique Questions`** — the diff, with which gap each new question closes.
62
+ 4. **Governance confirmation** — same-id refinement ✅, ≥ 1 citation intact ✅, linter 0-error ✅.
63
+
64
+ ## Gotcha
65
+
66
+ - The most common misuse is **scope creep disguised as refinement**: adding
67
+ questions that widen the persona into a second domain. That is a new persona
68
+ (per the per-domain cap), not a refinement — STOP and route to
69
+ `persona-governance`, do not grow the lens sideways.
70
+
71
+ ## Do NOT
72
+
73
+ - Do NOT refine on a single miss — a pattern needs ≥ 3.
74
+ - Do NOT touch identity, scope, tier, or wing — same-id `Unique Questions` only; anything else is a new-id change under `persona-governance`.
75
+ - Do NOT drop below 3 `Unique Questions` (schema floor).
76
+ - Do NOT commit or push — apply the edit locally, surface the diff.
77
+
78
+ ## Related Skills
79
+
80
+ - [`skill-improvement-pipeline`](../skill-improvement-pipeline/SKILL.md) — the skill-side analog this mirrors.
81
+ - [`persona-governance`](../../rules/persona-governance.md) — the four discipline checks this loop is gated by.
@@ -81,6 +81,8 @@ not name an implementation**. Use Given / When / Then or a numbered
81
81
  list. Reject ACs that hide assumptions ("works correctly", "is fast
82
82
  enough") — replace with measurable thresholds or strike them.
83
83
 
84
+ **Cross-source discrepancy scan** (per [`cross-source-consistency`](../../rules/cross-source-consistency.md), gated by `consistency.cross_source`): when the raw input includes a screenshot / mockup alongside the story text, check the sources against each other and surface any conflict as a `gap` / open question — never resolve it silently. Watch for: story text contradicting an attached screenshot; the AC contradicting the description; a clearly-needed behavior the input never states (weekend/holiday shift, empty/error state). Batch them into one clarifying question. Taxonomy: [`cross-source-consistency-mechanics`](../../../docs/guidelines/agent-infra/cross-source-consistency-mechanics.md).
85
+
84
86
  ### 5. Surface non-functional gaps
85
87
 
86
88
  Flag anything missing that downstream skills will need: success
@@ -253,6 +253,16 @@ current state on the next polish round.
253
253
 
254
254
  `DESIGN.md` `## Taste Dials` → honour: Variance → layout-family spread + asymmetry; Motion → animation budget + reduced-motion posture; Density → spacing scale + info-per-viewport. Absent → follow brief's inferred dials.
255
255
 
256
+ ## Component workshop (Storybook) — when the library is large enough
257
+
258
+ Generic "isolate + document reusable components" principle → [`fe-design`](../fe-design/SKILL.md) § Component Architecture; this is the React carve-out for the tool-specific part.
259
+
260
+ - **When it pays off** — real, growing shared-component library (more than a handful of reused primitives, multiple consumers, ongoing UI work): Storybook makes each component discoverable, reviewable in isolation, reused not re-invented. **Skip** for a small surface of one-offs — setup + maintenance not worth it yet.
261
+ - **Story per reusable primitive, not per screen** — a story covers a component + its states (default / loading / empty / error / dark), mirroring the Step 3 state-coverage matrix. Screens composed, not story-fied.
262
+ - **Reuse the token layer** — stories render under the same semantic tokens + `.dark` class; never hardcode a preview theme (Step 2 token discipline).
263
+ - **A11y in-workshop** — run the a11y addon so isolation catches contrast / role / focus before the component reaches a screen.
264
+ - Do NOT let stories drift from the component API — a story props-drilling values the component no longer accepts is stale documentation; keep beside the component, update in the same change.
265
+
256
266
  ## Do NOT
257
267
 
258
268
  - Do NOT install `shadcn-ui` from npm — primitives are scaffolded.
@@ -138,6 +138,13 @@ Check the loaded ticket for clarity signals before orchestrating:
138
138
  - Is the scope one feature, or multiple tangled together?
139
139
  - Any sentence that references an existing module name, feature flag, or domain concept?
140
140
 
141
+ **Cross-source discrepancy scan** (per [`cross-source-consistency`](../../rules/cross-source-consistency.md), gated by `consistency.cross_source`): the ticket is rarely a single source. Compare every source against the others and surface any conflict as an *Open question* — never resolve it silently:
142
+ - **text ↔ attachment** — does the ticket text agree with every attached mockup / screenshot / diagram? (Canonical miss: text says "birthdays **today**", the mockup shows a birthday from two days ago.) If an attachment cannot be read, say so — do not assume it agrees.
143
+ - **silent-but-needed** — is the spec silent on a clearly-needed behavior (weekend/holiday shift, empty state, error path, timezone, permissions)? Surface it and ask before it becomes an implementation assumption — an inferred behavior is a scope expansion, not a given.
144
+ - **intra-ticket** — do the AC, description, and comments contradict each other?
145
+
146
+ Fold every discrepancy into the refined output's *Open questions* section (one batched list), never a second prompt. Full taxonomy + scan procedure: [`cross-source-consistency-mechanics`](../../../docs/guidelines/agent-infra/cross-source-consistency-mechanics.md).
147
+
141
148
  Then run the deterministic detection helper — do **not** re-derive trigger
142
149
  logic in prose:
143
150
 
@@ -82,6 +82,20 @@ Vague goals ("improve roadmaps") force every reader to re-derive
82
82
  intent. If the goal needs three sentences, the roadmap is two
83
83
  roadmaps.
84
84
 
85
+ ### 3b. Scan sources for discrepancies before drafting phases
86
+
87
+ When the roadmap originates from a ticket/spec that carries a second
88
+ source — an attached mockup/screenshot, a code reality, or an internal
89
+ contradiction — run the **cross-source discrepancy scan** (per
90
+ [`cross-source-consistency`](../../rules/cross-source-consistency.md),
91
+ gated by `consistency.cross_source`) before writing phases. A phase plan
92
+ built over a text↔image contradiction or a silent-but-needed behavior
93
+ (weekend/holiday shift, empty/error state) bakes the wrong assumption into
94
+ every downstream step. Surface each discrepancy as one batched open
95
+ question first; an inferred behavior is a scope expansion to confirm, not
96
+ to plan silently. Taxonomy + procedure:
97
+ [`cross-source-consistency-mechanics`](../../../docs/guidelines/agent-infra/cross-source-consistency-mechanics.md).
98
+
85
99
  ### 4. Phase blocks carry checkboxes
86
100
 
87
101
  Every non-intro phase contains at least one `- [ ]`. Decision tables