@event4u/agent-config 1.18.0 → 1.20.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 (181) hide show
  1. package/.agent-src/commands/agent-handoff.md +14 -10
  2. package/.agent-src/commands/chat-history/import.md +170 -0
  3. package/.agent-src/commands/chat-history/learn.md +178 -0
  4. package/.agent-src/commands/chat-history/show.md +17 -18
  5. package/.agent-src/commands/chat-history.md +26 -25
  6. package/.agent-src/commands/council/default.md +77 -82
  7. package/.agent-src/commands/create-pr.md +28 -8
  8. package/.agent-src/commands/feature/roadmap.md +22 -0
  9. package/.agent-src/commands/roadmap/create.md +38 -6
  10. package/.agent-src/commands/roadmap/execute.md +36 -9
  11. package/.agent-src/commands/sync-gitignore.md +1 -1
  12. package/.agent-src/contexts/communication/rules-auto/skill-quality-mechanics.md +76 -0
  13. package/.agent-src/contexts/communication/rules-auto/slash-command-routing-policy-mechanics.md +3 -3
  14. package/.agent-src/contexts/communication/rules-auto/user-interaction-mechanics.md +5 -12
  15. package/.agent-src/rules/agent-authority.md +1 -0
  16. package/.agent-src/rules/agent-docs.md +1 -0
  17. package/.agent-src/rules/analysis-skill-routing.md +1 -0
  18. package/.agent-src/rules/architecture.md +1 -0
  19. package/.agent-src/rules/artifact-drafting-protocol.md +1 -0
  20. package/.agent-src/rules/artifact-engagement-recording.md +1 -0
  21. package/.agent-src/rules/ask-when-uncertain.md +1 -0
  22. package/.agent-src/rules/augment-portability.md +1 -0
  23. package/.agent-src/rules/augment-source-of-truth.md +1 -0
  24. package/.agent-src/rules/autonomous-execution.md +1 -0
  25. package/.agent-src/rules/capture-learnings.md +1 -0
  26. package/.agent-src/rules/cli-output-handling.md +2 -2
  27. package/.agent-src/rules/command-suggestion-policy.md +1 -0
  28. package/.agent-src/rules/commit-conventions.md +1 -0
  29. package/.agent-src/rules/commit-policy.md +1 -0
  30. package/.agent-src/rules/context-hygiene.md +22 -0
  31. package/.agent-src/rules/direct-answers.md +11 -2
  32. package/.agent-src/rules/docker-commands.md +1 -0
  33. package/.agent-src/rules/docs-sync.md +1 -0
  34. package/.agent-src/rules/downstream-changes.md +1 -0
  35. package/.agent-src/rules/e2e-testing.md +1 -0
  36. package/.agent-src/rules/guidelines.md +1 -0
  37. package/.agent-src/rules/improve-before-implement.md +1 -0
  38. package/.agent-src/rules/language-and-tone.md +38 -6
  39. package/.agent-src/rules/laravel-translations.md +1 -0
  40. package/.agent-src/rules/markdown-safe-codeblocks.md +1 -0
  41. package/.agent-src/rules/minimal-safe-diff.md +1 -0
  42. package/.agent-src/rules/missing-tool-handling.md +1 -0
  43. package/.agent-src/rules/model-recommendation.md +1 -0
  44. package/.agent-src/rules/no-attribution-footers.md +48 -0
  45. package/.agent-src/rules/no-cheap-questions.md +1 -0
  46. package/.agent-src/rules/no-roadmap-references.md +2 -1
  47. package/.agent-src/rules/non-destructive-by-default.md +1 -0
  48. package/.agent-src/rules/onboarding-gate.md +26 -0
  49. package/.agent-src/rules/package-ci-checks.md +1 -0
  50. package/.agent-src/rules/php-coding.md +1 -0
  51. package/.agent-src/rules/preservation-guard.md +1 -0
  52. package/.agent-src/rules/review-routing-awareness.md +1 -0
  53. package/.agent-src/rules/reviewer-awareness.md +1 -0
  54. package/.agent-src/rules/roadmap-progress-sync.md +22 -0
  55. package/.agent-src/rules/role-mode-adherence.md +2 -2
  56. package/.agent-src/rules/rule-type-governance.md +1 -0
  57. package/.agent-src/rules/runtime-safety.md +1 -0
  58. package/.agent-src/rules/scope-control.md +1 -0
  59. package/.agent-src/rules/security-sensitive-stop.md +1 -0
  60. package/.agent-src/rules/size-enforcement.md +1 -0
  61. package/.agent-src/rules/skill-improvement-trigger.md +1 -0
  62. package/.agent-src/rules/skill-quality.md +50 -0
  63. package/.agent-src/rules/slash-command-routing-policy.md +39 -0
  64. package/.agent-src/rules/think-before-action.md +1 -0
  65. package/.agent-src/rules/token-efficiency.md +1 -0
  66. package/.agent-src/rules/tool-safety.md +1 -0
  67. package/.agent-src/rules/ui-audit-gate.md +1 -0
  68. package/.agent-src/rules/upstream-proposal.md +1 -0
  69. package/.agent-src/rules/user-interaction.md +22 -5
  70. package/.agent-src/rules/verify-before-complete.md +1 -0
  71. package/.agent-src/skills/ai-council/SKILL.md +4 -5
  72. package/.agent-src/skills/dcf-modeling/SKILL.md +89 -0
  73. package/.agent-src/skills/funnel-analysis/SKILL.md +100 -0
  74. package/.agent-src/skills/md-language-check/SKILL.md +1 -1
  75. package/.agent-src/skills/okr-tree-modeling/SKILL.md +93 -0
  76. package/.agent-src/skills/rice-prioritization/SKILL.md +100 -0
  77. package/.agent-src/skills/roadmap-management/SKILL.md +29 -4
  78. package/.agent-src/skills/subagent-orchestration/SKILL.md +34 -2
  79. package/.agent-src/skills/unit-economics-modeling/SKILL.md +104 -0
  80. package/.agent-src/skills/using-git-worktrees/SKILL.md +1 -0
  81. package/.agent-src/skills/verify-completion-evidence/SKILL.md +8 -1
  82. package/.agent-src/templates/agent-settings.md +21 -26
  83. package/.agent-src/templates/roadmaps.md +8 -3
  84. package/.agent-src/templates/scripts/work_engine/hook_bootstrap.py +16 -5
  85. package/.agent-src/templates/scripts/work_engine/hooks/__init__.py +4 -4
  86. package/.agent-src/templates/scripts/work_engine/hooks/builtin/__init__.py +4 -4
  87. package/.agent-src/templates/scripts/work_engine/hooks/builtin/_chat_history_base.py +7 -51
  88. package/.agent-src/templates/scripts/work_engine/hooks/builtin/chat_history_append.py +1 -2
  89. package/.agent-src/templates/scripts/work_engine/hooks/builtin/chat_history_halt_append.py +1 -2
  90. package/.agent-src/templates/scripts/work_engine/hooks/builtin/decision_trace.py +163 -0
  91. package/.agent-src/templates/scripts/work_engine/hooks/builtin/memory_visibility.py +110 -0
  92. package/.agent-src/templates/scripts/work_engine/hooks/settings.py +36 -0
  93. package/.agent-src/templates/scripts/work_engine/scoring/decision_trace.py +141 -0
  94. package/.agent-src/templates/scripts/work_engine/scoring/memory_visibility.py +125 -0
  95. package/.agent-src/templates/skill.md +30 -1
  96. package/.claude-plugin/marketplace.json +8 -4
  97. package/AGENTS.md +44 -3
  98. package/CHANGELOG.md +173 -0
  99. package/README.md +22 -22
  100. package/config/agent-settings.template.yml +42 -13
  101. package/config/gitignore-block.txt +4 -4
  102. package/docs/architecture.md +3 -3
  103. package/docs/catalog.md +18 -13
  104. package/docs/contracts/adr-chat-history-split.md +10 -1
  105. package/docs/contracts/adr-settings-sync-engine.md +127 -0
  106. package/docs/contracts/command-clusters.md +1 -1
  107. package/docs/contracts/cross-wing-handoff.md +133 -0
  108. package/docs/contracts/decision-trace-v1.md +146 -0
  109. package/docs/contracts/file-ownership-matrix.json +348 -126
  110. package/docs/contracts/hook-architecture-v1.md +220 -0
  111. package/docs/contracts/memory-visibility-v1.md +122 -0
  112. package/docs/contracts/one-off-script-lifecycle.md +109 -0
  113. package/docs/contracts/rule-interactions.yml +22 -0
  114. package/docs/customization.md +2 -1
  115. package/docs/development.md +4 -1
  116. package/docs/getting-started.md +21 -29
  117. package/docs/guidelines/agent-infra/ask-when-uncertain-demos.md +1 -1
  118. package/docs/guidelines/agent-infra/layered-settings.md +32 -13
  119. package/docs/hook-payload-capture.md +221 -0
  120. package/docs/migrations/commands-1.15.0.md +17 -12
  121. package/docs/skills-catalog.md +5 -4
  122. package/llms.txt +4 -3
  123. package/package.json +1 -1
  124. package/scripts/agent-config +45 -1
  125. package/scripts/ai_council/_default_prices.py +4 -4
  126. package/scripts/ai_council/bundler.py +3 -3
  127. package/scripts/ai_council/clients.py +25 -9
  128. package/scripts/ai_council/modes.py +3 -4
  129. package/scripts/ai_council/one_off_archive/2026-05/README.md +22 -0
  130. package/scripts/ai_council/one_off_archive/2026-05/_one_off_roundtrip.py +13 -8
  131. package/scripts/ai_council/one_off_archive/2026-05/_one_off_tier_retrofit.py +180 -0
  132. package/scripts/ai_council/pricing.py +10 -9
  133. package/scripts/ai_council/session.py +92 -0
  134. package/scripts/build_rule_trigger_matrix.py +1 -9
  135. package/scripts/capture_showcase_session.py +361 -0
  136. package/scripts/chat_history.py +963 -597
  137. package/scripts/check_always_budget.py +7 -2
  138. package/scripts/check_references.py +12 -2
  139. package/scripts/context_hygiene_hook.py +14 -6
  140. package/scripts/council_cli.py +407 -0
  141. package/scripts/hook_manifest.yaml +217 -0
  142. package/scripts/hooks/__init__.py +1 -0
  143. package/scripts/hooks/augment-chat-history.sh +10 -0
  144. package/scripts/hooks/augment-dispatcher.sh +72 -0
  145. package/scripts/hooks/cline-dispatcher.sh +86 -0
  146. package/scripts/hooks/cowork-dispatcher.sh +98 -0
  147. package/scripts/hooks/cursor-dispatcher.sh +76 -0
  148. package/scripts/hooks/dispatch_hook.py +383 -0
  149. package/scripts/hooks/envelope.py +98 -0
  150. package/scripts/hooks/gemini-dispatcher.sh +117 -0
  151. package/scripts/hooks/state_io.py +122 -0
  152. package/scripts/hooks/windsurf-dispatcher.sh +123 -0
  153. package/scripts/hooks_status.py +157 -0
  154. package/scripts/install-hooks.sh +2 -2
  155. package/scripts/install.py +725 -87
  156. package/scripts/install.sh +38 -1
  157. package/scripts/lint_handoffs.py +214 -0
  158. package/scripts/lint_hook_manifest.py +217 -0
  159. package/scripts/lint_one_off_age.py +184 -0
  160. package/scripts/lint_rule_tiers.py +78 -0
  161. package/scripts/lint_showcase_sessions.py +148 -0
  162. package/scripts/minimal_safe_diff_hook.py +245 -0
  163. package/scripts/onboarding_gate_hook.py +13 -8
  164. package/scripts/readme_linter.py +12 -3
  165. package/scripts/redact_hook_capture.py +148 -0
  166. package/scripts/roadmap_progress_hook.py +5 -0
  167. package/scripts/schemas/skill.schema.json +5 -0
  168. package/scripts/skill_linter.py +163 -1
  169. package/scripts/sync_agent_settings.py +32 -129
  170. package/scripts/sync_yaml_rt.py +734 -0
  171. package/scripts/update_prices.py +3 -3
  172. package/scripts/verify_before_complete_hook.py +216 -0
  173. package/.agent-src/commands/chat-history/checkpoint.md +0 -126
  174. package/.agent-src/commands/chat-history/clear.md +0 -103
  175. package/.agent-src/commands/chat-history/resume.md +0 -183
  176. package/.agent-src/rules/chat-history-cadence.md +0 -109
  177. package/.agent-src/rules/chat-history-ownership.md +0 -123
  178. package/.agent-src/rules/chat-history-visibility.md +0 -96
  179. package/.agent-src/templates/scripts/work_engine/hooks/builtin/chat_history_heartbeat.py +0 -50
  180. package/.agent-src/templates/scripts/work_engine/hooks/builtin/chat_history_turn_check.py +0 -49
  181. package/scripts/check_phase_coupling.py +0 -148
