@drafthq/draft 3.2.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.cursor-plugin/plugin.json +28 -0
- package/README.md +2 -2
- package/cli/src/hosts/cursor.js +35 -5
- package/cli/src/installer.js +20 -0
- package/cli/src/lib/cursor-registry.js +122 -0
- package/cli/src/lib/marker.js +93 -0
- package/cli/src/lib/plugin-manifest.js +20 -0
- package/core/methodology.md +1 -1
- package/core/shared/condensation.md +3 -2
- package/core/shared/git-report-metadata.md +3 -2
- package/core/shared/graph-query.md +4 -3
- package/core/shared/tool-resolver.md +71 -4
- package/core/templates/okf/ai-context-index.md +48 -0
- package/core/templates/okf/concept.md +54 -0
- package/core/templates/okf/index.md +40 -0
- package/core/templates/okf/section-index.md +25 -0
- package/core/templates/plan.md +3 -2
- package/integrations/agents/AGENTS.md +792 -102
- package/integrations/copilot/.github/copilot-instructions.md +792 -102
- package/package.json +3 -2
- package/scripts/lib.sh +10 -0
- package/scripts/tools/graph-preflight.sh +259 -0
- package/scripts/tools/okf-render-views.sh +373 -0
- package/scripts/tools/okf-validate.sh +204 -0
- package/scripts/tools/resolve-tools.sh +78 -0
- package/skills/adr/SKILL.md +3 -2
- package/skills/bughunt/SKILL.md +10 -1
- package/skills/coverage/SKILL.md +8 -3
- package/skills/debug/SKILL.md +16 -5
- package/skills/decompose/SKILL.md +29 -12
- package/skills/deep-review/SKILL.md +19 -6
- package/skills/deploy-checklist/SKILL.md +6 -5
- package/skills/graph/SKILL.md +15 -6
- package/skills/impact/SKILL.md +12 -1
- package/skills/implement/SKILL.md +20 -4
- package/skills/init/SKILL.md +36 -10
- package/skills/init/references/architecture-spec.md +17 -6
- package/skills/init/references/okf-emitter.md +223 -0
- package/skills/learn/SKILL.md +15 -4
- package/skills/quick-review/SKILL.md +13 -3
- package/skills/review/SKILL.md +32 -8
- package/skills/standup/SKILL.md +3 -2
- package/skills/status/SKILL.md +3 -2
- package/skills/tech-debt/SKILL.md +20 -6
- package/skills/upload/SKILL.md +3 -2
- package/integrations/copilot/.github/copilot-instructions.md.7iDz8X +0 -91
- package/integrations/copilot/.github/copilot-instructions.md.DoBdtd +0 -91
- package/integrations/copilot/.github/copilot-instructions.md.McGoBW +0 -122
- package/integrations/copilot/.github/copilot-instructions.md.VsPyLB +0 -91
- package/integrations/copilot/.github/copilot-instructions.md.XAVr7D +0 -91
- package/integrations/copilot/.github/copilot-instructions.md.YoFVFa +0 -91
- package/integrations/copilot/.github/copilot-instructions.md.a9DeW0 +0 -91
- package/integrations/copilot/.github/copilot-instructions.md.oxQs3B +0 -91
- package/integrations/copilot/.github/copilot-instructions.md.ww33Ly +0 -91
|
@@ -319,6 +319,23 @@ Check for arguments:
|
|
|
319
319
|
|
|
320
320
|
> `draft init` is the **single entry point** for building context — there is no separate `index` command. Init is scope-aware (root vs sub-module); see **Scope Detection** below.
|
|
321
321
|
|
|
322
|
+
### Output Mode (`DRAFT_INIT_MODE`)
|
|
323
|
+
|
|
324
|
+
Init has two output modes. The default is **tier-gated (`auto`)** — resolved from the codebase tier computed in Step 1.4.5 — and the `DRAFT_INIT_MODE` environment variable overrides it:
|
|
325
|
+
|
|
326
|
+
```bash
|
|
327
|
+
DRAFT_INIT_MODE="${DRAFT_INIT_MODE:-auto}"
|
|
328
|
+
# auto → resolved AFTER tier is known (Step 1.4.5):
|
|
329
|
+
# tier 1–2 (micro/small) → monolith
|
|
330
|
+
# tier 3–5 (medium/large/XL) → okf
|
|
331
|
+
# monolith / okf → explicit override; honored as-is.
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
- **`monolith`** — the standard path documented in this skill: a single `architecture.md` (10-section graph-primary) + derived `.ai-context.md` / `.ai-profile.md`. The default for **small repos (tier 1–2)**, where one linear document beats a taxonomy with little to navigate. Also the A/B baseline and the over-fetch fallback.
|
|
335
|
+
- **`okf`** — emit an OKF-conformant concept taxonomy bundle (`draft/wiki/`) with `.ai-context.md` as the index root and `architecture.md` demoted to a generated rendered view. The default for **tier 3+ repos**, where navigation + maintainability pay off. When active, follow `references/okf-emitter.md` for the decomposition + serialization + validation stage; all shared phases (5-phase analysis, graph snapshot, `.state/` hashing, scope detection, atomic staging) are reused unchanged.
|
|
336
|
+
|
|
337
|
+
The tier-gated default rests on **maintainability/readability** (one navigable concept per file, cleaner PRs, a generated `architecture.md` preserved for linear onboarding) — not on the A/B benchmark, which was accuracy-parity (`docs/audit/okf-benchmark.md`). `monolith` is **retained, not retired**: it is the tier-1/2 default, the A/B baseline, and the fallback. If `DRAFT_INIT_MODE` is unset, do not commit to a mode until **Step 1.4.5** has computed the tier.
|
|
338
|
+
|
|
322
339
|
### Route Explicit Modes Before Initialization
|
|
323
340
|
|
|
324
341
|
If the user explicitly invoked a specialist mode, route directly:
|
|
@@ -611,8 +628,15 @@ The knowledge-graph engine `codebase-memory-mcp` is Draft's **default** capabili
|
|
|
611
628
|
One command resolves ROOT, ensures the engine, builds the whole-repo spine, and — in a sub-module — builds the module snapshot and writes the `root-link.json` pointer:
|
|
612
629
|
|
|
613
630
|
```bash
|
|
631
|
+
# Locate Draft's bundled helpers (cwd is the user's project; ${CLAUDE_PLUGIN_ROOT}
|
|
632
|
+
# is not exported into skill Bash). See core/shared/tool-resolver.md.
|
|
633
|
+
DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
|
|
634
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
|
|
635
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
|
|
636
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
|
|
637
|
+
|
|
614
638
|
# Add --module-only to skip touching the root (link marked "pending").
|
|
615
|
-
if
|
|
639
|
+
if "$DRAFT_TOOLS/graph-init.sh" --scope .; then
|
|
616
640
|
echo "Graph memory ready under draft/graph/ (the root spine is the structural source of truth)."
|
|
617
641
|
else
|
|
618
642
|
echo "Graph engine unavailable — proceeding with degraded manual discovery. Downstream skills degrade gracefully."
|
|
@@ -626,7 +650,7 @@ fi
|
|
|
626
650
|
Optionally record which engine was selected (usage-report contract):
|
|
627
651
|
|
|
628
652
|
```bash
|
|
629
|
-
|
|
653
|
+
"$DRAFT_TOOLS/verify-graph-binary.sh" --repo . --json 2>/dev/null || true
|
|
630
654
|
```
|
|
631
655
|
|
|
632
656
|
See `core/shared/graph-query.md` and `bin/README.md` for the query contract and engine resolution.
|
|
@@ -638,13 +662,13 @@ If indexing succeeds, `draft/graph/schema.yaml` is written and later steps query
|
|
|
638
662
|
Pull the architecture view once and reuse it across phases:
|
|
639
663
|
|
|
640
664
|
```bash
|
|
641
|
-
ARCH=$(
|
|
665
|
+
ARCH=$("$DRAFT_TOOLS/graph-arch.sh" --repo .)
|
|
642
666
|
```
|
|
643
667
|
|
|
644
668
|
- `$ARCH | jq '.packages'` — module list with fan-in/out
|
|
645
669
|
- `$ARCH | jq '.routes'` — detected service endpoints
|
|
646
670
|
- `$ARCH | jq '.languages, .node_labels, .layers, .boundaries'` — language mix, node shape, layering
|
|
647
|
-
- `
|
|
671
|
+
- `"$DRAFT_TOOLS/hotspot-rank.sh" --repo . --top 20` — complexity/fan-in hotspots (live)
|
|
648
672
|
|
|
649
673
|
### 3. Use graph data to accelerate Step 1.5
|
|
650
674
|
|
|
@@ -675,8 +699,10 @@ Apply tier table:
|
|
|
675
699
|
|
|
676
700
|
Hold tier in memory. This governs: architecture.md length minimum, .ai-context.md budget, and module deep-dive depth.
|
|
677
701
|
|
|
702
|
+
**Resolve the output mode now (if `auto`).** If `DRAFT_INIT_MODE` is unset/`auto`, finalize it from the tier just computed: **tier 1–2 → `monolith`**, **tier 3–5 → `okf`** (see **Output Mode** in Pre-Check). An explicit `DRAFT_INIT_MODE=monolith|okf` always wins and skips this resolution. Announce the resolved mode, e.g. `Tier 4 (large) → okf mode (wiki taxonomy bundle).` If `okf`, switch to `references/okf-emitter.md` for the decomposition + serialization + render-views + validate stage from here on; all the shared analysis above is reused unchanged.
|
|
703
|
+
|
|
678
704
|
**Step 1.4.6 — Build Module Priority List:**
|
|
679
|
-
From `
|
|
705
|
+
From `"$DRAFT_TOOLS/hotspot-rank.sh" --repo .`: count hotspot symbols per module.
|
|
680
706
|
From `$ARCH | jq '.packages[]'`: read `fan_in` per module.
|
|
681
707
|
Rank modules by: `(hotspot_count × 2) + fan_in_count`.
|
|
682
708
|
Top-ranked modules drive Section 6 deep-dive ordering and depth. Modules ranked zero on both: summary treatment only.
|
|
@@ -687,7 +713,7 @@ Query for diagram content and write into architecture.md slots using the standar
|
|
|
687
713
|
|
|
688
714
|
For Section 4.4 (module-deps slot):
|
|
689
715
|
```bash
|
|
690
|
-
|
|
716
|
+
"$DRAFT_TOOLS/mermaid-from-graph.sh" --repo . --diagram module-deps
|
|
691
717
|
```
|
|
692
718
|
The tool emits a ready-to-inject ` ```mermaid ``` ` block (or an empty stub on exit 2). Write between the markers:
|
|
693
719
|
```
|
|
@@ -697,7 +723,7 @@ The tool emits a ready-to-inject ` ```mermaid ``` ` block (or an empty stub on e
|
|
|
697
723
|
```
|
|
698
724
|
|
|
699
725
|
For Section 20 (hotspots slot):
|
|
700
|
-
Run `
|
|
726
|
+
Run `"$DRAFT_TOOLS/hotspot-rank.sh" --repo . --top 10`, take the top 10 by fanIn, build a markdown table:
|
|
701
727
|
```
|
|
702
728
|
<!-- GRAPH:hotspots:START -->
|
|
703
729
|
| Symbol | fanIn |
|
|
@@ -709,7 +735,7 @@ Run `scripts/tools/hotspot-rank.sh --repo . --top 10`, take the top 10 by fanIn,
|
|
|
709
735
|
|
|
710
736
|
For Appendix E (proto-map slot):
|
|
711
737
|
```bash
|
|
712
|
-
|
|
738
|
+
"$DRAFT_TOOLS/mermaid-from-graph.sh" --repo . --diagram proto-map
|
|
713
739
|
```
|
|
714
740
|
The tool emits a ` ```mermaid ``` ` block from detected routes (empty stub if none). Write:
|
|
715
741
|
```
|
|
@@ -786,7 +812,7 @@ For tier 3+, readers run simultaneously; wall clock = slowest reader, not the su
|
|
|
786
812
|
The engine is already indexed. Query it live throughout this protocol (reuse `$ARCH` from Step 1.4.2):
|
|
787
813
|
- `$ARCH | jq '.packages'` — module list with `.fan_in`/`.fan_out` (for grouping)
|
|
788
814
|
- `$ARCH | jq '.languages, .node_labels'` — file/symbol counts, tier metrics
|
|
789
|
-
- `
|
|
815
|
+
- `"$DRAFT_TOOLS/hotspot-rank.sh" --repo .` — top hotspot symbols per module (feed to readers)
|
|
790
816
|
|
|
791
817
|
#### Phase 1: Spawn Parallel Module Readers
|
|
792
818
|
|
|
@@ -913,7 +939,7 @@ If any reader agent fails to produce valid JSON after one retry:
|
|
|
913
939
|
When the Agent tool is unavailable or reader agents fail after retry, write `draft/architecture.md` using the **10-section graph-primary structure** (checklist above + `core/templates/architecture.md`). Do not use legacy 28-section or Pass 1/2/3 volume protocols.
|
|
914
940
|
|
|
915
941
|
1. Use the ranked module list from Step 1.4.6 (graph-first — do not re-scan by directory if Phase 0 succeeded).
|
|
916
|
-
2. For each top module (up to 20 by fan-in), query the engine for its symbols/callers (`
|
|
942
|
+
2. For each top module (up to 20 by fan-in), query the engine for its symbols/callers (`"$DRAFT_TOOLS/graph-callers.sh"`, `"$DRAFT_TOOLS/graph-impact.sh"`, or `$ARCH | jq '.packages[] | select(.name=="<m>")'`), read the hotspot files and 3–5 key sources; embed graph blocks and at least one workflow/state diagram per significant module inside §4–§8 as appropriate.
|
|
917
943
|
3. Always include §9 Graph Coverage Gaps and §10 Relationship when the Context Audit requires them.
|
|
918
944
|
4. Run Completion Verification (defined later in this skill) before condensation. Fidelity, provenance, and gap honesty block completion — not line counts.
|
|
919
945
|
|
|
@@ -2239,7 +2265,18 @@ Only when material: authentication/authorization checkpoints, distributed transa
|
|
|
2239
2265
|
|
|
2240
2266
|
**Core rule:** The graph is the source of truth for structure. LLM synthesis exists only to interpret the graph into actionable design understanding — primarily via one accurate workflow or state diagram per module — plus tiny supporting notes. The previous volume-oriented deep-dive expectations are superseded.
|
|
2241
2267
|
|
|
2242
|
-
|
|
2268
|
+
First resolve the bundled helpers:
|
|
2269
|
+
|
|
2270
|
+
```bash
|
|
2271
|
+
# Locate Draft's bundled helpers (cwd is the user's project; ${CLAUDE_PLUGIN_ROOT}
|
|
2272
|
+
# is not exported into skill Bash). See core/shared/tool-resolver.md.
|
|
2273
|
+
DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
|
|
2274
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
|
|
2275
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
|
|
2276
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
|
|
2277
|
+
```
|
|
2278
|
+
|
|
2279
|
+
For each module returned by `"$DRAFT_TOOLS/graph-arch.sh" --repo . | jq '.packages[]'`, produce a subsection whose **primary content** is the deterministic graph block followed by one synthesized behavioral diagram. Every module gets a slot; do not sample. The block's fan-in/out and node counts come from `.packages[]`; public API and key call edges come from live per-package queries (`"$DRAFT_TOOLS/graph-callers.sh"`, `"$DRAFT_TOOLS/graph-impact.sh"`) and `"$DRAFT_TOOLS/hotspot-rank.sh" --repo .`.
|
|
2243
2280
|
|
|
2244
2281
|
#### 7.{N} {module-name}
|
|
2245
2282
|
|
|
@@ -2326,7 +2363,7 @@ Regardless of tier, any directory whose name contains `ops`, `handlers`, `execut
|
|
|
2326
2363
|
| ... | (enumerate ALL — no sampling, no "and others") | | | |
|
|
2327
2364
|
```
|
|
2328
2365
|
|
|
2329
|
-
Use `
|
|
2366
|
+
Use `"$DRAFT_TOOLS/graph-callers.sh" --symbol <module>` or `"$DRAFT_TOOLS/graph-arch.sh" --repo .` to get the complete file list. Use `"$DRAFT_TOOLS/hotspot-rank.sh" --repo .` to flag high-complexity operations.
|
|
2330
2367
|
|
|
2331
2368
|
#### Example: Full Sub-Module Treatment for `icebox/` (917 files)
|
|
2332
2369
|
|
|
@@ -2480,10 +2517,10 @@ Include architecturally significant implementations (high fan-in, core extension
|
|
|
2480
2517
|
| (enumerate ALL — use hotspot-rank.sh and graph-callers.sh / get_architecture for file list and line counts) |
|
|
2481
2518
|
```
|
|
2482
2519
|
|
|
2483
|
-
> **MANDATORY (graph data)**: Query `
|
|
2484
|
-
> `
|
|
2520
|
+
> **MANDATORY (graph data)**: Query `"$DRAFT_TOOLS/graph-arch.sh" --repo .` or
|
|
2521
|
+
> `"$DRAFT_TOOLS/graph-callers.sh" --symbol <module>` to get the complete file list with line counts.
|
|
2485
2522
|
> Filter for files in operation sub-directories (paths containing `/ops/`,
|
|
2486
|
-
> `/handlers/`, `/executors/`, `/workers/`). Use `
|
|
2523
|
+
> `/handlers/`, `/executors/`, `/workers/`). Use `"$DRAFT_TOOLS/hotspot-rank.sh" --repo .` to flag
|
|
2487
2524
|
> high-complexity operations (high line count or fanIn). Do NOT skip this step — incomplete
|
|
2488
2525
|
> catalogs cause AI agents to reinvent existing functionality.
|
|
2489
2526
|
|
|
@@ -3178,7 +3215,7 @@ Fix: Cross-reference ALL data sources (Appendix B), ALL implementation outputs (
|
|
|
3178
3215
|
|
|
3179
3216
|
**FAILURE 4 — Missing Sub-Modules:**
|
|
3180
3217
|
Detection: A module with 100+ source files (check graph data) has no Sub-Module Structure table.
|
|
3181
|
-
Fix: Query `
|
|
3218
|
+
Fix: Query `"$DRAFT_TOOLS/graph-arch.sh" --repo .` or `"$DRAFT_TOOLS/graph-callers.sh" --symbol <name>`, group results by immediate sub-directory, and generate the table with file counts and one-line role descriptions per sub-directory.
|
|
3182
3219
|
|
|
3183
3220
|
**FAILURE 4b — Shallow Sub-Module Treatment:**
|
|
3184
3221
|
Detection: Large sub-modules (50+ files) listed only as table rows with no dedicated deep-dive subsection. Or ops/handler directories have no operation catalog.
|
|
@@ -3223,6 +3260,230 @@ Run this checklist before writing architecture.md:
|
|
|
3223
3260
|
|
|
3224
3261
|
---
|
|
3225
3262
|
|
|
3263
|
+
## Init — OKF Taxonomy Emitter (DRAFT_INIT_MODE=okf)
|
|
3264
|
+
|
|
3265
|
+
> Progressive-disclosure reference for `draft init`. Covers the OKF emitter:
|
|
3266
|
+
> type vocabulary, frontmatter contract, generation pipeline, render views,
|
|
3267
|
+
> incremental refresh, and the `okf-validate.sh` gate. Authoritative HLD:
|
|
3268
|
+
> `hld-draft-init-okf-taxonomy.md` at the repo root.
|
|
3269
|
+
|
|
3270
|
+
This is the `draft init` output mode for **tier 3+ repos**, where it is the
|
|
3271
|
+
**tier-gated default** (`DRAFT_INIT_MODE` unset → tier 1–2 `monolith`, tier 3–5
|
|
3272
|
+
`okf`; an explicit `DRAFT_INIT_MODE=monolith|okf` overrides). `monolith` is
|
|
3273
|
+
retained — the tier-1/2 default, the A/B baseline, and the over-fetch fallback.
|
|
3274
|
+
The default rests on maintainability/readability, not the benchmark (parity).
|
|
3275
|
+
|
|
3276
|
+
```bash
|
|
3277
|
+
# Mode gate — default is tier-gated 'auto', finalized after Step 1.4.5 (tier):
|
|
3278
|
+
DRAFT_INIT_MODE="${DRAFT_INIT_MODE:-auto}"
|
|
3279
|
+
case "$DRAFT_INIT_MODE" in
|
|
3280
|
+
monolith|okf) : ;; # explicit override — honored as-is
|
|
3281
|
+
auto) : ;; # resolve from tier: 1–2 → monolith, 3–5 → okf
|
|
3282
|
+
*) echo "Unknown DRAFT_INIT_MODE='$DRAFT_INIT_MODE' (monolith|okf|auto); using auto" >&2
|
|
3283
|
+
DRAFT_INIT_MODE=auto ;;
|
|
3284
|
+
esac
|
|
3285
|
+
```
|
|
3286
|
+
|
|
3287
|
+
Everything else in `draft init` (5-phase analysis, graph snapshot, `.state/`
|
|
3288
|
+
hashing, scope detection, atomic staging) is **reused unchanged**. This mode adds
|
|
3289
|
+
a decomposition + serialization stage. It introduces **no new LLM analysis
|
|
3290
|
+
engine** and exactly **one** new deterministic helper, `okf-validate.sh`.
|
|
3291
|
+
|
|
3292
|
+
## Target layout
|
|
3293
|
+
|
|
3294
|
+
`okf` mode changes **only** the `architecture.md` / `.ai-context.md` packaging
|
|
3295
|
+
and adds `wiki/`. **Every other standard `draft init` file is still produced**
|
|
3296
|
+
— `product.md`, `tech-stack.md`, `workflow.md`, `guardrails.md`, `index.md`,
|
|
3297
|
+
`.ai-profile.md`, `tracks/` + `tracks.md`, `.state/`, `graph/` — exactly as in
|
|
3298
|
+
`monolith` mode. Do **not** skip them: emitting only the bundle is a regression.
|
|
3299
|
+
|
|
3300
|
+
```
|
|
3301
|
+
draft/
|
|
3302
|
+
├── .ai-context.md # INDEX ROOT: synopsis (150–250 lines) + Concept Map
|
|
3303
|
+
├── architecture.md # RENDERED VIEW (generated from bundle; not source of truth)
|
|
3304
|
+
├── .ai-profile.md # always-injected profile (derived from .ai-context.md) [SAME AS MONOLITH]
|
|
3305
|
+
├── product.md # [SAME AS MONOLITH]
|
|
3306
|
+
├── tech-stack.md # [SAME AS MONOLITH]
|
|
3307
|
+
├── workflow.md # [SAME AS MONOLITH]
|
|
3308
|
+
├── guardrails.md # [SAME AS MONOLITH]
|
|
3309
|
+
├── index.md # docs index — lists prose files + wiki/ [SAME AS MONOLITH, +wiki link]
|
|
3310
|
+
├── tracks.md + tracks/ # [SAME AS MONOLITH]
|
|
3311
|
+
├── wiki/ # OKF bundle (source of truth) — okf-mode ONLY
|
|
3312
|
+
│ ├── index.md # bundle root + Concept Map
|
|
3313
|
+
│ ├── overview/{index,architecture,getting-started,glossary}.md
|
|
3314
|
+
│ ├── systems/{index,<subsystem>}.md
|
|
3315
|
+
│ ├── features/{index,<feature>}.md
|
|
3316
|
+
│ ├── reference/{index,<ref>}.md # config, deps, data models, ADRs, runbooks
|
|
3317
|
+
│ ├── entrypoints/<app>.md
|
|
3318
|
+
│ ├── web/index.html # optional offline viewer (okf-render-views.sh --web)
|
|
3319
|
+
│ └── log.md # chronological change history (from .state run memory)
|
|
3320
|
+
├── graph/schema.yaml # [SAME AS MONOLITH] engine gate marker
|
|
3321
|
+
└── .state/
|
|
3322
|
+
├── hashes.json # file → content hash [SAME AS MONOLITH]
|
|
3323
|
+
├── path-to-concept.json # NEW: source path → concept page(s) it grounds
|
|
3324
|
+
└── signals.json # [SAME AS MONOLITH]
|
|
3325
|
+
```
|
|
3326
|
+
|
|
3327
|
+
The standard project files come from the same generators as `monolith` mode
|
|
3328
|
+
(intake questions → `product.md`; tech detection → `tech-stack.md`; `draft learn`
|
|
3329
|
+
→ `guardrails.md`; templates → `workflow.md`, `index.md`, `tracks.md`,
|
|
3330
|
+
`.ai-profile.md`). The OKF emitter only *replaces the architecture packaging*; it
|
|
3331
|
+
never owns or removes the rest of the context directory.
|
|
3332
|
+
|
|
3333
|
+
Templates for each bundle page live in `core/templates/okf/` (`index.md`,
|
|
3334
|
+
`concept.md`, `section-index.md`, `ai-context-index.md`).
|
|
3335
|
+
|
|
3336
|
+
## Frozen `type` vocabulary
|
|
3337
|
+
|
|
3338
|
+
Every concept carries a `type` from this frozen set (changing it churns every
|
|
3339
|
+
file; versioned via `index.md` frontmatter `okf_types_version`):
|
|
3340
|
+
|
|
3341
|
+
| type | Maps to | Home |
|
|
3342
|
+
|------|---------|------|
|
|
3343
|
+
| `Subsystem` | major graph cluster / package boundary | `systems/` |
|
|
3344
|
+
| `Module` | single package/dir, cohesive responsibility | `systems/` |
|
|
3345
|
+
| `Feature` | user-facing capability spanning modules | `features/` |
|
|
3346
|
+
| `Entrypoint` | binary / main / CLI / handler root | `entrypoints/` |
|
|
3347
|
+
| `API` | public interface, route group, RPC surface | `reference/` |
|
|
3348
|
+
| `DataModel` | schema, table, core struct/type | `reference/` |
|
|
3349
|
+
| `Dependency` | notable external dep + how it's used | `reference/` |
|
|
3350
|
+
| `ADR` | architecture decision record | `reference/` |
|
|
3351
|
+
| `Runbook` | operational procedure | `reference/` |
|
|
3352
|
+
|
|
3353
|
+
`okf-validate.sh` enforces this set as ground truth — an out-of-vocab `type`
|
|
3354
|
+
fails the build.
|
|
3355
|
+
|
|
3356
|
+
## Frontmatter contract
|
|
3357
|
+
|
|
3358
|
+
Per concept page (see `core/templates/okf/concept.md`). Required OKF keys:
|
|
3359
|
+
`type`, `title`, `description`, `resource`. **`description` is the load-bearing
|
|
3360
|
+
routing key** — write it as a routing decision ("should the agent open this for
|
|
3361
|
+
the task at hand?"), never a summary. Draft extensions are namespaced `x-` and
|
|
3362
|
+
ignored by generic OKF consumers: `x-grounded-paths`, `x-hotspot-score`,
|
|
3363
|
+
`x-callers`.
|
|
3364
|
+
|
|
3365
|
+
## Concept granularity (resolves open decision 1)
|
|
3366
|
+
|
|
3367
|
+
Derive concepts from the graph, not by hand:
|
|
3368
|
+
|
|
3369
|
+
- A **Subsystem** = a graph cluster (package/dir boundary) with `fan_in ≥ 2` from
|
|
3370
|
+
other clusters, OR a top-ranked module from `hotspot-rank.sh`.
|
|
3371
|
+
- A **Module** = a cohesive package/dir below a subsystem that is *not* itself a
|
|
3372
|
+
cluster boundary but has its own hotspot or public surface.
|
|
3373
|
+
- A **Feature** = a capability the graph shows spanning ≥2 modules (shared
|
|
3374
|
+
callers / a route group touching multiple packages).
|
|
3375
|
+
- Default cap: one page per package boundary; do not split a package into
|
|
3376
|
+
multiple concept pages unless it has >1 distinct public surface. This keeps
|
|
3377
|
+
page count ≈ module count and navigation depth shallow.
|
|
3378
|
+
|
|
3379
|
+
## Generation pipeline (M3)
|
|
3380
|
+
|
|
3381
|
+
```
|
|
3382
|
+
1. Survey → existing draft init 5-phase + graph snapshot (graph-snapshot.sh)
|
|
3383
|
+
2. Plan → derive the concept list (above) from graph clusters +
|
|
3384
|
+
entrypoints + features. Topo-sort by dependency so pages that
|
|
3385
|
+
others link to (overview, core subsystems) generate FIRST —
|
|
3386
|
+
forward cross-links resolve.
|
|
3387
|
+
3. Generate → per concept, pull grounding from the graph and write the page:
|
|
3388
|
+
x-callers ← graph-callers.sh --symbol <c>
|
|
3389
|
+
x-grounded-paths ← graph-impact.sh --symbol <c> (blast radius)
|
|
3390
|
+
x-hotspot-score ← hotspot-rank.sh
|
|
3391
|
+
overview diagrams ← mermaid-from-graph.sh
|
|
3392
|
+
Record each source path → page in .state/path-to-concept.json.
|
|
3393
|
+
4. Render views → ai-context.md (synopsis + Concept Map), architecture.md
|
|
3394
|
+
(concatenated view), wiki/log.md (see M4).
|
|
3395
|
+
5. Validate → okf-validate.sh draft/wiki \
|
|
3396
|
+
--path-index draft/.state/path-to-concept.json
|
|
3397
|
+
FAIL the build (do not atomic-rename) on any dangle, missing
|
|
3398
|
+
field, bad type, or path-index gap.
|
|
3399
|
+
6. Emit → mv draft.tmp/ draft/ ; update .state/.
|
|
3400
|
+
```
|
|
3401
|
+
|
|
3402
|
+
Page bodies are LLM-narrated for readability **but** the graph-derived
|
|
3403
|
+
frontmatter and the `Blast radius`/`Used by` sections are deterministic. To keep
|
|
3404
|
+
incremental carry-forward byte-identical (open decision 2), cache the narrated
|
|
3405
|
+
prose keyed by the source hash of `x-grounded-paths` — unchanged sources reuse
|
|
3406
|
+
the cached narration verbatim.
|
|
3407
|
+
|
|
3408
|
+
## Render views (M4)
|
|
3409
|
+
|
|
3410
|
+
Both are produced by the deterministic helper `okf-render-views.sh` (no LLM) —
|
|
3411
|
+
regenerated on every init/refresh so they never drift from the bundle:
|
|
3412
|
+
|
|
3413
|
+
```bash
|
|
3414
|
+
okf-render-views.sh draft/wiki \
|
|
3415
|
+
--arch-out draft/architecture.md \
|
|
3416
|
+
--concept-map-into draft/wiki/index.md \
|
|
3417
|
+
--concept-map-into draft/.ai-context.md \
|
|
3418
|
+
--web draft/wiki/web/index.html
|
|
3419
|
+
```
|
|
3420
|
+
|
|
3421
|
+
- `--arch-out` renders the linear `architecture.md` (banner + TOC + every concept
|
|
3422
|
+
page in canonical section order, frontmatter stripped, Mermaid preserved).
|
|
3423
|
+
- `--concept-map-into` rebuilds the routing table between the
|
|
3424
|
+
`<!-- CONCEPT-MAP:START -->` / `:END` markers from each concept's `title` +
|
|
3425
|
+
`type` + `description` (section `index.md` pages excluded).
|
|
3426
|
+
- `--web` writes a **self-contained offline HTML viewer** (single file: all pages
|
|
3427
|
+
inlined as JSON + a built-in markdown renderer + sidebar nav + search). Works by
|
|
3428
|
+
double-click — no server, no internet, no CDN. Optional, human-facing; regenerate
|
|
3429
|
+
on refresh like the other views. (Mermaid blocks render as labeled source since a
|
|
3430
|
+
graphical engine can't be inlined offline.)
|
|
3431
|
+
|
|
3432
|
+
All views write into `draft/` (the OKF emitter never creates a separate output
|
|
3433
|
+
dir): `draft/wiki/` is the bundle, `draft/architecture.md` + `draft/.ai-context.md`
|
|
3434
|
+
are the rendered views, `draft/wiki/web/index.html` is the optional viewer.
|
|
3435
|
+
|
|
3436
|
+
The two views:
|
|
3437
|
+
|
|
3438
|
+
- **`ai-context.md`** (index root) — from `core/templates/okf/ai-context-index.md`:
|
|
3439
|
+
the Synopsis preserves the prior `.ai-context.md` content shape (so existing
|
|
3440
|
+
downstream consumers keep working); the Concept Map is built from each
|
|
3441
|
+
concept's `description`. Broad tasks terminate here.
|
|
3442
|
+
- **`architecture.md`** (rendered view) — TOC + per-concept section concat +
|
|
3443
|
+
Mermaid, in topo order. Demoted, not deleted: the brownfield Context Quality
|
|
3444
|
+
Audit and any command grepping `architecture.md` keep working (§9 of the HLD).
|
|
3445
|
+
- **`wiki/log.md`** — appended from `.state/` run memory.
|
|
3446
|
+
|
|
3447
|
+
The `<!-- CONCEPT-MAP:START -->` / `:END` markers in `wiki/index.md` and the
|
|
3448
|
+
section `index.md` tables are the injection slots for the routing tables.
|
|
3449
|
+
|
|
3450
|
+
## Incremental refresh at concept granularity (M5)
|
|
3451
|
+
|
|
3452
|
+
`draft init refresh` under `okf` mode:
|
|
3453
|
+
|
|
3454
|
+
```
|
|
3455
|
+
1. Diff hashes.json vs working tree → changed source paths
|
|
3456
|
+
2. path-to-concept.json → affected concept pages
|
|
3457
|
+
3. Regenerate ONLY affected concepts; carry the rest verbatim (cached narration)
|
|
3458
|
+
4. Re-render ai-context.md / architecture.md / log.md (cheap; always regenerated)
|
|
3459
|
+
5. Re-validate: okf-validate.sh on the bundle + path-index (cross-links touching
|
|
3460
|
+
changed concepts must still resolve)
|
|
3461
|
+
6. Append log.md; update hashes.json + path-to-concept.json
|
|
3462
|
+
```
|
|
3463
|
+
|
|
3464
|
+
A 1-file change regenerates only the concept(s) that file grounds. Unchanged
|
|
3465
|
+
concepts are byte-identical across runs.
|
|
3466
|
+
|
|
3467
|
+
## Backward compatibility (§9)
|
|
3468
|
+
|
|
3469
|
+
- `architecture.md` is retained as a rendered view (brownfield audit + grep keep
|
|
3470
|
+
working).
|
|
3471
|
+
- `ai-context.md`'s Synopsis preserves the prior content shape; the Concept Map
|
|
3472
|
+
is additive.
|
|
3473
|
+
- `draft review` and downstream command contracts are unchanged — they consume
|
|
3474
|
+
`architecture.md` / `ai-context.md`, both of which still exist.
|
|
3475
|
+
|
|
3476
|
+
## Default policy & retirement of `monolith`
|
|
3477
|
+
|
|
3478
|
+
`okf` is the **tier-gated default** (tier 3+); `monolith` is the tier-1/2 default
|
|
3479
|
+
and remains in place as the A/B baseline + over-fetch fallback. Full retirement of
|
|
3480
|
+
`monolith` is deferred until **both**: (1) the large-monolith A/B run shows `okf` ≥
|
|
3481
|
+
baseline on tokens at parity accuracy (the regime the §12 benchmark flagged), and
|
|
3482
|
+
(2) a human-onboarding eval confirms the wiki + generated `architecture.md` covers
|
|
3483
|
+
linear onboarding. Note: retiring `monolith` would not remove `architecture.md` —
|
|
3484
|
+
it is generated from the bundle regardless — so there is no readability gain from
|
|
3485
|
+
deletion, only lost optionality.
|
|
3486
|
+
|
|
3226
3487
|
---
|
|
3227
3488
|
|
|
3228
3489
|
## Graph Command
|
|
@@ -3257,6 +3518,15 @@ if [ ! -d "$REPO" ]; then
|
|
|
3257
3518
|
fi
|
|
3258
3519
|
REPO_ABS="$(cd "$REPO" && pwd)"
|
|
3259
3520
|
echo "Target repo: $REPO_ABS"
|
|
3521
|
+
|
|
3522
|
+
# Locate Draft's bundled helpers. Skills run with cwd = the user's project and
|
|
3523
|
+
# ${CLAUDE_PLUGIN_ROOT} is not exported into skill Bash, so resolve DRAFT_TOOLS here
|
|
3524
|
+
# and call helpers as "$DRAFT_TOOLS/<tool>.sh". See core/shared/tool-resolver.md.
|
|
3525
|
+
DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
|
|
3526
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
|
|
3527
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
|
|
3528
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
|
|
3529
|
+
DRAFT_SCRIPTS="${DRAFT_TOOLS%/tools}" # parent dir holds fetch-memory-engine.sh
|
|
3260
3530
|
```
|
|
3261
3531
|
|
|
3262
3532
|
## Step 2: Ensure the engine is present
|
|
@@ -3264,12 +3534,12 @@ echo "Target repo: $REPO_ABS"
|
|
|
3264
3534
|
Resolve the engine; if it is missing, fetch it once, then re-check. If it is still unavailable (e.g. offline, opted out via `DRAFT_MEMORY_DISABLE`), report and stop gracefully — graph features are optional everywhere in Draft.
|
|
3265
3535
|
|
|
3266
3536
|
```bash
|
|
3267
|
-
if !
|
|
3537
|
+
if ! "$DRAFT_TOOLS/verify-graph-binary.sh" --repo "$REPO_ABS" --json 2>/dev/null | grep -q '"status":"ok"'; then
|
|
3268
3538
|
echo "Graph engine not found — attempting to fetch it..."
|
|
3269
|
-
|
|
3539
|
+
"$DRAFT_SCRIPTS/fetch-memory-engine.sh" || true
|
|
3270
3540
|
fi
|
|
3271
3541
|
|
|
3272
|
-
ENGINE="$(
|
|
3542
|
+
ENGINE="$("$DRAFT_TOOLS/verify-graph-binary.sh" --repo "$REPO_ABS" --json 2>/dev/null || true)"
|
|
3273
3543
|
if ! echo "$ENGINE" | grep -q '"status":"ok"'; then
|
|
3274
3544
|
echo "Graph engine unavailable — skipping. Install with scripts/fetch-memory-engine.sh, or unset DRAFT_MEMORY_DISABLE."
|
|
3275
3545
|
exit 0
|
|
@@ -3282,7 +3552,7 @@ echo "Engine: $ENGINE"
|
|
|
3282
3552
|
One call resolves the engine, indexes the repo (incrementally on refresh), and updates the gate marker `<repo>/draft/graph/schema.yaml` (engine metadata + point-of-index counts; `access: engine-live`). All structural graph data is queried live from the engine — no snapshot files are committed beyond `schema.yaml`.
|
|
3283
3553
|
|
|
3284
3554
|
```bash
|
|
3285
|
-
|
|
3555
|
+
"$DRAFT_TOOLS/graph-snapshot.sh" --repo "$REPO_ABS"
|
|
3286
3556
|
```
|
|
3287
3557
|
|
|
3288
3558
|
If this exits non-zero, the engine became unavailable mid-run — report it and stop; do not fabricate results.
|
|
@@ -3296,10 +3566,10 @@ echo "--- Snapshot ---"
|
|
|
3296
3566
|
cat "$REPO_ABS/draft/graph/schema.yaml"
|
|
3297
3567
|
|
|
3298
3568
|
echo "--- Top hotspots ---"
|
|
3299
|
-
|
|
3569
|
+
"$DRAFT_TOOLS/hotspot-rank.sh" --repo "$REPO_ABS" --top 5
|
|
3300
3570
|
|
|
3301
3571
|
echo "--- Cycles ---"
|
|
3302
|
-
|
|
3572
|
+
"$DRAFT_TOOLS/cycle-detect.sh" --repo "$REPO_ABS"
|
|
3303
3573
|
|
|
3304
3574
|
echo "--- Snapshot state ---"
|
|
3305
3575
|
git -C "$REPO_ABS" rev-parse --short HEAD 2>/dev/null \
|
|
@@ -4181,12 +4451,23 @@ You are decomposing a project or track into modules with clear responsibilities,
|
|
|
4181
4451
|
|
|
4182
4452
|
## MANDATORY GRAPH LOOKUP (read before any analysis)
|
|
4183
4453
|
|
|
4454
|
+
First resolve the bundled helpers:
|
|
4455
|
+
|
|
4456
|
+
```bash
|
|
4457
|
+
# Locate Draft's bundled helpers (cwd is the user's project; ${CLAUDE_PLUGIN_ROOT}
|
|
4458
|
+
# is not exported into skill Bash). See core/shared/tool-resolver.md.
|
|
4459
|
+
DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
|
|
4460
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
|
|
4461
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
|
|
4462
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
|
|
4463
|
+
```
|
|
4464
|
+
|
|
4184
4465
|
When `draft/graph/schema.yaml` exists, this skill **must** follow the graph-first lookup contract in [core/shared/graph-query.md](../../core/shared/graph-query.md) §Mandatory Lookup Contract. Module identification (Step 3) and dependency mapping (Step 4) **start from the graph**:
|
|
4185
4466
|
|
|
4186
|
-
1. Query `
|
|
4187
|
-
2. Run `
|
|
4188
|
-
3. Use `
|
|
4189
|
-
4. Run `
|
|
4467
|
+
1. Query `"$DRAFT_TOOLS/graph-arch.sh" --repo .` for the authoritative module list and fan-in/out.
|
|
4468
|
+
2. Run `"$DRAFT_TOOLS/hotspot-rank.sh" --repo .` to identify candidate modules to split.
|
|
4469
|
+
3. Use `"$DRAFT_TOOLS/graph-callers.sh"`/`"$DRAFT_TOOLS/graph-impact.sh"` on demand for symbols/callers inside a candidate module.
|
|
4470
|
+
4. Run `"$DRAFT_TOOLS/cycle-detect.sh" --repo .` to enumerate existing cycles before proposing new boundaries.
|
|
4190
4471
|
|
|
4191
4472
|
Filesystem `grep`/`find` for module discovery is only permitted **after** a documented graph miss, using the fallback sentence `Graph returned no match for <X>; falling back to grep.` and recorded in the Graph Usage Report.
|
|
4192
4473
|
|
|
@@ -4328,11 +4609,11 @@ ls -d src/*/ lib/*/ app/*/ packages/*/ 2>/dev/null
|
|
|
4328
4609
|
|
|
4329
4610
|
When graph data is available, the graph is the **primary** (not optional) source for module discovery — manual scanning above is reserved for the graph-miss fallback path:
|
|
4330
4611
|
|
|
4331
|
-
- **Module boundaries**: Query `
|
|
4612
|
+
- **Module boundaries**: Query `"$DRAFT_TOOLS/graph-arch.sh" --repo .` — module list with node counts and per-language file counts
|
|
4332
4613
|
- **Dependency edges**: Weighted inter-module dependencies with exact include counts — replaces manual import tracing
|
|
4333
4614
|
- **Cycle detection**: Circular dependency paths already computed — use for identifying tight coupling and decomposition candidates
|
|
4334
|
-
- **Hotspots**: Run `
|
|
4335
|
-
- **Per-module detail**: query `
|
|
4615
|
+
- **Hotspots**: Run `"$DRAFT_TOOLS/hotspot-rank.sh" --repo .` — high-complexity files that may need further decomposition
|
|
4616
|
+
- **Per-module detail**: query `"$DRAFT_TOOLS/graph-callers.sh"`/`"$DRAFT_TOOLS/graph-impact.sh"` for symbol/call detail within modules of interest
|
|
4336
4617
|
|
|
4337
4618
|
This data is deterministic and exhaustive. The manual scanning recipes above only run **after** the graph misses on the concept the user named — and the miss must be reported in the Graph Usage Report footer. See [core/shared/graph-query.md](../../core/shared/graph-query.md) §Concept-to-Files Recipe.
|
|
4338
4619
|
|
|
@@ -4576,8 +4857,11 @@ After writing all generated files, strip trailing whitespace and blank lines at
|
|
|
4576
4857
|
Resolve the script via the canonical tool resolver (see [core/shared/tool-resolver.md](../../core/shared/tool-resolver.md)):
|
|
4577
4858
|
|
|
4578
4859
|
```bash
|
|
4579
|
-
|
|
4580
|
-
|
|
4860
|
+
# Locate Draft's bundled helpers (cwd is the user's project; ${CLAUDE_PLUGIN_ROOT}
|
|
4861
|
+
# is not exported into skill Bash). See core/shared/tool-resolver.md.
|
|
4862
|
+
DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
|
|
4863
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
|
|
4864
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
|
|
4581
4865
|
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
|
|
4582
4866
|
# Fix all generated markdown for this track:
|
|
4583
4867
|
[ -x "$DRAFT_TOOLS/fix-whitespace.sh" ] && bash "$DRAFT_TOOLS/fix-whitespace.sh" --track <id>
|
|
@@ -4624,7 +4908,7 @@ references, sunset criteria) survive every regenerate. After rewriting:
|
|
|
4624
4908
|
2. Update plan.md `generated_at:` to the current ISO-8601 timestamp.
|
|
4625
4909
|
3. Ensure plan.md `generated_at` ≥ sibling hld.md / lld.md `generated_at`
|
|
4626
4910
|
(the hygiene validator fails on stale plan).
|
|
4627
|
-
4. Run `
|
|
4911
|
+
4. Run `"$DRAFT_TOOLS/check-track-hygiene.sh" <track_dir>` and resolve any
|
|
4628
4912
|
findings before promoting status past `draft`.
|
|
4629
4913
|
|
|
4630
4914
|
If the plan does not yet have the bracket markers (pre-2.0 track), insert
|
|
@@ -4820,8 +5104,11 @@ As the last step after the completion announcement, emit a metrics record. Best-
|
|
|
4820
5104
|
|
|
4821
5105
|
**Emit call:**
|
|
4822
5106
|
```bash
|
|
4823
|
-
|
|
4824
|
-
|
|
5107
|
+
# Locate Draft's bundled helpers (cwd is the user's project; ${CLAUDE_PLUGIN_ROOT}
|
|
5108
|
+
# is not exported into skill Bash). See core/shared/tool-resolver.md.
|
|
5109
|
+
DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
|
|
5110
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
|
|
5111
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
|
|
4825
5112
|
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
|
|
4826
5113
|
[ -x "$DRAFT_TOOLS/emit-skill-metrics.sh" ] && bash "$DRAFT_TOOLS/emit-skill-metrics.sh" \
|
|
4827
5114
|
'{"skill":"decompose","scope":"<scope>","track_id":"<id_or_null>","modules_count":<N>,"lld_generated":<bool>,"high_complexity_modules":<N>}'
|
|
@@ -4961,9 +5248,21 @@ If one of these applies, route directly to the specialist workflow and stop this
|
|
|
4961
5248
|
- Keep matching invariants as **active constraints** for this task — these govern code generation, not just review
|
|
4962
5249
|
- If invariants reference lock ordering, fail-closed behavior, or data integrity rules: these are non-negotiable during implementation
|
|
4963
5250
|
9. **Load graph context** (if `draft/graph/schema.yaml` exists):
|
|
4964
|
-
|
|
5251
|
+
|
|
5252
|
+
First resolve the bundled helpers:
|
|
5253
|
+
|
|
5254
|
+
```bash
|
|
5255
|
+
# Locate Draft's bundled helpers (cwd is the user's project; ${CLAUDE_PLUGIN_ROOT}
|
|
5256
|
+
# is not exported into skill Bash). See core/shared/tool-resolver.md.
|
|
5257
|
+
DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
|
|
5258
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
|
|
5259
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
|
|
5260
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
|
|
5261
|
+
```
|
|
5262
|
+
|
|
5263
|
+
- Run `"$DRAFT_TOOLS/hotspot-rank.sh" --repo .` — check if any files this task will modify appear as hotspots
|
|
4965
5264
|
- If modifying a hotspot file (high fanIn), warn: "This task modifies {file} (fanIn={N}). Changes here affect many downstream files. Consider running a graph impact query."
|
|
4966
|
-
- Query `
|
|
5265
|
+
- Query `"$DRAFT_TOOLS/graph-impact.sh"`/`"$DRAFT_TOOLS/graph-callers.sh"` for the module(s) being modified — gives file-level dependency context
|
|
4967
5266
|
- See `core/shared/graph-query.md` for on-demand query subroutines (callers, impact)
|
|
4968
5267
|
10. Update the track's entry in `draft/tracks.md` from `[ ]` to `[~]` In Progress
|
|
4969
5268
|
|
|
@@ -5453,9 +5752,13 @@ After a phase passes review, refresh `metadata.json.impact` so future tracks can
|
|
|
5453
5752
|
```
|
|
5454
5753
|
That is the `files_touched` list. Derive `modules_touched` as the unique top-level path segments (e.g. `auth/login.go` → `auth`).
|
|
5455
5754
|
|
|
5456
|
-
2. **Compute downstream blast radius (graph-aware, optional):** If `draft/graph/schema.yaml` exists, for each file in `files_touched` query:
|
|
5755
|
+
2. **Compute downstream blast radius (graph-aware, optional):** If `draft/graph/schema.yaml` exists, for each file in `files_touched` query (this runs in its own Bash session — re-resolve the helpers):
|
|
5457
5756
|
```bash
|
|
5458
|
-
|
|
5757
|
+
DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
|
|
5758
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
|
|
5759
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
|
|
5760
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
|
|
5761
|
+
"$DRAFT_TOOLS/graph-impact.sh" --repo . --file <path>
|
|
5459
5762
|
```
|
|
5460
5763
|
Aggregate across all files: `downstream_files` = total unique downstream files (deduped), `downstream_modules` = union of `affected_modules`, `max_depth` = max across queries, `by_category` = sum of each query's `by_category`. If the graph is absent, leave these fields as zeros / empty arrays — the snapshot still records the directly-touched files.
|
|
5461
5764
|
|
|
@@ -5655,8 +5958,9 @@ If no active track and no argument provided:
|
|
|
5655
5958
|
**Preferred:** use the deterministic `detect-test-framework.sh` wrapper — it emits JSON `{languages:[{language,framework,runner_command,test_globs,config_file}]}`. Resolve via the canonical tool resolver (see [core/shared/tool-resolver.md](../../core/shared/tool-resolver.md)):
|
|
5656
5959
|
|
|
5657
5960
|
```bash
|
|
5658
|
-
DRAFT_TOOLS="$
|
|
5659
|
-
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$
|
|
5961
|
+
DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
|
|
5962
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
|
|
5963
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
|
|
5660
5964
|
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
|
|
5661
5965
|
[ -x "$DRAFT_TOOLS/detect-test-framework.sh" ] && \
|
|
5662
5966
|
bash "$DRAFT_TOOLS/detect-test-framework.sh" --root .
|
|
@@ -5695,7 +5999,11 @@ Build the coverage command with the appropriate scope/filter flags.
|
|
|
5695
5999
|
**Preferred:** invoke the normalized `run-coverage.sh` dispatcher — it dispatches to the language-specific runner and emits a normalized JSON `{language,tool,total:{lines,branches},per_file:[{path,lines,branches,uncovered_lines}]}`. This avoids per-language ad-hoc parsing in Step 5.
|
|
5696
6000
|
|
|
5697
6001
|
```bash
|
|
5698
|
-
#
|
|
6002
|
+
# Re-resolve helpers (this is a separate Bash session from Step 2).
|
|
6003
|
+
DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
|
|
6004
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
|
|
6005
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
|
|
6006
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
|
|
5699
6007
|
[ -x "$DRAFT_TOOLS/run-coverage.sh" ] && \
|
|
5700
6008
|
bash "$DRAFT_TOOLS/run-coverage.sh" --root .
|
|
5701
6009
|
```
|
|
@@ -5969,9 +6277,9 @@ You are generating a pre-deployment verification checklist customized to this pr
|
|
|
5969
6277
|
|
|
5970
6278
|
When `draft/graph/schema.yaml` exists, this skill **must** follow the graph-first lookup contract in [core/shared/graph-query.md](../../core/shared/graph-query.md) §Mandatory Lookup Contract. Use the graph to validate module boundaries before the deploy:
|
|
5971
6279
|
|
|
5972
|
-
1. For each file in the deploy diff, run `
|
|
5973
|
-
2. Run `
|
|
5974
|
-
3. Run `
|
|
6280
|
+
1. For each file in the deploy diff, run `"$DRAFT_TOOLS/graph-impact.sh" --repo . --file <path>` to enumerate the modules affected — flag any module **not** declared in `hld.md` §Detailed Design as a deployment-scope miss.
|
|
6281
|
+
2. Run `"$DRAFT_TOOLS/cycle-detect.sh" --repo .` (and query `"$DRAFT_TOOLS/graph-arch.sh" --repo .` for the module overview) to ensure no fresh cycles were introduced after HLD sign-off.
|
|
6282
|
+
3. Run `"$DRAFT_TOOLS/hotspot-rank.sh" --repo .` — any hotspot in the diff escalates the Resiliency row of Phase 0.
|
|
5975
6283
|
|
|
5976
6284
|
Filesystem `grep` is reserved for source-text scans (migration file names, flag-key strings). Module/impact discovery goes through the graph.
|
|
5977
6285
|
|
|
@@ -6025,8 +6333,9 @@ by validator.
|
|
|
6025
6333
|
```bash
|
|
6026
6334
|
TRACK_DIR="$1" # absolute path to track-under-deploy, or .
|
|
6027
6335
|
|
|
6028
|
-
DRAFT_TOOLS="$
|
|
6029
|
-
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$
|
|
6336
|
+
DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
|
|
6337
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
|
|
6338
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
|
|
6030
6339
|
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
|
|
6031
6340
|
|
|
6032
6341
|
"$DRAFT_TOOLS/check-track-hygiene.sh" "$TRACK_DIR" || rc=$?
|
|
@@ -6280,7 +6589,16 @@ Read and follow the base procedure in `core/shared/draft-context-loading.md`.
|
|
|
6280
6589
|
- **Leverage Storage Topology** — Identify data loss risks at each tier (cache eviction without writeback, event log gaps, missing archive)
|
|
6281
6590
|
- **Leverage Consistency Boundaries** — Find bugs at eventual consistency seams (stale reads, lost events, missing reconciliation)
|
|
6282
6591
|
- **Leverage Failure Recovery Matrix** — Verify idempotency claims, check for partial failure states without recovery paths
|
|
6283
|
-
- **Leverage Graph Data** (if `draft/graph/` exists) —
|
|
6592
|
+
- **Leverage Graph Data** (if `draft/graph/` exists) — First resolve the bundled helpers:
|
|
6593
|
+
```bash
|
|
6594
|
+
# Locate Draft's bundled helpers (cwd is the user's project; ${CLAUDE_PLUGIN_ROOT}
|
|
6595
|
+
# is not exported into skill Bash). See core/shared/tool-resolver.md.
|
|
6596
|
+
DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
|
|
6597
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
|
|
6598
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
|
|
6599
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
|
|
6600
|
+
```
|
|
6601
|
+
Query `"$DRAFT_TOOLS/graph-arch.sh" --repo .` for dependency awareness. Flag dependencies on unexpected modules. Flag code in modules involved in dependency cycles as higher risk. Run `"$DRAFT_TOOLS/hotspot-rank.sh" --repo .` to prioritize analysis of high-complexity, high-fanIn files. See `core/shared/graph-query.md`.
|
|
6284
6602
|
- **Leverage Learned Anti-Patterns** — If `draft/guardrails.md` exists, read the `## Learned Anti-Patterns` section. During the bug sweep, when a bug matches a learned anti-pattern, prefix the report entry with `[KNOWN-ANTI-PATTERN: {pattern name}]`. This distinguishes recurring documented patterns from newly discovered bugs, and signals that a systemic fix may be needed rather than a one-off patch.
|
|
6285
6603
|
|
|
6286
6604
|
### 2. Confirm Scope
|
|
@@ -7304,9 +7622,19 @@ You are conducting a code review using Draft's Context-Driven Development method
|
|
|
7304
7622
|
|
|
7305
7623
|
When `draft/graph/schema.yaml` exists, this skill **must** follow the graph-first lookup contract in [core/shared/graph-query.md](../../core/shared/graph-query.md) §Mandatory Lookup Contract. Stage 1 (Automated Validation) **starts from the graph**:
|
|
7306
7624
|
|
|
7307
|
-
|
|
7308
|
-
|
|
7309
|
-
|
|
7625
|
+
First resolve the bundled helpers:
|
|
7626
|
+
```bash
|
|
7627
|
+
# Locate Draft's bundled helpers (cwd is the user's project; ${CLAUDE_PLUGIN_ROOT}
|
|
7628
|
+
# is not exported into skill Bash). See core/shared/tool-resolver.md.
|
|
7629
|
+
DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
|
|
7630
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
|
|
7631
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
|
|
7632
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
|
|
7633
|
+
```
|
|
7634
|
+
|
|
7635
|
+
1. Run blast-radius assessment via `"$DRAFT_TOOLS/hotspot-rank.sh" --repo .` and `"$DRAFT_TOOLS/graph-impact.sh"` (see Stage 1).
|
|
7636
|
+
2. For each changed file with non-trivial diff size, run `"$DRAFT_TOOLS/graph-impact.sh" --repo . --file <path>` to obtain the affected module set deterministically.
|
|
7637
|
+
3. For each public symbol modified, run `"$DRAFT_TOOLS/graph-callers.sh" --repo . --symbol <name>` to enumerate downstream callers before judging breaking-change severity.
|
|
7310
7638
|
|
|
7311
7639
|
Filesystem `grep` is reserved for source-text scans (string literals, log messages, regex matches in code) — not for discovering modules, files, or callers when the graph can answer.
|
|
7312
7640
|
|
|
@@ -7662,10 +7990,21 @@ Load plugin guardrails before scanning: `core/guardrails/review-checks.md` (RC-#
|
|
|
7662
7990
|
For the files changed in the diff, perform static checks using `grep` or similar tools:
|
|
7663
7991
|
|
|
7664
7992
|
- **Blast Radius Assessment** (if the `draft/graph/` snapshot exists):
|
|
7993
|
+
|
|
7994
|
+
First resolve the bundled helpers:
|
|
7995
|
+
```bash
|
|
7996
|
+
# Locate Draft's bundled helpers (cwd is the user's project; ${CLAUDE_PLUGIN_ROOT}
|
|
7997
|
+
# is not exported into skill Bash). See core/shared/tool-resolver.md.
|
|
7998
|
+
DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
|
|
7999
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
|
|
8000
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
|
|
8001
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
|
|
8002
|
+
```
|
|
8003
|
+
|
|
7665
8004
|
- List all changed files from the diff
|
|
7666
|
-
- For each changed file, check if it appears in `
|
|
8005
|
+
- For each changed file, check if it appears in `"$DRAFT_TOOLS/hotspot-rank.sh" --repo .` output — if yes, record its `fanIn` value
|
|
7667
8006
|
- Classify: files with fanIn in the top 20% of the hotspot output = **HIGH IMPACT**; top 21–50% = **MEDIUM**; below 50% or not in output = **STANDARD**
|
|
7668
|
-
- For any file in a HIGH or MEDIUM module, query `
|
|
8007
|
+
- For any file in a HIGH or MEDIUM module, query `"$DRAFT_TOOLS/graph-arch.sh" --repo . | jq '.packages[].fan_in'` (how many modules depend on this module)
|
|
7669
8008
|
- Include a `Blast Radius` line in the Stage 1 report summary: `Blast Radius: HIGH | MEDIUM | STANDARD — <N> changed files affect high-fanIn modules: [file list]`
|
|
7670
8009
|
- If any changed file is HIGH IMPACT: escalate Stage 3 thoroughness (check all callers of changed functions) and note this in the report header
|
|
7671
8010
|
- **Architecture Conformance:** Search for pattern violations documented in `draft/.ai-context.md`. (e.g. `import * from 'database'` in a React component).
|
|
@@ -7674,7 +8013,7 @@ For the files changed in the diff, perform static checks using `grep` or similar
|
|
|
7674
8013
|
- **Graph Boundary Check** (if `draft/graph/schema.yaml` exists) `[RC-013]`:
|
|
7675
8014
|
- For each changed file, identify its module from the graph
|
|
7676
8015
|
- Check if any new cross-module includes were added in the diff
|
|
7677
|
-
- Verify they follow the established dependency direction from `
|
|
8016
|
+
- Verify they follow the established dependency direction from `"$DRAFT_TOOLS/graph-arch.sh" --repo .` package fan-in/out
|
|
7678
8017
|
- Flag reverse-direction dependencies (module A now depends on module B, but only B→A existed before) as "Potential architecture violation — new dependency direction"
|
|
7679
8018
|
- Check if changes introduce files in modules listed in graph cycles — flag as higher risk
|
|
7680
8019
|
- **Security Scan** `[RC-001, RC-002, RC-003, RC-011]`:
|
|
@@ -8399,8 +8738,11 @@ As the last step after saving the review report, emit a metrics record. Best-eff
|
|
|
8399
8738
|
|
|
8400
8739
|
**Emit call:**
|
|
8401
8740
|
```bash
|
|
8402
|
-
|
|
8403
|
-
|
|
8741
|
+
# Locate Draft's bundled helpers (cwd is the user's project; ${CLAUDE_PLUGIN_ROOT}
|
|
8742
|
+
# is not exported into skill Bash). See core/shared/tool-resolver.md.
|
|
8743
|
+
DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
|
|
8744
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
|
|
8745
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
|
|
8404
8746
|
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
|
|
8405
8747
|
[ -x "$DRAFT_TOOLS/emit-skill-metrics.sh" ] && bash "$DRAFT_TOOLS/emit-skill-metrics.sh" \
|
|
8406
8748
|
'{"skill":"review","track_id":"<id_or_null>","stage_reached":"<stage>","verdict":"<v>","critical_count":<N>,"important_count":<N>,"blast_radius":"<br>","graph_queries":<N>,"fallback_grep_count":<N>}'
|
|
@@ -8459,8 +8801,9 @@ Run the WS-9 chain from [verification-gates.md](../../core/shared/verification-g
|
|
|
8459
8801
|
|
|
8460
8802
|
```bash
|
|
8461
8803
|
TRACK_DIR="draft/tracks/<id>"
|
|
8462
|
-
DRAFT_TOOLS="$
|
|
8463
|
-
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$
|
|
8804
|
+
DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
|
|
8805
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
|
|
8806
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
|
|
8464
8807
|
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
|
|
8465
8808
|
|
|
8466
8809
|
"$DRAFT_TOOLS/check-track-hygiene.sh" "$TRACK_DIR"
|
|
@@ -10711,8 +11054,18 @@ You are performing a lightweight, ad-hoc code review. This is the fast alternati
|
|
|
10711
11054
|
|
|
10712
11055
|
When `draft/graph/schema.yaml` exists, this skill **must** follow the graph-first lookup contract in [core/shared/graph-query.md](../../core/shared/graph-query.md) §Mandatory Lookup Contract. Quick-review keeps the graph load light:
|
|
10713
11056
|
|
|
10714
|
-
|
|
10715
|
-
|
|
11057
|
+
First resolve the bundled helpers:
|
|
11058
|
+
```bash
|
|
11059
|
+
# Locate Draft's bundled helpers (cwd is the user's project; ${CLAUDE_PLUGIN_ROOT}
|
|
11060
|
+
# is not exported into skill Bash). See core/shared/tool-resolver.md.
|
|
11061
|
+
DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
|
|
11062
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
|
|
11063
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
|
|
11064
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
|
|
11065
|
+
```
|
|
11066
|
+
|
|
11067
|
+
1. Always run `"$DRAFT_TOOLS/hotspot-rank.sh" --repo .` for every changed file (Step 2 blast-radius pre-check below).
|
|
11068
|
+
2. If a finding spans more than one file, run `"$DRAFT_TOOLS/graph-callers.sh" --repo . --symbol <name>` to enumerate the call sites before claiming "no other usages".
|
|
10716
11069
|
|
|
10717
11070
|
Filesystem `grep` is reserved for source-text scans (literal strings, regex patterns). Symbol and caller discovery go through the graph.
|
|
10718
11071
|
|
|
@@ -10770,7 +11123,7 @@ Determine the diff to review:
|
|
|
10770
11123
|
|
|
10771
11124
|
## Step 2: Blast Radius Pre-check (if `draft/graph/schema.yaml` exists)
|
|
10772
11125
|
|
|
10773
|
-
Before the four-dimension review, run `
|
|
11126
|
+
Before the four-dimension review, run `"$DRAFT_TOOLS/hotspot-rank.sh" --repo .` and check if any files in scope appear in the output. If any file has a `fanIn` in the top 20% of the list, add this warning at the top of the review report:
|
|
10774
11127
|
|
|
10775
11128
|
```
|
|
10776
11129
|
⚠ HIGH IMPACT: {file} is a high-fanIn hotspot (fanIn={N}). Changes here propagate to many callers — review with extra care.
|
|
@@ -10927,10 +11280,20 @@ Perform an exhaustive end-to-end lifecycle review of a service, component, or mo
|
|
|
10927
11280
|
|
|
10928
11281
|
When `draft/graph/schema.yaml` exists, this skill **must** follow the graph-first lookup contract in [core/shared/graph-query.md](../../core/shared/graph-query.md) §Mandatory Lookup Contract. Deep-review uses the graph to **narrow review scope** — a key 30–50% scope reduction:
|
|
10929
11282
|
|
|
10930
|
-
|
|
10931
|
-
|
|
10932
|
-
|
|
10933
|
-
|
|
11283
|
+
First resolve the bundled helpers:
|
|
11284
|
+
```bash
|
|
11285
|
+
# Locate Draft's bundled helpers (cwd is the user's project; ${CLAUDE_PLUGIN_ROOT}
|
|
11286
|
+
# is not exported into skill Bash). See core/shared/tool-resolver.md.
|
|
11287
|
+
DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
|
|
11288
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
|
|
11289
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
|
|
11290
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
|
|
11291
|
+
```
|
|
11292
|
+
|
|
11293
|
+
1. Use `"$DRAFT_TOOLS/graph-impact.sh"`/`graph-callers.sh` and `"$DRAFT_TOOLS/graph-arch.sh" --repo .` for the audited module's structure — do not enumerate via `find`.
|
|
11294
|
+
2. Run `"$DRAFT_TOOLS/graph-impact.sh" --repo . --file <each-changed-file>` per file in the diff (or per file in the module if no diff) to obtain the affected module set deterministically.
|
|
11295
|
+
3. Run `"$DRAFT_TOOLS/cycle-detect.sh" --repo .` and flag any cycle that includes the audited module as Architecture Resilience finding.
|
|
11296
|
+
4. Run `"$DRAFT_TOOLS/hotspot-rank.sh" --repo .` to identify high-fanIn files inside the module — these get deeper inspection.
|
|
10934
11297
|
|
|
10935
11298
|
Filesystem `grep` is reserved for source-text scans (API contract strings, secret patterns, log message audits). Module enumeration and caller tracing go through the graph.
|
|
10936
11299
|
|
|
@@ -11234,8 +11597,11 @@ As the last step after saving the deep-review report, emit a metrics record. Bes
|
|
|
11234
11597
|
|
|
11235
11598
|
**Emit call:**
|
|
11236
11599
|
```bash
|
|
11237
|
-
|
|
11238
|
-
|
|
11600
|
+
# Locate Draft's bundled helpers (cwd is the user's project; ${CLAUDE_PLUGIN_ROOT}
|
|
11601
|
+
# is not exported into skill Bash). See core/shared/tool-resolver.md.
|
|
11602
|
+
DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
|
|
11603
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
|
|
11604
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
|
|
11239
11605
|
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
|
|
11240
11606
|
[ -x "$DRAFT_TOOLS/emit-skill-metrics.sh" ] && bash "$DRAFT_TOOLS/emit-skill-metrics.sh" \
|
|
11241
11607
|
'{"skill":"deep-review","module":"<module>","phases_completed":<N>,"critical_count":<N>,"important_count":<N>,"sec_violations":<N>,"acid_violations":<N>,"graph_queries":<N>,"fallback_grep_count":<N>}'
|
|
@@ -11446,10 +11812,21 @@ Scan the codebase to discover recurring coding patterns and update `draft/guardr
|
|
|
11446
11812
|
|
|
11447
11813
|
## MANDATORY GRAPH LOOKUP (read before pattern scanning)
|
|
11448
11814
|
|
|
11815
|
+
First resolve the bundled helpers:
|
|
11816
|
+
|
|
11817
|
+
```bash
|
|
11818
|
+
# Locate Draft's bundled helpers (cwd is the user's project; ${CLAUDE_PLUGIN_ROOT}
|
|
11819
|
+
# is not exported into skill Bash). See core/shared/tool-resolver.md.
|
|
11820
|
+
DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
|
|
11821
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
|
|
11822
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
|
|
11823
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
|
|
11824
|
+
```
|
|
11825
|
+
|
|
11449
11826
|
When `draft/graph/schema.yaml` exists, this skill **must** follow the graph-first lookup contract in [core/shared/graph-query.md](../../core/shared/graph-query.md) §Mandatory Lookup Contract. Use the graph to:
|
|
11450
11827
|
|
|
11451
|
-
1. Enumerate a module's symbols/files via `
|
|
11452
|
-
2. Prioritize hotspots via `
|
|
11828
|
+
1. Enumerate a module's symbols/files via `"$DRAFT_TOOLS/graph-callers.sh"`/`"$DRAFT_TOOLS/graph-impact.sh"` and `"$DRAFT_TOOLS/graph-arch.sh" --repo .` (preferred over `find`).
|
|
11829
|
+
2. Prioritize hotspots via `"$DRAFT_TOOLS/hotspot-rank.sh" --repo .` — patterns in high-fanIn files are more impactful when learned.
|
|
11453
11830
|
3. For TS/Python/Go/C/C++, use `*-index.jsonl` to identify class/function definitions rather than re-discovering them via regex.
|
|
11454
11831
|
|
|
11455
11832
|
Filesystem `find` for source discovery (Step 2.1) is permitted **as a complement** to the graph for languages not covered by indexes (e.g. Ruby, Java without ctags). Record the rationale in the Graph Usage Report.
|
|
@@ -11683,10 +12060,10 @@ git log --follow --oneline -1 -- {file_containing_pattern}
|
|
|
11683
12060
|
|
|
11684
12061
|
### 2.7: Graph-Aware Severity Enrichment
|
|
11685
12062
|
|
|
11686
|
-
If `draft/graph/schema.yaml` exists (engine live), derive objective severity for all anti-pattern candidates based on the fanIn of files where the pattern was found via `
|
|
12063
|
+
If `draft/graph/schema.yaml` exists (engine live), derive objective severity for all anti-pattern candidates based on the fanIn of files where the pattern was found via `"$DRAFT_TOOLS/hotspot-rank.sh" --repo .`.
|
|
11687
12064
|
|
|
11688
12065
|
For each anti-pattern candidate from Step 2.2:
|
|
11689
|
-
1. Check if any evidence files appear in the hotspot output from `
|
|
12066
|
+
1. Check if any evidence files appear in the hotspot output from `"$DRAFT_TOOLS/hotspot-rank.sh" --repo .`
|
|
11690
12067
|
2. Take the highest fanIn value across all evidence files:
|
|
11691
12068
|
- fanIn ≥ 10 → `graph_severity: critical` (breakage propagates to many callers)
|
|
11692
12069
|
- fanIn 5–9 → `graph_severity: high`
|
|
@@ -11969,8 +12346,9 @@ Check for arguments:
|
|
|
11969
12346
|
If argument is `list`:
|
|
11970
12347
|
1. Prefer the deterministic `adr-index.sh` wrapper for the listing — it returns a structured JSON `{adrs:[{id,title,date,status,path,related_tracks}]}` derived from each ADR's frontmatter. Resolve via the canonical tool resolver (see [core/shared/tool-resolver.md](../../core/shared/tool-resolver.md)):
|
|
11971
12348
|
```bash
|
|
11972
|
-
DRAFT_TOOLS="$
|
|
11973
|
-
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$
|
|
12349
|
+
DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
|
|
12350
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
|
|
12351
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
|
|
11974
12352
|
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
|
|
11975
12353
|
if [ -x "$DRAFT_TOOLS/adr-index.sh" ]; then
|
|
11976
12354
|
bash "$DRAFT_TOOLS/adr-index.sh" --root draft/adrs
|
|
@@ -12298,12 +12676,23 @@ You are conducting a structured debugging session following systematic investiga
|
|
|
12298
12676
|
|
|
12299
12677
|
## MANDATORY GRAPH LOOKUP (read before Isolate/Diagnose)
|
|
12300
12678
|
|
|
12679
|
+
First resolve the bundled helpers:
|
|
12680
|
+
|
|
12681
|
+
```bash
|
|
12682
|
+
# Locate Draft's bundled helpers (cwd is the user's project; ${CLAUDE_PLUGIN_ROOT}
|
|
12683
|
+
# is not exported into skill Bash). See core/shared/tool-resolver.md.
|
|
12684
|
+
DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
|
|
12685
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
|
|
12686
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
|
|
12687
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
|
|
12688
|
+
```
|
|
12689
|
+
|
|
12301
12690
|
When `draft/graph/schema.yaml` exists, this skill **must** follow the graph-first lookup contract in [core/shared/graph-query.md](../../core/shared/graph-query.md) §Mandatory Lookup Contract. During Steps 3–4 (Isolate, Diagnose):
|
|
12302
12691
|
|
|
12303
|
-
1. Locate the suspect file's module via `
|
|
12304
|
-
2. Use `
|
|
12305
|
-
3. Use `
|
|
12306
|
-
4. Run `
|
|
12692
|
+
1. Locate the suspect file's module via `"$DRAFT_TOOLS/graph-arch.sh" --repo .` before tracing data flow.
|
|
12693
|
+
2. Use `"$DRAFT_TOOLS/graph-callers.sh" --repo . --symbol <fn>` to enumerate call sites of suspect functions — not `grep`.
|
|
12694
|
+
3. Use `"$DRAFT_TOOLS/graph-impact.sh" --repo . --file <path>` to size the blast radius before proposing a fix.
|
|
12695
|
+
4. Run `"$DRAFT_TOOLS/hotspot-rank.sh" --repo .` to know whether the file is high-fanIn (any fix needs extra caution).
|
|
12307
12696
|
|
|
12308
12697
|
Filesystem `grep` is reserved for source-text scans (literal error strings, stack-trace symbols when the graph misses). Use the fallback sentence on graph miss.
|
|
12309
12698
|
|
|
@@ -12351,7 +12740,7 @@ Key context for debugging:
|
|
|
12351
12740
|
- `.ai-context.md` — Module boundaries, data flows, invariants (crucial for tracing)
|
|
12352
12741
|
- `tech-stack.md` — Language-specific debugging tools and techniques
|
|
12353
12742
|
- `guardrails.md` — Known anti-patterns that may be causing the issue
|
|
12354
|
-
- `draft/graph/` (MANDATORY when present) — Query `
|
|
12743
|
+
- `draft/graph/` (MANDATORY when present) — Query `"$DRAFT_TOOLS/graph-arch.sh" --repo .` for dependency/module context and `"$DRAFT_TOOLS/hotspot-rank.sh" --repo .` for complexity awareness. Use `"$DRAFT_TOOLS/graph-callers.sh" --repo . --symbol <fn>` to find all callers, and `"$DRAFT_TOOLS/graph-impact.sh" --repo . --file <path>` to size blast radius before any fix. See [core/shared/graph-query.md](../../core/shared/graph-query.md).
|
|
12355
12744
|
|
|
12356
12745
|
## Step 1: Parse Arguments
|
|
12357
12746
|
|
|
@@ -12544,8 +12933,9 @@ Check for arguments:
|
|
|
12544
12933
|
**Preferred:** invoke `parse-git-log.sh` — it parses conventional commits into structured JSONL `{sha,type,scope,track_id,subject,author,timestamp,files_changed}`, eliminating ambiguity in `type(track-id): subject` parsing. Resolve via the canonical tool resolver (see [core/shared/tool-resolver.md](../../core/shared/tool-resolver.md)):
|
|
12545
12934
|
|
|
12546
12935
|
```bash
|
|
12547
|
-
DRAFT_TOOLS="$
|
|
12548
|
-
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$
|
|
12936
|
+
DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
|
|
12937
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
|
|
12938
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
|
|
12549
12939
|
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
|
|
12550
12940
|
if [ -x "$DRAFT_TOOLS/parse-git-log.sh" ]; then
|
|
12551
12941
|
bash "$DRAFT_TOOLS/parse-git-log.sh" --since "24 hours ago" --author "$(git config user.name)"
|
|
@@ -12682,12 +13072,23 @@ You are conducting a technical debt analysis to catalog, prioritize, and plan re
|
|
|
12682
13072
|
|
|
12683
13073
|
## MANDATORY GRAPH LOOKUP (read before debt scan)
|
|
12684
13074
|
|
|
13075
|
+
First resolve the bundled helpers:
|
|
13076
|
+
|
|
13077
|
+
```bash
|
|
13078
|
+
# Locate Draft's bundled helpers (cwd is the user's project; ${CLAUDE_PLUGIN_ROOT}
|
|
13079
|
+
# is not exported into skill Bash). See core/shared/tool-resolver.md.
|
|
13080
|
+
DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
|
|
13081
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
|
|
13082
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
|
|
13083
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
|
|
13084
|
+
```
|
|
13085
|
+
|
|
12685
13086
|
When `draft/graph/schema.yaml` exists, this skill **must** follow the graph-first lookup contract in [core/shared/graph-query.md](../../core/shared/graph-query.md) §Mandatory Lookup Contract. Tech-debt prioritization is fundamentally driven by graph data:
|
|
12686
13087
|
|
|
12687
|
-
1. Run `
|
|
12688
|
-
2. Query `
|
|
12689
|
-
3. Run `
|
|
12690
|
-
4. For each catalogued finding, run `
|
|
13088
|
+
1. Run `"$DRAFT_TOOLS/hotspot-rank.sh" --repo .` — **rank candidates by `fanIn × complexity`** to surface high-leverage debt first.
|
|
13089
|
+
2. Query `"$DRAFT_TOOLS/graph-arch.sh" --repo .` and run `"$DRAFT_TOOLS/cycle-detect.sh" --repo .` — flag debt in modules involved in cycles as higher priority.
|
|
13090
|
+
3. Run `"$DRAFT_TOOLS/cycle-detect.sh" --repo .` to enumerate dependency cycles — every cycle is a candidate architecture-debt entry.
|
|
13091
|
+
4. For each catalogued finding, run `"$DRAFT_TOOLS/graph-impact.sh" --repo . --file <path>` so the remediation plan includes blast-radius.
|
|
12691
13092
|
|
|
12692
13093
|
Filesystem `grep` (e.g. `scan-markers.sh`) is still primary for TODO/FIXME marker discovery — markers are source-text, not graph-derived. The graph governs **prioritization**, the marker scan governs **discovery**.
|
|
12693
13094
|
|
|
@@ -12755,8 +13156,11 @@ Scan the codebase systematically across all seven categories. For each finding,
|
|
|
12755
13156
|
For TODO/FIXME/HACK/XXX/DEPRECATED markers, prefer the deterministic `scan-markers.sh` wrapper — it emits JSON `[{path,line,marker,text,sha,author,introduced,age_days}]` with blame ages already computed. Resolve via the canonical tool resolver (see [core/shared/tool-resolver.md](../../core/shared/tool-resolver.md)):
|
|
12756
13157
|
|
|
12757
13158
|
```bash
|
|
12758
|
-
|
|
12759
|
-
|
|
13159
|
+
# Locate Draft's bundled helpers (cwd is the user's project; ${CLAUDE_PLUGIN_ROOT}
|
|
13160
|
+
# is not exported into skill Bash). See core/shared/tool-resolver.md.
|
|
13161
|
+
DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
|
|
13162
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
|
|
13163
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
|
|
12760
13164
|
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
|
|
12761
13165
|
[ -x "$DRAFT_TOOLS/scan-markers.sh" ] && bash "$DRAFT_TOOLS/scan-markers.sh" --root .
|
|
12762
13166
|
# Fallback when script unavailable: grep -rn 'TODO\|FIXME\|HACK\|XXX\|DEPRECATED' .
|
|
@@ -13477,8 +13881,9 @@ Display a comprehensive overview of project progress.
|
|
|
13477
13881
|
If `parse-reports.sh` and `freshness-check.sh` are available, gather structured signals to enrich the status output (severity counts per track, stale `draft/` docs). Resolve via the canonical tool resolver (see [core/shared/tool-resolver.md](../../core/shared/tool-resolver.md)):
|
|
13478
13882
|
|
|
13479
13883
|
```bash
|
|
13480
|
-
DRAFT_TOOLS="$
|
|
13481
|
-
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$
|
|
13884
|
+
DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
|
|
13885
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
|
|
13886
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
|
|
13482
13887
|
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
|
|
13483
13888
|
|
|
13484
13889
|
# Per-track report severity rollup (bughunt, review, tech-debt, etc.):
|
|
@@ -14115,11 +14520,22 @@ Generate a project-wide impact report measuring Context-Driven Development effec
|
|
|
14115
14520
|
|
|
14116
14521
|
## Execution Constraints
|
|
14117
14522
|
|
|
14523
|
+
First resolve the bundled helpers:
|
|
14524
|
+
|
|
14525
|
+
```bash
|
|
14526
|
+
# Locate Draft's bundled helpers (cwd is the user's project; ${CLAUDE_PLUGIN_ROOT}
|
|
14527
|
+
# is not exported into skill Bash). See core/shared/tool-resolver.md.
|
|
14528
|
+
DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
|
|
14529
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
|
|
14530
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
|
|
14531
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
|
|
14532
|
+
```
|
|
14533
|
+
|
|
14118
14534
|
1. **Load Track State:**
|
|
14119
14535
|
- Read all `draft/tracks.md` entries.
|
|
14120
14536
|
- For each track, read `metadata.json` to extract: `created_at`, `updated`, `status`, phase counts, task counts, `scope_includes`, `scope_excludes`.
|
|
14121
14537
|
- If no tracks exist, report "No tracks found. Run `draft new-track` to create your first track."
|
|
14122
|
-
- Run `
|
|
14538
|
+
- Run `"$DRAFT_TOOLS/check-scope-conflicts.sh"` to surface adjacent
|
|
14123
14539
|
tracks sharing scope tags — duplicate effort signals in impact
|
|
14124
14540
|
reporting. Schema:
|
|
14125
14541
|
[core/shared/template-contract.md](../../core/shared/template-contract.md).
|
|
@@ -14672,7 +15088,7 @@ draft status
|
|
|
14672
15088
|
|
|
14673
15089
|
### Supported Platforms
|
|
14674
15090
|
|
|
14675
|
-
Draft works with **Claude Code** (native `.claude-plugin/` support) and **Cursor** (
|
|
15091
|
+
Draft works with **Claude Code** (native `.claude-plugin/` support) and **Cursor** (requires `.cursor-plugin/plugin.json` plus registration in the shared Claude plugin registry, both handled by `draft install cursor`). No build pipeline required.
|
|
14676
15092
|
|
|
14677
15093
|
---
|
|
14678
15094
|
|
|
@@ -16042,8 +16458,9 @@ Referenced by: All skills that generate Draft reports — including `draft bughu
|
|
|
16042
16458
|
Use `git-metadata.sh` from the plugin install, resolved via the canonical tool resolver (see [tool-resolver.md](tool-resolver.md)):
|
|
16043
16459
|
|
|
16044
16460
|
```bash
|
|
16045
|
-
DRAFT_TOOLS="$
|
|
16046
|
-
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$
|
|
16461
|
+
DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
|
|
16462
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
|
|
16463
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
|
|
16047
16464
|
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
|
|
16048
16465
|
bash "$DRAFT_TOOLS/git-metadata.sh" --yaml \
|
|
16049
16466
|
--project "$PROJECT" --module "$MODULE" \
|
|
@@ -16476,8 +16893,9 @@ Write the completed content to `draft/.ai-context.md`.
|
|
|
16476
16893
|
After writing both output files, strip trailing whitespace and blank lines at EOF to prevent GitHub upload failures. Resolve the script via the canonical tool resolver (see [tool-resolver.md](tool-resolver.md)):
|
|
16477
16894
|
|
|
16478
16895
|
```bash
|
|
16479
|
-
DRAFT_TOOLS="$
|
|
16480
|
-
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$
|
|
16896
|
+
DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
|
|
16897
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
|
|
16898
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
|
|
16481
16899
|
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
|
|
16482
16900
|
[ -x "$DRAFT_TOOLS/fix-whitespace.sh" ] && bash "$DRAFT_TOOLS/fix-whitespace.sh" draft/architecture.md draft/.ai-context.md draft/.ai-profile.md 2>/dev/null || true
|
|
16483
16901
|
```
|
|
@@ -16936,11 +17354,12 @@ These fields are appended to `~/.draft/metrics.jsonl` along with the existing sk
|
|
|
16936
17354
|
|
|
16937
17355
|
## Tooling Wrappers
|
|
16938
17356
|
|
|
16939
|
-
For common query modes, prefer the deterministic wrappers that ship with the plugin. Resolve their location via the canonical tool resolver (see [tool-resolver.md](tool-resolver.md)) before invoking:
|
|
17357
|
+
For common query modes, prefer the deterministic wrappers that ship with the plugin. Resolve their location via the canonical tool resolver (see [tool-resolver.md](tool-resolver.md)) before invoking. Skills run with cwd = the user's project and `${CLAUDE_PLUGIN_ROOT}` is **not** exported into skill Bash, so a bare `scripts/tools/foo.sh` fails — establish `DRAFT_TOOLS` once before the first helper call, in the same Bash session as your tool calls (re-establish it if you split helper calls into a separate, later Bash block):
|
|
16940
17358
|
|
|
16941
17359
|
```bash
|
|
16942
|
-
DRAFT_TOOLS="$
|
|
16943
|
-
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$
|
|
17360
|
+
DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
|
|
17361
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
|
|
17362
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
|
|
16944
17363
|
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
|
|
16945
17364
|
```
|
|
16946
17365
|
|
|
@@ -17927,14 +18346,81 @@ See verification-gates.md and template-hygiene.md for usage contracts.
|
|
|
17927
18346
|
|
|
17928
18347
|
---
|
|
17929
18348
|
shared: tool-resolver
|
|
17930
|
-
applies_to:
|
|
18349
|
+
applies_to: every skill that invokes scripts/tools/*
|
|
17931
18350
|
---
|
|
17932
18351
|
|
|
17933
|
-
# tool-resolver
|
|
18352
|
+
# tool-resolver
|
|
17934
18353
|
|
|
17935
|
-
|
|
18354
|
+
Canonical procedure for locating Draft's bundled shell helpers (`scripts/tools/*.sh`)
|
|
18355
|
+
from inside a skill.
|
|
17936
18356
|
|
|
17937
|
-
|
|
18357
|
+
## Why this exists
|
|
18358
|
+
|
|
18359
|
+
When Claude runs a draft skill, the shell's **working directory is the user's
|
|
18360
|
+
project**, not the plugin. The helpers live inside the plugin install directory,
|
|
18361
|
+
which on a marketplace/npm install is `~/.claude/plugins/cache/<marketplace>/draft/<version>/`
|
|
18362
|
+
— never the cwd. `${CLAUDE_PLUGIN_ROOT}` is **not** exported into skill-driven Bash
|
|
18363
|
+
(it is only set for hooks, MCP/LSP servers, and monitor commands), so a bare
|
|
18364
|
+
`scripts/tools/foo.sh` or `${CLAUDE_PLUGIN_ROOT}/...` invocation silently fails.
|
|
18365
|
+
|
|
18366
|
+
Every skill MUST resolve `DRAFT_TOOLS` and invoke helpers as `"$DRAFT_TOOLS/<tool>.sh"`.
|
|
18367
|
+
|
|
18368
|
+
## Resolution order
|
|
18369
|
+
|
|
18370
|
+
`DRAFT_TOOLS` resolves to the first directory that exists, in this order:
|
|
18371
|
+
|
|
18372
|
+
1. `${DRAFT_PLUGIN_ROOT}/scripts/tools` — explicit override (testing / pinned installs)
|
|
18373
|
+
2. `$(cat ~/.cache/draft/plugin-root)/scripts/tools` — install marker written by `draft install` (authoritative)
|
|
18374
|
+
3. `${CLAUDE_PLUGIN_ROOT}/scripts/tools` — set in hook/MCP contexts; harmless to probe
|
|
18375
|
+
4. `installed_plugins.json → installPath` for `draft@*` — Claude Code's own registry (needs `jq`)
|
|
18376
|
+
5. `~/.claude/plugins/cache/*/draft/*/scripts/tools` — newest cache install (glob, `sort -V`)
|
|
18377
|
+
6. `~/.claude/plugins/marketplaces/*draft*/scripts/tools` — marketplace clone
|
|
18378
|
+
7. `~/.cursor/plugins/local/draft/scripts/tools` — Cursor local install
|
|
18379
|
+
8. `$PWD/scripts/tools` — dev / dogfooding (running inside the draft repo itself)
|
|
18380
|
+
|
|
18381
|
+
The marker (step 2) is the fast, authoritative path; steps 5–6 are the glob fallback
|
|
18382
|
+
that keeps resolution working on installs predating the marker (no reinstall required).
|
|
18383
|
+
|
|
18384
|
+
## Skill preamble (copy verbatim)
|
|
18385
|
+
|
|
18386
|
+
Establish `DRAFT_TOOLS` once, before the first helper call, in the **same Bash
|
|
18387
|
+
session** that runs your tool calls — exactly as skills already define `REPO_ABS`
|
|
18388
|
+
once and reuse it. Env vars do not persist across **separate** Bash tool
|
|
18389
|
+
invocations (only the cwd does), so if you split helper calls into a later, separate
|
|
18390
|
+
Bash block, re-establish `DRAFT_TOOLS` there too:
|
|
18391
|
+
|
|
18392
|
+
```bash
|
|
18393
|
+
DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
|
|
18394
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
|
|
18395
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
|
|
18396
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
|
|
18397
|
+
```
|
|
18398
|
+
|
|
18399
|
+
Then invoke helpers through the variable:
|
|
18400
|
+
|
|
18401
|
+
```bash
|
|
18402
|
+
"$DRAFT_TOOLS/hotspot-rank.sh" --repo . --top 5
|
|
18403
|
+
"$DRAFT_TOOLS/graph-arch.sh" --repo .
|
|
18404
|
+
```
|
|
18405
|
+
|
|
18406
|
+
The four-line inline preamble is self-contained and is the recommended form for
|
|
18407
|
+
skills — it needs no marker file and no prior `source`. The full 8-step resolver
|
|
18408
|
+
(adding the `${DRAFT_PLUGIN_ROOT}` override, `${CLAUDE_PLUGIN_ROOT}`, the jq-registry
|
|
18409
|
+
lookup, and the Cursor path) is shipped as `scripts/tools/resolve-tools.sh` for tests
|
|
18410
|
+
and for callers that prefer a single source of truth:
|
|
18411
|
+
|
|
18412
|
+
```bash
|
|
18413
|
+
DRAFT_TOOLS="$("$PWD/scripts/tools/resolve-tools.sh" 2>/dev/null)" # dev/dogfood
|
|
18414
|
+
# installed: "$(cat ~/.cache/draft/plugin-root)/scripts/tools/resolve-tools.sh"
|
|
18415
|
+
```
|
|
18416
|
+
|
|
18417
|
+
## The engine binary is separate
|
|
18418
|
+
|
|
18419
|
+
`DRAFT_TOOLS` locates the **wrapper scripts**. Each wrapper then resolves the
|
|
18420
|
+
`codebase-memory-mcp` **engine binary** itself via `_lib.sh:find_memory_bin`
|
|
18421
|
+
(`DRAFT_MEMORY_BIN` → `$PATH` → `~/.cache/draft/bin/` → vendored). Do not conflate
|
|
18422
|
+
the two: a wrapper that runs but reports `source: unavailable` means the engine
|
|
18423
|
+
binary is missing, not the wrapper.
|
|
17938
18424
|
|
|
17939
18425
|
</core-file>
|
|
17940
18426
|
|
|
@@ -20340,8 +20826,9 @@ validator chain via the canonical resolver pattern (see
|
|
|
20340
20826
|
[core/shared/verification-gates.md](../../core/shared/verification-gates.md)):
|
|
20341
20827
|
|
|
20342
20828
|
```bash
|
|
20343
|
-
DRAFT_TOOLS="$
|
|
20344
|
-
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$
|
|
20829
|
+
DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
|
|
20830
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
|
|
20831
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
|
|
20345
20832
|
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
|
|
20346
20833
|
"$DRAFT_TOOLS/check-track-hygiene.sh" .; "$DRAFT_TOOLS/verify-citations.sh" .
|
|
20347
20834
|
"$DRAFT_TOOLS/verify-doc-anchors.sh" .; "$DRAFT_TOOLS/check-graph-usage-report.sh" .
|
|
@@ -21976,6 +22463,209 @@ List down alerting thresholds on those metrics:
|
|
|
21976
22463
|
|
|
21977
22464
|
---
|
|
21978
22465
|
|
|
22466
|
+
## core/templates/okf/index.md
|
|
22467
|
+
|
|
22468
|
+
<core-file path="core/templates/okf/index.md">
|
|
22469
|
+
|
|
22470
|
+
---
|
|
22471
|
+
type: Subsystem
|
|
22472
|
+
title: "{PROJECT_NAME} — Knowledge Bundle"
|
|
22473
|
+
description: >
|
|
22474
|
+
Root index of the OKF taxonomy bundle. Start here, then route into
|
|
22475
|
+
overview/, systems/, features/, reference/, or entrypoints/ via the
|
|
22476
|
+
Concept Map. Open a concept only when its description matches the task.
|
|
22477
|
+
resource: .
|
|
22478
|
+
tags: [index]
|
|
22479
|
+
timestamp: "{ISO_TIMESTAMP}"
|
|
22480
|
+
okf_version: "0.1"
|
|
22481
|
+
okf_types_version: "0.1"
|
|
22482
|
+
---
|
|
22483
|
+
|
|
22484
|
+
# {PROJECT_NAME} — Knowledge Bundle
|
|
22485
|
+
|
|
22486
|
+
> OKF v0.1 bundle. One concept per file; cross-links form the graph. The
|
|
22487
|
+
> live call graph (`codebase-memory-mcp`) is the grounding source; this bundle
|
|
22488
|
+
> is the navigable serialization. `../ai-context.md` is the consumption entry point.
|
|
22489
|
+
|
|
22490
|
+
## Sections
|
|
22491
|
+
|
|
22492
|
+
| Section | Holds | Index |
|
|
22493
|
+
|---------|-------|-------|
|
|
22494
|
+
| `overview/` | System map, getting-started, glossary | [overview/index.md](overview/index.md) |
|
|
22495
|
+
| `systems/` | Subsystems & modules (graph clusters) | [systems/index.md](systems/index.md) |
|
|
22496
|
+
| `features/` | User-facing capabilities spanning modules | [features/index.md](features/index.md) |
|
|
22497
|
+
| `reference/` | APIs, data models, dependencies, ADRs, runbooks | [reference/index.md](reference/index.md) |
|
|
22498
|
+
| `entrypoints/` | Binaries / mains / CLIs / handler roots | see pages below |
|
|
22499
|
+
|
|
22500
|
+
## Concept Map
|
|
22501
|
+
|
|
22502
|
+
<!-- Built from each concept's frontmatter `description` (the routing key).
|
|
22503
|
+
One line per concept. Regenerated on every init/refresh. -->
|
|
22504
|
+
<!-- CONCEPT-MAP:START -->
|
|
22505
|
+
<!-- CONCEPT-MAP:END -->
|
|
22506
|
+
|
|
22507
|
+
## Change log
|
|
22508
|
+
|
|
22509
|
+
See [log.md](log.md) for chronological regeneration history.
|
|
22510
|
+
|
|
22511
|
+
</core-file>
|
|
22512
|
+
|
|
22513
|
+
---
|
|
22514
|
+
|
|
22515
|
+
## core/templates/okf/concept.md
|
|
22516
|
+
|
|
22517
|
+
<core-file path="core/templates/okf/concept.md">
|
|
22518
|
+
|
|
22519
|
+
---
|
|
22520
|
+
type: Subsystem # required (OKF) — one of the frozen vocab below
|
|
22521
|
+
title: "{CONCEPT_TITLE}" # OKF
|
|
22522
|
+
description: > # OKF — LOAD-BEARING: the agent's routing key.
|
|
22523
|
+
Write this as a ROUTING DECISION, not a summary. It must answer
|
|
22524
|
+
"should the agent open this file for the task at hand?" from the index
|
|
22525
|
+
alone. Name the responsibilities and the words a task would use.
|
|
22526
|
+
resource: "{CANONICAL_SOURCE_PATH}" # OKF — canonical source path(s)
|
|
22527
|
+
tags: [tag1, tag2] # OKF
|
|
22528
|
+
timestamp: "{ISO_TIMESTAMP}" # OKF — last regeneration
|
|
22529
|
+
# Draft extensions (ignored by generic OKF consumers; namespaced x-):
|
|
22530
|
+
x-grounded-paths: ["{path/a}", "{path/b}"] # exact source files this page grounds
|
|
22531
|
+
x-hotspot-score: 0.0 # from hotspot-rank.sh (0..1)
|
|
22532
|
+
x-callers: ["{module/a}", "{module/b}"] # from graph-callers.sh
|
|
22533
|
+
---
|
|
22534
|
+
|
|
22535
|
+
# {CONCEPT_TITLE}
|
|
22536
|
+
|
|
22537
|
+
<!--
|
|
22538
|
+
Frozen `type` vocabulary (changing it churns every file — versioned via
|
|
22539
|
+
index.md: okf_types_version):
|
|
22540
|
+
Subsystem — major graph cluster / package boundary → systems/
|
|
22541
|
+
Module — single package/dir with cohesive responsibility → systems/
|
|
22542
|
+
Feature — user-facing capability spanning modules → features/
|
|
22543
|
+
Entrypoint — binary / main / CLI / handler root → entrypoints/
|
|
22544
|
+
API — public interface, route group, RPC surface → reference/
|
|
22545
|
+
DataModel — schema, table, core struct/type → reference/
|
|
22546
|
+
Dependency — notable external dep + how it's used → reference/
|
|
22547
|
+
ADR — architecture decision record → reference/
|
|
22548
|
+
Runbook — operational procedure → reference/
|
|
22549
|
+
-->
|
|
22550
|
+
|
|
22551
|
+
## What it is
|
|
22552
|
+
|
|
22553
|
+
One paragraph: the concept's responsibility and boundary. Graph-grounded.
|
|
22554
|
+
|
|
22555
|
+
## How it works
|
|
22556
|
+
|
|
22557
|
+
Primary control/data flow. At least one Mermaid diagram for a significant
|
|
22558
|
+
concept (workflow, state, or sequence). Grounded in the call graph.
|
|
22559
|
+
|
|
22560
|
+
## Used by
|
|
22561
|
+
|
|
22562
|
+
Cross-links to callers (from `x-callers`). Each link is a relative path to
|
|
22563
|
+
another concept page so `okf-validate.sh` can resolve it.
|
|
22564
|
+
|
|
22565
|
+
## Blast radius
|
|
22566
|
+
|
|
22567
|
+
What breaks if this changes (from `graph-impact.sh`). Lists `x-grounded-paths`
|
|
22568
|
+
so a focused task knows exactly which source files to open.
|
|
22569
|
+
|
|
22570
|
+
## See also
|
|
22571
|
+
|
|
22572
|
+
- [Related concept](../systems/other.md)
|
|
22573
|
+
|
|
22574
|
+
</core-file>
|
|
22575
|
+
|
|
22576
|
+
---
|
|
22577
|
+
|
|
22578
|
+
## core/templates/okf/section-index.md
|
|
22579
|
+
|
|
22580
|
+
<core-file path="core/templates/okf/section-index.md">
|
|
22581
|
+
|
|
22582
|
+
---
|
|
22583
|
+
type: Subsystem
|
|
22584
|
+
title: "{SECTION_TITLE}"
|
|
22585
|
+
description: >
|
|
22586
|
+
Section index. Lists every concept in this section with its one-line
|
|
22587
|
+
routing description so an agent can pick the right page without opening
|
|
22588
|
+
each one. {SECTION_PURPOSE}
|
|
22589
|
+
resource: .
|
|
22590
|
+
tags: [index]
|
|
22591
|
+
timestamp: "{ISO_TIMESTAMP}"
|
|
22592
|
+
---
|
|
22593
|
+
|
|
22594
|
+
# {SECTION_TITLE}
|
|
22595
|
+
|
|
22596
|
+
> Section of the OKF bundle. Back to [bundle root](../index.md).
|
|
22597
|
+
|
|
22598
|
+
## Concepts
|
|
22599
|
+
|
|
22600
|
+
<!-- One row per concept page in this section. `description` is the routing key
|
|
22601
|
+
copied from each page's frontmatter. Regenerated on every init/refresh. -->
|
|
22602
|
+
|
|
22603
|
+
| Concept | Type | Routing description |
|
|
22604
|
+
|---------|------|---------------------|
|
|
22605
|
+
| [{concept-a}]({concept-a}.md) | Module | {one-line routing desc} |
|
|
22606
|
+
| [{concept-b}]({concept-b}.md) | Feature | {one-line routing desc} |
|
|
22607
|
+
|
|
22608
|
+
</core-file>
|
|
22609
|
+
|
|
22610
|
+
---
|
|
22611
|
+
|
|
22612
|
+
## core/templates/okf/ai-context-index.md
|
|
22613
|
+
|
|
22614
|
+
<core-file path="core/templates/okf/ai-context-index.md">
|
|
22615
|
+
|
|
22616
|
+
---
|
|
22617
|
+
project: "{PROJECT_NAME}"
|
|
22618
|
+
module: "{MODULE_NAME or 'root'}"
|
|
22619
|
+
generated_by: "draft:init"
|
|
22620
|
+
generated_at: "{ISO_TIMESTAMP}"
|
|
22621
|
+
draft_init_mode: okf
|
|
22622
|
+
---
|
|
22623
|
+
|
|
22624
|
+
# {PROJECT_NAME} — AI Context Index
|
|
22625
|
+
|
|
22626
|
+
> Index root for the OKF taxonomy bundle (`wiki/`). Read **Synopsis** for broad
|
|
22627
|
+
> tasks (they usually terminate here). For focused tasks, route through the
|
|
22628
|
+
> **Concept Map** to ≤N concept pages — each lists `x-grounded-paths`. This is
|
|
22629
|
+
> both the cheap broad-context path AND the progressive-disclosure entry point.
|
|
22630
|
+
|
|
22631
|
+
## Synopsis
|
|
22632
|
+
|
|
22633
|
+
<!-- 150–250 lines: the cheap broad-context path (prior .ai-context.md value
|
|
22634
|
+
preserved). Architecture in brief, key invariants, where to start, top
|
|
22635
|
+
hotspots. A broad task should be answerable from this section alone. -->
|
|
22636
|
+
|
|
22637
|
+
- **Architecture in brief:** {2–4 sentences}
|
|
22638
|
+
- **Key invariants:** {bullet list, provenance-tagged}
|
|
22639
|
+
- **Where to start:** {entrypoints + core subsystems}
|
|
22640
|
+
- **Top hotspots:** {from hotspot-rank.sh — symbol, fan-in}
|
|
22641
|
+
|
|
22642
|
+
## Concept Map
|
|
22643
|
+
|
|
22644
|
+
<!-- Routing table built from each concept's frontmatter `description`.
|
|
22645
|
+
Open a section index for the full per-concept list. -->
|
|
22646
|
+
|
|
22647
|
+
| Section | Routing |
|
|
22648
|
+
|---------|---------|
|
|
22649
|
+
| `wiki/systems/` | {one-line per subsystem — what it owns, when to open} |
|
|
22650
|
+
| `wiki/features/` | {one-line per feature} |
|
|
22651
|
+
| `wiki/reference/` | config, schemas, APIs, ADRs, runbooks |
|
|
22652
|
+
| `wiki/entrypoints/` | binaries / CLIs / handler roots |
|
|
22653
|
+
|
|
22654
|
+
Full taxonomy: [wiki/index.md](wiki/index.md).
|
|
22655
|
+
|
|
22656
|
+
## How to navigate
|
|
22657
|
+
|
|
22658
|
+
1. **Broad task** (summarize, "what owns X", topology) → answer from **Synopsis**.
|
|
22659
|
+
2. **Focused task** ("what breaks if I change Y", "add a field to Z") → open the
|
|
22660
|
+
matching concept via the **Concept Map**; follow its `x-grounded-paths` and
|
|
22661
|
+
`Used by` cross-links. Do not read the whole bundle.
|
|
22662
|
+
3. Every concept page is verified against the live call graph; trust its
|
|
22663
|
+
`Blast radius` section over re-deriving by hand.
|
|
22664
|
+
|
|
22665
|
+
</core-file>
|
|
22666
|
+
|
|
22667
|
+
---
|
|
22668
|
+
|
|
21979
22669
|
## core/agents/architect.md
|
|
21980
22670
|
|
|
21981
22671
|
<core-file path="core/agents/architect.md">
|