superspecs 0.1.0 → 0.2.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.
@@ -0,0 +1,157 @@
1
+ ---
2
+ name: wiki-query
3
+ description: Query the compiled project wiki to answer a question. Uses tiered retrieval — summaries first, full pages only when needed. Synthesizes answers from existing wiki pages only, never from raw specs or the internet. Optionally files the answer back as a new wiki page. Triggers on /wiki-query, "search the wiki for...", "what does the wiki say about...", "ask the wiki".
4
+ slash_command: wiki-query
5
+ phase: "3.2 — Verify › Wiki Query"
6
+ ---
7
+
8
+ # Skill: wiki-query
9
+
10
+ You are answering a question using the compiled project wiki.
11
+
12
+ The wiki at `superspec/wiki/` is a compiled knowledge base. It has already processed the raw specs, decisions, and review logs. **Read the wiki, not the raw sources.** This is the key efficiency of the LLM Wiki pattern: compile once, query fast.
13
+
14
+ ---
15
+
16
+ ## The 3-Layer Context
17
+
18
+ ```
19
+ superspec/wiki/raw/ ← source material (ingest reads this; query does NOT)
20
+ superspec/wiki/ ← compiled wiki (query reads this exclusively)
21
+ .skills/wiki-query/ ← schema: these instructions
22
+ ```
23
+
24
+ **Never read `raw/` to answer a query.** If the answer isn't in `wiki/`, the knowledge hasn't been compiled yet — that's a signal to run `/wiki` first.
25
+
26
+ ---
27
+
28
+ ## Tiered Retrieval
29
+
30
+ Query in two phases to keep cost flat as the vault grows:
31
+
32
+ ### Phase 1 — Index scan (cheap)
33
+
34
+ Read only the frontmatter of every wiki page (excluding `raw/`, `.obsidian/`):
35
+ - `title`
36
+ - `summary` (1–2 sentence preview)
37
+ - `tags`
38
+
39
+ Also read:
40
+ - `superspec/wiki/Home.md` — domain table and recent updates
41
+ - `superspec/wiki/log.md` — recent activity
42
+
43
+ Score each page for relevance to the query. Select the top 3–5 candidates.
44
+
45
+ **If the user says "quick answer" or "just scan":** answer from Phase 1 only — do not open page bodies.
46
+
47
+ ### Phase 2 — Deep read (targeted)
48
+
49
+ Open the full body of the top 3–5 candidate pages only. Read:
50
+ - All sections
51
+ - Follow `[[wikilinks]]` to directly related pages (one level deep)
52
+
53
+ Synthesize the answer from Phase 2 content.
54
+
55
+ ---
56
+
57
+ ## Steps
58
+
59
+ ### 1. Receive the question
60
+
61
+ The user provides a question, topic, or keyword. Examples:
62
+ - "What do we know about authentication?"
63
+ - "What was the decision on database choice?"
64
+ - "What patterns do we use for error handling?"
65
+ - "Find everything about the payment integration"
66
+
67
+ ---
68
+
69
+ ### 2. Phase 1 — Index scan
70
+
71
+ For each wiki page, read frontmatter only. Score relevance:
72
+ - Title contains query keyword → high relevance
73
+ - `tags:` overlap with query topic → medium relevance
74
+ - `summary:` contains query concept → medium relevance
75
+
76
+ Select top 3–5 by relevance score. If Phase 1 returns zero candidates → signal gap (Step 5).
77
+
78
+ ---
79
+
80
+ ### 3. Phase 2 — Deep read
81
+
82
+ Open full body of top candidates. Follow `[[wikilinks]]` one level deep for directly linked pages.
83
+
84
+ Collect all relevant content. Note provenance markers:
85
+ - No marker = extracted from source
86
+ - `^[inferred]` = agent synthesis
87
+ - `^[ambiguous]` = sources disagree — flag this in the answer
88
+
89
+ ---
90
+
91
+ ### 4. Synthesize the answer
92
+
93
+ Write a synthesized answer **in your response**:
94
+
95
+ ```
96
+ ## Answer: <query topic>
97
+
98
+ <2–4 paragraph synthesis drawn from the wiki>
99
+
100
+ ### Sources
101
+ - [[<domain>/<page>]] — <one-line summary of what it contributed>
102
+ - [[<domain>/<page2>]] — <one-line summary>
103
+
104
+ ### Inferred content
105
+ <If any part of the answer is marked ^[inferred] or ^[ambiguous], call it out:>
106
+ "Note: the claim about X is inferred synthesis, not stated verbatim in sources."
107
+
108
+ ### Gaps
109
+ <If the wiki doesn't have full coverage:>
110
+ "The wiki has no pages about <X>. If this was covered in a spec, run /wiki to compile it first."
111
+ ```
112
+
113
+ **Cite only wiki pages** — not raw spec files, not source code files.
114
+
115
+ ---
116
+
117
+ ### 5. Signal gaps clearly
118
+
119
+ If Phase 1 returns no relevant pages:
120
+
121
+ ```
122
+ The wiki doesn't have pages about "<X>" yet.
123
+
124
+ This means either:
125
+ a) The feature hasn't been shipped yet (no spec/execution cycle completed)
126
+ b) The feature was shipped but not imported — run: /wiki <slug>
127
+ c) The knowledge lives only in raw/ — it hasn't been compiled yet
128
+
129
+ I found partial coverage in: [[<related-page>]] (if any)
130
+ ```
131
+
132
+ ---
133
+
134
+ ### 6. Optionally file the answer back
135
+
136
+ After answering, offer:
137
+
138
+ ```
139
+ File this answer to the wiki?
140
+ [Y] Yes — create wiki/<domain>/<topic>.md
141
+ [U] Update an existing page instead
142
+ [N] No — one-off answer only
143
+ ```
144
+
145
+ If the user confirms, write the page using the standard wiki page format including `summary:` and `provenance:` fields. Mark synthesized content as `^[inferred]`. Then:
146
+ - Update the relevant domain `Home.md`
147
+ - Append to `log.md`: `## [YYYY-MM-DD] query | <topic>`
148
+ - Run `/cross-linker` to weave new page into the knowledge graph
149
+
150
+ ---
151
+
152
+ ## Output
153
+
154
+ - Synthesized answer in the response
155
+ - Optionally: new wiki page in `superspec/wiki/<domain>/<topic>.md`
156
+ - Optionally: updated domain `Home.md`
157
+ - Optionally: appended `superspec/wiki/log.md`
@@ -0,0 +1,163 @@
1
+ ---
2
+ name: wiki-rebuild
3
+ description: Archive the current wiki vault and rebuild it from scratch from raw source material and specs. Use when the wiki has drifted too far from its sources or accumulated too much drift. Also restores from a previous archive. Triggers on /wiki-rebuild, "rebuild the wiki", "archive and rebuild", "reset the wiki".
4
+ slash_command: wiki-rebuild
5
+ phase: "3.2 — Verify › Wiki Rebuild"
6
+ ---
7
+
8
+ # Skill: wiki-rebuild
9
+
10
+ You are managing the vault lifecycle — archiving and rebuilding when the wiki needs a clean slate.
11
+
12
+ **When to rebuild:**
13
+ - The wiki has accumulated too much drift (contradictions, stale content, structural mess)
14
+ - A major architectural change makes existing pages misleading
15
+ - The tag taxonomy was restructured and pages need a full re-pass
16
+
17
+ **This is a destructive operation on the compiled wiki.** Raw source material in `raw/` and specs in `superspec/specs/` are never touched. The rebuild reconstructs from those sources.
18
+
19
+ ---
20
+
21
+ ## Modes
22
+
23
+ ### `archive` — Snapshot and preserve
24
+ Create a timestamped archive of the current vault. No rebuild.
25
+
26
+ ### `rebuild` — Archive then reconstruct
27
+ Archive the current vault, then compile all sources from scratch.
28
+
29
+ ### `restore <timestamp>` — Roll back
30
+ Restore a previous archive by timestamp.
31
+
32
+ ### `list` — Show available archives
33
+ List all archived snapshots.
34
+
35
+ ---
36
+
37
+ ## Steps
38
+
39
+ ### Archive
40
+
41
+ 1. Create `superspec/wiki/_archives/<YYYY-MM-DD-HH-MM>/`
42
+ 2. Copy the entire `superspec/wiki/` directory into it (excluding `raw/`, `_archives/`, `.obsidian/`)
43
+ 3. Write a manifest for the archive:
44
+
45
+ ```json
46
+ // _archives/<timestamp>/archive-manifest.json
47
+ {
48
+ "archived_at": "<ISO timestamp>",
49
+ "pages": N,
50
+ "domains": ["auth", "api", ...],
51
+ "reason": "<user-provided or 'manual'>",
52
+ "last_ingested_slug": "<slug>"
53
+ }
54
+ ```
55
+
56
+ 4. Print:
57
+ ```
58
+ Archive created: superspec/wiki/_archives/<timestamp>/
59
+ Pages preserved: N
60
+ ```
61
+
62
+ ---
63
+
64
+ ### Rebuild
65
+
66
+ After archiving:
67
+
68
+ 1. **Clear the compiled wiki** — delete all `.md` files and `_manifest.json` from `superspec/wiki/` except:
69
+ - `raw/` (source material — never touched)
70
+ - `.obsidian/` (vault config — never touched)
71
+ - `_archives/` (previous snapshots)
72
+ - `log.md` (append-only — preserve, add rebuild event)
73
+
74
+ 2. **Re-initialize vault structure:**
75
+ - New `Home.md` from template
76
+ - New `_manifest.json`: `{"sources": []}`
77
+ - Preserve `_meta/taxonomy.md` if it exists (tag vocabulary is still valid)
78
+
79
+ 3. **Recompile all sources in order:**
80
+
81
+ For each slug in `superspec/specs/` (ordered by `status.md` phase — shipped first):
82
+ - If spec has `## Phase ... ✅` in status.md → it was shipped → compile to wiki
83
+ - Follow the full `verify-wiki` ingest process for each slug
84
+
85
+ For each file in `superspec/wiki/raw/`:
86
+ - Compile to wiki pages
87
+
88
+ 4. **Post-rebuild:**
89
+ - Run cross-linker to weave all `[[wikilinks]]`
90
+ - Run tag-taxonomy audit
91
+ - Append to `log.md`:
92
+
93
+ ```markdown
94
+ ## [<YYYY-MM-DD>] rebuild | Vault rebuilt from scratch
95
+
96
+ - Archive: _archives/<timestamp>/
97
+ - Sources recompiled: N specs + M raw files
98
+ - Pages created: K
99
+ - Reason: <user-provided>
100
+ ```
101
+
102
+ 5. Print:
103
+ ```
104
+ Rebuild complete
105
+
106
+ Archive: superspec/wiki/_archives/<timestamp>/
107
+ Pages rebuilt: K
108
+ Specs compiled: N
109
+ Raw files compiled: M
110
+
111
+ Run /wiki-status to see the new vault state.
112
+ Run /wiki-lint to verify health.
113
+ ```
114
+
115
+ ---
116
+
117
+ ### Restore
118
+
119
+ 1. Confirm with user: `Restore from <timestamp>? This will overwrite the current wiki. [Y/N]`
120
+ 2. Archive the current state first (auto-archive before restore)
121
+ 3. Copy `_archives/<timestamp>/` → `superspec/wiki/` (excluding `raw/`, `.obsidian/`, `_archives/`)
122
+ 4. Append to `log.md`:
123
+
124
+ ```markdown
125
+ ## [<YYYY-MM-DD>] restore | Restored from archive <timestamp>
126
+
127
+ - Previous state auto-archived as: _archives/<auto-timestamp>/
128
+ ```
129
+
130
+ ---
131
+
132
+ ### List
133
+
134
+ Print all available archives:
135
+
136
+ ```
137
+ Available archives:
138
+
139
+ 2026-06-15-14-30 (N pages, reason: "pre-refactor snapshot")
140
+ 2026-05-20-09-15 (N pages, reason: "manual")
141
+ 2026-04-10-16-00 (N pages, reason: "rebuild")
142
+
143
+ To restore: /wiki-rebuild restore <timestamp>
144
+ ```
145
+
146
+ ---
147
+
148
+ ## Safety Rules
149
+
150
+ - **Never delete `raw/`** — source material is immutable
151
+ - **Never delete `.obsidian/`** — vault config must survive
152
+ - **Never delete `log.md`** — append-only, always preserved
153
+ - **Always archive before rebuild or restore** — no data loss
154
+ - **Always confirm before destructive operations** — print what will happen and wait for [Y/N]
155
+
156
+ ---
157
+
158
+ ## Output
159
+
160
+ - `superspec/wiki/_archives/<timestamp>/` (archive)
161
+ - Rebuilt wiki pages (rebuild mode)
162
+ - Appended `superspec/wiki/log.md`
163
+ - Summary report in response
@@ -0,0 +1,156 @@
1
+ ---
2
+ name: wiki-status
3
+ description: Show a health and activity dashboard for the compiled wiki vault. Ingested pages, pending sources, hub pages with most backlinks, tag distribution, recent activity. Triggers on /wiki-status, "wiki dashboard", "wiki stats", "what's in the wiki".
4
+ slash_command: wiki-status
5
+ phase: "3.2 — Verify › Wiki Status"
6
+ ---
7
+
8
+ # Skill: wiki-status
9
+
10
+ You are producing a health and activity dashboard for `superspec/wiki/`.
11
+
12
+ This is a read-only operation. No files are written except an optional `_insights.md`.
13
+
14
+ ---
15
+
16
+ ## Steps
17
+
18
+ ### 1. Inventory the vault
19
+
20
+ Scan all `.md` files in `superspec/wiki/` (excluding `raw/`, `.obsidian/`).
21
+
22
+ Collect for each page:
23
+ - Path, title, domain
24
+ - `created:` and `updated:` dates from frontmatter
25
+ - `tags:` list
26
+ - `summary:` (for preview)
27
+ - All outbound `[[wikilinks]]`
28
+ - Count of inbound `[[wikilinks]]` from other pages (backlinks)
29
+ - Provenance block if present
30
+
31
+ Also read:
32
+ - `_manifest.json` — ingestion history
33
+ - `log.md` — recent events
34
+
35
+ ---
36
+
37
+ ### 2. Compute metrics
38
+
39
+ **Vault size**
40
+ - Total pages (excluding Home indexes, log, manifest, lint report)
41
+ - Pages by domain
42
+ - Pages created this month / this quarter
43
+
44
+ **Activity**
45
+ - Last ingest: date + slug
46
+ - Last query: date + topic
47
+ - Last lint: date + issue count
48
+ - Last cross-link run: date + links inserted
49
+
50
+ **Hub pages** (most inbound backlinks)
51
+ - Top 5 pages by backlink count
52
+ - These are the most-referenced knowledge nodes
53
+
54
+ **Orphaned pages** (no inbound backlinks, not an index)
55
+ - Quick count — detail in `/wiki-lint`
56
+
57
+ **Tag distribution**
58
+ - Top 10 tags by frequency
59
+ - Tags not in `_meta/taxonomy.md` (if taxonomy exists)
60
+
61
+ **Provenance distribution** (across all pages with `provenance:` block)
62
+ - Average extracted / inferred / ambiguous ratios
63
+ - Pages with high inferred ratio (>50%) — flag for review
64
+
65
+ **Pending sources**
66
+ - Files in `superspec/wiki/raw/` not yet in `_manifest.json`
67
+ - Specs in `superspec/specs/` whose slugs don't appear in `_manifest.json` ingestion history
68
+
69
+ ---
70
+
71
+ ### 3. Output dashboard
72
+
73
+ ```
74
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
75
+ Wiki Status — superspec/wiki/
76
+ Generated: <YYYY-MM-DD HH:MM>
77
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
78
+
79
+ VAULT SIZE
80
+ Total pages: N
81
+ Domains: N (auth, api, data, ...)
82
+ Created this month: N
83
+
84
+ RECENT ACTIVITY
85
+ Last ingest: <YYYY-MM-DD> — <slug>: <title>
86
+ Last query: <YYYY-MM-DD> — "<topic>"
87
+ Last lint: <YYYY-MM-DD> — N issues
88
+ Last cross-link: <YYYY-MM-DD> — K links inserted
89
+
90
+ HUB PAGES (most referenced)
91
+ N [[auth/jwt-refresh]]
92
+ N [[patterns/error-handling]]
93
+ N [[api/rest-conventions]]
94
+ N [[decisions/database-choice]]
95
+ N [[infra/redis-cache]]
96
+
97
+ TAG DISTRIBUTION (top 10)
98
+ auth (N) api (N) patterns (N) ...
99
+
100
+ PROVENANCE
101
+ Extracted: ~X% (directly from source material)
102
+ Inferred: ~X% (agent synthesis)
103
+ Ambiguous: ~X% (sources disagree)
104
+ ⚠ High-inferred pages: N (>50% inferred — verify accuracy)
105
+
106
+ PENDING
107
+ raw/ files not yet ingested: N
108
+ Specs not yet compiled: N slugs
109
+ - <slug-1>
110
+ - <slug-2>
111
+
112
+ HEALTH
113
+ Orphaned pages: N (run /wiki-lint for details)
114
+ Broken wikilinks: N (run /wiki-lint for details)
115
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
116
+
117
+ Suggested actions:
118
+ /wiki <slug> Compile pending spec
119
+ /wiki-lint Full health check
120
+ /cross-linker Auto-weave missing [[wikilinks]]
121
+ /wiki-query Ask the wiki anything
122
+ ```
123
+
124
+ ---
125
+
126
+ ### 4. Optionally write _insights.md
127
+
128
+ If the user asks for a persistent record, write `superspec/wiki/_insights.md`:
129
+
130
+ ```markdown
131
+ ---
132
+ title: Wiki Insights
133
+ generated: <YYYY-MM-DD HH:MM>
134
+ tags: [insights, status]
135
+ ---
136
+
137
+ # Wiki Insights
138
+
139
+ <Full dashboard content as markdown>
140
+
141
+ ## Hub Pages
142
+ <Ranked list with backlink counts>
143
+
144
+ ## Domain Coverage
145
+ <Table: domain | pages | last updated | pending>
146
+
147
+ ## Suggested Next Steps
148
+ <Concrete actions based on pending sources and health>
149
+ ```
150
+
151
+ ---
152
+
153
+ ## Output
154
+
155
+ - Dashboard printed in response (always)
156
+ - Optionally: `superspec/wiki/_insights.md`
package/AGENTS.md CHANGED
@@ -2,37 +2,66 @@
2
2
 
