@event4u/agent-config 1.17.0 → 1.19.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 (158) hide show
  1. package/.agent-src/commands/council/default.md +74 -76
  2. package/.agent-src/commands/feature/roadmap.md +22 -0
  3. package/.agent-src/commands/roadmap/create.md +38 -6
  4. package/.agent-src/commands/roadmap/execute.md +36 -9
  5. package/.agent-src/rules/agent-authority.md +1 -0
  6. package/.agent-src/rules/agent-docs.md +1 -0
  7. package/.agent-src/rules/analysis-skill-routing.md +1 -0
  8. package/.agent-src/rules/architecture.md +1 -0
  9. package/.agent-src/rules/artifact-drafting-protocol.md +1 -0
  10. package/.agent-src/rules/artifact-engagement-recording.md +1 -0
  11. package/.agent-src/rules/ask-when-uncertain.md +1 -0
  12. package/.agent-src/rules/augment-portability.md +1 -0
  13. package/.agent-src/rules/augment-source-of-truth.md +1 -0
  14. package/.agent-src/rules/autonomous-execution.md +1 -0
  15. package/.agent-src/rules/capture-learnings.md +1 -0
  16. package/.agent-src/rules/chat-history-cadence.md +34 -0
  17. package/.agent-src/rules/chat-history-ownership.md +1 -0
  18. package/.agent-src/rules/chat-history-visibility.md +1 -0
  19. package/.agent-src/rules/cli-output-handling.md +2 -2
  20. package/.agent-src/rules/command-suggestion-policy.md +1 -0
  21. package/.agent-src/rules/commit-conventions.md +1 -0
  22. package/.agent-src/rules/commit-policy.md +1 -0
  23. package/.agent-src/rules/context-hygiene.md +28 -0
  24. package/.agent-src/rules/direct-answers.md +18 -26
  25. package/.agent-src/rules/docker-commands.md +1 -0
  26. package/.agent-src/rules/docs-sync.md +1 -0
  27. package/.agent-src/rules/downstream-changes.md +1 -0
  28. package/.agent-src/rules/e2e-testing.md +1 -0
  29. package/.agent-src/rules/guidelines.md +1 -0
  30. package/.agent-src/rules/improve-before-implement.md +1 -0
  31. package/.agent-src/rules/language-and-tone.md +1 -0
  32. package/.agent-src/rules/laravel-translations.md +1 -0
  33. package/.agent-src/rules/markdown-safe-codeblocks.md +1 -0
  34. package/.agent-src/rules/minimal-safe-diff.md +1 -0
  35. package/.agent-src/rules/missing-tool-handling.md +1 -0
  36. package/.agent-src/rules/model-recommendation.md +1 -0
  37. package/.agent-src/rules/no-cheap-questions.md +15 -21
  38. package/.agent-src/rules/no-roadmap-references.md +1 -0
  39. package/.agent-src/rules/non-destructive-by-default.md +1 -0
  40. package/.agent-src/rules/onboarding-gate.md +33 -0
  41. package/.agent-src/rules/package-ci-checks.md +1 -0
  42. package/.agent-src/rules/php-coding.md +1 -0
  43. package/.agent-src/rules/preservation-guard.md +1 -0
  44. package/.agent-src/rules/review-routing-awareness.md +1 -0
  45. package/.agent-src/rules/reviewer-awareness.md +1 -0
  46. package/.agent-src/rules/roadmap-progress-sync.md +49 -0
  47. package/.agent-src/rules/role-mode-adherence.md +2 -2
  48. package/.agent-src/rules/rule-type-governance.md +29 -0
  49. package/.agent-src/rules/runtime-safety.md +1 -0
  50. package/.agent-src/rules/scope-control.md +1 -0
  51. package/.agent-src/rules/security-sensitive-stop.md +1 -0
  52. package/.agent-src/rules/size-enforcement.md +1 -0
  53. package/.agent-src/rules/skill-improvement-trigger.md +1 -0
  54. package/.agent-src/rules/skill-quality.md +1 -0
  55. package/.agent-src/rules/slash-command-routing-policy.md +39 -0
  56. package/.agent-src/rules/think-before-action.md +1 -0
  57. package/.agent-src/rules/token-efficiency.md +1 -0
  58. package/.agent-src/rules/tool-safety.md +1 -0
  59. package/.agent-src/rules/ui-audit-gate.md +1 -0
  60. package/.agent-src/rules/upstream-proposal.md +1 -0
  61. package/.agent-src/rules/user-interaction.md +1 -0
  62. package/.agent-src/rules/verify-before-complete.md +1 -0
  63. package/.agent-src/skills/roadmap-management/SKILL.md +29 -4
  64. package/.agent-src/skills/verify-completion-evidence/SKILL.md +8 -1
  65. package/.agent-src/templates/agent-settings.md +16 -0
  66. package/.agent-src/templates/roadmaps.md +12 -3
  67. package/.agent-src/templates/scripts/work_engine/hook_bootstrap.py +9 -0
  68. package/.agent-src/templates/scripts/work_engine/hooks/__init__.py +4 -0
  69. package/.agent-src/templates/scripts/work_engine/hooks/builtin/__init__.py +4 -0
  70. package/.agent-src/templates/scripts/work_engine/hooks/builtin/decision_trace.py +163 -0
  71. package/.agent-src/templates/scripts/work_engine/hooks/builtin/memory_visibility.py +111 -0
  72. package/.agent-src/templates/scripts/work_engine/hooks/settings.py +36 -0
  73. package/.agent-src/templates/scripts/work_engine/scoring/decision_trace.py +141 -0
  74. package/.agent-src/templates/scripts/work_engine/scoring/memory_visibility.py +125 -0
  75. package/.claude-plugin/marketplace.json +1 -1
  76. package/CHANGELOG.md +97 -0
  77. package/README.md +20 -20
  78. package/config/agent-settings.template.yml +23 -0
  79. package/docs/architecture.md +1 -1
  80. package/docs/catalog.md +5 -2
  81. package/docs/contracts/adr-settings-sync-engine.md +127 -0
  82. package/docs/contracts/decision-trace-v1.md +146 -0
  83. package/docs/contracts/file-ownership-matrix.json +7 -0
  84. package/docs/contracts/hook-architecture-v1.md +213 -0
  85. package/docs/contracts/load-context-budget-model.md +80 -0
  86. package/docs/contracts/load-context-schema.md +20 -0
  87. package/docs/contracts/memory-visibility-v1.md +138 -0
  88. package/docs/contracts/one-off-script-lifecycle.md +109 -0
  89. package/docs/contracts/roadmap-complexity-standard.md +137 -0
  90. package/docs/contracts/rule-interactions.yml +22 -0
  91. package/docs/customization.md +1 -0
  92. package/docs/development.md +4 -1
  93. package/docs/guidelines/agent-infra/ask-when-uncertain-demos.md +134 -0
  94. package/docs/guidelines/agent-infra/direct-answers-demos.md +145 -0
  95. package/docs/guidelines/agent-infra/layered-settings.md +32 -13
  96. package/docs/guidelines/agent-infra/verify-before-complete-demos.md +128 -0
  97. package/package.json +1 -1
  98. package/scripts/agent-config +64 -0
  99. package/scripts/ai_council/bundler.py +3 -3
  100. package/scripts/ai_council/clients.py +24 -8
  101. package/scripts/ai_council/one_off_archive/2026-05/README.md +67 -0
  102. package/scripts/ai_council/one_off_archive/2026-05/_one_off_budget_v2_audit.py +206 -0
  103. package/scripts/ai_council/{_one_off_roundtrip.py → one_off_archive/2026-05/_one_off_roundtrip.py} +13 -8
  104. package/scripts/ai_council/one_off_archive/2026-05/_one_off_tier_retrofit.py +180 -0
  105. package/scripts/ai_council/session.py +92 -0
  106. package/scripts/build_rule_trigger_matrix.py +360 -0
  107. package/scripts/capture_showcase_session.py +361 -0
  108. package/scripts/chat_history.py +11 -1
  109. package/scripts/check_always_budget.py +46 -2
  110. package/scripts/check_one_off_location.py +81 -0
  111. package/scripts/check_references.py +6 -0
  112. package/scripts/compress.py +5 -2
  113. package/scripts/context_hygiene_hook.py +181 -0
  114. package/scripts/council_cli.py +357 -0
  115. package/scripts/hook_manifest.yaml +184 -0
  116. package/scripts/hooks/__init__.py +1 -0
  117. package/scripts/hooks/augment-context-hygiene.sh +55 -0
  118. package/scripts/hooks/augment-dispatcher.sh +72 -0
  119. package/scripts/hooks/augment-onboarding-gate.sh +55 -0
  120. package/scripts/hooks/cline-dispatcher.sh +86 -0
  121. package/scripts/hooks/cursor-dispatcher.sh +76 -0
  122. package/scripts/hooks/dispatch_hook.py +348 -0
  123. package/scripts/hooks/envelope.py +98 -0
  124. package/scripts/hooks/gemini-dispatcher.sh +117 -0
  125. package/scripts/hooks/state_io.py +122 -0
  126. package/scripts/hooks/windsurf-dispatcher.sh +123 -0
  127. package/scripts/hooks_status.py +146 -0
  128. package/scripts/install.py +728 -51
  129. package/scripts/install.sh +1 -1
  130. package/scripts/lint_examples.py +98 -0
  131. package/scripts/lint_hook_manifest.py +216 -0
  132. package/scripts/lint_one_off_age.py +184 -0
  133. package/scripts/lint_roadmap_complexity.py +127 -0
  134. package/scripts/lint_rule_tiers.py +78 -0
  135. package/scripts/lint_showcase_sessions.py +148 -0
  136. package/scripts/minimal_safe_diff_hook.py +245 -0
  137. package/scripts/onboarding_gate_hook.py +142 -0
  138. package/scripts/readme_linter.py +12 -3
  139. package/scripts/roadmap_progress_hook.py +5 -0
  140. package/scripts/schemas/rule.schema.json +5 -0
  141. package/scripts/sync_agent_settings.py +32 -129
  142. package/scripts/sync_yaml_rt.py +734 -0
  143. package/scripts/verify_before_complete_hook.py +216 -0
  144. /package/scripts/ai_council/{_one_off_2a4_acceptance.py → one_off_archive/2026-05/_one_off_2a4_acceptance.py} +0 -0
  145. /package/scripts/ai_council/{_one_off_context_layer_v1_estimate.py → one_off_archive/2026-05/_one_off_context_layer_v1_estimate.py} +0 -0
  146. /package/scripts/ai_council/{_one_off_context_layer_v1_review.py → one_off_archive/2026-05/_one_off_context_layer_v1_review.py} +0 -0
  147. /package/scripts/ai_council/{_one_off_followups_review.py → one_off_archive/2026-05/_one_off_followups_review.py} +0 -0
  148. /package/scripts/ai_council/{_one_off_nondestructive_inline_audit.py → one_off_archive/2026-05/_one_off_nondestructive_inline_audit.py} +0 -0
  149. /package/scripts/{_one_off_phase4_dispatch_latency.py → ai_council/one_off_archive/2026-05/_one_off_phase4_dispatch_latency.py} +0 -0
  150. /package/scripts/{_one_off_phase6_trigger_jaccard.py → ai_council/one_off_archive/2026-05/_one_off_phase6_trigger_jaccard.py} +0 -0
  151. /package/scripts/ai_council/{_one_off_phase_2a_budget_rebalance.py → one_off_archive/2026-05/_one_off_phase_2a_budget_rebalance.py} +0 -0
  152. /package/scripts/ai_council/{_one_off_phase_2a_post_revert.py → one_off_archive/2026-05/_one_off_phase_2a_post_revert.py} +0 -0
  153. /package/scripts/ai_council/{_one_off_rebalancing_audit.py → one_off_archive/2026-05/_one_off_rebalancing_audit.py} +0 -0
  154. /package/scripts/ai_council/{_one_off_rule_hardening_v1.py → one_off_archive/2026-05/_one_off_rule_hardening_v1.py} +0 -0
  155. /package/scripts/ai_council/{_one_off_structural_open_questions.py → one_off_archive/2026-05/_one_off_structural_open_questions.py} +0 -0
  156. /package/scripts/ai_council/{_one_off_structural_optimization.py → one_off_archive/2026-05/_one_off_structural_optimization.py} +0 -0
  157. /package/scripts/ai_council/{_one_off_structural_v3_gaps.py → one_off_archive/2026-05/_one_off_structural_v3_gaps.py} +0 -0
  158. /package/scripts/ai_council/{_one_off_structural_v3_review.py → one_off_archive/2026-05/_one_off_structural_v3_review.py} +0 -0
