@event4u/agent-config 1.14.0 → 1.15.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 (106) hide show
  1. package/.agent-src/commands/agent-handoff.md +1 -1
  2. package/.agent-src/commands/bug-fix.md +2 -2
  3. package/.agent-src/commands/chat-history-checkpoint.md +2 -2
  4. package/.agent-src/commands/chat-history-clear.md +1 -1
  5. package/.agent-src/commands/chat-history-resume.md +2 -2
  6. package/.agent-src/commands/chat-history.md +2 -2
  7. package/.agent-src/commands/check-current-md.md +43 -32
  8. package/.agent-src/commands/commit-in-chunks.md +43 -23
  9. package/.agent-src/commands/compress.md +34 -2
  10. package/.agent-src/commands/feature-roadmap.md +2 -2
  11. package/.agent-src/commands/fix-portability.md +2 -2
  12. package/.agent-src/commands/onboard.md +14 -5
  13. package/.agent-src/commands/optimize-augmentignore.md +9 -0
  14. package/.agent-src/commands/refine-ticket.md +9 -7
  15. package/.agent-src/commands/review-changes.md +35 -8
  16. package/.agent-src/commands/roadmap-create.md +13 -2
  17. package/.agent-src/commands/roadmap-execute.md +9 -7
  18. package/.agent-src/commands/set-cost-profile.md +8 -0
  19. package/.agent-src/commands/sync-agent-settings.md +9 -0
  20. package/.agent-src/commands/tests-execute.md +2 -3
  21. package/.agent-src/rules/artifact-engagement-recording.md +1 -1
  22. package/.agent-src/rules/augment-portability.md +56 -37
  23. package/.agent-src/rules/chat-history-cadence.md +109 -0
  24. package/.agent-src/rules/chat-history-ownership.md +123 -0
  25. package/.agent-src/rules/chat-history-visibility.md +96 -0
  26. package/.agent-src/rules/cli-output-handling.md +1 -1
  27. package/.agent-src/rules/command-suggestion.md +3 -2
  28. package/.agent-src/rules/commit-policy.md +44 -34
  29. package/.agent-src/rules/direct-answers.md +1 -1
  30. package/.agent-src/rules/language-and-tone.md +19 -15
  31. package/.agent-src/rules/non-destructive-by-default.md +18 -18
  32. package/.agent-src/rules/roadmap-progress-sync.md +133 -74
  33. package/.agent-src/rules/role-mode-adherence.md +1 -1
  34. package/.agent-src/rules/size-enforcement.md +2 -1
  35. package/.agent-src/rules/user-interaction.md +28 -4
  36. package/.agent-src/scripts/update_roadmap_progress.py +56 -4
  37. package/.agent-src/skills/blade-ui/SKILL.md +29 -10
  38. package/.agent-src/skills/command-writing/SKILL.md +15 -4
  39. package/.agent-src/skills/existing-ui-audit/SKILL.md +24 -9
  40. package/.agent-src/skills/fe-design/SKILL.md +20 -15
  41. package/.agent-src/skills/file-editor/SKILL.md +9 -0
  42. package/.agent-src/skills/livewire/SKILL.md +26 -7
  43. package/.agent-src/skills/refine-ticket/SKILL.md +30 -24
  44. package/.agent-src/skills/roadmap-management/SKILL.md +22 -16
  45. package/.agent-src/skills/skill-writing/SKILL.md +3 -3
  46. package/.agent-src/skills/upstream-contribute/SKILL.md +2 -2
  47. package/.agent-src/templates/agent-settings.md +1 -1
  48. package/.agent-src/templates/roadmaps.md +9 -8
  49. package/.agent-src/templates/scripts/memory_lookup.py +1 -1
  50. package/.agent-src/templates/scripts/work_engine/__init__.py +2 -2
  51. package/.agent-src/templates/scripts/work_engine/cli.py +64 -461
  52. package/.agent-src/templates/scripts/work_engine/cli_args.py +116 -0
  53. package/.agent-src/templates/scripts/work_engine/delivery_state.py +3 -3
  54. package/.agent-src/templates/scripts/work_engine/directives/backend/__init__.py +1 -1
  55. package/.agent-src/templates/scripts/work_engine/directives/backend/implement.py +1 -1
  56. package/.agent-src/templates/scripts/work_engine/directives/backend/memory.py +1 -1
  57. package/.agent-src/templates/scripts/work_engine/directives/backend/plan.py +1 -1
  58. package/.agent-src/templates/scripts/work_engine/directives/backend/report.py +1 -1
  59. package/.agent-src/templates/scripts/work_engine/dispatcher.py +1 -1
  60. package/.agent-src/templates/scripts/work_engine/emitters.py +43 -0
  61. package/.agent-src/templates/scripts/work_engine/errors.py +19 -0
  62. package/.agent-src/templates/scripts/work_engine/hook_bootstrap.py +76 -0
  63. package/.agent-src/templates/scripts/work_engine/input_builders.py +163 -0
  64. package/.agent-src/templates/scripts/work_engine/migration/v0_to_v1.py +34 -2
  65. package/.agent-src/templates/scripts/work_engine/persona_policy.py +1 -1
  66. package/.agent-src/templates/scripts/work_engine/resolvers/prompt.py +1 -1
  67. package/.agent-src/templates/scripts/work_engine/state_io.py +202 -0
  68. package/.claude-plugin/marketplace.json +1 -1
  69. package/AGENTS.md +6 -4
  70. package/CHANGELOG.md +83 -8
  71. package/README.md +24 -23
  72. package/docs/MIGRATION.md +122 -0
  73. package/docs/architecture.md +83 -34
  74. package/docs/contracts/STABILITY.md +95 -0
  75. package/docs/contracts/adr-chat-history-split.md +132 -0
  76. package/docs/contracts/adr-command-suggestion.md +146 -0
  77. package/docs/contracts/adr-implement-ticket-runtime.md +122 -0
  78. package/docs/contracts/adr-product-ui-track.md +384 -0
  79. package/docs/contracts/adr-prompt-driven-execution.md +187 -0
  80. package/docs/contracts/agent-memory-contract.md +149 -0
  81. package/docs/contracts/artifact-engagement-flow.md +262 -0
  82. package/docs/contracts/command-clusters.md +126 -0
  83. package/docs/contracts/command-suggestion-flow.md +148 -0
  84. package/docs/contracts/implement-ticket-flow.md +628 -0
  85. package/docs/contracts/linear-ai-rules-inclusion.md +143 -0
  86. package/docs/contracts/linear-ai-three-layers.md +131 -0
  87. package/docs/contracts/rule-interactions.md +107 -0
  88. package/docs/contracts/rule-interactions.yml +142 -0
  89. package/docs/contracts/ui-stack-extension.md +236 -0
  90. package/docs/contracts/ui-track-flow.md +338 -0
  91. package/docs/getting-started.md +2 -2
  92. package/docs/installation.md +42 -6
  93. package/docs/migrations/commands-1.15.0.md +112 -0
  94. package/docs/ui-track-mental-model.md +121 -0
  95. package/package.json +1 -1
  96. package/scripts/build_linear_digest.py +4 -4
  97. package/scripts/check_portability.py +2 -0
  98. package/scripts/check_public_links.py +185 -0
  99. package/scripts/check_references.py +1 -0
  100. package/scripts/lint_no_new_atomic_commands.py +179 -0
  101. package/scripts/lint_rule_interactions.py +149 -0
  102. package/scripts/memory_lookup.py +1 -1
  103. package/scripts/release.py +297 -64
  104. package/scripts/skill_linter.py +14 -0
  105. package/scripts/update_counts.py +10 -0
  106. package/.agent-src/rules/chat-history.md +0 -200