3
3
  SuperSpecs: spec-driven planning + parallel TDD execution + wiki memory.
4
4
 
5
+ ## Commands
6
+
7
+ **Claude Code / Cursor:** `/superspecs:<cmd>`
8
+ **OpenCode:** `/superspecs-<cmd>`
9
+
5
10
  ## Lifecycle (always in order)
6
11
 
7
12
  **Phase 0 — Setup**
8
- - `/techstack` — questionnaire: define stack, get skill & library recommendations, save to wiki
13
+ - `/superspecs:techstack` — questionnaire: define stack, get skill & library recommendations, save to wiki
9
14
 
10
15
  **Phase 1 — Plan**
11
- - `/discuss`capture decisions before planning
12
- - `/spec` — write spec (fits 200k context window)
16
+ - `/superspecs:design-import <path>` (optional) import DesignOS export → design-context.md; enriches /discuss + /spec with design constraints, data shapes, milestone structure, and test scaffolding
17
+ - `/superspecs:discuss` — capture decisions before planning
18
+ - `/superspecs:spec` — write spec (fits 200k context window)
19
+ - `/superspecs:grill` — stress-test spec against wiki + techstack before execution
13
20
 
14
21
  **Phase 2 — Execute**
15
- - `/pick-spec` — validate spec, check context fit
16
- - `/branch` — create branch/worktree
17
- - `/subagent` — fresh subagent per task, two-stage review
18
- - `/tdd` — RED-GREEN-REFACTOR, no exceptions
19
- - `/code-review` — critical issues block progress
22
+ - `/superspecs:pick-spec` — validate spec, check context fit
23
+ - `/superspecs:branch` — create branch/worktree
24
+ - `/superspecs:subagent` — fresh subagent per task; RED→GREEN→REFACTOR TDD runs inside each task
25
+ - `/superspecs:tdd` — invoke directly if writing code outside of subagent mode
26
+ - `/superspecs:code-review` — critical issues block progress
20
27
 
