diff --git a/.agents/skills/capture-learning/SKILL.md b/.agents/skills/capture-learning/SKILL.md new file mode 100644 index 0000000..c0a9af0 --- /dev/null +++ b/.agents/skills/capture-learning/SKILL.md @@ -0,0 +1,77 @@ +--- +name: capture-learning +description: After a PR merges, examine the completed change and decide whether permanent project knowledge should be preserved — a new ADR, an updated runbook, a changed command/dependency in .ai/, or an architecture doc that's now stale — then write it and clean up the task's handoff/context files. Use when the user says "capture learnings from this", "what should we document from this merge", after merging a PR, or when closing out a ticket. +--- + +# Capture Learning + +> Project values (ticket prefix, default branch, repo list) come from +> `devrig.toml` and `AGENTS.md` at the workspace root — read them; never assume. + +Closes the loop in `AGENTS.md`'s lifecycle: implement → verify → review → PR → +merge → **capture learning** → better context for the next task. This is the +one point where the workspace's own knowledge improves from doing the work, +instead of staying static until someone remembers to update a doc. + +## Usage + +`/capture-learning` — the merged PR/ticket is inferred from the current session or branch. +`/capture-learning ` — explicit target. + +## Step 1 — Resolve what happened + +Gather, in parallel: + +1. The merged PR's diff and description: `gh pr view --json title,body,files,commits` and `gh pr diff ` (same resolution as `/code-review`'s Step 1 if only a branch/ticket is given). +2. The task's persisted context, if it exists: `.ai/context/.json`. +3. The task's handoff doc, if it exists: `knowledge/handoffs/.md`. +4. Any `/verify-change` evidence from this session. + +## Step 2 — Ask the reflective questions + +Go through each; answer from the actual diff/PR body, not speculation: + +| Question | If yes | +|---|---| +| Did we make an architectural decision (a real fork in the road, not just "how we implemented it")? | Draft an ADR — `/write-doc adr ` | +| Did we discover an operational lesson (something that would help whoever's on call next)? | Add/update a runbook — `/write-doc runbook for ` | +| Did a command change (new script, changed test/build/lint invocation)? | Update `.ai/commands.yaml` and `AGENTS.md`'s Commands table | +| Did a system or dependency relationship change? | Update `.ai/systems.yaml` and `AGENTS.md`'s Systems table | +| Did we solve a recurring bug worth remembering? | Note it in the relevant architecture/runbook doc's known-gaps section (and remove the gap if it's now fixed) | +| Did this make existing architecture/design documentation inaccurate? | Update that doc directly; bump its `last_reviewed` | + +If every answer is genuinely no, say so and stop — don't manufacture a doc +for a purely mechanical change. Manufactured documentation is worse than none +(it erodes trust in `authority: canonical`). + +## Step 3 — Confirm scope + +If more than one item came back "yes", list them and let the user pick via +`AskUserQuestion` (multi-select) which to write now vs. skip — don't silently +write everything without a chance to review the list first. + +## Step 4 — Write it + +For each confirmed item, follow `/write-doc`'s normal flow (template, frontmatter, style) — don't duplicate its logic here, just feed it the right doc type and content. Set `authorship: ai-assisted`, `human_reviewed: false` unless a human is actively co-authoring. + +## Step 5 — Close out the task's working state + +- If `knowledge/handoffs/.md` exists, delete it (the task is done, not interrupted) or set `status: archived` if the team prefers keeping history. +- If `.ai/context/.json` exists, delete it — it's no longer useful once the task is merged. + +## Step 6 — Close the observability trail + +Write `.ai/runs//summary.md` — the final entry in that ticket's +observability trail (see `.ai/README.md`): what was captured as permanent +knowledge (with paths), what was skipped and why, and what was cleaned up. +This closes the run; nothing else writes to `.ai/runs//` after this. + +## Step 7 — Regenerate and land + +1. If `.ai/systems.yaml` or `.ai/ownership.yaml` changed: `node scripts/generate-architecture-views.mjs`. +2. `node scripts/build-knowledge-index.mjs`. +3. Land all changes from this run on **one** branch (`-docs-capture-learning`) and suggest `/raise-pr` — do not commit to the default branch. + +## Output + +Report what was captured (or "nothing worth capturing, here's why") and what was cleaned up (handoff/context files removed). diff --git a/.agents/skills/check-knowledge-consistency/SKILL.md b/.agents/skills/check-knowledge-consistency/SKILL.md new file mode 100644 index 0000000..f940856 --- /dev/null +++ b/.agents/skills/check-knowledge-consistency/SKILL.md @@ -0,0 +1,100 @@ +--- +name: check-knowledge-consistency +description: Compare the knowledge base and .ai/ config against actual repo state — ADRs vs implementation, architecture docs vs repos, runbooks vs scripts, documented API contracts vs actual routes, commands.yaml vs package.json, ownership.yaml vs CODEOWNERS — and report drift. Use when the user asks "are the docs still accurate", "find outdated documentation", "check knowledge consistency", or periodically as a health check. +--- + +# Check Knowledge Consistency + +> Project values (ticket prefix, default branch, repo list) come from +> `devrig.toml` and `AGENTS.md` at the workspace root — read them; never assume. + +Combines a mechanical pass (fast, deterministic) with a semantic pass (needs +an agent reading code) to catch documentation that's gone stale — the gap +`scripts/detect-doc-drift.mjs` can't close on its own because it can't read code. + +## Usage + +`/check-knowledge-consistency` — checks everything. +`/check-knowledge-consistency ` — scope to one system/repo. + +## Step 1 — Mechanical pass + +Run both, capture the output, don't re-derive what they already found: + +```bash +node scripts/validate-knowledge.mjs +node scripts/detect-doc-drift.mjs +``` + +## Step 2 — Semantic checks + +Run these per affected system/repo (in parallel where independent). Only +check repos that are actually cloned locally — note as "not checked (repo not +cloned)" for any that aren't, rather than skipping silently. + +**Commands ↔ package.json** — for each system in `.ai/commands.yaml`, read +that repo's `package.json` `scripts` and confirm every referenced `npm run +