@event4u/agent-config 8.7.0 → 8.9.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 (171) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +109 -222
  3. package/CONTRIBUTING.md +25 -0
  4. package/README.md +7 -4
  5. package/dist/agent-src/commands/agent-handoff.md +39 -2
  6. package/dist/agent-src/commands/research/deep.md +8 -0
  7. package/dist/agent-src/commands/research/report.md +7 -0
  8. package/dist/agent-src/commands/roadmap/create.md +12 -0
  9. package/dist/agent-src/commands/roadmap/process-full.md +31 -5
  10. package/dist/agent-src/contexts/communication/rules-auto/think-before-action-mechanics.md +30 -1
  11. package/dist/agent-src/contexts/execution/auto-orchestration-activation.md +1 -1
  12. package/dist/agent-src/contexts/execution/orchestration-benchmark-gate.md +28 -16
  13. package/dist/agent-src/contexts/execution/orchestration-telemetry.md +36 -5
  14. package/dist/agent-src/contexts/execution/roadmap-process-loop.md +37 -0
  15. package/dist/agent-src/contexts/execution/subagent-topologies.md +34 -0
  16. package/dist/agent-src/contexts/execution/verification-mechanics.md +9 -9
  17. package/dist/agent-src/rules/active-remediation.md +92 -0
  18. package/dist/agent-src/rules/agent-authority.md +1 -1
  19. package/dist/agent-src/rules/broken-access-control.md +106 -0
  20. package/dist/agent-src/rules/communication-through-line.md +42 -0
  21. package/dist/agent-src/rules/decision-revisit-gate.md +8 -0
  22. package/dist/agent-src/rules/delegation-policy.md +5 -0
  23. package/dist/agent-src/rules/direct-answers.md +1 -1
  24. package/dist/agent-src/rules/downstream-changes.md +1 -0
  25. package/dist/agent-src/rules/external-code-graph-interop.md +65 -0
  26. package/dist/agent-src/rules/git-history-discipline.md +18 -0
  27. package/dist/agent-src/rules/lethal-trifecta-guard.md +6 -1
  28. package/dist/agent-src/rules/minimal-safe-diff.md +66 -1
  29. package/dist/agent-src/rules/non-destructive-by-default.md +3 -0
  30. package/dist/agent-src/rules/prefer-enums-over-literals.md +65 -0
  31. package/dist/agent-src/rules/question-not-instruction.md +76 -0
  32. package/dist/agent-src/rules/senior-engineering-discipline.md +82 -0
  33. package/dist/agent-src/rules/think-before-action.md +1 -0
  34. package/dist/agent-src/rules/tool-safety.md +8 -0
  35. package/dist/agent-src/rules/untrusted-input-defense.md +87 -22
  36. package/dist/agent-src/scripts/update_roadmap_progress.ts +2 -1
  37. package/dist/agent-src/skills/accessibility-auditor/SKILL.md +19 -0
  38. package/dist/agent-src/skills/ai-code-blindspots/SKILL.md +112 -0
  39. package/dist/agent-src/skills/ai-code-blindspots/evals/triggers.json +52 -0
  40. package/dist/agent-src/skills/authz-review/SKILL.md +21 -4
  41. package/dist/agent-src/skills/code-review/SKILL.md +2 -0
  42. package/dist/agent-src/skills/command-writing/SKILL.md +53 -40
  43. package/dist/agent-src/skills/dcf-modeling/evals/domain-truth.json +29 -0
  44. package/dist/agent-src/skills/deep-reading-analyst/SKILL.md +1 -0
  45. package/dist/agent-src/skills/dependency-upgrade/SKILL.md +20 -0
  46. package/dist/agent-src/skills/design-intelligence/SKILL.md +49 -12
  47. package/dist/agent-src/skills/design-review/SKILL.md +29 -15
  48. package/dist/agent-src/skills/design-system-capture/SKILL.md +63 -24
  49. package/dist/agent-src/skills/forecasting/evals/domain-truth.json +29 -0
  50. package/dist/agent-src/skills/frontend-render-security/SKILL.md +104 -0
  51. package/dist/agent-src/skills/frontend-render-security/evals/triggers.json +52 -0
  52. package/dist/agent-src/skills/markitdown/SKILL.md +1 -0
  53. package/dist/agent-src/skills/mcp/SKILL.md +24 -0
  54. package/dist/agent-src/skills/mcp-builder/SKILL.md +9 -1
  55. package/dist/agent-src/skills/memory-consolidation/SKILL.md +55 -4
  56. package/dist/agent-src/skills/roadmap-writing/SKILL.md +46 -5
  57. package/dist/agent-src/skills/runway-cognition/evals/domain-truth.json +29 -0
  58. package/dist/agent-src/skills/scenario-modeling/evals/domain-truth.json +29 -0
  59. package/dist/agent-src/skills/secrets-management/SKILL.md +7 -0
  60. package/dist/agent-src/skills/skill-writing/SKILL.md +12 -3
  61. package/dist/agent-src/skills/subagent-orchestration/SKILL.md +27 -33
  62. package/dist/agent-src/skills/supply-chain-intake/SKILL.md +112 -0
  63. package/dist/agent-src/skills/supply-chain-intake/evals/triggers.json +52 -0
  64. package/dist/agent-src/skills/testing-anti-patterns/SKILL.md +72 -2
  65. package/dist/agent-src/skills/ui-component-architect/SKILL.md +9 -0
  66. package/dist/agent-src/skills/unit-economics-modeling/evals/domain-truth.json +40 -0
  67. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  68. package/dist/agent-src/templates/roadmaps.md +60 -0
  69. package/dist/cli/registry.js +3 -0
  70. package/dist/cli/registry.js.map +1 -1
  71. package/dist/discovery/deprecation-report.md +1 -1
  72. package/dist/discovery/discovery-manifest.json +268 -46
  73. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  74. package/dist/discovery/discovery-manifest.summary.md +4 -4
  75. package/dist/discovery/orphan-report.md +1 -1
  76. package/dist/discovery/packs.json +18 -8
  77. package/dist/discovery/trust-report.md +11 -11
  78. package/dist/discovery/workspaces.json +16 -6
  79. package/dist/install/install.mjs +141 -3
  80. package/dist/mcp/awesome-mcp-servers.row.md +1 -1
  81. package/dist/mcp/mcp-cloudflare-catalogue.json +1 -1
  82. package/dist/mcp/registry-manifest.json +4 -4
  83. package/dist/router.json +1 -1
  84. package/dist/scripts/_lib/claude_builtin_names.js +145 -0
  85. package/dist/scripts/_lib/claude_builtin_names.js.map +1 -0
  86. package/dist/scripts/condense.js +14 -0
  87. package/dist/scripts/condense.js.map +1 -1
  88. package/dist/server/schemas/settings.js +2 -1
  89. package/dist/server/schemas/settings.js.map +1 -1
  90. package/docs/CLAIMS.md +58 -2
  91. package/docs/architecture.md +3 -3
  92. package/docs/archive/CHANGELOG-pre-8.9.0.md +306 -0
  93. package/docs/benchmark.md +113 -0
  94. package/docs/catalog.md +32 -5
  95. package/docs/contracts/command-clusters.md +18 -0
  96. package/docs/contracts/design-artifact-verification.md +124 -0
  97. package/docs/contracts/injected-block-authenticity-model.md +66 -0
  98. package/docs/contracts/mcp-tool-inventory.md +31 -30
  99. package/docs/decisions/ADR-061-corpus-grounding-layer.md +13 -0
  100. package/docs/decisions/ADR-105-automatic-subagent-orchestration.md +6 -0
  101. package/docs/decisions/ADR-116-memory-tripwire-activation-path.md +11 -2
  102. package/docs/decisions/ADR-117-subagents-auto-default-on.md +88 -0
  103. package/docs/decisions/INDEX.md +1 -0
  104. package/docs/experiences/content_creator.md +2 -0
  105. package/docs/experiences/finance.md +2 -0
  106. package/docs/experiences/founder.md +2 -0
  107. package/docs/experiences/ops.md +2 -0
  108. package/docs/featured-skills.md +2 -2
  109. package/docs/getting-started-by-role.md +1 -1
  110. package/docs/getting-started.md +1 -1
  111. package/docs/governance-advantage.md +1 -1
  112. package/docs/guidelines/agent-infra/asking-and-brevity-examples.md +27 -0
  113. package/docs/guidelines/agent-infra/emphasis-budget.md +45 -0
  114. package/docs/guidelines/agent-infra/memory-access.md +12 -0
  115. package/docs/guidelines/agent-infra/simplicity-and-goal-demos.md +151 -0
  116. package/docs/guidelines/agent-infra/tool-description-as-policy.md +35 -0
  117. package/docs/guidelines/design-canon.md +1 -0
  118. package/docs/proof.md +60 -3
  119. package/docs/release-runbook.md +138 -0
  120. package/docs/second-brain-scope.md +116 -0
  121. package/docs/succession.md +80 -0
  122. package/package.json +2 -2
  123. package/src/agent-src/scripts/update_roadmap_progress.ts +2 -1
  124. package/src/config/agent-settings.template.yml +25 -6
  125. package/src/scripts/_dispatch.bash +27 -0
  126. package/src/scripts/_lib/claude_builtin_names.ts +148 -0
  127. package/src/scripts/_lib/file_slicer.ts +117 -0
  128. package/src/scripts/_lib/lexical_index.ts +155 -0
  129. package/src/scripts/_lib/orchestration_gate.ts +12 -8
  130. package/src/scripts/_lib/orchestration_record.ts +170 -0
  131. package/src/scripts/_lib/orchestration_savings.ts +180 -0
  132. package/src/scripts/_lib/retrieval_sanitize.ts +71 -0
  133. package/src/scripts/_lib/security_lint.ts +1 -0
  134. package/src/scripts/_lib/stat_index.ts +98 -0
  135. package/src/scripts/benchmark.ts +122 -0
  136. package/src/scripts/build_proof.ts +51 -0
  137. package/src/scripts/chat_history.ts +79 -7
  138. package/src/scripts/check_memory.ts +2 -0
  139. package/src/scripts/check_quality_regression.ts +51 -0
  140. package/src/scripts/check_roadmap_trackable.ts +3 -2
  141. package/src/scripts/condense.ts +14 -0
  142. package/src/scripts/discovery_graph.ts +0 -0
  143. package/src/scripts/domain_soundness_status.ts +236 -0
  144. package/src/scripts/external_sources_denylist.json +4 -1
  145. package/src/scripts/generate_index.ts +17 -0
  146. package/src/scripts/hot_context_hook.ts +47 -2
  147. package/src/scripts/install-hooks.sh +25 -0
  148. package/src/scripts/install.ts +35 -2
  149. package/src/scripts/learning_sidecar.ts +0 -0
  150. package/src/scripts/lint_agent_skill_names.ts +29 -0
  151. package/src/scripts/lint_behavioural_eval_freshness.ts +140 -0
  152. package/src/scripts/lint_knowledge_scale.ts +4 -3
  153. package/src/scripts/lint_roadmap_complexity.ts +124 -0
  154. package/src/scripts/lint_versioned_cache.ts +195 -0
  155. package/src/scripts/mcp_server/consumer_tool_catalog.json +23 -3
  156. package/src/scripts/mcp_server/tools.ts +182 -1
  157. package/src/scripts/measure_lexical_ranking.ts +173 -0
  158. package/src/scripts/memory_lookup.ts +0 -0
  159. package/src/scripts/memory_replay.ts +285 -0
  160. package/src/scripts/orchestration_record.ts +140 -0
  161. package/src/scripts/orchestration_savings_report.ts +124 -0
  162. package/src/scripts/schemas/domain-truth.schema.json +94 -0
  163. package/src/scripts/schemas/evals.schema.json +113 -0
  164. package/src/scripts/schemas/skill.schema.json +4 -0
  165. package/src/scripts/score_domain_truth.ts +192 -0
  166. package/src/scripts/second_brain_retrieval.ts +278 -0
  167. package/src/scripts/second_brain_run.ts +341 -0
  168. package/src/scripts/second_brain_score.ts +186 -0
  169. package/src/scripts/session_memory_index.ts +94 -0
  170. package/src/scripts/skill_eval_coverage.ts +318 -0
  171. package/src/server/schemas/settings.ts +5 -2
