agent-directives 0.1.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 (57) hide show
  1. package/README.md +385 -0
  2. package/directives/adaptive-routing.md +361 -0
  3. package/directives/architecture-boundaries.md +223 -0
  4. package/directives/codebase-navigation.md +325 -0
  5. package/directives/context-handoff.md +220 -0
  6. package/directives/error-memory.md +169 -0
  7. package/directives/exploration-mode.md +266 -0
  8. package/directives/session-decisions.md +193 -0
  9. package/directives/specification-driven-development.md +278 -0
  10. package/directives/task-framing.md +154 -0
  11. package/directives/test-driven-development.md +305 -0
  12. package/directives/type-driven-development.md +173 -0
  13. package/directives/verification.md +266 -0
  14. package/directives/workspace-isolation.md +219 -0
  15. package/dist/cli.d.ts +3 -0
  16. package/dist/cli.d.ts.map +1 -0
  17. package/dist/cli.js +232 -0
  18. package/dist/cli.js.map +1 -0
  19. package/dist/context-audit.d.ts +30 -0
  20. package/dist/context-audit.d.ts.map +1 -0
  21. package/dist/context-audit.js +75 -0
  22. package/dist/context-audit.js.map +1 -0
  23. package/dist/install.d.ts +18 -0
  24. package/dist/install.d.ts.map +1 -0
  25. package/dist/install.js +28 -0
  26. package/dist/install.js.map +1 -0
  27. package/dist/manifest.d.ts +25 -0
  28. package/dist/manifest.d.ts.map +1 -0
  29. package/dist/manifest.js +29 -0
  30. package/dist/manifest.js.map +1 -0
  31. package/dist/prompt.d.ts +3 -0
  32. package/dist/prompt.d.ts.map +1 -0
  33. package/dist/prompt.js +29 -0
  34. package/dist/prompt.js.map +1 -0
  35. package/dist/targets.d.ts +10 -0
  36. package/dist/targets.d.ts.map +1 -0
  37. package/dist/targets.js +32 -0
  38. package/dist/targets.js.map +1 -0
  39. package/manifest.json +387 -0
  40. package/package.json +74 -0
  41. package/skills/architecture-boundary-reviewer/SKILL.md +228 -0
  42. package/skills/code-reviewer/SKILL.md +77 -0
  43. package/skills/codebase-health-reviewer/SKILL.md +234 -0
  44. package/skills/harness-hooks-reviewer/SKILL.md +159 -0
  45. package/skills/implementation-task-planner/SKILL.md +205 -0
  46. package/skills/mcp-integration-reviewer/SKILL.md +157 -0
  47. package/skills/product-requirements-writer/SKILL.md +205 -0
  48. package/skills/production-readiness-reviewer/SKILL.md +240 -0
  49. package/skills/self-audit/SKILL.md +134 -0
  50. package/skills/spec-reviewer/SKILL.md +304 -0
  51. package/skills/subagent-driven-development/SKILL.md +236 -0
  52. package/skills/systematic-debugging/SKILL.md +313 -0
  53. package/skills/test-reviewer/SKILL.md +293 -0
  54. package/templates/AGENTS.md +120 -0
  55. package/templates/CLAUDE.md +115 -0
  56. package/templates/copilot-instructions.md +116 -0
  57. package/templates/decision-log.md +44 -0
