@drafthq/draft 3.2.0 → 3.2.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drafthq/draft",
3
- "version": "3.2.0",
3
+ "version": "3.2.1",
4
4
  "description": "Context-Driven Development for AI coding agents — install Draft into Claude Code, Cursor, Codex, or opencode.",
5
5
  "bin": {
6
6
  "draft": "cli/bin/draft.js"
package/scripts/lib.sh CHANGED
@@ -186,6 +186,7 @@ TOOLS=(
186
186
  "verify-citations.sh"
187
187
  "verify-doc-anchors.sh"
188
188
  "verify-graph-binary.sh"
189
+ "resolve-tools.sh"
189
190
  )
190
191
 
191
192
  # ─────────────────────────────────────────────────────────
@@ -0,0 +1,78 @@
1
+ #!/usr/bin/env bash
2
+ # resolve-tools.sh — print the absolute path to Draft's bundled scripts/tools dir.
3
+ #
4
+ # Skills run with cwd = the user's project, and ${CLAUDE_PLUGIN_ROOT} is NOT exported
5
+ # into skill-driven Bash, so a bare `scripts/tools/foo.sh` invocation fails. This
6
+ # resolver finds the plugin's helper directory regardless of how Draft was installed.
7
+ # See core/shared/tool-resolver.md for the canonical procedure and the inline preamble
8
+ # skills embed (this script is the single source of truth for the resolution order).
9
+ #
10
+ # Usage:
11
+ # DRAFT_TOOLS="$(scripts/tools/resolve-tools.sh)" # prints the dir, exit 0 if found
12
+ # scripts/tools/resolve-tools.sh || echo "tools not found" # exit 1 if none exist
13
+ set -euo pipefail
14
+
15
+ case "${1:-}" in
16
+ -h|--help)
17
+ sed -n '2,13p' "$0" | sed 's/^# \{0,1\}//'
18
+ exit 0
19
+ ;;
20
+ esac
21
+
22
+ newest() {
23
+ # Echo the lexically-newest existing match of a glob (by version sort), or nothing.
24
+ # shellcheck disable=SC2086
25
+ ls -d $1 2>/dev/null | sort -V | tail -1
26
+ }
27
+
28
+ resolve() {
29
+ local d
30
+
31
+ # 1. Explicit override (testing / pinned installs).
32
+ d="${DRAFT_PLUGIN_ROOT:-}/scripts/tools"
33
+ [ -n "${DRAFT_PLUGIN_ROOT:-}" ] && [ -d "$d" ] && { printf '%s' "$d"; return 0; }
34
+
35
+ # 1b. Dev / dogfooding: cwd IS the draft repo. Guarded by this script's own
36
+ # presence so it can never misfire in a user project (which has no resolve-tools.sh).
37
+ [ -f "$PWD/scripts/tools/resolve-tools.sh" ] && { printf '%s' "$PWD/scripts/tools"; return 0; }
38
+
39
+ # 2. Install marker written by `draft install` (authoritative).
40
+ local marker="$HOME/.cache/draft/plugin-root"
41
+ if [ -f "$marker" ]; then
42
+ d="$(cat "$marker" 2>/dev/null)/scripts/tools"
43
+ [ -d "$d" ] && { printf '%s' "$d"; return 0; }
44
+ fi
45
+
46
+ # 3. ${CLAUDE_PLUGIN_ROOT} — set in hook/MCP contexts; harmless to probe.
47
+ d="${CLAUDE_PLUGIN_ROOT:-}/scripts/tools"
48
+ [ -n "${CLAUDE_PLUGIN_ROOT:-}" ] && [ -d "$d" ] && { printf '%s' "$d"; return 0; }
49
+
50
+ # 4. Claude Code's own registry (authoritative installPath; needs jq).
51
+ local reg="$HOME/.claude/plugins/installed_plugins.json"
52
+ if command -v jq >/dev/null 2>&1 && [ -f "$reg" ]; then
53
+ local ip
54
+ ip="$(jq -r '.plugins | to_entries[] | select(.key|startswith("draft@")) | .value[0].installPath' \
55
+ "$reg" 2>/dev/null | head -1)"
56
+ [ -n "$ip" ] && [ -d "$ip/scripts/tools" ] && { printf '%s' "$ip/scripts/tools"; return 0; }
57
+ fi
58
+
59
+ # 5. Newest cache install (glob).
60
+ d="$(newest "$HOME/.claude/plugins/cache/*/draft/*/scripts/tools")"
61
+ [ -n "$d" ] && [ -d "$d" ] && { printf '%s' "$d"; return 0; }
62
+
63
+ # 6. Marketplace clone.
64
+ d="$(newest "$HOME/.claude/plugins/marketplaces/*draft*/scripts/tools")"
65
+ [ -n "$d" ] && [ -d "$d" ] && { printf '%s' "$d"; return 0; }
66
+
67
+ # 7. Cursor local install.
68
+ d="$HOME/.cursor/plugins/local/draft/scripts/tools"
69
+ [ -d "$d" ] && { printf '%s' "$d"; return 0; }
70
+
71
+ # 8. Dev / dogfooding (running inside the draft repo itself).
72
+ d="$PWD/scripts/tools"
73
+ [ -d "$d" ] && { printf '%s' "$d"; return 0; }
74
+
75
+ return 1
76
+ }
77
+
78
+ resolve
@@ -54,8 +54,9 @@ Check for arguments:
54
54
  If argument is `list`:
55
55
  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)):
56
56
  ```bash
57
- DRAFT_TOOLS="${DRAFT_PLUGIN_ROOT:-$HOME/.claude/plugins/draft}/scripts/tools"
58
- [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$HOME/.cursor/plugins/local/draft/scripts/tools"
57
+ DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
58
+ [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
59
+ [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
59
60
  [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
60
61
  if [ -x "$DRAFT_TOOLS/adr-index.sh" ]; then
61
62
  bash "$DRAFT_TOOLS/adr-index.sh" --root draft/adrs
@@ -68,7 +68,16 @@ Read and follow the base procedure in `core/shared/draft-context-loading.md`.
68
68
  - **Leverage Storage Topology** — Identify data loss risks at each tier (cache eviction without writeback, event log gaps, missing archive)
69
69
  - **Leverage Consistency Boundaries** — Find bugs at eventual consistency seams (stale reads, lost events, missing reconciliation)
70
70
  - **Leverage Failure Recovery Matrix** — Verify idempotency claims, check for partial failure states without recovery paths
71
- - **Leverage Graph Data** (if `draft/graph/` exists) — Query `scripts/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 `scripts/tools/hotspot-rank.sh --repo .` to prioritize analysis of high-complexity, high-fanIn files. See `core/shared/graph-query.md`.
71
+ - **Leverage Graph Data** (if `draft/graph/` exists) — First resolve the bundled helpers:
72
+ ```bash
73
+ # Locate Draft's bundled helpers (cwd is the user's project; ${CLAUDE_PLUGIN_ROOT}
74
+ # is not exported into skill Bash). See core/shared/tool-resolver.md.
75
+ DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
76
+ [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
77
+ [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
78
+ [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
79
+ ```
80
+ 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`.
72
81
  - **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.
73
82
 
74
83
  ### 2. Confirm Scope
@@ -33,8 +33,9 @@ If no active track and no argument provided:
33
33
  **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)):
34
34
 
35
35
  ```bash
