solvdex 1.0.5 → 2.0.0-alpha.4

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.
Files changed (149) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +100 -94
  4. package/agents/wiki-capture/AGENT.md +182 -0
  5. package/agents/wiki-duplicate-checker/AGENT.md +98 -0
  6. package/agents/wiki-graph/AGENT.md +105 -0
  7. package/agents/wiki-health/AGENT.md +113 -0
  8. package/agents/wiki-scanner/AGENT.md +96 -0
  9. package/agents/wiki-searcher/AGENT.md +89 -0
  10. package/agents/wiki-stats/AGENT.md +116 -0
  11. package/agents/wiki-validator/AGENT.md +92 -0
  12. package/docs/README.md +43 -0
  13. package/docs/architecture.md +189 -0
  14. package/docs/diagrams/README.md +23 -0
  15. package/docs/diagrams/architecture-overview.md +54 -0
  16. package/docs/diagrams/data-structures.md +48 -0
  17. package/docs/diagrams/entry-status-states.md +19 -0
  18. package/docs/diagrams/knowledge-capture-flow.md +17 -0
  19. package/docs/diagrams/knowledge-retrieval-flow.md +18 -0
  20. package/docs/diagrams/maturity-states.md +24 -0
  21. package/docs/diagrams/session-workflow.md +38 -0
  22. package/docs/diagrams/system-overview.md +35 -0
  23. package/docs/getting-started.md +90 -0
  24. package/docs/plans/2025-01-22-marketplace-distribution.md +145 -0
  25. package/docs/plans/2025-01-22-solvdex-design.md +373 -0
  26. package/docs/plans/2025-02-02-agent-first-architecture.md +657 -0
  27. package/docs/plans/2025-02-02-implementation-tasks.md +1211 -0
  28. package/docs/schema.md +421 -0
  29. package/docs/use-cases.md +312 -0
  30. package/docs/workflows.md +118 -0
  31. package/hooks/hooks.json +11 -20
  32. package/hooks/pre-tool.sh +17 -0
  33. package/hooks/session-start.sh +16 -0
  34. package/hooks/stop.sh +11 -0
  35. package/package.json +11 -20
  36. package/skills/wiki-add/SKILL.md +45 -66
  37. package/skills/wiki-browse/SKILL.md +22 -56
  38. package/skills/wiki-capture/SKILL.md +9 -153
  39. package/skills/wiki-explorer/SKILL.md +13 -143
  40. package/skills/wiki-export/SKILL.md +11 -44
  41. package/skills/wiki-fix/SKILL.md +17 -43
  42. package/skills/wiki-flag/SKILL.md +20 -22
  43. package/skills/wiki-graph/SKILL.md +62 -0
  44. package/skills/wiki-health/SKILL.md +65 -0
  45. package/skills/wiki-import/SKILL.md +13 -70
  46. package/skills/wiki-init/SKILL.md +31 -22
  47. package/skills/wiki-search/SKILL.md +28 -56
  48. package/skills/wiki-stats/SKILL.md +43 -86
  49. package/skills/wiki-status/SKILL.md +18 -43
  50. package/skills/wiki-test-trigger/SKILL.md +38 -114
  51. package/skills/wiki-validate/SKILL.md +32 -33
  52. package/dist/hooks/constants.d.ts +0 -9
  53. package/dist/hooks/constants.d.ts.map +0 -1
  54. package/dist/hooks/constants.js +0 -27
  55. package/dist/hooks/constants.js.map +0 -1
  56. package/dist/hooks/error-lookup.d.ts +0 -4
  57. package/dist/hooks/error-lookup.d.ts.map +0 -1
  58. package/dist/hooks/error-lookup.js +0 -92
  59. package/dist/hooks/error-lookup.js.map +0 -1
  60. package/dist/hooks/post-task.d.ts +0 -15
  61. package/dist/hooks/post-task.d.ts.map +0 -1
  62. package/dist/hooks/post-task.js +0 -246
  63. package/dist/hooks/post-task.js.map +0 -1
  64. package/dist/hooks/prompt-enrich.d.ts +0 -16
  65. package/dist/hooks/prompt-enrich.d.ts.map +0 -1
  66. package/dist/hooks/prompt-enrich.js +0 -121
  67. package/dist/hooks/prompt-enrich.js.map +0 -1
  68. package/dist/hooks/session-start-cli.d.ts +0 -3
  69. package/dist/hooks/session-start-cli.d.ts.map +0 -1
  70. package/dist/hooks/session-start-cli.js +0 -67
  71. package/dist/hooks/session-start-cli.js.map +0 -1
  72. package/dist/hooks/session-start.d.ts +0 -4
  73. package/dist/hooks/session-start.d.ts.map +0 -1
  74. package/dist/hooks/session-start.js +0 -120
  75. package/dist/hooks/session-start.js.map +0 -1
  76. package/dist/src/audit.d.ts +0 -63
  77. package/dist/src/audit.d.ts.map +0 -1
  78. package/dist/src/audit.js +0 -229
  79. package/dist/src/audit.js.map +0 -1
  80. package/dist/src/cache.d.ts +0 -54
  81. package/dist/src/cache.d.ts.map +0 -1
  82. package/dist/src/cache.js +0 -167
  83. package/dist/src/cache.js.map +0 -1
  84. package/dist/src/config.d.ts +0 -52
  85. package/dist/src/config.d.ts.map +0 -1
  86. package/dist/src/config.js +0 -175
  87. package/dist/src/config.js.map +0 -1
  88. package/dist/src/entry.d.ts +0 -155
  89. package/dist/src/entry.d.ts.map +0 -1
  90. package/dist/src/entry.js +0 -469
  91. package/dist/src/entry.js.map +0 -1
  92. package/dist/src/errors.d.ts +0 -59
  93. package/dist/src/errors.d.ts.map +0 -1
  94. package/dist/src/errors.js +0 -111
  95. package/dist/src/errors.js.map +0 -1
  96. package/dist/src/frontmatter.d.ts +0 -28
  97. package/dist/src/frontmatter.d.ts.map +0 -1
  98. package/dist/src/frontmatter.js +0 -111
  99. package/dist/src/frontmatter.js.map +0 -1
  100. package/dist/src/index.d.ts +0 -35
  101. package/dist/src/index.d.ts.map +0 -1
  102. package/dist/src/index.js +0 -188
  103. package/dist/src/index.js.map +0 -1
  104. package/dist/src/maturity.d.ts +0 -39
  105. package/dist/src/maturity.d.ts.map +0 -1
  106. package/dist/src/maturity.js +0 -97
  107. package/dist/src/maturity.js.map +0 -1
  108. package/dist/src/quality.d.ts +0 -22
  109. package/dist/src/quality.d.ts.map +0 -1
  110. package/dist/src/quality.js +0 -232
  111. package/dist/src/quality.js.map +0 -1
  112. package/dist/src/search.d.ts +0 -35
  113. package/dist/src/search.d.ts.map +0 -1
  114. package/dist/src/search.js +0 -263
  115. package/dist/src/search.js.map +0 -1
  116. package/dist/src/similarity.d.ts +0 -42
  117. package/dist/src/similarity.d.ts.map +0 -1
  118. package/dist/src/similarity.js +0 -111
  119. package/dist/src/similarity.js.map +0 -1
  120. package/dist/src/stats.d.ts +0 -56
  121. package/dist/src/stats.d.ts.map +0 -1
  122. package/dist/src/stats.js +0 -196
  123. package/dist/src/stats.js.map +0 -1
  124. package/dist/src/templates.d.ts +0 -63
  125. package/dist/src/templates.d.ts.map +0 -1
  126. package/dist/src/templates.js +0 -347
  127. package/dist/src/templates.js.map +0 -1
  128. package/dist/src/transfer.d.ts +0 -92
  129. package/dist/src/transfer.d.ts.map +0 -1
  130. package/dist/src/transfer.js +0 -215
  131. package/dist/src/transfer.js.map +0 -1
  132. package/dist/src/types.d.ts +0 -270
  133. package/dist/src/types.d.ts.map +0 -1
  134. package/dist/src/types.js +0 -153
  135. package/dist/src/types.js.map +0 -1
  136. package/dist/src/validate.d.ts +0 -90
  137. package/dist/src/validate.d.ts.map +0 -1
  138. package/dist/src/validate.js +0 -295
  139. package/dist/src/validate.js.map +0 -1
  140. package/hooks/constants.ts +0 -25
  141. package/hooks/error-lookup.ts +0 -110
  142. package/hooks/post-task.ts +0 -309
  143. package/hooks/prompt-enrich.ts +0 -140
  144. package/hooks/session-start-cli.ts +0 -80
  145. package/hooks/session-start.ts +0 -143
  146. package/scripts/error-lookup.py +0 -64
  147. package/scripts/post-task.py +0 -60
  148. package/scripts/prompt-enrich.py +0 -64
  149. package/scripts/session-start.py +0 -64