@@ -45,6 +45,14 @@ ceiling on what the package may ever become.
45
45
  `telegraph-speak`, thin-projector trimming) that rejects a change on
46
46
  cost grounds alone.
47
47
  - An ADR whose decision is being cited as a blocker for the current change.
48
+ - A **hard structural cap** (kernel size, per-domain persona cap, rich-skill
49
+ ratio). A change that genuinely *qualifies* to cross the cap — e.g. a new
50
+ rule that truly meets the kernel-membership inclusion criteria — triggers a
51
+ **cap-raise proposal + maintainer/council approval**, never a silent
52
+ downgrade of the rule to fit the old number (e.g. demoting a must-always-fire
53
+ rule to `auto` just because the kernel says 9). Fitting the cap is not a
54
+ reason to weaken a qualifying rule; but a rule that does **not** meet the
55
+ criteria stays out — the cap is not the reason, the criteria are.
48
56
 
49
57
  ## What to do when it fires
50
58
 
@@ -72,6 +72,11 @@ primitive → run in-session (clean no-op).
72
72
  session (an application of the N=3 budget, no new mechanism); an ordered
73
73
  slice never dispatches before its declared parent's return is verified.
74
74
  Both per [`subagent-steering`](../contexts/execution/subagent-steering.md).
75
+ 6. **Record** telemetry after each dispatch — run `orchestration_record`
76
+ (one validated line: spawn_count, token_delta + provenance, tier, task_class)
77
+ per [`orchestration-telemetry`](../contexts/execution/orchestration-telemetry.md)
78
+ § Emit. Agent-behavioral capture the savings report reads; skipping it leaves
79
+ the value-of-orchestration question unmeasured.
75
80
 
