{
  "markdown": "<h1 align=\"center\">Draft</h1>\n\n<p align=\"center\">\n  <strong>Stop shipping AI-generated bugs.</strong><br>\n  One command runs a three-stage review on your branch — validation, spec compliance, code quality — and writes the missing tests. Free. Open-source. MIT.\n</p>\n\n<p align=\"center\">\n  <a href=\"https://github.com/drafthq/draft/releases\"><img src=\"https://img.shields.io/github/v/release/drafthq/draft?include_prereleases&style=for-the-badge\" alt=\"GitHub release\"></a>\n  <a href=\"LICENSE\"><img src=\"https://img.shields.io/badge/License-MIT-blue.svg?style=for-the-badge\" alt=\"MIT License\"></a>\n  <a href=\"https://github.com/drafthq/draft/stargazers\"><img src=\"https://img.shields.io/github/stars/drafthq/draft?style=for-the-badge\" alt=\"Stars\"></a>\n  <a href=\"https://github.com/DeusData/codebase-memory-mcp\" target=\"_blank\" rel=\"noopener noreferrer\"><img src=\"https://img.shields.io/badge/graph_engine-codebase--memory--mcp-8A2BE2?style=for-the-badge\" alt=\"Graph engine: codebase-memory-mcp\"></a>\n</p>\n\n<p align=\"center\">\n  Powered by <a href=\"https://github.com/DeusData/codebase-memory-mcp\" target=\"_blank\" rel=\"noopener noreferrer\">codebase-memory-mcp</a> by <a href=\"https://github.com/DeusData\" target=\"_blank\" rel=\"noopener noreferrer\">DeusData</a> — a 159-language, 100% local knowledge-graph engine.\n</p>\n\n<p align=\"center\">\n  <a href=\"https://getdraft.dev\">Website</a> ·\n  <a href=\"https://getdraft.dev#commands\">Docs</a> ·\n  <a href=\"core/methodology.md\">Methodology</a> ·\n  <a href=\"https://www.youtube.com/watch?v=gBSwFEFVd7Y\">Watch (8 min)</a> ·\n  <a href=\"https://www.youtube.com/playlist?list=PLoN73NRJ_HQPdnR5Su4WkWK-O_7IOrOg_\">All Videos</a>\n</p>\n\n---\n\n## The 60-second pitch\n\nYour AI assistant just wrote 200 lines. Some of them are bugs. Some don't match your patterns. Some skip tests.\n\n```bash\n/draft:review\n```\n\nThree stages, one command:\n\n1. **Validation** — runs your tests, lints, type-checks, and surfaces real failures\n2. **Spec compliance** — checks the diff against the agreed spec, not vibes\n3. **Code quality** — flags hotspots, blast radius, and missing test coverage using a tree-sitter knowledge graph of your repo\n\nNo setup required for the first run: on an un-indexed repo it reviews the diff and names the structural checks it skipped, so you see findings before you spend anything.\n\nFree. No API keys. No paid tier. No vendor lock-in. Catches the 3 bugs you missed before they hit your reviewer.\n\n> *Demo coming soon — for now, [watch the 8-minute walkthrough](https://www.youtube.com/watch?v=gBSwFEFVd7Y).*\n\n---\n\n## Install (30 seconds)\n\nOne command installs Draft into your agent. No clone, no config.\n\n```bash\nnpx @drafthq/draft install <host>      # claude-code | cursor | codex | opencode\n```\n\n…or install the CLI once and reuse it:\n\n```bash\nnpm install -g @drafthq/draft\ndraft install <host>\ndraft list                             # show every host + where it installs\n```\n\nEach host installs the way that host actually loads extensions — no manual steps after the command:\n\n| Host | `draft install …` | What it does |\n|------|-------------------|--------------|\n| **Claude Code** | `claude-code` | Registers the plugin via `claude plugin marketplace add` + `claude plugin install` (default `--global` / user scope). Restart Claude Code. |\n| **Cursor** | `cursor` | Default `--global`. Copies the plugin into `~/.cursor/plugins/local/draft/`, writes `.cursor-plugin/plugin.json`, registers `draft@draft-plugins` in Cursor's plugin registry, and enables it. Restart Cursor (or Developer: Reload Window). Existing installs upgrade with `draft install cursor --force`. |\n| **Codex** | `codex` | Default `--project`. Writes `./AGENTS.md`, which Codex reads automatically. |\n| **opencode** | `opencode` | Default `--project`. Writes `./AGENTS.md` + `~/.agents/skills/draft/`, both auto-discovered. |\n\nFlags: `--global` / `--project` to pick scope (`--global` is the default for `claude-code` and `cursor`; `--project` is the default for `codex` and `opencode`), `--dry-run` to preview, `--force` to overwrite, `--no-graph` to skip the graph-engine fetch.\n\nThen, in Claude Code (after restarting):\n\n```bash\n/draft:review     # ← start here. No setup, no indexing. Reviews your current diff.\n/draft:init       # once you've seen what it catches: index the repo (one-time)\n/draft:review     # same command, now with blast radius + hotspots + cycle detection\n```\n\n`/draft:review` runs on an un-indexed repo and tells you exactly which structural checks it had to skip. Indexing is the upgrade, not the entry fee.\n\nRun `/draft` for the full command map.\n\n<details>\n<summary><strong>Other ways to install →</strong></summary>\n\n### Claude Code — native marketplace\n\n```bash\n/plugin marketplace add drafthq/draft\n/plugin install draft\n```\n\n### Cursor — from GitHub\n\nCursor requires `.cursor-plugin/plugin.json`; the `draft install cursor` command also registers the plugin via the shared Claude plugin registry that Cursor reads on many builds. To add from source instead, use *Settings > Rules, Skills, Subagents > Rules > New > Add from Github*:\n\n```text\nhttps://github.com/drafthq/draft.git\n```\n\n### GitHub Copilot\n\nCopilot reads a committed instructions file — copy it directly (not a `draft install` host):\n\n```bash\nmkdir -p .github && curl -o .github/copilot-instructions.md \\\n  https://raw.githubusercontent.com/drafthq/draft/main/integrations/copilot/.github/copilot-instructions.md\n```\n\n### Gemini\n\n```bash\ncurl -o .gemini.md https://raw.githubusercontent.com/drafthq/draft/main/integrations/gemini/.gemini.md\n```\n\n</details>\n\n---\n\n## The five commands\n\n| Command | What it does |\n|---------|--------------|\n| **`/draft:review`** | 3-stage review of your diff. **Works with zero setup** — run it first. |\n| **`/draft:init`** | Index the repo once. Adds blast radius, caller lookup, hotspot ranking, and cycle detection to every later review. |\n| **`/draft:new-track`** | Turn an idea into a spec + plan before any code is written. |\n| **`/draft:implement`** | Execute the plan task-by-task under TDD with verification gates. |\n| **`/draft:graph`** | Build or refresh the knowledge-graph snapshot on its own. |\n\nThat is the whole loop. 28 more specialist commands — bug hunting, ACID audits, ADRs, tech debt, incident response, Jira, coverage, standups — sit behind five intent routers (`/draft:plan`, `/draft:discover`, `/draft:ops`, `/draft:docs`, `/draft:jira`).\n\n[Full command reference →](docs/COMMANDS.md) · run `/draft` for the interactive intent map\n\n---\n\n## Built-in Code Intelligence\n\nDraft is powered by a **local knowledge graph engine** ([codebase-memory-mcp](https://github.com/DeusData/codebase-memory-mcp)) that gives every command precise structural context — module boundaries, call graphs, dependencies, hotspots. It's 100% local (no API key, no SaaS), fetched during `draft install` (best-effort; `--no-graph` to skip), with first-use fetch as a fallback.\n\n```bash\n/draft:graph                                  # build / refresh the snapshot\nscripts/tools/graph-impact.sh --file src/auth/login.go\n# → blast radius: which files, which symbols, which tests/docs/configs\n```\n\n| Capability | What it provides |\n|---|---|\n| **Multi-language extraction** | Tree-sitter + LSP-grade resolution across 159 languages, 100% local |\n| **Call graph** | Callers/callees with confidence signals so review/bughunt can weight findings |\n| **Impact analysis** | Blast-radius with file-class dimension (code/test/doc/config) — answers *\"what breaks if I change this?\"* |\n| **Cycle detection** | Flags circular call dependencies before they bite |\n| **Hotspot ranking** | Fan-in score so high-risk symbols get extra scrutiny |\n| **Incremental indexing** | git-aware, content-based; only changed code re-indexes |\n| **Track impact memory** | `metadata.json.impact` snapshots each completed track's blast radius — `/draft:new-track` flags overlap with recent work |\n\nThe graph powers `/draft:graph` and `/draft:impact`, enriches `/draft:bughunt` and `/draft:review`, and is consumed by skills via `core/shared/graph-query.md`. The engine is installed via [`scripts/fetch-memory-engine.sh`](scripts/fetch-memory-engine.sh); the deterministic shell helpers live under [`scripts/tools/`](scripts/tools/).\n\n### Deterministic helper tools\n\nSkills also call into **shell helpers** under `scripts/tools/` for mechanical work — git metadata, file classification, test-framework detection, hotspot ranking, freshness checks, ADR indexing, and live graph queries (`graph-callers.sh`, `graph-impact.sh`, `hotspot-rank.sh`, `cycle-detect.sh`, `mermaid-from-graph.sh`). All emit JSON or markdown and follow a uniform exit-code contract. Graph wrappers fail loud: shapeless `{}` (no `.rows` array) is `source:\"unavailable\"` with a non-zero exit, not a measured empty result.\n\n---\n\n## How It Works\n\n```text\n┌─────────────────────────────────────────────────────────────┐\n│                        /draft:init                          │\n│    5-phase codebase analysis + signal detection + state     │\n│  architecture.md + .ai-context.md + .state/ (freshness,    │\n│                   signals, run memory)                      │\n└────────────────────────────┬────────────────────────────────┘\n                             │\n                             ▼\n┌─────────────────────────────────────────────────────────────┐\n│                      /draft:new-track                       │\n│            AI-guided spec.md + phased plan.md               │\n└────────────────────────────┬────────────────────────────────┘\n                             │\n                             ▼\n┌─────────────────────────────────────────────────────────────┐\n│                     /draft:implement                        │\n│              RED → GREEN → REFACTOR (repeat)                │\n└────────────────────────────┬────────────────────────────────┘\n                             │\n                             ▼\n┌─────────────────────────────────────────────────────────────┐\n│                      /draft:review                          │\n│        Three-stage review (validation + spec + quality)     │\n└─────────────────────────────────────────────────────────────┘\n\n         /draft:init refresh  ←── incremental: only re-analyze\n                                   files with changed hashes\n```\n\n### Context output modes (`/draft:init`)\n\n`/draft:init` packages your architecture context in one of two modes, selected\nautomatically by repo size (override with `DRAFT_INIT_MODE`):\n\n- **`monolith`** (default for small repos, tiers 1–2) — a single\n  graph-primary `architecture.md` is the source of truth; `.ai-context.md` is\n  the token-optimized AI view derived from it.\n- **`okf`** (default for larger repos, tiers 3+) — an **OKF concept taxonomy**\n  under `draft/wiki/` is the source of truth (one concept per file, cross-links\n  form the graph), `.ai-context.md` becomes the navigable index root\n  (Synopsis + Concept Map), and `architecture.md` is demoted to a generated\n  rendered view. An optional self-contained offline HTML viewer ships under\n  `draft/wiki/web/`.\n\nBoth modes produce the same `product.md`, `tech-stack.md`, `workflow.md`,\n`guardrails.md`, tracks, and `.state/` — only the architecture packaging differs.\n\n[Full workflow →](core/methodology.md#core-workflow)\n\n---\n\n## Why Draft?\n\nAI tools are fast but unstructured. Draft applies Context-Driven Development to impose clear boundaries: explicit context, phased execution, and built-in verification, ensuring outputs remain aligned, predictable, and production-ready.\n\n```text\nproduct.md       →  \"Build a task manager\"\ntech-stack.md    →  \"React, TypeScript, Tailwind\"\narchitecture.md  →  Comprehensive: 10-section graph-primary engineering reference, Mermaid diagrams (source of truth). Mature brownfield projects with strong existing agent docs (CLAUDE.md, INVARIANTS.md, etc.) receive early Context Quality Audit, graph fidelity dashboard, and explicit Relationship + Gaps sections (no blind duplication).\n.ai-context.md   →  200-400 lines: condensed from architecture.md (token-optimized AI context)\n.state/          →  freshness hashes, signal classification, run memory (incremental refresh)\nspec.md          →  \"Add drag-and-drop reordering\"\nplan.md          →  \"Phase 1: sortable, Phase 2: persist\"\n```\n\nEach layer narrows the solution space. By the time AI writes code, decisions are made.\n\n**Incremental refresh**: After initial setup, `/draft:init refresh` uses stored file hashes and signal classification to only re-analyze what changed — no full re-scan needed.\n\n[Read methodology →](core/methodology.md#philosophy)\n\n---\n\n## Contributing\n\n### Source of Truth\n\n1. `core/methodology.md` — Master methodology\n2. `skills/<name>/SKILL.md` — Command implementations\n3. `integrations/` — Auto-generated (don't edit)\n\n### Update Workflow\n\n```bash\n# 1. Edit core/methodology.md or skills/*/SKILL.md\n# 2. Rebuild integrations\n./scripts/build-integrations.sh\n```\n\n[Full architecture →](CLAUDE.md)\n\n---\n\n## Star History\n\n[![Star History Chart](https://api.star-history.com/svg?repos=drafthq/draft&type=Date)](https://star-history.com/#drafthq/draft&Date)\n\n---\n\n<p align=\"center\">MIT License &middot; Created &amp; maintained by <a href=\"https://www.linkedin.com/in/mayurpise/\" target=\"_blank\" rel=\"noopener noreferrer\">Mayur Pise</a> &middot; Graph engine: <a href=\"https://github.com/DeusData/codebase-memory-mcp\" target=\"_blank\" rel=\"noopener noreferrer\">codebase-memory-mcp</a> by <a href=\"https://github.com/DeusData\" target=\"_blank\" rel=\"noopener noreferrer\">DeusData</a></p>\n\n<p align=\"center\">\n  <strong>Credits:</strong> Inspired by <a href=\"https://github.com/gemini-cli-extensions/conductor\">gemini-cli-extensions/conductor</a>\n</p>\n",
  "bytes": 13718,
  "sha": "b7ba82acaf38a71ea90543ae3697f3c2db84092e36b4258722fc3c2c34ebe879",
  "repo_slug": "mayurpise/draft",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/plg_mayurpise_draft_draft_4a6042e5/readme"
}