@event4u/agent-config 2.11.0 → 2.13.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 (75) hide show
  1. package/.agent-src/commands/council/analysis.md +142 -0
  2. package/.agent-src/commands/council/debate.md +129 -0
  3. package/.agent-src/commands/council/default.md +8 -0
  4. package/.agent-src/commands/council/design.md +16 -12
  5. package/.agent-src/commands/council/optimize.md +16 -15
  6. package/.agent-src/commands/council/pr.md +12 -12
  7. package/.agent-src/commands/council.md +48 -2
  8. package/.agent-src/personas/advisors/contrarian.md +95 -0
  9. package/.agent-src/personas/advisors/executor.md +99 -0
  10. package/.agent-src/personas/advisors/expansionist.md +98 -0
  11. package/.agent-src/personas/advisors/first-principles.md +98 -0
  12. package/.agent-src/personas/advisors/outsider.md +102 -0
  13. package/.agent-src/rules/copilot-routing.md +19 -0
  14. package/.agent-src/rules/devcontainer-routing.md +20 -0
  15. package/.agent-src/rules/laravel-routing.md +20 -0
  16. package/.agent-src/rules/symfony-routing.md +20 -0
  17. package/.agent-src/skills/ai-council/SKILL.md +180 -2
  18. package/.agent-src/skills/canvas-design/SKILL.md +132 -0
  19. package/.agent-src/skills/canvas-design/evals/triggers.json +16 -0
  20. package/.agent-src/skills/copilot-config/SKILL.md +1 -1
  21. package/.agent-src/skills/devcontainer/SKILL.md +1 -1
  22. package/.agent-src/skills/doc-coauthoring/SKILL.md +129 -0
  23. package/.agent-src/skills/doc-coauthoring/evals/triggers.json +16 -0
  24. package/.agent-src/skills/laravel/SKILL.md +1 -1
  25. package/.agent-src/skills/project-analysis-core/SKILL.md +1 -1
  26. package/.agent-src/skills/project-analyzer/SKILL.md +1 -1
  27. package/.agent-src/skills/skill-writing/SKILL.md +101 -16
  28. package/.agent-src/skills/sql-writing/SKILL.md +1 -1
  29. package/.agent-src/skills/symfony-workflow/SKILL.md +1 -1
  30. package/.agent-src/skills/universal-project-analysis/SKILL.md +1 -1
  31. package/.agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  32. package/.claude-plugin/marketplace.json +5 -1
  33. package/AGENTS.md +1 -1
  34. package/CHANGELOG.md +78 -0
  35. package/CONTRIBUTING.md +5 -0
  36. package/README.md +3 -3
  37. package/config/agent-settings.template.yml +5 -84
  38. package/docs/architecture/multi-tool-projection.md +53 -0
  39. package/docs/architecture/{compression.md → source-projection.md} +21 -3
  40. package/docs/architecture.md +6 -6
  41. package/docs/catalog.md +21 -11
  42. package/docs/contracts/adr-architectural-consensus-mechanism.md +67 -0
  43. package/docs/contracts/adr-level-6-productization.md +2 -2
  44. package/docs/contracts/ai-council-config.md +186 -0
  45. package/docs/contracts/command-clusters.md +57 -1
  46. package/docs/contracts/multi-tool-projection-fidelity.md +109 -0
  47. package/docs/getting-started.md +2 -2
  48. package/package.json +1 -1
  49. package/scripts/_archive/README.md +59 -0
  50. package/scripts/ai_council/_default_prices.py +10 -1
  51. package/scripts/ai_council/advisors.py +148 -0
  52. package/scripts/ai_council/clients.py +189 -4
  53. package/scripts/ai_council/config.py +368 -0
  54. package/scripts/ai_council/consensus.py +290 -0
  55. package/scripts/ai_council/orchestrator.py +634 -16
  56. package/scripts/ai_council/prompts.py +335 -0
  57. package/scripts/check_compressed_paths.py +6 -1
  58. package/scripts/check_references.py +25 -0
  59. package/scripts/ci_time_ratio.py +168 -0
  60. package/scripts/council_cli.py +1007 -32
  61. package/scripts/measure_projection_bytes.py +159 -0
  62. package/scripts/measure_roadmap_trajectory.py +112 -0
  63. package/scripts/probe_projection_fidelity.py +202 -0
  64. package/scripts/run_skill_evals.py +185 -0
  65. package/scripts/schemas/skill.schema.json +4 -0
  66. package/scripts/score_skill_selection.py +198 -0
  67. package/scripts/skill_collision_clusters.py +162 -0
  68. package/scripts/skill_linter.py +71 -1
  69. /package/scripts/{_backfill_skill_domains.py → _archive/_backfill_skill_domains.py} +0 -0
  70. /package/scripts/{_bootstrap_tier_frontmatter.py → _archive/_bootstrap_tier_frontmatter.py} +0 -0
  71. /package/scripts/{_p43_bodies.py → _archive/_p43_bodies.py} +0 -0
  72. /package/scripts/{_p43_compress.py → _archive/_p43_compress.py} +0 -0
  73. /package/scripts/{_p4_migrate.py → _archive/_p4_migrate.py} +0 -0
  74. /package/scripts/{_phase2_shim_helper.py → _archive/_phase2_shim_helper.py} +0 -0
  75. /package/scripts/{_pilot_council_question.py → _archive/_pilot_council_question.py} +0 -0
