@event4u/agent-config 2.10.0 → 2.11.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 (82) hide show
  1. package/.agent-src/commands/agents.md +1 -0
  2. package/.agent-src/commands/challenge-me.md +1 -0
  3. package/.agent-src/commands/chat-history.md +1 -0
  4. package/.agent-src/commands/context.md +1 -0
  5. package/.agent-src/commands/council.md +1 -0
  6. package/.agent-src/commands/feature.md +1 -0
  7. package/.agent-src/commands/fix.md +1 -0
  8. package/.agent-src/commands/grill-me.md +1 -0
  9. package/.agent-src/commands/judge.md +1 -0
  10. package/.agent-src/commands/memory.md +1 -0
  11. package/.agent-src/commands/module.md +1 -0
  12. package/.agent-src/commands/onboard.md +32 -4
  13. package/.agent-src/commands/optimize.md +1 -0
  14. package/.agent-src/commands/override.md +1 -0
  15. package/.agent-src/commands/roadmap.md +1 -0
  16. package/.agent-src/commands/tests.md +1 -0
  17. package/.agent-src/skills/nextjs-patterns/SKILL.md +203 -0
  18. package/.agent-src/skills/symfony-workflow/SKILL.md +173 -0
  19. package/.agent-src/templates/scripts/work_engine/hook_bootstrap.py +4 -0
  20. package/.agent-src/templates/scripts/work_engine/hooks/builtin/__init__.py +3 -0
  21. package/.agent-src/templates/scripts/work_engine/hooks/builtin/decision_gate.py +162 -0
  22. package/.agent-src/templates/scripts/work_engine/hooks/settings.py +24 -6
  23. package/.agent-src/templates/scripts/work_engine/scoring/decision_engine.py +351 -0
  24. package/.claude-plugin/marketplace.json +3 -1
  25. package/CHANGELOG.md +37 -0
  26. package/README.md +37 -8
  27. package/config/agent-settings.template.yml +57 -0
  28. package/docs/architecture.md +1 -1
  29. package/docs/contracts/STABILITY.md +16 -0
  30. package/docs/contracts/adr-chat-history-split.md +1 -0
  31. package/docs/contracts/adr-forecast-construction-shape.md +1 -0
  32. package/docs/contracts/adr-gtm-context-spine.md +1 -0
  33. package/docs/contracts/adr-level-6-productization.md +147 -0
  34. package/docs/contracts/adr-settings-sync-engine.md +1 -0
  35. package/docs/contracts/adr-wing4-context-spine.md +1 -0
  36. package/docs/contracts/agent-memory-contract.md +1 -0
  37. package/docs/contracts/agents-md-tech-stack.md +1 -0
  38. package/docs/contracts/audit-log-v1.md +1 -0
  39. package/docs/contracts/command-clusters.md +1 -0
  40. package/docs/contracts/command-surface-tiers.md +1 -0
  41. package/docs/contracts/context-paths.md +1 -0
  42. package/docs/contracts/cost-profile-defaults.md +105 -0
  43. package/docs/contracts/cross-wing-handoff.md +1 -0
  44. package/docs/contracts/decision-engine-gates.md +115 -0
  45. package/docs/contracts/decision-trace-v1.md +1 -0
  46. package/docs/contracts/file-ownership-matrix.md +1 -0
  47. package/docs/contracts/hook-architecture-v1.md +1 -0
  48. package/docs/contracts/implement-ticket-flow.md +1 -0
  49. package/docs/contracts/installed-tools-lockfile.md +1 -0
  50. package/docs/contracts/kernel-membership.md +1 -0
  51. package/docs/contracts/linear-ai-rules-inclusion.md +1 -0
  52. package/docs/contracts/linear-ai-three-layers.md +1 -0
  53. package/docs/contracts/linter-structural-model.md +1 -0
  54. package/docs/contracts/load-context-budget-model.md +1 -0
  55. package/docs/contracts/load-context-schema.md +1 -0
  56. package/docs/contracts/memory-visibility-v1.md +1 -0
  57. package/docs/contracts/one-off-script-lifecycle.md +1 -0
  58. package/docs/contracts/orchestration-dsl-v1.md +1 -0
  59. package/docs/contracts/package-self-orientation.md +1 -0
  60. package/docs/contracts/persona-schema.md +1 -0
  61. package/docs/contracts/release-trunk-sync.md +104 -0
  62. package/docs/contracts/roadmap-complexity-standard.md +1 -0
  63. package/docs/contracts/rule-classification.md +1 -0
  64. package/docs/contracts/rule-interactions.md +26 -0
  65. package/docs/contracts/rule-priority-hierarchy.md +1 -0
  66. package/docs/contracts/rule-router.md +1 -0
  67. package/docs/contracts/settings-sync-yaml-subset.md +1 -0
  68. package/docs/contracts/skill-domains.md +1 -0
  69. package/docs/contracts/tier-3-contrib-plugin.md +1 -0
  70. package/docs/contracts/ui-stack-extension.md +1 -0
  71. package/docs/contracts/ui-track-flow.md +1 -0
  72. package/docs/customization.md +1 -1
  73. package/docs/getting-started.md +3 -1
  74. package/docs/installation.md +8 -6
  75. package/package.json +1 -1
  76. package/scripts/check_beta_review_markers.py +127 -0
  77. package/scripts/check_release_trunk_sync.py +152 -0
  78. package/scripts/install.py +3 -3
  79. package/scripts/schemas/command.schema.json +5 -0
  80. package/scripts/skill_linter.py +11 -2
  81. package/scripts/smoke_quickstart.py +134 -0
  82. package/scripts/validate_decision_engine.py +124 -0