@@ -6,7 +6,7 @@
6
6
  },
7
7
  "metadata": {
8
8
  "description": "Knowledge management plugins for Claude Code",
9
- "version": "1.0.5"
9
+ "version": "2.0.0-alpha.4"
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": "Auto-capture and retrieve project knowledge - solutions, patterns, gotchas, testing, docs, security, performance",
19
- "version": "1.0.5"
19
+ "version": "2.0.0-alpha.4"
20
20
  }
21
21
  ]
22
22
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "solvdex",
3
3
  "description": "Auto-capture and retrieve project knowledge - solutions, patterns, gotchas, testing, docs, security, performance",
4
- "version": "1.0.5",
4
+ "version": "2.0.0-alpha.4",
5
5
  "author": {
6
6
  "name": "duc.do",
7
7
  "email": "ducdm.dev.work@gmail.com"
package/README.md CHANGED
@@ -1,34 +1,61 @@
1
1
  # Solvdex
2
2
 
3
- [![Tests](https://img.shields.io/badge/tests-204%20passed-brightgreen)](./tests)
4
- [![Version](https://img.shields.io/badge/version-0.3.0-blue)](./package.json)
3
+ [![Tests](https://img.shields.io/badge/tests-passing-brightgreen)](./tests)
4
+ [![Version](https://img.shields.io/badge/version-2.0.0--alpha.3-blue)](./package.json)
5
5
  [![License](https://img.shields.io/badge/license-MIT-green)](./LICENSE)
6
- [![TypeScript](https://img.shields.io/badge/TypeScript-5.0-blue)](https://www.typescriptlang.org/)
6
+ [![Architecture](https://img.shields.io/badge/architecture-pure%20agent-purple)](./docs/schema.md)
7
7
 
8
8
  > **An index of solved problems.** A Claude Code plugin that auto-captures and retrieves project knowledge.
9
9
 
10
10
  ```
11
- ┌─────────────────────────────────────────────────────────────┐
12
- Error: ETIMEDOUT connecting to database
13
- ├─────────────────────────────────────────────────────────────┤
14
- 📚 Solvdex found a solution:
15
- "Database Connection Timeout"
16
- Confidence: 85
17
-
18
- Solution: Increase pool timeout in config...
19
- └─────────────────────────────────────────────────────────────┘
11
+ +-------------------------------------------------------------+
12
+ | Error: ETIMEDOUT connecting to database |
13
+ +-------------------------------------------------------------+
14
+ | Solvdex found a solution: |
15
+ | "Database Connection Timeout" |
16
+ | Confidence: 85 |
17
+ | |
18
+ | Solution: Increase pool timeout in config... |
19
+ +-------------------------------------------------------------+
20
20
  ```
21
21
 
22
22
  ## Features
23
23
 
24
24
  | Feature | Description |
25
25
  |---------|-------------|
26
- | 🔄 **Auto-Capture** | Saves solutions when errors are resolved |
27
- | 🔍 **Auto-Lookup** | Surfaces relevant knowledge on errors |
28
- | 📊 **7 Categories** | Organized knowledge across development domains |
29
- | 🎯 **Trigger Patterns** | Regex matching for automatic error detection |
30
- | 📈 **Confidence Tracking** | Trust scores with decay over time |
31
- | 🔗 **Cross-References** | Link related entries and source files |
26
+ | **Auto-Capture** | Saves solutions when errors are resolved |
27
+ | **Auto-Lookup** | Surfaces relevant knowledge on errors |
28
+ | **7 Categories** | Organized knowledge across development domains |
29
+ | **Trigger Patterns** | Regex matching for automatic error detection |
30
+ | **Confidence Tracking** | Trust scores with decay over time |
31
+ | **Cross-References** | Link related entries and source files |
32
+
33
+ ## Architecture
34
+
35
+ **Pure Agent Plugin - No Code Required**
36
+
37
+ Solvdex 2.0 uses a pure agent-based architecture. All logic is implemented in agent markdown files - no TypeScript compilation needed.
38
+
39
+ > **[View Architecture Diagram](./docs/diagrams/architecture-overview.md)**
40
+
41
+ | Layer | Components |
42
+ |-------|------------|
43
+ | **Skills (18)** | `/wiki search`, `/wiki add`, `/wiki health`, etc. |
44
+ | **Hooks** | SessionStart → wiki-advisor prompt, Stop → wiki-capture prompt |
45
+ | **Agents (8)** | wiki-searcher, wiki-capture, wiki-scanner, wiki-validator, wiki-stats, wiki-health, wiki-graph, wiki-duplicate |
46
+ | **Storage** | `.wiki/` with 7 categories |
47
+
48
+ ## Project Structure
49
+
50
+ ```
51
+ solvdex/
52
+ ├── agents/ # 8 specialized agents (ALL logic)
53
+ ├── skills/ # 18 Claude Code skills (thin wrappers)
54
+ ├── hooks/ # hooks.json (prompt-based hints)
55
+ ├── docs/ # Documentation
56
+ │ └── schema.md # Entry schema & constants (source of truth)
57
+ └── tests/ # Validation tests
58
+ ```
32
59
 
33
60
  ## Categories
34
61
 
@@ -80,6 +107,8 @@
80
107
  | `/wiki scan` | Generate stubs from project |
81
108
  | `/wiki flag <entry>` | Mark for review |
82
109
  | `/wiki fix <entry>` | Update flagged entry |
110
+ | `/wiki health` | Coverage gaps and health analysis |
111
+ | `/wiki graph` | Relationship diagrams |
83
112
 
84
113
  ### Transfer Commands
85
114
 
@@ -91,40 +120,48 @@
91
120
 
92
121
  ### Agents
93
122
 
94
- | Command | Description |
95
- |---------|-------------|
96
- | `/wiki explore <query>` | Deep multi-strategy search |
97
- | `/wiki capture` | Extract knowledge from conversation |
123
+ All logic is implemented by specialized agents:
124
+
125
+ | Agent | Commands | Description |
126
+ |-------|----------|-------------|
127
+ | `wiki-searcher` | `/wiki search`, `/wiki explore` | Search + recommendations |
128
+ | `wiki-capture` | `/wiki add`, `/wiki capture` | Knowledge extraction |
129
+ | `wiki-scanner` | `/wiki scan` | Project scanning |
130
+ | `wiki-validator` | `/wiki validate` | Quality checks |
131
+ | `wiki-stats` | `/wiki stats` | Analytics + maturity |
132
+ | `wiki-duplicate-checker` | (internal) | Prevent duplicates |
133
+ | `wiki-health` | `/wiki health` | Coverage gaps |
134
+ | `wiki-graph` | `/wiki graph` | Relationship diagrams |
98
135
 
99
136
  ## How It Works
100
137
 
101
138
  ### Automatic Knowledge Capture
102
139
 
103
140
  ```
104
- ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
105
- You solve │────▶│ Solvdex │────▶│ .wiki/
106
- an error detects saved!
107
- └──────────────┘ └──────────────┘ └──────────────┘
141
+ +--------------+ +--------------+ +--------------+
142
+ | You solve |---->| Solvdex |---->| .wiki/ |
143
+ | an error | | detects | | saved! |
144
+ +--------------+ +--------------+ +--------------+
108
145
 
109
146
  Signals detected:
110
- error_resolved issues/
111
- workaround gotchas/
112
- user confirms auto-detect category
113
- explicit save "remember this"
147
+ - error_resolved -> issues/
148
+ - workaround -> gotchas/
149
+ - user confirms -> auto-detect category
150
+ - explicit save -> "remember this"
114
151
  ```
115
152
 
116
153
  ### Automatic Knowledge Retrieval
117
154
 
118
155
  ```
119
- ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
120
- Error │────▶│ Solvdex │────▶│ Solution
121
- occurs matches displayed
122
- └──────────────┘ └──────────────┘ └──────────────┘
156
+ +--------------+ +--------------+ +--------------+
157
+ | Error |---->| Solvdex |---->| Solution |
158
+ | occurs | | matches | | displayed |
159
+ +--------------+ +--------------+ +--------------+
123
160
 
124
161
  Lookup triggers:
125
- Session start relevant context
126
- Error match trigger patterns
127
- Prompt keywords category detection
162
+ - Session start -> relevant context
163
+ - Error match -> trigger patterns
164
+ - Prompt keywords -> category detection
128
165
  ```
129
166
 
130
167
  ## Entry Format
@@ -150,7 +187,7 @@ Increase timeout and add connection pool...
150
187
  - `src/db/config.ts:45`
151
188
  ```
152
189
 
153
- > **Note:** Entries also include maturity tracking fields (`maturity`, `use_count`, `last_used`). See [Entry Maturity System](#entry-maturity-system) below.
190
+ > **Note:** For complete schema details including all fields, maturity levels, and constants, see [docs/schema.md](./docs/schema.md).
154
191
 
155
192
  ### Entry Maturity System
156
193
 
@@ -164,9 +201,9 @@ Solvdex automatically tracks and promotes entries through maturity phases based
164
201
 
165
202
  **Automatic Promotion:**
166
203
  - Entries start as `captured` when created
167
- - Maturity is evaluated automatically each time `recordEntryUsage()` is called
168
- - After 3 successful uses promoted to `verified`
169
- - After 10 uses AND 30+ days promoted to `validated`
204
+ - Maturity is evaluated automatically on each use
205
+ - After 3 successful uses: promoted to `verified`
206
+ - After 10 uses AND 30+ days: promoted to `validated`
170
207
  - Confidence scores update automatically with maturity
171
208
 
172
209
  **Safety Features:**
@@ -175,45 +212,26 @@ Solvdex automatically tracks and promotes entries through maturity phases based
175
212
  - Maturity only goes up (no demotion)
176
213
  - All promotions logged in audit trail
177
214
 
178
- **Example Entry:**
179
- ```yaml
180
- ---
181
- title: Fix Redis Connection Timeout
182
- maturity: verified
183
- confidence: 70
184
- use_count: 5
185
- last_used: 2025-01-23
186
- audit:
187
- - date: 2025-01-20
188
- action: created
189
- by: user
190
- - date: 2025-01-22
191
- action: maturity_promoted
192
- by: system
193
- context: "Auto-promoted: captured → verified (3 uses)"
194
- ---
195
- ```
196
-
197
215
  ## Confidence Scale
198
216
 
199
217
  | Score | Level | Meaning |
200
218
  |-------|-------|---------|
201
- | 90-100 | 🟢 High | Typically validated entries |
202
- | 60-89 | 🟡 Medium | Typically verified entries or manually set |
203
- | 0-59 | 🔴 Low | Typically captured entries or stubs |
219
+ | 90-100 | High | Typically validated entries |
220
+ | 60-89 | Medium | Typically verified entries or manually set |
221
+ | 0-59 | Low | Typically captured entries or stubs |
204
222
 
205
223
  Confidence auto-decays for entries unused for 90+ days.
206
224
 
207
- ## Hooks
225
+ ## Hooks (Prompt-Based)
226
+
227
+ Real-time integration with Claude Code via contextual prompts:
208
228
 
209
- Real-time integration with Claude Code:
229
+ | Hook | Suggests | When | Purpose |
230
+ |------|----------|------|---------|
231
+ | `SessionStart` | `wiki-advisor` | New conversation | Hint to check for relevant entries |
232
+ | `Stop` | `wiki-capture` | Task completes | Hint to capture valuable knowledge |
210
233
 
211
- | Hook | When | Action |
212
- |------|------|--------|
213
- | `SessionStart` | New conversation | Surface relevant entries |
214
- | `UserPromptSubmit` | Each prompt | Enrich with context |
215
- | `PostToolUseFailure` | Error occurs | Show matching solutions |
216
- | `Stop` | Task completes | Offer to capture knowledge |
234
+ Hooks are configured in `hooks/hooks.json` and provide prompt-based guidance to use wiki agents.
217
235
 
218
236
  ## Installation
219
237
 
@@ -222,8 +240,7 @@ Real-time integration with Claude Code:
222
240
  ```bash
223
241
  git clone https://github.com/ducdmdev/solvdex.git
224
242
  cd solvdex
225
- npm install
226
- npm run build
243
+ npm install # For running tests only
227
244
  ```
228
245
 
229
246
  ### Via Claude Code Marketplace
@@ -233,38 +250,27 @@ npm run build
233
250
  /plugin install solvdex
234
251
  ```
235
252
 
253
+ ## Development
254
+
255
+ ```bash
256
+ npm install # Install dependencies (for tests only)
257
+ npm test # Run validation tests
258
+ npm run test:watch # Watch mode
259
+ ```
260
+
236
261
  ## Documentation
237
262
 
238
263
  | Document | Description |
239
264
  |----------|-------------|
265
+ | [Schema Reference](./docs/schema.md) | Entry schema & constants (source of truth) |
240
266
  | [Getting Started](./docs/getting-started.md) | Quick setup guide |
241
267
  | [Architecture](./docs/architecture.md) | System design |
242
268
  | [Workflows](./docs/workflows.md) | Hook and skill flows |
243
269
  | [Use Cases](./docs/use-cases.md) | Common scenarios |
244
270
 
245
- ## Development
246
-
247
- ```bash
248
- npm install # Install dependencies
249
- npm run build # Compile TypeScript
250
- npm test # Run 204 tests
251
- npm run lint # Check code style
252
- ```
253
-
254
- ## Project Structure
255
-
256
- ```
257
- solvdex/
258
- ├── src/ # Core TypeScript library
259
- ├── skills/ # 16 Claude Code skills
260
- ├── hooks/ # 4 automated hooks
261
- ├── docs/ # Documentation
262
- └── tests/ # Test suite (204 tests)
263
- ```
264
-
265
271
  ## License
266
272
 
267
- MIT © [duc.do](https://github.com/ducdmdev)
273
+ MIT (c) [duc.do](https://github.com/ducdmdev)
268
274
 
269
275
  ---
270
276
 
@@ -0,0 +1,182 @@
1
+ ---
2
+ description: Extract problem/solution from conversation context and create wiki entry.
3
+ Smart categorization, duplicate checking, tag suggestions.
4
+ tools:
5
+ - Glob
6
+ - Read
7
+ - Write
8
+ ---
9
+
10
+ # Wiki Capture Agent
11
+
12
+ ## Schema Reference
13
+
14
+ For entry structure, validation rules, and constants, see: `docs/schema.md`
15
+
16
+ Key references:
17
+ - Entry frontmatter fields: `docs/schema.md#entry-frontmatter`
18
+ - Maturity rules: `docs/schema.md#maturity-rules`
19
+ - Confidence levels: `docs/schema.md#confidence-levels`
20
+ - Categories: `docs/schema.md#default-categories`
21
+
22
+ Intelligently extract problem and solution from conversation context to create a wiki entry.
23
+
24
+ ## Input
25
+
26
+ You will receive conversation context containing:
27
+ - Error messages or problem descriptions
28
+ - Solution steps or code fixes
29
+ - Verification that solution worked
30
+
31
+ Optional parameters:
32
+ - `mode: "auto-capture"` - Auto-capture from conversation (hook)
33
+ - `category: "<category>"` - Force specific category
34
+ - `title: "<title>"` - Force specific title
35
+
36
+ ## Process
37
+
38
+ ### Step 1: Extract Problem
39
+
40
+ Look for:
41
+ - Error messages: `Error:`, `Exception:`, `failed`, `timeout`
42
+ - Problem statements: "I'm trying to...", "It doesn't work when..."
43
+ - Stack traces or logs
44
+
45
+ Summarize in 1-3 sentences.
46
+
47
+ ### Step 2: Extract Solution
48
+
49
+ Look for:
50
+ - Code changes or fixes
51
+ - Configuration updates
52
+ - Commands that resolved the issue
53
+ - Explanation of what worked
54
+
55
+ Include relevant code snippets (max 20 lines).
56
+
57
+ ### Step 3: Check for Duplicates
58
+
59
+ **IMPORTANT: Always check before creating!**
60
+
61
+ 1. Search existing entries in detected category:
62
+ ```
63
+ Glob .wiki/<category>/*.md
64
+ ```
65
+
66
+ 2. Compare semantically:
67
+ - Title similarity (exact, partial, synonym)
68
+ - Tag overlap
69
+ - Content similarity
70
+
71
+ 3. If >80% similarity found:
72
+ ```
73
+ Similar entry exists: category/existing-entry.md
74
+ Consider updating it instead: /wiki fix category/existing-entry.md
75
+ ```
76
+ Do NOT create new entry.
77
+
78
+ 4. If 50-79% similarity:
79
+ ```
80
+ Related entry found: category/related-entry.md
81
+ Creating new entry and linking to related.
82
+ ```
83
+ Create entry with `related_entries` field.
84
+
85
+ ### Step 4: Determine Category
86
+
87
+ | Keywords/Context | Category |
88
+ |------------------|----------|
89
+ | Error, Exception, bug, fix, crash | issues |
90
+ | Pattern, approach, template, design | patterns |
91
+ | Warning, pitfall, gotcha, careful, avoid | gotchas |
92
+ | Test, mock, assert, spec, fixture | testing |
93
+ | Auth, permission, token, secret, security | security |
94
+ | Slow, optimize, cache, memory, performance | performance |
95
+ | Doc, readme, guide, documentation | docs |
96
+
97
+ ### Step 5: Generate Tags
98
+
99
+ **Reuse existing tags when possible!**
100
+
101
+ 1. Read existing tags from wiki:
102
+ ```
103
+ Grep "tags:" .wiki/**/*.md
104
+ ```
105
+
106
+ 2. Extract candidates from content:
107
+ - Technology names (go, typescript, postgres)
108
+ - Concepts (auth, api, database)
109
+ - Error types (timeout, null, parse)
110
+
111
+ 3. Prefer existing tags over new ones
112
+ 4. Limit to 3-5 most relevant
113
+
114
+ ### Step 6: Generate Title
115
+
116
+ Create a concise, descriptive title:
117
+ - Start with action verb if fix: "Fix Database Timeout"
118
+ - Be specific: "Redis Connection Pool Exhaustion" not "Database Error"
119
+ - Include technology: "TypeScript Generic Constraint Issue"
120
+ - Max 60 characters
121
+
122
+ ### Step 7: Create Entry
123
+
124
+ Write to `.wiki/<category>/<slug>.md`:
125
+
126
+ ```yaml
127
+ ---
128
+ title: Descriptive Title
129
+ created: YYYY-MM-DD
130
+ updated: YYYY-MM-DD
131
+ status: active
132
+ confidence: 40
133
+ maturity: captured
134
+ tags: [tag1, tag2, tag3]
135
+ trigger: "error pattern regex" # For issues category
136
+ use_count: 0
137
+ related_entries: # If found related entries
138
+ - category/related-entry.md
139
+ audit:
140
+ - date: YYYY-MM-DD
141
+ action: created
142
+ by: capture-agent
143
+ context: Auto-captured from conversation
144
+ ---
145
+
146
+ # Problem
147
+
148
+ <extracted problem description>
149
+
150
+ # Solution
151
+
152
+ <extracted solution with code>
153
+
154
+ # Verification
155
+
156
+ <how to verify it works, or "Verified in conversation">
157
+
158
+ # Related
159
+
160
+ - [[category/related-entry]] # If applicable
161
+ ```
162
+
163
+ ### Step 8: Return Confirmation
164
+
165
+ ```
166
+ Captured: category/entry-name.md
167
+ Title: Entry Title
168
+ Tags: tag1, tag2, tag3
169
+ Confidence: 40 (captured)
170
+
171
+ Edit: /wiki fix category/entry-name.md
172
+ ```
173
+
174
+ ## Important Rules
175
+
176
+ 1. **Always check duplicates first** - don't create redundant entries
177
+ 2. **Reuse existing tags** - maintain consistent tagging
178
+ 3. **Include code** - solutions need concrete examples
179
+ 4. **Keep it concise** - problem/solution should be scannable
180
+ 5. **Set confidence 40** - captured entries start at maturity baseline
181
+ 6. **Add trigger patterns** - for issues category, extract regex
182
+ 7. **Link related entries** - build the knowledge graph
@@ -0,0 +1,98 @@
1
+ ---
2
+ description: Check if a new entry would duplicate existing knowledge.
3
+ Uses semantic similarity, not just title matching.
4
+ tools:
5
+ - Glob
6
+ - Read
7
+ ---
8
+
9
+ # Wiki Duplicate Checker Agent
10
+
11
+ ## Schema Reference
12
+
13
+ For entry structure, validation rules, and constants, see: `docs/schema.md`
14
+
15
+ Key references:
16
+ - Entry frontmatter fields: `docs/schema.md#entry-frontmatter`
17
+ - Maturity rules: `docs/schema.md#maturity-rules`
18
+ - Confidence levels: `docs/schema.md#confidence-levels`
19
+ - Categories: `docs/schema.md#default-categories`
20
+
21
+ Detect potential duplicate entries before creation.
22
+
23
+ ## Input
24
+
25
+ ```json
26
+ {
27
+ "title": "Database Connection Timeout",
28
+ "tags": ["database", "timeout", "postgres"],
29
+ "category": "issues",
30
+ "contentSummary": "Fix for connection pool exhaustion..."
31
+ }
32
+ ```
33
+
34
+ ## Process
35
+
36
+ 1. Load existing entries in same category
37
+ 2. Compare semantically:
38
+ - Title similarity (exact, partial, synonym)
39
+ - Tag overlap (Jaccard similarity)
40
+ - Content overlap (key phrases)
41
+ 3. Calculate overall similarity score
42
+ 4. Determine if duplicate
43
+
44
+ ## Output Format
45
+
46
+ ### Duplicate Found
47
+ ```json
48
+ {
49
+ "isDuplicate": true,
50
+ "similarity": 85,
51
+ "matchedEntry": "issues/db-timeout.md",
52
+ "matchedTitle": "Database Timeout Fix",
53
+ "reason": "Very similar title and tags",
54
+ "suggestion": "Consider updating existing entry instead"
55
+ }
56
+ ```
57
+
58
+ ### No Duplicate
59
+ ```json
60
+ {
61
+ "isDuplicate": false,
62
+ "similarity": 20,
63
+ "closestMatch": "issues/connection-error.md",
64
+ "suggestion": "Safe to create new entry"
65
+ }
66
+ ```
67
+
68
+ ## Similarity Thresholds
69
+
70
+ | Score | Meaning | Action |
71
+ |-------|---------|--------|
72
+ | 80-100 | Likely duplicate | Block creation, suggest merge |
73
+ | 50-79 | Possibly related | Warn, suggest linking |
74
+ | 0-49 | Distinct | Allow creation |
75
+
76
+ ## Similarity Calculation
77
+
78
+ ### Title Similarity (40% weight)
79
+ - Exact match: 100
80
+ - Contains same words: 80
81
+ - Synonyms/related: 60
82
+ - Partial match: 40
83
+
84
+ ### Tag Overlap (30% weight)
85
+ - Jaccard index: |intersection| / |union|
86
+ - Score = Jaccard * 100
87
+
88
+ ### Content Overlap (30% weight)
89
+ - Key phrase matching
90
+ - Problem/solution similarity
91
+ - Technology overlap
92
+
93
+ ## Important Rules
94
+
95
+ 1. Be conservative - prefer false positives over duplicates
96
+ 2. Consider synonyms (e.g., "timeout" ≈ "connection timeout")
97
+ 3. Same category increases likelihood
98
+ 4. Different maturity levels can coexist (stub vs detailed)