@@ -97,71 +97,65 @@ Council calls to billable members spend money. Even under
97
97
  `personal.autonomy: on`, the agent **must** ask before invoking any
98
98
  billable member.
99
99
 
100
- Compute `orchestrator.estimate(question, members, table)` over the
101
- **billable** subset only (`getattr(m, "billable", True)`). Manual
102
- members contribute `$0` and skip the estimate.
103
-
104
- Render the cost-confirmation numbered-options block per the
105
- `ai-council` skill (§ Pre-call estimate format) — per-member tokens
106
- + USD, projected total, budget caps, then `1. Run / 2. Cancel`. If
107
- the resolved member set is **all-manual**, skip the gate entirely
108
- (spend = $0) and proceed directly to Step 4.
109
-
110
- Wait for the user's pick. `1` proceeds; anything else aborts.
111
-
112
- ### 4. Bundle the context
113
-
114
- Use `scripts.ai_council.bundler`:
100
+ Run the CLI in **estimate** mode first it bundles the artefact, runs
101
+ redaction, and prints the per-member preview without spending:
102
+
103
+ ```bash
104
+ ./agent-config council:estimate <question-file> \
105
+ [--input-mode prompt|roadmap] \
106
+ [--max-tokens N] \
107
+ [--mode-override api|manual] \
108
+ [--original-ask "<framing sentence>"]
109
+ ```
115
110
 