36
- DRAFT_TOOLS="${DRAFT_PLUGIN_ROOT:-$HOME/.claude/plugins/draft}/scripts/tools"
37
- [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$HOME/.cursor/plugins/local/draft/scripts/tools"
36
+ DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
37
+ [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
38
+ [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
38
39
  [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
39
40
  [ -x "$DRAFT_TOOLS/detect-test-framework.sh" ] && \
40
41
  bash "$DRAFT_TOOLS/detect-test-framework.sh" --root .
@@ -73,7 +74,11 @@ Build the coverage command with the appropriate scope/filter flags.
73
74
  **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.
74
75
 
75
76
  ```bash
76
- # DRAFT_TOOLS resolved in Step 2 above
77
+ # Re-resolve helpers (this is a separate Bash session from Step 2).
78
+ DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
79
+ [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
80
+ [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
81
+ [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
77
82
  [ -x "$DRAFT_TOOLS/run-coverage.sh" ] && \
78
83
  bash "$DRAFT_TOOLS/run-coverage.sh" --root .
79
84
  ```
@@ -9,12 +9,23 @@ You are conducting a structured debugging session following systematic investiga
9
9
 
10
10
  ## MANDATORY GRAPH LOOKUP (read before Isolate/Diagnose)
11
11
 
12
+ First resolve the bundled helpers:
13
+
14
+ ```bash
15
+ # Locate Draft's bundled helpers (cwd is the user's project; ${CLAUDE_PLUGIN_ROOT}
16
+ # is not exported into skill Bash). See core/shared/tool-resolver.md.
17
+ DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
18
+ [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
19
+ [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
20
+ [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
21
+ ```
22
+
12
23
  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):
13
24
 
14
- 1. Locate the suspect file's module via `scripts/tools/graph-arch.sh --repo .` before tracing data flow.
15
- 2. Use `scripts/tools/graph-callers.sh --repo . --symbol <fn>` to enumerate call sites of suspect functions — not `grep`.
16
- 3. Use `scripts/tools/graph-impact.sh --repo . --file <path>` to size the blast radius before proposing a fix.
17
- 4. Run `scripts/tools/hotspot-rank.sh --repo .` to know whether the file is high-fanIn (any fix needs extra caution).
25
+ 1. Locate the suspect file's module via `"$DRAFT_TOOLS/graph-arch.sh" --repo .` before tracing data flow.
26
+ 2. Use `"$DRAFT_TOOLS/graph-callers.sh" --repo . --symbol <fn>` to enumerate call sites of suspect functions — not `grep`.
27
+ 3. Use `"$DRAFT_TOOLS/graph-impact.sh" --repo . --file <path>` to size the blast radius before proposing a fix.
28
+ 4. Run `"$DRAFT_TOOLS/hotspot-rank.sh" --repo .` to know whether the file is high-fanIn (any fix needs extra caution).
18
29
 
19
30
  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.
20
31
 
@@ -62,7 +73,7 @@ Key context for debugging:
62
73
  - `.ai-context.md` — Module boundaries, data flows, invariants (crucial for tracing)
63
74
  - `tech-stack.md` — Language-specific debugging tools and techniques
64
75
  - `guardrails.md` — Known anti-patterns that may be causing the issue
65
- - `draft/graph/` (MANDATORY when present) — Query `scripts/tools/graph-arch.sh --repo .` for dependency/module context and `scripts/tools/hotspot-rank.sh --repo .` for complexity awareness. Use `scripts/tools/graph-callers.sh --repo . --symbol <fn>` to find all callers, and `scripts/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).
76
+ - `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).
66
77
 
67
78
  ## Step 1: Parse Arguments
68
79
 
@@ -9,12 +9,23 @@ You are decomposing a project or track into modules with clear responsibilities,
9
9
 
10
10
  ## MANDATORY GRAPH LOOKUP (read before any analysis)
11
11
 
12
+ First resolve the bundled helpers:
13
+
14
+ ```bash
15
+ # Locate Draft's bundled helpers (cwd is the user's project; ${CLAUDE_PLUGIN_ROOT}
16
+ # is not exported into skill Bash). See core/shared/tool-resolver.md.
17
+ DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
18
+ [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
19
+ [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
20
+ [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
21
+ ```
22
+
12
23
  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**:
13
24
 
14
- 1. Query `scripts/tools/graph-arch.sh --repo .` for the authoritative module list and fan-in/out.
15
- 2. Run `scripts/tools/hotspot-rank.sh --repo .` to identify candidate modules to split.
16
- 3. Use `scripts/tools/graph-callers.sh`/`graph-impact.sh` on demand for symbols/callers inside a candidate module.
17
- 4. Run `scripts/tools/cycle-detect.sh --repo .` to enumerate existing cycles before proposing new boundaries.
25
+ 1. Query `"$DRAFT_TOOLS/graph-arch.sh" --repo .` for the authoritative module list and fan-in/out.
26
+ 2. Run `"$DRAFT_TOOLS/hotspot-rank.sh" --repo .` to identify candidate modules to split.
27
+ 3. Use `"$DRAFT_TOOLS/graph-callers.sh"`/`"$DRAFT_TOOLS/graph-impact.sh"` on demand for symbols/callers inside a candidate module.
28
+ 4. Run `"$DRAFT_TOOLS/cycle-detect.sh" --repo .` to enumerate existing cycles before proposing new boundaries.
18
29
 
19
30
  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.
20
31
 
@@ -156,11 +167,11 @@ ls -d src/*/ lib/*/ app/*/ packages/*/ 2>/dev/null
156
167
 
157
168
  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:
158
169
 
159
- - **Module boundaries**: Query `scripts/tools/graph-arch.sh --repo .` — module list with node counts and per-language file counts
170
+ - **Module boundaries**: Query `"$DRAFT_TOOLS/graph-arch.sh" --repo .` — module list with node counts and per-language file counts
160
171
  - **Dependency edges**: Weighted inter-module dependencies with exact include counts — replaces manual import tracing
161
172
  - **Cycle detection**: Circular dependency paths already computed — use for identifying tight coupling and decomposition candidates
162
- - **Hotspots**: Run `scripts/tools/hotspot-rank.sh --repo .` — high-complexity files that may need further decomposition
163
- - **Per-module detail**: query `scripts/tools/graph-callers.sh`/`graph-impact.sh` for symbol/call detail within modules of interest
173
+ - **Hotspots**: Run `"$DRAFT_TOOLS/hotspot-rank.sh" --repo .` — high-complexity files that may need further decomposition
174
+ - **Per-module detail**: query `"$DRAFT_TOOLS/graph-callers.sh"`/`"$DRAFT_TOOLS/graph-impact.sh"` for symbol/call detail within modules of interest
164
175
 
165
176
  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.
166
177
 
@@ -404,8 +415,11 @@ After writing all generated files, strip trailing whitespace and blank lines at
404
415
  Resolve the script via the canonical tool resolver (see [core/shared/tool-resolver.md](../../core/shared/tool-resolver.md)):
405
416
 
406
417
  ```bash
407
- DRAFT_TOOLS="${DRAFT_PLUGIN_ROOT:-$HOME/.claude/plugins/draft}/scripts/tools"
408
- [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$HOME/.cursor/plugins/local/draft/scripts/tools"
418
+ # Locate Draft's bundled helpers (cwd is the user's project; ${CLAUDE_PLUGIN_ROOT}
419
+ # is not exported into skill Bash). See core/shared/tool-resolver.md.
420
+ DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
421
+ [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
422
+ [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
409
423
  [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
410
424
  # Fix all generated markdown for this track:
411
425
  [ -x "$DRAFT_TOOLS/fix-whitespace.sh" ] && bash "$DRAFT_TOOLS/fix-whitespace.sh" --track <id>
@@ -452,7 +466,7 @@ references, sunset criteria) survive every regenerate. After rewriting:
452
466
  2. Update plan.md `generated_at:` to the current ISO-8601 timestamp.
453
467
  3. Ensure plan.md `generated_at` ≥ sibling hld.md / lld.md `generated_at`
454
468
  (the hygiene validator fails on stale plan).
455
- 4. Run `scripts/tools/check-track-hygiene.sh <track_dir>` and resolve any
469
+ 4. Run `"$DRAFT_TOOLS/check-track-hygiene.sh" <track_dir>` and resolve any
456
470
  findings before promoting status past `draft`.
457
471
 
458
472
  If the plan does not yet have the bracket markers (pre-2.0 track), insert
@@ -648,8 +662,11 @@ As the last step after the completion announcement, emit a metrics record. Best-
648
662
 
649
663
  **Emit call:**
650
664
  ```bash
651
- DRAFT_TOOLS="${DRAFT_PLUGIN_ROOT:-$HOME/.claude/plugins/draft}/scripts/tools"
652
- [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$HOME/.cursor/plugins/local/draft/scripts/tools"
665
+ # Locate Draft's bundled helpers (cwd is the user's project; ${CLAUDE_PLUGIN_ROOT}
666
+ # is not exported into skill Bash). See core/shared/tool-resolver.md.
667
+ DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
668
+ [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
669
+ [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
653
670
  [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
654
671
  [ -x "$DRAFT_TOOLS/emit-skill-metrics.sh" ] && bash "$DRAFT_TOOLS/emit-skill-metrics.sh" \
655
672
  '{"skill":"decompose","scope":"<scope>","track_id":"<id_or_null>","modules_count":<N>,"lld_generated":<bool>,"high_complexity_modules":<N>}'
@@ -11,10 +11,20 @@ Perform an exhaustive end-to-end lifecycle review of a service, component, or mo
11
11
 
12
12
  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:
13
13
 
14
- 1. Use `scripts/tools/graph-impact.sh`/`graph-callers.sh` and `scripts/tools/graph-arch.sh --repo .` for the audited module's structure — do not enumerate via `find`.
15
- 2. Run `scripts/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.
16
- 3. Run `scripts/tools/cycle-detect.sh --repo .` and flag any cycle that includes the audited module as Architecture Resilience finding.
17
- 4. Run `scripts/tools/hotspot-rank.sh --repo .` to identify high-fanIn files inside the module — these get deeper inspection.
14
+ First resolve the bundled helpers:
15
+ ```bash
16
+ # Locate Draft's bundled helpers (cwd is the user's project; ${CLAUDE_PLUGIN_ROOT}
17
+ # is not exported into skill Bash). See core/shared/tool-resolver.md.
18
+ DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
19
+ [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
20
+ [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
21
+ [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
22
+ ```
23
+
24
+ 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`.
25
+ 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.
26
+ 3. Run `"$DRAFT_TOOLS/cycle-detect.sh" --repo .` and flag any cycle that includes the audited module as Architecture Resilience finding.
27
+ 4. Run `"$DRAFT_TOOLS/hotspot-rank.sh" --repo .` to identify high-fanIn files inside the module — these get deeper inspection.
18
28
 
19
29
  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.
20
30
 
@@ -318,8 +328,11 @@ As the last step after saving the deep-review report, emit a metrics record. Bes
318
328
 
319
329
  **Emit call:**
320
330
  ```bash
321
- DRAFT_TOOLS="${DRAFT_PLUGIN_ROOT:-$HOME/.claude/plugins/draft}/scripts/tools"
322
- [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$HOME/.cursor/plugins/local/draft/scripts/tools"
331
+ # Locate Draft's bundled helpers (cwd is the user's project; ${CLAUDE_PLUGIN_ROOT}
332
+ # is not exported into skill Bash). See core/shared/tool-resolver.md.
333
+ DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
334
+ [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
335
+ [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
323
336
  [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
324
337
  [ -x "$DRAFT_TOOLS/emit-skill-metrics.sh" ] && bash "$DRAFT_TOOLS/emit-skill-metrics.sh" \
325
338
  '{"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>}'
@@ -11,9 +11,9 @@ You are generating a pre-deployment verification checklist customized to this pr
11
11
 
12
12
  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:
13
13
 
14
- 1. For each file in the deploy diff, run `scripts/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.
15
- 2. Run `scripts/tools/cycle-detect.sh --repo .` (and query `scripts/tools/graph-arch.sh --repo .` for the module overview) to ensure no fresh cycles were introduced after HLD sign-off.
16
- 3. Run `scripts/tools/hotspot-rank.sh --repo .` — any hotspot in the diff escalates the Resiliency row of Phase 0.
14
+ 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.
15
+ 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.
16
+ 3. Run `"$DRAFT_TOOLS/hotspot-rank.sh" --repo .` — any hotspot in the diff escalates the Resiliency row of Phase 0.
17
17
 
18
18
  Filesystem `grep` is reserved for source-text scans (migration file names, flag-key strings). Module/impact discovery goes through the graph.
19
19
 
@@ -67,8 +67,9 @@ by validator.
67
67
  ```bash
68
68
  TRACK_DIR="$1" # absolute path to track-under-deploy, or .
69
69
 
70
- DRAFT_TOOLS="${DRAFT_PLUGIN_ROOT:-$HOME/.claude/plugins/draft}/scripts/tools"
71
- [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$HOME/.cursor/plugins/local/draft/scripts/tools"
70
+ DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
71
+ [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
72
+ [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
72
73
  [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
73
74
 
74
75
  "$DRAFT_TOOLS/check-track-hygiene.sh" "$TRACK_DIR" || rc=$?
@@ -33,6 +33,15 @@ if [ ! -d "$REPO" ]; then
33
33
  fi
34
34
  REPO_ABS="$(cd "$REPO" && pwd)"
35
35
  echo "Target repo: $REPO_ABS"
36
+
37
+ # Locate Draft's bundled helpers. Skills run with cwd = the user's project and
38
+ # ${CLAUDE_PLUGIN_ROOT} is not exported into skill Bash, so resolve DRAFT_TOOLS here
39
+ # and call helpers as "$DRAFT_TOOLS/<tool>.sh". See core/shared/tool-resolver.md.
40
+ DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
41
+ [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
42
+ [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
43
+ [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
44
+ DRAFT_SCRIPTS="${DRAFT_TOOLS%/tools}" # parent dir holds fetch-memory-engine.sh
36
45
  ```
37
46
 
38
47
  ## Step 2: Ensure the engine is present
@@ -40,12 +49,12 @@ echo "Target repo: $REPO_ABS"
40
49
  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.
41
50
 
42
51
  ```bash
43
- if ! scripts/tools/verify-graph-binary.sh --repo "$REPO_ABS" --json 2>/dev/null | grep -q '"status":"ok"'; then
52
+ if ! "$DRAFT_TOOLS/verify-graph-binary.sh" --repo "$REPO_ABS" --json 2>/dev/null | grep -q '"status":"ok"'; then
44
53
  echo "Graph engine not found — attempting to fetch it..."
45
- scripts/fetch-memory-engine.sh || true
54
+ "$DRAFT_SCRIPTS/fetch-memory-engine.sh" || true
46
55
  fi
47
56
 
48
- ENGINE="$(scripts/tools/verify-graph-binary.sh --repo "$REPO_ABS" --json 2>/dev/null || true)"
57
+ ENGINE="$("$DRAFT_TOOLS/verify-graph-binary.sh" --repo "$REPO_ABS" --json 2>/dev/null || true)"
49
58
  if ! echo "$ENGINE" | grep -q '"status":"ok"'; then
50
59
  echo "Graph engine unavailable — skipping. Install with scripts/fetch-memory-engine.sh, or unset DRAFT_MEMORY_DISABLE."
51
60
  exit 0
@@ -58,7 +67,7 @@ echo "Engine: $ENGINE"
58
67
  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`.
59
68
 
60
69
  ```bash
61
- scripts/tools/graph-snapshot.sh --repo "$REPO_ABS"
70
+ "$DRAFT_TOOLS/graph-snapshot.sh" --repo "$REPO_ABS"
62
71
  ```
63
72
 
64
73
  If this exits non-zero, the engine became unavailable mid-run — report it and stop; do not fabricate results.
@@ -72,10 +81,10 @@ echo "--- Snapshot ---"
72
81
  cat "$REPO_ABS/draft/graph/schema.yaml"
73
82
 
74
83
  echo "--- Top hotspots ---"
75
- scripts/tools/hotspot-rank.sh --repo "$REPO_ABS" --top 5
84
+ "$DRAFT_TOOLS/hotspot-rank.sh" --repo "$REPO_ABS" --top 5
76
85
 
77
86
  echo "--- Cycles ---"
78
- scripts/tools/cycle-detect.sh --repo "$REPO_ABS"
87
+ "$DRAFT_TOOLS/cycle-detect.sh" --repo "$REPO_ABS"
79
88
 
80
89
  echo "--- Snapshot state ---"
81
90
  git -C "$REPO_ABS" rev-parse --short HEAD 2>/dev/null \
@@ -16,11 +16,22 @@ Generate a project-wide impact report measuring Context-Driven Development effec
16
16
 
17
17
  ## Execution Constraints
18
18
 
19
+ First resolve the bundled helpers:
20
+
21
+ ```bash
22
+ # Locate Draft's bundled helpers (cwd is the user's project; ${CLAUDE_PLUGIN_ROOT}
23
+ # is not exported into skill Bash). See core/shared/tool-resolver.md.
24
+ DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
25
+ [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
26
+ [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
27
+ [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
28
+ ```
29
+
19
30
  1. **Load Track State:**
20
31
  - Read all `draft/tracks.md` entries.
21
32
  - For each track, read `metadata.json` to extract: `created_at`, `updated`, `status`, phase counts, task counts, `scope_includes`, `scope_excludes`.
22
33
  - If no tracks exist, report "No tracks found. Run `/draft:new-track` to create your first track."
23
- - Run `scripts/tools/check-scope-conflicts.sh` to surface adjacent
34
+ - Run `"$DRAFT_TOOLS/check-scope-conflicts.sh"` to surface adjacent
24
35
  tracks sharing scope tags — duplicate effort signals in impact
25
36
  reporting. Schema:
26
37
  [core/shared/template-contract.md](../../core/shared/template-contract.md).
@@ -133,9 +133,21 @@ If one of these applies, route directly to the specialist workflow and stop this
133
133
  - Keep matching invariants as **active constraints** for this task — these govern code generation, not just review
134
134
  - If invariants reference lock ordering, fail-closed behavior, or data integrity rules: these are non-negotiable during implementation
135
135
  9. **Load graph context** (if `draft/graph/schema.yaml` exists):
136
- - Run `scripts/tools/hotspot-rank.sh --repo .` — check if any files this task will modify appear as hotspots
136
+
137
+ First resolve the bundled helpers:
138
+
139
+ ```bash
140
+ # Locate Draft's bundled helpers (cwd is the user's project; ${CLAUDE_PLUGIN_ROOT}
141
+ # is not exported into skill Bash). See core/shared/tool-resolver.md.
142
+ DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
143
+ [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
144
+ [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
145
+ [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
146
+ ```
147
+
148
+ - Run `"$DRAFT_TOOLS/hotspot-rank.sh" --repo .` — check if any files this task will modify appear as hotspots
137
149
  - 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."
138
- - Query `scripts/tools/graph-impact.sh`/`graph-callers.sh` for the module(s) being modified — gives file-level dependency context
150
+ - Query `"$DRAFT_TOOLS/graph-impact.sh"`/`"$DRAFT_TOOLS/graph-callers.sh"` for the module(s) being modified — gives file-level dependency context
139
151
  - See `core/shared/graph-query.md` for on-demand query subroutines (callers, impact)
140
152
  10. Update the track's entry in `draft/tracks.md` from `[ ]` to `[~]` In Progress
141
153
 
@@ -625,9 +637,13 @@ After a phase passes review, refresh `metadata.json.impact` so future tracks can
625
637
  ```
626
638
  That is the `files_touched` list. Derive `modules_touched` as the unique top-level path segments (e.g. `auth/login.go` → `auth`).
627
639
 
628
- 2. **Compute downstream blast radius (graph-aware, optional):** If `draft/graph/schema.yaml` exists, for each file in `files_touched` query:
640
+ 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):
629
641
  ```bash
630
- scripts/tools/graph-impact.sh --repo . --file <path>
642
+ DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
643
+ [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
644
+ [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
645
+ [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
646
+ "$DRAFT_TOOLS/graph-impact.sh" --repo . --file <path>
631
647
  ```
632
648
  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.
633
649
 
@@ -491,8 +491,15 @@ The knowledge-graph engine `codebase-memory-mcp` is Draft's **default** capabili
491
491
  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:
492
492
 
493
493
  ```bash
494
+ # Locate Draft's bundled helpers (cwd is the user's project; ${CLAUDE_PLUGIN_ROOT}
495
+ # is not exported into skill Bash). See core/shared/tool-resolver.md.
496
+ DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
497
+ [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
498
+ [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
499
+ [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
500
+
494
501
  # Add --module-only to skip touching the root (link marked "pending").
495
- if scripts/tools/graph-init.sh --scope .; then
502
+ if "$DRAFT_TOOLS/graph-init.sh" --scope .; then
496
503
  echo "Graph memory ready under draft/graph/ (the root spine is the structural source of truth)."
497
504
  else
498
505
  echo "Graph engine unavailable — proceeding with degraded manual discovery. Downstream skills degrade gracefully."
@@ -506,7 +513,7 @@ fi
506
513
  Optionally record which engine was selected (usage-report contract):
507
514
 
508
515
  ```bash
509
- scripts/tools/verify-graph-binary.sh --repo . --json 2>/dev/null || true
516
+ "$DRAFT_TOOLS/verify-graph-binary.sh" --repo . --json 2>/dev/null || true
510
517
  ```
511
518
 
512
519
  See `core/shared/graph-query.md` and `bin/README.md` for the query contract and engine resolution.
@@ -518,13 +525,13 @@ If indexing succeeds, `draft/graph/schema.yaml` is written and later steps query
518
525
  Pull the architecture view once and reuse it across phases:
519
526
 
520
527
  ```bash
521
- ARCH=$(scripts/tools/graph-arch.sh --repo .)
528
+ ARCH=$("$DRAFT_TOOLS/graph-arch.sh" --repo .)
522
529
  ```
523
530
 
524
531
  - `$ARCH | jq '.packages'` — module list with fan-in/out
525
532
  - `$ARCH | jq '.routes'` — detected service endpoints
526
533
  - `$ARCH | jq '.languages, .node_labels, .layers, .boundaries'` — language mix, node shape, layering
527
- - `scripts/tools/hotspot-rank.sh --repo . --top 20` — complexity/fan-in hotspots (live)
534
+ - `"$DRAFT_TOOLS/hotspot-rank.sh" --repo . --top 20` — complexity/fan-in hotspots (live)
528
535
 
529
536
  ### 3. Use graph data to accelerate Step 1.5
530
537
 
@@ -556,7 +563,7 @@ Apply tier table:
556
563
  Hold tier in memory. This governs: architecture.md length minimum, .ai-context.md budget, and module deep-dive depth.
557
564
 
558
565
  **Step 1.4.6 — Build Module Priority List:**
559
- From `scripts/tools/hotspot-rank.sh --repo .`: count hotspot symbols per module.
566
+ From `"$DRAFT_TOOLS/hotspot-rank.sh" --repo .`: count hotspot symbols per module.
560
567
  From `$ARCH | jq '.packages[]'`: read `fan_in` per module.
561
568
  Rank modules by: `(hotspot_count × 2) + fan_in_count`.
562
569
  Top-ranked modules drive Section 6 deep-dive ordering and depth. Modules ranked zero on both: summary treatment only.
@@ -567,7 +574,7 @@ Query for diagram content and write into architecture.md slots using the standar
567
574
 
568
575
  For Section 4.4 (module-deps slot):
569
576
  ```bash
570
- scripts/tools/mermaid-from-graph.sh --repo . --diagram module-deps
577
+ "$DRAFT_TOOLS/mermaid-from-graph.sh" --repo . --diagram module-deps
571
578
  ```
572
579
  The tool emits a ready-to-inject ` ```mermaid ``` ` block (or an empty stub on exit 2). Write between the markers:
573
580
  ```
@@ -577,7 +584,7 @@ The tool emits a ready-to-inject ` ```mermaid ``` ` block (or an empty stub on e
577
584
  ```
578
585
 
579
586
  For Section 20 (hotspots slot):
580
- Run `scripts/tools/hotspot-rank.sh --repo . --top 10`, take the top 10 by fanIn, build a markdown table:
587
+ Run `"$DRAFT_TOOLS/hotspot-rank.sh" --repo . --top 10`, take the top 10 by fanIn, build a markdown table:
581
588
  ```
582
589
  <!-- GRAPH:hotspots:START -->
583
590
  | Symbol | fanIn |
@@ -589,7 +596,7 @@ Run `scripts/tools/hotspot-rank.sh --repo . --top 10`, take the top 10 by fanIn,
589
596
 
590
597
  For Appendix E (proto-map slot):
591
598
  ```bash
592
- scripts/tools/mermaid-from-graph.sh --repo . --diagram proto-map
599
+ "$DRAFT_TOOLS/mermaid-from-graph.sh" --repo . --diagram proto-map
593
600
  ```
594
601
  The tool emits a ` ```mermaid ``` ` block from detected routes (empty stub if none). Write:
595
602
  ```
@@ -666,7 +673,7 @@ For tier 3+, readers run simultaneously; wall clock = slowest reader, not the su
666
673
  The engine is already indexed. Query it live throughout this protocol (reuse `$ARCH` from Step 1.4.2):
667
674
  - `$ARCH | jq '.packages'` — module list with `.fan_in`/`.fan_out` (for grouping)
668
675
  - `$ARCH | jq '.languages, .node_labels'` — file/symbol counts, tier metrics
669
- - `scripts/tools/hotspot-rank.sh --repo .` — top hotspot symbols per module (feed to readers)
676
+ - `"$DRAFT_TOOLS/hotspot-rank.sh" --repo .` — top hotspot symbols per module (feed to readers)
670
677
 
671
678
  #### Phase 1: Spawn Parallel Module Readers
672
679
 
@@ -793,7 +800,7 @@ If any reader agent fails to produce valid JSON after one retry:
793
800
  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.
794
801
 
795
802
  1. Use the ranked module list from Step 1.4.6 (graph-first — do not re-scan by directory if Phase 0 succeeded).
796
- 2. For each top module (up to 20 by fan-in), query the engine for its symbols/callers (`scripts/tools/graph-callers.sh`, `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.
803
+ 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.
797
804
  3. Always include §9 Graph Coverage Gaps and §10 Relationship when the Context Audit requires them.
798
805
  4. Run Completion Verification (defined later in this skill) before condensation. Fidelity, provenance, and gap honesty block completion — not line counts.
799
806