@drafthq/draft 3.2.1 → 3.3.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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.cursor-plugin/plugin.json +28 -0
- package/README.md +20 -2
- package/cli/src/hosts/cursor.js +35 -5
- package/cli/src/installer.js +12 -0
- package/cli/src/lib/cursor-registry.js +122 -0
- package/cli/src/lib/plugin-manifest.js +20 -0
- package/core/methodology.md +1 -1
- 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/integrations/agents/AGENTS.md +452 -2
- package/integrations/copilot/.github/copilot-instructions.md +452 -2
- package/package.json +3 -2
- package/scripts/lib.sh +9 -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/skills/init/SKILL.md +24 -1
- package/skills/init/references/okf-emitter.md +223 -0
- 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:
|
|
@@ -438,7 +455,11 @@ If the user runs `draft init refresh`:
|
|
|
438
455
|
|
|
439
456
|
1. **Tech Stack Refresh**: Re-scan `package.json`, `go.mod`, etc. Compare with `draft/tech-stack.md`. Propose updates.
|
|
440
457
|
|
|
441
|
-
2. **Architecture Refresh**:
|
|
458
|
+
2. **Architecture Refresh**:
|
|
459
|
+
|
|
460
|
+
**Mode detection (do this first).** If `draft/wiki/` exists, the bundle was generated in **`okf` mode** and `architecture.md` is a *generated rendered view*, not the source of truth. In that case **follow `references/okf-emitter.md` §"Incremental refresh at concept granularity (M5)"** instead of the monolith steps below: diff `hashes.json` → map changed source paths to affected concepts → regenerate only those concepts (carry the rest forward from cache) → always re-render `.ai-context.md`, `architecture.md`, and `log.md` via `okf-render-views.sh` → re-run `okf-validate.sh` so cross-links still resolve. Do **not** hand-edit `architecture.md` in this mode — it is overwritten by the renderer. Then skip to step 3.
|
|
461
|
+
|
|
462
|
+
Otherwise (**`monolith` mode** — `draft/architecture.md` is the source of truth and no `draft/wiki/` exists), use metadata-based incremental analysis. If freshness state is available from step 0b, use file-level deltas to scope the refresh more precisely than git-diff alone:
|
|
442
463
|
|
|
443
464
|
**a. Read synced commit from metadata:**
|
|
444
465
|
```bash
|
|
@@ -682,6 +703,8 @@ Apply tier table:
|
|
|
682
703
|
|
|
683
704
|
Hold tier in memory. This governs: architecture.md length minimum, .ai-context.md budget, and module deep-dive depth.
|
|
684
705
|
|
|
706
|
+
**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.
|
|
707
|
+
|
|
685
708
|
**Step 1.4.6 — Build Module Priority List:**
|
|
686
709
|
From `"$DRAFT_TOOLS/hotspot-rank.sh" --repo .`: count hotspot symbols per module.
|
|
687
710
|
From `$ARCH | jq '.packages[]'`: read `fan_in` per module.
|
|
@@ -3241,6 +3264,230 @@ Run this checklist before writing architecture.md:
|
|
|
3241
3264
|
|
|
3242
3265
|
---
|
|
3243
3266
|
|
|
3267
|
+
## Init — OKF Taxonomy Emitter (DRAFT_INIT_MODE=okf)
|
|
3268
|
+
|
|
3269
|
+
> Progressive-disclosure reference for `draft init`. Covers the OKF emitter:
|
|
3270
|
+
> type vocabulary, frontmatter contract, generation pipeline, render views,
|
|
3271
|
+
> incremental refresh, and the `okf-validate.sh` gate. Authoritative HLD:
|
|
3272
|
+
> `hld-draft-init-okf-taxonomy.md` at the repo root.
|
|
3273
|
+
|
|
3274
|
+
This is the `draft init` output mode for **tier 3+ repos**, where it is the
|
|
3275
|
+
**tier-gated default** (`DRAFT_INIT_MODE` unset → tier 1–2 `monolith`, tier 3–5
|
|
3276
|
+
`okf`; an explicit `DRAFT_INIT_MODE=monolith|okf` overrides). `monolith` is
|
|
3277
|
+
retained — the tier-1/2 default, the A/B baseline, and the over-fetch fallback.
|
|
3278
|
+
The default rests on maintainability/readability, not the benchmark (parity).
|
|
3279
|
+
|
|
3280
|
+
```bash
|
|
3281
|
+
# Mode gate — default is tier-gated 'auto', finalized after Step 1.4.5 (tier):
|
|
3282
|
+
DRAFT_INIT_MODE="${DRAFT_INIT_MODE:-auto}"
|
|
3283
|
+
case "$DRAFT_INIT_MODE" in
|
|
3284
|
+
monolith|okf) : ;; # explicit override — honored as-is
|
|
3285
|
+
auto) : ;; # resolve from tier: 1–2 → monolith, 3–5 → okf
|
|
3286
|
+
*) echo "Unknown DRAFT_INIT_MODE='$DRAFT_INIT_MODE' (monolith|okf|auto); using auto" >&2
|
|
3287
|
+
DRAFT_INIT_MODE=auto ;;
|
|
3288
|
+
esac
|
|
3289
|
+
```
|
|
3290
|
+
|
|
3291
|
+
Everything else in `draft init` (5-phase analysis, graph snapshot, `.state/`
|
|
3292
|
+
hashing, scope detection, atomic staging) is **reused unchanged**. This mode adds
|
|
3293
|
+
a decomposition + serialization stage. It introduces **no new LLM analysis
|
|
3294
|
+
engine** and exactly **one** new deterministic helper, `okf-validate.sh`.
|
|
3295
|
+
|
|
3296
|
+
## Target layout
|
|
3297
|
+
|
|
3298
|
+
`okf` mode changes **only** the `architecture.md` / `.ai-context.md` packaging
|
|
3299
|
+
and adds `wiki/`. **Every other standard `draft init` file is still produced**
|
|
3300
|
+
— `product.md`, `tech-stack.md`, `workflow.md`, `guardrails.md`, `index.md`,
|
|
3301
|
+
`.ai-profile.md`, `tracks/` + `tracks.md`, `.state/`, `graph/` — exactly as in
|
|
3302
|
+
`monolith` mode. Do **not** skip them: emitting only the bundle is a regression.
|
|
3303
|
+
|
|
3304
|
+
```
|
|
3305
|
+
draft/
|
|
3306
|
+
├── .ai-context.md # INDEX ROOT: synopsis (150–250 lines) + Concept Map
|
|
3307
|
+
├── architecture.md # RENDERED VIEW (generated from bundle; not source of truth)
|
|
3308
|
+
├── .ai-profile.md # always-injected profile (derived from .ai-context.md) [SAME AS MONOLITH]
|
|
3309
|
+
├── product.md # [SAME AS MONOLITH]
|
|
3310
|
+
├── tech-stack.md # [SAME AS MONOLITH]
|
|
3311
|
+
├── workflow.md # [SAME AS MONOLITH]
|
|
3312
|
+
├── guardrails.md # [SAME AS MONOLITH]
|
|
3313
|
+
├── index.md # docs index — lists prose files + wiki/ [SAME AS MONOLITH, +wiki link]
|
|
3314
|
+
├── tracks.md + tracks/ # [SAME AS MONOLITH]
|
|
3315
|
+
├── wiki/ # OKF bundle (source of truth) — okf-mode ONLY
|
|
3316
|
+
│ ├── index.md # bundle root + Concept Map
|
|
3317
|
+
│ ├── overview/{index,architecture,getting-started,glossary}.md
|
|
3318
|
+
│ ├── systems/{index,<subsystem>}.md
|
|
3319
|
+
│ ├── features/{index,<feature>}.md
|
|
3320
|
+
│ ├── reference/{index,<ref>}.md # config, deps, data models, ADRs, runbooks
|
|
3321
|
+
│ ├── entrypoints/<app>.md
|
|
3322
|
+
│ ├── web/index.html # optional offline viewer (okf-render-views.sh --web)
|
|
3323
|
+
│ └── log.md # chronological change history (from .state run memory)
|
|
3324
|
+
├── graph/schema.yaml # [SAME AS MONOLITH] engine gate marker
|
|
3325
|
+
└── .state/
|
|
3326
|
+
├── hashes.json # file → content hash [SAME AS MONOLITH]
|
|
3327
|
+
├── path-to-concept.json # NEW: source path → concept page(s) it grounds
|
|
3328
|
+
└── signals.json # [SAME AS MONOLITH]
|
|
3329
|
+
```
|
|
3330
|
+
|
|
3331
|
+
The standard project files come from the same generators as `monolith` mode
|
|
3332
|
+
(intake questions → `product.md`; tech detection → `tech-stack.md`; `draft learn`
|
|
3333
|
+
→ `guardrails.md`; templates → `workflow.md`, `index.md`, `tracks.md`,
|
|
3334
|
+
`.ai-profile.md`). The OKF emitter only *replaces the architecture packaging*; it
|
|
3335
|
+
never owns or removes the rest of the context directory.
|
|
3336
|
+
|
|
3337
|
+
Templates for each bundle page live in `core/templates/okf/` (`index.md`,
|
|
3338
|
+
`concept.md`, `section-index.md`, `ai-context-index.md`).
|
|
3339
|
+
|
|
3340
|
+
## Frozen `type` vocabulary
|
|
3341
|
+
|
|
3342
|
+
Every concept carries a `type` from this frozen set (changing it churns every
|
|
3343
|
+
file; versioned via `index.md` frontmatter `okf_types_version`):
|
|
3344
|
+
|
|
3345
|
+
| type | Maps to | Home |
|
|
3346
|
+
|------|---------|------|
|
|
3347
|
+
| `Subsystem` | major graph cluster / package boundary | `systems/` |
|
|
3348
|
+
| `Module` | single package/dir, cohesive responsibility | `systems/` |
|
|
3349
|
+
| `Feature` | user-facing capability spanning modules | `features/` |
|
|
3350
|
+
| `Entrypoint` | binary / main / CLI / handler root | `entrypoints/` |
|
|
3351
|
+
| `API` | public interface, route group, RPC surface | `reference/` |
|
|
3352
|
+
| `DataModel` | schema, table, core struct/type | `reference/` |
|
|
3353
|
+
| `Dependency` | notable external dep + how it's used | `reference/` |
|
|
3354
|
+
| `ADR` | architecture decision record | `reference/` |
|
|
3355
|
+
| `Runbook` | operational procedure | `reference/` |
|
|
3356
|
+
|
|
3357
|
+
`okf-validate.sh` enforces this set as ground truth — an out-of-vocab `type`
|
|
3358
|
+
fails the build.
|
|
3359
|
+
|
|
3360
|
+
## Frontmatter contract
|
|
3361
|
+
|
|
3362
|
+
Per concept page (see `core/templates/okf/concept.md`). Required OKF keys:
|
|
3363
|
+
`type`, `title`, `description`, `resource`. **`description` is the load-bearing
|
|
3364
|
+
routing key** — write it as a routing decision ("should the agent open this for
|
|
3365
|
+
the task at hand?"), never a summary. Draft extensions are namespaced `x-` and
|
|
3366
|
+
ignored by generic OKF consumers: `x-grounded-paths`, `x-hotspot-score`,
|
|
3367
|
+
`x-callers`.
|
|
3368
|
+
|
|
3369
|
+
## Concept granularity (resolves open decision 1)
|
|
3370
|
+
|
|
3371
|
+
Derive concepts from the graph, not by hand:
|
|
3372
|
+
|
|
3373
|
+
- A **Subsystem** = a graph cluster (package/dir boundary) with `fan_in ≥ 2` from
|
|
3374
|
+
other clusters, OR a top-ranked module from `hotspot-rank.sh`.
|
|
3375
|
+
- A **Module** = a cohesive package/dir below a subsystem that is *not* itself a
|
|
3376
|
+
cluster boundary but has its own hotspot or public surface.
|
|
3377
|
+
- A **Feature** = a capability the graph shows spanning ≥2 modules (shared
|
|
3378
|
+
callers / a route group touching multiple packages).
|
|
3379
|
+
- Default cap: one page per package boundary; do not split a package into
|
|
3380
|
+
multiple concept pages unless it has >1 distinct public surface. This keeps
|
|
3381
|
+
page count ≈ module count and navigation depth shallow.
|
|
3382
|
+
|
|
3383
|
+
## Generation pipeline (M3)
|
|
3384
|
+
|
|
3385
|
+
```
|
|
3386
|
+
1. Survey → existing draft init 5-phase + graph snapshot (graph-snapshot.sh)
|
|
3387
|
+
2. Plan → derive the concept list (above) from graph clusters +
|
|
3388
|
+
entrypoints + features. Topo-sort by dependency so pages that
|
|
3389
|
+
others link to (overview, core subsystems) generate FIRST —
|
|
3390
|
+
forward cross-links resolve.
|
|
3391
|
+
3. Generate → per concept, pull grounding from the graph and write the page:
|
|
3392
|
+
x-callers ← graph-callers.sh --symbol <c>
|
|
3393
|
+
x-grounded-paths ← graph-impact.sh --symbol <c> (blast radius)
|
|
3394
|
+
x-hotspot-score ← hotspot-rank.sh
|
|
3395
|
+
overview diagrams ← mermaid-from-graph.sh
|
|
3396
|
+
Record each source path → page in .state/path-to-concept.json.
|
|
3397
|
+
4. Render views → ai-context.md (synopsis + Concept Map), architecture.md
|
|
3398
|
+
(concatenated view), wiki/log.md (see M4).
|
|
3399
|
+
5. Validate → okf-validate.sh draft/wiki \
|
|
3400
|
+
--path-index draft/.state/path-to-concept.json
|
|
3401
|
+
FAIL the build (do not atomic-rename) on any dangle, missing
|
|
3402
|
+
field, bad type, or path-index gap.
|
|
3403
|
+
6. Emit → mv draft.tmp/ draft/ ; update .state/.
|
|
3404
|
+
```
|
|
3405
|
+
|
|
3406
|
+
Page bodies are LLM-narrated for readability **but** the graph-derived
|
|
3407
|
+
frontmatter and the `Blast radius`/`Used by` sections are deterministic. To keep
|
|
3408
|
+
incremental carry-forward byte-identical (open decision 2), cache the narrated
|
|
3409
|
+
prose keyed by the source hash of `x-grounded-paths` — unchanged sources reuse
|
|
3410
|
+
the cached narration verbatim.
|
|
3411
|
+
|
|
3412
|
+
## Render views (M4)
|
|
3413
|
+
|
|
3414
|
+
Both are produced by the deterministic helper `okf-render-views.sh` (no LLM) —
|
|
3415
|
+
regenerated on every init/refresh so they never drift from the bundle:
|
|
3416
|
+
|
|
3417
|
+
```bash
|
|
3418
|
+
okf-render-views.sh draft/wiki \
|
|
3419
|
+
--arch-out draft/architecture.md \
|
|
3420
|
+
--concept-map-into draft/wiki/index.md \
|
|
3421
|
+
--concept-map-into draft/.ai-context.md \
|
|
3422
|
+
--web draft/wiki/web/index.html
|
|
3423
|
+
```
|
|
3424
|
+
|
|
3425
|
+
- `--arch-out` renders the linear `architecture.md` (banner + TOC + every concept
|
|
3426
|
+
page in canonical section order, frontmatter stripped, Mermaid preserved).
|
|
3427
|
+
- `--concept-map-into` rebuilds the routing table between the
|
|
3428
|
+
`<!-- CONCEPT-MAP:START -->` / `:END` markers from each concept's `title` +
|
|
3429
|
+
`type` + `description` (section `index.md` pages excluded).
|
|
3430
|
+
- `--web` writes a **self-contained offline HTML viewer** (single file: all pages
|
|
3431
|
+
inlined as JSON + a built-in markdown renderer + sidebar nav + search). Works by
|
|
3432
|
+
double-click — no server, no internet, no CDN. Optional, human-facing; regenerate
|
|
3433
|
+
on refresh like the other views. (Mermaid blocks render as labeled source since a
|
|
3434
|
+
graphical engine can't be inlined offline.)
|
|
3435
|
+
|
|
3436
|
+
All views write into `draft/` (the OKF emitter never creates a separate output
|
|
3437
|
+
dir): `draft/wiki/` is the bundle, `draft/architecture.md` + `draft/.ai-context.md`
|
|
3438
|
+
are the rendered views, `draft/wiki/web/index.html` is the optional viewer.
|
|
3439
|
+
|
|
3440
|
+
The two views:
|
|
3441
|
+
|
|
3442
|
+
- **`ai-context.md`** (index root) — from `core/templates/okf/ai-context-index.md`:
|
|
3443
|
+
the Synopsis preserves the prior `.ai-context.md` content shape (so existing
|
|
3444
|
+
downstream consumers keep working); the Concept Map is built from each
|
|
3445
|
+
concept's `description`. Broad tasks terminate here.
|
|
3446
|
+
- **`architecture.md`** (rendered view) — TOC + per-concept section concat +
|
|
3447
|
+
Mermaid, in topo order. Demoted, not deleted: the brownfield Context Quality
|
|
3448
|
+
Audit and any command grepping `architecture.md` keep working (§9 of the HLD).
|
|
3449
|
+
- **`wiki/log.md`** — appended from `.state/` run memory.
|
|
3450
|
+
|
|
3451
|
+
The `<!-- CONCEPT-MAP:START -->` / `:END` markers in `wiki/index.md` and the
|
|
3452
|
+
section `index.md` tables are the injection slots for the routing tables.
|
|
3453
|
+
|
|
3454
|
+
## Incremental refresh at concept granularity (M5)
|
|
3455
|
+
|
|
3456
|
+
`draft init refresh` under `okf` mode:
|
|
3457
|
+
|
|
3458
|
+
```
|
|
3459
|
+
1. Diff hashes.json vs working tree → changed source paths
|
|
3460
|
+
2. path-to-concept.json → affected concept pages
|
|
3461
|
+
3. Regenerate ONLY affected concepts; carry the rest verbatim (cached narration)
|
|
3462
|
+
4. Re-render ai-context.md / architecture.md / log.md (cheap; always regenerated)
|
|
3463
|
+
5. Re-validate: okf-validate.sh on the bundle + path-index (cross-links touching
|
|
3464
|
+
changed concepts must still resolve)
|
|
3465
|
+
6. Append log.md; update hashes.json + path-to-concept.json
|
|
3466
|
+
```
|
|
3467
|
+
|
|
3468
|
+
A 1-file change regenerates only the concept(s) that file grounds. Unchanged
|
|
3469
|
+
concepts are byte-identical across runs.
|
|
3470
|
+
|
|
3471
|
+
## Backward compatibility (§9)
|
|
3472
|
+
|
|
3473
|
+
- `architecture.md` is retained as a rendered view (brownfield audit + grep keep
|
|
3474
|
+
working).
|
|
3475
|
+
- `ai-context.md`'s Synopsis preserves the prior content shape; the Concept Map
|
|
3476
|
+
is additive.
|
|
3477
|
+
- `draft review` and downstream command contracts are unchanged — they consume
|
|
3478
|
+
`architecture.md` / `ai-context.md`, both of which still exist.
|
|
3479
|
+
|
|
3480
|
+
## Default policy & retirement of `monolith`
|
|
3481
|
+
|
|
3482
|
+
`okf` is the **tier-gated default** (tier 3+); `monolith` is the tier-1/2 default
|
|
3483
|
+
and remains in place as the A/B baseline + over-fetch fallback. Full retirement of
|
|
3484
|
+
`monolith` is deferred until **both**: (1) the large-monolith A/B run shows `okf` ≥
|
|
3485
|
+
baseline on tokens at parity accuracy (the regime the §12 benchmark flagged), and
|
|
3486
|
+
(2) a human-onboarding eval confirms the wiki + generated `architecture.md` covers
|
|
3487
|
+
linear onboarding. Note: retiring `monolith` would not remove `architecture.md` —
|
|
3488
|
+
it is generated from the bundle regardless — so there is no readability gain from
|
|
3489
|
+
deletion, only lost optionality.
|
|
3490
|
+
|
|
3244
3491
|
---
|
|
3245
3492
|
|
|
3246
3493
|
## Graph Command
|
|
@@ -14845,7 +15092,7 @@ draft status
|
|
|
14845
15092
|
|
|
14846
15093
|
### Supported Platforms
|
|
14847
15094
|
|
|
14848
|
-
Draft works with **Claude Code** (native `.claude-plugin/` support) and **Cursor** (
|
|
15095
|
+
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.
|
|
14849
15096
|
|
|
14850
15097
|
---
|
|
14851
15098
|
|
|
@@ -22220,6 +22467,209 @@ List down alerting thresholds on those metrics:
|
|
|
22220
22467
|
|
|
22221
22468
|
---
|
|
22222
22469
|
|
|
22470
|
+
## core/templates/okf/index.md
|
|
22471
|
+
|
|
22472
|
+
<core-file path="core/templates/okf/index.md">
|
|
22473
|
+
|
|
22474
|
+
---
|
|
22475
|
+
type: Subsystem
|
|
22476
|
+
title: "{PROJECT_NAME} — Knowledge Bundle"
|
|
22477
|
+
description: >
|
|
22478
|
+
Root index of the OKF taxonomy bundle. Start here, then route into
|
|
22479
|
+
overview/, systems/, features/, reference/, or entrypoints/ via the
|
|
22480
|
+
Concept Map. Open a concept only when its description matches the task.
|
|
22481
|
+
resource: .
|
|
22482
|
+
tags: [index]
|
|
22483
|
+
timestamp: "{ISO_TIMESTAMP}"
|
|
22484
|
+
okf_version: "0.1"
|
|
22485
|
+
okf_types_version: "0.1"
|
|
22486
|
+
---
|
|
22487
|
+
|
|
22488
|
+
# {PROJECT_NAME} — Knowledge Bundle
|
|
22489
|
+
|
|
22490
|
+
> OKF v0.1 bundle. One concept per file; cross-links form the graph. The
|
|
22491
|
+
> live call graph (`codebase-memory-mcp`) is the grounding source; this bundle
|
|
22492
|
+
> is the navigable serialization. `../ai-context.md` is the consumption entry point.
|
|
22493
|
+
|
|
22494
|
+
## Sections
|
|
22495
|
+
|
|
22496
|
+
| Section | Holds | Index |
|
|
22497
|
+
|---------|-------|-------|
|
|
22498
|
+
| `overview/` | System map, getting-started, glossary | [overview/index.md](overview/index.md) |
|
|
22499
|
+
| `systems/` | Subsystems & modules (graph clusters) | [systems/index.md](systems/index.md) |
|
|
22500
|
+
| `features/` | User-facing capabilities spanning modules | [features/index.md](features/index.md) |
|
|
22501
|
+
| `reference/` | APIs, data models, dependencies, ADRs, runbooks | [reference/index.md](reference/index.md) |
|
|
22502
|
+
| `entrypoints/` | Binaries / mains / CLIs / handler roots | see pages below |
|
|
22503
|
+
|
|
22504
|
+
## Concept Map
|
|
22505
|
+
|
|
22506
|
+
<!-- Built from each concept's frontmatter `description` (the routing key).
|
|
22507
|
+
One line per concept. Regenerated on every init/refresh. -->
|
|
22508
|
+
<!-- CONCEPT-MAP:START -->
|
|
22509
|
+
<!-- CONCEPT-MAP:END -->
|
|
22510
|
+
|
|
22511
|
+
## Change log
|
|
22512
|
+
|
|
22513
|
+
See [log.md](log.md) for chronological regeneration history.
|
|
22514
|
+
|
|
22515
|
+
</core-file>
|
|
22516
|
+
|
|
22517
|
+
---
|
|
22518
|
+
|
|
22519
|
+
## core/templates/okf/concept.md
|
|
22520
|
+
|
|
22521
|
+
<core-file path="core/templates/okf/concept.md">
|
|
22522
|
+
|
|
22523
|
+
---
|
|
22524
|
+
type: Subsystem # required (OKF) — one of the frozen vocab below
|
|
22525
|
+
title: "{CONCEPT_TITLE}" # OKF
|
|
22526
|
+
description: > # OKF — LOAD-BEARING: the agent's routing key.
|
|
22527
|
+
Write this as a ROUTING DECISION, not a summary. It must answer
|
|
22528
|
+
"should the agent open this file for the task at hand?" from the index
|
|
22529
|
+
alone. Name the responsibilities and the words a task would use.
|
|
22530
|
+
resource: "{CANONICAL_SOURCE_PATH}" # OKF — canonical source path(s)
|
|
22531
|
+
tags: [tag1, tag2] # OKF
|
|
22532
|
+
timestamp: "{ISO_TIMESTAMP}" # OKF — last regeneration
|
|
22533
|
+
# Draft extensions (ignored by generic OKF consumers; namespaced x-):
|
|
22534
|
+
x-grounded-paths: ["{path/a}", "{path/b}"] # exact source files this page grounds
|
|
22535
|
+
x-hotspot-score: 0.0 # from hotspot-rank.sh (0..1)
|
|
22536
|
+
x-callers: ["{module/a}", "{module/b}"] # from graph-callers.sh
|
|
22537
|
+
---
|
|
22538
|
+
|
|
22539
|
+
# {CONCEPT_TITLE}
|
|
22540
|
+
|
|
22541
|
+
<!--
|
|
22542
|
+
Frozen `type` vocabulary (changing it churns every file — versioned via
|
|
22543
|
+
index.md: okf_types_version):
|
|
22544
|
+
Subsystem — major graph cluster / package boundary → systems/
|
|
22545
|
+
Module — single package/dir with cohesive responsibility → systems/
|
|
22546
|
+
Feature — user-facing capability spanning modules → features/
|
|
22547
|
+
Entrypoint — binary / main / CLI / handler root → entrypoints/
|
|
22548
|
+
API — public interface, route group, RPC surface → reference/
|
|
22549
|
+
DataModel — schema, table, core struct/type → reference/
|
|
22550
|
+
Dependency — notable external dep + how it's used → reference/
|
|
22551
|
+
ADR — architecture decision record → reference/
|
|
22552
|
+
Runbook — operational procedure → reference/
|
|
22553
|
+
-->
|
|
22554
|
+
|
|
22555
|
+
## What it is
|
|
22556
|
+
|
|
22557
|
+
One paragraph: the concept's responsibility and boundary. Graph-grounded.
|
|
22558
|
+
|
|
22559
|
+
## How it works
|
|
22560
|
+
|
|
22561
|
+
Primary control/data flow. At least one Mermaid diagram for a significant
|
|
22562
|
+
concept (workflow, state, or sequence). Grounded in the call graph.
|
|
22563
|
+
|
|
22564
|
+
## Used by
|
|
22565
|
+
|
|
22566
|
+
Cross-links to callers (from `x-callers`). Each link is a relative path to
|
|
22567
|
+
another concept page so `okf-validate.sh` can resolve it.
|
|
22568
|
+
|
|
22569
|
+
## Blast radius
|
|
22570
|
+
|
|
22571
|
+
What breaks if this changes (from `graph-impact.sh`). Lists `x-grounded-paths`
|
|
22572
|
+
so a focused task knows exactly which source files to open.
|
|
22573
|
+
|
|
22574
|
+
## See also
|
|
22575
|
+
|
|
22576
|
+
- [Related concept](../systems/other.md)
|
|
22577
|
+
|
|
22578
|
+
</core-file>
|
|
22579
|
+
|
|
22580
|
+
---
|
|
22581
|
+
|
|
22582
|
+
## core/templates/okf/section-index.md
|
|
22583
|
+
|
|
22584
|
+
<core-file path="core/templates/okf/section-index.md">
|
|
22585
|
+
|
|
22586
|
+
---
|
|
22587
|
+
type: Subsystem
|
|
22588
|
+
title: "{SECTION_TITLE}"
|
|
22589
|
+
description: >
|
|
22590
|
+
Section index. Lists every concept in this section with its one-line
|
|
22591
|
+
routing description so an agent can pick the right page without opening
|
|
22592
|
+
each one. {SECTION_PURPOSE}
|
|
22593
|
+
resource: .
|
|
22594
|
+
tags: [index]
|
|
22595
|
+
timestamp: "{ISO_TIMESTAMP}"
|
|
22596
|
+
---
|
|
22597
|
+
|
|
22598
|
+
# {SECTION_TITLE}
|
|
22599
|
+
|
|
22600
|
+
> Section of the OKF bundle. Back to [bundle root](../index.md).
|
|
22601
|
+
|
|
22602
|
+
## Concepts
|
|
22603
|
+
|
|
22604
|
+
<!-- One row per concept page in this section. `description` is the routing key
|
|
22605
|
+
copied from each page's frontmatter. Regenerated on every init/refresh. -->
|
|
22606
|
+
|
|
22607
|
+
| Concept | Type | Routing description |
|
|
22608
|
+
|---------|------|---------------------|
|
|
22609
|
+
| [{concept-a}]({concept-a}.md) | Module | {one-line routing desc} |
|
|
22610
|
+
| [{concept-b}]({concept-b}.md) | Feature | {one-line routing desc} |
|
|
22611
|
+
|
|
22612
|
+
</core-file>
|
|
22613
|
+
|
|
22614
|
+
---
|
|
22615
|
+
|
|
22616
|
+
## core/templates/okf/ai-context-index.md
|
|
22617
|
+
|
|
22618
|
+
<core-file path="core/templates/okf/ai-context-index.md">
|
|
22619
|
+
|
|
22620
|
+
---
|
|
22621
|
+
project: "{PROJECT_NAME}"
|
|
22622
|
+
module: "{MODULE_NAME or 'root'}"
|
|
22623
|
+
generated_by: "draft:init"
|
|
22624
|
+
generated_at: "{ISO_TIMESTAMP}"
|
|
22625
|
+
draft_init_mode: okf
|
|
22626
|
+
---
|
|
22627
|
+
|
|
22628
|
+
# {PROJECT_NAME} — AI Context Index
|
|
22629
|
+
|
|
22630
|
+
> Index root for the OKF taxonomy bundle (`wiki/`). Read **Synopsis** for broad
|
|
22631
|
+
> tasks (they usually terminate here). For focused tasks, route through the
|
|
22632
|
+
> **Concept Map** to ≤N concept pages — each lists `x-grounded-paths`. This is
|
|
22633
|
+
> both the cheap broad-context path AND the progressive-disclosure entry point.
|
|
22634
|
+
|
|
22635
|
+
## Synopsis
|
|
22636
|
+
|
|
22637
|
+
<!-- 150–250 lines: the cheap broad-context path (prior .ai-context.md value
|
|
22638
|
+
preserved). Architecture in brief, key invariants, where to start, top
|
|
22639
|
+
hotspots. A broad task should be answerable from this section alone. -->
|
|
22640
|
+
|
|
22641
|
+
- **Architecture in brief:** {2–4 sentences}
|
|
22642
|
+
- **Key invariants:** {bullet list, provenance-tagged}
|
|
22643
|
+
- **Where to start:** {entrypoints + core subsystems}
|
|
22644
|
+
- **Top hotspots:** {from hotspot-rank.sh — symbol, fan-in}
|
|
22645
|
+
|
|
22646
|
+
## Concept Map
|
|
22647
|
+
|
|
22648
|
+
<!-- Routing table built from each concept's frontmatter `description`.
|
|
22649
|
+
Open a section index for the full per-concept list. -->
|
|
22650
|
+
|
|
22651
|
+
| Section | Routing |
|
|
22652
|
+
|---------|---------|
|
|
22653
|
+
| `wiki/systems/` | {one-line per subsystem — what it owns, when to open} |
|
|
22654
|
+
| `wiki/features/` | {one-line per feature} |
|
|
22655
|
+
| `wiki/reference/` | config, schemas, APIs, ADRs, runbooks |
|
|
22656
|
+
| `wiki/entrypoints/` | binaries / CLIs / handler roots |
|
|
22657
|
+
|
|
22658
|
+
Full taxonomy: [wiki/index.md](wiki/index.md).
|
|
22659
|
+
|
|
22660
|
+
## How to navigate
|
|
22661
|
+
|
|
22662
|
+
1. **Broad task** (summarize, "what owns X", topology) → answer from **Synopsis**.
|
|
22663
|
+
2. **Focused task** ("what breaks if I change Y", "add a field to Z") → open the
|
|
22664
|
+
matching concept via the **Concept Map**; follow its `x-grounded-paths` and
|
|
22665
|
+
`Used by` cross-links. Do not read the whole bundle.
|
|
22666
|
+
3. Every concept page is verified against the live call graph; trust its
|
|
22667
|
+
`Blast radius` section over re-deriving by hand.
|
|
22668
|
+
|
|
22669
|
+
</core-file>
|
|
22670
|
+
|
|
22671
|
+
---
|
|
22672
|
+
|
|
22223
22673
|
## core/agents/architect.md
|
|
22224
22674
|
|
|
22225
22675
|
<core-file path="core/agents/architect.md">
|