116
- - `prompt` mode `bundle_prompt(text)`
117
- - `roadmap` mode `bundle_roadmap(path)`
118
- - `diff` mode `bundle_diff(base, head)`
119
- - `files` mode `bundle_files(paths)`
111
+ For `prompt:"<text>"` mode, write the text to a temp file first
112
+ (`mktemp` is fine) and pass that path. For `roadmap:<path>`, pass the
113
+ roadmap file with `--input-mode roadmap`. `diff` and `files` modes
114
+ remain Phase 4 for now ask the user to convert into a `prompt`.
120
115
 
121
- The bundler runs redaction + size guard. If `BundleTooLarge` raises,
122
- surface the byte count and ask the user to narrow scope. Do **not**
123
- truncate silently.
116
+ The CLI prints a `council:estimate · members=N (billable=M)` line
117
+ followed by per-member projected USD and a TOTAL. Render that to the
118
+ user inside the cost-confirmation numbered-options block per the
119
+ `ai-council` skill (§ Pre-call estimate format) — then `1. Run /
120
+ 2. Cancel`. If the billable count is `0`, skip the gate entirely
121
+ (spend = $0) and proceed directly to Step 4.
124
122
 
125
- Print the manifest (what was included) and the excluded list before
126
- sending — gives the user a chance to abort if scope is wrong.
123
+ Wait for the user's pick. `1` proceeds; anything else aborts.
127
124
 
