Update agent config

From yigitkonur/skills-by-yigitkonur · View interactive version

Update agent config is an AI agent skill from the GitHub repository yigitkonur/skills-by-yigitkonur. Use if auditing AGENTS.md/CLAUDE.md/REVIEW.md for drift after refactors — stale refs, rules.

How to use this skill

Skill file

Update Agent Config

Refresh a mature AGENTS.md hierarchy that has drifted from current code. Audit first, in evidence. Then dispatch parallel writers fed by the audit. Add files only for code-bearing folders that genuinely lack one. Preserve voice, structure, length — patch, do not rewrite.

This skill assumes the AGENTS hierarchy already exists. For greenfield creation of root + folder AGENTS.md files, route to init-agent-config.

When to use

Do NOT use for

File responsibilities (same contract as init)

| Surface | Purpose | Update-mode concern |

|---|---|---|

| AGENTS.md | How agents should work, where code lives, what local boundaries exist | Refresh refs, recount tables, drop "NOT YET LANDED" stubs that landed |

| CLAUDE.md | Compatibility companion symlink → AGENTS.md | Verify symlink integrity; create for new gap folders |

| REVIEW.md | What diffs should be flagged, protected, or held to a higher bar | Update severity refs; drop trigger phrases for rules that became false |

| Folder AGENTS.md | Local delta only — never restate root | Same; add for newly-discovered code-bearing folders |

Non-negotiables

Hard guardrails — read every run.

  1. Audit before editing. Always. The Quality Report ships before any Edit/Write call.
  2. Falsifiable claims only. Every statement that names file:line, a function/symbol/CLI flag, or a count is verified by grep -n / sed -n / wc -l against current HEAD before correction. Drift is a fact, not a guess.
  3. Parallel Opus auditors then parallel Opus writers. Two phases, hard boundary. Auditors do not edit; writers do not re-audit (they trust their brief).
  4. Preserve voice, structure, length. Patch in place. Don't rewrite a 313-line file into 280 lines because the new wording is "cleaner". The goal is accurate, not prettier.
  5. Internal consistency. When fixing §1, check §8 doesn't contradict. When the manifest table says "Y is a stub", check the prose later doesn't already describe Y as landed.
  6. Gap folders get new files patterned after the closest sibling. No greenfield template. The closest sibling AGENTS.md is the model — its tone, density, and section structure transfer.
  7. Companion CLAUDE.md symlinks intact. Verify post-edit. Create for new gap folders. Fallback to @AGENTS.md wrapper only when symlinks are forbidden — call it out.
  8. Re-audit before declaring done. scripts/audit-agents-md.sh runs once before edits and once after. Diff the surface counts.
  9. No new sections without 3+ repo-specific facts. Updating ≠ expanding. If a section is missing because the code is missing, leave it missing.

Anti-derail guardrails

| Derail | Correction |

|---|---|

| Editing the doc before the audit completes | Audit-first is the contract; the Quality Report ships first |

| Rewriting from memory ("I recall the file changed") | Always re-grep / re-sed; cite line numbers from the actual file |

| Auditor agent also edits | Auditors produce findings only; writers act |

| Writer agent re-runs the audit | Writers trust the brief; re-grep only for the specific recount they're applying |

| Frequency tables left untouched because "they're roughly right" | Recount every numbered table via grep — the cascade of additions silently shifts counts |

| "NOT YET LANDED" stub claims left in place | ls the alleged-missing files; if they exist, document them and remove the stub line |

| Internal contradictions silently surviving (§1 row vs §8 prose) | Cross-check the rule in §N against every later reference to the same symbol/file |

| Voice rewrite ("I made it more readable") | Patch in place; if you can't make a surgical edit, the change isn't ready |

| Auditing only headlines, missing prose claims | Every paragraph with a file.ext:line token is in scope |

| Adding new sections during update | Update mode only — new content goes to a separate init-agent-config pass |

