dld-kit 1.0.0-rc.1

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.
@@ -0,0 +1,284 @@
1
+ ---
2
+ name: dld-snapshot
3
+ description: Generate SNAPSHOT.md (detailed decision reference) and OVERVIEW.md (narrative synthesis with diagrams) from the decision log.
4
+ compatibility: Requires Node.js 20+ and git.
5
+ metadata:
6
+ dld-kit-version: "1.0.0-rc.1"
7
+ ---
8
+ <!-- Generated by dld-kit from templates/skills/dld-snapshot/SKILL.md. Do not edit: updating the skills overwrites this file. -->
9
+
10
+ # /dld-snapshot — Generate Spec Projection
11
+
12
+ You are generating documents that project the current state of the decision log into readable formats. The two built-in documents are always generated:
13
+
14
+ 1. **`decisions/SNAPSHOT.md`** — Detailed per-decision reference. Every active decision with its rationale and code references.
15
+ 2. **`decisions/OVERVIEW.md`** — High-level narrative synthesis with Mermaid diagrams. The document you'd hand to someone who needs to understand the system.
16
+
17
+ If the project's `dld.config.yaml` defines `snapshot_artifacts`, additional custom documents are generated as well (see Step 5).
18
+
19
+ ## Commands
20
+
21
+ The commands below run the `dld` CLI bundled with the dld-common skill, and need Node.js 20+. `<skill-dir>` stands for the absolute path of this skill's directory. If `<skill-dir>/../dld-common/scripts/dld.mjs` does not exist, stop and tell the user to install the dld-common skill: `npx skills add jimutt/dld-kit --skill dld-common`.
22
+
23
+ This skill uses: `detect-snapshot-changes`, `collect-active-decisions`, `update-snapshot-state`.
24
+
25
+ ## Prerequisites
26
+
27
+ Check that `dld.config.yaml` exists at the repo root. If not, tell the user to run `/dld-init` first and stop.
28
+
29
+ There must be at least one `accepted` decision. If all decisions are `proposed`, tell the user there's nothing to snapshot yet and suggest `/dld-implement`.
30
+
31
+ Check for uncommitted changes to decision files. Run `git status --porcelain -- <decisions_dir>/records/` and inspect the output. If there are unstaged or staged-but-uncommitted decision files, commit them first with a message like `"Update decision records"` before proceeding. This ensures the change detection script can rely on git history. Tell the user you are committing pending decision changes.
32
+
33
+ ## Step 1: Determine update mode
34
+
35
+ If the user's message includes `--full` (e.g., `/dld-snapshot --full`), skip change detection and use **full mode** for all documents.
36
+
37
+ Otherwise, run:
38
+
39
+ ```bash
40
+ node "<skill-dir>/../dld-common/scripts/dld.mjs" detect-snapshot-changes
41
+ ```
42
+
43
+ This outputs:
44
+ - `mode: full` — no prior snapshot state exists, or SNAPSHOT.md/OVERVIEW.md are missing. Proceed with full generation.
45
+ - `mode: incremental` — prior state exists. The output also includes:
46
+ - `new_decisions:` — comma-separated list of new accepted decision IDs (e.g., `DL-072, DL-073`)
47
+ - `modified_decisions:` — comma-separated list of existing decisions changed since last snapshot (status changes, content edits)
48
+ - `commit_range:` — the git range since last snapshot (e.g., `abc1234..HEAD`)
49
+
50
+ If mode is `incremental` but both `new_decisions` and `modified_decisions` are empty, tell the user nothing has changed since the last snapshot and stop.
51
+
52
+ ## Step 2: Collect active decisions
53
+
54
+ ```bash
55
+ node "<skill-dir>/../dld-common/scripts/dld.mjs" collect-active-decisions
56
+ ```
57
+
58
+ This outputs the full content of all `accepted` decisions, separated by `===DLD_DECISION_BOUNDARY===` markers. Parse the output to extract each decision's frontmatter and body. Use the project mode from `dld.config.yaml` (already checked in prerequisites) to determine the organization strategy.
59
+
60
+ ## Step 3: Generate or update SNAPSHOT.md
61
+
62
+ ### Full mode
63
+
64
+ Write `decisions/SNAPSHOT.md` from scratch using the template and rules below.
65
+
66
+ ### Incremental mode
67
+
68
+ Read the existing `decisions/SNAPSHOT.md` and apply targeted edits:
69
+
70
+ 1. **For each new decision:** Identify which group heading (`## Namespace` or `## Tag Group`) it belongs to. Insert the new `### DL-NNN: Title` section in the correct position (ascending ID order within the group). If the group heading doesn't exist yet, add a new `## Group` section.
71
+ 2. **For each modified decision:** Read its current status from the decision file.
72
+ - If now `superseded` or `deprecated`: remove its `### DL-NNN` section from the file. If the group becomes empty after removal, remove the group heading too.
73
+ - If still `accepted` but content changed: replace its `### DL-NNN` section with updated content.
74
+ - If it has a new `amends` relationship: add an `*Amended by: DL-YYY*` line to the target decision's section.
75
+ 3. **Update the header:** Adjust the "Active decisions" count, the "DL-001 through DL-XXX" range, and the date.
76
+
77
+ Do NOT rewrite the entire file. Use targeted edits to insert, remove, or modify only the affected sections.
78
+
79
+ ### Template
80
+
81
+ ```markdown
82
+ # System Snapshot
83
+
84
+ > Auto-generated from the decision log on YYYY-MM-DD. Do not edit manually.
85
+ > Use `/dld-snapshot` to regenerate. Source of truth: individual decision records.
86
+ >
87
+ > **Active decisions:** N (DL-001 through DL-XXX, excluding superseded/deprecated)
88
+
89
+ ---
90
+
91
+ ## <Namespace or Tag Group>
92
+
93
+ ### DL-NNN: <Title>
94
+ *Supersedes: DL-XXX* ← only if applicable
95
+ *Amends: DL-XXX* ← only if applicable
96
+ *Amended by: DL-YYY* ← only if another decision amends this one
97
+
98
+ <The Decision section from the record — what was decided. Copy verbatim or lightly condense.>
99
+
100
+ **Rationale:** <1-3 sentence summary of the Rationale section. Condense, don't copy verbatim.>
101
+
102
+ **Code:** `<path>` → `<symbol>`, `<path>`
103
+
104
+ ---
105
+
106
+ ### DL-NNN: <Title>
107
+ ...
108
+ ```
109
+
110
+ ### Organization rules
111
+
112
+ **Namespaced projects:** Primary grouping by namespace. Within each namespace, decisions listed by ID ascending (oldest first — they build on each other).
113
+
114
+ **Flat projects:** Group by tag. Decisions with multiple tags appear under their first/primary tag. Decisions with no tags go under a "General" section. Within each group, decisions listed by ID ascending.
115
+
116
+ ### Content rules
117
+
118
+ - Only include `accepted` decisions
119
+ - Skip `superseded`, `deprecated`, and `proposed` decisions entirely
120
+ - When a decision supersedes another (check the `supersedes` field in the YAML frontmatter), include a `*Supersedes: DL-XXX*` note
121
+ - When a decision amends another (check the `amends` field), include an `*Amends: DL-XXX*` note on the amending decision and an `*Amended by: DL-YYY*` note on the original decision
122
+ - The **Decision** section content should be copied directly or lightly condensed — this is the authoritative statement
123
+ - The **Rationale** should be condensed to 1-3 sentences — enough to understand *why*, not every detail
124
+ - **Code** references should list paths and symbols from the frontmatter `references` field
125
+ - If a decision has no Rationale section, omit the Rationale line
126
+ - If a decision has no references, omit the Code line
127
+
128
+ ## Step 4: Generate or update OVERVIEW.md
129
+
130
+ This is fundamentally different from SNAPSHOT.md. You are **synthesizing** across decisions to create a readable narrative that explains the system's current design. Think of it as the document you'd give a new team member or use to onboard an AI agent on the project.
131
+
132
+ ### Full mode
133
+
134
+ Write `decisions/OVERVIEW.md` from scratch using the template and guidelines below.
135
+
136
+ ### Incremental mode
137
+
138
+ Read the existing `decisions/OVERVIEW.md`. Identify which domain sections are affected by the new and modified decisions — look at their namespaces, tags, and the topics they cover. Then:
139
+
140
+ 1. **Update only the affected sections.** Rewrite each affected section to integrate new decisions or remove references to superseded/deprecated ones. Leave unaffected sections untouched.
141
+ 2. **Add new sections** if new decisions introduce a domain area not covered by existing sections.
142
+ 3. **Update diagrams** only if the changeset affects the relationships or components they depict.
143
+ 4. **Update the header** (decision count, date) and **Key Technical Choices** if any new decisions are cross-cutting.
144
+
145
+ **Maintaining appropriate abstraction:** The overview should remain a high-level narrative, not grow into a detailed specification. As you update sections, consider whether the overall document still reads as an overview. If adding new decisions makes a section too detailed or the document too long, condense older stable content to make room — summarize established decisions more aggressively to keep focus on what matters for understanding the system. If the document's section structure no longer properly organizes the content (e.g., a new cross-cutting concern spans multiple existing sections), restructure as needed — this may mean a larger rewrite of the document, which is appropriate when the system's shape has meaningfully changed.
146
+
147
+ ### Template
148
+
149
+ ```markdown
150
+ # System Overview
151
+
152
+ > Auto-generated narrative synthesis from N active decisions. Last updated YYYY-MM-DD.
153
+ > This document is derived from individual decision records — do not edit manually.
154
+ > Use `/dld-snapshot` to regenerate.
155
+
156
+ ## Architecture Overview
157
+
158
+ <If there are enough architectural decisions to warrant it, include a high-level Mermaid diagram showing key components and their relationships. Base this on the code references and decision content.>
159
+
160
+ ```mermaid
161
+ graph TD
162
+ A[Component A] --> B[Component B]
163
+ B --> C[Component C]
164
+ ```
165
+
166
+ ## <Namespace or Domain Area>
167
+
168
+ <Narrative prose synthesizing the decisions in this area. Write in present tense.
169
+ Explain what the system does and why, weaving together multiple decisions into
170
+ a coherent story. Reference decision IDs parenthetically, e.g., (DL-012).>
171
+
172
+ <If the decisions in this area describe a flow or process, include a Mermaid diagram:>
173
+
174
+ ```mermaid
175
+ sequenceDiagram
176
+ participant Client
177
+ participant API
178
+ participant PaymentGateway
179
+ ...
180
+ ```
181
+
182
+ <Continue with other areas...>
183
+
184
+ ## Decision Relationships
185
+
186
+ <Only include this section if there are supersession chains, amendment relationships, or closely related decision groups.
187
+ If no decisions supersede or amend others and there are no meaningful relationship clusters, omit this section entirely.>
188
+
189
+ ```mermaid
190
+ graph LR
191
+ DL-003 -->|superseded by| DL-012
192
+ DL-012 -.->|amends| DL-005
193
+ DL-012 -.->|related| DL-014
194
+ ```
195
+
196
+ ## Key Technical Choices
197
+
198
+ <Bullet-point summary of the most impactful cross-cutting decisions that don't
199
+ belong to a single area. E.g., "PostgreSQL for primary data store (DL-001)",
200
+ "All API input validated with Zod schemas (DL-008)".>
201
+ ```
202
+
203
+ ### Narrative guidelines
204
+
205
+ - **Write prose, not lists.** The snapshot already provides the structured listing. The overview should read like a design document.
206
+ - **Synthesize, don't enumerate.** Don't just list decisions — explain how they fit together. "The billing system uses banker's rounding for EU VAT calculations (DL-012), replacing the earlier truncation approach that caused reconciliation failures."
207
+ - **Use present tense.** Describe what the system *does*, not what was decided.
208
+ - **Reference decision IDs parenthetically.** Every claim should be traceable: "(DL-012)" after the relevant statement.
209
+ - **Include Mermaid diagrams where they add clarity.** Good candidates:
210
+ - Architecture/component diagrams when decisions span multiple components
211
+ - Sequence diagrams when decisions describe flows or protocols
212
+ - Relationship diagrams when there are supersession chains or amendment relationships
213
+ - Don't force diagrams if the decisions are simple or unrelated
214
+ - **Keep it proportional.** A project with 5 decisions needs a short overview. A project with 50 needs more structure. Scale the document to the content.
215
+ - **Group by namespace (namespaced projects) or by domain theme (flat projects).** For flat projects, identify natural domain groupings from tags and decision content.
216
+
217
+ ### Diagram guidelines
218
+
219
+ When creating Mermaid diagrams:
220
+ - Use `graph TD` or `graph LR` for architecture/component/relationship diagrams
221
+ - Use `sequenceDiagram` for flow/protocol diagrams
222
+ - Use `flowchart` for process/workflow diagrams
223
+ - Keep diagrams focused — show the relationships that decisions actually govern, not a complete system map
224
+ - Label edges with the nature of the relationship
225
+ - Reference relevant decision IDs in node labels or notes where helpful
226
+ - **Always quote node labels** with `["..."]` to avoid parse errors from special characters
227
+ - **Escape `@` as `#64;`** inside node labels and edge labels — raw `@` breaks Mermaid parsing
228
+ - **Use `<br/>` for line breaks** inside quoted labels — do not use `\n` or literal newlines
229
+ - **Avoid special characters** (`(`, `)`, `[`, `]`, `{`, `}`, `|`, `#`, `&`) in unquoted labels — use quoted labels or HTML entities instead
230
+
231
+ ## Step 5: Generate custom artifacts
232
+
233
+ Read the `snapshot_artifacts` key from `dld.config.yaml`. If the key is absent or the list is empty, skip this step entirely.
234
+
235
+ For each entry in `snapshot_artifacts`:
236
+
237
+ 1. **Validate the `title`:**
238
+ - Must end in `.md`. If not, warn the user and skip this artifact.
239
+ - Must not collide (case-insensitive) with reserved filenames: `SNAPSHOT.md`, `OVERVIEW.md`, `INDEX.md`. If it collides, warn the user and skip this artifact.
240
+
241
+ 2. **Generate `decisions/<title>`** using the collected decisions (from Step 2) as context and the `prompt` field as the generation instruction. The file must begin with this standard header:
242
+
243
+ ```markdown
244
+ # <Title without .md extension>
245
+
246
+ > Auto-generated from the decision log on YYYY-MM-DD. Do not edit manually.
247
+ > Use `/dld-snapshot` to regenerate.
248
+ ```
249
+
250
+ Followed by the content generated according to the prompt.
251
+
252
+ Keep track of which custom artifacts were successfully generated — you will need the list for Step 6 and Step 7.
253
+
254
+ ## Step 6: Update snapshot state
255
+
256
+ Pass any successfully generated custom artifact filenames as arguments:
257
+
258
+ ```bash
259
+ node "<skill-dir>/../dld-common/scripts/dld.mjs" update-snapshot-state [ARTIFACT_NAME...]
260
+ ```
261
+
262
+ For example, if custom artifacts `ONBOARDING.md` and `API-CONTRACTS.md` were generated:
263
+
264
+ ```bash
265
+ node "<skill-dir>/../dld-common/scripts/dld.mjs" update-snapshot-state ONBOARDING.md API-CONTRACTS.md
266
+ ```
267
+
268
+ If no custom artifacts were generated, run without arguments:
269
+
270
+ ```bash
271
+ node "<skill-dir>/../dld-common/scripts/dld.mjs" update-snapshot-state
272
+ ```
273
+
274
+ ## Step 7: Suggest next steps
275
+
276
+ > Snapshot generated:
277
+ > - `decisions/SNAPSHOT.md` — detailed reference (N active decisions)
278
+ > - `decisions/OVERVIEW.md` — narrative synthesis with diagrams
279
+ > - `decisions/<ARTIFACT>.md` — <one line per custom artifact generated, if any>
280
+ >
281
+ > Next steps:
282
+ > - Review the generated documents for accuracy
283
+ > - `/dld-decide` — record new decisions
284
+ > - `/dld-audit` — check for drift between decisions and code
@@ -0,0 +1,127 @@
1
+ ---
2
+ name: dld-status
3
+ description: Quick overview of the decision log state — counts by status, recent decisions, and run tracking info.
4
+ compatibility: No external dependencies.
5
+ metadata:
6
+ dld-kit-version: "1.0.0-rc.1"
7
+ ---
8
+ <!-- Generated by dld-kit from templates/skills/dld-status/SKILL.md. Do not edit: updating the skills overwrites this file. -->
9
+
10
+ # /dld-status — Decision Log Overview
11
+
12
+ You are generating a quick overview of the decision log state for the developer.
13
+
14
+ ## Files read
15
+
16
+ This skill runs no commands. It reads decision files and state files directly:
17
+ - `dld.config.yaml` — project configuration (decisions directory, mode)
18
+ - `decisions/records/DL-*.md` — all decision records (scan YAML frontmatter for status, tags, timestamp, namespace)
19
+ - `decisions/.dld-state.yaml` — run tracking state for audit and snapshot (may not exist)
20
+
21
+ ## Prerequisites
22
+
23
+ Check that `dld.config.yaml` exists at the repo root. If not, tell the user to run `/dld-init` first and stop.
24
+
25
+ ## Read project context
26
+
27
+ 1. Read `dld.config.yaml` to understand the project structure (flat vs namespaced, decisions directory)
28
+ 2. Read all decision files in the records subdirectory (`decisions/records/`) to gather statistics
29
+
30
+ ## Generate the overview
31
+
32
+ ### 1. Count decisions by status
33
+
34
+ Scan all `DL-*.md` files in the records subdirectory (`decisions/records/`, including namespace subdirectories). Read the `status` field from each file's YAML frontmatter. Count:
35
+ - `proposed`
36
+ - `accepted`
37
+ - `deprecated`
38
+ - `superseded`
39
+
40
+ Present as:
41
+ ```
42
+ ## Decision Log Status
43
+
44
+ | Status | Count |
45
+ |--------|-------|
46
+ | proposed | 3 |
47
+ | accepted | 12 |
48
+ | deprecated | 2 |
49
+ | superseded | 1 |
50
+ | **Total** | **18** |
51
+ ```
52
+
53
+ ### 2. Recent decisions
54
+
55
+ Show the 5 most recent decisions (by timestamp), with ID, title, status:
56
+
57
+ ```
58
+ ## Recent Decisions
59
+
60
+ | ID | Title | Status | Date |
61
+ |----|-------|--------|------|
62
+ | DL-018 | ... | proposed | 2026-03-07 |
63
+ | DL-017 | ... | accepted | 2026-03-06 |
64
+ | ...
65
+ ```
66
+
67
+ ### 3. Decisions by grouping
68
+
69
+ **Namespaced projects:** Show decision counts per namespace.
70
+
71
+ ```
72
+ ## By Namespace
73
+
74
+ | Namespace | Total | Proposed | Accepted |
75
+ |-----------|-------|----------|----------|
76
+ | billing | 8 | 1 | 7 |
77
+ | auth | 5 | 2 | 3 |
78
+ | shared | 5 | 0 | 5 |
79
+ ```
80
+
81
+ **All projects:** If there are tags in use, show the most active tags (those with the most decisions):
82
+
83
+ ```
84
+ ## Active Tags
85
+
86
+ | Tag | Decisions |
87
+ |-----|-----------|
88
+ | payment-gateway | 4 |
89
+ | auth-refactor | 3 |
90
+ ```
91
+
92
+ ### 4. Run tracking info
93
+
94
+ Read `decisions/.dld-state.yaml` if it exists. Report:
95
+ - Last audit run time and commit hash
96
+ - Last snapshot run time
97
+
98
+ If the file doesn't exist, note that no audits or snapshots have been run yet.
99
+
100
+ ```
101
+ ## Run History
102
+
103
+ - **Last audit:** 2026-03-06 at commit `a1b2c3d` (1 day ago)
104
+ - **Last snapshot:** 2026-03-05 (2 days ago, covers through DL-015)
105
+ ```
106
+
107
+ Or:
108
+ ```
109
+ ## Run History
110
+
111
+ No audits or snapshots have been run yet. Use `/dld-audit` to check for drift.
112
+ ```
113
+
114
+ ### 5. Proposed decisions needing action
115
+
116
+ If there are any `proposed` decisions, list them as a call to action:
117
+
118
+ ```
119
+ ## Pending Implementation
120
+
121
+ These decisions are proposed but not yet implemented:
122
+ - **DL-016**: Rate limiting strategy
123
+ - **DL-017**: Cache invalidation approach
124
+ - **DL-018**: Error response format
125
+
126
+ Use `/dld-implement DL-NNN` to implement them.
127
+ ```
@@ -0,0 +1,22 @@
1
+ # DLD (Decision-Linked Development)
2
+
3
+ This project uses Decision-Linked Development. Decision records (DL-*.md) live in the `records/` subdirectory of the decisions directory set in `dld.config.yaml` (`decisions/` by default). High-level docs (INDEX.md, OVERVIEW.md, SNAPSHOT.md) live in the decisions directory.
4
+
5
+ ## Rules
6
+
7
+ - When you encounter `@decision(DL-XXX)` annotations in code, read the referenced decision with the dld-lookup skill BEFORE modifying the annotated code.
8
+ - ALWAYS look up and verify related decisions before modifying annotated code. Do not skip this step.
9
+ - NEVER modify code in a way that contradicts an existing decision without first confirming with the user. If the change requires breaking a previous decision, a new decision must be recorded (with the dld-decide skill) that explicitly supersedes the old one. If it only partially modifies a previous decision, record it as an amendment instead.
10
+
11
+ ## Skills
12
+
13
+ - dld-decide: record a new decision
14
+ - dld-plan: break down a feature into multiple grouped decisions
15
+ - dld-implement: implement proposed decisions
16
+ - dld-lookup: query decisions by ID, tag, or code path
17
+ - dld-adjust: adjust or update existing decisions
18
+ - dld-audit: scan for drift between decisions and code
19
+ - dld-snapshot: regenerate SNAPSHOT.md and OVERVIEW.md from the decision log
20
+ - dld-status: a quick overview of the decision log state
21
+ - dld-retrofit: generate decisions from an existing codebase
22
+ - dld-reindex: resolve decision-ID collisions with the base branch (and open PRs) before rebasing
@@ -0,0 +1,139 @@
1
+ ---
2
+ name: dld-adjust
3
+ description: Adjust or update existing decision records. Handles permission gating for accepted decisions and correctly interprets adjustment requests.
4
+ compatibility: Requires Node.js 20+ and git.
5
+ ---
6
+
7
+ # /dld-adjust — Adjust a Decision
8
+
9
+ You are helping the developer adjust one or more existing decision records. Your job is to apply their requested changes accurately and minimally.
10
+
11
+ ## Interaction style
12
+
13
+ Use the `AskUserQuestion` tool for all questions and prompts. This provides a structured input experience for the user.
14
+
15
+ ## Commands
16
+
17
+ {{dld-setup}}
18
+
19
+ This skill uses: `regenerate-index`.
20
+
21
+ ## Prerequisites
22
+
23
+ Check that `dld.config.yaml` exists at the repo root. If not, tell the user to run `/dld-init` first and stop.
24
+
25
+ ## Read project context
26
+
27
+ This skill is typically invoked mid-session after `/dld-plan`, `/dld-decide`, or during `/dld-implement`, so the project context and decision content are likely already in your conversation context. Only read these if you don't already have the information:
28
+
29
+ 1. `dld.config.yaml` — project structure (flat vs namespaced, decisions directory)
30
+ 2. The target decision file(s) — decision records (`DL-*.md`) live in the `records/` subdirectory under the decisions directory
31
+
32
+ ## Step 1: Identify the decision(s)
33
+
34
+ The user may specify decision IDs explicitly (e.g., `/dld-adjust DL-005`), but often they won't — this skill is typically used right after `/dld-plan`, `/dld-decide`, or during `/dld-implement`, so the decisions are already part of the current conversation context.
35
+
36
+ - **Explicit IDs provided** — use those directly.
37
+ - **No IDs provided** — infer which decision(s) the user is referring to from the conversation context. If decisions were recently created or discussed in this session, assume those are the target. If it's still ambiguous, ask using `AskUserQuestion`.
38
+
39
+ Find and read each decision file. If a decision ID is not found, report the error and continue with any remaining valid IDs.
40
+
41
+ ## Step 2: Determine if confirmation is needed
42
+
43
+ For each decision, check whether editing requires user confirmation:
44
+
45
+ ### Proposed decisions (`status: proposed`)
46
+
47
+ Edit freely. No confirmation needed — proposed decisions are mutable by convention.
48
+
49
+ ### Accepted decisions (`status: accepted`)
50
+
51
+ Check if the decision file has been committed and pushed to the remote:
52
+
53
+ ```bash
54
+ # Get the last commit hash for the decision file
55
+ LAST_COMMIT=$(git log --format=%H -1 -- <path-to-decision-file>)
56
+
57
+ # Check if that commit exists on any remote branch
58
+ git branch -r --contains "$LAST_COMMIT" 2>/dev/null
59
+ ```
60
+
61
+ - **Not yet pushed** (commit not on any remote branch, file is uncommitted, or file is untracked) — edit freely. It is still local work-in-progress.
62
+ - **Pushed to remote** — this decision has been published. Use `AskUserQuestion` to present options:
63
+ 1. **Edit anyway** — modify the accepted decision directly (breaks immutability convention)
64
+ 2. **Supersede instead** — record a new decision via `/dld-decide` that supersedes this one
65
+ 3. **Cancel** — do nothing
66
+
67
+ If the user chooses to supersede, direct them to `/dld-decide` and stop. If they cancel, stop. Only proceed with editing if they explicitly choose to edit anyway.
68
+
69
+ ### Deprecated or superseded decisions
70
+
71
+ These are historical records. Ask for confirmation before editing — modifying historical decisions is unusual.
72
+
73
+ ## Step 3: Collect the adjustment request
74
+
75
+ If the user provided the adjustment alongside the skill invocation (e.g., `/dld-adjust DL-005 remove the mention of Java records`), use that directly.
76
+
77
+ Otherwise, ask what changes they want to make.
78
+
79
+ Read the current decision content so you understand the full context of what you are working with.
80
+
81
+ ## Step 4: Apply the changes
82
+
83
+ ### CRITICAL — How to interpret adjustment requests
84
+
85
+ AI agents consistently misinterpret adjustment requests. Follow these rules exactly:
86
+
87
+ **"Remove X" means DELETE the content about X.**
88
+ Do NOT replace it with "We decided not to use X" or "We chose against X" or any other negative phrasing. Simply remove the sentences, bullet points, or paragraphs that mention X. The goal is a clean decision record that reads as if X was never discussed.
89
+
90
+ **"Change X to Y" means REPLACE the content.**
91
+ Find where X is described and replace it with Y. Do not add explanatory text about the change.
92
+
93
+ **"Add X" means INSERT new content.**
94
+ Add the new content in the appropriate section. Do not add meta-commentary about it being an addition.
95
+
96
+ **General principle:** The decision record should always read as a clean, coherent document. Never add editorial notes like "Updated on...", "Previously we...", "This was changed from...", or "We decided against...". The record captures the current state of the decision, not a changelog of edits.
97
+
98
+ **Examples of WRONG vs RIGHT:**
99
+
100
+ User says: *"Remove the mention of Java records from DL-005"*
101
+
102
+ - WRONG: Replacing "We will use Java records for DTOs" with "We decided not to use Java records for DTOs"
103
+ - RIGHT: Deleting the sentence "We will use Java records for DTOs" entirely (and any related sentences about Java records)
104
+
105
+ User says: *"Change the retry count from 3 to 5"*
106
+
107
+ - WRONG: Adding "Originally 3 retries, changed to 5 retries because..."
108
+ - RIGHT: Replacing "3 retries" with "5 retries" wherever it appears in the decision
109
+
110
+ User says: *"Remove the part about caching"*
111
+
112
+ - WRONG: "We considered caching but decided it is not relevant to this decision"
113
+ - RIGHT: Delete all sentences and paragraphs about caching. Adjust surrounding text so the document flows naturally.
114
+
115
+ ### Applying edits
116
+
117
+ 1. Read the full decision file
118
+ 2. Apply the requested changes to the markdown body (and frontmatter fields like title or tags if affected)
119
+ 3. Write the updated file
120
+ 4. Show the user a brief summary of what changed
121
+
122
+ If multiple decisions are being adjusted, process them one at a time.
123
+
124
+ ## Step 5: Regenerate INDEX.md
125
+
126
+ If any decision titles or metadata changed:
127
+
128
+ ```bash
129
+ {{dld}} regenerate-index
130
+ ```
131
+
132
+ ## Step 6: Suggest next steps
133
+
134
+ > Adjusted **DL-NNN**: [brief description of what changed]
135
+ >
136
+ > Next steps:
137
+ > - `/dld-lookup DL-NNN` — review the updated decision
138
+ > - `/dld-implement DL-NNN` — implement if the decision is proposed
139
+ > - `/dld-snapshot` — regenerate overview docs to reflect the update