76
81
  ## Scope — does NOT
77
82
 
@@ -30,7 +30,7 @@ THE MORE LOAD-BEARING THE CLAIM, THE HARDER YOU VERIFY.
30
30
  WHEN VERIFICATION IS NOT WORTH THE COST → ASK.
31
31
  ```
32
32
 
33
- Severity tiers (High = load-bearing · Medium = project-shape · Low = idioms), per-tier verification actions, and "just guess" override: [`asking-and-brevity-examples`](../docs/guidelines/agent-infra/asking-and-brevity-examples.md).
33
+ Severity tiers, per-tier verification actions, "just guess" override, **no duration estimates**, and **never cite the rule** when declining: [`asking-and-brevity-examples`](../docs/guidelines/agent-infra/asking-and-brevity-examples.md).
34
34
 
35
35
  **Live-state facts — never from memory.** Git/PR merge/branch/sync/existence state is High-severity and decays silently (branch already merged, PR already closed, `main` already ahead). NEVER assert "merged / not merged / pending / still open / already in `main` / out of scope" — or any branch/sync/existence claim — from memory, a roadmap note, an earlier turn, or a recalled memory. Run the live check FIRST (`git log --first-parent origin/main`, `git branch -r --contains <ref>`, `gh pr view <n> --json state,mergedAt,baseRefName`); a state question is self-answering (per [`git-workflow`](../skills/git-workflow/SKILL.md)). Same for any external system that changes behind you (CI run, deploy, remote queue).
36
36
 
@@ -77,3 +77,4 @@ After completing all downstream changes:
77
77
  2. **No broken tests** — run the project test suite (Pest / PHPUnit, Jest / Vitest, pytest, `go test ./...`, `cargo test`).
78
78
  3. **No broken types / signatures** — project's type-checker (PHPStan / Psalm, TypeScript, mypy / pyright, `go vet`, `cargo check`).
79
79
  4. **No stale references** — grep for the old name / namespace / import path to confirm zero results.
80
+ 5. **No own-orphans** — the same sweep applied to the new diff: identifiers whose last reference disappeared in a file this diff touched are removed in the same diff (see [`minimal-safe-diff § Own-orphan cleanup`](minimal-safe-diff.md#own-orphan-cleanup)); pre-existing dead code stays.
@@ -0,0 +1,65 @@
1
+ ---
2
+ type: "auto"
3
+ tier: "2a"
4
+ description: "When the repo ships an external code-graph index (a graph.json-shaped artifact or a SCIP index), query IT first for codebase-structure questions — do not grep from scratch"
5
+ triggers:
6
+ - keyword: "scip"
7
+ - keyword: "code-graph"
8
+ - keyword: "code graph"
9
+ - phrase: "graph.json"
10
+ - phrase: "who calls"
11
+ - phrase: "call graph"
12
+ - phrase: "find references"
13
+ - phrase: "where is this used"
14
+ applies_to_user_types:
15
+ - "developer"
16
+ - "maintainer"
17
+ workspaces: [engineering]
18
+ packs: [meta]
19
+ ---
20
+
21
+ # External Code-Graph Interop
22
+
23
+ Some repos commit a pre-built code-intelligence index — a `graph.json`-shaped
24
+ artifact or a SCIP index (`index.scip`, `*.scip`). When one exists, it already
25
+ answers "who calls X", "where is Y used", "what does this import" far more
26
+ precisely than a fresh `grep`. This suite is an **orchestrator, not a
27
+ competitor**: query the existing index first.
28
+
29
+ ## The rule
30
+
31
+ ```
32
+ REPO SHIPS A CODE-GRAPH INDEX (graph.json-shaped OR a SCIP index)
33
+ → QUERY IT FIRST FOR CODEBASE-STRUCTURE QUESTIONS. GREP IS THE FALLBACK,
34
+ NOT THE FIRST MOVE. NEVER REBUILD WHAT THE INDEX ALREADY ANSWERS.
35
+ ```
36
+
37
+ ## When it fires
38
+
39
+ A codebase-structure question (call graph, references, usages, import graph)
40
+ AND the repo contains a detectable index:
41
+
42
+ - a SCIP index — `index.scip` or any `*.scip` at the repo root or a conventional
43
+ index directory;
44
+ - a `graph.json`-shaped artifact (a committed code-graph export).
45
+
46
+ ## What to do
47
+
48
+ 1. **Detect** the index (its path is the concrete pointer; the specific tool
49
+ that produced it is named in the repo's own docs, not here).
50
+ 2. **Query it** for the relationship the user asked about.
51
+ 3. **Fall back to `grep`/read** only for what the index does not cover, and say
52
+ so ("the index has no entry for X, so I grepped").
53
+
54
+ ## When NOT to fire
55
+
56
+ - No such index in the repo — normal `grep`/read is the right first move.
57
+ - The question is about content/semantics, not code structure.
58
+
59
+ ## See also
60
+
61
+ - [`discovery_graph`](../scripts/discovery_graph.ts) — this suite's OWN artefact
62
+ relation-graph (`affected`/`explain`); the external code-graph is the
63
+ *source-code* analogue this rule defers to for code questions.
64
+ - [`think-before-action`](think-before-action.md) — analyze with the best
65
+ available tool before grepping blind.
@@ -120,6 +120,24 @@ If either stop fires and resolution is not immediate → tag the state (`git tag
120
120
 