| One AGENTS.md per directory ("coverage looks thorough") | Most folders are skips; a file needs invariants, not just code. 2–4 new files per pass is healthy |

| Paging through build noise in the tree scan | Use treezip (or prune by hand), find where real source resumes, read that — never script around it |

| Verifying claims inside a stale worktree / vendored copy | Resolve every path against the repo's live source tree before grepping |

Scripts

Resolve script paths relative to this skill directory.

| Script | Use when | Mutates |

|---|---|---|

| scripts/audit-agents-md.sh | Phase 0 inventory + post-edit re-audit: existing surfaces, line counts, companion symlink status, folder coverage map (src-files / LOC / AGENTS.md per code folder), duplicate-source risk. See scripts/audit-agents-md.sh.md. | No |

The init-only scaffold-agents-md.sh was dropped — update-mode never emits greenfield skeletons.

The Five Phases

mature AGENTS hierarchy with drift after code churn
                            │
       Phase 0 — Scan + Gap detection + Last-edit churn signal
                            │
       Phase 1 — Quality Report (BEFORE any edit; ask user)
                            │
       Phase 2 — Parallel Opus auditor dispatch (falsifiable claims)
                            │
       Phase 3 — Triage findings + scope confirmation
                            │
       Phase 4 — Parallel Opus writer dispatch (patch in place + author gap files)
                            │
       Phase 5 — Post-edit re-audit + commit + push
                            │
                   refreshed hierarchy

Each phase has a gate. Do not skip forward. See references/audit-and-update.md for the per-phase detail and Quality Report format.

Phase 0 — Scan + Gap detection + Churn signal

Three reads, no writes:

  1. Existing surfaces + coverage map. bash scripts/audit-agents-md.sh from the repo root — lists every AGENTS.md, CLAUDE.md (with symlink target), REVIEW.md, native adapter, current line counts, and a folder coverage map: each code-bearing directory (depth ≤ 2) with its source-file count, source LOC, and whether it has its own AGENTS.md (with line count). This table is the gap-detection input — read it, don't recompute it by hand.
  2. Tree scan. Prefer treezip . (compressed, AI-readable tree; npm i -g treezip) over raw tree — it brace-groups siblings and hardcodes an aggressive noise filter (VCS dirs, node_modules, venvs, caches, DerivedData, worktrees under .claude/), so the structure fits in context without hand-filtering. Fall back to tree -dL 2 . (-dL 3 for monorepos) when treezip isn't installed. Either way, budget the read: if the output is dominated by one noisy subtree (vendored deps, build products, checked-in worktrees), locate where the real source tree resumes and read that section — never page through build noise, and never write a one-off script to parse the tree.
  3. Gap folders — select, don't enumerate. From the coverage map, a folder is a gap candidate only when all of these hold:

Expect to skip most folders. A healthy pass on a mid-size repo adds 2–4 folder files, not one per directory. In the Quality Report, list skipped candidates with a one-line reason each ("conventional UI code", "covered by root") so the user can veto.

  1. Churn signal — the steering trick. For each existing doc, get its last edit timestamp:

```bash

git log -1 --format=%ct -- <doc>

```

Then for the source files that doc references (anything matching \b[\w./-]+\.[a-z]+:\d+\b in the doc), list commits since that timestamp:

```bash

git log --since=<timestamp> --oneline -- <referenced-file>

```

This is the audit scope. If the doc was last touched at T and styles.css has had 12 commits since T, that file's line refs and counts are guaranteed stale. Drive auditor focus there. Files with zero churn since the doc's last edit can be lower-priority.

Phase 1 — Quality Report (BEFORE editing)

Output the report — no edits yet. Format in references/audit-and-update.md. Headline rows:

| Surface | Count | Avg score | Stale-ref count | Notes |

|---|---|---|---|---|

| AGENTS.md | N | X/10 | M lines flagged | … |

| CLAUDE.md symlinks | N | ✅ / ⚠ | — | … |

| REVIEW.md | N | X/10 | M | … |

| Gap folders | N | — | — | List |