package/docs/catalog.md CHANGED
@@ -1,13 +1,13 @@
1
1
  # agent-config — Public Catalog
2
2
 
3
- Consumer-facing catalog of all **327 public artefacts** shipped by
3
+ Consumer-facing catalog of all **332 public artefacts** shipped by
4
4
  this package. Internal package-maintenance rules and deprecation shims
5
5
  are excluded.
6
6
 
7
7
  > **Regenerate:** `python3 scripts/generate_index.py`
8
8
  > Auto-generated — do not edit manually.
9
9
 
10
- ## Skills (129)
10
+ ## Skills (134)
11
11
 
12
12
  | kind | name | extra | description |
13
13
  |---|---|---|---|
@@ -39,6 +39,7 @@ are excluded.
39
39
  | skill | [`dashboard-design`](../.agent-src/skills/dashboard-design/SKILL.md) | | Use when designing monitoring dashboards — visualization selection, layout principles, observability strategies (RED/USE/Golden Signals), and data storytelling. |
40
40
  | skill | [`data-flow-mapper`](../.agent-src/skills/data-flow-mapper/SKILL.md) | | Use BEFORE editing code that touches user data — traces the value from entry → validation → transformation → storage → egress, every hop cited with file:line. |
41
41
  | skill | [`database`](../.agent-src/skills/database/SKILL.md) | | Use when working with database architecture, MariaDB/MySQL tuning, indexing strategies, slow queries, or multi-connection patterns — even when the user just says 'this query is slow'. |
42
+ | skill | [`dcf-modeling`](../.agent-src/skills/dcf-modeling/SKILL.md) | | Wing-4 valuation cognition for a CFO / finance-partner. Use when a deal, internal investment, or board ask names DCF, intrinsic value, WACC, terminal value, or 'what's it worth on a 5-year hold'. |
42
43
  | skill | [`dependency-upgrade`](../.agent-src/skills/dependency-upgrade/SKILL.md) | | Use when upgrading dependencies — "update Laravel", "bump PHP version", or "upgrade packages". Covers changelog review, breaking change detection, and verification. |