121
121
  `--amend` on the *current local* commit before the first push is the narrow exception (treated as continuing to compose the commit, not rewriting history).
122
122
 
123
+ ## Amend-after-hook-failure trap (data-loss)
124
+
125
+ When a **pre-commit hook fails, the commit did NOT happen** — no new commit
126
+ object was created. A reflexive `git commit --amend` at that point does not
127
+ "retry the commit"; it rewrites the **previous, already-good** commit,
128
+ destroying that work. This is the one place the narrow `--amend` exception
129
+ above turns into data loss.
130
+
131
+ Recovery — never amend after a hook failure:
132
+
133
+ 1. Read the hook output and **fix the cause** (the lint/test/format failure).
134
+ 2. **Re-stage** the fix (`git add`).
135
+ 3. Create a **NEW commit** (`git commit`, not `--amend`) — the prior commit was
136
+ never overwritten and must stay intact.
137
+
138
+ Recovery procedures live next to this mechanism in
139
+ [`skill:git-workflow`](../skills/git-workflow/SKILL.md).
140
+
123
141
  ## Why this rule exists
124
142
 
125
143
  Interactive rebase + fixup loops generate disproportionate token cost on every iteration: re-running CI per replayed commit, resolving the same content conflict in three derived files (`.condensation-hashes.json`, `dist/router.json`, `.windsurfrules`), losing the working tree to a stash that silently re-introduces older state. A single conflict can burn the budget of an entire feature.
@@ -21,7 +21,11 @@ packs: [engineering-base]
21
21
  Prompt injection is not solvable at the model layer (OWASP LLM01). It is
22
22
  contained **architecturally**: a tool/skill/command becomes dangerous only when
23
23
  it combines all three legs of the *lethal trifecta*. Remove one leg and an
24
- injected instruction can do no consequential harm.
24
+ injected instruction can do no consequential harm. This is the agentic attack
25
+ surface OWASP's Agentic Security Initiative (ASI Top 10) catalogues — excessive
26
+ agency, tool misuse, confused-deputy data exfiltration; the Least-Agency
27
+ discipline in [`tool-safety`](tool-safety.md) is the same defence applied to the
28
+ tool grant.
25
29
 
26
30
  ## The Iron Law
27
31
 
@@ -75,6 +79,7 @@ backstop.
75
79
  ## See also
76
80
 
77
81
  - [`untrusted-input-defense`](untrusted-input-defense.md) — data/instruction separation, spotlighting.
82
+ - [`tool-safety`](tool-safety.md) — Least Agency: the narrowest tool grant breaks the egress leg by construction (OWASP ASI excessive-agency).
78
83
  - [`security-sensitive-stop`](security-sensitive-stop.md) — threat-model before editing a sensitive surface.
79
84
  - [`non-destructive-by-default`](non-destructive-by-default.md) — the human-in-the-loop egress floor.
80
85
  - [`threat-modeling`](../skills/threat-modeling/SKILL.md) — abuse-case enumeration.
@@ -74,6 +74,54 @@ task scope · dependency bumps "because it was close to the cache".
74
74
  Ask. A minimal diff plus one follow-up is cheaper than a sprawling diff the
75
75
  reviewer has to untangle.
76
76
 