21
28
  **Phase 3 — Verify**
22
- - `/check-tests` — full suite, every scenario covered
23
- - `/wiki` — distill to knowledge base
29
+ - `/superspecs:check-tests` — full suite, every scenario covered
30
+ - `/superspecs:wiki` — compile feature to wiki (ingest)
24
31
 
25
32
  **Phase 4 — Ship**
26
- - `/ship` — PR, archive, next cycle
33
+ - `/superspecs:ship` — PR, archive, next cycle
34
+
35
+ ## Wiki Operations (run any time)
36
+ - `/superspecs:wiki-query` — tiered retrieval query; answer stays in context or files back as a page
37
+ - `/superspecs:wiki-lint` — health check: orphans, broken links, contradictions, stale refs
38
+ - `/superspecs:cross-linker` — auto-insert `[[wikilinks]]` for unlinked mentions
39
+ - `/superspecs:wiki-status` — vault dashboard: size, hubs, tags, provenance, pending sources
40
+ - `/superspecs:wiki-capture` — save session findings to wiki (`--quick` or `--full`)
41
+ - `/superspecs:tag-taxonomy` — canonical tag vocabulary; audit and normalize vault-wide
42
+ - `/superspecs:wiki-rebuild` — archive + rebuild vault; restore from snapshot
43
+
44
+ ## Wiki Architecture (Karpathy LLM Wiki pattern)
45
+ ```
46
+ superspec/wiki/raw/ ← immutable source material (agent reads, never edits)
47
+ superspec/wiki/ ← compiled knowledge base (agent writes)
48
+ superspec/wiki/log.md ← append-only activity log
49
+ .skills/verify-wiki/ ← schema: how to ingest, link, and format
50
+ ```
51
+ Compile once → query fast. The agent reads `wiki/`, not `raw/`, at query time.
27
52
 
28
53
  ## Rules
29
54
  - No implementation code before a failing test
30
55
  - Critical review findings block all progress
31
56
  - Spec must fit a fresh 200k context window
57
+ - Spec must pass grill before execution
32
58
  - Every shipped feature → wiki page
59
+ - Wiki query reads compiled `wiki/` only — never raw specs
33
60
 
34
61
  ## Paths
35
62
  - `superspec/specs/` — specs + DISCUSS.md files
36
63
  - `superspec/phases/` — execution working dirs
37
- - `superspec/wiki/` — knowledge base
38
- - `.skills/` — skill definitions
64
+ - `superspec/wiki/raw/` — immutable source material
65
+ - `superspec/wiki/` — compiled knowledge base (Obsidian vault)
66
+ - `superspec/wiki/log.md` — append-only activity log
67
+ - `.skills/` — skill definitions (schema layer)