You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(init)!: single scope-aware /draft:init, remove /draft:index (3.0.0)
/draft:init is now the single, scope-aware entry point. It builds the whole-repo code-graph knowledge memory first (the root spine), then scope-local context. New scripts/tools/graph-init.sh resolves the repo ROOT (ancestor-draft/ -> git toplevel -> cwd), ensures the engine (fetching as fallback), builds the committed root snapshot, and in a sub-module writes the module snapshot + draft/graph/root-link.json pointing up to the root graph. Adds --graph-only and --module-only flags; markdown is scope-asymmetric (sparse root / detailed module) while the graph stays symmetric. Rewires routers (discover, draft, intent-mapping), methodology, shared procedures, and 6 root-aggregation templates from index to init; the multi-directory bug sweep moves to /draft:bughunt. Also syncs pending OKF feature docs and bumps 2.8.3 -> 3.0.0 across package.json, plugin.json, marketplace.json, web, and docs.
BREAKING CHANGE: /draft:index is removed. Run /draft:init at the repo root for whole-repo context (graph spine + sparse root map), or inside a sub-module for detailed context linked up to the root graph.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: CLAUDE.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,16 +4,16 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
4
4
5
5
## Repository Overview
6
6
7
-
Draft is a Claude Code plugin that implements Context-Driven Development methodology. It provides a two-tier command surface: 4 primary workflow commands (`/draft:init`, `/draft:new-track`, `/draft:implement`, `/draft:review`) plus 5 routers (`/draft:plan`, `/draft:ops`, `/draft:docs`, `/draft:discover`, `/draft:jira`) as the recommended public interface. 25 specialist commands are dispatched underneath the routers. The unified `/draft:jira` router supports `preview`, `create`, and the advanced `review <JIRA-ID>` qualification pipeline (deep-review + bughunt + coverage + test-gap analysis). Run `/draft` for the full intent map. Total surface: 34 skills.
7
+
Draft is a Claude Code plugin that implements Context-Driven Development methodology. It provides a two-tier command surface: 4 primary workflow commands (`/draft:init`, `/draft:new-track`, `/draft:implement`, `/draft:review`) plus 5 routers (`/draft:plan`, `/draft:ops`, `/draft:docs`, `/draft:discover`, `/draft:jira`) as the recommended public interface. 24 specialist commands are dispatched underneath the routers. The unified `/draft:jira` router supports `preview`, `create`, and the advanced `review <JIRA-ID>` qualification pipeline (deep-review + bughunt + coverage + test-gap analysis). Run `/draft` for the full intent map. Total surface: 33 skills.
8
8
9
-
Draft also ships a **knowledge graph engine** under `bin/<arch>/` (native Aether binaries) + `scripts/tools/` (14 deterministic shell helpers). Skills are markdown (source of truth, processed by a bash build script into platform-specific integration files for Copilot and Gemini); the graph engine and shell helpers handle mechanical work that markdown can't.
9
+
Draft also ships a **knowledge graph engine** under `bin/<arch>/` (native Aether binaries) + `scripts/tools/` (34 deterministic shell helpers). Skills are markdown (source of truth, processed by a bash build script into platform-specific integration files for Copilot and Gemini); the graph engine and shell helpers handle mechanical work that markdown can't.
10
10
11
11
## Build & Test Commands
12
12
13
13
```bash
14
14
make build # Generate integration files from skills
15
15
make build-integrations # Same as above (explicit target)
16
-
make test# Run all 25 test suites (skills, build, tools)
16
+
make test# Run all 44 test suites (skills, build, tools)
17
17
make lint # Run shellcheck + markdownlint
18
18
make clean # Remove generated integrations
19
19
@@ -47,7 +47,7 @@ core/agents/*.md ──┘
47
47
```
48
48
49
49
The build script (`scripts/build-integrations.sh`) reads `SKILL_ORDER`, `CORE_FILES`, and `TOOLS` from `scripts/lib.sh` (sourced) and:
50
-
1. Iterates `SKILL_ORDER` (34 skills in current two-tier model, order matters)
50
+
1. Iterates `SKILL_ORDER` (33 skills in current two-tier model, order matters)
51
51
2. Validates YAML frontmatter (`name:` and `description:` required)
52
52
3. Validates body format: blank, `# Title`, blank, then content
53
53
4. Extracts body via `extract_body()`, skipping frontmatter
-**`web/`** — Static website deployed to GitHub Pages (`getdraft.dev`), deployed via `.github/workflows/pages.yml`. Includes the Draft Book (22 chapters + 2 appendices) under `web/book/`.
74
74
-**`draft/`** — Dogfooding: Draft's own context files, generated by running `/draft:init` on this repo
`/draft:review` is the wedge. Once Draft has indexed your repo, you also get spec-driven planning, TDD-enforced implementation, exhaustive bug hunting, deep architectural audits, and 29 more commands covering the full development lifecycle.
118
+
`/draft:review` is the wedge. Once Draft has indexed your repo, you also get spec-driven planning, TDD-enforced implementation, exhaustive bug hunting, deep architectural audits, and 32 more commands covering the full development lifecycle.
119
119
120
120
---
121
121
@@ -187,7 +187,7 @@ The graph powers `/draft:graph` and `/draft:impact`, enriches `/draft:bughunt` a
187
187
188
188
### Deterministic helper tools
189
189
190
-
Skills also call into **14 shell helpers** under `scripts/tools/` for mechanical work — git metadata, file classification, test-framework detection, hotspot ranking, freshness checks, ADR indexing. All emit JSON, follow a uniform exit-code contract, and degrade gracefully when their input source is unavailable.
190
+
Skills also call into **34 shell helpers** under `scripts/tools/` for mechanical work — git metadata, file classification, test-framework detection, hotspot ranking, freshness checks, ADR indexing, and Open Knowledge Format emission/validation (`okf-emit.sh`, `okf-bundle.sh`, `okf-check.sh`). All emit JSON or markdown, follow a uniform exit-code contract, and degrade gracefully when their input source is unavailable.
|`okf/`| Open Knowledge Format v0.1 bundle (`index.md` + cross-linked `modules/<name>.md`), emitted by default — a portable markdown mirror of the graph. Validate with `okf-check.sh`. |
59
+
47
60
## Offline / air-gapped distributions
48
61
49
62
To ship the engine in-tree, place the binary at `bin/<os>-<arch>/codebase-memory-mcp` (resolution step 4). This is optional and not the default; the managed fetch is preferred.
@@ -405,7 +405,7 @@ Draft auto-classifies the project:
405
405
-**Brownfield (existing codebase):** Detected by the presence of `package.json`, `requirements.txt`, `go.mod`, `Cargo.toml`, `src/`, or git history with commits. Draft scans the existing stack and pre-fills `tech-stack.md`.
406
406
-**Greenfield (new project):** Empty or near-empty directory. Developer provides all context through dialogue.
407
407
-**Mature high-context brownfield:** Projects with strong existing agent-optimized docs (CLAUDE.md, INVARIANTS.md, ADRs, etc.) now receive an early Context Quality Audit, graph fidelity declaration, and explicit Relationship/Gaps sections so the generated architecture.md acts as graph-primary overlay rather than duplicative prose.
408
-
-**Monorepo:** Detected by `lerna.json`, `pnpm-workspace.yaml`, `nx.json`, `turbo.json`, or multiple package manifests in child directories. Suggests `/draft:index` instead.
408
+
-**Monorepo:** Detected by `lerna.json`, `pnpm-workspace.yaml`, `nx.json`, `turbo.json`, or multiple package manifests in child directories. `/draft:init` is scope-aware — run it at the root for whole-repo context (sparse root map + the code-graph spine), or inside a sub-module to generate detailed module context that links up to the root graph. See **Monorepo Support (via /draft:init)** below.
409
409
410
410
#### Initialization Sequence
411
411
@@ -499,32 +499,31 @@ The parent command should move planning forward rather than listing options.
499
499
500
500
---
501
501
502
-
### `/draft:index` — Monorepo Service Index
502
+
### Monorepo Support (via `/draft:init`)
503
503
504
-
Aggregates Draft context from multiple services in a monorepo into unified root-level documents. Designed for organizations with multiple services, each with their own `draft/` context.
504
+
There is no separate index command — `/draft:init` is the single, scope-aware entry point. The same command behaves differently by where it is run, so a monorepo needs no special tooling.
2.**Reads** each service's `draft/product.md`, `draft/.ai-context.md` (or legacy `draft/architecture.md`), `draft/tech-stack.md`
510
-
3.**Synthesizes** root-level documents:
508
+
1.**Builds the whole-repo code-graph spine** — `graph-init.sh` indexes every file at every depth into one unified graph and writes the committed `draft/graph/` snapshot (the structural source of truth).
509
+
2.**Generates a sparse root map** (not deep per-module prose), aggregating the children into root-level documents:
511
510
-`draft/service-index.md` — Service registry with status, tech, and links
-`init-missing` — Run `/draft:init` on services that lack a `draft/` directory
521
-
-`bughunt [dir1 dir2 ...]` — Run `/draft:bughunt` across subdirectories with `draft/` folders. If no directories specified, auto-discovers all subdirectories with `draft/`. Generates summary report at `draft-index-bughunt-summary.md`.
518
+
1.**Ensures the root spine exists first** (builds it if missing), then builds the module's own `draft/graph/` snapshot.
519
+
2.**Writes `draft/graph/root-link.json`** — a pointer up to the root graph so the module has full cross-module understanding regardless of where init ran.
520
+
3.**Generates the detailed module reference** (full 10-section `architecture.md` for the subtree). Use `--module-only` to skip touching the root (link marked `pending`).
522
521
523
522
#### When to Use
524
523
525
-
- After running `/draft:init`on individual services
526
-
-After adding or removing services from the monorepo
527
-
-Periodically to refresh cross-service context
524
+
- After cloning or adding a service — run `/draft:init`in it (auto-links to the root spine)
525
+
-At the root after services change — refresh the whole-repo graph + sparse root map
526
+
-`/draft:init --graph-only`to (re)build just the code-graph knowledge memory, no markdown
|`draft/graph/hotspots.jsonl`| Fan-in-ranked symbols, one object per line: `{id, name, fanIn}`| JSONL |
77
77
78
+
The snapshot also includes `draft/graph/okf/` — an Open Knowledge Format v0.1 bundle (`index.md` + `modules/*.md`) emitted by default. It is a portable mirror of the graph, not an always-load target.
79
+
78
80
Note: `.ai-context.md` embeds a condensed graph summary (`GRAPH:MODULES`, `GRAPH:HOTSPOTS`, `GRAPH:CYCLES`) for first-pass structural ground truth. `architecture.json` is authoritative for deep structure.
79
81
80
-
Note: The canonical embedded mermaid diagrams are in architecture.md injection slots (`<!-- GRAPH:module-deps:START/END -->`, `<!-- GRAPH:proto-map:START/END -->`), refreshed by `draft:index`. For current data, regenerate via `scripts/tools/mermaid-from-graph.sh`.
82
+
Note: The canonical embedded mermaid diagrams are in architecture.md injection slots (`<!-- GRAPH:module-deps:START/END -->`, `<!-- GRAPH:proto-map:START/END -->`), refreshed by `draft:init`. For current data, regenerate via `scripts/tools/mermaid-from-graph.sh`.
81
83
82
84
**Live structural queries** (run on demand — no per-language index files; the engine's model is unified):
0 commit comments