43
44
  | skill | [`description-assist`](../.agent-src/skills/description-assist/SKILL.md) | | Use when polishing a skill/rule/command/guideline frontmatter description — pushier phrasing, trigger coverage, undertrigger audit — even if the user just says 'make this pushier'. |
44
45
  | skill | [`design-review`](../.agent-src/skills/design-review/SKILL.md) | | Use when the user says "review the design", "check the UI", or wants a comprehensive UI/UX review. Uses a 7-phase methodology covering interaction, responsiveness, accessibility, and more. |
@@ -54,6 +55,7 @@ are excluded.
54
55
  | skill | [`file-editor`](../.agent-src/skills/file-editor/SKILL.md) | | Use when opening edited files in the user's IDE. Reads settings from .agent-settings.yml to determine IDE and whether auto-open is enabled. |
55
56
  | skill | [`finishing-a-development-branch`](../.agent-src/skills/finishing-a-development-branch/SKILL.md) | | Use when the feature is implementation-complete and the next step is 'ship it' — verifies, cleans up, and routes to merge/PR/park/discard — even when the user just says 'I'm done, what now?'. |
56
57
  | skill | [`flux`](../.agent-src/skills/flux/SKILL.md) | | Use when the project uses `livewire/flux` — dispatched by `directives/ui/{apply,review,polish}.py`. Covers Flux components, slots, variants, and form primitives. |
58
+ | skill | [`funnel-analysis`](../.agent-src/skills/funnel-analysis/SKILL.md) | | Use when diagnosing where a SaaS or product funnel leaks — visitor → signup → activation → paid → retained — channel-agnostic, conversion-rate-driven. |
57
59
  | skill | [`git-workflow`](../.agent-src/skills/git-workflow/SKILL.md) | | Use when working with Git — branch naming, commit messages, PR creation, rebasing, or the code review process — even when the user says 'push this' or 'merge the branch' without naming Git. |
58
60
  | skill | [`github-ci`](../.agent-src/skills/github-ci/SKILL.md) | | Use when working with GitHub Actions — workflow YAML, quality gates, test matrices, deployment triggers, reusable workflows — even when the user just says 'my CI is failing' or 'add a check'. |
59
61
  | skill | [`grafana`](../.agent-src/skills/grafana/SKILL.md) | | Use when working with Grafana — dashboards, Loki LogQL queries, alerting rules, monitoring panels — even when the user just says 'build me a dashboard' or 'query the logs' without naming Grafana. |
@@ -84,6 +86,7 @@ are excluded.
84
86
  | skill | [`migration-creator`](../.agent-src/skills/migration-creator/SKILL.md) | | Use when the user says "create migration", "add column", or "new table". Creates migrations with correct table prefixes, column naming, and multi-tenant awareness. |
85
87
  | skill | [`module-management`](../.agent-src/skills/module-management/SKILL.md) | | Use when the user says "create module", "explore module", or works within app/Modules/. Understands module structure, auto-loading, route registration, and namespace conventions. |
86
88
  | skill | [`multi-tenancy`](../.agent-src/skills/multi-tenancy/SKILL.md) | | Use when working with the multi-tenant architecture — customer DB switching, FQDN routing, tenant isolation, or cross-tenant operations. |
89
+ | skill | [`okr-tree-modeling`](../.agent-src/skills/okr-tree-modeling/SKILL.md) | | Use when decomposing a company objective into team OKRs, auditing a draft OKR tree, or stress-testing an existing one for measurability and laddering. |
87
90
  | skill | [`openapi`](../.agent-src/skills/openapi/SKILL.md) | | Use when documenting APIs — OpenAPI/Swagger, PHP attributes, Redocly validation, versioned specs — even when the user just says 'document this endpoint' without naming OpenAPI. |
88
91
  | skill | [`override-management`](../.agent-src/skills/override-management/SKILL.md) | | Creates and manages project-level overrides for shared skills, rules, and commands — extending or replacing originals from .augment/ with project-specific behavior in agents/overrides/. |
89
92
  | skill | [`performance`](../.agent-src/skills/performance/SKILL.md) | | Use when optimizing application performance — caching strategies, eager loading, query optimization, Redis patterns, or background job design. |
@@ -113,6 +116,7 @@ are excluded.
113
116
  | skill | [`refine-ticket`](../.agent-src/skills/refine-ticket/SKILL.md) | | Refine a Jira/Linear ticket before planning — 'refine ticket', 'tighten AC on PROJ-123', 'ist das Ticket klar?' — rewritten ticket, Top-5 risks, persona voices, sub-skills orchestrated, close-prompt. |
114
117
  | skill | [`requesting-code-review`](../.agent-src/skills/requesting-code-review/SKILL.md) | | Use when asking for a review or creating a PR — self-review first, frame the right context, test plan included — even when the user just says 'open a PR' or 'ready to merge'. |
115
118
  | skill | [`review-routing`](../.agent-src/skills/review-routing/SKILL.md) | | Use when preparing a PR description, suggesting reviewers, or flagging risk — produces owner-mapped roles plus historical bug-pattern matches from project-local YAML. |
119
+ | skill | [`rice-prioritization`](../.agent-src/skills/rice-prioritization/SKILL.md) | | Use when ranking competing initiatives for a roadmap, breaking a tie between two features, or auditing a backlog for hidden low-value work via Reach × Impact × Confidence ÷ Effort. |
116
120
  | skill | [`roadmap-management`](../.agent-src/skills/roadmap-management/SKILL.md) | | Use when the user says "create roadmap", "show roadmap", or "execute roadmap". Creates, reads, and manages roadmap files with phase tracking. |
117
121
  | skill | [`rtk-output-filtering`](../.agent-src/skills/rtk-output-filtering/SKILL.md) | | Use when running verbose CLI commands — wraps them with rtk (Rust Token Killer) for 60-90% token savings. Covers installation, configuration, and usage patterns. |
118
122
  | skill | [`rule-writing`](../.agent-src/skills/rule-writing/SKILL.md) | | Use when creating or editing a rule in .agent-src.uncompressed/rules/ — trigger wording, always vs auto classification, size budget — even when the user just says 'add a rule for X'. |
@@ -125,7 +129,7 @@ are excluded.
125
129
  | skill | [`skill-reviewer`](../.agent-src/skills/skill-reviewer/SKILL.md) | | Use when reviewing, auditing, or optimizing skills — validates against the 7 Skill Killers checklist and produces fix recommendations. |
126
130
  | skill | [`skill-writing`](../.agent-src/skills/skill-writing/SKILL.md) | | Use when deciding 'should this be a skill or a rule?', creating/improving/reviewing agent skills, SKILL.md frontmatter, or procedure sections — even without saying 'skill-writing'. |
127
131
  | skill | [`sql-writing`](../.agent-src/skills/sql-writing/SKILL.md) | | Use when writing raw SQL — MariaDB/MySQL syntax, parameterization, raw migrations, seeders with `DB::statement` — even when the user just pastes a query and asks 'why is this slow' without naming SQL. |
128
- | skill | [`subagent-orchestration`](../.agent-src/skills/subagent-orchestration/SKILL.md) | | Use when orchestrating implementer/judge subagents — five modes (do-and-judge, do-in-steps, do-in-parallel, do-competitively, judge-with-debate) — models from .agent-settings.yml. |
132
+ | skill | [`subagent-orchestration`](../.agent-src/skills/subagent-orchestration/SKILL.md) | | Use when orchestrating implementer/judge subagents — six modes (do-and-judge, do-in-steps, do-in-parallel, do-competitively, judge-with-debate, do-in-worktrees) — models from .agent-settings.yml. |
129
133
  | skill | [`systematic-debugging`](../.agent-src/skills/systematic-debugging/SKILL.md) | | Use when hitting a bug, test failure, crash, or unexpected behavior — enforces reproduce → isolate → hypothesize → verify before any fix — even when the user just says 'this is broken' or 'quick fix'. |