128
- ### 5. Run the orchestrator
125
+ ### 4. Run the CLI
129
126
 
130
- Members are constructed from the settings file plus
131
- `load_anthropic_key()` / `load_openai_key()`. Cost budget comes from
132
- `ai_council.cost_budget`.
127
+ Once the user picks `1`, invoke the same arguments with `run` plus
128
+ `--confirm` and an output path under `agents/council-sessions/`:
133
129
 
134
- Detect project context once via
135
- `scripts.ai_council.project_context.detect_project_context()` (reads
136
- `composer.json`, `package.json`, root `README.md` — never raises;
137
- empty-fields fall back to bare neutrality preamble).
130
+ ```bash
131
+ ./agent-config council:run <question-file> \
132
+ --output agents/council-sessions/<UTC-timestamp>.json \
133
+ --confirm \
134
+ [--rounds 1|2|3] \
135
+ [--input-mode …] [--max-tokens …] [--mode-override …] \
136
+ [--original-ask "<framing sentence>"]
137
+ ```
138
138
 
139
- Call:
139
+ The CLI:
140
140
 
141
- ```python
142
- consult(
143
- members, question, budget,
144
- table=table,
145
- on_overrun=_handle_overrun,
146
- project=project,
147
- original_ask=original_ask,
148
- rounds=rounds, # 1 by default; 2-3 enables multi-round debate
149
- )
150
- ```
141
+ - bundles the artefact via `scripts.ai_council.bundler` (redaction +
142
+ size guard — `BundleTooLarge` exits 2 with the byte count),
143
+ - builds members from `.agent-settings.yml` (refusing if
144
+ `ai_council.enabled` is false or no member is wired up),
145
+ - detects project context via `detect_project_context()`,
146
+ - calls `orchestrator.consult(...)` with the `cost_budget` from
147
+ settings,
148
+ - writes the responses JSON to `--output`.
151
149
 
152
- `project` + `original_ask` flow into `handoff_preamble()` so each
153
- member receives a neutral context-handoff alongside the artefact
154
- (see `ai-council` skill § Neutrality context-handoff). Members run
155
- **sequentially**; per-member errors are normalised — one failure
156
- does not abort the others. Define `_handle_overrun(event)` per the
157
- `ai-council` skill (§ Mid-flow overrun callback) to surface the user
158
- prompt before each breaching member.
150
+ Per-member errors are normalised one failure does not abort the
151
+ others. Exit code `1` means **all** members errored; `0` means at
152
+ least one succeeded; `2` means the gate refused before any spend.
159
153
 
160
- ### 6. Render the report
154
+ ### 5. Render the report
161
155
 
162
- Use `scripts.ai_council.orchestrator.render(responses)` for the
163
- per-member sections (stacked, not side-by-side — narrow terminals).
164
- Then write the **Convergence / Divergence** section yourself:
156
+ Use `./agent-config council:render <output.json>` for the per-member
157
+ sections (stacked, not side-by-side — narrow terminals). Then write
158
+ the **Convergence / Divergence** section yourself:
165
159
 
166
160
  - **Agreements** — points all members made (or did not contradict).
167
161
  - **Disagreements** — points where members took opposing positions.
@@ -173,49 +167,53 @@ End with a numbered-options block asking the user how to proceed
173
167
  (e.g. update the roadmap, request a second round, ignore the
174
168
  critique).
175
169
 
176
- ### 7. Hard floor — text only
170
+ ### 6. Hard floor — text only
177
171
 
178
172
  `/council` produces **text**. It does **NOT**:
179
173
 
180
174
  - Edit any file in the project.
181
175
  - Open, comment on, or merge any PR.
182
176
  - Run `git` commands beyond `git diff` (read-only).
183
- - Persist API responses outside the current chat unless the user
184
- explicitly asks (Phase 4 — out of scope for v1).
185
177
 
186
- This is restated in step 7 deliberately. The neutrality framing
187
- loses meaning if the council can act on the project directly.
178
+ The CLI persists the responses JSON under `agents/council-sessions/`
179
+ for traceability, but the agent never edits other project files on
180
+ the user's behalf. The neutrality framing loses meaning if the
181
+ council can act on the project directly.
188
182
 
189
183
  ## Failure modes
190
184
 
191
- - **Member SDK not installed** → tell the user exactly which `pip
192
- install` runs (`pip install anthropic` / `pip install openai`).
193
- Do not fall back to mocks.
194
- - **Key file mode drift** → refuse and point at the install script.
185
+ - **CLI exits 2, "ai_council.enabled is false"** → tell the user how
186
+ to flip it on; do not flip it autonomously.
187
+ - **CLI exits 2, "no council member has `enabled: true`"** → list the
188
+ install commands (`./agent-config keys:install-anthropic`,
189
+ `./agent-config keys:install-openai`) and stop.
190
+ - **CLI raises `BundleTooLarge`** → surface the byte count and ask the
191
+ user to narrow scope. Do not truncate silently.
192
+ - **Member SDK not installed** → CLI prints the missing-package
193
+ message; tell the user exactly which `pip install` runs
194
+ (`pip install anthropic` / `pip install openai`). Do not fall back
195
+ to mocks.
196
+ - **Key file mode drift** → CLI refuses; point at the install script.
195
197
  The 0600 contract is non-negotiable.
