{
  "markdown": "# md-linker\n\nMarkdown link graph and staleness detection plugin for Claude Code.\n\n## Why I made this\n\nIn agentic coding workflows, Claude Code generates and maintains many markdown documents — analysis reports, plans, progress logs, specs. But sessions end, context windows are finite, and documents drift out of sync. When the agent reads an outdated document in a later session, it reasons from stale information, leading to hallucination and inconsistent decisions.\n\nmd-linker turns your project's markdown files into a lightweight internal RAG system. It tracks cross-references between documents, detects when a linked document has changed, and ensures the agent always reads up-to-date content — eliminating a major source of context-related errors across sessions.\n\n## What it does\n\nWhen you edit a markdown file, md-linker automatically:\n\n1. **Detects broken links** — warns immediately if any `[[wikilinks]]` or `[markdown](links.md)` point to missing targets\n2. **Marks stale documents** — finds all documents that reference the changed file and adds `stale-refs` annotations to their frontmatter\n3. **Summarizes changes** — generates a concise diff summary (via Sonnet sub-agent) so Claude knows what changed without reading the full document\n\nWhen Claude reads a stale document, a PreToolUse hook resolves the `stale-refs` via a Sonnet sub-agent before the main agent sees the file — keeping the main context clean.\n\n## Installation\n\n```bash\nclaude plugin install md-linker\n```\n\nOr for local development:\n\n```bash\nclaude --plugin-dir /path/to/md-linker\n```\n\n## Usage\n\n### Automatic (via hooks)\n\nOnce installed, md-linker works automatically. Every time Claude edits a `.md` file:\n\n- **SessionStart** — detects external file changes (user edits, deletions, moves) by comparing content hashes, marks affected documents stale, and re-indexes the graph\n- **PreToolUse (Write|Edit)** — snapshots the file before modification\n- **PreToolUse (Read)** — resolves `stale-refs` via Sonnet sub-agent before the main agent reads the file\n- **PostToolUse (Write|Edit) sync** — diffs, updates the link graph, detects broken links, and marks stale documents\n- **PostToolUse (Write|Edit) async** — generates change summaries in the background\n\n### Manual (via commands)\n\n```\n/md-linker:init       # Scan all .md files and build the link graph\n/md-linker:status     # Show all stale documents\n/md-linker:graph      # Generate a dependency graph (PNG or .dot)\n/md-linker:rebuild    # Rebuild graph from scratch\n/md-linker:resolve    # Remove all stale-refs annotations\n```\n\n## Link syntax\n\nmd-linker tracks these link types:\n\n- `[[target]]` — wikilink (document-level)\n- `[[target#Section]]` — wikilink (section-level)\n- `[text](path.md)` — standard markdown link\n- `[ref]: path.md` — reference-style link\n- `depends-on` frontmatter field\n\n## Stale reference format\n\nWhen a linked document is modified, md-linker adds frontmatter like this:\n\n```yaml\n---\nstale-refs:\n  - source: docs/schema.md\n    changed_at: 2026-03-09T10:30:00\n    sections_changed: [\"User Model\"]\n    summary: \"Added email_verified field to User model\"\n---\n```\n\n## Requirements\n\n- Python 3.10+\n- Claude Code 1.0.33+\n- No external Python dependencies (stdlib only)\n\n## Roadmap\n\nPlanned features for future releases:\n\n- **Document normalization** — Reformat inconsistent markdown files to follow a standard structure (heading depth, bullet style, etc.)\n- **Document organization** — Classify documents by purpose and content, unify file names and titles according to naming conventions\n- **Defragmentation** — Merge related content scattered across multiple files into a single document, so the agent can read it in one context\n- **Fragmentation** — Split documents with independently meaningful sections into atomic files linked via an index, avoiding unnecessary full-document reads\n- **Auto-linking** — Detect closely related documents that lack cross-references and insert links automatically\n\n## Contributing\n\nThis project is under active development. Bug reports, corner case discoveries, and improvement suggestions are all welcome — feel free to open an issue or pull request.\n\n## License\n\nMIT\n",
  "bytes": 4163,
  "sha": "9000623dc96bd1983269d8ee675e1f64cb43421158c98829badce46aa62ee00f",
  "repo_slug": "dev-jahn/md-linker",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/plg_dev_jahn_md_linker_md_linker_ccc3e1d9/readme"
}