130
134
  | skill | [`technical-specification`](../.agent-src/skills/technical-specification/SKILL.md) | | Use when the user says "write a spec", "create RFC", or "document this decision". Writes technical specifications, RFCs, and ADRs with clear structure. |
131
135
  | skill | [`terraform`](../.agent-src/skills/terraform/SKILL.md) | | Use when writing Terraform — AWS modules, resources, variables, outputs, remote state — even when the user just says 'provision this infra' or 'add an S3 bucket' without naming Terraform. |
@@ -134,6 +138,7 @@ are excluded.
134
138
  | skill | [`test-performance`](../.agent-src/skills/test-performance/SKILL.md) | | Use when optimizing test suite performance — database setup, seeder optimization, parallel testing, CI pipeline efficiency, or RefreshDatabase alternatives. |
135
139
  | skill | [`threat-modeling`](../.agent-src/skills/threat-modeling/SKILL.md) | | Use when adding auth, webhooks, uploads, queues, secrets, tenant boundaries, or public endpoints — produces trust boundaries + abuse cases mapped to files, BEFORE implementation. |
136
140
  | skill | [`traefik`](../.agent-src/skills/traefik/SKILL.md) | | Use when setting up Traefik as a local reverse proxy — real domains on 127.0.0.1, trusted HTTPS via mkcert, automatic service discovery, and multi-project routing. |
141
+ | skill | [`unit-economics-modeling`](../.agent-src/skills/unit-economics-modeling/SKILL.md) | | Use when modeling CAC, LTV, gross-margin payback, or contribution margin per customer — for SaaS, marketplace, or transactional businesses. |
137
142
  | skill | [`universal-project-analysis`](../.agent-src/skills/universal-project-analysis/SKILL.md) | | ONLY when user explicitly requests: full project analysis, deep codebase audit, or comprehensive architecture review. Routes to core and framework-specific analysis skills. |
138
143
  | skill | [`upstream-contribute`](../.agent-src/skills/upstream-contribute/SKILL.md) | | Use when a learning, new skill, rule improvement, or bug fix from a consumer project should be contributed back to the shared agent-config package. |
139
144
  | skill | [`using-git-worktrees`](../.agent-src/skills/using-git-worktrees/SKILL.md) | | Use when starting parallel work in isolation from the current branch — spawn a git worktree with ignore-safety checks and a clean test baseline — even when the user says 'try this on the side'. |
@@ -141,7 +146,7 @@ are excluded.
141
146
  | skill | [`verify-completion-evidence`](../.agent-src/skills/verify-completion-evidence/SKILL.md) | | Use when claiming 'done', suggesting a commit, push, or PR — runs the evidence gate so completion claims come from fresh output in this message, not memory or earlier runs. |
142
147
  | skill | [`websocket`](../.agent-src/skills/websocket/SKILL.md) | | Use when building real-time features — WebSocket broadcasting, live updates, presence channels, connection state — even when the user just says 'push this to the client live'. |
143
148
 
144
- ## Rules (55)
149
+ ## Rules (53)
145
150
 
146
151
  | kind | name | type | description |
147
152
  |---|---|---|---|
@@ -154,9 +159,6 @@ are excluded.
154
159
  | rule | [`ask-when-uncertain`](../.agent-src/rules/ask-when-uncertain.md) | always | Ask when uncertain — don't guess, assume, or improvise |
155
160
  | rule | [`autonomous-execution`](../.agent-src/rules/autonomous-execution.md) | auto | 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 |
156
161
  | rule | [`capture-learnings`](../.agent-src/rules/capture-learnings.md) | auto | After completing a task where a repeated mistake or successful pattern appeared — capture as rule or skill |
157
- | rule | [`chat-history-cadence`](../.agent-src/rules/chat-history-cadence.md) | auto | 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 |
158
- | rule | [`chat-history-ownership`](../.agent-src/rules/chat-history-ownership.md) | auto | 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 |
159
- | rule | [`chat-history-visibility`](../.agent-src/rules/chat-history-visibility.md) | auto | 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 |
160
162
  | rule | [`cli-output-handling`](../.agent-src/rules/cli-output-handling.md) | auto | 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. |
161
163
  | rule | [`command-suggestion-policy`](../.agent-src/rules/command-suggestion-policy.md) | auto | 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 |
162
164
  | rule | [`commit-conventions`](../.agent-src/rules/commit-conventions.md) | auto | Git commit message format, branch naming, conventional commits, committing, pushing, or creating pull requests |
@@ -174,6 +176,7 @@ are excluded.
174
176
  | rule | [`minimal-safe-diff`](../.agent-src/rules/minimal-safe-diff.md) | auto | When writing or reviewing a diff — the smallest change that solves the stated problem; no drive-by edits, no opportunistic refactors, no reformatting of untouched code |
175
177
  | rule | [`missing-tool-handling`](../.agent-src/rules/missing-tool-handling.md) | auto | When a CLI tool needed for the task is not installed — ask before working around it; do NOT install silently |
176
178
  | rule | [`model-recommendation`](../.agent-src/rules/model-recommendation.md) | auto | Starting a new task, switching task type, or invoking a command — detect task complexity and recommend the optimal model (Opus/Sonnet/GPT) before any work |
179
+ | rule | [`no-attribution-footers`](../.agent-src/rules/no-attribution-footers.md) | auto | Generating PR/issue/comment/commit-message bodies — forbids unsolicited 'Generated with', 'Co-authored by', or 'Pull Request opened by' attribution footers in any user-owned artifact |
177
180
  | rule | [`no-cheap-questions`](../.agent-src/rules/no-cheap-questions.md) | always | No cheap questions — never ask what context answers, never offer Iron-Law-violating options, never stage no-trade-off choices; mode-independent (off / auto / on) |
178
181
  | rule | [`no-roadmap-references`](../.agent-src/rules/no-roadmap-references.md) | auto | Adding a link to a specific file in agents/roadmaps/ from any stable artifact (rule, skill, command, context, guideline) — roadmaps are transient; promote durable findings to agents/contexts/ instead |
179
182
  | rule | [`non-destructive-by-default`](../.agent-src/rules/non-destructive-by-default.md) | always | Agent is never destructive — Hard Floor always asks for prod-trunk merges, deploys, pushes, prod data/infra, bulk deletions, and bulk-deletion/infra commits; no autonomy or roadmap bypass |
@@ -201,7 +204,7 @@ are excluded.
201
204
  | rule | [`user-interaction`](../.agent-src/rules/user-interaction.md) | auto | Asking the user a question, presenting options, or summarizing progress — numbered-options Iron Law, single-recommendation rule, progress indicators |
202
205
  | rule | [`verify-before-complete`](../.agent-src/rules/verify-before-complete.md) | always | Verify before completion — run tests and quality tools before claiming done |
203
206
 
204
- ## Commands (95)
207
+ ## Commands (94)
205
208
 
206
209
  | kind | name | cluster | description |
207
210
  |---|---|---|---|
@@ -214,11 +217,10 @@ are excluded.
214
217
  | command | [`analyze-reference-repo`](../.agent-src/commands/analyze-reference-repo.md) | | Analyze an external reference repository (competitor, inspiration, peer) and produce a structured comparison + adoption plan for this project. |