196
- - **Manual mode + non-interactive stdin** → `ManualClient` reads
197
- pasted replies from stdin terminated by a line containing only
198
- `END`. If stdin is closed before any reply lands, the member
199
- returns empty text with `error="manual_aborted"`; render the
200
- partial result and ask the user.
201
- - **Invalid mode value** → `resolve_mode()` raises
202
- `InvalidModeError` with the exact settings path. Surface verbatim
203
- and stop.
204
- - **Cost budget exceeded mid-fan-out** → render the partial
205
- responses and clearly mark the unfinished members with their
206
- `cost_budget_exceeded` error. Do not silently retry.
198
+ - **Invalid mode value** → CLI surfaces `InvalidModeError` with the
199
+ exact settings path. Surface verbatim and stop.
200
+ - **Cost budget exceeded mid-fan-out** render the partial responses
201
+ and clearly mark unfinished members with `cost_budget_exceeded`. Do
202
+ not silently retry.
207
203
  - **Stale price table, refresher fails (offline)** → state the
208
204
  failure, re-offer "continue with stale table / cancel", do not
209
205
  proceed silently.
210
206
  - **`.agent-prices.md` corrupt (missing frontmatter or columns)** →
211
207
  surface the parse error, suggest deleting the file to bootstrap
212
208
  fresh from defaults; never silently fall back.
213
- - **All members error** → render the errors and ask the user
214
- whether to fix and retry, or abort.
209
+ - **All members error (CLI exit 1)** → render the errors via
210
+ `council:render` and ask the user whether to fix and retry, or
211
+ abort.
215
212
 
216
213
  ## See also
217
214
 
218
215
  - `/council` — cluster dispatcher.
219
216
  - `ai-council` skill — neutrality guidelines, anti-patterns, redaction expectations.
220
217
  - `subagent-orchestration` skill — internal multi-agent variant (no network calls).
218
+ - `scripts/council_cli.py` — the CLI entry point this command wraps.
221
219
  - `docs/customization.md` § Available settings → `ai_council.*`.
@@ -111,6 +111,28 @@ For each roadmap, work through the phases interactively:
111
111
  - Single: `agents/roadmaps/{feature-name}.md`
112
112
  - Multiple: `agents/roadmaps/{feature-name}-{aspect}.md`
113
113
 