77
+ ## Anti-over-engineering
78
+
79
+ The smallest change is also the least *abstract* and least *speculative* one:
80
+
81
+ - **Three similar lines beat a premature abstraction.** Do not extract a helper
82
+ / generic / config layer to dedupe two or three call sites — inline
83
+ repetition is cheaper to read and change than the wrong abstraction. Per new
84
+ abstraction: **cite the second caller — or inline it.**
85
+ - **No speculative features.** Nothing beyond what was asked: no
86
+ configurability or "flexibility" nobody requested, no parameters with one
87
+ call site, no error handling for scenarios that cannot occur in this
88
+ codebase.
89
+ - **The rewrite trigger.** If the change could be half the size without losing
90
+ behavior, rewrite before presenting. Self-check: *"Would a senior engineer
91
+ call this overcomplicated?"* — if yes, simplify.
92
+ - **No tombstones.** Delete removed code completely — no `_oldName` renames,
93
+ no `// removed X` / `// no longer used` markers, no dead re-export shims kept
94
+ "for safety". Git history is the tombstone.
95
+ - **No docstrings/comments on untouched code.** Do not annotate code the diff
96
+ does not change.
97
+
98
+ Wrong/right pairs for each ban:
99
+ [`simplicity-and-goal-demos`](../docs/guidelines/agent-infra/simplicity-and-goal-demos.md)
100
+ — the demos are the recognition surface; match your diff against the *right*
101
+ column before presenting.
102
+
103
+ **Not adopted (council):** the source's "validate only at system boundaries /
104
+ trust internal code" clause is **rejected** — internal code can be wrong, and
105
+ "trust" is not a testing strategy. Keep validating internal invariants; this
106
+ fold is about *diff shape*, not about dropping internal checks.
107
+
108
+ ## Own-orphan cleanup
109
+
110
+ Your diff cleans up exactly the mess it made — nothing more:
111
+
112
+ - An identifier (import, variable, function, parameter) is an **own-orphan**
113
+ iff its **last reference disappeared in a file THIS diff touched**. Remove
114
+ it in the same diff — it traces to the task; leaving it is an incomplete
115
+ change, not restraint.
116
+ - If **any reference survives in a file the diff did not touch**, the
117
+ identifier is **pre-existing debt** — leave it untouched and surface it via
118
+ [`active-remediation`](active-remediation.md)'s note-and-ask ladder, never
119
+ delete drive-by.
120
+ - The check is mechanical: after editing, grep each identifier your hunks
121
+ stopped referencing; zero remaining references and the last one was yours →
122
+ own-orphan (delete); otherwise → note. (`downstream-changes` runs the same
123
+ sweep for renames — this is that sweep applied to the new diff.)
124
+
77
125
  ## Break-glass exception
78
126
 
79
127
  This rule stays in force during production incidents. "Break-glass mode"
@@ -98,4 +146,21 @@ After the incident, open a **follow-up PR** for any scope that was
98
146
  intentionally deferred and reference the break-glass commit in its
99
147
  description.
100
148
 
101
- See also: `scope-control` · `downstream-changes` · `think-before-action` · `preservation-guard` · `verify-before-complete`.
149
+ ## Bounded remediation carve-out
150
+
151
+ The default stands: no drive-by edits, no opportunistic refactors. The one
152
+ bounded exception — a **small, task-aligned security/correctness fix in code
153
+ the current task already touches** — is governed by
154
+ [`active-remediation`](active-remediation.md). It is permitted inline **only**
155
+ when ALL hold: same request path / module, ≤ ~10 changed lines in one
156
+ production file (plus its test file), no public-API / response-shape change, no dependency bump or migration,
157
+ and its verification (e.g. the negative test) ships in the same commit.
158
+ Anything outside those five conditions is **not** this carve-out — it is
159
+ note + ask per `active-remediation`. This never licenses reformatting,
160
+ renames, dependency bumps, or version upgrades (a syntax-idiom modernization
161
+ is allowed only under `active-remediation`'s version-gated, behavior-preserving
162
+ clause; a dependency/version bump stays ask-only). The sole case that may
163
+ interrupt is a **live cross-user/tenant data exposure** ([`broken-access-control`](broken-access-control.md)) —
164
+ fix-now-if-small, else stop and surface; never defer it silently.
165
+
166
+ See also: `scope-control` · `downstream-changes` · `think-before-action` · `preservation-guard` · `verify-before-complete` · [`active-remediation`](active-remediation.md) · [`broken-access-control`](broken-access-control.md).
@@ -32,9 +32,12 @@ Triggers below require explicit user confirmation **on this turn** — not from
32
32
  | **Production data / infra** | prod DB writes / migrations, prod config, secrets rotation, IAM / role / policy, DNS, anything in a `prod`-scoped path or pipeline |
33
33
  | **Whimsical / unscoped bulk deletion** | `rm -rf <dir>`, `git rm -r`, glob deletes, `DROP TABLE`, `TRUNCATE`, `git reset --hard` past unpushed work — when **not required** by the task (task-aligned WIP deletions allowed, below) |
34
34
  | **Commit containing bulk deletions or infra changes** | diff removes a directory, deletes ≥5 unrelated files, or touches Terraform/Pulumi/k8s/Ansible/cloud-config — surface the diff + confirm even when [`commit-policy`](commit-policy.md) authorizes |
35
+ | **Irreversible external action** | **send** / **publish** / **post** / **purchase** / **submit** — an outbound, externally-visible, or money-moving action the user cannot un-see: send an email/message, publish or post content, submit a form, place an order or payment. Also gated by [`scope-control`](scope-control.md) external-comms; named here so the Hard Floor lists the actual buttons |
35
36
 
36
37
  Standing "just keep going" + next step crosses the floor → STOP, surface it (one numbered-options block per [`user-interaction`](user-interaction.md)), wait.
37
38
 
39
+ **Never act while asking.** The ask and the action are strictly sequential: surface the confirmation, then WAIT for the answer. Never fire the action in the same turn you ask for it — no do-then-ask race, no "I went ahead and…". **The approval names the exact object** so the user confirms the real thing, not a category: a download names filename + size + source; a purchase names amount + card-last4 + total; a send names recipient + subject. Shape per [`user-interaction`](user-interaction.md) numbered-options.
40
+
38
41
  ## Not in scope — deterministic regeneration
39
42
 
40
43
  Output regenerated from a tracked source (condensation, code-gen, formatters, lock-files) is reversible — **not destructive** ([`autonomous-execution`](autonomous-execution.md)). Per-file diff approval is theater.