215
218
  | command | [`bug-fix`](../.agent-src/commands/bug-fix.md) | | Plan and implement a bug fix — based on investigation, with quality checks and test verification |
216
219
  | command | [`bug-investigate`](../.agent-src/commands/bug-investigate.md) | | Investigate a bug — auto-detect ticket from branch, gather Jira/Sentry/description context, trace root cause |
217
- | command | [`chat-history:checkpoint`](../.agent-src/commands/chat-history/checkpoint.md) | cluster: chat-history | Append a phase-boundary entry to .agent-chat-history CHECKPOINT fallback for platforms without a native hook (Augment IDE, Cursor pre-1.7, Cline non-Mac/Linux). ~1s. |
218
- | command | [`chat-history:clear`](../.agent-src/commands/chat-history/clear.md) | cluster: chat-history | Manually delete the persistent chat-history log asks for confirmation, optionally archives to a timestamped backup before wiping |
219
- | command | [`chat-history:resume`](../.agent-src/commands/chat-history/resume.md) | cluster: chat-history | Load the persistent chat-history log into the current conversation — picks match/returning/foreign flow and supports resume, merge, replace, or continue |
220
+ | command | [`chat-history:import`](../.agent-src/commands/chat-history/import.md) | cluster: chat-history | Surface prior chat-history sessions as numbered options, let the user pick exactly one, then render its entries verbatim into the current chat — selective, user-driven cross-session import |
221
+ | command | [`chat-history:learn`](../.agent-src/commands/chat-history/learn.md) | cluster: chat-history | Pick a prior chat-history session and mine it for project-improving learnings runs learning-to-rule-or-skill on the picked session, drafts proposal(s) under agents/proposals/ |
220
222
  | command | [`chat-history:show`](../.agent-src/commands/chat-history/show.md) | cluster: chat-history | Show the status of the persistent chat-history log — file size, entry count, header fingerprint, age, and the last few entries |
221
- | command | [`chat-history`](../.agent-src/commands/chat-history.md) | cluster: chat-history | Chat-history orchestrator — routes to show, resume, clear, checkpoint |
223
+ | command | [`chat-history`](../.agent-src/commands/chat-history.md) | cluster: chat-history | Chat-history orchestrator — routes to show, import, learn |
222
224
  | command | [`check-current-md`](../.agent-src/commands/check-current-md.md) | | Check the open .md file (or a passed path) for German outside DE:/EN: anchor blocks — umlauts, function words, untranslated quotes. Reports and offers fixes. |
223
225
  | command | [`commit:in-chunks`](../.agent-src/commands/commit/in-chunks.md) | cluster: commit | Stage and commit all uncommitted changes in logical chunks WITHOUT confirmation — sibling of /commit for autonomous flows |
224
226
  | command | [`commit`](../.agent-src/commands/commit.md) | cluster: commit | Stage and commit all uncommitted changes — splits into logical commits following Conventional Commits |
@@ -301,14 +303,16 @@ are excluded.
301
303
  | command | [`upstream-contribute`](../.agent-src/commands/upstream-contribute.md) | | Contribute a learning, skill, rule, or fix from a consumer project back to the shared agent-config package |
302
304
  | command | [`work`](../.agent-src/commands/work.md) | | Drive a free-form prompt end-to-end through refine → score → plan → implement → test → verify → report — Option-A loop over the `work_engine` Python engine, confidence-band gated, no auto-git. |
303
305
 
304
- ## Guidelines (48)
306
+ ## Guidelines (51)
305
307
 
306
308
  | kind | name | category | description |
307
309
  |---|---|---|---|
308
310
  | guideline | [`agent-interaction-and-decision-quality`](../docs/guidelines/agent-infra/agent-interaction-and-decision-quality.md) | agent-infra | |
311
+ | guideline | [`ask-when-uncertain-demos`](../docs/guidelines/agent-infra/ask-when-uncertain-demos.md) | agent-infra | |
309
312
  | guideline | [`asking-and-brevity-examples`](../docs/guidelines/agent-infra/asking-and-brevity-examples.md) | agent-infra | |
310
313
  | guideline | [`break-glass-usage`](../docs/guidelines/agent-infra/break-glass-usage.md) | agent-infra | |
311
314
  | guideline | [`developer-judgment`](../docs/guidelines/agent-infra/developer-judgment.md) | agent-infra | |
315
+ | guideline | [`direct-answers-demos`](../docs/guidelines/agent-infra/direct-answers-demos.md) | agent-infra | |
312
316
  | guideline | [`engineering-memory-data-format`](../docs/guidelines/agent-infra/engineering-memory-data-format.md) | agent-infra | |
313
317
  | guideline | [`language-and-tone-examples`](../docs/guidelines/agent-infra/language-and-tone-examples.md) | agent-infra | |
314
318
  | guideline | [`layered-settings`](../docs/guidelines/agent-infra/layered-settings.md) | agent-infra | |
@@ -322,6 +326,7 @@ are excluded.
322
326
  | guideline | [`self-improvement-pipeline`](../docs/guidelines/agent-infra/self-improvement-pipeline.md) | agent-infra | |
323
327
  | guideline | [`size-and-scope`](../docs/guidelines/agent-infra/size-and-scope.md) | agent-infra | |
324
328
  | guideline | [`tool-integration`](../docs/guidelines/agent-infra/tool-integration.md) | agent-infra | |
329
+ | guideline | [`verify-before-complete-demos`](../docs/guidelines/agent-infra/verify-before-complete-demos.md) | agent-infra | |
325
330
  | guideline | [`readme-size-and-splitting`](../docs/guidelines/docs/readme-size-and-splitting.md) | docs | |
326
331
  | guideline | [`playwright`](../docs/guidelines/e2e/playwright.md) | e2e | |
327
332
  | guideline | [`api-design`](../docs/guidelines/php/api-design.md) | php | |
@@ -4,7 +4,16 @@ stability: beta
4
4
 
5
5
  # ADR — Chat-history rule split
6
6
 
7
- > **Status:** Decided · 2026-05-02
7
+ > **Status:** Superseded · 2026-05-04 · by
8
+ > [`agents/contexts/chat-history-platform-hooks.md`](../../agents/contexts/chat-history-platform-hooks.md).
9
+ > The cooperative three-rule split this ADR locked in
10
+ > (`chat-history-ownership` / `-cadence` / `-visibility`) has been
11
+ > reduced to a hook-only structural artifact. The three always-rules,
12
+ > the heartbeat marker, and the Foreign-Prompt handshake are gone;
13
+ > `session_start` hooks auto-adopt foreign sessions silently. The text
14
+ > below is preserved for historical context only.
15
+ >
16
+ > **Original status:** Decided · 2026-05-02
8
17
  > **Context:** AI #1, AI #3, AI #5 review of PR #29 flagged the
9
18
  > 200-line monolithic `rules/chat-history.md` as the rule the agent
10
19
  > revisited 12+ times during the 1.14.0 cycle — three independent
