solvdex 3.1.0-alpha.1 → 3.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.
@@ -6,7 +6,7 @@
6
6
  },
7
7
  "metadata": {
8
8
  "description": "Knowledge management plugins for Claude Code",
9
- "version": "3.1.0-alpha.1"
9
+ "version": "3.2.0"
10
10
  },
11
11
  "plugins": [
12
12
  {
@@ -16,7 +16,7 @@
16
16
  "url": "https://github.com/ducdmdev/solvdex.git"
17
17
  },
18
18
  "description": "Universal problem-solving journal - auto-capture and retrieve knowledge (problems, solutions, references)",
19
- "version": "3.1.0-alpha.1"
19
+ "version": "3.2.0"
20
20
  }
21
21
  ]
22
22
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "solvdex",
3
3
  "description": "Universal problem-solving journal - auto-captures and retrieves knowledge across problems, solutions, and references",
4
- "version": "3.1.0-alpha.1",
4
+ "version": "3.2.0",
5
5
  "author": {
6
6
  "name": "duc.do",
7
7
  "email": "ducdm.dev.work@gmail.com"
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Solvdex
2
2
 
3
3
  [![Claude Code Plugin](https://img.shields.io/badge/Claude%20Code-Plugin-blueviolet)](https://github.com/ducdmdev/solvdex)
4
- [![Version](https://img.shields.io/badge/version-3.1.0--alpha.1-blue)](./package.json)
4
+ [![Version](https://img.shields.io/badge/version-3.2.0-blue)](./package.json)
5
5
  [![Tests](https://img.shields.io/badge/tests-passing-brightgreen)](./tests)
6
6
  [![License](https://img.shields.io/badge/license-MIT-green)](./LICENSE)
7
7
 
@@ -47,7 +47,7 @@ Solvdex 3.0 uses a pure agent-based architecture. All logic is implemented in ag
47
47
  | Layer | Components |
48
48
  |-------|------------|
49
49
  | **Skills (12)** | `/wiki search`, `/wiki add`, `/wiki health`, etc. |
50
- | **Hooks** | SessionStart → entry count, PreToolUse → context hints, Stop → capture prompt |
50
+ | **Hooks** | SessionStart → inline entry summaries, Stop → capture prompt |
51
51
  | **Agents (8)** | searcher, capture, scanner, validator, stats, health, graph, duplicate-checker |
52
52
  | **Storage** | `.wiki/` with 3 universal folders |
53
53
 
@@ -239,17 +239,16 @@ Solvdex automatically tracks and promotes entries through maturity phases based
239
239
 
240
240
  Confidence auto-decays for entries unused for 90+ days.
241
241
 
242
- ## Hooks (Prompt-Based)
242
+ ## Hooks (Shell Scripts)
243
243
 
244
- Real-time integration with Claude Code via contextual prompts:
244
+ Real-time integration with Claude Code via shell scripts in `hooks/`:
245
245
 
246
246
  | Hook | When | Purpose |
247
247
  |------|------|---------|
248
- | `SessionStart` | New conversation | Shows entry count, hints to use `/wiki search` |
249
- | `PreToolUse` | Before Edit/Write | Shows problems/solutions count for context |
250
- | `Stop` | Task completes | Hint to capture valuable knowledge |
248
+ | `SessionStart` | New conversation | Inlines wiki entry summaries (title, folder, trigger, confidence) |
249
+ | `Stop` | Task completes | Suggests `/wiki add` to capture valuable knowledge |
251
250
 
252
- Hooks are configured in `hooks/hooks.json` and provide prompt-based guidance to use wiki agents.
251
+ Hooks are configured in `hooks/hooks.json` which delegates to shell scripts.
253
252
 
254
253
  ## Installation
255
254
 
package/agents/capture.md CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: capture
3
3
  description: Extract problem/solution from conversation context and create wiki entry. Smart categorization, duplicate checking, tag suggestions.
4
- tools: Glob, Read, Write
4
+ tools: Glob, Read, Write, Grep
5
5
  ---
6
6
 
7
7
  # Wiki Capture Agent
@@ -127,7 +127,7 @@ Create a concise, descriptive title:
127
127
  |--------|-------------------|
128
128
  | `problems/` | Problem, Cause, Solution, Prevention, Related |
129
129
  | `solutions/` | Overview, Prerequisites, Steps, Example, Related |
130
- | `references/` | Summary, Details, Links, Related |
130
+ | `references/` | Summary, Version*, Details, Examples*, Notes*, Links, Related |
131
131
 
132
132
  2. **Fill frontmatter**:
133
133
 
@@ -11,9 +11,9 @@ tools: Glob, Read
11
11
  For entry structure, validation rules, and constants, see: `docs/schema.md`
12
12
 
13
13
  Key references:
14
- - Entry frontmatter fields: `docs/schema.md#entry-frontmatter`
14
+ - Entry frontmatter fields: `docs/schema.md#entryfrontmatter`
15
15
  - Maturity rules: `docs/schema.md#maturity-rules`
16
- - Confidence levels: `docs/schema.md#confidence-levels`
16
+ - Confidence levels: `docs/schema.md#confidence-constants`
17
17
  - Folders: `docs/schema.md#default-folders`
18
18
 
19
19
  Detect potential duplicate entries before creation.
package/agents/health.md CHANGED
@@ -11,9 +11,9 @@ tools: Glob, Read, Write
11
11
  For entry structure, validation rules, and constants, see: `docs/schema.md`
12
12
 
13
13
  Key references:
14
- - Entry frontmatter fields: `docs/schema.md#entry-frontmatter`
14
+ - Entry frontmatter fields: `docs/schema.md#entryfrontmatter`
15
15
  - Maturity rules: `docs/schema.md#maturity-rules`
16
- - Confidence levels: `docs/schema.md#confidence-levels`
16
+ - Confidence levels: `docs/schema.md#confidence-constants`
17
17
  - Folders: `docs/schema.md#default-folders`
18
18
 
19
19
  Comprehensive wiki health analysis and recommendations.
@@ -25,7 +25,7 @@ Comprehensive wiki health analysis and recommendations.
25
25
  - Stale: Not used in 90+ days
26
26
  - Stub: Missing Problem or Solution section
27
27
  - Low confidence: < 50
28
- - No trigger: Issues without error pattern
28
+ - No trigger: Problems entries without trigger pattern
29
29
  - Orphaned: No tags, no related entries
30
30
  - Broken links: [[link]] to non-existent entry
31
31
  3. **Find coverage gaps**:
package/agents/stats.md CHANGED
@@ -11,9 +11,9 @@ tools: Glob, Read, Write
11
11
  For entry structure, validation rules, and constants, see: `docs/schema.md`
12
12
 
13
13
  Key references:
14
- - Entry frontmatter fields: `docs/schema.md#entry-frontmatter`
14
+ - Entry frontmatter fields: `docs/schema.md#entryfrontmatter`
15
15
  - Maturity rules: `docs/schema.md#maturity-rules`
16
- - Confidence levels: `docs/schema.md#confidence-levels`
16
+ - Confidence levels: `docs/schema.md#confidence-constants`
17
17
  - Folders: `docs/schema.md#default-folders`
18
18
 
19
19
  Calculate comprehensive wiki statistics and manage maturity tracking.
@@ -11,9 +11,9 @@ tools: Glob, Read, Write
11
11
  For entry structure, validation rules, and constants, see: `docs/schema.md`
12
12
 
13
13
  Key references:
14
- - Entry frontmatter fields: `docs/schema.md#entry-frontmatter`
14
+ - Entry frontmatter fields: `docs/schema.md#entryfrontmatter`
15
15
  - Maturity rules: `docs/schema.md#maturity-rules`
16
- - Confidence levels: `docs/schema.md#confidence-levels`
16
+ - Confidence levels: `docs/schema.md#confidence-constants`
17
17
  - Folders: `docs/schema.md#default-folders`
18
18
 
19
19
  Validate wiki entries for quality and correctness.
@@ -67,9 +67,10 @@ Passed: Y | Issues: Z
67
67
 
68
68
  ## Validation Rules
69
69
 
70
- ### Required Sections
71
- - All entries: Problem section (or Context)
72
- - All entries: Solution section
70
+ ### Required Sections (by folder)
71
+ - problems/: Problem and Solution sections
72
+ - solutions/: Overview and Steps sections
73
+ - references/: Summary and Details sections
73
74
 
74
75
  ### Confidence-Maturity Match
75
76
  - captured: confidence should be 30-50
package/docs/README.md CHANGED
@@ -26,11 +26,12 @@ A universal problem-solving journal - auto-capture and retrieve knowledge across
26
26
  |----------|-------------|
27
27
  | [plans/2025-02-02-agent-first-architecture.md](./plans/2025-02-02-agent-first-architecture.md) | Pure agent architecture (v3.0) |
28
28
  | [plans/2026-02-03-index-scaling-design.md](./plans/2026-02-03-index-scaling-design.md) | Index-based scaling design (v3.1) |
29
+ | [plans/2026-02-03-v3.1-index-implementation.md](./plans/2026-02-03-v3.1-index-implementation.md) | Index implementation plan (v3.1) |
29
30
 
30
31
  ## Quick Links
31
32
 
32
33
  - **Skills:** 12 commands for wiki management
33
- - **Hooks:** 3 automated triggers for capture and retrieval
34
+ - **Hooks:** 2 automated triggers for capture and retrieval
34
35
  - **Folders:** 3 universal folders (problems, solutions, references)
35
36
 
36
37
  ## Project Structure
@@ -49,11 +50,11 @@ solvdex/
49
50
 
50
51
  ## Version
51
52
 
52
- Current: v3.1.0-alpha.1
53
+ Current: v3.2.0
53
54
 
54
55
  ## Quick Stats
55
56
 
56
57
  - **12 skills** - CLI commands for wiki management
57
- - **3 hooks** - Automated capture and retrieval
58
+ - **2 hooks** - Automated capture and retrieval
58
59
  - **8 agents** - Specialized wiki operations
59
60
  - **3 folders** - Universal organization (problems, solutions, references)
@@ -2,7 +2,7 @@
2
2
 
3
3
  Solvdex system design and component overview.
4
4
 
5
- **Version:** 3.1.0-alpha.1 - Universal Problem-Solving Journal
5
+ **Version:** 3.2.0 - Universal Problem-Solving Journal
6
6
 
7
7
  ## System Overview
8
8
 
@@ -22,12 +22,12 @@ All business logic lives in agent markdown files. No TypeScript.
22
22
  | Agent | Purpose | Tools |
23
23
  |-------|---------|-------|
24
24
  | `searcher` | Search entries, find solutions, recommendations | Glob, Read |
25
- | `capture` | Extract problem/solution from conversations | Glob, Read, Write |
25
+ | `capture` | Extract problem/solution from conversations | Glob, Read, Write, Grep |
26
26
  | `scanner` | Scan project and create stub entries | Bash, Read, Write, Grep, Glob |
27
- | `validator` | Validate entry quality, check for issues | Glob, Read |
27
+ | `validator` | Validate entry quality, check for issues | Glob, Read, Write |
28
28
  | `stats` | Calculate statistics, track maturity | Glob, Read, Write |
29
29
  | `duplicate-checker` | Detect potential duplicate entries | Glob, Read |
30
- | `health` | Analyze coverage gaps, find stale entries | Glob, Read |
30
+ | `health` | Analyze coverage gaps, find stale entries | Glob, Read, Write |
31
31
  | `graph` | Generate relationship diagrams (Mermaid) | Glob, Read |
32
32
 
33
33
  **Agent Naming:** Agent `name` field is required by Claude Code plugin spec and must match the filename without extension (e.g., `agents/scanner.md` → `name: scanner`).
@@ -90,17 +90,16 @@ See [Index Scaling Design](./plans/2026-02-03-index-scaling-design.md) for full
90
90
  - `wiki-export` - Export to JSON → `capture`
91
91
  - `wiki-import` - Import from JSON → `capture`
92
92
 
93
- ### 3. Hooks (`hooks/hooks.json`) - Prompt-Based
93
+ ### 3. Hooks (`hooks/`) - Shell Scripts
94
94
 
95
95
  Hooks provide context prompts that guide Claude to use wiki agents when appropriate:
96
96
 
97
- | Hook | Purpose | Agent Suggested |
98
- |------|---------|-----------------|
99
- | `SessionStart` | Show entry count, hint to use `/wiki search` | (prompt-based) |
100
- | `PreToolUse` | Show problems/solutions count before Edit/Write | (prompt-based) |
101
- | `Stop` | Capture knowledge after tasks | `capture` |
97
+ | Hook | Script | Purpose | Agent Suggested |
98
+ |------|--------|---------|-----------------|
99
+ | `SessionStart` | `hooks/session-start.sh` | Inline wiki entry summaries (title, folder, trigger, confidence) | (prompt-based) |
100
+ | `Stop` | `hooks/stop.sh` | Capture knowledge after tasks | `capture` |
102
101
 
103
- No TypeScript hook files - all handled by `hooks.json` with prompt-based hints.
102
+ No TypeScript hook files - `hooks.json` delegates to shell scripts in `hooks/`.
104
103
 
105
104
  ## Data Flow
106
105
 
@@ -12,7 +12,6 @@ graph TB
12
12
  end
13
13
  subgraph "Hooks"
14
14
  H1["SessionStart"]
15
- H2["Error"]
16
15
  H3["Stop"]
17
16
  end
18
17
  end
@@ -39,7 +38,6 @@ graph TB
39
38
  S3 --> A6
40
39
  S4 --> A7
41
40
  H1 --> A1
42
- H2 --> A1
43
41
  H3 --> A2
44
42
 
45
43
  A1 --> W1
@@ -7,7 +7,10 @@ Set up Solvdex in your project in under 2 minutes.
7
7
  ### Via Claude Code Marketplace (Recommended)
8
8
 
9
9
  ```bash
10
- # Coming soon
10
+ # Step 1: Add marketplace
11
+ /plugin marketplace add https://raw.githubusercontent.com/ducdmdev/solvdex/main/.claude-plugin/marketplace.json
12
+
13
+ # Step 2: Install plugin
11
14
  /plugin install solvdex
12
15
  ```
13
16
 
@@ -69,15 +72,14 @@ Or browse all:
69
72
 
70
73
  ## Automatic Context
71
74
 
72
- Solvdex hooks provide prompt-based hints to use wiki agents:
75
+ Solvdex hooks provide context via shell scripts in `hooks/`:
73
76
 
74
77
  | Hook | Trigger | Purpose |
75
78
  |------|---------|---------|
76
- | SessionStart | New conversation | Shows wiki entry count |
77
- | PreToolUse | Before Edit/Write | Shows problems/solutions count for context |
78
- | Stop | Task completes | Hints to capture valuable knowledge |
79
+ | SessionStart | New conversation | Inlines wiki entry summaries (title, folder, trigger, confidence) |
80
+ | Stop | Task completes | Suggests `/wiki add` to capture valuable knowledge |
79
81
 
80
- Hooks are configured in `hooks/hooks.json` - no TypeScript needed.
82
+ Hooks are configured in `hooks/hooks.json` which delegates to shell scripts.
81
83
 
82
84
  ## Next Steps
83
85
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  **Created**: 2025-02-02
4
4
  **Updated**: 2025-02-02
5
- **Status**: Approved
5
+ **Status**: Completed
6
6
  **Goal**: Eliminate TypeScript logic, move ALL intelligence to Claude agents
7
7
 
8
8
  ## Executive Summary
@@ -2,6 +2,8 @@
2
2
 
3
3
  > **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
4
4
 
5
+ **Status:** Completed
6
+
5
7
  **Goal:** Transform Solvdex from a dev-focused wiki (7 categories) to a universal problem-solving journal (3 categories) with AI-generated templates.
6
8
 
7
9
  **Architecture:** Replace fixed categories (issues, patterns, gotchas, testing, docs, security, performance) with 3 universal folders (problems, solutions, references). Remove fixed templates - AI generates structure based on content type. Domains become AI-inferred tags.
@@ -1,7 +1,7 @@
1
1
  # Index-Based Scaling Design
2
2
 
3
3
  **Date:** 2026-02-03
4
- **Status:** Proposed
4
+ **Status:** Implemented
5
5
  **Problem:** As wiki entries grow, agent-based search becomes slow and hits context window limits.
6
6
 
7
7
  ## Summary
@@ -2,6 +2,8 @@
2
2
 
3
3
  > **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
4
4
 
5
+ **Status:** Completed
6
+
5
7
  **Goal:** Add `.wiki/index.json` for efficient agent-based search at scale (100-1000 entries).
6
8
 
7
9
  **Architecture:** Agents read a single index file instead of globbing/reading all entries. Index is derived data; markdown files remain source of truth. All operations use agent tools (Read, Write, Glob) — no compiled code.
@@ -0,0 +1,123 @@
1
+ # Plan: Expand Solvdex Test Coverage
2
+
3
+ **Status:** Implemented
4
+ **Date:** 2026-02-06
5
+
6
+ ## Context
7
+
8
+ Solvdex has 77 validation-only tests across 5 files (frontmatter structure checks). The quality pass we just completed revealed issues (stale schema links, wrong tools in docs, inconsistent required sections) that tests should have caught. We need tests that validate cross-file consistency, schema contracts, and template correctness.
9
+
10
+ **Constraint:** This is a pure agent-based plugin — no TypeScript logic to unit test. All tests validate file structure, cross-references, and data contracts.
11
+
12
+ ## New Test Files (4 files, ~80 tests)
13
+
14
+ ### 1. `tests/cross-references.test.ts` (~20 tests)
15
+
16
+ **Purpose:** Catch drift between agents, skills, docs, and hooks — the exact issues found in the quality pass.
17
+
18
+ **What it tests:**
19
+ - Every skill `agent:` field references an existing `agents/<name>.md` file
20
+ - Every agent is referenced by at least one skill (exception: `duplicate-checker` is internal-only)
21
+ - `architecture.md` agent tools table matches actual agent frontmatter tools
22
+ - Schema reference links in agents (e.g., `docs/schema.md#confidence-constants`) point to valid headings in schema.md
23
+ - README.md and CLAUDE.md reference correct counts (8 agents, 12 skills)
24
+ - hooks.json event names are valid Claude Code hook events
25
+
26
+ **Pattern:** Load all agents + skills + docs in `beforeAll`, then cross-check.
27
+
28
+ ### 2. `tests/schema-constants.test.ts` (~18 tests)
29
+
30
+ **Purpose:** Validate `docs/schema.md` as a structured contract — ensure constants are consistent internally.
31
+
32
+ **What it tests:**
33
+ - Exactly 3 status values: `active`, `flagged`, `deprecated`
34
+ - Exactly 3 maturity values: `captured`, `verified`, `validated`
35
+ - Exactly 6 audit actions
36
+ - Confidence constants: HIGH=80, MEDIUM=50, LOW=20, THRESHOLD=40, MAX=100, MIN=0
37
+ - Maturity rules: ascending uses (0, 3, 10) and confidence (40, 70, 90)
38
+ - Exactly 3 folders with matching template files in `docs/templates/`
39
+ - Required frontmatter fields list
40
+ - IndexEntry fields are a subset of EntryFrontmatter fields
41
+
42
+ **Pattern:** Read schema.md, hardcode expected values, assert match. If schema changes, test forces update.
43
+
44
+ ### 3. `tests/templates.test.ts` (~15 tests)
45
+
46
+ **Purpose:** Validate template structure matches schema documentation.
47
+
48
+ **What it tests:**
49
+ - Exactly 3 template files exist (problems.md, solutions.md, references.md)
50
+ - problems/ template has sections: Problem, Cause, Solution, Prevention, Related
51
+ - solutions/ template has sections: Overview, Prerequisites, Steps, Example, Related
52
+ - references/ template has sections: Summary, Version, Details, Examples, Notes, Links, Related
53
+ - Only problems/ template includes `trigger` field
54
+ - All templates default to `confidence: 40`, `maturity: captured`
55
+ - All templates include `audit` with `action: created`
56
+ - Template frontmatter fields are valid EntryFrontmatter fields
57
+
58
+ **Pattern:** Read template files, extract sections from code blocks via regex.
59
+
60
+ ### 4. `tests/frontmatter-contracts.test.ts` (~20 tests)
61
+
62
+ **Purpose:** Test data validation rules using synthetic sample data.
63
+
64
+ **What it tests:**
65
+ - Date format: valid YYYY-MM-DD accepted, invalid formats rejected
66
+ - Confidence range: 0-100 accepted, negative/over-100 rejected
67
+ - Status enum: only `active`/`flagged`/`deprecated` valid
68
+ - Maturity enum: only `captured`/`verified`/`validated` valid
69
+ - Maturity progression: verified requires 3+ uses, validated requires 10+ uses
70
+ - Audit entry requires date, action, by fields
71
+ - Index entry path matches `<folder>/<slug>.md` pattern
72
+ - Index entry folder field matches path prefix
73
+
74
+ **Pattern:** Pure validation functions with hardcoded test data (no file I/O in individual tests).
75
+
76
+ ### 5. Enhance `tests/index-schema.test.ts` (+8 tests)
77
+
78
+ **Purpose:** Add constraint validation to existing index tests.
79
+
80
+ **What it adds:**
81
+ - No stat value should be negative
82
+ - `by_folder` keys must be valid folder names only
83
+ - `by_maturity` keys must be valid maturity values only
84
+ - Actual entry counts per folder match `by_folder` stats
85
+ - Actual entry counts per maturity match `by_maturity` stats
86
+
87
+ ## Implementation Order
88
+
89
+ 1. `cross-references.test.ts` — catches the most impactful bugs (stale references)
90
+ 2. `schema-constants.test.ts` — establishes canonical constants
91
+ 3. `templates.test.ts` — validates template contracts
92
+ 4. `frontmatter-contracts.test.ts` — validates data rules
93
+ 5. `index-schema.test.ts` enhancements — incremental additions
94
+
95
+ Commit after each file.
96
+
97
+ ## Critical Files
98
+
99
+ | File | Role |
100
+ |------|------|
101
+ | `tests/agents.test.ts` | Pattern reference (imports, beforeAll, loop assertions) |
102
+ | `docs/schema.md` | Source of truth for all constants |
103
+ | `docs/architecture.md` | Agent tools table to cross-check |
104
+ | `docs/templates/*.md` | Template sections to validate |
105
+ | `agents/*.md` | 8 agent files to cross-reference |
106
+ | `skills/*/SKILL.md` | 12 skill files to cross-reference |
107
+
108
+ ## Conventions (from existing tests)
109
+
110
+ - Imports: `import { describe, it, expect, beforeAll } from 'vitest'` + `fs`, `path`, `gray-matter`
111
+ - Root: `const rootDir = path.join(__dirname, '..')`
112
+ - Heavy I/O in `beforeAll`, not in `it()` blocks
113
+ - Descriptive error messages: `expect(value, \`${name} issue\`).toBe(expected)`
114
+ - Loop over collections in single `it()` blocks
115
+ - TypeScript interfaces for parsed data
116
+
117
+ ## Verification
118
+
119
+ ```bash
120
+ npm test
121
+ ```
122
+
123
+ Expected: All existing 77 tests + ~88 new tests = ~165 total, all passing.
@@ -0,0 +1,153 @@
1
+ # Fix Capture Workflow for Plugin Mode
2
+
3
+ **Date:** 2026-02-09
4
+ **Status:** Implemented
5
+ **Version:** 3.2.0
6
+
7
+ ## Problem
8
+
9
+ Solvdex capture doesn't work when installed as a plugin in other projects. Users report that `/wiki add` fails to properly create entries after solving problems.
10
+
11
+ ## Root Causes
12
+
13
+ ### 1. Skills Don't Load Agent Logic (CRITICAL)
14
+
15
+ Per the [official Claude Code plugin spec](https://code.claude.com/docs/en/skills), the `agent:` field in SKILL.md only activates when `context: fork` is set. Without it, the field is decorative metadata.
16
+
17
+ Current skills (like `wiki-add/SKILL.md`) have `agent: capture` but NO `context: fork`. When `/wiki add` is invoked:
18
+ - Claude loads SKILL.md content **inline** (in the main conversation)
19
+ - The skill has only **high-level** descriptions like "The capture agent will: 1. Analyze conversation 2. Check duplicates 3. Create entry"
20
+ - The **detailed 9-step process** in `agents/capture.md` (240 lines) is **never loaded**
21
+ - Claude improvises with the vague skill instructions - doesn't know exact frontmatter format, template structure, or index update procedure
22
+
23
+ **Why `context: fork` can't fix this:** Forked subagents don't have conversation history. The capture agent NEEDS conversation context to extract problems and solutions.
24
+
25
+ ### 2. Stop Hook Output Is Invisible (MAJOR)
26
+
27
+ Per the [official hooks spec](https://code.claude.com/docs/en/hooks), Stop hook stdout is **only shown in verbose mode** (`Ctrl+O`). Only `SessionStart` and `UserPromptSubmit` hooks have stdout added to Claude's context.
28
+
29
+ Current `stop.sh` echoes "suggest /wiki add" but Claude **never sees it** in normal operation.
30
+
31
+ However, Stop hooks CAN return JSON with `{"decision": "block", "reason": "..."}` - the reason IS shown to Claude, and `stop_hook_active` in the input prevents infinite loops.
32
+
33
+ ### 3. Capture Agent Missing Grep Tool (BUG)
34
+
35
+ `agents/capture.md` declares `tools: Glob, Read, Write` but Step 5 instructs:
36
+ ```
37
+ Grep "tags:" .wiki/**/*.md
38
+ ```
39
+
40
+ If ever invoked as a subagent, the Grep tool would fail because it's not in the allowed tools list.
41
+
42
+ ## Solution
43
+
44
+ ### Strategy: Dynamic Content Injection via `!`command``
45
+
46
+ Use Claude Code's official [`!`command`` preprocessing](https://code.claude.com/docs/en/skills#inject-dynamic-context) to inject full agent content into skills at load time.
47
+
48
+ How it works:
49
+ 1. The `!`command`` syntax runs shell commands **before** skill content is sent to Claude
50
+ 2. Command output **replaces** the placeholder
51
+ 3. `${CLAUDE_PLUGIN_ROOT}` resolves to the plugin installation directory
52
+ 4. Result: Claude receives the complete agent instructions inline
53
+ 5. Conversation context is preserved (no fork = inline execution)
54
+
55
+ This approach:
56
+ - Keeps agents as the **single source of truth** (no duplication)
57
+ - Gives skills the **complete procedure** instructions
58
+ - Runs **inline** so conversation context is available
59
+ - Uses an **official Claude Code feature**
60
+
61
+ ### Changes
62
+
63
+ #### 1. `skills/wiki-add/SKILL.md` - Inject capture agent logic
64
+
65
+ Keep existing frontmatter and usage section. Add dynamic injection of the full capture procedure:
66
+
67
+ ```markdown
68
+ ## Capture Procedure
69
+
70
+ The following is the complete capture procedure from the capture agent:
71
+
72
+ !`cat "${CLAUDE_PLUGIN_ROOT}/agents/capture.md"`
73
+ ```
74
+
75
+ This replaces the high-level "The capture agent will..." with the actual 9-step process including exact frontmatter format, template selection, duplicate checking, and index updates.
76
+
77
+ #### 2. `skills/wiki-fix/SKILL.md` - Inject capture agent logic
78
+
79
+ Same approach for the fix/update workflow:
80
+
81
+ ```markdown
82
+ ## Capture Procedure Reference
83
+
84
+ !`cat "${CLAUDE_PLUGIN_ROOT}/agents/capture.md"`
85
+ ```
86
+
87
+ #### 3. `agents/capture.md` - Add Grep to tools
88
+
89
+ ```yaml
90
+ # Before
91
+ tools: Glob, Read, Write
92
+
93
+ # After
94
+ tools: Glob, Read, Write, Grep
95
+ ```
96
+
97
+ Step 5 uses `Grep "tags:" .wiki/**/*.md` for tag reuse.
98
+
99
+ #### 4. `hooks/stop.sh` - Use JSON decision control
100
+
101
+ Replace plain echo with JSON output. Per spec, `decision: "block"` with `reason` IS shown to Claude:
102
+
103
+ ```bash
104
+ #!/bin/sh
105
+ # Stop hook: Suggest capturing knowledge using JSON decision control
106
+ if [ ! -d .wiki ]; then exit 0; fi
107
+
108
+ # Read JSON input and check stop_hook_active to prevent infinite loops
109
+ INPUT=$(cat)
110
+ echo "$INPUT" | grep -q '"stop_hook_active".*true' && exit 0
111
+
112
+ # Return JSON decision - reason IS shown to Claude (unlike plain stdout)
113
+ printf '{"decision":"block","reason":"Solvdex: If a problem was solved or valuable knowledge was learned, consider using /wiki add to capture it. If nothing notable, you may proceed."}\n'
114
+ ```
115
+
116
+ #### 5. `CLAUDE.md` - Update hooks documentation
117
+
118
+ Update hooks section to reflect:
119
+ - Stop hook now uses JSON decision control (visible to Claude)
120
+ - SessionStart hook stdout is added to Claude's context (already works)
121
+
122
+ ### Files NOT Changed
123
+
124
+ | File | Reason |
125
+ |------|--------|
126
+ | `skills/wiki-scan/SKILL.md` | Already uses explicit `Task(subagent_type="scanner")` delegation; scanner doesn't need conversation context |
127
+ | `hooks/hooks.json` | Structure unchanged (paths already fixed in previous commit) |
128
+ | Other skills (search, stats, health, graph, flag) | Work adequately with inline instructions for read operations |
129
+
130
+ ## Risk Assessment
131
+
132
+ | Change | Risk | Mitigation |
133
+ |--------|------|------------|
134
+ | `!`cat`` injection | Medium - requires `${CLAUDE_PLUGIN_ROOT}` to resolve correctly | Test in both local dev and plugin installation; if `!`cat`` fails, Claude sees the raw command (visible error) |
135
+ | Stop hook blocking | Medium - more aggressive than silent echo | `stop_hook_active` prevents loops; Claude can dismiss and proceed |
136
+ | Grep tool addition | Low - purely additive | No breaking changes |
137
+
138
+ ## Verification
139
+
140
+ 1. `npm test` - all existing tests pass (changes are backward-compatible)
141
+ 2. Manual: install as plugin in test project, invoke `/wiki add` after solving a problem
142
+ 3. Verify full 9-step capture executes (frontmatter, template, index update)
143
+ 4. Verify Stop hook shows suggestion to Claude in normal mode (not just verbose)
144
+ 5. Verify `stop_hook_active` prevents infinite loops
145
+
146
+ ## Alternative Approaches Considered
147
+
148
+ | Approach | Why Rejected |
149
+ |----------|-------------|
150
+ | `context: fork` with conversation summary | Forked subagents don't have conversation history; manual summarization is lossy and complex |
151
+ | Duplicate agent logic in skills | Violates DRY; 2x maintenance burden; agents are documented as "single source of truth" |
152
+ | Accept limitation, document it | Defeats purpose of plugin marketplace; user reports this as critical |
153
+ | `prompt` type Stop hook | Adds LLM call on every stop (latency + cost); blocking with JSON is simpler |
package/docs/use-cases.md CHANGED
@@ -241,7 +241,7 @@ Returns top 5 most relevant entries with explanations.
241
241
 
242
242
  ---
243
243
 
244
- ## Scenario 13: Scan New Project
244
+ ## Scenario 11: Scan New Project
245
245
 
246
246
  **Situation:** Just joined a project, want to populate wiki with initial knowledge.
247
247
 
package/docs/workflows.md CHANGED
@@ -9,10 +9,9 @@ How Solvdex automates knowledge capture and retrieval.
9
9
  > **[View Session Workflow Diagram](./diagrams/session-workflow.md)**
10
10
 
11
11
  **Session Lifecycle:**
12
- 1. **SessionStart** → Shows wiki entry count, hints to use `/wiki search`
13
- 2. **User prompts** → Claude Code processes
14
- 3. **Tool execution** → PreToolUse shows problems/solutions count for context
15
- 4. **Continue or Stop** → Prompt hints to use `capture` agent
12
+ 1. **SessionStart** → Inlines wiki entry summaries (title, folder, trigger, confidence)
13
+ 2. **User prompts** → Claude Code processes with wiki context available
14
+ 3. **Continue or Stop** → Suggests `/wiki add` to capture valuable knowledge
16
15
 
17
16
  ## Hook Details
18
17
 
package/hooks/hooks.json CHANGED
@@ -6,19 +6,7 @@
6
6
  "hooks": [
7
7
  {
8
8
  "type": "command",
9
- "command": "if [ -d .wiki ]; then t=$(find .wiki -name '*.md' -not -name 'README*' 2>/dev/null | wc -l | tr -d ' '); echo \"Solvdex: Wiki has $t entries. Check .wiki/index.json for entries relevant to this session. Surface highly relevant ones.\"; fi; exit 0",
10
- "timeout": 5
11
- }
12
- ]
13
- }
14
- ],
15
- "PreToolUse": [
16
- {
17
- "matcher": "Edit|Write",
18
- "hooks": [
19
- {
20
- "type": "command",
21
- "command": "if [ -d .wiki ]; then echo 'Solvdex: Before editing, check .wiki/index.json for problems/solutions related to files being modified. Mention if highly relevant.'; fi; exit 0",
9
+ "command": "sh ${CLAUDE_PLUGIN_ROOT}/hooks/session-start.sh; exit 0",
22
10
  "timeout": 5
23
11
  }
24
12
  ]
@@ -30,7 +18,7 @@
30
18
  "hooks": [
31
19
  {
32
20
  "type": "command",
33
- "command": "if [ -d .wiki ]; then echo 'Solvdex: If a problem was solved or something valuable was learned, suggest /wiki add to capture it.'; fi; exit 0",
21
+ "command": "sh ${CLAUDE_PLUGIN_ROOT}/hooks/stop.sh; exit 0",
34
22
  "timeout": 5
35
23
  }
36
24
  ]
@@ -0,0 +1,20 @@
1
+ #!/bin/sh
2
+ # SessionStart hook: Surface wiki entries at session start
3
+ if [ ! -d .wiki ]; then exit 0; fi
4
+
5
+ if [ -f .wiki/index.json ]; then
6
+ node -e '
7
+ const idx = require("./.wiki/index.json");
8
+ const lines = idx.entries.map(e => {
9
+ let s = " [" + e.folder + "] " + e.title;
10
+ if (e.trigger) s += " (trigger: " + e.trigger + ")";
11
+ s += " [confidence: " + e.confidence + "]";
12
+ return s;
13
+ });
14
+ console.log("Solvdex: Wiki has " + idx.stats.total + " entries. Surface relevant ones:");
15
+ lines.forEach(l => console.log(l));
16
+ '
17
+ else
18
+ t=$(find .wiki -name '*.md' -not -name 'README*' 2>/dev/null | wc -l | tr -d ' ')
19
+ echo "Solvdex: Wiki has $t entries (no index). Use /wiki health --reindex to build index."
20
+ fi
package/hooks/stop.sh ADDED
@@ -0,0 +1,10 @@
1
+ #!/bin/sh
2
+ # Stop hook: Suggest capturing knowledge using JSON decision control
3
+ if [ ! -d .wiki ]; then exit 0; fi
4
+
5
+ # Read JSON input and check stop_hook_active to prevent infinite loops
6
+ INPUT=$(cat)
7
+ echo "$INPUT" | grep -q '"stop_hook_active".*true' && exit 0
8
+
9
+ # Return JSON decision - reason IS shown to Claude (unlike plain stdout)
10
+ printf '{"decision":"block","reason":"Solvdex: If a problem was solved or valuable knowledge was learned, consider using /wiki add to capture it. If nothing notable, you may proceed."}\n'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solvdex",
3
- "version": "3.1.0-alpha.1",
3
+ "version": "3.2.0",
4
4
  "description": "Universal problem-solving journal - auto-captures and retrieves knowledge across any domain",
5
5
  "files": [
6
6
  ".claude-plugin/",
@@ -26,14 +26,11 @@ Save knowledge from the current conversation to the wiki.
26
26
  - **Duplicate check**: Warns if similar entry exists
27
27
  - **Smart titles**: Generated from problem description
28
28
 
29
- ## What Happens
30
-
31
- The capture agent will:
32
- 1. Analyze conversation for problem/solution
33
- 2. **Check for duplicate entries** (important!)
34
- 3. Determine appropriate folder
35
- 4. Use fixed template for the folder (see docs/templates/)
36
- 5. Create entry with proper frontmatter
29
+ ## Capture Procedure
30
+
31
+ The following is the complete capture procedure from the capture agent:
32
+
33
+ !`cat "${CLAUDE_PLUGIN_ROOT}/agents/capture.md"`
37
34
 
38
35
  ## Folders
39
36
 
@@ -15,17 +15,9 @@ Update a flagged entry and reset its status to active.
15
15
 
16
16
  - `entry-path`: Path to the wiki entry to fix (e.g., `problems/database-timeout.md`)
17
17
 
18
- ## What Happens
18
+ ## Capture Procedure Reference
19
19
 
20
- When invoked, the **capture** agent will:
21
-
22
- 1. **Read the flagged entry** - Load the current content and metadata
23
- 2. **Show current content and issues** - Display what needs to be fixed
24
- 3. **Analyze conversation context** - Look for new solutions or information
25
- 4. **Update content** - Apply fixes based on the conversation
26
- 5. **Reset status to 'active'** - Mark the entry as no longer flagged
27
- 6. **Increase confidence** - Bump confidence if solution is verified
28
- 7. **Add audit log entry** - Record the fix action
20
+ !`cat "${CLAUDE_PLUGIN_ROOT}/agents/capture.md"`
29
21
 
30
22
  ## Process
31
23
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: wiki-health
3
3
  description: Analyze wiki health, validate entries, find coverage gaps, and get recommendations.
4
- argument-hint: "[--validate]"
4
+ argument-hint: "[--validate] [--reindex]"
5
5
  user-invocable: true
6
6
  agent: health
7
7
  ---
@@ -15,6 +15,7 @@ Comprehensive wiki health analysis with validation and recommendations.
15
15
  ```
16
16
  /wiki health # Full health report with recommendations
17
17
  /wiki health --validate # Include detailed validation checks
18
+ /wiki health --reindex # Rebuild .wiki/index.json from entry files
18
19
  ```
19
20
 
20
21
  ## What You Get