Purpose
Run a long-running coding/maintenance agent over the WikiLLM vault performing the Lint operation defined in
CLAUDE.md. This spec is the Specify-phase artifact for Spec-Driven Development and thefeature_list.jsonanalogue for the initializer + coding agent pattern. Use it to test long-running agents on a real workload with verifiable artifacts.
Why this is a good test workload
Per Long-Running Agents — three-walls criteria:
- Finite context. ~100 wiki pages, ~50 sources, ~10 MOCs. Cannot be loaded at once. Forces real context-engineering: just-in-time reads, hierarchical summaries, per-page sessions.
- No persistent state. Each session must reconstruct where we are from durable artifacts on disk. The vault itself is the durable session log.
- No self-verification. The agent must re-read pages it touched and confirm wikilinks resolve, frontmatter parses, conventions hold. Premature-victory is the canonical failure here.
Per Five Patterns for Long-Running Agents in Production:
- Checkpoint-and-resume — every page processed = one checkpoint
- Memory-layered context —
CLAUDE.md+index.mdare the long-term memory; current page is the working set - Three-tier boundaries — see Boundaries below
- Optionally fleet orchestration — see Stretch goals
Specify (the what and why)
User journey
You (the vault owner) want to know that:
- Every wikilink in the vault resolves to an existing page (or is intentionally a stub).
- Every page has frontmatter conforming to the schema in
CLAUDE.md. - Every image referenced via
![[Attachments/...]]exists. - No page contradicts another without an explicit
> [!warning]callout flagging the contradiction. - Orphan pages (not linked from any MOC or other page) are surfaced for review.
- Stale
updated:dates are surfaced (page edited afterupdated:field’s date). index.mdandMOCs/*are coherent with the actual page set.- The activity log (
log.md) reflects all the changes the agent makes.
Success criteria (done-condition)
The run is done when all of the following hold:
- A
lint-report.mdexists at the vault root with one section per finding category and zero unresolved items in any category, OR every unresolved item has an explicitwon't-fixnote with a reason. - A diff exists in git showing fixes applied; every commit message references the lint-report section it satisfies.
log.mdhas a[LINT]entry summarising the run.- A second pass of the agent finds zero new issues introduced by the first pass (idempotence check).
index.mdupdated:field reflects the run’s date.
Out of scope
- No content rewrites. Don’t improve prose. Lint is structural, not editorial.
- No new pages unless the user has approved a scaffold via Ask-first.
- No deletions. Even orphan pages get flagged, never deleted.
- No source modification.
Sources/is immutable perCLAUDE.md.
Plan (the how)
Stack
- The vault is a directory of Markdown files under
~/Data/Obsidian-Vault/WikiLLM/. - Use ripgrep, find, and standard Unix tools for scanning.
- Use git (already initialised) for history + checkpoints + recovery.
- Frontmatter is YAML; parse with any standard YAML reader.
- Wikilinks resolve by filename anywhere in the vault — short forms only (e.g.
[[Dan Koe]]not[[Authors/Dan Koe]]).
Initialiser-phase outputs
Run the initialiser once at the start. It produces:
lint-spec/feature_list.json— the rubric (see structure below)lint-spec/init.sh— sanity check script: ripgrep finds expected files, frontmatter parses on a sample, etc.lint-spec/progress.txt— empty, ready for the coding-agent to append- Initial git commit titled
chore: initialise lint run
Coding-agent loop
Each session:
pwdand confirm vault root.- Read
lint-spec/progress.txt,git log --oneline -20, andlint-spec/feature_list.json. - Pick the highest-priority
passes: falsefeature. - Execute that feature’s checks.
- Apply allowed fixes (per Boundaries).
- Re-run the checks; only flip
passes: truewhen the verification passes. - Append a session note to
lint-spec/progress.txt. - Commit with a message referencing the feature.
- Stop.
This is the Long-Running Agents - Initializer + Coding Pattern applied directly. The Ralph Loop wrapper around the coding agent is: “if any feature is passes: false, re-invoke.”
Tasks (the rubric — feature_list.json structure)
Each feature is a JSON object:
{
"id": "FM-001",
"category": "frontmatter",
"description": "Every wiki page has YAML frontmatter conforming to CLAUDE.md schema.",
"verification": [
"Walk every .md file outside Sources/, Attachments/, .obsidian/.",
"Parse YAML frontmatter; confirm required fields present (title, type, created, updated).",
"Confirm aliases use the correct form per CLAUDE.md (no double-quoted simple aliases).",
"List violations in lint-report.md under '## Frontmatter'."
],
"fix_tier": "ask_first",
"passes": false
}Categories (initial set)
The initialiser should expand each category into ~5–15 concrete features. Total target: ~60–100 features so the run takes meaningfully long.
| Category | Description |
|---|---|
| Wikilinks | Every [[link]] resolves to an existing file by filename; no folder-prefixed wikilinks; aliases work |
| Frontmatter | YAML parses; required fields present; aliases follow CLAUDE.md form rules; updated: ≥ created: |
| Images | Every ![[Attachments/...]] exists; no external image URLs in non-Sources pages |
| MOC coverage | Every wiki page is reachable via at least one MOC or another page; orphans are listed |
| index.md coherence | Every page exists in index.md with a one-line summary; no index entries point to missing pages |
| Source immutability | Sources/*.md unmodified vs. their git history except for frontmatter-only changes |
| Author pages location | All author/person entity pages live in Authors/ |
| Aliases convention | No double-quoted simple aliases (per CLAUDE.md rule) |
| Log integrity | log.md has at most one heading per date; dates sorted descending; updated: field current |
Stale updated: | Page mtime > updated: frontmatter field date |
| Contradictions | Surface conflicting claims across pages on the same topic (LLM-as-a-judge pass) |
| Broken cross-refs | [[Page#Section]] or `[[Page |
AGENTS.md (the operational rules — six core areas)
Commands
# Sanity / dev
rg --files | wc -l # count vault files
fd -e md . | wc -l # count markdown files
git status # check working tree
# Per-feature checks (examples)
rg -o '\[\[([^\]]+)\]\]' --no-filename | sort -u # all wikilinks, deduped
fd -e md . Authors # author pages
git log --oneline -20 # recent commits
# Self-test
bash lint-spec/init.sh # sanity script must passTesting
- “Tests” = re-running the verification step of each feature after applying a fix.
- A feature is
passes: trueonly when verification re-runs cleanly. - After completing all features, an idempotence pass: re-run the entire rubric; zero new violations expected.
Project structure
- Wiki lives under repo root; treat the whole vault as the working tree.
- Lint artefacts go in
lint-spec/. - The lint report goes at vault root:
lint-report.md. - Never write outside the vault.
Code style
- Frontmatter follows
CLAUDE.mdexactly. Examples beat rules — when in doubt, copy the structure of a known-good page (e.g.Long-Running Agents.md). - Wikilinks always short form:
[[Dan Koe]]not[[Authors/Dan Koe]]. > [!warning],> [!note],> [!key insight],> [!summary]callouts are the canonical structure markers.- Commit messages: Conventional Commits —
lint(wikilinks): fix 3 broken refs in MOC — AI Agents.
Git workflow
- One feature = one commit (or one tight commit cluster). Easier rollback.
- Branch:
lint-run/<YYYY-MM-DD>. PR is optional (single-developer vault) but commit history must be clean enough to bisect. - Never amend or rebase commits the agent has already pushed (assume an observer reads the log live).
Boundaries (three-tier)
| Tier | Action |
|---|---|
| ✅ Always | Read any .md file in the vault; run ripgrep / fd / git read-only commands; append to lint-report.md; append to lint-spec/progress.txt; commit changes with descriptive messages; update updated: frontmatter on pages it modifies |
| ⚠️ Ask first | Edit page content (anything outside frontmatter); add a > [!warning] Contradiction with [[X]] callout; modify index.md; modify MOCs/*.md; rename a file; create a new page |
| 🚫 Never | Modify any file under Sources/ (frontmatter-only updates require explicit user approval and an Ask-first flag); delete any page; force-push; modify .obsidian/; commit secrets or local paths; rewrite prose for “improvement”; modify CLAUDE.md (the schema is human-owned) |
Iterate (the cycle)
Per Writing Specs for AI Coding Agents principle 5:
- The agent should detect when this spec is incomplete (e.g. a category with no clear verification step) and surface it as an Ask-first item, not silently improvise.
- After a complete run, you (the human) review
lint-report.mdand the diff. Update this spec with anything missing. Re-run. - The spec is a living artifact. Treat it as code: commit changes; keep history.
Stretch goals (only if the basic run lands cleanly)
- Fleet orchestration. Split into specialist sub-agents per Cursor Planner Worker Judge: a Frontmatter Agent, a Wikilink Agent, a Coherence Judge. Each gets only the relevant portion of this spec; coordinated by a planner that picks the next category.
- Memory-layered context. Use the Memory Bank pattern: persist learned conventions across runs (e.g. “the
aliases:block-list form is preferred for entries with commas”) so the second run is faster than the first. - LLM-as-a-judge for contradictions. Run a separate evaluator agent over the content of pages on the same topic, flagging genuine semantic contradictions for human review.
- Self-improving rubric. Have the agent propose new feature categories based on issues it finds that don’t fit existing categories. Surface them as Ask-first.
Session bootstrap routine (paste into the coding-agent prompt)
You are a vault maintenance coding agent. Your spec is `Prompts/Vault Maintenance Spec.md`. Run the following bootstrap routine before doing anything else:
1. `pwd` — confirm you are at the vault root.
2. Read `lint-spec/progress.txt` and the last 20 lines of `git log --oneline`.
3. Read `lint-spec/feature_list.json` and pick the highest-priority `passes: false` feature.
4. Run `bash lint-spec/init.sh` to verify the environment.
5. Re-read the relevant sections of `Prompts/Vault Maintenance Spec.md` (Boundaries, the feature's category) and `CLAUDE.md` (the schema rules the feature checks).
6. Execute the feature's verification step. Apply only fixes within the ✅ Always tier without asking; pause and ask for ⚠️ Ask first; refuse 🚫 Never.
7. Re-run the verification. Flip `passes: true` only if it now passes cleanly.
8. Append a one-paragraph summary to `lint-spec/progress.txt` (date, feature id, what changed, what surprised you).
9. Commit with a message referencing the feature id.
10. Stop. Do not pick a second feature in the same session.
This is deliberately one feature per session to test session-to-session handoff — the load-bearing thing in long-running agents per Long-Running Agents - Initializer + Coding Pattern. If you want faster runs once it works, raise to N features per session.
What to watch for during the run
- Premature victory — agent flips
passes: truewithout re-running verification. Counter: the bootstrap routine forces a re-run. - Test-deletion — agent “fixes” a feature by softening its verification step. Counter: the verification step is part of the spec; don’t let the agent edit
feature_list.json’sverificationfield. - Boundary creep — agent rewrites prose because the wikilink fix “felt incomplete.” Counter: explicit ✅/⚠️/🚫.
- Context drift across sessions — agent forgets a convention learned in session 3 and re-introduces a violation in session 17. Counter: the
progress.txtshould accumulate learned conventions, not just tasks-done.
Related
- Long-Running Agents — umbrella concept; this spec is its concrete test
- Long-Running Agents - Initializer + Coding Pattern — the harness pattern this spec slots into
- Writing Specs for AI Coding Agents — principles this spec follows
- AGENTS.md Six Core Areas — the operational rules section adheres to this checklist
- Spec-Driven Development — this is the Specify + Plan + Tasks artefact in one document
- Curse of Instructions — why the spec splits into per-category features rather than one big rule list
- Ralph Loop — the outer wrapper that re-invokes until done
- Five Patterns for Long-Running Agents in Production — the patterns this spec exercises