From sdd
Loads ADRs and specs from project directories into the session for architecture-aware responses. Resolves paths, aggregates multi-module workspaces with prefixes, checks CLAUDE.md, and updates qmd index.
npx claudepluginhub joestump/claude-plugin-sdd --plugin sddThis skill uses the workspace's default tool permissions.
Load existing ADRs and specs into the session so Claude can give architecture-aware responses.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Guides code writing, review, and refactoring with Karpathy-inspired rules to avoid overcomplication, ensure simplicity, surgical changes, and verifiable success criteria.
Provides UI/UX resources: 50+ styles, color palettes, font pairings, guidelines, charts for web/mobile across React, Next.js, Vue, Svelte, Tailwind, React Native, Flutter. Aids planning, building, reviewing interfaces.
Share bugs, ideas, or general feedback.
Load existing ADRs and specs into the session so Claude can give architecture-aware responses.
Resolve artifact paths: Follow the Artifact Path Resolution pattern from references/shared-patterns.md to determine the ADR and spec directories. If $ARGUMENTS contains --module <name>, resolve paths relative to that module; otherwise, in a workspace, aggregate across all modules. The resolved ADR directory is {adr-dir} and spec directory is {spec-dir}.
Cross-module aggregation: When in aggregate mode (no --module, workspace detected), iterate over all discovered modules. For each module, resolve its artifact paths independently. Prefix every artifact reference in the output with the module name in square brackets: [api] ADR-0001, [worker] SPEC-0003. When --module is provided, scope to that single module — no prefix needed. When in single-module mode (no workspace), operate normally without prefixes.
Check if init has been run: Read CLAUDE.md at the project root (or module root if --module is set) and check if it contains references to an ADR or spec directory. If CLAUDE.md does not exist or lacks SDD plugin references, output:
CLAUDE.md does not have SDD plugin references. Run `/sdd:init` first to set up your project, then re-run `/sdd:prime`.
Then stop. Do NOT proceed with scanning.
1a. Tier 2 session-start update (v5.0.0+):
Run qmd update (cheap file-mtime scan) on entry to catch changes from outside the current Claude session — other developers, CI bots, branch switches, manually edited files. Skip the update when the qmd index was touched within the last 60 seconds (back-to-back primes are common; the short-circuit prevents redundant work).
Read the qmd index's last-modified timestamp via qmd status (or the qmd MCP mcp__plugin_qmd_qmd__status tool — prefer MCP when loaded per references/qmd-helpers.md § "MCP-vs-CLI Selection"). Take the maximum lastUpdated across this-repo collections (identified via the exact-prefix match algorithm in qmd-helpers.md § "This-Repo Collection Identification").
If the most recent timestamp is within the last 60 seconds, skip the update entirely (no output).
Otherwise, invoke qmd update per references/qmd-helpers.md § "Update Patterns". The update is silent on success when the diff is empty. If the update added/modified/removed any documents, print exactly one line in the report header (between the ## Architecture Context Loaded heading and the section tables): Refreshed index ({a} added, {m} updated, {r} removed across this repo's collections).
After the update, count unembedded chunks for this repo's collections via qmd status (sum (documents - embedded) across this-repo collections, again via the exact-prefix match algorithm). If non-zero, surface a one-line note in the report header (after the refresh line, if any): {N} chunks unembedded — run \/sdd:index embed` (≈{seconds}s on this machine, foreground; or wait for the next mutation skill to backfill)`. Do NOT prompt via AskUserQuestion — the surface is informational, not a decision the user needs to make right now.
Scan for ADRs: Glob for {adr-dir}/ADR-*.md files (in aggregate mode, glob per-module). For each file:
status and date per the Status Field Extraction algorithm belowsuperseded-by from YAML frontmatter if present (used by Step 4 footer rendering)# heading## Context and Problem Statement section## Decision Outcome section to extract the key decisionScan for specs: Glob for {spec-dir}/*/spec.md files (in aggregate mode, glob per-module). Validate spec pairing per references/shared-patterns.md § "Spec Pairing Validation". For each file:
status per the Status Field Extraction algorithm belowsuperseded-by from YAML frontmatter if present (used by Step 4 footer rendering)# heading (e.g., SPEC-0001: Web Dashboard)## Overview section### Requirement: headings#### Scenario: headings3a. Status Field Extraction algorithm (used by both ADR and spec scans). Two formats are supported because legacy SDD-using repos predate YAML frontmatter:
status: key inside the --- … --- frontmatter block at the top of the file.status: field, scan the first 30 lines for a line matching - **Status:** {value} (case-insensitive on "Status"; tolerate * or + as the bullet marker; tolerate Status: without the bold).- **Status:** accepted (refined by ADR-0010, 2026-05-03). Split on the first (, trim trailing whitespace, and use only the leading word ("accepted"). The parenthetical content is preserved in the source file but is not rendered in prime tables — it would blow out column width for a corner case better surfaced by /sdd:graph or by reading the artifact directly.— in the table when other artifacts in the same corpus have status; drop the Status column entirely when zero artifacts in the corpus have status (see Step 7 rendering rule).Filter non-authoritative artifacts: Partition all scanned ADRs and specs into two groups:
accepted, proposed, draft, review, approved, implemented, or missing/empty — these appear in the main output tablessuperseded, deprecated, or rejected — these are excluded from the main tables and collected for the footer sectionsuperseded-by target (if present)⚠ badge in the output (not excluded), per the topic-filter rules below.Apply topic filter (if $ARGUMENTS is not empty):
The topic argument is a free-text string. Starting v5.0.0, the topic-filter mode uses qmd hybrid retrieval to identify the top-K most relevant ADRs and specs to the topic, then reads ONLY those candidates in full — replacing the pre-v5 "load every artifact, then filter semantically" path. Untargeted /sdd:prime (no topic) MUST still load all artifacts (the user explicitly asked for a corpus overview); only the topic-filtered mode uses qmd retrieval.
references/qmd-helpers.md § "Hybrid Retrieval". The query document SHOULD include both lex (the topic verbatim, for keyword/exact matches like "JWT" or "OAuth") and vec (a natural-language framing of the topic, e.g., for topic "security" → "decisions about authentication, authorization, encryption, and access control") sub-queries. Set intent: "/sdd:prime topic-filter — find ADRs and specs relevant to {topic}" so the reranker has context.collections: ["{repo}-adrs", "{repo}-specs"] (or {repo}-{module}-adrs / {repo}-{module}-specs per module in workspace mode — see qmd-helpers.md § "This-Repo Collection Identification"). Set limit: 8 and minScore: 0.3 as the V1 defaults.status and superseded-by per Step 3a so the topic-filter output can flag non-authoritative matches with a ⚠ badge (per ADR-0027).minScore, output the canonical "no matches" message (preserved from the pre-v5 behavior):
No ADRs or specs matched the topic "{topic}". Try a broader term, or run `/sdd:prime` without a topic to see all artifacts.
qmd-helpers.md § "Error Handling"), surface the error and stop — do NOT fall back to the pre-v5 "scan everything and semantically filter" path. Per ADR-0024, fallback paths were eliminated in v5; the failure mode is "fix qmd, retry."The "Skipped" section in the topic-filter output (per the existing template) lists artifacts retrieved by qmd that fell below the relevance threshold OR the artifacts present in the corpus but NOT returned by qmd at all. The point is the same as before: the user sees what was excluded so they can broaden the topic if needed.
Handle edge cases:
{adr-dir} does not exist: "The {adr-dir} directory does not exist. Run /sdd:adr [description] to create your first ADR."{spec-dir} does not exist: "The {spec-dir} directory does not exist. Run /sdd:spec [capability] to create your first spec."/sdd:adr or a spec with /sdd:spec first."Present results using the appropriate output format below.
/sdd:prime):## Architecture Context Loaded
Primed session with {N} ADRs and {M} specs.
### Architecture Decision Records
| ID | Title | Status | Key Decision |
|----|-------|--------|--------------|
| ADR-0001 | {title} | {status} | {one-sentence summary of decision outcome} |
### Specifications
| ID | Title | Status | Requirements |
|----|-------|--------|--------------|
| SPEC-0001 | {title} | {status} | {N} requirements, {M} scenarios |
### Non-Authoritative (excluded)
- ADR-XXXX: {title} → superseded by ADR-YYYY
- ADR-XXXX: {title} (deprecated)
- SPEC-XXXX: {title} (rejected)
### Quick Reference
- Check for drift: `/sdd:check [target]`
- Full audit: `/sdd:audit [scope]`
- List all artifacts: `/sdd:list`
Note: The "Non-Authoritative (excluded)" section MUST only appear when there are excluded artifacts. If all artifacts are authoritative, omit the section entirely.
/sdd:prime in a multi-module project):## Architecture Context Loaded
Primed session with {N} ADRs and {M} specs across {K} modules.
### Architecture Decision Records
| Module | ID | Title | Status | Key Decision |
|--------|----|-------|--------|--------------|
| [api] | ADR-0001 | {title} | {status} | {one-sentence summary} |
| [worker] | ADR-0001 | {title} | {status} | {one-sentence summary} |
### Specifications
| Module | ID | Title | Status | Requirements |
|--------|----|-------|--------|--------------|
| [api] | SPEC-0001 | {title} | {status} | {N} requirements, {M} scenarios |
| [worker] | SPEC-0001 | {title} | {status} | {N} requirements, {M} scenarios |
### Non-Authoritative (excluded)
- [api] ADR-XXXX: {title} → superseded by ADR-YYYY
- [worker] SPEC-XXXX: {title} (deprecated)
### Quick Reference
- Check for drift: `/sdd:check [target]`
- Check single module: `/sdd:check --module api [target]`
- Full audit: `/sdd:audit [scope]`
- List all artifacts: `/sdd:list`
/sdd:prime {topic}):## Architecture Context Loaded (filtered: "{topic}")
Primed session with {N} ADRs and {M} specs matching "{topic}".
### Matching ADRs
| ID | Title | Status | Relevance |
|----|-------|--------|-----------|
| ADR-XXXX | {title} | {status} | {why this matched the topic} |
| ADR-XXXX | {title} | ⚠ superseded | {why this matched the topic} |
### Matching Specs
| ID | Title | Status | Relevance |
|----|-------|--------|-----------|
| SPEC-XXXX | {title} | {status} | {why this matched the topic} |
### Summaries
**ADR-XXXX: {title}**
{2-3 sentence summary of context, decision, and rationale.}
**ADR-XXXX: {title}** ⚠ superseded by ADR-YYYY
{2-3 sentence summary. Final sentence notes: "This decision was superseded by ADR-YYYY — see the replacement for current guidance."}
**SPEC-XXXX: {title}**
{2-3 sentence summary of what the spec covers and key requirements.}
### Skipped (not relevant to "{topic}")
- ADR-XXXX: {title}
- SPEC-XXXX: {title}
- **Status:** {value} is misleading and was reported as a real-world bug— so the asymmetry is visible. Workspace aggregate mode: the rendered corpus is the union across all modules — drop the column only when ZERO artifacts across ALL modules have status. If even one module has status, keep the column and render — for the modules that do not (the asymmetry is the signal). Single-module mode applies the rule to that module's corpus directlyaccepted (refined by ADR-0010, 2026-05-03) → accepted) — the full text remains in the source file; prime tables show the lifecycle word only[api] ADR-0001)--module is provided, do NOT prefix artifacts — behave as single-modulesuperseded, deprecated, and rejected are non-authoritative; everything else (including missing/empty status) is authoritative (Governing: ADR-0027)ADR-XXXX: {title} → superseded by ADR-YYYY. If superseded-by metadata is missing, render as ADR-XXXX: {title} (superseded — no replacement recorded) so the dead-end is visible⚠ {status} badge in the table and a "superseded by" note in the summary — do NOT silently exclude them, since topic filtering is for historical/investigative use[api] ADR-XXXX: ...) consistent with main-table prefixingqmd update on entry unless the index was touched within 60s. Surface refresh diff as one-line note when non-zero; otherwise silent. Surface unembedded chunk count as one-line informational note (no AskUserQuestion) (Governing: ADR-0026, SPEC-0019 REQ "Tier 2 Session-Start Update via /sdd:prime")references/qmd-helpers.md to identify the top-K relevant artifacts; deep-read ONLY the candidates qmd returns. The pre-v5 read-everything-then-filter path is removed for topic-filter mode (Governing: ADR-0024, SPEC-0019 REQ "qmd-Smart Context Loading")/sdd:prime (no topic) MUST retain the full-corpus overview behavior — qmd retrieval is for the topic-filter path only