@@ -0,0 +1,143 @@
1
+ ---
2
+ stability: beta
3
+ ---
4
+
5
+ # Linear AI — rules inclusion list
6
+
7
+ > Phase 3 Step 1 deliverable for [`road-to-universal-distribution.md`](../../agents/roadmaps/road-to-universal-distribution.md).
8
+ > Per-rule decision for the Linear AI rules digest. The digest is a
9
+ > Markdown blob the user pastes into Linear's `Settings → Agents →
10
+ > Additional guidance` (workspace / team / personal). The third-party
11
+ > agent (Codegen, Charlie, Cursor's Linear app, …) reads it verbatim —
12
+ > no skill triggering, no script execution, no `.augment/` access.
13
+ >
14
+ > Source of tier data: `python3 scripts/audit_cloud_compatibility.py
15
+ > --details` (47 rules: T1=20, T2=19, T3-S=8).
16
+ >
17
+ > Last refreshed: 2026-04-29.
18
+
19
+ ## Inclusion criteria
20
+
21
+ - **Workspace** — universal coding posture and interaction discipline.
22
+ Survives without filesystem, scripts, or this package's tooling.
23
+ - **Team** — framework-specific (Laravel, PHP, E2E with Playwright).
24
+ Only applied where the team uses that stack.
25
+ - **Personal** — empty by default; reserved for individual preferences
26
+ the user may add manually.
27
+ - **Excluded** — meta-rules about authoring this package, Augment Code
28
+ specifics, or rules already declared `cloud_safe: noop`.
29
+
30
+ Two transformations the digest builder (Phase 3 Step 2) must apply
31
+ to *included-degraded* rules:
32
+
33
+ 1. Strip references to scripts, `.agent-settings.yml`, `.agent-src/`,
34
+ `.augment/`, `agents/`, and `task <foo>` invocations.
35
+ 2. Replace `[link](path)` to other rules/skills/files with a footnote
36
+ or inline summary, since the path won't resolve outside this repo.
37
+
38
+ ## Workspace digest (18 rules)
39
+
40
+ Universal coding posture — applies to every team regardless of stack.
41
+
42
+ | Rule | Tier | Mode | Notes |
43
+ |---|---|---|---|
44
+ | `ask-when-uncertain` | T1 | as-is | One-question-per-turn iron law; strip cross-refs to `user-interaction` / `artifact-drafting-protocol` |
45
+ | `commit-conventions` | T1 | as-is | Generic Conventional Commits |
46
+ | `context-hygiene` | T1 | as-is | Conversation freshness, 3-Failure Rule, tool-loop detection; strip Augment-specific `.augmentignore` section |
47
+ | `direct-answers` | T1 | as-is | Iron Laws (no flattery, no invented facts, brevity); strip emoji whitelist refs to other rules |
48
+ | `markdown-safe-codeblocks` | T1 | as-is | Generic markdown safety |
49
+ | `minimal-safe-diff` | T1 | as-is | Universal coding discipline |
50
+ | `reviewer-awareness` | T1 | as-is | Anchor reviewer choice in paths and risk |
51
+ | `scope-control` | T1 | as-is | Universal scope discipline + git-ops permission gating |
52
+ | `security-sensitive-stop` | T1 | as-is | Stop-and-threat-model on security-sensitive paths |
53
+ | `think-before-action` | T1 | degraded | Strip `memory-access` guideline ref (no shared memory on Linear) |
54
+ | `verify-before-complete` | T1 | as-is | Evidence gate; the tool list (PHPStan etc.) is illustrative, harmless |
55
+ | `cli-output-handling` | T2 | degraded | Keep "use targeted output, not full dumps"; strip `rtk` Iron Law (rtk is a local tool) |
56
+ | `downstream-changes` | T2 | as-is | Universal post-edit propagation |
57
+ | `improve-before-implement` | T2 | as-is | Challenge weak requirements before implementing |
58
+ | `language-and-tone` | T2 | degraded | Keep mirroring + tone; strip "all `.md` docs must be English" clause (no `.md` files on Linear) |
59
+ | `missing-tool-handling` | T2 | as-is | Don't install silently |
60
+ | `token-efficiency` | T2 | degraded | Strip `.agent-settings.yml` references (`personal.minimal_output`, `personal.play_by_play`) |
61
+ | `user-interaction` | T3-S | degraded | Numbered-options Iron Law, single-source recommendation; strip `scripts/check_reply_consistency.py` reference |
62
+
63
+ ## Team digest (4 rules)
64
+
65
+ Framework-specific. Only paste into the Team layer of teams that use
66
+ the stack. Each rule already names the stack in its own trigger line,
67
+ so nothing to strip.
68
+
69
+ | Rule | Tier | Stack | Notes |
70
+ |---|---|---|---|
71
+ | `docker-commands` | T1 | Docker / Laravel | Container-prefixed CLI for artisan/composer/phpunit |
72
+ | `laravel-translations` | T1 | Laravel | `__()` helper, `lang/de`, `lang/en` |
73
+ | `e2e-testing` | T2 | Playwright | Locators, Page Objects, fixtures, flake prevention |
74
+ | `php-coding` | T2 | PHP | Strict types, naming, comparisons, Eloquent conventions |
75
+
76
+ ## Personal digest (0 rules)
77
+
78
+ Empty by default. The user may paste individual preferences (preferred
79
+ naming, IDE-specific shortcuts, response language overrides) into this
80
+ layer manually. The digest builder emits an empty stub with a comment.
81
+
82
+ ## Excluded (25 rules) — categorised
83
+
84
+ ### Meta — about authoring this package (20)
85
+
86
+ These rules govern how skills/rules/commands are created, kept in sync,
87
+ and shipped from this repository. They have no meaning for a third-party
88
+ agent that does not maintain `event4u/agent-config`.
89
+
90
+ `agent-docs`, `architecture`, `artifact-drafting-protocol`,
91
+ `augment-portability`, `augment-source-of-truth`, `capture-learnings`,
92
+ `docs-sync`, `guidelines`, `package-ci-checks`, `preservation-guard`,
93
+ `review-routing-awareness`, `roadmap-progress-sync`,
94
+ `role-mode-adherence`, `rule-type-governance`, `runtime-safety`,
95
+ `size-enforcement`, `skill-improvement-trigger`, `skill-quality`,
96
+ `tool-safety`, `upstream-proposal`.
97
+
98
+ ### Augment Code specifics (3)
99
+
100
+ These reference Augment-only mechanics — model identity in Augment's
101
+ system prompt, Augment's `/slash` command surface, and the Augment
102
+ onboarding flow gated by `.agent-settings.yml`.
103
+
104
+ `model-recommendation`, `onboarding-gate`, `slash-commands`.
105
+
106
+ ### Skill-routing only (1)
107
+
108
+ `analysis-skill-routing` — routes to one of our `analysis-*` skills.
109
+ Skills do not exist on Linear AI; the third-party agent has its own
110
+ capability surface.
111
+
112
+ ### Already declared inert on cloud (1)
113
+
114
+ `chat-history` — carries `<!-- cloud_safe: noop -->` by design. No
115
+ persistence on cloud platforms; the rule is a no-op.
116
+
117
+ ## Open follow-ups
118
+
119
+ - **Phase 3 Step 2** (`scripts/build_linear_digest.py`) implements the
120
+ two transformations above (strip script/path/setting refs, replace
121
+ cross-refs with inline summaries or footnotes). Pin the *degraded*
122
+ set in the script's source so a human can audit which rules ship
123
+ modified vs. as-is.
124
+ - **Phase 3 Step 4 char-budget test** — Linear's per-field char limit
125
+ is still unresearched (Open Question #1 in the roadmap). Before the
126
+ test is wired, run a quick recon and capture the value. The
127
+ conservative fallback (~30 KB) probably fits this 18-rule workspace
128
+ digest without contention; team layer is far smaller.
129
+ - **Phase 3 Step 3 three-layer split** — this document already
130
+ partitions workspace / team / personal. Step 3 only needs to
131
+ document the three-layer rationale for the README.
132
+ - Re-classify on every audit run; if a rule is added to
133
+ `.agent-src.uncompressed/rules/`, this document MUST gain a row.
134
+
135
+ ## Source of tier data
136
+
137
+ ```
138
+ python3 scripts/audit_cloud_compatibility.py --details --format json
139
+ ```
140
+
141
+ 47 rules: T1=20, T2=19, T3-S=8. Counts in this document derive from the
142
+ above; if they drift, this document is stale and the digest builder
143
+ must refuse to emit until reconciled.
@@ -0,0 +1,131 @@
1
+ ---
2
+ stability: beta
3
+ ---
4
+
5
+ # Linear AI — three-layer split rationale
6
+
7
+ > Phase 3 Step 3 deliverable for [`road-to-universal-distribution.md`](../../agents/roadmaps/road-to-universal-distribution.md).
8
+ > Per-rule routing is in [`linear-ai-rules-inclusion.md`](linear-ai-rules-inclusion.md);
9
+ > this file documents *why* the split is workspace / team / personal and
10
+ > what belongs in each.
11
+
12
+ ## The three slots Linear gives us
13
+
14
+ `Settings → Agents → Additional guidance` exposes three text fields:
15
+
16
+ | Field | Scope | Inheritance | Editable by |
17
+ |---|---|---|---|
18
+ | **Workspace** | Whole organisation | Inherited by every team and every member | Workspace admins |
19
+ | **Team** | One Linear team | Overrides workspace for that team's issues | Team admins |
20
+ | **Personal** | One member, on their own assigned issues | Layered on top of workspace + team | The member |
21
+
22
+ Linear's docs frame this as **most-specific-wins**: when an agent is
23
+ linked to a Linear issue, it reads workspace + team + personal
24
+ concatenated, with later layers overriding earlier ones. The third-party
25
+ agent (Codegen, Charlie, Cursor's Linear app, …) receives the bytes
26
+ verbatim — no filesystem, no skill triggering, no `.augment/` access.
27
+
28
+ ## Our mapping — workspace / team / personal
29
+
30
+ The inclusion list partitions our 47 rules into three mutually exclusive
31
+ buckets. Counts and per-rule decisions live in
32
+ [`linear-ai-rules-inclusion.md`](linear-ai-rules-inclusion.md); this
33
+ section explains the *principle* behind each bucket.
34
+
35
+ ### Workspace — universal coding posture (18 rules)
36
+
37
+ Goes into the **Workspace** field. Rules that:
38
+
39
+ - Apply regardless of stack (PHP, Node, Python, Go, …)
40
+ - Govern *interaction discipline* — when to ask, how to commit, how to
41
+ surface options, how to push back on weak reviews
42
+ - Survive without filesystem, scripts, or this package's tooling
43
+ - Carry no Augment-specific or repo-authoring scaffolding
44
+
45
+ Examples: `ask-when-uncertain`, `commit-conventions`, `direct-answers`,
46
+ `minimal-safe-diff`, `scope-control`, `verify-before-complete`,
47
+ `user-interaction`. Anything that helps a generic third-party agent
48
+ behave like a competent engineer on *any* codebase.
49
+
50
+ A few rules in this bucket are **degraded** — the digest builder strips
51
+ the local-only sections (rtk, `.agent-settings.yml`, `.augment/` paths,
52
+ `.md`-files-must-be-English clause). The substance survives; the tooling
53
+ references don't.
54
+
55
+ ### Team — framework-specific (4 rules)
56
+
57
+ Goes into the **Team** field of teams that match the stack. Rules that:
58
+
59
+ - Name a specific framework, language, or tool in their trigger line
60
+ - Carry conventions that only fire when that stack is touched
61
+ - Don't apply to teams using a different stack (a frontend-only team
62
+ doesn't need the PHP rules)
63
+
64
+ Currently four rules: `docker-commands`, `laravel-translations`,
65
+ `e2e-testing` (Playwright), `php-coding`. Each rule already names its
66
+ stack, so the digest builder ships them as-is — no per-rule stripping.
67
+
68
+ If the org has a Node-only team, paste only `e2e-testing`. If a
69
+ Laravel-Docker team, paste all four. The Team layer is per-team, not
70
+ universal.
71
+
72
+ ### Personal — empty by default (0 rules)
73
+
74
+ Goes into the **Personal** field of individual members. Empty stub by
75
+ default. Each developer pastes their own preferences into this layer
76
+ manually. Examples a member might add:
77
+
78
+ - Response language overrides ("respond in German on my issues")
79
+ - Personal naming conventions ("I prefer `result_` prefixes for outputs")
80
+ - Individual IDE shortcuts they want surfaced in PR descriptions
81
+ - Scoped opt-outs from a workspace rule, with a one-sentence reason
82
+
83
+ The digest builder emits an empty stub with a comment line so members
84
+ have a starting point, but the file is intentionally minimal — the
85
+ package does not own personal preferences.
86
+
87
+ ## Why this split, not a flat blob
88
+
89
+ Three reasons we don't merge everything into one workspace digest:
90
+
91
+ 1. **Stack-specific noise.** A frontend-only team doesn't need 4 KB of
92
+ Laravel + PHP + Docker conventions cluttering their guidance field.
93
+ Pushing those into Team layers keeps the workspace lean and
94
+ universal.
95
+ 2. **Per-team override surface.** When a team needs to override a
96
+ workspace rule (e.g. their own commit-message convention), Linear's
97
+ layering already gives them the surface. We don't need to fork the
98
+ workspace digest per team.
99
+ 3. **Personal autonomy.** Members own the Personal layer. The package
100
+ never writes there; it's the user's escape hatch for individual
101
+ preferences without lobbying for a workspace-wide rule change.
102
+
103
+ ## Excluded from all three layers (25 rules)
104
+
105
+ [`linear-ai-rules-inclusion.md`](linear-ai-rules-inclusion.md) §
106
+ "Excluded" covers the four categories: meta-rules about authoring this
107
+ package (20), Augment Code specifics (3), skill-routing only (1),
108
+ already-cloud-inert (1). None of these benefit a third-party agent that
109
+ does not maintain `event4u/agent-config`.
110
+
111
+ ## Future evolution
112
+
113
+ - **More stacks → more team rules.** When the package gains a Node,
114
+ Python, or Go equivalent of `php-coding`, the Team digest grows. The
115
+ decision criterion stays: stack-named in the trigger line → Team;
116
+ stack-agnostic → Workspace.
117
+ - **Workspace stays bounded.** Adding new universal rules is fine, but
118
+ the workspace digest should not grow to swamp Linear's per-field cap.
119
+ Current digest is well under the 100 KB safety budget; if growth
120
+ approaches the cap, split workspace by *concern* (interaction vs.
121
+ code-shape vs. delivery) rather than relaxing the cap.
122
+ - **Personal layer stays empty in this package.** Even if patterns
123
+ emerge, they belong in workspace (if universal) or team (if
124
+ stack-bound), not in a curated personal blob the package owns.
125
+
126
+ ## Source of truth
127
+
128
+ - Per-rule decision: [`linear-ai-rules-inclusion.md`](linear-ai-rules-inclusion.md)
129
+ - Builder script: [`scripts/build_linear_digest.py`](../../scripts/build_linear_digest.py)
130
+ - Generated digests: `dist/linear/{workspace,team,personal}.md` (gitignored)
131
+ - Roadmap: [`road-to-universal-distribution.md`](../../agents/roadmaps/road-to-universal-distribution.md) Phase 3
@@ -0,0 +1,107 @@
1
+ ---
2
+ stability: beta
3
+ ---
4
+
5
+ # Rule-Interaction Matrix
6
+
7
+ > **Audience:** rule authors and reviewers — anyone editing
8
+ > `.agent-src.uncompressed/rules/*.md` or proposing a new always-rule.
9
+ > **Authoritative source:** [`rule-interactions.yml`](rule-interactions.yml).
10
+ > **Linter:** `scripts/lint_rule_interactions.py` (run via `task lint-rule-interactions`).
11
+
12
+ The matrix captures how the package's `always` rules relate when more
13
+ than one fires on the same turn. It exists because rules at this size
14
+ (55 rules, ~49k tokens budget) develop emergent precedence relationships
15
+ that no single rule file can document on its own.
16
+
17
+ The anchor pair is `non-destructive-by-default` — the universal safety
18
+ floor — paired with the five rules most likely to be invoked in the
19
+ same turn:
20
+
21
+ - `autonomous-execution` — autonomy never lifts the floor.
22
+ - `scope-control` — git-ops permission gate; floor is the never-overridable subset.
23
+ - `commit-policy` — four exception paths to commit; floor still gates the diff content.
24
+ - `ask-when-uncertain` — both rules push toward the same response on a destructive ambiguous request.
25
+ - `verify-before-complete` — independent gates; both must be satisfied.
26
+
27
+ ## Diagram
28
+
29
+ ```mermaid
30
+ graph LR
31
+ NDD["non-destructive-by-default<br/>(Hard Floor)"]
32
+ AE["autonomous-execution"]
33
+ SC["scope-control"]
34
+ CP["commit-policy"]
35
+ AWU["ask-when-uncertain"]
36
+ VBC["verify-before-complete"]
37
+
38
+ NDD -- "overrides" --> AE
39
+ NDD -- "restates" --> SC
40
+ NDD -- "gates diff" --> CP
41
+ NDD -- "complements" --> AWU
42
+ NDD -- "complements" --> VBC
43
+
44
+ SC -- "gates git ops" --> AE
45
+ CP -- "overrides<br/>commit Q" --> AE
46
+
47
+ classDef floor fill:#7a1f1f,stroke:#fff,color:#fff,font-weight:bold
48
+ classDef gate fill:#1f4f7a,stroke:#fff,color:#fff
49
+ class NDD floor
50
+ class SC,CP gate
51
+ ```
52
+
53
+ ## Relations
54
+
55
+ The YAML uses six relation kinds. Definitions:
56
+
57
+ | Relation | Meaning |
58
+ |---|---|
59
+ | `overrides` | Senior rule's outcome wins when both fire — junior's permission cannot proceed past senior's stop. |
60
+ | `narrows` | Senior shrinks the surface area on which junior applies, but does not stop it. |
61
+ | `defers_to` | Junior explicitly hands over to senior on the overlapping surface. |
62
+ | `restates` | The two rules cover overlapping ground intentionally — the restatement prevents future weakening of one side. |
63
+ | `gates` | Senior fires *in addition to* junior on a specific subset, not instead of. |
64
+ | `complements` | Both rules independently apply; outcomes are additive and harmonious. |
65
+
66
+ ## Reading a pair entry
67
+
68
+ ```yaml
69
+ - id: ndd-x-autonomous-execution
70
+ rules: [non-destructive-by-default, autonomous-execution] # senior, junior
71
+ relation: overrides
72
+ conflict: … # what triggers both
73
+ resolution: … # what the agent does
74
+ evidence:
75
+ - .agent-src.uncompressed/rules/non-destructive-by-default.md#the-iron-law
76
+ - .agent-src.uncompressed/rules/autonomous-execution.md#hard-floor--see-non-destructive-by-default
77
+ ```
78
+
79
+ `rules: [a, b]` is ordered: `a` is senior (wins on conflict), `b` is
80
+ junior (yields). For `complements`, ordering is documentary only.
81
+
82
+ ## Adding a new pair
83
+
84
+ 1. Edit `rule-interactions.yml`, append a pair under `pairs:` with all
85
+ six required fields.
86
+ 2. Add both rule slugs to the top-level `rules:` block if not already
87
+ listed.
88
+ 3. Run `task lint-rule-interactions` — must exit 0.
89
+ 4. Update the Mermaid diagram above if the pair is anchor-relevant
90
+ (involves `non-destructive-by-default` or one of its five partners).
91
+ 5. Reference the matrix from the rule files that are involved (one
92
+ line each — the matrix is the source, not the rules).
93
+
94
+ ## When **not** to add a pair
95
+
96
+ - Two rules that never fire on the same turn — no interaction means
97
+ no entry; the matrix is for *active* relationships.
98
+ - Documentation-only cross-references (e.g. "see also") — those stay
99
+ in the rule files.
100
+ - Skill ↔ rule interactions — the matrix is rule-only. Skills are
101
+ invoked, not always-active.
102
+
103
+ ## See also
104
+
105
+ - [`docs/contracts/STABILITY.md`](STABILITY.md) — public-surface stability tiers.
106
+ - [`docs/contracts/adr-chat-history-split.md`](adr-chat-history-split.md) — ADR pattern for major rule structural changes.
107
+ - [`agents/roadmaps/archive/road-to-post-pr29-optimize.md`](../../agents/roadmaps/archive/road-to-post-pr29-optimize.md) § P2.2 — anchor for this matrix.
@@ -0,0 +1,142 @@
1
+ # Rule-Interaction Matrix
2
+ # -----------------------
3
+ # Machine-readable contract for how the package's `always` rules relate
4
+ # when more than one fires on the same turn. Linted by
5
+ # `scripts/lint_rule_interactions.py`. Rendered diagram in
6
+ # `docs/contracts/rule-interactions.md`.
7
+ #
8
+ # Schema:
9
+ # version: integer
10
+ # rules: list of rule slugs that participate in any interaction (each
11
+ # must exist as `.agent-src.uncompressed/rules/<slug>.md`)
12
+ # pairs: list of pairwise interactions
13
+ # - id: kebab-case stable identifier
14
+ # rules: [senior, junior] — `senior` wins on conflict
15
+ # relation: overrides | narrows | defers_to | restates | gates | complements
16
+ # conflict: one-line trigger that causes both to fire
17
+ # resolution: one paragraph — what the agent does
18
+ # evidence: list of `file#anchor` citations
19
+ # tests: optional list of test paths
20
+ #
21
+ # Anchor pair: `non-destructive-by-default` × five rules per
22
+ # `road-to-post-pr29-optimize.md` Phase 2.
23
+
24
+ version: 1
25
+
26
+ rules:
27
+ - non-destructive-by-default
28
+ - autonomous-execution
29
+ - scope-control
30
+ - commit-policy
31
+ - ask-when-uncertain
32
+ - verify-before-complete
33
+
34
+ pairs:
35
+
36
+ - id: ndd-x-autonomous-execution
37
+ rules: [non-destructive-by-default, autonomous-execution]
38
+ relation: overrides
39
+ conflict: >-
40
+ Standing autonomy directive ("arbeite selbstständig") is active and
41
+ the next step crosses a Hard-Floor trigger (production-branch merge,
42
+ deploy, push, prod data/infra, whimsical bulk deletion, commit with
43
+ bulk deletion / infra change).
44
+ resolution: >-
45
+ Autonomy never lifts the floor. Stop, surface the action via one
46
+ numbered-options block, wait for explicit user confirmation on
47
+ this turn before proceeding.
48
+ evidence:
49
+ - .agent-src.uncompressed/rules/non-destructive-by-default.md#the-iron-law
50
+ - .agent-src.uncompressed/rules/autonomous-execution.md#hard-floor--see-non-destructive-by-default
51
+
52
+ - id: ndd-x-scope-control
53
+ rules: [non-destructive-by-default, scope-control]
54
+ relation: restates
55
+ conflict: >-
56
+ Push, merge, branch creation, PR ops, tag pushes — both rules speak
57
+ to the same git operations.
58
+ resolution: >-
59
+ `scope-control` is the canonical permission gate; the floor restates
60
+ the prod-trunk and deploy-tied subset so the never-overridable layer
61
+ cannot be weakened by future scope-control edits. On any conflict,
62
+ the floor wins.
63
+ evidence:
64
+ - .agent-src.uncompressed/rules/non-destructive-by-default.md#the-iron-law
65
+ - .agent-src.uncompressed/rules/scope-control.md#git-operations--permission-gated
66
+ - .agent-src.uncompressed/rules/scope-control.md#production-infrastructure-bulk-destructive--hard-floor
67
+
68
+ - id: ndd-x-commit-policy
69
+ rules: [non-destructive-by-default, commit-policy]
70
+ relation: gates
71
+ conflict: >-
72
+ A commit is otherwise authorized by one of `commit-policy`'s four
73
+ paths (user-this-turn, standing instruction, `/commit*` invocation,
74
+ roadmap pre-scan), but the diff contains bulk deletions or infra
75
+ changes (row 6 of the Hard Floor).
76
+ resolution: >-
77
+ The commit pre-scan triggers regardless of which authorization path
78
+ applies. Surface the diff (paths + counts), confirm this turn,
79
+ then commit. The four exceptions cover *whether* commits happen;
80
+ the floor covers *which diffs* still need a separate confirmation.
81
+ evidence:
82
+ - .agent-src.uncompressed/rules/non-destructive-by-default.md#the-iron-law
83
+ - .agent-src.uncompressed/rules/commit-policy.md#hard-floor-still-applies--bulk-deletions-and-infra-changes
84
+
85
+ - id: ndd-x-ask-when-uncertain
86
+ rules: [non-destructive-by-default, ask-when-uncertain]
87
+ relation: complements
88
+ conflict: >-
89
+ A floor trigger fires AND the request is ambiguous (e.g. "delete
90
+ the legacy folder" without a file list).
91
+ resolution: >-
92
+ Both rules require the same response — stop and ask. The floor
93
+ provides the categorical reason (destructive); ask-when-uncertain
94
+ provides the question shape (one numbered-options block, blocking).
95
+ No conflict; both fire harmoniously.
96
+ evidence:
97
+ - .agent-src.uncompressed/rules/non-destructive-by-default.md#failure-modes
98
+ - .agent-src.uncompressed/rules/ask-when-uncertain.md#vague-request-triggers--must-ask
99
+
100
+ - id: ndd-x-verify-before-complete
101
+ rules: [non-destructive-by-default, verify-before-complete]
102
+ relation: complements
103
+ conflict: >-
104
+ A floor-crossing action (deploy, prod-data write) was authorized
105
+ and executed; agent is about to claim "done".
106
+ resolution: >-
107
+ Both rules apply independently. Floor is satisfied by user
108
+ confirmation; verify-before-complete is satisfied by fresh
109
+ verification evidence in the same message. Skipping either is a
110
+ rule violation.
111
+ evidence:
112
+ - .agent-src.uncompressed/rules/non-destructive-by-default.md#the-iron-law
113
+ - .agent-src.uncompressed/rules/verify-before-complete.md#the-iron-law
114
+
115
+ - id: autonomy-x-scope-control
116
+ rules: [scope-control, autonomous-execution]
117
+ relation: gates
118
+ conflict: >-
119
+ Autonomy is `on` and the next step is a permission-gated git
120
+ operation (push, branch create/delete, PR open, tag push) below
121
+ the floor threshold.
122
+ resolution: >-
123
+ `scope-control`'s permission gate stays in force. Autonomy
124
+ suppresses *trivial* questions only; git-shape decisions are
125
+ blocking. Stop and ask.
126
+ evidence:
127
+ - .agent-src.uncompressed/rules/scope-control.md#git-operations--permission-gated
128
+ - .agent-src.uncompressed/rules/autonomous-execution.md#blocking--still-ask-regardless-of-personalautonomy
129
+
130
+ - id: autonomy-x-commit-policy
131
+ rules: [commit-policy, autonomous-execution]
132
+ relation: overrides
133
+ conflict: >-
134
+ Autonomy is `on` and the agent could plausibly "just commit" after
135
+ a green verification step.
136
+ resolution: >-
137
+ `commit-policy` Iron Law forbids both committing AND asking about
138
+ committing unless one of the four exceptions applies. Autonomy
139
+ does not add a fifth exception.
140
+ evidence:
141
+ - .agent-src.uncompressed/rules/commit-policy.md#the-iron-law
142
+ - .agent-src.uncompressed/rules/autonomous-execution.md#commit-policy--see-commit-policy