@@ -0,0 +1,142 @@
1
+ ---
2
+ name: council:analysis
3
+ tier: 2
4
+ cluster: council
5
+ sub: analysis
6
+ skills: [ai-council]
7
+ description: Run the council on a local analysis output (project-analyze, audit script, codebase scan) — critiques the analysis itself for dedup, evidence quality, and roadmap-readiness.
8
+ disable-model-invocation: true
9
+ suggestion:
10
+ eligible: true
11
+ trigger_description: "council on this analysis, critique the project-analyze output, second opinion on the audit findings, turn analysis into roadmap"
12
+ trigger_context: "user has a local analysis artefact (agents/analysis/*.md|json) and wants an external critique of the analysis quality + roadmap-ready follow-ups"
13
+ ---
14
+
15
+ # /council analysis
16
+
17
+ ## Instructions
18
+
19
+ Specialised council mode for **local analysis artefacts** — `/project-analyze`
20
+ output, audit reports, codebase scans under `agents/analysis/`. Wraps
21
+ `/council default files:<path>` with the `analysis` neutrality preamble that
22
+ focuses members on **critiquing the analysis itself** (dedup, evidence
23
+ quality, roadmap-readiness) rather than re-reviewing the underlying code.
24
+
25
+ The synthesis output is shaped for direct consumption by
26
+ `/roadmap-create` — Top-N consensus findings + per-finding metadata
27
+ (`evidence-grade`, `roadmap-ready`, `supporting-citation`).
28
+
29
+ ### 1. Resolve the analysis artefact
30
+
31
+ The user invoked `/council analysis <path>` or `/council analysis`. If
32
+ no path was supplied, ask (one question per turn, per
33
+ `ask-when-uncertain`):
34
+
35
+ > Which analysis artefact should the council review?
36
+ >
37
+ > 1. A file path under `agents/analysis/` (`.md` or `.json`)
38
+ > 2. Multiple files (one analysis split across sections)
39
+ > 3. Free-form analysis text in the chat — paste it now
40
+
41
+ Pick **1** or **2** → use `files:` mode of `/council default`.
42
+ Pick **3** → use `prompt:` mode of `/council default`.
43
+
44
+ ### 2. Capture the upstream-analysis goal
45
+
46
+ Look for the artefact's stated goal — the first paragraph after the
47
+ title, a `## Goal` / `## Scope` section, or the analyzer command that
48
+ produced it (often in the file header). That goal is the `original_ask`
49
+ for the handoff preamble. If absent, ask the user (one question per
50
+ turn):
51
+
52
+ > What was the goal of this analysis? (one sentence — used as neutral
53
+ > framing for the council, not their critique)
54
+
55
+ A follow-up question MAY also be supplied as part of the invocation
56
+ (e.g. `/council analysis <path> "which findings warrant a roadmap?"`).
57
+ Append it to `original_ask` so members see both the analyzer goal and
58
+ the consumer question.
59
+
60
+ ### 3. Run /council default with the analysis mode preamble
61
+
62
+ Invoke the matching `/council default` form:
63
+
64
+ - `files:` → `/council default files:<paths>` with `--prompt-mode analysis`.
65
+ - `prompt:` → `/council default prompt:"<artefact text>"` with
66
+ `--prompt-mode analysis`.
67
+
68
+ `--prompt-mode` is the CLI flag (`scripts/council_cli.py`) that
69
+ swaps the lens addendum after the bundler has run. The bundle shape
70
+ stays as the resolved `--input-mode` (prompt | roadmap | files).
71
+
72
+ The `analysis` mode addendum from `scripts/ai_council/prompts.py`
73
+ focuses council members on:
74
+
75
+ - Deduplicating findings restated under different headings.
76
+ - Scoring evidence quality (confirmed / inferred / speculative).
77
+ - Separating roadmap-ready findings from ones that need a discovery
78
+ loop first.
79
+ - Proposing 3–5 ranked follow-up actions with supporting citations.
80
+
81
+ The cost gate from `/council default` Step 3 still applies. Render via
82
+ Step 5/5a/5b of `/council default`.
83
+
84
+ ### 4. Render the report (analysis-shaped header + Top-N consensus)
85
+
86
+ Use the standard stacked + Convergence/Divergence layout. Add a
87
+ one-line analysis header at the top so reviewers know the lens:
88
+
89
+ ```
90
+ ## Council on <artefact path> — analysis lens
91
+ ```
92
+
93
+ After the standard Convergence / Divergence blocks, append a
94
+ **Top-N consensus** block in the shape consumed by `/roadmap-create`:
95
+
96
+ ```
97
+ ## Top-N consensus findings (roadmap-ready first)
98
+
99
+ 1. <finding title>
100
+ - evidence-grade: confirmed | inferred | speculative
101
+ - roadmap-ready: yes | needs-discovery
102
+ - cited by: <member names — anonymised post-render is fine>
103
+ - supporting citation: <file:line | section heading from the upstream analysis>
104
+
105
+ 2. ...
106
+ ```
107
+
108
+ Order: roadmap-ready findings first, ranked by member-consensus count;
109
+ then `needs-discovery` items. Cap at N=10 unless the upstream analysis
110
+ has fewer findings.
111
+
112
+ ### 5. Hand back to the user
113
+
114
+ The council is **advisory**. Do **not** rewrite the analysis or open
115
+ roadmap files based on findings. Surface the Top-N block and offer:
116
+
117
+ > 1. Feed the Top-N block into `/roadmap create` to draft a roadmap.
118
+ > 2. Discard — keep findings in chat only.
119
+ > 3. Re-run with a narrower scope.
120
+
121
+ ### Hard floor (restated)
122
+
123
+ `/council analysis` produces **text only**. It does NOT edit the
124
+ analysis file, write roadmap files, or modify the codebase. Roadmap
125
+ authoring is the explicit downstream step, not a side-effect.
126
+
127
+ ## Failure modes
128
+
129
+ - **No artefact resolvable** → ask once; if still empty, stop.
130
+ - **Artefact too large** → bundler raises `BundleTooLarge`; suggest
131
+ splitting (`/council default files:<single-section>` per heading).
132
+ - **Analysis has zero citations** → flag in the rendered report; every
133
+ finding will score as `speculative`. The council will say so loudly
134
+ and the Top-N block will be empty of `confirmed` rows — that is the
135
+ signal to re-run the upstream analyzer with stricter evidence rules.
136
+
137
+ ## See also
138
+
139
+ - `/council default` — base orchestration entry point.
140
+ - `/project-analyze` — primary upstream producer of analysis artefacts.
141
+ - `/roadmap create` — primary downstream consumer of the Top-N block.
142
+ - `ai-council` skill — neutrality guidelines.
@@ -0,0 +1,129 @@
1
+ ---
2
+ name: council:debate
3
+ tier: 2
4
+ cluster: council
5
+ sub: debate
6
+ skills: [ai-council]
7
+ description: Multi-round council debate with progressive cost disclosure — each member produces a position, then rebuts the strongest opposing position in subsequent rounds. User confirms spend between rounds.
8
+ disable-model-invocation: true
9
+ suggestion:
10
+ eligible: true
11
+ trigger_description: "council debate on X, multi-round rebuttal, escalate council to debate mode, push the council to argue not synthesize"
12
+ trigger_context: "user wants real pushback — initial positions plus explicit rebuttals across rounds, with progressive cost confirmation between rounds"
13
+ ---
14
+
15
+ # /council debate
16
+
17
+ ## Instructions
18
+
19
+ Specialised council mode for **multi-round debates**. Each enabled member
20
+ produces an initial position in Round 1, then rebuts the strongest
21
+ opposing position in subsequent rounds. The orchestrator pauses between
22
+ rounds and asks the user to continue (progressive cost disclosure). Hard
23
+ cap: `ai_council.cost_budget.max_total_usd` aborts the next round if
24
+ the projection breaches the cap, persisting the partial debate.
25
+
26
+ This is **not a flag** on `/council default` — debate mode changes the
27
+ orchestration shape (N members × R rounds = N×R calls) and the cost UX,
28
+ so it earns its own sub-command per the R4 verdict.
29
+
30
+ ### 1. Resolve the topic
31
+
32
+ The user invoked `/council debate "<topic>"` or `/council debate <path-to-artefact>`.
33
+ Treat the argument as the **topic** of the debate (a question, a
34
+ proposal, an architectural call). If missing, ask (one question per
35
+ turn, per `ask-when-uncertain`):
36
+
37
+ > What is the topic of the debate?
38
+ >
39
+ > 1. Inline topic (e.g. "Should we adopt event sourcing for the orders module?")
40
+ > 2. Path to a file containing the topic / artefact
41
+ > 3. Cancel
42
+
43
+ Capture the resolved topic as `original_ask` verbatim. Do **not** add
44
+ the agent's framing.
45
+
46
+ ### 2. Decide round count + auto-continue
47
+
48
+ Default: 2 rounds (initial position + one rebuttal). Cap: the value of
49
+ `defaults.debate_max_rounds` in [`agents/.ai-council.yml`](../../../agents/.ai-council.yml)
50
+ (default 4). `--rounds N` overrides the default; values above the cap
51
+ are rejected by the CLI.
52
+
53
+ Auto-continue is **off by default** — the user explicitly opts in via
54
+ `--auto-continue` when they want to skip the y/N gate between rounds.
55
+ The hard cost cap still applies regardless.
56
+
57
+ ### 3. Estimate (always)
58
+
59
+ Run `council:estimate` first using `--prompt-mode=debate` (the CLI sets
60
+ this automatically when invoked via `debate`). The estimate covers
61
+ **one round**. Multiply by the planned round count for the worst-case
62
+ projection. Surface the projection to the user with a clear note that
63
+ progressive disclosure may stop the debate early.
64
+
65
+ ### 4. Cost confirmation (ALWAYS ASK)
66
+
67
+ Per [`ai-council` skill § cost gate](../../skills/ai-council/SKILL.md),
68
+ always surface the projected total spend and ask for explicit consent
69
+ before invoking. Numbered options:
70
+
71
+ > The debate is projected to cost **$X.XXXX** ($Y.YYYY × N rounds, worst case).
72
+ >
73
+ > 1. Run all N rounds (auto-continue, no between-round prompt)
74
+ > 2. Run round-by-round (confirm before each next round) — recommended
75
+ > 3. Cancel
76
+
77
+ The default recommendation is option 2 (progressive disclosure). Map
78
+ option 1 to `--auto-continue`, option 2 to interactive mode, option 3
79
+ to abort.
80
+
81
+ ### 5. Invoke the CLI
82
+
83
+ ```bash
84
+ python3 scripts/council_cli.py debate <topic-path> \
85
+ --output agents/council-sessions/<date>-<slug>/ \
86
+ --confirm \
87
+ --rounds <N> \
88
+ [--auto-continue] \
89
+ [--continue-as-debate <prior-session.json>] \
90
+ --original-ask "<verbatim topic>"
91
+ ```
92
+
93
+ Session directory shape: `agents/council-sessions/<YYYY-MM-DD>-debate-<slug>/`
94
+ with `debate-round-1.json`, `debate-round-2.json`, … written incrementally.
95
+ An interrupted debate leaves every completed round on disk.
96
+
97
+ ### 6. Continuation pivot (optional)
98
+
99
+ If the user has a prior `/council default` session and wants more
100
+ pushback, they can pivot via `--continue-as-debate <session.json>`. The
101
+ orchestrator seeds Round 1 from the existing responses (no calls billed
102
+ for Round 1) and starts the rebuttal loop at Round 2. **Members + models
103
+ must match** the source session — a mismatch is a hard error.
104
+
105
+ ### 7. Render the final synthesis
106
+
107
+ After all rounds complete, render the last round's JSON via
108
+ `/council` render flow:
109
+
110
+ ```bash
111
+ python3 scripts/council_cli.py render agents/council-sessions/<dir>/debate-round-<N>.json
112
+ ```
113
+
114
+ The debate mode uses the structured decision-lens template (Karpathy
115
+ synthesis) by default. `--prose-synthesis` switches to open-ended prose.
116
+
117
+ ### 8. Hard floor — text only
118
+
119
+ `/council debate` produces text artefacts (round JSONs + synthesis
120
+ markdown). It does NOT edit files, commit, push, or open PRs. The
121
+ session directory is the canonical audit trail.
122
+
123
+ ## Cap exceeded
124
+
125
+ If `DebateCapExceeded` fires, the CLI exits with code 3 and the partial
126
+ debate is persisted. Surface the partial-debate path to the user and
127
+ ask whether to (a) raise the cap in `agents/.ai-council.yml` and rerun,
128
+ (b) stop here and render the partial result, or (c) start a new debate
129
+ with a smaller scope.
@@ -126,9 +126,16 @@ redaction, and prints the per-member preview without spending:
126
126
  [--input-mode prompt|roadmap] \
