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.
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "dld-kit",
3
+ "version": "1.0.0-rc.1",
4
+ "description": "Decision-Linked Development: record, link, and audit development decisions alongside code",
5
+ "license": "MIT",
6
+ "author": {
7
+ "name": "Jimmy Utterström",
8
+ "url": "https://github.com/jimutt"
9
+ },
10
+ "type": "module",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/jimutt/dld-kit.git"
14
+ },
15
+ "homepage": "https://github.com/jimutt/dld-kit#readme",
16
+ "keywords": [
17
+ "dld",
18
+ "decision-records",
19
+ "agent-skills",
20
+ "cli",
21
+ "pi-package"
22
+ ],
23
+ "engines": {
24
+ "node": ">=20"
25
+ },
26
+ "bin": {
27
+ "dld": "dist/dld.mjs"
28
+ },
29
+ "files": [
30
+ "dist/dld.mjs",
31
+ "skills/",
32
+ "templates/skills/",
33
+ "templates/rules/"
34
+ ],
35
+ "pi": {
36
+ "skills": [
37
+ "./skills"
38
+ ]
39
+ },
40
+ "scripts": {
41
+ "build": "node scripts/build.mjs",
42
+ "generate": "bun scripts/generate.ts",
43
+ "check:generated": "bun scripts/generate.ts --check",
44
+ "prepack": "npm run build",
45
+ "version": "npm run generate && git add skills .claude/skills .claude/rules claude-plugin .claude-plugin plugin.json .agents/plugins .github/plugin",
46
+ "typecheck": "tsc --noEmit -p tsconfig.json && tsc --noEmit -p tsconfig.src.json",
47
+ "lint": "biome check .",
48
+ "lint:fix": "biome check --write .",
49
+ "test": "npm run check:generated && npm run test:unit && npm run test:cli",
50
+ "test:unit": "bun test src",
51
+ "test:coverage": "bun test --coverage src",
52
+ "test:cli": "npm run build && bun test tests/cli",
53
+ "check:pack": "node scripts/check-pack.mjs",
54
+ "check:installers": "node scripts/check-installers.mjs"
55
+ },
56
+ "devDependencies": {
57
+ "@biomejs/biome": "2.5.14",
58
+ "@types/bun": "1.4.2",
59
+ "@types/node": "20.19.43",
60
+ "esbuild": "0.28.2",
61
+ "typescript": "7.0.2",
62
+ "yaml": "2.9.1"
63
+ }
64
+ }
@@ -0,0 +1,142 @@
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
+ metadata:
6
+ dld-kit-version: "1.0.0-rc.1"
7
+ ---
8
+ <!-- Generated by dld-kit from templates/skills/dld-adjust/SKILL.md. Do not edit: updating the skills overwrites this file. -->
9
+
10
+ # /dld-adjust — Adjust a Decision
11
+
12
+ You are helping the developer adjust one or more existing decision records. Your job is to apply their requested changes accurately and minimally.
13
+
14
+ ## Interaction style
15
+
16
+ Use the `AskUserQuestion` tool for all questions and prompts. This provides a structured input experience for the user.
17
+
18
+ ## Commands
19
+
20
+ 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`.
21
+
22
+ This skill uses: `regenerate-index`.
23
+
24
+ ## Prerequisites
25
+
26
+ Check that `dld.config.yaml` exists at the repo root. If not, tell the user to run `/dld-init` first and stop.
27
+
28
+ ## Read project context
29
+
30
+ 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:
31
+
32
+ 1. `dld.config.yaml` — project structure (flat vs namespaced, decisions directory)
33
+ 2. The target decision file(s) — decision records (`DL-*.md`) live in the `records/` subdirectory under the decisions directory
34
+
35
+ ## Step 1: Identify the decision(s)
36
+
37
+ 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.
38
+
39
+ - **Explicit IDs provided** — use those directly.
40
+ - **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`.
41
+
42
+ Find and read each decision file. If a decision ID is not found, report the error and continue with any remaining valid IDs.
43
+
44
+ ## Step 2: Determine if confirmation is needed
45
+
46
+ For each decision, check whether editing requires user confirmation:
47
+
48
+ ### Proposed decisions (`status: proposed`)
49
+
50
+ Edit freely. No confirmation needed — proposed decisions are mutable by convention.
51
+
52
+ ### Accepted decisions (`status: accepted`)
53
+
54
+ Check if the decision file has been committed and pushed to the remote:
55
+
56
+ ```bash
57
+ # Get the last commit hash for the decision file
58
+ LAST_COMMIT=$(git log --format=%H -1 -- <path-to-decision-file>)
59
+
60
+ # Check if that commit exists on any remote branch
61
+ git branch -r --contains "$LAST_COMMIT" 2>/dev/null
62
+ ```
63
+
64
+ - **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.
65
+ - **Pushed to remote** — this decision has been published. Use `AskUserQuestion` to present options:
66
+ 1. **Edit anyway** — modify the accepted decision directly (breaks immutability convention)
67
+ 2. **Supersede instead** — record a new decision via `/dld-decide` that supersedes this one
68
+ 3. **Cancel** — do nothing
69
+
70
+ 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.
71
+
72
+ ### Deprecated or superseded decisions
73
+
74
+ These are historical records. Ask for confirmation before editing — modifying historical decisions is unusual.
75
+
76
+ ## Step 3: Collect the adjustment request
77
+
78
+ 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.
79
+
80
+ Otherwise, ask what changes they want to make.
81
+
82
+ Read the current decision content so you understand the full context of what you are working with.
83
+
84
+ ## Step 4: Apply the changes
85
+
86
+ ### CRITICAL — How to interpret adjustment requests
87
+
88
+ AI agents consistently misinterpret adjustment requests. Follow these rules exactly:
89
+
90
+ **"Remove X" means DELETE the content about X.**
91
+ 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.
92
+
93
+ **"Change X to Y" means REPLACE the content.**
94
+ Find where X is described and replace it with Y. Do not add explanatory text about the change.
95
+
96
+ **"Add X" means INSERT new content.**
97
+ Add the new content in the appropriate section. Do not add meta-commentary about it being an addition.
98
+
99
+ **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.
100
+
101
+ **Examples of WRONG vs RIGHT:**
102
+
103
+ User says: *"Remove the mention of Java records from DL-005"*
104
+
105
+ - WRONG: Replacing "We will use Java records for DTOs" with "We decided not to use Java records for DTOs"
106
+ - RIGHT: Deleting the sentence "We will use Java records for DTOs" entirely (and any related sentences about Java records)
107
+
108
+ User says: *"Change the retry count from 3 to 5"*
109
+
110
+ - WRONG: Adding "Originally 3 retries, changed to 5 retries because..."
111
+ - RIGHT: Replacing "3 retries" with "5 retries" wherever it appears in the decision
112
+
113
+ User says: *"Remove the part about caching"*
114
+
115
+ - WRONG: "We considered caching but decided it is not relevant to this decision"
116
+ - RIGHT: Delete all sentences and paragraphs about caching. Adjust surrounding text so the document flows naturally.
117
+
118
+ ### Applying edits
119
+
120
+ 1. Read the full decision file
121
+ 2. Apply the requested changes to the markdown body (and frontmatter fields like title or tags if affected)
122
+ 3. Write the updated file
123
+ 4. Show the user a brief summary of what changed
124
+
125
+ If multiple decisions are being adjusted, process them one at a time.
126
+
127
+ ## Step 5: Regenerate INDEX.md
128
+
129
+ If any decision titles or metadata changed:
130
+
131
+ ```bash
132
+ node "<skill-dir>/../dld-common/scripts/dld.mjs" regenerate-index
133
+ ```
134
+
135
+ ## Step 6: Suggest next steps
136
+
137
+ > Adjusted **DL-NNN**: [brief description of what changed]
138
+ >
139
+ > Next steps:
140
+ > - `/dld-lookup DL-NNN` — review the updated decision
141
+ > - `/dld-implement DL-NNN` — implement if the decision is proposed
142
+ > - `/dld-snapshot` — regenerate overview docs to reflect the update
@@ -0,0 +1,162 @@
1
+ ---
2
+ name: dld-audit
3
+ description: Scan for drift between decisions and code. Finds orphaned annotations, stale references, and undocumented changes.
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-audit/SKILL.md. Do not edit: updating the skills overwrites this file. -->
9
+
10
+ # /dld-audit — Audit Decision-Code Drift
11
+
12
+ You are scanning the codebase for drift between decision records and code annotations. This helps catch situations where code evolved but decisions weren't updated.
13
+
14
+ ## Commands
15
+
16
+ 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`.
17
+
18
+ This skill uses: `find-annotations`, `find-missing-amends`, `update-audit-state`.
19
+
20
+ ## Prerequisites
21
+
22
+ Check that `dld.config.yaml` exists at the repo root. If not, tell the user to run `/dld-init` first and stop.
23
+
24
+ ## Audit Steps
25
+
26
+ ### 1. Collect all annotations in code
27
+
28
+ Run `find-annotations`:
29
+ ```bash
30
+ node "<skill-dir>/../dld-common/scripts/dld.mjs" find-annotations
31
+ ```
32
+
33
+ This outputs lines in the format `<file>:<line>:<DL-NNN>`, one per annotation occurrence.
34
+
35
+ ### 2. Collect all decision records
36
+
37
+ Read all `DL-*.md` files in the records subdirectory (`decisions/records/`). For each, note:
38
+ - The ID
39
+ - The status
40
+ - The code references listed in the frontmatter
41
+
42
+ ### 3. Check for issues
43
+
44
+ Perform these drift checks:
45
+
46
+ #### a) Orphaned annotations
47
+
48
+ Annotations in code that reference non-existent decision IDs. These indicate decisions that were deleted or IDs that were mistyped.
49
+
50
+ #### b) Annotations referencing non-accepted decisions
51
+
52
+ Annotations referencing decisions with status `deprecated` or `superseded`. Code is still tied to a decision that's no longer active.
53
+
54
+ #### b2) Annotations referencing amended decisions
55
+
56
+ Annotations referencing decisions that have been amended by a newer decision (check all decisions for `amends` fields that reference this ID). This is **informational, not an error** — the original decision is still active, but the developer should be aware of the amendment. Surface these as notes, not issues.
57
+
58
+ #### c) Stale references in decisions
59
+
60
+ Decision records whose `references` list code paths that no longer exist in the repository. Use file existence checks.
61
+
62
+ #### d) Unreferenced code changes (if previous audit exists)
63
+
64
+ If `decisions/.dld-state.yaml` exists and has an `audit.commit_hash`, find files that:
65
+ 1. Contain `@decision` annotations
66
+ 2. Were modified since the last audit commit
67
+
68
+ First, verify the commit is reachable:
69
+ ```bash
70
+ git cat-file -t <commit_hash> 2>/dev/null
71
+ ```
72
+
73
+ If the commit is unreachable (e.g., after a rebase or shallow clone), skip this check and note it in the report:
74
+ > **Note:** Previous audit commit `<hash>` is not reachable in current history. Skipping changed-file detection. This can happen after a rebase or shallow clone.
75
+
76
+ If the commit is reachable:
77
+ ```bash
78
+ git diff --name-only <commit_hash>..HEAD
79
+ ```
80
+
81
+ Cross-reference this list with annotated files. Files that changed but whose associated decisions weren't updated may indicate undocumented drift.
82
+
83
+ #### e) Missing amendment relationships
84
+
85
+ **This check is mandatory — do not skip it.** Run `find-missing-amends` to get initial candidates:
86
+
87
+ ```bash
88
+ node "<skill-dir>/../dld-common/scripts/dld.mjs" find-missing-amends
89
+ ```
90
+
91
+ This outputs lines in the format `<source-id>:<referenced-id>` — decisions whose body references another decision ID that isn't listed in their `supersedes` or `amends` fields. Not every candidate is a missing amendment — some are just informational references (e.g., "this is similar to DL-005").
92
+
93
+ By default the command only emits candidates whose source decision file changed since the last audit (recorded in `.dld-state.yaml`), so references the agent has already evaluated and judged informational don't keep resurfacing. To force a full rescan — useful for cold starts or manual deep audits — pass `--all`:
94
+
95
+ ```bash
96
+ node "<skill-dir>/../dld-common/scripts/dld.mjs" find-missing-amends --all
97
+ ```
98
+
99
+ For each candidate, read the source decision's body and evaluate whether the reference describes a partial modification of the referenced decision. Look for language like: "supersedes the X portions of", "changes the Y behavior from DL-Z", "replaces the approach in DL-Z for...", "modifies how DL-Z handles...". If so, flag it as a missing amendment.
100
+
101
+ #### f) Decisions without annotations
102
+
103
+ `accepted` decisions that have code references in their frontmatter but no corresponding `@decision` annotations found in the code. The references claim code is linked, but the annotations are missing.
104
+
105
+ ### 4. Report findings
106
+
107
+ Present findings grouped by severity:
108
+
109
+ ```
110
+ ## Audit Report
111
+
112
+ ### Issues Found
113
+
114
+ #### Orphaned Annotations
115
+ - `src/billing/vat.ts:42` references `DL-099` — decision does not exist
116
+
117
+ #### Stale References
118
+ - **DL-012** references `src/billing/old-vat.ts` — file does not exist
119
+
120
+ #### Deprecated/Superseded References
121
+ - `src/auth/login.ts:15` references `DL-003` (status: superseded by DL-012)
122
+
123
+ #### Amended Decisions (informational)
124
+ - `src/billing/vat.ts:42` references `DL-003` — amended by DL-012. Verify code aligns with the amendment.
125
+
126
+ #### Modified Annotated Files (since last audit)
127
+ - `src/billing/vat.ts` — modified, contains `@decision(DL-012)`. Review if decision needs updating.
128
+
129
+ ### Summary
130
+ - **X** orphaned annotations
131
+ - **Y** stale references
132
+ - **Z** annotated files modified since last audit
133
+
134
+ ### Suggested Remediation
135
+ - Fix orphaned annotation at `src/billing/vat.ts:42` — update to correct ID or remove
136
+ - Update DL-012 references — remove `src/billing/old-vat.ts`
137
+ - Review `src/billing/vat.ts` changes — consider `/dld-decide` if behavior changed
138
+ ```
139
+
140
+ If no issues are found:
141
+ ```
142
+ ## Audit Report
143
+
144
+ No drift detected. All annotations reference valid, accepted decisions. All decision references point to existing code.
145
+ ```
146
+
147
+ ### 5. Update audit state
148
+
149
+ After the audit completes (regardless of findings):
150
+ ```bash
151
+ node "<skill-dir>/../dld-common/scripts/dld.mjs" update-audit-state
152
+ ```
153
+
154
+ ### 6. Suggest next steps
155
+
156
+ > Audit complete. **N** issue(s) found.
157
+ >
158
+ > Next steps:
159
+ > - Fix any orphaned or stale references identified above
160
+ > - `/dld-decide` — record new decisions for undocumented changes
161
+ > - `/dld-snapshot` — regenerate the spec projection
162
+ > - `/dld-status` — view overall decision log state
@@ -0,0 +1,172 @@
1
+ ---
2
+ name: dld-audit-auto
3
+ description: Autonomous audit — detects drift, fixes issues, and opens a PR. Designed for scheduled/CI execution without human interaction.
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-audit-auto/SKILL.md. Do not edit: updating the skills overwrites this file. -->
9
+
10
+ # /dld-audit-auto — Autonomous Audit & Fix
11
+
12
+ You are running an autonomous audit of the decision-code relationship. Unlike the interactive `/dld-audit`, you **detect issues and fix them** without asking for human input. Your output is a branch with fixes and a PR for review.
13
+
14
+ **This skill is designed for unattended execution** — scheduled runs, CI pipelines, or autonomous agent sessions. Do not ask questions or wait for user input.
15
+
16
+ ## Commands
17
+
18
+ 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`.
19
+
20
+ This skill uses: `find-annotations`, `find-missing-amends`, `regenerate-index`, `update-audit-state`.
21
+
22
+ ## Prerequisites
23
+
24
+ 1. Check that `dld.config.yaml` exists at the repo root. If not, exit with a clear error message.
25
+ 2. Verify the working tree is clean (`git status --porcelain` should be empty). If not, exit — do not mix audit fixes with uncommitted work.
26
+
27
+ ## Step 1: Create audit branch
28
+
29
+ ```bash
30
+ git checkout -b dld/audit-$(date +%Y%m%d-%H%M%S)
31
+ ```
32
+
33
+ ## Step 2: Run the full audit
34
+
35
+ Perform all the same checks as `/dld-audit`:
36
+
37
+ ### a) Collect annotations and decision records
38
+
39
+ ```bash
40
+ node "<skill-dir>/../dld-common/scripts/dld.mjs" find-annotations
41
+ ```
42
+
43
+ Read all `DL-*.md` files in the records subdirectory (`decisions/records/`). Note each decision's ID, status, and code references.
44
+
45
+ ### b) Detect issues
46
+
47
+ Check for all drift categories:
48
+
49
+ 1. **Orphaned annotations** — annotations referencing non-existent decision IDs
50
+ 2. **Annotations referencing non-accepted decisions** — code tied to deprecated or superseded decisions
51
+ 3. **Stale references in decisions** — frontmatter references to files that no longer exist
52
+ 4. **Unreferenced code changes** — annotated files modified since last audit (if previous audit state exists)
53
+ 5. **Decisions without annotations** — accepted decisions with code references but no corresponding annotations in code
54
+ 6. **Missing amendment relationships** — decisions whose body references modifying part of a previous decision but have an empty `amends` field
55
+
56
+ For check (4), if `decisions/.dld-state.yaml` exists with an `audit.commit_hash`, first verify reachability:
57
+ ```bash
58
+ git cat-file -t <commit_hash> 2>/dev/null
59
+ ```
60
+ If unreachable (e.g., after rebase or shallow clone), skip check (4) and note it in the PR description. If reachable, use `git diff --name-only <commit_hash>..HEAD` to find changed files and cross-reference with annotated files.
61
+
62
+ ## Step 3: Fix issues
63
+
64
+ Apply fixes for each issue category. Use judgment on what can be safely fixed automatically vs. what should only be flagged in the PR description.
65
+
66
+ ### Hard rule: never edit the body of an accepted decision
67
+
68
+ The narrative body of an accepted decision (Context, Decision, Rationale, Consequences, and any other prose sections) is **immutable**. An audit must never rewrite, refine, "clean up", or otherwise modify it.
69
+
70
+ The only changes an audit may make to an accepted decision are housekeeping updates to specific frontmatter fields — `references`, `amends`, `superseded_by`, and similar relational metadata — plus adding or fixing `@decision` annotations in code.
71
+
72
+ If drift suggests the substance of an accepted decision is no longer accurate, or that code has evolved beyond what the decision describes, **do not modify the original record**. Instead, create a **new decision** (status `accepted`, since the code already exists) that captures the new rationale and uses `supersedes` or `amends` to link back to the prior one. The original stays as-is to preserve the historical record of why things were done that way at the time.
73
+
74
+ ### Auto-fixable (apply these directly):
75
+
76
+ **Orphaned annotations** — If the annotation has an obvious typo (e.g., `DL-01` where `DL-001` exists), fix it. If the referenced ID is completely unknown, remove the annotation and note the removal in the commit message.
77
+
78
+ **Stale references in decisions** — Remove file paths from the decision's `references` field that no longer exist. If the file was renamed/moved (detectable via `git log --follow --diff-filter=R`), update the path instead of removing.
79
+
80
+ **Annotations referencing superseded decisions** — Update the annotation to reference the superseding decision (read the `supersedes` field of the newer decision to find the chain). For deprecated decisions, remove the annotation.
81
+
82
+ **Annotations referencing amended decisions** — Do **not** rewrite or remove these annotations. The original decision is still active. Instead, note the amendment relationship in the PR description so reviewers can verify the code aligns with the amendment.
83
+
84
+ **Missing amendment relationships** — Run `node "<skill-dir>/../dld-common/scripts/dld.mjs" find-missing-amends` to get candidates. The command only emits candidates whose source decision changed since the last audit, so re-runs stay focused on new work. For each candidate, read the source decision's body and determine if it describes a partial modification. If so, add the referenced ID to the `amends` field. Flag prominently in the PR for review, since this is an inferred relationship.
85
+
86
+ **Decisions without annotations** — If an accepted decision has code references but no annotations, and the referenced files exist, add the missing `@decision(DL-NNN)` annotations to the referenced code locations.
87
+
88
+ ### Best-effort fixes (apply, but flag prominently for review):
89
+
90
+ **Unreferenced code changes** — Annotated files that were modified since the last audit without a corresponding decision update. These represent changes made outside the DLD process. Try to resolve them:
91
+
92
+ 1. **Check commit messages** — Read the commits that modified the file (`git log --oneline <last_audit_hash>..HEAD -- <file>`). Look for context about what changed and why.
93
+ 2. **Look up referenced tickets** — If commit messages reference a ticket (e.g., Jira, Linear, GitHub issue), try to look it up using available tools (MCP servers, `gh` CLI, etc.) to gather additional context about the change.
94
+ 3. **Assess the impact** — Read the current code and the associated decision(s). Determine whether:
95
+ - The existing decision is still accurate (the change was compatible — no action needed)
96
+ - The change introduced new or different behavior/rationale that is not fully captured by the existing decision (a **new decision** is needed)
97
+ 4. **Create a new decision when needed** — Per the hard rule above, never edit the body of the existing accepted decision to absorb the new behavior. Instead, create a new decision using the standard scripts, mark it `accepted` (the code already exists), and link it to the prior decision via `supersedes` or `amends` as appropriate. Add `@decision` annotations to the new/changed code pointing at the new decision.
98
+
99
+ **Important:** These best-effort fixes are inferred, not authoritative. In the PR description, clearly mark each one under a **"Inferred Decisions — Review Required"** section. Explain what changed, what context was found (commit messages, tickets), and what new decision was created. Reviewers should prioritize checking these for accuracy.
100
+
101
+ ## Step 4: Regenerate INDEX.md
102
+
103
+ If any decision records were modified:
104
+ ```bash
105
+ node "<skill-dir>/../dld-common/scripts/dld.mjs" regenerate-index
106
+ ```
107
+
108
+ ## Step 5: Update audit state
109
+
110
+ ```bash
111
+ node "<skill-dir>/../dld-common/scripts/dld.mjs" update-audit-state
112
+ ```
113
+
114
+ ## Step 6: Commit, push, and open PR
115
+
116
+ If there are changes (fixes were applied or audit state was updated):
117
+
118
+ ```bash
119
+ git add -A
120
+ ```
121
+
122
+ Commit with a descriptive message summarizing the fixes:
123
+
124
+ ```bash
125
+ git commit -m "fix: resolve DLD audit drift
126
+
127
+ - [list each fix applied]
128
+ - Audit state updated"
129
+ ```
130
+
131
+ Push and open a PR:
132
+
133
+ ```bash
134
+ git push -u origin HEAD
135
+ ```
136
+
137
+ Create a PR with the following structure:
138
+
139
+ ```markdown
140
+ ## DLD Audit — Automated Drift Fixes
141
+
142
+ **Audit date:** YYYY-MM-DD
143
+ **Issues found:** N
144
+ **Auto-fixed:** M
145
+ **Needs review:** K
146
+
147
+ ### Fixes Applied
148
+
149
+ - [Description of each fix, grouped by category]
150
+
151
+ ### Inferred Decisions — Review Required
152
+
153
+ These decisions were created or updated based on code changes made outside the DLD process. The rationale was inferred from commit messages and available ticket context. **Please verify accuracy.**
154
+
155
+ - **DL-NNN: [Title]** (new/updated) — [What changed in the code, what context was found, what was inferred]
156
+
157
+ ### Audit Summary
158
+
159
+ | Check | Result |
160
+ |-------|--------|
161
+ | Orphaned annotations | N found, M fixed |
162
+ | Stale references | N found, M fixed |
163
+ | Superseded/deprecated refs | N found, M fixed |
164
+ | Missing annotations | N found, M added |
165
+ | Modified annotated files | N flagged for review |
166
+ ```
167
+
168
+ If no issues were found (only audit state updated), still commit and push the state update but **do not open a PR**. Instead, exit with a message:
169
+
170
+ ```
171
+ Audit complete. No drift detected. Audit state updated.
172
+ ```
@@ -0,0 +1,14 @@
1
+ ---
2
+ name: dld-common
3
+ description: The dld CLI shared by the DLD skills. Not intended for direct invocation — the other DLD skills run it.
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-common/SKILL.md. Do not edit: updating the skills overwrites this file. -->
9
+
10
+ # DLD Common
11
+
12
+ This skill ships `scripts/dld.mjs`, the bundled `dld` command-line tool the other DLD skills run for mechanical operations: assigning IDs, creating records, updating status, regenerating the index, scanning annotations, and reindexing. Do not invoke this skill directly.
13
+
14
+ `node "<skill-dir>/scripts/dld.mjs" --help` lists the commands, where `<skill-dir>` is the absolute path of this skill's directory.