| Native adapters | N | — | — | List |

Then the coverage table — every code-bearing folder from the Phase 0 map, so the user sees what exists, how big it is, and what you propose:

| Folder | Src files | Src LOC | AGENTS.md | Decision |

|---|---|---|---|---|

| src/api/ | 41 | 7,200 | yes (65 lines) | audit for drift |

| src/transcription/ | 29 | 4,800 | — | author (invariant-dense) |

| src/components/ | 76 | 13,000 | — | skip: conventional UI, covered by root |

| src/utils/ | 8 | 400 | — | skip: small utility folder |

Every skipped row carries its one-line reason. Per-file: score + 5-line summary of what's drifted (line refs / invalidated rules / missing content / internal contradictions). Then ask the user:

  1. Which files to fix (default: all flagged as drift > 0)
  2. Which gap folders to fill (default: code-bearing ones only)
  3. Skip the post-edit native-adapter regeneration unless explicitly requested

Phase 2 — Parallel Opus auditor dispatch

After user confirms scope. Dispatch 3–5 parallel Opus agents, one per logical group of files. Sample grouping for a typical repo:

Each auditor follows the falsifiable-claim discipline — see references/agent-dispatch.md Auditor section. They:

Use the churn signal from Phase 0 to focus their attention.

Phase 3 — Triage findings

Classify the returned findings:

Decide which to fix this pass vs. defer. Default: fix high + medium; fix low only in surrounding edits.

Phase 4 — Parallel Opus writer dispatch

Dispatch 3–5 parallel Opus writers with the same grouping. Each writer gets:

Each writer applies Edit calls in place. They do not add new sections. They report which paths they touched and a 3-line summary per file. See references/agent-dispatch.md Writer section.

Phase 5 — Post-edit re-audit + commit + push

  1. Re-run bash scripts/audit-agents-md.sh — diff against the Phase 0 snapshot. Surface counts should match (or +N for gap folders newly created). No new orphan symlinks.
  2. Spot-check 2–3 high-impact corrections via grep — confirm the new ref points where the doc claims.
  3. Commit. One commit per concern:
  1. Push. Watch CI (typecheck on docs is no-op; the push exists to land the refresh).

Creative steering signals

These are the under-used patterns. Reach for them when the audit feels generic.

Reference routing

Read the smallest reference set that unblocks the current decision.

| Need | Reference |

|---|---|

| Quality Report format, drift categories, post-edit verification, falsifiable-claim discipline | references/audit-and-update.md |

| Auditor + writer prompt scaffolds (parallel-Opus dispatch) | references/agent-dispatch.md |

| AGENTS authoring, folder scoping, WHAT/WHY/HOW filter (applies to in-place edits too) | references/agents-md-format.md |

| Companion CLAUDE.md symlinks, native review adapter rules, cross-agent surfaces | references/agent-entrypoints.md |

| REVIEW.md purpose, root/scoped split, severity tagging | references/review-context.md |

Quick-start mapping

| Situation | Start with | Then read |

|---|---|---|

| Big refactor just landed; sweep all docs | references/audit-and-update.md | references/agent-dispatch.md |

| Just need to refresh frequency tables | references/audit-and-update.md (recount section) | — |

| Add AGENTS.md for newly-discovered code folder | references/agents-md-format.md | references/agent-entrypoints.md |

| REVIEW.md needs severity refresh after rule changes | references/review-context.md | references/audit-and-update.md |

Final output expectations

When you finish a run, return:

  1. Phase 0 scan — surface counts before and after; gap folders identified
  2. Quality Report — pre-edit, with per-file scores and drift findings
  3. Triage decision — which findings landed this pass, which deferred
  4. Files edited + files authored — explicit list with line-count deltas
  5. Companion symlink status — verified intact; new ones for gap folders
  6. Re-audit diff — Phase 5 output vs Phase 0
  7. Commits + push state — commit SHAs, CI status
  8. Unresolved unknowns — [unverified] markers left in place, why
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.