@@ -0,0 +1,127 @@
1
+ ---
2
+ stability: beta
3
+ ---
4
+
5
+ # ADR — Settings sync engine: stdlib-only round-trip
6
+
7
+ > **Status:** Decided · 2026-05-04
8
+ > **Context:** Additive Settings Sync roadmap — review round 2
9
+ > (Self-Review + AI Council, Anthropic + OpenAI) flagged the
10
+ > 735-line `scripts/sync_yaml_rt.py` as potential NIH burden vs.
11
+ > adopting `ruamel.yaml` as a third-party dependency.
12
+ > **Builds on:** [`docs/guidelines/agent-infra/layered-settings.md`](../guidelines/agent-infra/layered-settings.md)
13
+ > § Sync rules — defines the additive-merge-with-user-line-preservation
14
+ > contract this engine implements.
15
+
16
+ ## Decision
17
+
18
+ `.agent-settings.yml` synchronization uses a **custom, stdlib-only
19
+ round-trip parser + emitter** in [`scripts/sync_yaml_rt.py`](../../scripts/sync_yaml_rt.py),
20
+ not `ruamel.yaml` or any other third-party YAML library.
21
+
22
+ The engine implements a narrow YAML subset (block-mappings, scalars,
23
+ flow-list values, comments, CRLF/LF) that covers the full surface of
24
+ `.agent-settings.yml` plus its template (`config/agent-settings.template.yml`).
25
+ Out-of-subset YAML — anchors, aliases, multi-document streams, complex
26
+ keys, nested flow mappings — is **not supported** and raises `ValueError`.
27
+
28
+ The merge layer (additive walk, max-index insertion, scalar→section
29
+ guard, healer for legacy `_user._user.foo` corruption, EOL
30
+ normalization) sits on top of the parser and is custom regardless of
31
+ the parser choice.
32
+
33
+ ## Why this was a real question
34
+
35
+ Three options were on the table:
36
+
37
+ 1. **`ruamel.yaml` for parse + emit, custom merge on top.** Rejected.
38
+ 2. **`PyYAML` for parse, custom emitter for round-trip.** Rejected
39
+ earlier in the roadmap — PyYAML's parser drops comments and
40
+ formatting before the merger ever sees them.
41
+ 3. **Custom stdlib-only parser + emitter + merger.** Chosen.
42
+
43
+ ### Why ruamel.yaml does not match the contract
44
+
45
+ The driving requirement from `layered-settings.md` is **verbatim
46
+ user-line preservation** — every byte of every line in the user's
47
+ file is preserved unless that line carries a key the merger is
48
+ explicitly editing. Tests pin this contract by asserting byte-identity
49
+ across two consecutive sync runs (`test_user_block_round_trip_is_idempotent`,
50
+ `test_three_level_idempotent`).
51
+
52
+ `ruamel.yaml` is a round-trip-aware library, not a verbatim one — it
53
+ re-parses into an in-memory model and **re-emits** through its own
54
+ emitter. This re-emit normalizes:
55
+
56
+ | Behavior | ruamel.yaml | Custom engine |
57
+ |---|---|---|
58
+ | User-line bytes (whitespace, quoting, blanks) | re-emitted, may shift | preserved 1:1 |
59
+ | Mixed CRLF/LF in user file | normalized to one EOL (typically platform default) | detected + normalized to the user's predominant EOL |
60
+ | `personal: null` blocking template-section injection | requires custom merge logic regardless | scalar guard in `_merge_into` |
61
+ | Legacy `_user._user.foo.bar` healer (one-off migration) | requires custom logic regardless | `heal_user_block` |
62
+ | Synthetic header rendering for newly-inserted template keys | re-emits the entire file | only renders the new subtree |
63
+ | Unknown user blocks at top level | preserved as data, but indent / quoting may shift on emit | preserved verbatim |
64
+ | 3rd-party dependency in distribution package | +1 (`ruamel.yaml` + transitive `ruamel.yaml.clib`) | 0 |
65
+
66
+ The rows where the libraries diverge are exactly the rows the test
67
+ suite asserts on.
68
+
69
+ ### Cost analysis
70
+
71
+ | Axis | Custom engine | ruamel.yaml |
72
+ |---|---|---|
73
+ | Lines of code | 735 (engine) + 335 (merge/heal) = 1070 | ~400 (parser+emitter saved) + 335 (merge/heal stays) + adapter glue = ~735 |
74
+ | Net code saved | — | ~335 lines |
75
+ | 3rd-party deps | 0 | +2 (`ruamel.yaml`, `ruamel.yaml.clib`) |
76
+ | Runtime YAML surface | narrow (documented subset) | full YAML 1.2 |
77
+ | Verbatim guarantee | yes | no |
78
+ | Performance | irrelevant — cold-path, runs on profile change | irrelevant |
79
+
80
+ The 335-line saving is real but offset by a stronger contract (verbatim)
81
+ and a 0-dep posture. The package is a distribution-layer library
82
+ (`composer.json` `type: library`, `package.json` thin manifest); it
83
+ already restricts itself to stdlib for portability across consumer
84
+ projects, several of which lock Python deps tightly.
85
+
86
+ ## Consequences
87
+
88
+ - **Maintenance:** the engine must keep covering the YAML subset its
89
+ template + user files exercise. Any new template feature (e.g. a
90
+ block-style nested list) is a parser change, not a config change.
91
+ - **Error surface:** YAML outside the subset (anchors, complex keys)
92
+ surfaces as a friendly `ValueError` from `_rt.sync()`, caught by
93
+ `sync_agent_settings.main` and turned into exit code 2 with a
94
+ user-readable message. Documented in
95
+ `tests/test_sync_agent_settings.py::test_malformed_user_yaml_exits_2_with_message`.
96
+ - **Test debt:** `tests/test_sync_round_trip.py` (34 tests) and
97
+ `tests/test_sync_agent_settings.py` (15 tests) are the contract.
98
+ Any parser change must keep those green and is the entry point
99
+ for new fixtures under `tests/fixtures/sync_yaml_rt/`.
100
+
101
+ ## Revisit triggers
102
+
103
+ This decision is revisited (new ADR with successor link) when **any**
104
+ of the following holds:
105
+
106
+ 1. `.agent-settings.yml` schema gains a YAML feature outside the
107
+ supported subset (anchors, multi-doc, complex keys, nested flow
108
+ mappings) — the cost of extending the parser exceeds the cost of
109
+ adopting ruamel.
110
+ 2. The verbatim-preservation contract is relaxed (e.g. consumers
111
+ accept that sync can re-format) — the driver for the custom engine
112
+ is gone.
113
+ 3. The 0-dep posture for Python tooling is dropped at the package level
114
+ — the marginal cost of one more dep collapses.
115
+ 4. A maintenance bug surfaces in the engine that would have been
116
+ prevented by ruamel's mature spec coverage.
117
+
118
+ ## See also
119
+
120
+ - [`docs/guidelines/agent-infra/layered-settings.md`](../guidelines/agent-infra/layered-settings.md)
121
+ § Sync rules — the contract this engine implements.
122
+ - [`scripts/sync_yaml_rt.py`](../../scripts/sync_yaml_rt.py) module
123
+ docstring — the supported YAML subset, listed exhaustively.
124
+ - `tests/test_sync_round_trip.py` — verbatim, scalar-guard, healer,
125
+ CRLF, and synthetic-header pinning.
126
+ - `tests/test_sync_agent_settings.py` — CLI integration, profile
127
+ override, malformed-input exit code.
@@ -30,7 +30,7 @@ column 1 of this table.
30
30
  | `fix` | 1 | `ci` · `pr` · `pr-bots` · `pr-developers` · `portability` · `refs` · `seeder` | `fix-ci` · `fix-pr-comments` · `fix-pr-bot-comments` · `fix-pr-developer-comments` · `fix-portability` · `fix-references` · `fix-seeder` |
31
31
  | `optimize` | 1 | `agents` · `augmentignore` · `rtk` · `skills` | `optimize-agents` · `optimize-augmentignore` · `optimize-rtk-filters` · `optimize-skills` |
32
32
  | `feature` | 1 | `explore` · `plan` · `refactor` · `roadmap` · `dev` | `feature-explore` · `feature-plan` · `feature-refactor` · `feature-roadmap` · `feature-dev` |