package/README.md CHANGED
@@ -7,7 +7,7 @@ Give your AI agents an audit-disciplined orchestration contract — testing, Git
7
7
  > Your agent picks up the project's stack, runs tests, prepares PRs, fixes CI — and follows your team's coding standards while doing it. Stack-aware skill sets ship for PHP (Laravel · Symfony · Zend/Laminas), JavaScript (Next.js · React · Node), and cross-stack concerns (API · testing · security · observability).
8
8
 
9
9
  <p align="center">
10
- <strong>206 Skills</strong> · <strong>61 Rules</strong> · <strong>106 Commands</strong> · <strong>72 Guidelines</strong> · <strong>8 AI Tools</strong>
10
+ <strong>208 Skills</strong> · <strong>61 Rules</strong> · <strong>106 Commands</strong> · <strong>72 Guidelines</strong> · <strong>8 AI Tools</strong>
11
11
  </p>
12
12
 
13
13
  ---
@@ -46,6 +46,30 @@ or `.agent-src/`.
46
46
 
47
47
  ## Quickstart
48
48
 
49
+ **Three steps. Five minutes. Decision-traced first task.**
50
+
51
+ ```bash
52
+ # 1. Install (writes .agent-settings.yml, .augment/, .claude/, …)
53
+ npx @event4u/agent-config init
54
+
55
+ # 2. First-run setup (sets your name, IDE, cost profile)
56
+ # Open your AI agent (Claude Code, Cursor, …) and type:
57
+ /onboard
58
+
59
+ # 3. First real task — agent refines, plans, logs a decision_result
60
+ /work "your first real task"
61
+ ```
62
+
63
+ A `decision_result` entry lands in `agents/state/` confirming the
64
+ work-engine phases ran end-to-end. Stack-aware skills auto-load.
65
+
66
+ > Pick specific AIs, switch to global scope, deploy MCP on Cloudflare,
67
+ > or wire optional memory — see [**Detailed installation**](#detailed-installation)
68
+ > below. Contributors rebuilding the package — jump to
69
+ > [**Development**](#development).
70
+
71
+ ### Detailed installation
72
+
49
73
  Two minutes from `npx` to a better-behaved agent — no install, no
50
74
  vendored package, no postinstall hook.
51
75
 
@@ -451,12 +475,14 @@ kernel set: [`docs/contracts/kernel-membership.md`](docs/contracts/kernel-member
451
475
  | Stack | Coverage |
452
476
  |---|---|
453
477
  | Laravel · modern PHP | Skills, rules, project-analysis, quality-tool wiring (Pest · PHPStan · Rector · ECS) |
454
- | Symfony · Zend / Laminas | Project-analysis skills + shared PHP coder/quality skills |
455
- | Next.js · React · Node / Express | Project-analysis skills + UI directive set (`react-shadcn`) |
478
+ | Symfony | Workflow skill (`symfony-workflow`) + project-analysis + shared PHP coder/quality skills |
479
+ | Zend / Laminas | Project-analysis skills + shared PHP coder/quality skills |
480
+ | Next.js · App Router | Workflow skill (`nextjs-patterns`) + project-analysis + UI directive set (`react-shadcn`) |
481
+ | React · Node / Express | Project-analysis skills + UI directive set (`react-shadcn`) |
456
482
  | Vue · plain HTML | UI directive set (`vue` / `plain`) — analysis skills as they ship |
457
483
  | Cross-stack | API design · testing · security · database · Docker · Git · CI · review · threat modeling · observability |
458
484
 
459
- **Deepest reference stack today: Laravel.** Skill density covers Pest, PHPStan, Rector, Eloquent, Livewire/Flux, Horizon, Pulse, Reverb, Pennant — the stack the package was first proven on. Other stacks ship in the order they are battle-tested, not second-class. Adopting on a thin stack? Open an issue so we can prioritize the right skills for extraction.
485
+ **Deepest reference stack today: Laravel** Pest, PHPStan, Rector, Eloquent, Livewire/Flux, Horizon, Pulse, Reverb, Pennant. **Workflow-grade second tier: Symfony** (`symfony-workflow` DI, Doctrine, Messenger, voters, Twig) and **Next.js App Router** (`nextjs-patterns` — RSC boundaries, Server Actions, caching, route handlers). Other stacks ship in the order they are battle-tested, not second-class. Adopting on a thin stack? Open an issue so we can prioritize the right skills for extraction.
460
486
 
461
487
  ---
462
488
 
@@ -530,7 +556,7 @@ slash-commands) &nbsp; 📌 = informational marker only (no auto-discovery
530
556
  or manual wiring required)
531
557
 
532
558
  > **What this means in practice:** Claude Code gets the full project-scoped
533
- > package (rules + 206 skills + 106 native commands); Augment Code gets the
559
+ > package (rules + 208 skills + 106 native commands); Augment Code gets the
534
560
  > same content but only from a single global install at `~/.augment/`.
535
561
  > Cursor, Cline, Windsurf, Gemini CLI, GitHub Copilot, Roo Code, Codex CLI,
536
562
  > and Continue.dev only get the **rules** natively; skills and commands are
@@ -652,11 +678,14 @@ re-enabled or the chat ends. Full scoring contract and hardening:
652
678
 
653
679
  ## Development
654
680
 
655
- Edit in `.agent-src.uncompressed/`, compress, verify:
681
+ Working on the package itself? Edit in `.agent-src.uncompressed/`,
682
+ then regenerate compressed and projected trees:
656
683
 
657
684
  ```bash
658
- task ci # Run all CI checks
659
- task test # Run all tests
685
+ task sync # regenerate .agent-src/ and .augment/
686
+ task generate-tools # regenerate .claude/, .cursor/, .clinerules/, .windsurfrules
687
+ task ci # full pipeline — green before PR
688
+ task test # unit + integration tests
660
689
  ```
661
690
 
662
691
  → Full commands and project structure: [**docs/development.md**](docs/development.md)
@@ -418,6 +418,63 @@ hooks:
418
418
  tier1_concerns: []
419
419
  hard_fail: false
420
420
 
421
+ # --- Decision engine ---
422
+ #
423
+ # Controllable gates layered over the observability surface. Absent
424
+ # block = current behaviour (observe-only, no gates fire). Enforcement
425
+ # is strictly opt-in; the engine never silently rejects work without
426
+ # a configured gate. See docs/contracts/decision-engine-gates.md for
427
+ # the full schema, gate-conflict matrix, and non-TTY timeout protocol.
428
+ #
429
+ # Gate-conflict resolution (only the first firing gate per phase
430
+ # surfaces a reason; downstream gates are skipped):
431
+ # 1. block_on_risk (Phase=Implement, highest impact)
432
+ # 2. require_memory_hits (Phase=Refine)
433
+ # 3. min_confidence (Phase=Plan, lowest impact)
434
+ #
435
+ # Unknown keys are rejected hard by scripts/validate_decision_engine.py
436
+ # (wired into `task ci`). Removing the entire block restores observe-only.
437
+ decision_engine:
438
+ # Opt-in for DecisionTraceHook (default false). Mirrored into
439
+ # hooks.decision_trace.enabled by work_engine.hooks.settings.
440
+ surface_traces: false
441
+
442
+ # Confidence-band floor for Phase=Plan.
443
+ # off = no floor (default)
444
+ # low = refuse to advance when band is below low
445
+ # medium = refuse when below medium
446
+ # high = refuse when below high
447
+ min_confidence: off
448
+
449
+ # Risk-class ceiling for Phase=Implement.
450
+ # off = no ceiling (default)
451
+ # low = refuse when risk_class >= low (most aggressive)
452
+ # medium = refuse when risk_class >= medium
453
+ # high = refuse only when risk_class == high
454
+ block_on_risk: off
455
+
456
+ # Phase=Refine demands at least one memory hit when true (default false).
457
+ # Gated on road-to-proof-not-features.md P2 (memory-consequence trace);
458
+ # leaving this off avoids opaque rejections until the trace can explain
459
+ # which memory entry was missing.
460
+ require_memory_hits: false
461
+
462
+ # What happens when a gate fires.
463
+ # stop = halt the engine with reason on the trace (default)
464
+ # ask = prompt the user; falls back to on_block_fallback in CI
465
+ # warn = log the reason but advance
466
+ on_block: stop
467
+
468
+ # Non-TTY timeout (seconds) when on_block=ask runs without a TTY
469
+ # (CI=true env or stdin not a TTY). After the timeout, the engine
470
+ # applies on_block_fallback and surfaces block_reason=ask_timeout.
471
+ ask_timeout_seconds: 30
472
+
473
+ # Resolution after ask_timeout fires.
474
+ # stop = halt the engine (default — fail-safe)
475
+ # warn = log and advance
476
+ on_block_fallback: stop
477
+
421
478
  # --- Update check ---
422
479
  #
423
480
  # Daily background check against the npm registry for a newer
@@ -141,7 +141,7 @@ note, package-internal path-swap, description budget, and the
141
141
 
142
142
  | Layer | Count | Purpose |
143
143
  |---|---|---|
144
- | **Skills** | 206 | On-demand expertise — stack analysis (Laravel · Symfony · Zend / Laminas · Next.js · React · Node), testing, Docker, API design, security, observability, … |
144
+ | **Skills** | 208 | On-demand expertise — stack analysis (Laravel · Symfony · Zend / Laminas · Next.js · React · Node), testing, Docker, API design, security, observability, … |
145
145
  | **Rules** | 61 | Always-active constraints — coding standards, scope control, verification, language-and-tone, agent-authority |
146
146
  | **Commands** | 106 | Slash-command workflows — `/commit`, `/create-pr`, `/fix ci`, `/optimize skills`, `/feature plan`, `/work`, `/implement-ticket`, `/compress`, … |
147
147
  | **Guidelines** | 72 | Reference material cited by skills — PHP patterns, Eloquent, Playwright, agent-infra, … |
@@ -83,6 +83,22 @@ Promotion criteria:
83
83
  with the contract unchanged, or the contract has been explicitly
84
84
  frozen as part of a roadmap step.
85
85
 
86
+ ## Beta-review markers
87
+
88
+ Every `stability: beta` contract MUST carry exactly one of the
89
+ following frontmatter markers (audit-acceptance for the periodic beta
90
+ review; see `road-to-productization.md` § P5.4):
91
+
92
+ | Marker | Shape | Meaning |
93
+ |---|---|---|
94
+ | `promote-to: stable` | literal | Contract has been ≥ 30 days in beta, zero breaking changes in the last 14 days, ≥ 1 consumer reference. Schedule promotion in the next release. |
95
+ | `keep-beta-until: YYYY-MM-DD` | ISO date | API still moving or consumer count = 0. Date is the next review deadline (max 90 days from the last review). |
96
+ | `superseded-by: <contract-id>` | string | Replaced by a stable contract. Slated for deprecation, not deletion. |
97
+
98
+ The audit is repeated whenever the `keep-beta-until` date passes for
99
+ ≥ 25 % of beta contracts, or at the start of any roadmap phase that
100
+ touches the contract surface.
101
+
86
102
  ## Current contracts
87
103
 
88
104
  See the file headers themselves for current levels. The frontmatter is
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  stability: beta
3
+ keep-beta-until: 2026-08-12
3
4
  ---
4
5
 
5
6
  # ADR — Chat-history rule split
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  stability: beta
3
+ keep-beta-until: 2026-08-12
3
4
  ---
4
5
 
5
6
  # ADR — `forecast-construction-shape`: the O2 ↔ H10 interface
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  stability: beta
3
+ keep-beta-until: 2026-08-12
3
4
  ---
4
5
 
5
6
  # ADR — GTM context-spine: Wing-3 slot extension
@@ -0,0 +1,147 @@
1
+ ---
2
+ stability: stable
3
+ ---
4
+
5
+ # ADR — Level-6 Productization Closure
6
+
7
+ > **Status:** Decided · 2026-05-14
8
+ > **Context:** Closure record for `road-to-productization.md` and its
9
+ > two sibling roadmaps (`road-to-proof-not-features.md`,
10
+ > `road-to-better-skills-and-profiles.md` Block A). PR #43 lifted the
11
+ > package from Level-4 (execution engine) to Level-5 (observable
12
+ > decision system); this roadmap was the Level-5 → Level-6 jump:
13
+ > **steerable + provable + onboardable**.
14
+ > **Cross-links:**
15
+ > [`road-to-productization.md`](../../agents/roadmaps/road-to-productization.md) ·
16
+ > [`road-to-proof-not-features.md`](../../agents/roadmaps/archive/road-to-proof-not-features.md) ·
17
+ > [`road-to-better-skills-and-profiles.md`](../../agents/roadmaps/archive/road-to-better-skills-and-profiles.md).
18
+
19
+ ## What shipped
20
+
21
+ ### Decision-Engine steerability (Phase 2)
22
+
23
+ - [`decision-engine-gates.md`](decision-engine-gates.md) — additive
24
+ `decision_engine:` block in `.agent-settings.yml` with
25
+ `min_confidence`, `block_on_risk`, `require_memory_hits`, `on_block`,
26
+ `ask_timeout_seconds`, `on_block_fallback`. Absent block = unchanged
27
+ observe-only behaviour.
28
+ - Gate-conflict resolution matrix (P2.1a) + non-TTY timeout fallback
29
+ (P2.1b) shipped before the gates themselves; the engine refuses to
30
+ evaluate downstream gates after the first rejection and falls back
31
+ to `on_block_fallback` in non-interactive contexts.
32
+ - Confidence-band gate (P2.2) and risk-class gate (P2.3) wired into
33
+ the scoring path. Memory-required policy (P2.4) unblocks on P6.2
34
+ shipping (`affected` keys in the decision trace).
35
+
36
+ ### UX simplification (Phase 3)
37
+
38
+ - README "Quickstart" block — install → `/onboard` → `/work "first
39
+ real task"`, contributor detail moved below the `## For contributors`
40
+ fold.
41
+ - Default `cost_profile` flipped from `minimal` to `balanced`;
42
+ rationale in [`cost-profile-defaults.md`](cost-profile-defaults.md).
43
+ - `/onboard` step 11 prints the Quickstart command list inline.
44
+ - CI gate: `task smoke-quickstart` runs the installer into a tmpdir
45
+ and validates the documented default surface deterministically.
46
+
47
+ ### Multi-stack skill depth (Phase 4)
48
+
49
+ - `symfony-workflow` skill (~8.6 KB) — DI, Doctrine, Messenger,
50
+ voters, Twig, console.
51
+ - `nextjs-patterns` skill (~9.9 KB) — App Router, RSC boundaries,
52
+ Server Actions, caching, route handlers, 14.x↔15.x deltas.
53
+ - README stack table now separates Symfony / Next.js / Zend-Laminas
54
+ rows; "Deepest reference stack" paragraph names the workflow-grade
55
+ second tier explicitly.
56
+
57
+ ### Architecture cleanup (Phase 5)
58
+
59
+ - Auto-rules (`non-destructive-by-default`, `scope-control-policy`)
60
+ audited: already refactored to trigger + Iron Law + pointer shape;
61
+ bound by the kernel-budget linter at 4 000-char override ceiling
62
+ (P5.1).
63
+ - Rule-Interaction matrix marked rule-only by design;
64
+ [`rule-interactions.md`](rule-interactions.md) § "Out of scope —
65
+ orchestration surfaces" points at `decision-engine-gates`,
66
+ `decision-trace-v1`, `agent-memory-contract`, `memory-visibility-v1`,
67
+ and the `ai-council` skill for Council × Memory × Work-Engine
68
+ interactions (P5.2).
69
+ - `type: orchestrator` frontmatter tag exempts cluster routers from
70
+ the `command_missing_skill_references` linter check; 15 commands
71
+ carry the tag (P5.3).
72
+ - Beta-review marker protocol shipped in [`STABILITY.md`](STABILITY.md)
73
+ § Beta-review markers; `scripts/check_beta_review_markers.py` wired
74
+ into `task ci`; 39 beta contracts back-filled (P5.4).
75
+ - Test-redundancy audit produced
76
+ [`road-to-test-cleanup.md`](../../agents/roadmaps/road-to-test-cleanup.md)
77
+ — audit-only, no deletions (P5.5).
78
+
79
+ ### Release-trunk discipline (Phase 1)
80
+
81
+ - [`release-trunk-sync.md`](release-trunk-sync.md) protocol; CI gate
82
+ fails the release-prep branch when `main` is more than one tagged
83
+ release behind (P1.3).
84
+
85
+ ### Proof + cognition layers (Phases 6 + 7)
86
+
87
+ - Memory-consequence in the trace: `affected` keys in
88
+ [`decision-trace-v1.md`](decision-trace-v1.md) (sibling P2.1a–c).
89
+ - README three-audience split (sibling P2.2a–c).
90
+ - Hook doctor (sibling P2.3).
91
+ - Persona spine: Core-tier 5-section + Specialist-tier 7-section
92
+ spines locked in [`persona-schema.md`](persona-schema.md) (sibling
93
+ Block A).
94
+
95
+ ## What got cancelled
96
+
97
+ - **P6.1 — Three real showcase sessions** (sibling P1.1–P1.4).
98
+ Cancelled upstream — capturing real host-agent sessions requires a
99
+ hosted-LLM runner that is out of scope for this roadmap. P1.0
100
+ pre-flight shipped; the capture surface is ready when a runner
101
+ exists. Reopen as `road-to-showcase-capture.md` once a runner is
102
+ on the table.
103
+ - **P8.1 — End-to-end Level-6 smoke** — same gating as P6.1.
104
+ Structural coverage (`task smoke-quickstart` + decision-engine
105
+ schema validator + gate-evaluator unit tests) covers the
106
+ configuration surface deterministically; the live smoke remains
107
+ the manual pre-tag gate.
108
+
109
+ ## What stayed beta
110
+
111
+ 39 contracts carry `keep-beta-until: 2026-08-12` (next audit
112
+ deadline). None met the 30-day promotion floor at audit time.
113
+ First-commit age range: 0–12 days. Audit cap is 90 days from the
114
+ audit date; CI rejects undated betas, multiple markers, and
115
+ keep-beta-until dates beyond the window.
116
+
117
+ ## What got deferred to siblings
118
+
119
+ - **Showcase capture** → future `road-to-showcase-capture.md` when a
120
+ hosted-LLM runner is on the table.
121
+ - **Test-suite deletion** →
122
+ [`road-to-test-cleanup.md`](../../agents/roadmaps/road-to-test-cleanup.md)
123
+ (audit-only sibling spawned by P5.5; non-destructive by default).
124
+ - **Persona Block B** (Architect / Risk-Officer extension) —
125
+ anti-recommended per the sibling closure decision; not deferred,
126
+ closed.
127
+ - **Distribution / adoption** →
128
+ `road-to-distribution-and-adoption.md`, gated on this roadmap
129
+ closing (which this ADR records).
130
+ - **MCP server work** — own strand, out of scope.
131
+
132
+ ## Consequences
133
+
134
+ - **Steerable:** the Decision Engine now gates on configurable
135
+ thresholds; the configuration surface is documented and CI-tested.
136
+ - **Provable:** memory hits/misses surface as `affected` keys in the
137
+ decision trace; the trace shape is contract-stable.
138
+ - **Onboardable:** a fresh user can land at a working `/work`
139
+ invocation in three Quickstart steps without scrolling past the
140
+ fold.
141
+ - **Multi-stack credible:** Laravel stays the deepest reference;
142
+ Symfony and Next.js shipped at workflow-grade depth; other stacks
143
+ remain project-analysis-only with the honest delta language in the
144
+ README.
145
+ - **Architecturally tidy:** orchestrator commands no longer warn,
146
+ beta contracts cannot rot undated, and the contract surface itself
147
+ carries a periodic review obligation.
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  stability: beta
3
+ keep-beta-until: 2026-08-12
3
4
  ---
4
5
 
5
6
  # ADR — Settings sync engine: stdlib-only round-trip
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  stability: beta
3
+ keep-beta-until: 2026-08-12
3
4
  ---
4
5
 
5
6
  # ADR — Wing-4 context-spine: Money / Strategy / Ops slot extension
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  stability: beta
3
+ keep-beta-until: 2026-08-12
3
4
  ---
4
5
 
5
6
  # Agent-Memory Contract (as expected by `agent-config`)
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  stability: beta
3
+ keep-beta-until: 2026-08-12
3
4
  ---
4
5
 
5
6
  # Tech stack — deep detail
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  stability: beta
3
+ keep-beta-until: 2026-08-12
3
4
  ---
4
5
 
5
6
  # Audit-log v1
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  stability: beta
3
+ keep-beta-until: 2026-08-12
3
4
  ---
4
5
 
5
6
  # Command-cluster contract
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  stability: beta
3
+ keep-beta-until: 2026-08-12
3
4
  ---
4
5
 
5
6
 
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  stability: beta
3
+ keep-beta-until: 2026-08-12
3
4
  ---
4
5
 
5
6
  # Context-file path conventions
@@ -0,0 +1,105 @@
1
+ # Cost-Profile Defaults — Contract
2
+
3
+ > **Status:** beta · **Owner:** package maintainer · **Last reviewed:** 2026-05-14
4
+ >
5
+ > Normative contract for the **default `cost_profile`** new installs receive.
6
+ > Profile semantics themselves are documented in
7
+ > [`docs/customization.md` § cost_profile](../customization.md) and
8
+ > [`docs/contracts/rule-router.md`](rule-router.md); this file owns only the
9
+ > **default-selection decision** and the rationale behind it.
10
+
11
+ ## Decision
12
+
13
+ ```
14
+ DEFAULT_PROFILE = "balanced"
15
+ ```
16
+
17
+ `scripts/install.py` and `npx @event4u/agent-config init` write
18
+ `cost_profile: balanced` into `.agent-settings.yml` for fresh installs
19
+ unless the user passes `--profile=minimal` or `--profile=full`.
20
+
21
+ ## Profile table
22
+
23
+ | Profile | Contents | Token footprint | Use when |
24
+ |---|---|---|---|
25
+ | `minimal` | Kernel only (9 always-loaded Iron-Law rules, ≤ 26 k chars) | Lowest | Token-constrained agents (small context windows, free-tier models) or projects that opt out of routing |
26
+ | **`balanced`** *(default)* | Kernel + tier-1 auto-rules (workflow + safety floor) | Medium | Every productized install — the documented "current behaviour superset" |
27
+ | `full` | Kernel + tier-1 + tier-2 (every rule, every guideline-cited skill) | Highest | Teams running large-context models (Opus 4, GPT-5) that want maximum guardrail coverage |
28
+ | `custom` | Ignore profile; every matrix value set explicitly | Variable | Power users tuning per-rule load decisions |
29
+
30
+ ## Why `balanced`, not `minimal`
31
+
32
+ The kernel-only `minimal` profile predates the tier-1 router. It was the
33
+ correct default while tier-1 was experimental, but four signals now point
34
+ at `balanced`:
35
+
36
+ 1. **Documented intent already says so.** Both
37
+ `config/agent-settings.template.yml` (the source the installer projects
38
+ from) and `docs/customization.md` describe `balanced` as
39
+ "default — current behaviour superset". The code default of `minimal`
40
+ was a drift artifact, not a deliberate stance.
41
+ 2. **Productization (Level-6) demands sensible-default-out-of-the-box.**
42
+ A fresh `npx init` followed immediately by `/work` should engage the
43
+ full workflow guardrail set — `developer-like-execution`,
44
+ `verify-before-complete`, `minimal-safe-diff`, `scope-control`.
45
+ These live in tier-1, not the kernel. With `minimal`, the
46
+ work-engine runs unanchored against most quality guardrails.
47
+ 3. **Decision-engine gates assume tier-1 is present.** The P2.x gates
48
+ (`min_confidence`, `block_on_risk`, `require_memory_hits`) are
49
+ harmless under `minimal` but only reach their documented behaviour
50
+ under `balanced` and above — because the confidence model and
51
+ risk-classification rules they read live in tier-1.
52
+ 4. **Opt-out is cheap, opt-in is invisible.** A team that wants the
53
+ `minimal` floor flips one YAML value. A team that doesn't know
54
+ tier-1 exists never finds it. The default should err toward
55
+ guardrail coverage.
56
+
57
+ ## Opt-out path
58
+
59
+ Token-budget pressure → flip in `.agent-settings.yml`:
60
+
61
+ ```yaml
62
+ cost_profile: minimal
63
+ ```
64
+
65
+ …or pass `--profile=minimal` to `npx @event4u/agent-config init`.
66
+ No migration is required: removing tier-1 rules from a session has no
67
+ state-machine impact because the kernel carries the Iron-Law floor.
68
+
69
+ ## Drift detection
70
+
71
+ CI must keep three surfaces in sync:
72
+
73
+ - `scripts/install.py` — `DEFAULT_PROFILE` constant.
74
+ - `config/agent-settings.template.yml` — comment block on the
75
+ `cost_profile:` key.
76
+ - `docs/customization.md` — cost-profile table default column.
77
+
78
+ Reviewer guidance: a PR that changes any one of these must touch the
79
+ other two **plus** this file's `Last reviewed:` field. The
80
+ `docs-sync` rule enforces the cross-reference check; a missing update
81
+ trips it.
82
+
83
+ ## Re-review schedule
84
+
85
+ `re-review: 2026-11-14` (six months out). Triggers for earlier
86
+ re-review:
87
+
88
+ - Tier-1 rule count drops below 5 (the router would carry too little
89
+ to justify the load cost).
90
+ - Median `npx init` token cost grows past 40 k for a fresh agent
91
+ session (then re-evaluate `minimal` as the default).
92
+ - A consumer-project tally shows ≥ 80 % of installs override the
93
+ default within seven days (the default is wrong for the population).
94
+
95
+ ## Non-goals
96
+
97
+ - This contract does **not** dictate what tier-1 contains. That belongs
98
+ to [`rule-router.md`](rule-router.md) and the `kernel-membership.md`
99
+ contract.
100
+ - It does **not** add a fourth profile. `custom` covers the
101
+ per-tenant-tuning case; no new tier needed.
102
+ - It does **not** auto-migrate existing installs. Projects already
103
+ pinned to `minimal` keep `minimal` until a developer edits the file
104
+ or runs `npx @event4u/agent-config migrate` (which preserves
105
+ user-set values per [`migration/v1-to-v2.md`](../migration/v1-to-v2.md)).
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  stability: beta
3
+ keep-beta-until: 2026-08-12
3
4
  ---
4
5
 
5
6
 
@@ -0,0 +1,115 @@
1
+ # Decision-engine gates (v1)
2
+
3
+ **Status:** beta — landed 2026-05-14 via `road-to-productization.md` Phase 2.
4
+ **Owners:** `work_engine` maintainers.
5
+ **Scope:** the optional `decision_engine:` block in `.agent-settings.yml`.
6
+
7
+ ## Purpose
8
+
9
+ Cross the package from **observable** (Level-5) to **controllable**
10
+ (Level-6). The engine has scored confidence-bands, risk-classes, and
11
+ memory-hits since Phase 4 of `road-to-decision-trace`; this contract
12
+ turns those signals into refusal gates the user opts into.
13
+
14
+ Absent block = unchanged behaviour. Enforcement is opt-in only; the
15
+ engine never silently halts on a signal the user did not configure.
16
+
17
+ ## Schema
18
+
19
+ All keys optional. Unknown keys are rejected hard by
20
+ `scripts/validate_decision_engine.py` and by
21
+ `work_engine.scoring.decision_engine.parse`.
22
+
23
+ | Key | Type | Default | Notes |
24
+ |------------------------|-----------------|---------|-------|
25
+ | `surface_traces` | bool | `false` | Mirrored to `DecisionTraceHook`. Predates the gates; lives here so the block has one schema. |
26
+ | `min_confidence` | enum | `off` | `low` \| `medium` \| `high` \| `off`. Phase=Plan floor. |
27
+ | `block_on_risk` | enum | `off` | `low` \| `medium` \| `high` \| `off`. Phase=Implement ceiling. |
28
+ | `require_memory_hits` | bool | `false` | Phase=Refine demands `memory_hits >= 1`. |
29
+ | `on_block` | enum | `stop` | `stop` \| `ask` \| `warn`. Action when a gate fires. |
30
+ | `ask_timeout_seconds` | int (>= 0) | `30` | Non-TTY wait before applying `on_block_fallback`. |
31
+ | `on_block_fallback` | enum | `stop` | `stop` \| `warn`. Resolution after `ask_timeout`. |
32
+
33
+ ## Gate-to-phase mapping
34
+
35
+ Each gate fires on exactly one phase. The dispatcher emits gate
36
+ decisions on `AFTER_STEP` for that phase only.
37
+
38
+ | Gate | Phase | Signal compared | Fires when |
39
+ |-----------------------|-----------|-----------------------------|-------------------------------------|
40
+ | `min_confidence` | Plan | `confidence_band` | actual < floor |
41
+ | `require_memory_hits` | Refine | `state.memory.hits` | hits < 1 |
42
+ | `block_on_risk` | Implement | `risk_class` | actual >= ceiling |
43
+
44
+ `low` < `medium` < `high` for both confidence and risk. `off` disables
45
+ the gate.
46
+
47
+ ## Conflict matrix
48
+
49
+ Only one gate fires per phase, so cross-phase conflicts are impossible
50
+ by construction. Within a phase, **only the highest-impact gate
51
+ applies**; downstream gates are evaluated against the same phase but
52
+ skipped if a higher-priority gate already fired.
53
+
54
+ Priority (highest → lowest):
55
+
56
+ 1. `block_on_risk` (Implement)
57
+ 2. `require_memory_hits` (Refine)
58
+ 3. `min_confidence` (Plan)
59
+
60
+ This priority surfaces only when a future schema adds gates that
61
+ overlap on the same phase; today each gate owns a unique phase and the
62
+ priority is documentary. The order is locked so future additions
63
+ inherit the contract.
64
+
65
+ ### Worked examples
66
+
67
+ | Config | Phase | confidence | risk | hits | Outcome |
68
+ |---------------------------------------------------------------------------------------|-----------|------------|----------|------|----------------------------------|
69
+ | `min_confidence: medium` | Plan | `low` | - | - | `min_confidence` fires, action=stop |
70
+ | `min_confidence: medium` | Plan | `high` | - | - | no fire — band at/above floor |
71
+ | `block_on_risk: medium` | Implement | - | `high` | - | `block_on_risk` fires, action=stop |
72
+ | `block_on_risk: high` | Implement | - | `medium` | - | no fire — below ceiling |
73
+ | `require_memory_hits: true` | Refine | - | - | 0 | `require_memory_hits` fires |
74
+ | `require_memory_hits: true` | Refine | - | - | 2 | no fire |
75
+ | `min_confidence: high, block_on_risk: low, require_memory_hits: true` (all on) | Plan | `low` | `low` | 0 | `min_confidence` fires (Plan-owning gate) — Refine/Implement gates inert this phase |
76
+
77
+ ## Non-TTY timeout protocol
78
+
79
+ `on_block=ask` is interactive. In a non-interactive context the
80
+ engine cannot block waiting for keystrokes that will never arrive.
81
+ Detection follows two signals (either disables interactivity):
82
+
83
+ - environment variable `CI` set to `1`, `true`, `yes` (case-insensitive)
84
+ - `sys.stdin.isatty()` or `sys.stdout.isatty()` returns false
85
+
86
+ When non-interactive, `on_block=ask` collapses to action `ask_timeout`.
87
+ The consumer (CLI / dispatcher) is expected to:
88
+
89
+ 1. wait `ask_timeout_seconds` for a stdin response;
90
+ 2. apply `on_block_fallback` (`stop` or `warn`) when the timeout
91
+ elapses or stdin is closed;
92
+ 3. surface `block_reason=ask_timeout` on the decision trace so the
93
+ reason is replay-visible.
94
+
95
+ Default fallback is `stop` (fail-safe). Flip to `warn` only when CI
96
+ explicitly wants advisory gates.
97
+
98
+ ## Rollback
99
+
100
+ The block is config-only. Remove the `decision_engine:` block and
101
+ the engine reverts to observe-only behaviour — no migration, no DB
102
+ state, no schema lock. Per-key removal also works (each key has a
103
+ safe default).
104
+
105
+ ## Test surface
106
+
107
+ Coverage lives in `tests/work_engine/scoring/test_decision_engine.py`:
108
+
109
+ - schema parser: defaults, unknown-key rejection, bad-type rejection;
110
+ - gate evaluation: per-phase, per-signal, conflict isolation;
111
+ - TTY detection: env-var detection, fallback to `ask_timeout`;
112
+ - action resolution: `stop` / `warn` short-circuit interactivity.
113
+
114
+ Wiring tests (dispatcher + hook) live in
115
+ `tests/work_engine/test_decision_gate_hook.py`.
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  stability: beta
3
+ keep-beta-until: 2026-08-12
3
4
  ---
4
5
 
5
6
  # Decision-trace v1
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  stability: beta
3
+ keep-beta-until: 2026-08-12
3
4
  ---
4
5
 
5
6
  # File-ownership matrix