@@ -0,0 +1,65 @@
1
+ ---
2
+ type: "auto"
3
+ tier: "2b"
4
+ alwaysApply: false
5
+ description: "Modeling a field/property with multiple non-boolean states — prefer an enum over bare string/numeric literals; found old-style literals where an enum fits → note, finish the task, ask after"
6
+ triggers:
7
+ - intent: "modeling a field with multiple states"
8
+ - intent: "adding a status or type field"
9
+ - keyword: "enum"
10
+ - keyword: "status"
11
+ - keyword: "kind"
12
+ - keyword: "category"
13
+ - keyword: "migration"
14
+ workspaces: [engineering]
15
+ packs: [engineering-base]
16
+ ---
17
+
18
+ # Prefer Enums Over Literal Values
19
+
20
+ When a field/property holds **two or more non-boolean states** — strings (`'active'`, `'pending'`, `'archived'`) or meaningful numeric codes (priority `1`/`2`/`3`, tier levels) — model it as an **enum**, not a bare string/int. An enum names the value in code (readable), makes it greppable + safe to rename, gives exhaustiveness/typo safety, and makes filtering + editing relations far easier than raw literals scattered across the codebase.
21
+
22
+ ## The Iron Law
23
+
24
+ ```
25
+ A FIELD WITH MULTIPLE NON-BOOLEAN STATES IS AN ENUM, NOT A BARE STRING OR MAGIC NUMBER.
26
+ NAME THE VALUE IN CODE — NEVER SCATTER RAW LITERALS ('active', 2, 'PENDING') ACROSS THE CODEBASE.
27
+ FOUND OLD-STYLE LITERALS WHERE AN ENUM FITS? NOTE IT, FINISH THE TASK, THEN ASK — NEVER REFACTOR MID-FLOW.
28
+ ```
29
+
30
+ ## Prefer an enum when
31
+
32
+ - A multi-state **string** field — `status`, `type`, `role`, `kind`, `category`, `state` — with 2+ distinct values.
33
+ - A **numeric code that is a label, not a quantity** — priority `1/2/3`, severity levels, tiers.
34
+ - Any **closed set of values the code branches on** (`match` / `switch` / `if ===`).
35
+
36
+ ## Do NOT force an enum when
37
+
38
+ - A boolean (`true`/`false`) — a flag, not an enum.
39
+ - Open/unbounded free text — name, description, URL, comment.
40
+ - A genuine numeric **quantity** used in arithmetic — price, count, age, bytes.
41
+ - A set owned entirely by a volatile external system — unless you map it to your own enum at the boundary.
42
+
43
+ ## How (framework-neutral)
44
+
45
+ - Use the language's native construct: backed enum (PHP `enum Status: string`), string-literal union or `enum` (TypeScript), `enum.Enum` (Python), an enum/`CHECK`-constrained column or lookup table + FK (database).
46
+ - Persist the enum's backing value; reference the **named case** in code, never the raw literal.
47
+
48
+ ## Found old-style literals where an enum fits — defer, do not disrupt
49
+
50
+ Apply exactly this order so the current task's flow is never interrupted:
51
+
52
+ 1. **While doing the actual task**, if you pass code using raw string/numeric literals for a multi-state field where an enum fits, do **NOT** refactor inline (a drive-by edit — see `minimal-safe-diff`) and do **NOT** stop to ask mid-flow.
53
+ 2. **Note the site** — file:line + the literal set — in your working notes.
54
+ 3. **After the actual task is delivered**, surface the noted candidates as **one** numbered-options prompt (per `user-interaction`): list each enum-candidate site, ask whether to replace — all / selected / none.
55
+ 4. **Only on an explicit yes** do you refactor, as a **separate change** with its own scope (`downstream-changes` applies — update every caller, migration, test, serializer).
56
+
57
+ If the task itself is *adding* the field, apply the enum from the start — no deferral; the defer-and-ask flow is only for pre-existing literals you encounter.
58
+
59
+ ## See also
60
+
61
+ - [`improve-before-implement`](improve-before-implement.md) — the Strategy sniff test when a second branch on the same enum/string discriminator signals the enum should become a Strategy (`docs/guidelines/php/patterns/strategy.md`).
62
+ - [`minimal-safe-diff`](minimal-safe-diff.md) — why you don't drive-by-refactor the literals you find.
63
+ - [`scope-control`](scope-control.md) — replacing an existing pattern needs the user's yes first.
64
+ - [`active-remediation`](active-remediation.md) — the general fix-now / note-and-ask / follow-up-PR ladder; the enum defer-and-ask above is one instance of it.
65
+ - [`senior-engineering-discipline`](senior-engineering-discipline.md) — the "generalize, don't overfit" anchor this extends.
@@ -0,0 +1,76 @@
1
+ ---
2
+ type: "auto"
3
+ tier: "1"
4
+ description: "A question is a request for an ANSWER, never authorization to act — answer first; never treat 'why…?' / 'can you…?' / 'what do you think?' as a green light to build, change, or execute"
5
+ triggers:
6
+ - phrase: "warum"
7
+ - phrase: "wieso"
8
+ - phrase: "weshalb"
9
+ - keyword: "why"
10
+ - phrase: "what do you think"
11
+ - phrase: "was denkst du"
12
+ - phrase: "was hältst du"
13
+ - phrase: "geht das"
14
+ - phrase: "kannst du"
15
+ - phrase: "sollte ich"
16
+ - phrase: "should i"
17
+ - phrase: "is it possible"
18
+ applies_to_user_types:
19
+ - "creator"
20
+ - "developer"
21
+ - "maintainer"
22
+ - "operator"
23
+ - "researcher"
24
+ workspaces: [engineering]
25
+ packs: [meta]
26
+ ---
27
+
28
+ # Question Is Not an Instruction
29
+
30
+ ```
31
+ A QUESTION ASKS FOR AN ANSWER. IT IS NOT AUTHORIZATION TO ACT.
32
+ "WARUM…?" / "WHY…?" / "WAS DENKST DU?" / "GEHT DAS?" / "KANNST DU…?"
33
+ → ANSWER FIRST. NEVER BUILD, CHANGE, COMMIT, OR EXECUTE ON A QUESTION.
34
+ RUNNING OFF ON A QUESTION IS A RULE VIOLATION, NOT INITIATIVE.
35
+ ```
36
+
37
+ The user asks two distinct kinds of turn. Confusing them is the failure this
38
+ rule exists to stop:
39
+
40
+ | Turn shape | Signal | Correct response |
41
+ |---|---|---|
42
+ | **Question** | interrogative — `warum`, `wieso`, `why`, `?`, `was denkst du`, `geht das`, `kannst du`, `sollte ich`, `is it possible` | **Answer it.** Explain, reflect, surface the trade-off. Do NOT execute. |
43
+ | **Instruction** | imperative — `mach`, `bau`, `implementiere`, `fix`, `erstelle`, `run`, `füge hinzu` | Execute per the usual authority gates. |
44
+
45
+ ## The trap
46
+
47
+ A question that expresses **frustration or challenge** — *"Warum hast du nur
48
+ eine Phase gemacht?"*, *"Wieso hast du das nicht anders gelöst?"* — is STILL a
49
+ question. It demands an explanation, not a burst of corrective action. Reading
50
+ the frustration as *"go fix everything now"* and charging off is the canonical
51
+ violation: the user loses their answer AND gets unrequested work.
52
+
53
+ ## What to do
54
+
55
+ 1. **Answer the literal question** — directly, honestly, first token.
56
+ 2. If the answer implies work *might* follow, **stop after the answer** and let
57
+ the user decide. Offer numbered options if a decision is genuinely theirs
58
+ (per [`user-interaction`](user-interaction.md)), but do not start the work.
59
+ 3. Only a subsequent **imperative** turn authorizes execution.
60
+
61
+ ## When it does NOT fire
62
+
63
+ - The turn is imperative (an instruction), even if phrased politely
64
+ (*"kannst du bitte X machen"* where X is clearly the ask + context makes it a
65
+ directive) — but when genuinely ambiguous between question and instruction,
66
+ treat it as a **question** and ask which the user meant (one line).
67
+ - A rhetorical question inside a larger instruction (*"why not just do X? do
68
+ it"*) — the trailing imperative governs.
69
+
70
+ ## See also
71
+
72
+ - [`user-interrupt-priority`](user-interrupt-priority.md) — a new *instruction*
73
+ mid-flight; this rule is its complement for a *question* mid-flight.
74
+ - [`ask-when-uncertain`](ask-when-uncertain.md) — when the agent should ask;
75
+ this rule is about honouring the user's question, not the agent's.
76
+ - [`direct-answers`](direct-answers.md) — answer the substance, no deflection.
@@ -0,0 +1,82 @@
1
+ ---
2
+ type: "auto"
3
+ tier: "2b"
4
+ alwaysApply: false
5
+ description: "Writing/generating code — generalize (no overfit or tautological tests), supply the invisible cross-cutting controls the prompt didn't name, never invent an API/field/package"
6
+ triggers:
7
+ - intent: "writing or generating code"
8
+ - intent: "implementing a feature"
9
+ - keyword: "implement"
10
+ - keyword: "endpoint"
11
+ - keyword: "query"
12
+ - keyword: "migration"
13
+ - keyword: "component"
14
+ - keyword: "seeder"
15
+ - keyword: "dependency"
16
+ - keyword: "refactor"
17
+ routes_to:
18
+ - "skill:ai-code-blindspots"
19
+ - "skill:frontend-render-security"
20
+ - "skill:supply-chain-intake"
21
+ - "skill:testing-anti-patterns"
22
+ workspaces: [engineering]
23
+ packs: [engineering-base]
24
+ ---
25
+
26
+ # Senior Engineering Discipline
27
+
28
+ Dominant failure mode of AI-written code isn't ignorance — **omission**. Model writes happy-path code satisfying the literal task + passing shallow tests, silently drops the invisible cross-cutting controls a senior supplies from unstated context. Baseline (2025 studies): a large share of AI-generated code ships a known vulnerability even at high syntax-correctness, and automation bias makes devs trust it *more* while it's *less* safe. Write like a senior: general not overfit; invisible controls present; verified against real sources, not memory. Act like a senior **owner**, not a passive typist — work in the interest of the product, the user, and the company, especially on security and quality; see a problem → react (fix it if small and task-aligned, else ask — per [`active-remediation`](active-remediation.md)) — never look away.
29
+
30
+ ## The Iron Law
31
+
32
+ ```
33
+ CODE AND TESTS EXPRESS THE GENERAL RULE — NEVER OVERFIT TO A FIXED CASE.
34
+ SUPPLY THE INVISIBLE CROSS-CUTTING CONTROLS THE PROMPT DID NOT NAME.
35
+ NEVER INVENT AN API, FIELD, OR PACKAGE — VERIFY IT AGAINST A REAL SOURCE.
36
+ THE HAPPY PATH THAT PASSES ONE TEST IS NOT A FINISHED CHANGE.
37
+ ```
38
+
39
+ ## Three obligations, every time you write code
40
+
41
+ ### 1. Generalize — never overfit
42
+
43
+ - Implementation expresses the general rule, not a special case that happens to satisfy the example. Don't hardcode a derivable value; don't branch on one literal where a rule covers all inputs; don't paste a near-duplicate where an existing abstraction fits.
44
+ - Tests assert **general behavior**, never a fixed value or narrow regex passing only for one crafted input. Derive expected from inputs + seeded/random data — never hardcode what the code emits. Cover happy **and** boundary (empty / null / max / Unicode) **and** error **and**, on security paths, an abuse case. Lone happy-path assertion = tautology. → `skill:testing-anti-patterns`.
45
+
46
+ ### 2. Cover the invisible controls for what you touched
47
+
48
+ Before done, assert the unmentioned cross-cutting control is present, matched to surface:
49
+
50
+ - **endpoint / route** → authorization + tenant scope + input validation + rate limit; state-changing → CSRF + audit. (`security-sensitive-stop` gates the sensitive ones.)
51
+ - **database query / migration** → parameterized (never string-built), tenant-scoped, transaction around multi-step writes, reversible migration (expand-contract, never bare `DROP`), index on filtered / FK columns.
52
+ - **user-controlled render** → output-encode; never `dangerouslySetInnerHTML` / `v-html` / `innerHTML` / `eval` on non-constant input; no secret / token in client code. → `skill:frontend-render-security`.
53
+ - **file / outbound fetch** → path-confinement + SSRF allow-list; validate server-side, never client-only.
54
+ - **infra / IaC** → least-privilege (no `Action:*` / `Resource:*`), encryption at rest, no `0.0.0.0/0` to mgmt / DB ports, no hardcoded creds; real scanner (Checkov / Trivy) is the backstop — `plan` succeeding isn't.
55
+ - **new dependency** → verify it exists on the real registry before install (hallucinated / "slopsquatted" packages ~1 in 5 AI suggestions); pin + lockfile; CVE scan. → `skill:supply-chain-intake`.
56
+
57
+ Full surface→controls table + backstop greps: → `skill:ai-code-blindspots`.
58
+
59
+ ### 3. Verify — never assert from memory
60
+
61
+ No completion claim without exercising the real path (running endpoint / UI / test — not "the code looks right"). "Defined but not wired" (middleware written, never connected to the route) = **not done**. **Before pushing code / opening a PR, run a changed-files static pass — type-checker + linter scoped to the diff (`tsc --noEmit` on the touched project, linter on changed files) — even when `quality.local_auto_run` is false: a narrow probe of your own diff, NOT the suppressed full pipeline. Letting a compile/lint error hit remote CI = completion claim without evidence (the beginner error this guards).** → `verify-before-complete`, `source-discovery-gate`.
62
+
63
+ ## When it fires
64
+
65
+ Any turn that writes, generates, or modifies code — feature, endpoint, query, migration, component, test, seeder, dependency, infra resource.
66
+
67
+ ## When NOT to fire
68
+
69
+ - Prose / docs / config-only edits, no code behavior.
70
+ - One-line rename / typo / formatting.
71
+ - User fenced the scope ("just this one line", "skip the checks").
72
+
73
+ ## Relationship to existing rules
74
+
75
+ Cross-cutting **anchor**; depth lives elsewhere and this routes to it. Doesn't replace `security-sensitive-stop` (threat-model before editing auth / billing / tenant / secret paths), `minimal-safe-diff` (smallest change), `think-before-action` (analyze first), `downstream-changes` (update all callers), `output-discipline` (no placeholder / TODO code). When one fires it wins on its subject; this adds the "generalized + invisible controls?" gate on top.
76
+
77
+ ## See also
78
+
79
+ - [`ai-code-blindspots`](../skills/ai-code-blindspots/SKILL.md) — surface→controls checklist + backstop greps.
80
+ - [`frontend-render-security`](../skills/frontend-render-security/SKILL.md), [`supply-chain-intake`](../skills/supply-chain-intake/SKILL.md) — the two precision gaps.
81
+ - [`testing-anti-patterns`](../skills/testing-anti-patterns/SKILL.md) — overfit / tautological assertions + test-data realism.
82
+ - [`security-sensitive-stop`](security-sensitive-stop.md), [`engineering-safety-floor`](engineering-safety-floor.md), [`verify-before-complete`](verify-before-complete.md), [`source-discovery-gate`](source-discovery-gate.md).
@@ -33,6 +33,7 @@ NO BLIND TRIAL-AND-ERROR. MAX 2 RETRIES PER APPROACH.
33
33
  - Prefer targeted inspection (jq, debugger, logs) over brute-force.
34
34
  - Always verify results after changes (API, UI, tests) using the concrete tool that exercises that surface — `curl` / Playwright / browser for HTTP and UI, debugger / `xdebug` for runtime frames, the project's test runner for behavior.
35
35
  - When behavior can be defined → prefer test-first / TDD.
36
+ - **Multi-step task → restate as verifiable success criteria first** (test that reproduces the bug, failing-then-passing check, before/after invariant) and plan `step → verify:` per step; a task whose success cannot be checked is a clarification trigger, not an execution trigger. Transformation table: [`think-before-action-mechanics § Goal-driven execution`](../contexts/communication/rules-auto/think-before-action-mechanics.md#goal-driven-execution--vague-ask--verifiable-goal).
36
37
  - Unclear requirements → precise clarification question, not hidden assumptions.
37
38
  - Refactors must preserve behavior, validation, examples, and anti-failure guidance unless explicitly changed.
38
39
  - Do NOT modify code you do not fully understand — read it, trace the flow, then change it.
@@ -16,6 +16,8 @@ packs: [meta]
16
16
 
17
17
  Tools are permissions, not abilities. Every tool access must be declared and reviewable.
18
18
 
19
+ **Least Agency** — grant the narrowest set of tools, scopes, and consequential actions the task needs; fewer capabilities per path = smaller blast radius when something (prompt injection, confused-deputy step, bug) goes wrong. Agent-tool application of least-privilege; maps to OWASP Agentic Security Initiative (ASI) excessive-agency / permission-management risks. In doubt, deny and ask — don't grant and hope.
20
+
19
21
  ## Constraints
20
22
 
21
23
  - **Deny by default** — no tool access unless explicitly listed in `allowed_tools`
@@ -43,3 +45,9 @@ If a skill needs a tool that is not in the registry:
43
45
  - Internal agent capabilities (file reading, code analysis) — these are not external tools
44
46
  - MCP server configuration — handled by the `mcp` skill
45
47
  - Credential management — handled by environment configuration
48
+
49
+ ## See also
50
+
51
+ - [`lethal-trifecta-guard`](lethal-trifecta-guard.md) — an over-broad tool grant is the standing egress leg of the lethal trifecta (OWASP ASI). Least Agency breaks that leg by construction.
52
+ - [`supply-chain-intake`](../skills/supply-chain-intake/SKILL.md) — the MCP-server intake gate applies this Least-Agency tool-grant review before a new server is connected.
53
+ - [`untrusted-input-defense`](untrusted-input-defense.md) — the least-agency + human-approval controls (OWASP LLM06 / ASI excessive-agency) that bound an untrusted-content path.