127
127
  [--max-tokens N] \
128
128
  [--mode-override api|manual] \
129
+ [--prompt-mode pr|design|optimize|analysis] \
129
130
  [--original-ask "<framing sentence>"]
130
131
  ```
131
132
 
133
+ `--prompt-mode` is the lens-override flag routed by the
134
+ `/council pr|design|optimize|analysis` wrappers. It swaps the
135
+ per-mode neutrality addendum (see `scripts/ai_council/prompts.py`
136
+ `_MODE_TABLE`) without changing the bundle shape. Bare
137
+ `/council default` invocations leave it unset.
138
+
132
139
  For `prompt:"<text>"` mode, write the text to a temp file first
133
140
  (`mktemp` is fine) and pass that path. For `roadmap:<path>`, pass the
134
141
  roadmap file with `--input-mode roadmap`. `diff` and `files` modes
@@ -155,6 +162,7 @@ Once the user picks `1`, invoke the same arguments with `run` plus
155
162
  [--rounds 1|2|3] \
156
163
  [--depth standard|deep] \
157
164
  [--input-mode …] [--max-tokens …] [--mode-override …] \
165
+ [--prompt-mode …] \
158
166
  [--original-ask "<framing sentence>"]
159
167
  ```
160
168
 
@@ -17,8 +17,8 @@ suggestion:
17
17
  ## Instructions
