ワンクリックで
dld-audit-auto
Autonomous audit — detects drift, fixes issues, and opens a PR. Designed for scheduled/CI execution without human interaction.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Autonomous audit — detects drift, fixes issues, and opens a PR. Designed for scheduled/CI execution without human interaction.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Implement one or more proposed decisions. Makes code changes, adds `@decision` annotations, and updates decision status.
Implement one or more proposed decisions. Makes code changes, adds `@decision` annotations, and updates decision status.
Resolve decision ID collisions between a local branch and the base branch (and open PRs) before rebasing. Renames colliding local decisions with git mv, rewrites cross-references and annotations, then squashes branch commits into a single rebase-clean reindex commit.
Shared utility scripts for DLD skills. Not intended for direct invocation — used internally by other DLD skills.
Resolve decision ID collisions between a local branch and the base branch (and open PRs) before rebasing. Renames colliding local decisions with git mv, rewrites cross-references and annotations, then squashes branch commits into a single rebase-clean reindex commit.
Autonomous audit — detects drift, fixes issues, and opens a PR. Designed for scheduled/CI execution without human interaction.
| name | dld-audit-auto |
| description | Autonomous audit — detects drift, fixes issues, and opens a PR. Designed for scheduled/CI execution without human interaction. |
| compatibility | Requires bash and git. Scripts use BASH_SOURCE for path resolution. |
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.
This skill is designed for unattended execution — scheduled runs, CI pipelines, or autonomous agent sessions. Do not ask questions or wait for user input.
Shared scripts:
../dld-common/scripts/common.sh
../dld-common/scripts/regenerate-index.sh
../dld-common/scripts/update-status.sh
Skill-specific scripts:
../dld-audit/scripts/find-annotations.sh
../dld-audit/scripts/find-missing-amends.sh
../dld-audit/scripts/update-audit-state.sh
dld.config.yaml exists at the repo root. If not, exit with a clear error message.git status --porcelain should be empty). If not, exit — do not mix audit fixes with uncommitted work.git checkout -b dld/audit-$(date +%Y%m%d-%H%M%S)
Perform all the same checks as /dld-audit:
bash ../dld-audit/scripts/find-annotations.sh
Read all DL-*.md files in the records subdirectory (decisions/records/). Note each decision's ID, status, and code references.
Check for all drift categories:
amends fieldFor check (4), if decisions/.dld-state.yaml exists with an audit.commit_hash, first verify reachability:
git cat-file -t <commit_hash> 2>/dev/null
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.
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.
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.
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.
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.
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.
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.
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.
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.
Missing amendment relationships — Run bash ../dld-audit/scripts/find-missing-amends.sh to get candidates. The script 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.
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.
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:
git log --oneline <last_audit_hash>..HEAD -- <file>). Look for context about what changed and why.gh CLI, etc.) to gather additional context about the change.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.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.
If any decision records were modified:
bash ../dld-common/scripts/regenerate-index.sh
bash ../dld-audit/scripts/update-audit-state.sh
If there are changes (fixes were applied or audit state was updated):
git add -A
Commit with a descriptive message summarizing the fixes:
git commit -m "fix: resolve DLD audit drift
- [list each fix applied]
- Audit state updated"
Push and open a PR:
git push -u origin HEAD
Create a PR with the following structure:
## DLD Audit — Automated Drift Fixes
**Audit date:** YYYY-MM-DD
**Issues found:** N
**Auto-fixed:** M
**Needs review:** K
### Fixes Applied
- [Description of each fix, grouped by category]
### Inferred Decisions — Review Required
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.**
- **DL-NNN: [Title]** (new/updated) — [What changed in the code, what context was found, what was inferred]
### Audit Summary
| Check | Result |
|-------|--------|
| Orphaned annotations | N found, M fixed |
| Stale references | N found, M fixed |
| Superseded/deprecated refs | N found, M fixed |
| Missing annotations | N found, M added |
| Modified annotated files | N flagged for review |
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:
Audit complete. No drift detected. Audit state updated.