@@ -0,0 +1,169 @@
1
+ ---
2
+ name: error-memory
3
+ description: Captures repeated mistakes in durable error memory only when recurrence and prevention criteria are met.
4
+ version: 1.0.0
5
+ required: false
6
+ category: memory
7
+ tools:
8
+ - claude
9
+ - codex
10
+ triggers:
11
+ - repeated-mistakes
12
+ - error-memory
13
+ - post-task-learning
14
+ routing:
15
+ load: conditional
16
+ ---
17
+
18
+ # Error Memory Directive
19
+
20
+ **When to load:** Load this directive when setting up a new project or when writing to the error memory file for the first time in a session.
21
+
22
+ ## MANDATORY: Document Repeated Mistakes in ERRORS.md
23
+
24
+ ---
25
+
26
+ ## When to Write an Error Entry
27
+
28
+ Write an error entry when ALL of the following are true:
29
+
30
+ 1. The agent made a mistake that reached a commit, PR, or significant draft
31
+ 2. A human corrected it, or the agent caught it during VERIFY/GATES
32
+ 3. The mistake is likely to recur in future sessions (not a one-off typo)
33
+ 4. The prevention strategy is non-obvious — a future agent wouldn't
34
+ automatically avoid it
35
+
36
+ **The test:** "Would a fresh agent in a new session make this same mistake?"
37
+
38
+ If yes, write the entry. If no (obvious bug, one-off slip), skip it.
39
+
40
+ ---
41
+
42
+ ## When NOT to Write an Error Entry
43
+
44
+ Do NOT write an error entry for:
45
+
46
+ - Mistakes already caught by existing linter rules or CI checks
47
+ - One-off typos or copy-paste errors
48
+ - Mistakes mandated by unclear requirements (the requirements were the problem)
49
+ - Anything a type checker would catch on its own
50
+ - Mistakes the agent self-corrected before committing (no recurrence risk)
51
+
52
+ ---
53
+
54
+ ## File Location and Format
55
+
56
+ ```
57
+ docs/ERRORS.md
58
+ ```
59
+
60
+ Single file, not per-error files. Errors are cheap to scan in bulk and the file
61
+ stays small (entries get retired as they're automated away).
62
+
63
+ ### Structure of an Entry
64
+
65
+ Each entry in `docs/ERRORS.md` contains these fields:
66
+
67
+ - **Error: [Short descriptive name]** — the pattern, not the agent
68
+ - **Frequency**: N occurrences — triggers automation at 5+
69
+ - **Severity**: High | Medium | Low — production impact
70
+ - **Last Occurrence**: YYYY-MM-DD — recency signal
71
+ - **Symptom**: What you see when the error manifests
72
+ - **Bad Pattern**: The actual mistake (concrete code, not abstract description)
73
+ - **Correct Pattern**: The right way (also concrete code)
74
+ - **Prevention**: Actionable steps (e.g., "Enable X rule", "Check Y before Z")
75
+
76
+ Example entry:
77
+
78
+ ## Error: Missing await on Promises
79
+
80
+ **Frequency**: 12 occurrences | **Severity**: High | **Last Occurrence**: 2026-01-20
81
+
82
+ **Symptom**: UnhandledPromiseRejectionWarning; function returns Promise instead of value
83
+
84
+ **Bad Pattern**: `const user = getUserById(id); console.log(user.email)`
85
+
86
+ **Correct Pattern**: `const user = await getUserById(id); console.log(user.email)`
87
+
88
+ **Prevention**: 1. Enable appropriate linter rules (e.g., @typescript-eslint/no-floating-promises for TypeScript projects) 2. Add pre-commit hook
89
+
90
+ ---
91
+
92
+ ---
93
+
94
+ ## When to Read ERRORS.md
95
+
96
+ During the codebase survey/orientation phase, after loading types and test
97
+ names, load relevant error entries for the domain you're working in.
98
+
99
+ Do not load the entire file. Use progressive disclosure — grep for
100
+ `## Error:` headings, then read the relevant entry by line range.
101
+
102
+ **Before implementation starts** (after initial orientation, before
103
+ implementation), the agent should have relevant error patterns in context.
104
+ This is the "don't do these things" layer that complements the "do it this
105
+ way" layer from types and tests.
106
+
107
+ ---
108
+
109
+ ## Monthly Review Process
110
+
111
+ Each month, the first agent session after the 1st should check the review date
112
+ in `docs/ERRORS.md`. If the last review is 30+ days old, run the review:
113
+
114
+ 1. **Sort by frequency** — highest-count errors first
115
+ 2. **Errors at 5+ occurrences**: Automate the prevention
116
+ - Can a linter rule catch it? → Create or enable one
117
+ - Can a type guard catch it? → Add one
118
+ - Can CI catch it? → Add a check
119
+ 3. **Errors at 1-2 occurrences with no recurrence in 30+ days**: Consider
120
+ retiring. The agent learned, or the codebase changed.
121
+ 4. **Update prevention strategies** — if a new rule or check was added,
122
+ note it in the entry
123
+
124
+ **The goal isn't zero errors. It's zero repeated errors.**
125
+
126
+ ### Retirement
127
+
128
+ When an error is fully automated (a linter rule exists, CI catches it, or a
129
+ type guard prevents it), mark it:
130
+
131
+ ## Error: [name] (RETIRED)
132
+
133
+ **Retired**: YYYY-MM-DD
134
+ **Automated by**: `no-floating-promise` rule (v1.2.0)
135
+
136
+ Retired entries stay in the file for reference but are skipped during codebase
137
+ orientation.
138
+
139
+ ---
140
+
141
+ ## Connection to Other Directives
142
+
143
+ ```
144
+ codebase-navigation guidance ← loads error entries during survey phase
145
+ session-decisions ← captures why choices were made (not mistakes)
146
+ verification ← catches errors before merge (not memory)
147
+ error memory (this directive) ← remembers mistakes to prevent recurrence
148
+ ```
149
+
150
+ ### Compacting Pipeline Integration
151
+
152
+ During the compact step (every 5+ tasks, per codebase-navigation guidance),
153
+ check:
154
+
155
+ ```
156
+ Compacting checklist (extended):
157
+ □ Session digest (current context)
158
+ □ Pending work and active constraints
159
+ □ Decision logs for qualifying decisions
160
+ □ Error entries for qualifying mistakes ← NEW
161
+ □ Discard exploration context
162
+ ```
163
+
164
+ If a task produced a corrected mistake that meets the error entry criteria,
165
+ write it during compacting while the details are fresh.
166
+
167
+ ---
168
+
169
+ _This directive ensures mistakes compound into guardrails instead of repeating._
@@ -0,0 +1,266 @@
1
+ ---
2
+ name: exploration-mode
3
+ description: Supports investigation and option discovery before committing to an implementation approach.
4
+ version: 1.0.0
5
+ required: true
6
+ category: workflow
7
+ tools:
8
+ - claude
9
+ - copilot
10
+ - codex
11
+ - cursor
12
+ triggers:
13
+ - explore
14
+ - investigate
15
+ - compare-options
16
+ - uncertain-approach
17
+ routing:
18
+ load: conditional
19
+ ---
20
+
21
+ # Exploration Mode Directive
22
+
23
+ **When to load:** Load this directive when the user wants to investigate, think through, or explore a problem before committing to an implementation approach. Also load when the user says "explore," "investigate," "think about," "what if," or "I'm not sure how to approach."
24
+
25
+ This directive governs a distinct pre-implementation phase: structured
26
+ investigation and thinking. It is not codebase navigation (how to search) or
27
+ task framing (how to scope work). It governs the **stance** the agent takes
28
+ when the right answer is not yet clear.
29
+
30
+ **Do not implement during exploration.** The purpose is to develop
31
+ understanding, surface options, and identify risks — not to write code.
32
+
33
+ ---
34
+
35
+ ## The Stance
36
+
37
+ During exploration, the agent adopts a specific posture:
38
+
39
+ - **Curious, not prescriptive** — Ask questions that emerge from what the user said. Don't follow a script or funnel toward a predetermined answer.
40
+ - **Open threads, not interrogations** — Surface multiple interesting directions and let the user follow what resonates.
41
+ - **Grounded in reality** — Explore the actual codebase when relevant. Don't just theorize. Read files, trace dependencies, map architecture.
42
+ - **Visual when it helps** — Use ASCII diagrams, tables, and structured layouts to clarify thinking. A good diagram is worth many paragraphs.
43
+ - **Patient** — Don't rush to conclusions. Let the shape of the problem emerge from investigation.
44
+ - **Comfortable with uncertainty** — If something is unclear, say so. Unresolved questions are a valid output of exploration.
45
+
46
+ ---
47
+
48
+ ## What Exploration Produces
49
+
50
+ Exploration may produce any combination of:
51
+
52
+ ### Problem Understanding
53
+
54
+ - Clarified problem statement
55
+ - Identified constraints (explicit and implicit)
56
+ - Surfaced assumptions that need validation
57
+ - Reframed problem from a different angle
58
+
59
+ ### Architecture Mapping
60
+
61
+ ```
62
+ ┌─────────────────────────────────────────────┐
63
+ │ CURRENT SYSTEM │
64
+ ├─────────────────────────────────────────────┤
65
+ │ │
66
+ │ ┌──────────┐ ┌──────────┐ │
67
+ │ │ Module A │───▶│ Module B │ │
68
+ │ └──────────┘ └────┬─────┘ │
69
+ │ │ │
70
+ │ ▼ │
71
+ │ ┌──────────┐ │
72
+ │ │ Module C │ │
73
+ │ └──────────┘ │
74
+ │ │
75
+ └─────────────────────────────────────────────┘
76
+ ```
77
+
78
+ - How existing components relate to the area under investigation
79
+ - Integration points and dependencies
80
+ - Data flow and control flow
81
+ - Where complexity lives
82
+
83
+ ### Option Comparison
84
+
85
+ | Criterion | Option A | Option B | Option C |
86
+ |------------- |-------------- |-------------- |-------------- |
87
+ | Complexity | Low | Medium | High |
88
+ | Performance | Fast | Adequate | Fast |
89
+ | Maintenance | Easy | Moderate | Hard |
90
+ | Risk | Low | Medium | High |
91
+
92
+ - Multiple approaches with tradeoffs made visible
93
+ - Constraints that favor or disfavor each option
94
+ - Recommendation (if asked) with reasoning
95
+
96
+ ### Risk Surface
97
+
98
+ - What could go wrong
99
+ - Hidden complexity not obvious from the initial description
100
+ - Dependencies that might block or complicate the work
101
+ - Assumptions that, if wrong, would change the approach
102
+
103
+ ---
104
+
105
+ ## The Flow
106
+
107
+ Exploration is not a fixed sequence. It is a conversation that follows
108
+ interesting threads. The general pattern:
109
+
110
+ ### 1. Listen
111
+
112
+ Receive what the user brings. It might be:
113
+ - A vague idea ("I'm thinking about adding real-time collaboration")
114
+ - A specific problem ("The auth system is a mess")
115
+ - A question ("Should we use Postgres or SQLite?")
116
+ - A blockage ("I'm stuck on the OAuth integration")
117
+
118
+ ### 2. Ground
119
+
120
+ Before theorizing, check what actually exists:
121
+ - Read relevant source files (using codebase-navigation discipline)
122
+ - Trace the relevant architecture
123
+ - Identify current patterns and conventions
124
+ - Find existing constraints
125
+
126
+ ### 3. Investigate
127
+
128
+ Follow the thread that seems most productive:
129
+ - Ask clarifying questions that emerge from the codebase
130
+ - Challenge assumptions — both the user's and your own
131
+ - Reframe the problem if the current framing seems incomplete
132
+ - Find analogies or prior art in the codebase
133
+
134
+ ### 4. Surface
135
+
136
+ Present what you've found:
137
+ - Diagrams for architecture and flow
138
+ - Tables for comparisons and tradeoffs
139
+ - Lists for risks, unknowns, and open questions
140
+ - Plain language for insights and recommendations
141
+
142
+ ### 5. Summarize (optional)
143
+
144
+ When the exploration feels like it's crystallizing, offer a summary:
145
+
146
+ ```
147
+ ## What We Figured Out
148
+
149
+ **The problem**: [crystallized understanding]
150
+
151
+ **The approach**: [if one emerged]
152
+
153
+ **Open questions**: [if any remain]
154
+
155
+ **Next steps** (if ready):
156
+ - Proceed to task framing and implementation
157
+ - Keep exploring: follow a specific thread
158
+ ```
159
+
160
+ This summary is optional. Sometimes the thinking IS the value.
161
+
162
+ ---
163
+
164
+ ## Handling Different Entry Points
165
+
166
+ ### Vague Idea
167
+
168
+ ```
169
+ User: I'm thinking about adding real-time collaboration
170
+
171
+ Agent: [maps the problem space, surfaces options at different
172
+ complexity levels, asks where the user's head is at]
173
+ ```
174
+
175
+ Do not jump to "here's how we implement CRDTs." Explore the spectrum first.
176
+
177
+ ### Specific Problem
178
+
179
+ ```
180
+ User: The auth system is a mess
181
+
182
+ Agent: [reads the actual auth code, maps the tangle,
183
+ identifies specific pain points, asks which one burns most]
184
+ ```
185
+
186
+ Do not prescribe a full rewrite. Find the specific tangle first.
187
+
188
+ ### Comparison Question
189
+
190
+ ```
191
+ User: Should we use Postgres or SQLite?
192
+
193
+ Agent: [asks about context and constraints, then evaluates
194
+ against the actual use case, not generic pros/cons]
195
+ ```
196
+
197
+ Generic comparisons are boring. Ground them in the project's reality.
198
+
199
+ ### Mid-Implementation Blockage
200
+
201
+ ```
202
+ User: I'm stuck — the OAuth integration is more complex than expected
203
+
204
+ Agent: [reads the code where they're stuck, traces the actual
205
+ complexity, surfaces options for simplifying or working around it]
206
+ ```
207
+
208
+ Do not just suggest reading the docs. Investigate the actual blocker.
209
+
210
+ ---
211
+
212
+ ## Exploration vs. Other Directives
213
+
214
+ | Directive | What it governs | Phase |
215
+ | -------------------- | -------------------------- | ---------------- |
216
+ | Codebase Navigation | How to search efficiently | Orientation |
217
+ | Task Framing | How to scope work | Planning |
218
+ | Exploration Mode | How to think through | Investigation |
219
+ | Test-Driven Dev | How to implement | Implementation |
220
+ | Verification | How to confirm correctness | Review |
221
+
222
+ Exploration sits between navigation and framing. You orient (navigation),
223
+ investigate (exploration), scope (framing), implement (TDD), verify
224
+ (verification).
225
+
226
+ ---
227
+
228
+ ## Guardrails
229
+
230
+ | Guardrail | Why |
231
+ | --------------------------- | -------------------------------------------------------------- |
232
+ | No implementation code | Writing code commits to an approach before exploration is done |
233
+ | No auto-capture of insights | Offer to save findings; let the user decide |
234
+ | No forced structure | Exploration is conversational; let patterns emerge naturally |
235
+ | No rushing to conclusions | Premature solutions miss better options |
236
+ | No faking understanding | If something is unclear, dig deeper rather than guessing |
237
+
238
+ ---
239
+
240
+ ## Forbidden Patterns
241
+
242
+ | Pattern | Why Forbidden |
243
+ | ------------------------------------------- | ----------------------------------------------------------- |
244
+ | Writing implementation code during exploration | Commits to approach before investigation is complete |
245
+ | Following a fixed question checklist | Every exploration is different; scripts kill curiosity |
246
+ | Prescribing a solution in the first response | Premature solutions skip the most valuable thinking |
247
+ | Theorizing without reading the codebase | Ungrounded advice is noise |
248
+ | Producing a required artifact | Exploration may end with clarity, a decision, or more questions — all are valid |
249
+
250
+ ---
251
+
252
+ ## When Exploration Ends
253
+
254
+ There is no required ending. Exploration might:
255
+
256
+ - **Flow into task framing** — "I have a clear picture now. Want me to frame the task?"
257
+ - **Result in a decision** — "We should go with Option B because..."
258
+ - **Just provide clarity** — User has what they need, moves on
259
+ - **Continue later** — "We can pick this up anytime"
260
+
261
+ The signal that exploration is done: the user asks to implement something,
262
+ or a clear path forward has emerged and been confirmed.
263
+
264
+ ---
265
+
266
+ _This directive applies to any investigation, brainstorm, or "what if" conversation. It is optional for straightforward tasks with obvious implementations._
@@ -0,0 +1,193 @@
1
+ ---
2
+ name: session-decisions
3
+ description: Captures durable decisions for repo policy, architecture, workflow, and cross-cutting conventions.
4
+ version: 1.0.0
5
+ required: false
6
+ category: memory
7
+ tools:
8
+ - claude
9
+ - codex
10
+ triggers:
11
+ - policy-change
12
+ - architecture-decision
13
+ - workflow-change
14
+ - cross-cutting-convention
15
+ routing:
16
+ load: conditional
17
+ ---
18
+
19
+ # Session Decisions Directive
20
+
21
+ **When to load:** Load this directive when making changes that affect repo policy, architecture, contributor workflow, or cross-cutting conventions.
22
+
23
+ ## MANDATORY: Capture Durable Decisions at Task Completion
24
+
25
+ Before closing out any task where you set or changed a durable repo/process
26
+ policy, architectural constraint, or cross-cutting code/documentation
27
+ convention, you MUST write a decision log entry if the reasoning would not be
28
+ obvious later. This is non-negotiable.
29
+
30
+ ---
31
+
32
+ ## When to Write a Decision Log
33
+
34
+ Write a decision log when ALL of the following are true:
35
+
36
+ 1. You set, changed, or explicitly confirmed a durable decision that affects repo policy, contributor workflow, architecture, or a cross-cutting convention
37
+ 2. You made a choice between two or more real alternatives
38
+ 3. The rejected alternatives were plausible (a reasonable agent might have chosen them)
39
+ 4. The reason for your choice is not obvious from the code, config, or document diff alone, and a future agent would likely spend real time re-deciding or accidentally reversing it without a log
40
+
41
+ **The test:** Ask yourself:
42
+
43
+ - "Will this decision still matter outside the file I changed?"
44
+ - "Would another reasonable agent revisit this tradeoff without extra context?"
45
+
46
+ If both are yes, write the log. If any of the criteria above are false, no log
47
+ is needed.
48
+
49
+ ---
50
+
51
+ ## When NOT to Write a Decision Log
52
+
53
+ Do NOT write a decision log for:
54
+
55
+ - Choices mandated by a directive (e.g., using TDD, defining types first, following naming conventions)
56
+ - Naming choices where no alternatives were explicitly considered
57
+ - Standard library usage over custom code (always prefer standard — not a decision)
58
+ - Bug fixes (the decision is obvious: fix it correctly)
59
+ - Routine implementation details where the code clearly explains itself
60
+ - Single-file or one-off refactors that do not establish an ongoing convention
61
+ - Local code-level choices that do not affect future work elsewhere in the repo
62
+
63
+ Most code-level decisions do **not** need a log. Code decisions qualify only
64
+ when they create a reusable rule for later work, such as an architectural
65
+ boundary, an authoring convention, or a cross-cutting policy.
66
+
67
+ ---
68
+
69
+ ## When to Read Existing Decision Logs
70
+
71
+ Before changing repo policy, contributor workflow, architecture, or any
72
+ cross-cutting code or documentation convention:
73
+
74
+ 1. Scan the frontmatter in `docs/decisions/*.md`
75
+ 2. Filter for entries with `status: active`
76
+ 3. Match on `domain`, `triggers`, and `applies_to`
77
+ 4. Open only the matching logs unless you need a superseded record for history
78
+
79
+ Decision logs are for progressive disclosure. Do not load every file in
80
+ `docs/decisions/` by default.
81
+
82
+ ---
83
+
84
+ ## File Naming
85
+
86
+ ```
87
+ docs/decisions/YYYY-MM-DD-<topic>.md
88
+ ```
89
+
90
+ Use today's date with zero-padded month and day. Use a short kebab-case topic
91
+ that names the **decision domain**, not the outcome.
92
+
93
+ ```
94
+ docs/decisions/2026-04-05-error-reporting-format.md ✅ names the domain
95
+ docs/decisions/2026-04-05-chose-discriminated-unions.md ✗ names the outcome
96
+ docs/decisions/2026-04-05-refactor.md ✗ too vague
97
+ ```
98
+
99
+ ---
100
+
101
+ ## Frontmatter
102
+
103
+ Every decision log MUST begin with YAML frontmatter so agents can classify and
104
+ retrieve the right records before reading the full body.
105
+
106
+ ```yaml
107
+ ---
108
+ date: YYYY-MM-DD
109
+ task: one-line task description
110
+ domain: short-kebab-case-decision-domain
111
+ kind: repo-policy | process | architecture | code-convention
112
+ scope: repo | cross-cutting | subtree
113
+ status: active | superseded | retired
114
+ triggers:
115
+ - when this record should be read
116
+ applies_to:
117
+ - path/or/glob
118
+ supersedes: []
119
+ ---
120
+ ```
121
+
122
+ ### Required Fields
123
+
124
+ | Field | Purpose |
125
+ | ------------ | ------------------------------------------------------------------------ |
126
+ | `date` | The date the decision was recorded |
127
+ | `task` | The task this decision arose from |
128
+ | `domain` | Stable retrieval key for the decision area |
129
+ | `kind` | Broad class of decision |
130
+ | `scope` | Whether the decision applies repo-wide, cross-cuttingly, or to a subtree |
131
+ | `status` | Whether the decision is current |
132
+ | `triggers` | Short phrases describing when agents should read this log |
133
+ | `applies_to` | Paths or globs affected by the decision |
134
+ | `supersedes` | Older decision records replaced by this one |
135
+
136
+ Keep frontmatter short and operational. If a field does not help an agent decide
137
+ whether to read the file, it does not belong here.
138
+
139
+ This directive is the canonical source for the retrieval workflow and
140
+ frontmatter schema. Other docs should link here instead of duplicating the full
141
+ rules.
142
+
143
+ ---
144
+
145
+ ## Template
146
+
147
+ Copy the decision log template from `templates/decision-log.md` (or
148
+ `docs/decisions/TEMPLATE.md` in your project), fill in every section. Delete
149
+ placeholder text. Do not leave `[brackets]` in the output.
150
+
151
+ ### Required Sections
152
+
153
+ Every decision log MUST contain all five sections:
154
+
155
+ | Section | What it contains |
156
+ | ------------------------- | ----------------------------------------------------------------------------------------- |
157
+ | **Title** | One sentence starting with a verb. Names the domain, not the outcome. |
158
+ | **Context** | 2–4 sentences on the problem, constraints, and why this was a real choice. |
159
+ | **Decision** | One paragraph. Specific reasoning — name the properties that made this option preferable. |
160
+ | **Rejected Alternatives** | At least one entry. Name the alternative and the specific reason it was disqualified. |
161
+ | **Consequences** | Easier / Harder / Watch for / **Unlearn** — what this decision makes true going forward. |
162
+
163
+ **The Unlearn entry in Consequences:** After writing Easier / Harder / Watch for,
164
+ ask: *"What assumption worked for this task that should NOT be carried forward
165
+ as a default?"* If the answer is "none," skip it. If an assumption was valid
166
+ here but context-dependent (e.g., "we denormalized because reads dominate — but
167
+ that won't hold if writes increase"), name it. Future sessions encountering
168
+ this decision log should verify the Unlearn entry still holds before inheriting
169
+ the approach.
170
+
171
+ ---
172
+
173
+ ## Forbidden Patterns
174
+
175
+ | Pattern | Why it's forbidden |
176
+ | ------------------------------------------------- | --------------------------------------------- |
177
+ | "We decided to use the best approach" | Not a decision — no alternative named |
178
+ | Leaving `[placeholder]` text in the output | Decision log is incomplete — do not commit it |
179
+ | Logging choices already captured in code comments | Duplication — code comments are sufficient |
180
+ | Writing the log before finishing the task | You don't know the consequences yet |
181
+
182
+ ---
183
+
184
+ ## Quick Reference
185
+
186
+ | Question | Answer |
187
+ | --------------------------------------------------------------------------------------------- | ------------------------------------------------------------------- |
188
+ | Does this set repo policy, workflow, architecture, or a cross-cutting convention? | If no → skip the log |
189
+ | Did I choose between plausible alternatives? | If no → skip the log |
190
+ | Is the reasoning obvious from the diff, and would a future agent avoid re-deciding it anyway? | If yes → skip the log |
191
+ | Before making a cross-cutting change, what do I do first? | Scan decision-log frontmatter and read only matching active entries |
192
+ | Where does the file go? | `docs/decisions/YYYY-MM-DD-<topic>.md` |
193
+ | What template? | Use the decision log template from `templates/decision-log.md` |