18
18
 
19
19
  Specialised council mode for **design documents, ADRs, and
20
- architecture proposals**. Wraps `/council files:<paths>` (or
21
- `/council prompt:"…"`) with the `design` mode neutrality preamble that
20
+ architecture proposals**. Wraps `/council default files:<paths>` (or
21
+ `/council default prompt:"…"`) with the `design` mode neutrality preamble that
22
22
  focuses members on architectural risk rather than line-level
23
23
  correctness.
24
24
 
@@ -33,8 +33,8 @@ path was supplied, ask (one question per turn):
33
33
  > 2. Multiple files / a directory (the bundler will gather them)
34
34
  > 3. A free-form proposal in the chat — paste it now
35
35
 
36
- Pick **1** or **2** → use `files:` mode of `/council`.
37
- Pick **3** → use `prompt:` mode of `/council`.
36
+ Pick **1** or **2** → use `files:` mode of `/council default`.
37
+ Pick **3** → use `prompt:` mode of `/council default`.
38
38
 
39
39
  ### 2. Capture the originating ask
40
40
 
@@ -46,13 +46,16 @@ goal section, ask the user (one question per turn):
46
46
  > What is the goal of this design? (one sentence — used as neutral
47
47
  > framing for the council, not their analysis)
48
48
 
49
- ### 3. Run /council with the design mode preamble
49
+ ### 3. Run /council default with the design mode preamble
50
50
 