114
+ **Collision check before writing.** For each planned filename, scan
115
+ the entire roadmap namespace — active, `archive/`, `skipped/`, and
116
+ nested subdirs:
117
+
118
+ ```bash
119
+ find agents/roadmaps -type f -iname "{feature-name}.md" 2>/dev/null
120
+ # Module-scoped:
121
+ find app/Modules/{Module}/agents/roadmaps -type f -iname "{feature-name}.md" 2>/dev/null
122
+ ```
123
+
124
+ If any planned name already exists anywhere under the namespace,
125
+ **STOP** and ask (in the user's language):
126
+
127
+ > Filename `{feature-name}.md` already exists at `<path>` (archived/skipped/active).
128
+ >
129
+ > 1. Pick a different name — suggest `{feature-name}-v2` or `{feature-name}-{scope}`
130
+ > 2. Open the existing roadmap first — revival or extension may fit
131
+ > 3. Abort
132
+
133
+ Re-run the check after a rename. Never silently overwrite, never
134
+ auto-suffix without the user's pick.
135
+
114
136
  ### 5. Link roadmaps in the feature plan
115
137
 
116
138
  Update the feature file's `## Roadmaps` section:
@@ -92,8 +92,40 @@ Show the complete roadmap to the user and ask (in their language) if anything sh
92
92
  ### 6. Save the file
93
93
 
94
94
  - Generate a filename from the title: kebab-case, e.g. `optimize-webhook-jobs.md`.
95
- - Save to the chosen location.
96
- - Show the final path.
95
+
96
+ **Before saving, check for filename collisions across the entire
97
+ roadmap namespace** — active, `archive/`, `skipped/`, and any nested
98
+ subdirs (e.g. `agent-memory/`). A new roadmap that shadows an
99
+ archived or skipped one silently buries history; never overwrite,
100
+ never auto-suffix without the user's pick.
101
+
102
+ ```bash
103
+ NAME="<kebab-case-name>.md"
104
+ # Project-root roadmaps:
105
+ find agents/roadmaps -type f -iname "$NAME" 2>/dev/null
106
+ # Module-scoped roadmaps (only if step 1 picked a module):
107
+ find app/Modules/<Module>/agents/roadmaps -type f -iname "$NAME" 2>/dev/null
108
+ ```
109
+
110
+ Use `-iname` (case-insensitive) so case-only differences still count
111
+ as a collision on case-sensitive filesystems.
112
+
113
+ If the search returns one or more hits → **STOP**. Show the matches
114
+ and ask (in the user's language):
115
+
116
+ > Found N existing roadmap(s) with this name:
117
+ > - `agents/roadmaps/archive/<file>.md` (archived)
118
+ > - `agents/roadmaps/skipped/<file>.md` (skipped)
119
+ >
120
+ > 1. Pick a different name — suggest `<name>-v2`, `<name>-<scope>`, or `<name>-<YYYY-MM>`
121
+ > 2. Open the existing file first — revival or extension may be the right move
122
+ > 3. Abort creation
123
+
124
+ - **1** → re-prompt for name, re-run the collision check, repeat until clean.
125
+ - **2** → read the existing roadmap, summarize state, hand back to the user.
126
+ - **3** → stop without writing anything.
127
+
128
+ Only when the search is empty: save to the chosen location and show the final path.
97
129
 
98
130
  ### 7. Update the progress dashboard
99
131
 
@@ -150,12 +182,12 @@ If yes → switch to the `roadmap-execute` command workflow with the newly creat
150
182
  violates [`roadmap-progress-sync`](../rules/roadmap-progress-sync.md)
151
183
  Iron Law #2.
152
184
  - **Status is binary: `ready` (default) or `draft`.** Create new
153
- roadmaps as **ready** — no `status:` field needed, ready is
154
- implicit. Only mark `status: draft` (in YAML frontmatter) when the
185
+ roadmaps as **ready** — no `status:` field needed.
186
+ Only mark `status: draft` (in YAML frontmatter) when the
155
187
  user explicitly says it should be hidden from the dashboard (still
156
188
  being authored, awaiting upstream decisions, capture-only synthesis
157
189
  without executable phases). If the user wants draft, ask once at
158
190
  step 3 — do not infer it.
159
- - **Write the roadmap in English** (per project convention for `.md` files).
160
- - Follow the roadmap template from `.augment/templates/roadmaps.md`.
191
+ - Follow the roadmap template from `.augment/templates/roadmaps.md`; write in English (project convention).
161
192
  - Keep the file focused: 500–1000 lines max. If larger, suggest splitting.
193
+ - **Never overwrite an existing roadmap.** Step 6 scans `active/`, `archive/`, `skipped/` (+ subdirs); on collision → STOP, present rename / open / abort. Auto-suffix requires explicit pick.
@@ -33,7 +33,26 @@ suggestion:
33
33
  > "Phase 2: {name} — noch nicht begonnen"
34
34
  > "Next open step: {step description}"
35
35
 
36
- ### 3. Execute step by step
36
+ ### 3. Resolve quality cadence (read once, before any step runs)
37
+
38
+ Read `roadmap.quality_cadence` from `.agent-settings.yml`:
39
+
40
+ | Value | When the project's quality pipeline runs |
41
+ |---|---|
42
+ | `end_of_roadmap` (default) | Once, in step 7 — before archiving |
43
+ | `per_phase` | Once after every completed phase, plus step 7 |
44
+ | `per_step` | After every completed step, plus step 7 (legacy verbose) |
45
+
46
+ Missing key, unreadable file, or unknown value → fall back to `end_of_roadmap`.
47
+ Cite the resolved cadence once in step 2's summary so the user can override it.
48
+
49
+ The Iron Law `verify-before-complete` still applies — fresh quality
50
+ output is mandatory before any "roadmap complete" claim, regardless of
51
+ cadence. Step checkboxes and `agents/roadmaps-progress.md` are ALWAYS
52
+ updated in the same response per `roadmap-progress-sync`; cadence only
53
+ gates the *quality pipeline*, not progress tracking.
54
+
55
+ ### 4. Execute step by step
37
56
 
38
57
  For each open step:
39
58
 
@@ -41,28 +60,35 @@ For each open step:
41
60
  2. **Analyze** the codebase to understand what's needed for this step.
42
61
  3. **Present a plan** — what files to change, what approach to take.
43
62
  4. **Ask for confirmation**: "Should I implement this step?"
44
- - If yes → implement, run quality checks, mark step as done in the roadmap file.
63
+ - If yes → implement, mark the step `[x]` in the roadmap file.
45
64
  - If no / skip → move to the next step.
46
65
  - If the user wants to stop → stop and summarize progress.
47
66
 
48
- ### 4. After each step
67
+ ### 5. After each step
49
68
 
50
- - Update the roadmap file: mark the completed step (e.g. `[x]` or add a completion note).
51
- - Run quality tools if code was changed (PHPStan at minimum).
69
+ - Update the roadmap file: mark the completed step `[x]` (or `[~]` / `[-]`).
52
70
  - Regenerate `agents/roadmaps-progress.md` — `./agent-config roadmap:progress`.
71
+ - **Quality pipeline** — run only when `quality_cadence: per_step`.
72
+ Otherwise skip and proceed.
53
73
  - Ask: "Continue with the next step?"
54
74
 
55
- ### 5. After all steps in a phase
75
+ ### 6. After all steps in a phase
56
76
 
57
77
  - Summarize what was accomplished in the phase.
78
+ - **Quality pipeline** — run when `quality_cadence: per_phase` (or `per_step`).
79
+ Skip when `end_of_roadmap`.
58
80
  - Ask: "Phase {N} complete. Continue with Phase {N+1}?"
59
81
 
60
- ### 6. When done (or stopped)
82
+ ### 7. When done (or stopped)
61
83
 
62
84
  - Summarize total progress: steps completed, steps remaining.
63
85
  - Update the roadmap file with the current status.
64
86
  - Regenerate the dashboard one last time so it matches the final state.
65
- - **If ALL steps are done** → trigger the completion & archiving workflow from the `roadmap-management` skill.
87
+ - **If ALL steps are done** → run the project's quality pipeline now
88
+ (this is the `verify-before-complete` evidence gate; required for
89
+ every cadence value, including `end_of_roadmap`). On green, trigger
90
+ the completion & archiving workflow from the `roadmap-management`
91
+ skill. On red, stop, surface the failures, do not archive.
66
92
 
67
93
  ### Rules
68
94
 
@@ -77,6 +103,7 @@ For each open step:
77
103
  to execute the listed commit steps, then proceed silently per the answer.
78
104
  - **Push, merge, branch, PR, tag** stay permission-gated by [`scope-control`](../rules/scope-control.md#git-operations--permission-gated).
79
105
  - **Always ask before implementing** a step — never auto-execute.
80
- - **Run quality checks** after each code change.
106
+ - **Quality cadence** is set by `roadmap.quality_cadence` (see step 3).
107
+ Step 7 always runs the pipeline before archival regardless of cadence.
81
108
  - If a step is unclear or too large, suggest breaking it down further.
82
109
  - If a step reveals a problem not covered in the roadmap, flag it to the user.
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  type: "always"
3
+ tier: "3"
3
4
  description: "Priority Index for the four authority rules — Hard Floor → Permission Gate → Commit Default → Trivial-vs-Blocking; read first, route to canonical rule"
4
5
  alwaysApply: true
5
6
  source: package
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  type: "auto"
3
+ tier: "2a"
3
4
  description: "Reading, creating, or updating agent documentation, module docs, roadmaps, or AGENTS.md"
4
5
  source: package
5
6
  ---
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  type: auto
3
+ tier: "3"
3
4
  description: "When choosing an analysis skill, route to the narrowest matching skill instead of defaulting to broad analysis"
4
5
  source: package
5
6
  ---
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  type: "auto"
3
+ tier: "3"
3
4
  alwaysApply: false
4
5
  description: "Architecture rules for creating new files, classes, controllers, modules, or making structural decisions about project organization"
5
6
  source: package
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  type: "auto"
3
+ tier: "2a"
3
4
  alwaysApply: false
4
5
  description: "Creating a new skill, rule, command, or guideline, or significantly rewriting one — runs a mandatory Understand → Research → Draft sequence before any artifact content is written."
5
6
  source: package
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  type: "auto"
3
+ tier: "mechanical-already"
3
4
  alwaysApply: false
4
5
  description: "After a /implement-ticket or /work phase-step (refine/memory/analyze/plan/implement/test/verify/report) or full task — emit one telemetry:record call with consulted+applied ids when enabled"
5
6
  source: package
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  type: "always"
3
+ tier: "3"
3
4
  description: "Ask when uncertain — don't guess, assume, or improvise"
4
5
  alwaysApply: true
5
6
  source: package
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  type: "auto"
3
+ tier: "mechanical-already"
3
4
  description: "Editing or creating files inside .augment/ directory — skills, rules, commands, templates, contexts must be project-agnostic"
4
5
  source: package
5
6
  load_context:
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  type: "auto"
3
+ tier: "1"
3
4
  description: "Creating, editing, or modifying files inside .agent-src/ or .augment/ — the source of truth is .agent-src.uncompressed/, never edit the generated directories directly"
4
5
  source: package
5
6
  load_context:
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  type: "auto"
3
+ tier: "3"
3
4
  description: "Deciding whether to ask the user or just act on a workflow step — trivial-vs-blocking classification, autonomy opt-in detection, commit default; defers to non-destructive-by-default for the Hard Floor"
4
5
  alwaysApply: false
5
6
  source: package
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  type: "auto"
3
+ tier: "2a"
3
4
  description: "After completing a task where a repeated mistake or successful pattern appeared — capture as rule or skill"
4
5
  alwaysApply: false
5
6
  source: package
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  type: "auto"
3
+ tier: "mechanical-already"
3
4
  description: "Appending to .agent-chat-history — cadence boundaries (per_turn/per_phase/per_tool), turn-check ownership refusal handling, never writing the file directly; cadence is the trigger, not reply length"
4
5
  alwaysApply: false
5
6
  source: package
@@ -102,6 +103,39 @@ On cloud surfaces (Claude.ai Web, Skills API) cadence is **inert** —
102
103
  no append calls, no `scripts/`, no JSONL file. Treat
103
104
  `chat_history.enabled` as `false`.
104
105
 
106
+ ## Copilot fallback
107
+
108
+ GitHub Copilot has no `SessionStart` / `PostToolUse` / `Stop` hook
109
+ surface, so `scripts/chat_history.py hook-dispatch` cannot fire
110
+ structurally. `.agent-chat-history` is not maintained for the agent
111
+ unless the agent runs the cooperative path itself.
112
+
113
+ Treat Copilot as the **CHECKPOINT path** described above — gates 1 +
114
+ 2 are cooperative:
115
+
116
+ 1. Run `turn-check` on the first turn (and after any ownership
117
+ reset) to establish ownership against the first user message.
118
+ 2. Run `append --first-user-msg "<msg>" --type <…> --json '<…>'` at
119
+ every cadence boundary, exactly as the cooperative path
120
+ specifies.
121
+ 3. Surface ownership-refusal exit `3` to the user; do not swallow it.
122
+
123
+ The state "file" the hook would have written is `.agent-chat-history`
124
+ itself (JSONL, project root). The manual command that reproduces a
125
+ single hook-dispatch step is the same one the dispatcher would
126
+ have invoked:
127
+
128
+ ```bash
129
+ scripts/chat_history.py hook-dispatch \
130
+ --platform copilot \
131
+ --event <session_start|post_tool_use|stop> \
132
+ < envelope.json
133
+ ```
134
+
135
+ — but in practice the cooperative `turn-check` + `append` calls
136
+ above are the supported Copilot path; `hook-dispatch` is mainly the
137
+ dispatcher's entry point.
138
+
105
139
  ## Interactions & references
106
140
 
107
141
  - Sibling rules: [`chat-history-ownership`](chat-history-ownership.md) (gate 1 — turn-check) · [`chat-history-visibility`](chat-history-visibility.md) (gate 3 — heartbeat marker).
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  type: "auto"
3
+ tier: "1"
3
4
  description: "First turn or reference to .agent-chat-history — detects ownership (match/returning/foreign/missing) and HOOK/ENGINE/CHECKPOINT/MANUAL path classification with numbered-options prompt"
4
5
  alwaysApply: false
5
6
  source: package
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  type: "auto"
3
+ tier: "mechanical-already"
3
4
  description: "Emitting the chat-history heartbeat marker — paste subprocess stdout verbatim or nothing, never type from memory, hybrid mode prints on drift only, slip handling per language-and-tone"
4
5
  alwaysApply: false
5
6
  source: package
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  type: "auto"
3
+ tier: "2a"
3
4
  alwaysApply: false
4
5
  description: "Running CLI commands that produce verbose output — git, tests, linters, docker, build tools, artisan, npm, composer. Wrap with rtk when installed; tail/grep is fallback."
5
6
  source: package
@@ -9,8 +10,7 @@ load_context:
9
10
 
10
11
  # Development Efficiency
11
12
 
12
- Loaded when actively working with code, tests, quality tools, CLI, or analysis.
13
- For communication and response style rules → see the always-loaded `token-efficiency` rule.
13
+ Loaded for code, tests, quality tools, CLI, analysis. Communication / response style → always-loaded `token-efficiency`.
14
14
 
15
15
  ## Iron Law — rtk first, tail/grep fallback
16
16
 
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  type: "auto"
3
+ tier: "mechanical-already"
3
4
  description: "User prompt without /command but matching an eligible slash command — surface matches as numbered options with as-is escape hatch; never auto-executes, user always picks"
4
5
  alwaysApply: false
5
6
  source: package
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  type: "auto"
3
+ tier: "2a"
3
4
  alwaysApply: false
4
5
  description: "Git commit message format, branch naming, conventional commits, committing, pushing, or creating pull requests"
5
6
  source: package
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  type: "always"
3
+ tier: "safety-floor"
3
4
  description: "Commit policy — never commit and never ask about committing unless the user said so this turn, the roadmap authorizes it, or a commit command is invoked"
4
5
  alwaysApply: true
5
6
  source: package
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  type: "auto"
3
+ tier: "1"
3
4
  alwaysApply: false
4
5
  description: "When debugging, fixing errors, or running long conversations — 3-failure stop rule, tool-loop detection, fresh-chat triggers"
5
6
  source: package
@@ -7,6 +8,12 @@ source: package
7
8
 
8
9
  # Context Hygiene
9
10
 
11
+ > **Enforced by:** [`scripts/context_hygiene_hook.py`](../../scripts/context_hygiene_hook.py)
12
+ > on Augment + Claude Code (`PostToolUse`). The hook maintains
13
+ > `agents/state/context-hygiene.json` (turn count, loop signal,
14
+ > freshness milestones at 20/40/60); the prose below is the spec the
15
+ > hook implements and the agent-side fallback.
16
+
10
17
  ## Conversation Freshness
11
18
 
12
19
  Monitor for **context decay** — long conversations degrade quality and waste tokens.
@@ -88,3 +95,24 @@ If you need an ignored skill: read its SKILL.md directly, apply guidance, then a
88
95
  > 1. Remove from ignore — relevant for this project
89
96
  > 2. Keep ignored — one-off
90
97
  ```
98
+
99
+ ## Copilot fallback
100
+
101
+ GitHub Copilot has no `PostToolUse` hook surface, so
102
+ `scripts/context_hygiene_hook.py` cannot run structurally and
103
+ `agents/state/context-hygiene.json` is not maintained automatically
104
+ (turn count, loop signal, freshness milestones at 20/40/60).
105
+
106
+ The cooperative path: track turns and tool-loop signals from memory
107
+ during the conversation and apply the suggest-a-new-chat / 3-failure
108
+ stop / loop-detection rules above. To refresh the state file
109
+ manually so the dashboard or another tool can read the latest
110
+ counters, run:
111
+
112
+ ```bash
113
+ python3 scripts/context_hygiene_hook.py < /dev/null
114
+ ```
115
+
116
+ The script reads from stdin if a JSON envelope is provided and
117
+ otherwise writes a no-op snapshot under the shared dispatcher lock.
118
+ Exit code is always 0 — hooks must never block the agent loop.