33
- | `chat-history` | 2 | `show` · `resume` · `clear` · `checkpoint` | `chat-history` (legacy status) · `chat-history-resume` · `chat-history-clear` · `chat-history-checkpoint` |
33
+ | `chat-history` | 2 | `show` · `import` · `learn` | `chat-history` (legacy status) `resume` / `clear` / `checkpoint` removed in `road-to-chat-history-hook-only` (auto-adopt + structural hooks); `import` (verbatim cross-session render) and `learn` (project-improving learning extraction) added in the v4 stateless schema |
34
34
  | `agents` | 2 | `audit` · `cleanup` · `prepare` | `agents-audit` · `agents-cleanup` · `agents-prepare` |
35
35
  | `memory` | 2 | `add` · `load` · `promote` · `propose` | `memory-add` · `memory-full` · `memory-promote` · `propose-memory` |
36
36
  | `roadmap` | 2 | `create` · `execute` | `roadmap-create` · `roadmap-execute` |
@@ -0,0 +1,133 @@
1
+ ---
2
+ stability: beta
3
+ ---
4
+
5
+
6
+ # Cross-Wing Handoff Contract
7
+
8
+ > **Status:** active · **Stability:** beta · **Owner:** suite-closure Phase 3
9
+ > · **Lint gate:** `task lint-handoffs` (CI)
10
+
11
+ The four wings (Engineering, Product+Foundation, GTM+Growth,
12
+ Money+Strategy+Ops) compose by handing off **typed artifacts** between
13
+ senior-tier skills, not by sharing a runtime. This contract locks the
14
+ shape of those handoffs so cognition clusters do not collide and the
15
+ linter can detect drift mechanically.
16
+
17
+ ## § 1 — Purpose
18
+
19
+ Typed composition across wings prevents three failure modes:
20
+
21
+ 1. **Cognition-cluster collision** — a Wing-3 skill silently re-implements
22
+ Wing-4 reasoning (e.g. funnel-analysis ad-hoc forecasting); the
23
+ handoff makes the dependency explicit.
24
+ 2. **Tier mismatch** — a senior skill delegates to a non-senior peer,
25
+ weakening the per-wing authoring floor; the linter blocks this.
26
+ 3. **Untyped artifact drift** — caller and callee disagree on the input
27
+ shape; the contract requires the delegated skill to declare its
28
+ `## Input` block so the linter can verify call-site compatibility.
29
+
30
+ ## § 2 — Anatomy
31
+
32
+ A handoff has three named parts:
33
+
34
+ ```
35
+ initiator-skill → delegated-skill(input-shape) → output-artifact
36
+ senior-tier senior-tier declared in
37
+ in wing X in wing Y (may = X) delegated-skill's
38
+ `## Output` block
39
+ ```
40
+
41
+ - **initiator-skill** — the senior-tier skill that triggers the handoff;
42
+ declares the target in its `## Related Skills` § *WHEN NOT to use this*
43
+ routing list **or** as a `Composes` line in the procedure.
44
+ - **delegated-skill** — the senior-tier skill that owns the cognition
45
+ step being handed off; MUST declare a `## Input` block listing the
46
+ shape the initiator must pass (named fields + 1-line type hint).
47
+ - **output-artifact** — the named artifact from the delegated skill's
48
+ `## Output` block (e.g. `opportunity-tree.md`, `forecast-band.json`).
49
+
50
+ A handoff that omits any of the three parts is incomplete and the
51
+ linter rejects it.
52
+
53
+ ## § 3 — Worktree boundary
54
+
55
+ Each handoff MAY run in a fresh git worktree when invoked through
56
+ [`subagent-orchestration`](../../.agent-src.uncompressed/skills/subagent-orchestration/SKILL.md)
57
+ mode 6 (`do-in-worktrees`). Mode 6 is the state-machine layer — it
58
+ declares when worktree isolation is mandatory (multi-step cross-wing
59
+ chain, each step ≥30 min, branch state would otherwise leak between
60
+ steps) and what handoff shape each step emits / consumes. The
61
+ executor lives in
62
+ [`using-git-worktrees`](../../.agent-src.uncompressed/skills/using-git-worktrees/SKILL.md)
63
+ and
64
+ [`finishing-a-development-branch`](../../.agent-src.uncompressed/skills/finishing-a-development-branch/SKILL.md);
65
+ this contract does not duplicate that runtime.
66
+
67
+ The boundary is **advisory** for chains that do not opt into mode 6:
68
+ the handoff contract does not force isolation, but every handoff
69
+ MUST not assume shared in-process state with the initiator. Write
70
+ artifacts to disk; never pass live Python objects. Chains that opt
71
+ into mode 6 promote the boundary from advisory to mandatory for the
72
+ duration of the chain.
73
+
74
+ ## § 4 — Lint rules
75
+
76
+ `scripts/lint_handoffs.py` enforces three rules over the handoff graph
77
+ built from senior-tier skills. The graph is built from the
78
+ `**WHEN to use this**` sub-block of each skill's `## Related Skills`
79
+ section — those links are **composition (delegation) edges**. Links
80
+ under `**WHEN NOT to use this**` are **alternative pointers** (peer
81
+ cognition the user picks instead) and are NOT composition edges:
82
+ mutual `A ↔ B` "use the other instead" pointers are intentional and
83
+ MUST NOT be flagged.
84
+
85
+ | Rule | Failure code | Description | Sub-block scope |
86
+ |---|---|---|---|
87
+ | **No cycles** | `handoff_cycle` | Composition graph must be a DAG. A→B→A or longer cycles fail. | WHEN-to-use only |
88
+ | **No dangling references** | `handoff_dangling` | Every link must resolve to an existing skill file. | WHEN-to-use **and** WHEN-NOT |
89
+ | **No tier mismatch** | `handoff_tier_mismatch` | A senior skill MAY only reference other senior skills (delegate to OR offer as alternative). | WHEN-to-use **and** WHEN-NOT |
90
+
91
+ Optional rule (warning only, locked in Phase 6):
92
+
93
+ | Rule | Code | Description |
94
+ |---|---|---|
95
+ | Input shape declared | `handoff_missing_input` | Delegated skill SHOULD declare `## Input`. Warning today; error after Phase 6. |
96
+
97
+ Lint runs in CI between `task lint-skills` and `task test`. Output
98
+ mirrors `lint_skills` (`file:line:reason`).
99
+
100
+ ## § 5 — Reference chains
101
+
102
+ Three shipped chains across the suite illustrate the contract:
103
+
104
+ ### W3 launch chain — `positioning` → `messaging-architecture` → `gtm-launch`
105
+
106
+ - `positioning` (H1) owns category framing.
107
+ - `messaging-architecture` (H2) **composes** `positioning` — primary
108
+ message + supporting proofs derive from H1's point-of-view output.
109
+ - `gtm-launch` (H3) **composes** `messaging-architecture` plus
110
+ `release-comms` (unified-senior-roles Block L) — launch sequencing
111
+ reuses the messaging stack.
112
+
113
+ ### W4 / W3 forecasting chain — `forecasting` → `forecast-accuracy`
114
+
115
+ - `forecasting` (Wing-4 O2) owns construction cognition (top-down vs
116
+ bottom-up, confidence-band, retro-loop).
117
+ - O2 ships an interface-first stub (`forecast-construction-shape` ADR)
118
+ before full implementation — locks the call shape early.
119
+ - `forecast-accuracy` (Wing-3 H10) **composes** O2's interface for the
120
+ forecast-call loop. Contract drift = O2's break, not H10's.
121
+
122
+ ### W4 build-buy → org-design chain — `build-buy-partner` → `org-design`
123
+
124
+ - `build-buy-partner` (P1) owns insource-vs-outsource reasoning.
125
+ - `org-design` (Q1) **composes** `build-buy-partner` for insource-vs-
126
+ outsource shape — team-design follows the build-buy verdict.
127
+
128
+ ## See also
129
+
130
+ - `.agent-src.uncompressed/rules/skill-quality.md` § Senior-Tier
131
+ Required Structure — defines the `## Related Skills` and `## Output`
132
+ blocks the contract reads.
133
+ - `scripts/lint_handoffs.py` — mechanical enforcement.
@@ -0,0 +1,146 @@
1
+ ---
2
+ stability: beta
3
+ ---
4
+
5
+ # Decision-trace v1
6
+
7
+ **Purpose.** Pin the JSON shape that `/implement-ticket` and `/work`
8
+ runs emit when the user opts into trace surfacing. The trace is the
9
+ audit substrate for the rule-interaction matrix
10
+ ([`rule-interactions.md`](rule-interactions.md)) and feeds the
11
+ showcase-session capture pipeline
12
+ ([`outcome-baseline.md`](../../agents/contexts/outcome-baseline.md)).
13
+
14
+ **Scope.** Defines the JSON envelope written next to a `WorkState`
15
+ file when `decision_engine.surface_traces: true`. Does **not**
16
+ specify how individual rules detect their own activation — that is
17
+ the rule's own responsibility — only the shape of the report.
18
+
19
+ Last refreshed: 2026-05-04.
20
+
21
+ ## Opt-in
22
+
23
+ Off by default. Toggled in `.agent-settings.yml`:
24
+
25
+ ```yaml
26
+ decision_engine:
27
+ surface_traces: true
28
+ ```
29
+
30
+ The `/work` and `/implement-ticket` engines check this flag at phase
31
+ boundaries and emit one trace file per phase when set.
32
+
33
+ ## File location
34
+
35
+ ```
36
+ agents/state/work/<work-id>/decision-trace-<phase>.json
37
+ ```
38
+
39
+ `work-id` matches the `WorkState` directory; `phase` is one of
40
+ `refine`, `memory`, `analyze`, `plan`, `implement`, `test`, `verify`,
41
+ `report`. Files are gitignored.
42
+
43
+ ## Envelope shape
44
+
45
+ ```json
46
+ {
47
+ "schema_version": 1,
48
+ "work_id": "ABCD-1234-2026-05-04T12-34-56Z",
49
+ "phase": "implement",
50
+ "started_at": "2026-05-04T12:35:01Z",
51
+ "ended_at": "2026-05-04T12:38:42Z",
52
+ "confidence_band": "high",
53
+ "risk_class": "low",
54
+ "rules": [
55
+ {
56
+ "rule_id": "verify-before-complete",
57
+ "applied": true,
58
+ "skipped": false,
59
+ "conflicted_with": [],
60
+ "evidence_refs": ["agents/state/work/.../verify.log"]
61
+ }
62
+ ],
63
+ "memory": {
64
+ "asks": 3,
65
+ "hits": 2,
66
+ "ids": ["mem_42", "mem_57"]
67
+ },
68
+ "verify": {
69
+ "claims": 1,
70
+ "first_try_passes": 1
71
+ }
72
+ }
73
+ ```
74
+
75
+ Concerns and engines MUST treat unknown top-level keys as forward-
76
+ compat extensions and MUST NOT raise on them.
77
+
78
+ ## Field semantics
79
+
80
+ | Field | Meaning |
81
+ |---|---|
82
+ | `schema_version` | Always `1` for this contract. Major bump on breaking changes. |
83
+ | `work_id` | Stable id of the WorkState directory. Allows cross-trace correlation across phases. |
84
+ | `phase` | Engine phase that produced the trace. One of the eight phases above. |
85
+ | `confidence_band` | One of `low` / `medium` / `high`. Heuristic defined below — derived from memory hits + ambiguity flags + verify evidence count. |
86
+ | `risk_class` | One of `low` / `medium` / `high`. Per [`rule-interactions.md`](rule-interactions.md) — drives reviewer routing. |
87
+ | `rules[].rule_id` | Stable rule id, matches the filename under `.agent-src.uncompressed/rules/` minus `.md`. |
88
+ | `rules[].applied` | True if the rule's Iron Law fired and changed engine behaviour this phase. |
89
+ | `rules[].skipped` | True if the rule was checked but produced no effect (no trigger match). |
90
+ | `rules[].conflicted_with` | List of rule_ids that fired against this one. Reduction handled per `rule-interactions.md`. |
91
+ | `rules[].evidence_refs` | Optional list of paths under `agents/state/` or `tests/` that back the `applied` claim. |
92
+ | `memory.asks` | Count of `memory_retrieve` calls during the phase. |
93
+ | `memory.hits` | Count of calls that returned ≥ 1 result. |
94
+ | `memory.ids` | Stable memory entry ids returned. Bounded to ≤ 32 ids per phase; remainder dropped silently. |
95
+ | `verify.claims` | Count of "done"-class claims the engine attempted this phase. |
96
+ | `verify.first_try_passes` | Count of those claims that passed the verify gate without a re-prompt. |
97
+
98
+ ## Confidence-band heuristic
99
+
100
+ ```
101
+ high: memory.hits ≥ 2 AND verify.first_try_passes == verify.claims AND no ambiguity flag
102
+ medium: memory.hits ≥ 1 OR verify.first_try_passes ≥ 1
103
+ low: otherwise
104
+ ```
105
+
106
+ Edge case: `verify.claims == 0` is not "high" by default — it folds
107
+ into "medium" if at least one memory hit landed, "low" otherwise.
108
+
109
+ ## Risk-class heuristic
110
+
111
+ Mirrors [`file-ownership-matrix.json`](file-ownership-matrix.json):
112
+ the trace inherits the **maximum** risk class across all files the
113
+ phase touched. If no files were touched (pure planning phase), risk
114
+ is `low`.
115
+
116
+ ## Privacy floor
117
+
118
+ - `memory.ids` carries opaque ids only — no entry bodies, no secrets.
119
+ - `evidence_refs` carries paths only — no file contents.
120
+ - `rules[].rule_id` is stable id, not free-form text.
121
+
122
+ The visibility line surfaced to the user (Phase 4) consumes this file
123
+ under the same floor.
124
+
125
+ ## Stability
126
+
127
+ Beta. Breaking changes between v1 and v2 are allowed in a minor
128
+ release if the change appears in `CHANGELOG.md` under a `### Breaking`
129
+ heading. Engines MUST gate on `schema_version` and refuse unknown
130
+ majors.
131
+
132
+ ## Cross-references
133
+
134
+ - Personas (Architect, Risk-Officer) live in the package's persona
135
+ library under [`.agent-src.uncompressed/personas/`](../../.agent-src.uncompressed/personas/).
136
+ This contract does not duplicate them — when a future trace consumer
137
+ attributes a decision to one of those personas, the persona file is
138
+ the source of truth, not this envelope.
139
+ - Rule-interaction matrix:
140
+ [`rule-interactions.md`](rule-interactions.md) (machine-readable
141
+ source: [`rule-interactions.yml`](rule-interactions.yml)).
142
+ - Confidence-band heuristic is implemented in
143
+ `work_engine/scoring/decision_trace.py` and exercised by
144
+ `tests/work_engine/scoring/test_decision_trace_scoring.py`.
145
+ - Outcome metrics consume `verify.first_try_passes`:
146
+ [`outcome-baseline.md`](../../agents/contexts/outcome-baseline.md).