51
- Invoke the matching `/council` form:
51
+ Invoke the matching `/council default` form:
52
52
 
53
- - `files:` → `/council files:<paths>` with `mode_override=design`.
54
- - `prompt:` → `/council prompt:"<artefact text>"` with
55
- `mode_override=design`.
53
+ - `files:` → `/council default files:<paths>` with `--prompt-mode design`.
54
+ - `prompt:` → `/council default prompt:"<artefact text>"` with
55
+ `--prompt-mode design`.
56
+
57
+ `--prompt-mode` is the CLI flag (`scripts/council_cli.py`) that
58
+ swaps the lens addendum after the bundler has run.
56
59
 
57
60
  The `design` mode addendum from `scripts/ai_council/prompts.py`
58
61
  focuses council members on:
@@ -62,7 +65,8 @@ focuses council members on:
62
65
  - Sequencing risk (does step N really not block step N+1?).
63
66
  - Open questions disguised as decisions.
64
67
 
65
- The cost gate from `/council` Step 3 still applies.
68
+ The cost gate from `/council default` Step 3 still applies. Render via
69
+ Step 5/5a/5b of `/council default`.
66
70
 
67
71
  ### 4. Render the report
68
72
 
@@ -88,11 +92,11 @@ design file, open ADR PRs, or modify the codebase.
88
92
 
89
93
  - **No artefact resolvable** → ask once; if still empty, stop.
90
94
  - **Artefact too large** → bundler raises `BundleTooLarge`; suggest
91
- splitting (`/council files:<single-file>` per section).
95
+ splitting (`/council default files:<single-file>` per section).
92
96
 
93
97
  ## See also
94
98
 
95
- - `/council` — base orchestration entry point.
99
+ - `/council default` — base orchestration entry point.
96
100
  - `/feature plan` / `/feature refactor` — where design changes get
97
101
  written, after the council surfaces issues.
98
102
  - `ai-council` skill — neutrality guidelines.
@@ -20,7 +20,7 @@ Specialised council mode for **optimization targets**: hot paths,
20
20
  slow queries, allocation profiles, or the output of an `/optimize-*`
21
21
  command (`/optimize-skills`, `/optimize-agents`,
22
22
  `/optimize-augmentignore`, `/optimize-rtk-filters`). Wraps
23
- `/council` with the `optimize` neutrality preamble, which focuses
23
+ `/council default` with the `optimize` neutrality preamble, which focuses
24
24
  members on **ranked**, **evidence-based** suggestions instead of
25
25
  generic "you should profile" advice.
26
26
 
@@ -37,19 +37,19 @@ If nothing was supplied, ask (one question per turn):
37
37
  > the report to the council
38
38
  > 4. A free-form description of the bottleneck
39
39
 
40
- Pick **1** → `/council files:<paths>` with `mode_override=optimize`.
41
- Pick **2** → `/council prompt:"<query + context>"` with
42
- `mode_override=optimize`.
40
+ Pick **1** → `/council default files:<paths>` with `--prompt-mode optimize`.
41
+ Pick **2** → `/council default prompt:"<query + context>"` with
42
+ `--prompt-mode optimize`.
43
43
  Pick **3** → run the chosen `/optimize-*` command first, then feed
44
- its report file to `/council files:<report>` with
45
- `mode_override=optimize`.
46
- Pick **4** → `/council prompt:"<description>"` with
47
- `mode_override=optimize`.
44
+ its report file to `/council default files:<report>` with
45
+ `--prompt-mode optimize`.
46
+ Pick **4** → `/council default prompt:"<description>"` with
47
+ `--prompt-mode optimize`.
48
48
 
49
49
  ### 2. Capture the constraint
50
50
 
51
51
  Optimization is meaningless without a target metric. Ask **once**
52
- (one question per turn) before invoking `/council`:
52
+ (one question per turn) before invoking `/council default`:
53
53
 
54
54
  > What does "better" mean here?
55
55
  >
@@ -63,10 +63,10 @@ Optimization is meaningless without a target metric. Ask **once**
63
63
  The chosen metric becomes the `original_ask` for the handoff preamble:
64
64
  `Optimize for <metric>: <one-line scope>`.
65
65
 
66
- ### 3. Run /council with the optimize mode preamble
66
+ ### 3. Run /council default with the optimize mode preamble
67
67
 
68
- Invoke the matching `/council` form (`files:` / `prompt:`) with
69
- `mode_override=optimize`. The `optimize` mode addendum from
68
+ Invoke the matching `/council default` form (`files:` / `prompt:`) with
69
+ `--prompt-mode optimize`. The `optimize` mode addendum from
70
70
  `scripts/ai_council/prompts.py` requires members to:
71
71
 
72
72
  - Rank suggestions by expected impact on the chosen metric, not by
@@ -78,7 +78,8 @@ Invoke the matching `/council` form (`files:` / `prompt:`) with
78
78
  - Mark at least one suggestion that requires measurement before
79
79
  committing — i.e. flag what is hypothesis vs. confirmed.
80
80
 
81
- The cost gate from `/council` Step 3 still applies.
81
+ The cost gate from `/council default` Step 3 still applies. Render via
82
+ Step 5/5a/5b of `/council default`.
82
83
 
83
84
  ### 4. Render the report
84
85
 
@@ -106,11 +107,11 @@ run benchmarks, or change configuration.
106
107
  unit, ask once for clarification; if still vague, stop. Generic
107
108
  "make it better" is exactly what this command refuses to enable.
108
109
  - **Target too large** → bundler raises `BundleTooLarge`; suggest
109
- narrowing to the hot path (`/council files:<single-file>`).
110
+ narrowing to the hot path (`/council default files:<single-file>`).
110
111
 
111
112
  ## See also
112
113
 
113
- - `/council` — base orchestration entry point.
114
+ - `/council default` — base orchestration entry point.
114
115
  - `/optimize-skills`, `/optimize-agents`, `/optimize-augmentignore`,
115
116
  `/optimize-rtk-filters` — internal optimization commands; their
116
117
  output can be fed to `/council optimize` for an external ranking.
@@ -16,7 +16,7 @@ suggestion:
16
16
 
17
17
  ## Instructions
18
18
 
19
- Specialised council mode for **GitHub PRs**. Wraps `/council diff:<base>..<head>`
19
+ Specialised council mode for **GitHub PRs**. Wraps `/council default diff:<base>..<head>`
20
20
  with a PR-aware neutrality preamble (the `pr` mode) and an opt-in
21
21
  "post a comment summary on the PR" step at the end.
22
22
 
@@ -55,26 +55,26 @@ git fetch origin <head>:<head>
55
55
  Compute the diff range as `origin/<base>..origin/<head>` (or the local
56
56
  refs if already fetched).
57
57
 
58
- ### 4. Run /council with the pr mode preamble
58
+ ### 4. Run /council default with the pr mode preamble
59
59
 
60
- Invoke `/council diff:<base>..<head>` with:
60
+ Invoke `/council default diff:<base>..<head>` with:
61
61
 
62
62
  - `original_ask` = PR title + body (capped per
63
63
  `bundler.size_guard`; warn if truncated).
64
- - The neutrality preamble uses the `pr` mode addendum from
65
- `scripts/ai_council/prompts.py` — focuses members on
66
- PR-specific risks (shipping risk, reviewer fatigue, scope creep)
67
- on top of the generic diff focus (correctness, security, tests,
68
- maintainability).
64
+ - Pass `--prompt-mode pr` so the neutrality preamble uses the `pr`
65
+ mode addendum from `scripts/ai_council/prompts.py` — focuses
66
+ members on PR-specific risks (shipping risk, reviewer fatigue,
67
+ scope creep) on top of the generic diff focus (correctness,
68
+ security, tests, maintainability).
69
69
 
70
- The cost gate from `/council` Step 3 still applies. Council is
70
+ The cost gate from `/council default` Step 3 still applies. Council is
71
71
  billable; suppress the question only when the resolved members are
72
72
  all-manual.
73
73
 
74
74
  ### 5. Render the report
75
75
 
76
76
  Use the standard stacked + Convergence/Divergence layout from
77
- `/council` Step 6. Add a one-line PR header at the top:
77
+ `/council default` Step 5/5a/5b. Add a one-line PR header at the top:
78
78
 
79
79
  ```
80
80
  ## Council on PR #<number> — <title>
@@ -116,10 +116,10 @@ comment**. It does **NOT**:
116
116
  - **PR is closed / merged** → ask whether to proceed (council on a
117
117
  closed PR is fine for retrospectives) or cancel.
118
118
  - **Diff too large** → bundler raises `BundleTooLarge`; suggest
119
- `/council files:<paths>` for a narrower review.
119
+ `/council default files:<paths>` for a narrower review.
120
120
 
121
121
  ## See also
122
122
 
123
- - `/council` — base orchestration entry point.
123
+ - `/council default` — base orchestration entry point.
124
124
  - `ai-council` skill — neutrality guidelines.
125
125
  - `/review-changes` — internal four-judge variant for local diffs.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: council
3
3
  tier: 1
4
- description: Council orchestrator — routes to default, pr, design, optimize
4
+ description: Council orchestrator — routes to default, pr, design, optimize, analysis, debate
5
5
  cluster: council
6
6
  type: orchestrator
7
7
  disable-model-invocation: true
@@ -18,6 +18,37 @@ commands with a single entry point + sub-command dispatch. Each lens
18
18
  shares the same transport, neutrality preamble, and cost gate; the
19
19
  sub-command swaps the mode-specific addendum.
20
20
 
21
+ ## Architecture — master / wrapper split
22
+
23
+ `/council default` is the **master orchestrator**. It owns the full flow:
24
+
25
+ 1. Resolve the target + capture the original ask.
26
+ 2. Check the council is configured + price table fresh.
27
+ 3. Cost confirmation (ALWAYS ASK for billable members).
28
+ 4. Run the CLI.
29
+ 5. Render the report (5 / 5a / 5b — render → critical lens → user options).
30
+ 6. Hard floor — text only.
31
+
32
+ The other three sub-commands (`pr`, `design`, `optimize`) are **wrappers**.
33
+ Each wrapper resolves its lens-specific input (PR target, design artefact,
34
+ optimization target + metric), captures a wrapper-specific `original_ask`,
35
+ then delegates to `/council default` with `mode_override=<lens>`. The
36
+ lens-specific neutrality addendums live in **one** place —
37
+ [`scripts/ai_council/prompts.py:_MODE_TABLE`](../../scripts/ai_council/prompts.py) —
38
+ and are selected by the `mode_override` value. Wrappers never re-implement
39
+ cost-gate, CLI invocation, render, or the host-verdict pass; those flow
40
+ through the master verbatim.
41
+
42
+ Invariants:
43
+
44
+ - Wrapper step numbers (`cost gate from /council default Step 3`,
45
+ `render via Step 5/5a/5b of /council default`) anchor to the master, not
46
+ the wrapper, so the master is the single source of truth for flow shape.
47
+ - A new lens = a new entry in `_MODE_TABLE` + a new wrapper file that
48
+ follows the `pr.md` / `design.md` / `optimize.md` shape. No new master.
49
+ - Behavioural changes to the orchestration (e.g. new render step) land in
50
+ `default.md` + `_MODE_TABLE`; the wrappers inherit automatically.
51
+
21
52
  ## Sub-commands
22
53
 
23
54
  | Sub-command | Routes to | Purpose |
@@ -26,9 +57,22 @@ sub-command swaps the mode-specific addendum.
26
57
  | `/council pr` | `commands/council/pr.md` | Pull a GitHub PR via `gh` and run the council on the diff with PR-specific framing |
27
58
  | `/council design` | `commands/council/design.md` | Run the council on a design doc / ADR / architecture proposal |
28
59
  | `/council optimize` | `commands/council/optimize.md` | Run the council on an optimization target — ranked, evidence-based suggestions |
60
+ | `/council analysis` | `commands/council/analysis.md` | Run the council on a local analysis output — dedup, evidence quality, roadmap-ready Top-N |
61
+ | `/council debate` | `commands/council/debate.md` | Multi-round debate with progressive cost disclosure — initial positions + rebuttals across N rounds |
29
62
 
30
63
  Sub-command names match the locked contract in
31
- [`docs/contracts/command-clusters.md`](../docs/contracts/command-clusters.md).
64
+ [`docs/contracts/command-clusters.md`](../../docs/contracts/command-clusters.md).
65
+
66
+ ## Advisor mode (replace-mode personas)
67
+
68
+ Any sub-command above can run in **advisor mode** by enabling one or
69
+ more advisors in `agents/.ai-council.yml` under `advisors:` (Contrarian,
70
+ First-Principles, Expansionist, Outsider, Executor). An enabled advisor
71
+ swaps its bound member's plain call for the same provider running the
72
+ advisor persona — **same call count, same budget**. `council:estimate`
73
+ surfaces every active swap on a dedicated line. Full contract: skills
74
+ `ai-council` § "Thinking-style advisors" and
75
+ [`docs/contracts/ai-council-config.md`](../../docs/contracts/ai-council-config.md).
32
76
 
33
77
  ## Dispatch
34
78
 
@@ -42,6 +86,8 @@ Sub-command names match the locked contract in
42
86
  > 2. pr — review a GitHub PR (read-only by default)
43
87
  > 3. design — review a design doc / ADR / architecture proposal
44
88
  > 4. optimize — ranked, evidence-based optimization advice
89
+ > 5. analysis — critique a local analysis output (project-analyze, audits)
90
+ > 6. debate — multi-round rebuttals with progressive cost disclosure
45
91
 
46
92
  ## Rules
47
93
 
@@ -0,0 +1,95 @@
1
+ ---
2
+ id: contrarian
3
+ role: Contrarian Advisor
4
+ description: "The voice that argues the strongest possible case AGAINST the proposal — to surface hidden assumptions and avoid groupthink."
5
+ tier: specialist
6
+ mode: reviewer
7
+ version: "1.0"
8
+ source: package
9
+ council_advisor: true
10
+ ---
11
+
12
+ # Contrarian Advisor
13
+
14
+ ## Focus
15
+
16
+ The proposal as written is the consensus view. This advisor's job is
17
+ the opposite view, argued as well as the consensus is. Not devil's
18
+ advocacy for sport — a real attempt to show that the obvious answer
19
+ might be the wrong one. The output succeeds when a reader cannot tell
20
+ whether the advisor secretly agrees with the proposal.
21
+
22
+ This lens is NOT responsible for finding bugs, scoring trade-offs, or
23
+ recommending implementation order. Those belong to the standard
24
+ member call. This lens generates the *strongest reasonable opposing
25
+ case* so the synthesis stage has a real disagreement to weigh, not a
26
+ straw man.
27
+
28
+ ## Mindset
29
+
30
+ - Every consensus position carries an implicit "we already considered
31
+ the alternative". Test that — usually the alternative was assumed
32
+ away, not considered.
33
+ - Survivorship bias is the default flaw of any plan: it succeeded
34
+ because the failure modes are invisible, not because they don't
35
+ exist.
36
+ - "Industry standard" and "best practice" are usually defences of a
37
+ past decision, not evidence about this one.
38
+ - The strongest argument against a proposal usually concedes its
39
+ premises and attacks the implication.
40
+
41
+ ## Unique Questions
42
+
43
+ - What is the strongest version of the argument that this proposal is
44
+ net-negative for the project, even granting every claim in it?
45
+ - Which "obvious win" in this proposal is actually a trade we would
46
+ refuse if it were stated explicitly?
47
+ - What pattern in the broader codebase / team / market suggests this
48
+ approach has been tried and rolled back before?
49
+ - Who benefits if this proposal fails, and what does their world look
50
+ like in 12 months?
51
+
52
+ ## Output Expectations
53
+
54
+ - Format: numbered list, 3–5 points. Each point is a complete argument
55
+ (premise + implication), not a one-liner.
56
+ - Severity vocabulary: `fatal-objection · structural-risk · ignored-trade`.
57
+ Use sparingly — every finding should survive the rebuttal it invites.
58
+ - Citation rule: cite a sentence from the proposal verbatim before
59
+ attacking it. No straw men.
60
+ - Length: ≤ one screen. Brevity is part of the lens — a 4-page
61
+ contrarian read becomes wallpaper.
62
+
63
+ ## Anti-Patterns
64
+
65
+ - Do NOT recycle generic objections (technical debt, complexity, cost)
66
+ — every point must trace to a specific claim in the artefact.
67
+ - Do NOT play "what if the user changes their mind" — assume the
68
+ stated requirements stand.
69
+ - Do NOT propose alternative solutions — the standard member call
70
+ does that. This lens only argues against.
71
+ - Do NOT hedge ("on the other hand", "to be fair") — the synthesis
72
+ stage hedges. The lens's value is the unhedged opposite case.
73
+
74
+ ## Critical Rules
75
+
76
+ - Every objection cites a verbatim sentence from the artefact.
77
+ - No proposal of alternatives — opposition only.
78
+ - The advisor must produce an objection even when convinced the
79
+ proposal is correct. The lens's value is the discipline of the
80
+ exercise, not the verdict.
81
+
82
+ ## Workflows
83
+
84
+ 1. Read the artefact and identify the 2–3 strongest claims.
85
+ 2. For each, construct the steel-manned opposite position.
86
+ 3. Cite the verbatim claim, then state the opposing implication.
87
+ 4. Discard any objection that requires changing the stated
88
+ requirements — those belong in a different lens.
89
+
90
+ ---
91
+
92
+ *This persona is consumed by the AI Council advisor system
93
+ (replace-mode). When activated via `agents/.ai-council.yml`'s
94
+ `advisors:` block, the entire file body below the frontmatter becomes
95
+ the system prompt for the targeted member.*