bluera-knowledge 0.31.0 → 0.33.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.
- package/.claude-plugin/plugin.json +23 -0
- package/.mcp.json +13 -0
- package/CHANGELOG.md +42 -0
- package/NOTICE +47 -0
- package/README.md +2 -2
- package/bun.lock +1978 -0
- package/dist/{chunk-B335UOU7.js → chunk-3TB7TDVF.js} +24 -3
- package/dist/chunk-3TB7TDVF.js.map +1 -0
- package/dist/{chunk-KCI4U6FH.js → chunk-KDZDLJUY.js} +2 -2
- package/dist/{chunk-AEXFPA57.js → chunk-YDTTD53Y.js} +158 -26
- package/dist/chunk-YDTTD53Y.js.map +1 -0
- package/dist/index.js +3 -3
- package/dist/mcp/bootstrap.js +10 -0
- package/dist/mcp/bootstrap.js.map +1 -1
- package/dist/mcp/server.d.ts +5 -3
- package/dist/mcp/server.js +2 -2
- package/dist/workers/background-worker-cli.js +2 -2
- package/hooks/check-ready.sh +109 -0
- package/hooks/hooks.json +97 -0
- package/hooks/job-status-hook.sh +51 -0
- package/hooks/posttooluse-bk-reminder.py +126 -0
- package/hooks/posttooluse-web-research.py +209 -0
- package/hooks/posttooluse-websearch-bk.py +158 -0
- package/hooks/pretooluse-bk-suggest.py +296 -0
- package/hooks/skill-activation.py +221 -0
- package/hooks/skill-rules.json +131 -0
- package/package.json +9 -2
- package/scripts/CLAUDE.md +65 -0
- package/scripts/auto-setup.sh +65 -0
- package/scripts/bench-regression.sh +345 -0
- package/scripts/dev.sh +16 -0
- package/scripts/doctor.sh +103 -0
- package/scripts/download-models.ts +188 -0
- package/scripts/export-web-store.ts +142 -0
- package/scripts/lib/mock-server.sh +70 -0
- package/scripts/mcp-wrapper.sh +91 -0
- package/scripts/setup.sh +224 -0
- package/scripts/statusline-module.sh +29 -0
- package/scripts/test-mcp-dev.js +260 -0
- package/scripts/validate-local.sh +412 -0
- package/scripts/validate-npm-release.sh +406 -0
- package/skills/add-folder/SKILL.md +48 -0
- package/skills/add-repo/SKILL.md +50 -0
- package/skills/advanced-workflows/SKILL.md +273 -0
- package/skills/cancel/SKILL.md +63 -0
- package/skills/check-status/SKILL.md +130 -0
- package/skills/crawl/SKILL.md +61 -0
- package/skills/doctor/SKILL.md +27 -0
- package/skills/eval/SKILL.md +222 -0
- package/skills/health/SKILL.md +72 -0
- package/skills/index/SKILL.md +48 -0
- package/skills/knowledge-search/SKILL.md +110 -0
- package/skills/remove-store/SKILL.md +52 -0
- package/skills/search/SKILL.md +80 -0
- package/skills/search/search.sh +63 -0
- package/skills/search-optimization/SKILL.md +199 -0
- package/skills/search-optimization/references/mistakes.md +21 -0
- package/skills/search-optimization/references/strategies.md +80 -0
- package/skills/skill-activation/SKILL.md +131 -0
- package/skills/statusline/SKILL.md +19 -0
- package/skills/store-lifecycle/SKILL.md +470 -0
- package/skills/stores/SKILL.md +54 -0
- package/skills/suggest/SKILL.md +118 -0
- package/skills/sync/SKILL.md +96 -0
- package/skills/test-plugin/SKILL.md +547 -0
- package/skills/uninstall/SKILL.md +65 -0
- package/skills/when-to-query/SKILL.md +160 -0
- package/dist/chunk-AEXFPA57.js.map +0 -1
- package/dist/chunk-B335UOU7.js.map +0 -1
- /package/dist/{chunk-KCI4U6FH.js.map → chunk-KDZDLJUY.js.map} +0 -0
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Evaluate agent quality across three modes — without BK, BK grep-only, and BK full
|
|
3
|
+
argument-hint: "[query | --predefined | --predefined N]"
|
|
4
|
+
allowed-tools: ["mcp__bluera-knowledge__execute", "mcp__bluera-knowledge__search", "mcp__bluera-knowledge__get_full_context", "Read", "Grep", "Glob", "WebSearch", "Bash"]
|
|
5
|
+
context: fork
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Agent Quality Evaluation
|
|
9
|
+
|
|
10
|
+
Compare how well Claude answers library questions across three access levels.
|
|
11
|
+
|
|
12
|
+
For each query, three agents run in parallel:
|
|
13
|
+
- **Without BK** — uses only web search and training knowledge
|
|
14
|
+
- **BK Grep** — can Grep/Read/Glob the cloned source repos but has no vector search
|
|
15
|
+
- **BK Full** — uses BK vector search + get_full_context + Grep/Read (all BK tools)
|
|
16
|
+
|
|
17
|
+
Then score all three answers on accuracy, specificity, completeness, and source grounding.
|
|
18
|
+
|
|
19
|
+
## Arguments
|
|
20
|
+
|
|
21
|
+
Parse `$ARGUMENTS`:
|
|
22
|
+
|
|
23
|
+
- **No arguments or empty**: Show usage help
|
|
24
|
+
- **Quoted string** (not starting with `--`): Arbitrary query mode — run eval for that single question
|
|
25
|
+
- **`--predefined`**: Run all predefined queries (skip any whose stores are not indexed)
|
|
26
|
+
- **`--predefined N`**: Run predefined query #N only (1-based index)
|
|
27
|
+
|
|
28
|
+
If no arguments provided, show:
|
|
29
|
+
```
|
|
30
|
+
Usage:
|
|
31
|
+
/bluera-knowledge:eval "How does Express handle errors?" # Arbitrary query
|
|
32
|
+
/bluera-knowledge:eval --predefined # Run all predefined queries
|
|
33
|
+
/bluera-knowledge:eval --predefined 3 # Run predefined query #3
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Step 1: Prerequisites Check
|
|
37
|
+
|
|
38
|
+
1. Call MCP `execute` with `{ command: "stores" }` to list indexed stores
|
|
39
|
+
2. If no stores are indexed, show error and abort:
|
|
40
|
+
```
|
|
41
|
+
No knowledge stores indexed. Add at least one library first:
|
|
42
|
+
/bluera-knowledge:add-repo https://github.com/expressjs/express --name express
|
|
43
|
+
```
|
|
44
|
+
3. Record the list of available store names — you'll pass these to the BK Full agent
|
|
45
|
+
4. Build a `STORE_PATHS` mapping from the store response: for each store with a `path` field, record `- **<name>**: \`<path>\`` (one per line, as a markdown list). This gets passed to the BK Grep agent.
|
|
46
|
+
|
|
47
|
+
## Step 2: Resolve Queries
|
|
48
|
+
|
|
49
|
+
### Predefined mode (`--predefined`)
|
|
50
|
+
|
|
51
|
+
1. Read the predefined queries file: `$CLAUDE_PLUGIN_ROOT/evals/agent-quality/queries/predefined.yaml`
|
|
52
|
+
2. Parse the YAML content
|
|
53
|
+
3. For each query, check if ANY of its `store_hint` values match an available store name
|
|
54
|
+
4. Split into **runnable** (store available) and **skipped** (store not available) lists
|
|
55
|
+
5. If `--predefined N` was specified, select only query at index N from the full list (skip if store not available)
|
|
56
|
+
6. If no queries are runnable, show what stores to add and abort
|
|
57
|
+
|
|
58
|
+
### Arbitrary mode (bare query string)
|
|
59
|
+
|
|
60
|
+
1. Use the raw query string as the question
|
|
61
|
+
2. Set `expected_topics` and `anti_patterns` to empty lists
|
|
62
|
+
3. Set `id` to "arbitrary", `category` to "general", `difficulty` to "unknown"
|
|
63
|
+
|
|
64
|
+
## Step 3: Load Templates
|
|
65
|
+
|
|
66
|
+
Read these files from `$CLAUDE_PLUGIN_ROOT/evals/agent-quality/templates/`:
|
|
67
|
+
|
|
68
|
+
1. `without-bk-agent.md` — instructions for the baseline agent
|
|
69
|
+
2. `bk-grep-agent.md` — instructions for the BK Grep agent
|
|
70
|
+
3. `with-bk-agent.md` — instructions for the BK Full agent
|
|
71
|
+
4. `judge.md` — grading rubric
|
|
72
|
+
|
|
73
|
+
## Step 4: Run Eval (for each query)
|
|
74
|
+
|
|
75
|
+
### Spawn ALL THREE agents in parallel (same turn, three Task tool calls)
|
|
76
|
+
|
|
77
|
+
**Without-BK agent** — Use the Task tool with `subagent_type: "general-purpose"`:
|
|
78
|
+
- Take the content from `without-bk-agent.md`
|
|
79
|
+
- Replace `{{QUESTION}}` with the actual question
|
|
80
|
+
- Send as the task prompt
|
|
81
|
+
|
|
82
|
+
**BK Grep agent** — Use the Task tool with `subagent_type: "general-purpose"`:
|
|
83
|
+
- Take the content from `bk-grep-agent.md`
|
|
84
|
+
- Replace `{{QUESTION}}` with the actual question
|
|
85
|
+
- Replace `{{STORE_PATHS}}` with the store name-to-path mapping built in Step 1
|
|
86
|
+
- Send as the task prompt
|
|
87
|
+
|
|
88
|
+
**BK Full agent** — Use the Task tool with `subagent_type: "general-purpose"`:
|
|
89
|
+
- Take the content from `with-bk-agent.md`
|
|
90
|
+
- Replace `{{QUESTION}}` with the actual question
|
|
91
|
+
- Replace `{{STORES}}` with the list of available store names (one per line, as a markdown list)
|
|
92
|
+
- Send as the task prompt
|
|
93
|
+
|
|
94
|
+
Wait for all three agents to complete.
|
|
95
|
+
|
|
96
|
+
### Capture Token Usage
|
|
97
|
+
|
|
98
|
+
From each Task tool response, parse the `<usage>` block to extract:
|
|
99
|
+
- `total_tokens` — the total tokens consumed by the agent
|
|
100
|
+
- `duration_ms` — wall-clock time for the agent
|
|
101
|
+
|
|
102
|
+
If usage data is not available in a Task response, show "N/A" for that agent.
|
|
103
|
+
|
|
104
|
+
### Judge the results
|
|
105
|
+
|
|
106
|
+
Using the rubric from `judge.md`, evaluate all three answers yourself:
|
|
107
|
+
|
|
108
|
+
1. Read all three agent responses
|
|
109
|
+
2. For each answer, score all 4 criteria (1-5):
|
|
110
|
+
- **Factual Accuracy**: Are the claims correct?
|
|
111
|
+
- **Specificity**: Does it cite specific files, functions, code?
|
|
112
|
+
- **Completeness**: Does it cover the full answer?
|
|
113
|
+
- **Source Grounding**: Are claims backed by evidence?
|
|
114
|
+
3. If the query has `expected_topics`, check which answers mention each topic
|
|
115
|
+
4. If the query has `anti_patterns`, flag if any answer makes those claims
|
|
116
|
+
5. Calculate totals (max 20 each), determine winner and deltas
|
|
117
|
+
|
|
118
|
+
## Step 5: Output Results
|
|
119
|
+
|
|
120
|
+
### Single query output (arbitrary or `--predefined N`)
|
|
121
|
+
|
|
122
|
+
Show the full comparison:
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
## Eval: "<question>"
|
|
126
|
+
|
|
127
|
+
| Criterion | Without BK | BK Grep | BK Full |
|
|
128
|
+
|-------------------|:----------:|:-------:|:-------:|
|
|
129
|
+
| Accuracy | X | X | X |
|
|
130
|
+
| Specificity | X | X | X |
|
|
131
|
+
| Completeness | X | X | X |
|
|
132
|
+
| Source Grounding | X | X | X |
|
|
133
|
+
| **Total** | **X** | **X** | **X** |
|
|
134
|
+
|
|
135
|
+
| Usage | Without BK | BK Grep | BK Full |
|
|
136
|
+
|-------------------|:----------:|:-------:|:-------:|
|
|
137
|
+
| Tokens | X,XXX | X,XXX | X,XXX |
|
|
138
|
+
| Duration (s) | X.X | X.X | X.X |
|
|
139
|
+
|
|
140
|
+
**Winner:** [BK Full | BK Grep | Without BK | Tie] ([significant | marginal | none])
|
|
141
|
+
**Key Difference:** [One sentence explaining the most important quality gap]
|
|
142
|
+
**Grep vs Full:** [One sentence on whether vector search outperformed manual grep, and if so how]
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
If expected topics were provided:
|
|
146
|
+
```
|
|
147
|
+
### Expected Topics
|
|
148
|
+
- [x] topic covered by all three
|
|
149
|
+
- [x] topic covered by BK Full + BK Grep only
|
|
150
|
+
- [x] topic covered by BK Full only
|
|
151
|
+
- [ ] topic missed by all
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Multi-query output (`--predefined`)
|
|
155
|
+
|
|
156
|
+
Show a summary row per query, then aggregate:
|
|
157
|
+
|
|
158
|
+
```
|
|
159
|
+
## Agent Quality Eval Summary
|
|
160
|
+
|
|
161
|
+
Ran X/8 queries (Y skipped — stores not indexed)
|
|
162
|
+
|
|
163
|
+
| # | Query | Difficulty | w/o BK | Grep | Full | Winner | Delta |
|
|
164
|
+
|---|-------|:----------:|:------:|:----:|:----:|--------|-------|
|
|
165
|
+
| 1 | query-id | medium | 9/20 | 15/20 | 19/20 | Full | significant |
|
|
166
|
+
| 2 | query-id | easy | 14/20 | 17/20 | 18/20 | Full | marginal |
|
|
167
|
+
| ... |
|
|
168
|
+
|
|
169
|
+
### Token Usage
|
|
170
|
+
|
|
171
|
+
| # | Query | w/o BK tokens | Grep tokens | Full tokens |
|
|
172
|
+
|---|-------|:-------------:|:-----------:|:-----------:|
|
|
173
|
+
| 1 | query-id | 2,340 | 8,120 | 5,670 |
|
|
174
|
+
| 2 | query-id | 1,890 | 6,450 | 4,230 |
|
|
175
|
+
| ... |
|
|
176
|
+
|
|
177
|
+
### Aggregate
|
|
178
|
+
- **Without BK mean:** X.X/20 (avg X,XXX tokens)
|
|
179
|
+
- **BK Grep mean:** X.X/20 (avg X,XXX tokens)
|
|
180
|
+
- **BK Full mean:** X.X/20 (avg X,XXX tokens)
|
|
181
|
+
- **Full vs Without:** +X.X points (+XX%)
|
|
182
|
+
- **Full vs Grep:** +X.X points (+XX%)
|
|
183
|
+
- **Grep vs Without:** +X.X points (+XX%)
|
|
184
|
+
- **Full win rate:** X/X (XX%)
|
|
185
|
+
- **Significant wins (Full):** X
|
|
186
|
+
|
|
187
|
+
### By Category
|
|
188
|
+
| Category | w/o BK | Grep | Full | Full delta |
|
|
189
|
+
|----------|:------:|:----:|:----:|------------|
|
|
190
|
+
| implementation | X.X | X.X | X.X | +X.X |
|
|
191
|
+
| api | X.X | X.X | X.X | +X.X |
|
|
192
|
+
|
|
193
|
+
### By Difficulty
|
|
194
|
+
| Difficulty | w/o BK | Grep | Full | Full delta |
|
|
195
|
+
|------------|:------:|:----:|:----:|------------|
|
|
196
|
+
| easy | X.X | X.X | X.X | +X.X |
|
|
197
|
+
| medium | X.X | X.X | X.X | +X.X |
|
|
198
|
+
| hard | X.X | X.X | X.X | +X.X |
|
|
199
|
+
|
|
200
|
+
### Token Efficiency
|
|
201
|
+
| Agent | Mean Score | Mean Tokens | Score/1K Tokens |
|
|
202
|
+
|-------|:----------:|:-----------:|:---------------:|
|
|
203
|
+
| Without BK | X.X | X,XXX | X.XX |
|
|
204
|
+
| BK Grep | X.X | X,XXX | X.XX |
|
|
205
|
+
| BK Full | X.X | X,XXX | X.XX |
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
If any queries were skipped:
|
|
209
|
+
```
|
|
210
|
+
### Skipped (store not indexed)
|
|
211
|
+
- vue-reactivity-tracking — add with: /bluera-knowledge:add-repo https://github.com/vuejs/core --name vue
|
|
212
|
+
- fastapi-dependency-injection — add with: /bluera-knowledge:add-repo https://github.com/fastapi/fastapi --name fastapi
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## Important Notes
|
|
216
|
+
|
|
217
|
+
- Each query spawns 3 subagents. For `--predefined` with 8 queries, that's up to 24 agent runs. Process one query at a time (but spawn all three agents for each query in parallel).
|
|
218
|
+
- The without-BK agent may use WebSearch — this is intentional. We're comparing against "the best Claude can do without BK."
|
|
219
|
+
- The BK Grep agent may NOT use WebSearch. It tests what an agent can discover by exploring raw source code, to isolate the value of vector search.
|
|
220
|
+
- Scoring is somewhat subjective. The value is in the comparison (relative scores) rather than absolute numbers. Look at the delta and key differences.
|
|
221
|
+
- The Token Efficiency table reveals cost-effectiveness: if BK Grep achieves similar scores to BK Full with fewer tokens, it suggests vector search isn't adding much for that query type.
|
|
222
|
+
- For arbitrary queries without expected topics, grading relies entirely on the 4 general criteria. This is fine — it still reveals whether BK adds value.
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Check health of all stores (path existence, model compatibility)
|
|
3
|
+
allowed-tools: ["mcp__bluera-knowledge__execute"]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Store Health Check
|
|
7
|
+
|
|
8
|
+
Diagnose issues with knowledge stores: missing paths, schema migrations, model mismatches.
|
|
9
|
+
|
|
10
|
+
## Steps
|
|
11
|
+
|
|
12
|
+
1. Use the mcp__bluera-knowledge__execute tool with command "stores:health" to check all stores
|
|
13
|
+
|
|
14
|
+
2. Present results grouped by status:
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
## Store Health Report
|
|
18
|
+
|
|
19
|
+
### Errors (require action)
|
|
20
|
+
| Store | Type | Issue | Fix |
|
|
21
|
+
|-------|------|-------|-----|
|
|
22
|
+
| my-repo | repo | Path not found | Re-create store or fix projectRoot |
|
|
23
|
+
|
|
24
|
+
### Warnings (recommended action)
|
|
25
|
+
| Store | Type | Issue | Fix |
|
|
26
|
+
|-------|------|-------|-----|
|
|
27
|
+
| old-docs | web | Schema v1 | Run: /bluera-knowledge:index old-docs |
|
|
28
|
+
|
|
29
|
+
### Healthy
|
|
30
|
+
- react-docs (web)
|
|
31
|
+
- lodash (repo)
|
|
32
|
+
|
|
33
|
+
**Summary**: 2 healthy, 1 warning, 1 error
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Exit Codes
|
|
37
|
+
|
|
38
|
+
The health check returns an exit code for scripting:
|
|
39
|
+
|
|
40
|
+
| Exit Code | Meaning |
|
|
41
|
+
|-----------|---------|
|
|
42
|
+
| 0 | All stores healthy |
|
|
43
|
+
| 1 | At least one store has an error (path not found) |
|
|
44
|
+
| 2 | No errors, but at least one warning (model/schema issue) |
|
|
45
|
+
|
|
46
|
+
## Issue Types
|
|
47
|
+
|
|
48
|
+
### PATH_NOT_FOUND (Error)
|
|
49
|
+
The store's source path no longer exists. This happens when:
|
|
50
|
+
- A local folder was deleted or moved
|
|
51
|
+
- The project was relocated and paths weren't updated
|
|
52
|
+
- A cloned repo directory was removed
|
|
53
|
+
|
|
54
|
+
**Fix**: Re-create the store or update the projectRoot setting.
|
|
55
|
+
|
|
56
|
+
### SCHEMA_V1 (Warning)
|
|
57
|
+
The store was created before model tracking was added. It needs to be re-indexed to be searchable.
|
|
58
|
+
|
|
59
|
+
**Fix**: Run `/bluera-knowledge:index <store-name>`
|
|
60
|
+
|
|
61
|
+
### MODEL_MISMATCH (Warning)
|
|
62
|
+
The store was indexed with a different embedding model than the current configuration.
|
|
63
|
+
|
|
64
|
+
**Fix**: Run `/bluera-knowledge:index <store-name>` to re-index with the current model.
|
|
65
|
+
|
|
66
|
+
## Check Single Store
|
|
67
|
+
|
|
68
|
+
To check a specific store only:
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
stores:health --store=<store-name>
|
|
72
|
+
```
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Re-index a knowledge store
|
|
3
|
+
argument-hint: "[store-name-or-id]"
|
|
4
|
+
allowed-tools: ["mcp__bluera-knowledge__execute"]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Re-index Knowledge Store
|
|
8
|
+
|
|
9
|
+
Re-index a knowledge store: **$ARGUMENTS**
|
|
10
|
+
|
|
11
|
+
## Steps
|
|
12
|
+
|
|
13
|
+
1. Parse the store name or ID from $ARGUMENTS (required)
|
|
14
|
+
|
|
15
|
+
2. Use mcp__bluera-knowledge__execute tool with command "store:index":
|
|
16
|
+
- args.store: The store name or ID from $ARGUMENTS
|
|
17
|
+
|
|
18
|
+
3. Display results showing job ID for background indexing:
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
✓ Indexing store: react...
|
|
22
|
+
🔄 Indexing started in background
|
|
23
|
+
Job ID: job_def456ghi789
|
|
24
|
+
|
|
25
|
+
Check status with: /bluera-knowledge:check-status job_def456ghi789
|
|
26
|
+
Or view all jobs: /bluera-knowledge:check-status
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## When to Re-index
|
|
30
|
+
|
|
31
|
+
Re-index a store when:
|
|
32
|
+
- The source repository has been updated (for repo stores)
|
|
33
|
+
- Files have been added or modified (for file stores)
|
|
34
|
+
- You want to refresh embeddings with an updated model
|
|
35
|
+
- Search results seem out of date
|
|
36
|
+
|
|
37
|
+
## Error Handling
|
|
38
|
+
|
|
39
|
+
If indexing fails:
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
✗ Failed to index store: [error message]
|
|
43
|
+
|
|
44
|
+
Common issues:
|
|
45
|
+
- Store name or ID not found - use /bluera-knowledge:stores to list available stores
|
|
46
|
+
- Source directory no longer exists (for file stores)
|
|
47
|
+
- Network issues pulling latest changes (for repo stores)
|
|
48
|
+
```
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: knowledge-search
|
|
3
|
+
description: Query BK for library internals via vector search or direct Grep/Read
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Using Bluera Knowledge (BK)
|
|
7
|
+
|
|
8
|
+
BK provides access to **definitive library sources** for your project dependencies.
|
|
9
|
+
|
|
10
|
+
## The Rule: Query BK for External Code
|
|
11
|
+
|
|
12
|
+
**Any question about libraries, dependencies, or indexed reference material should query BK.**
|
|
13
|
+
|
|
14
|
+
BK is:
|
|
15
|
+
- **Cheap**: ~100ms response, unlimited queries, no rate limits
|
|
16
|
+
- **Authoritative**: Actual source code, not blog posts or training data
|
|
17
|
+
- **Complete**: Includes tests, examples, internal APIs, configuration
|
|
18
|
+
|
|
19
|
+
## Always Query BK For:
|
|
20
|
+
|
|
21
|
+
**Library implementation:**
|
|
22
|
+
- "How does Express handle middleware errors?"
|
|
23
|
+
- "What does React's useEffect cleanup actually do?"
|
|
24
|
+
- "How is Pydantic validation implemented?"
|
|
25
|
+
|
|
26
|
+
**API signatures and options:**
|
|
27
|
+
- "What parameters does axios.create() accept?"
|
|
28
|
+
- "What options can I pass to hono.use()?"
|
|
29
|
+
- "What's the signature of zod.object()?"
|
|
30
|
+
|
|
31
|
+
**Error handling:**
|
|
32
|
+
- "What errors can this library throw?"
|
|
33
|
+
- "Why might this function return undefined?"
|
|
34
|
+
- "What validation does Zod perform?"
|
|
35
|
+
|
|
36
|
+
**Version-specific behavior:**
|
|
37
|
+
- "What changed in React 18?"
|
|
38
|
+
- "Is this deprecated in Express 5?"
|
|
39
|
+
- "Does my version support this?"
|
|
40
|
+
|
|
41
|
+
**Configuration:**
|
|
42
|
+
- "What config options exist for Vite?"
|
|
43
|
+
- "What are the default values?"
|
|
44
|
+
- "What environment variables does this use?"
|
|
45
|
+
|
|
46
|
+
**Testing:**
|
|
47
|
+
- "How do the library authors test this?"
|
|
48
|
+
- "How should I mock this in tests?"
|
|
49
|
+
- "What edge cases do the tests cover?"
|
|
50
|
+
|
|
51
|
+
**Performance:**
|
|
52
|
+
- "Is this cached internally?"
|
|
53
|
+
- "What's the complexity of this operation?"
|
|
54
|
+
- "Does this run async or sync?"
|
|
55
|
+
|
|
56
|
+
**Security:**
|
|
57
|
+
- "How does this validate input?"
|
|
58
|
+
- "Is this safe against injection?"
|
|
59
|
+
- "How are credentials handled?"
|
|
60
|
+
|
|
61
|
+
**Integration:**
|
|
62
|
+
- "How do I integrate X with Y?"
|
|
63
|
+
- "What's the idiomatic usage pattern?"
|
|
64
|
+
- "How do examples in the library do this?"
|
|
65
|
+
|
|
66
|
+
## Two Ways to Access Library Sources
|
|
67
|
+
|
|
68
|
+
### 1. Vector Search (Discovery)
|
|
69
|
+
Find concepts and patterns across indexed content:
|
|
70
|
+
```
|
|
71
|
+
search("vue reactivity system")
|
|
72
|
+
/bluera-knowledge:search "pydantic custom validators"
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### 2. Direct File Access (Precision)
|
|
76
|
+
Precise lookups in cloned library source:
|
|
77
|
+
```
|
|
78
|
+
Grep: pattern="defineReactive" path=".bluera/bluera-knowledge/repos/vue/"
|
|
79
|
+
Read: .bluera/bluera-knowledge/repos/pydantic/pydantic/validators.py
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Both are valid! Use vector search for discovery, Grep/Read for specific functions.
|
|
83
|
+
|
|
84
|
+
## DO NOT Query BK For:
|
|
85
|
+
|
|
86
|
+
- **Your project code** → Use Grep/Read directly
|
|
87
|
+
- **General concepts** → Use training data ("What is a closure?")
|
|
88
|
+
- **Breaking news** → Use web search ("Latest React release")
|
|
89
|
+
|
|
90
|
+
## Example Workflow
|
|
91
|
+
|
|
92
|
+
User: "How does Vue's computed properties work internally?"
|
|
93
|
+
|
|
94
|
+
Claude:
|
|
95
|
+
1. Check stores: `list_stores` MCP tool → vue store exists
|
|
96
|
+
2. Vector search: `search("vue computed properties")` → finds computed.ts
|
|
97
|
+
3. Read file: `.bluera/bluera-knowledge/repos/vue/packages/reactivity/src/computed.ts`
|
|
98
|
+
4. Grep for implementation: pattern="class ComputedRefImpl"
|
|
99
|
+
5. Explain with authoritative source code examples
|
|
100
|
+
|
|
101
|
+
## Quick Reference
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
[library] question → Query BK
|
|
105
|
+
[your code] question → Grep/Read directly
|
|
106
|
+
[concept] question → Training data
|
|
107
|
+
[news/updates] question → Web search
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
BK is cheap and fast. Query it liberally for library questions.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Delete a knowledge store and all associated data
|
|
3
|
+
argument-hint: "[store-name-or-id]"
|
|
4
|
+
allowed-tools: ["mcp__bluera-knowledge__execute"]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Remove Knowledge Store
|
|
8
|
+
|
|
9
|
+
Delete a knowledge store and all associated data: **$ARGUMENTS**
|
|
10
|
+
|
|
11
|
+
## Steps
|
|
12
|
+
|
|
13
|
+
1. Parse the store name or ID from $ARGUMENTS (required)
|
|
14
|
+
- If no store provided, show error and suggest using /bluera-knowledge:stores to list available stores
|
|
15
|
+
|
|
16
|
+
2. Use mcp__bluera-knowledge__execute tool with command "store:delete":
|
|
17
|
+
- args.store: The store name or ID from $ARGUMENTS
|
|
18
|
+
|
|
19
|
+
3. Display deletion result:
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
Store "react" deleted successfully.
|
|
23
|
+
|
|
24
|
+
Removed:
|
|
25
|
+
- Store registry entry
|
|
26
|
+
- LanceDB search index
|
|
27
|
+
- Cloned repository files (for repo stores)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## What Gets Deleted
|
|
31
|
+
|
|
32
|
+
When you remove a store:
|
|
33
|
+
- **Registry entry** - Store is removed from the list
|
|
34
|
+
- **Search index** - LanceDB vector embeddings are dropped
|
|
35
|
+
- **Cloned files** - For repo stores created from URLs, the cloned repository is deleted
|
|
36
|
+
|
|
37
|
+
## Warning
|
|
38
|
+
|
|
39
|
+
This action is **permanent**. The store and all indexed data will be deleted.
|
|
40
|
+
To re-create, you'll need to add and re-index the source again.
|
|
41
|
+
|
|
42
|
+
## Error Handling
|
|
43
|
+
|
|
44
|
+
If store not found:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
Store not found: nonexistent-store
|
|
48
|
+
|
|
49
|
+
Available stores:
|
|
50
|
+
- Use /bluera-knowledge:stores to list all stores
|
|
51
|
+
- Check spelling of store name or ID
|
|
52
|
+
```
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Search indexed library sources
|
|
3
|
+
argument-hint: "[query] [--stores names] [--limit N] [--mode vector|fts|hybrid] [--detail minimal|contextual|full] [--threshold 0-1] [--min-relevance 0-1]"
|
|
4
|
+
allowed-tools: ["mcp__bluera-knowledge__search"]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Search Knowledge Stores
|
|
8
|
+
|
|
9
|
+
Search indexed library sources for: **$ARGUMENTS**
|
|
10
|
+
|
|
11
|
+
## Steps
|
|
12
|
+
|
|
13
|
+
1. Parse the query from $ARGUMENTS:
|
|
14
|
+
- Extract the search query (required)
|
|
15
|
+
- Extract --stores parameter (optional, comma-separated store names)
|
|
16
|
+
- Extract --limit parameter (optional, default 10)
|
|
17
|
+
- Extract --mode parameter (optional: vector, fts, hybrid; default hybrid)
|
|
18
|
+
- Extract --detail parameter (optional: minimal, contextual, full; default minimal)
|
|
19
|
+
- Extract --threshold parameter (optional, 0-1 range for normalized score filtering)
|
|
20
|
+
- Extract --min-relevance parameter (optional, 0-1 range for raw cosine similarity filtering)
|
|
21
|
+
|
|
22
|
+
2. Call mcp__bluera-knowledge__search with:
|
|
23
|
+
- query: The search query string
|
|
24
|
+
- stores: Array of store names (if --stores specified)
|
|
25
|
+
- limit: Number of results (if --limit specified, default 10)
|
|
26
|
+
- mode: Search mode (if --mode specified, default "hybrid")
|
|
27
|
+
- detail: Detail level (if --detail specified, default "minimal")
|
|
28
|
+
- threshold: Minimum normalized score (if --threshold specified)
|
|
29
|
+
- minRelevance: Minimum raw cosine similarity (if --min-relevance specified)
|
|
30
|
+
- intent: "find-implementation"
|
|
31
|
+
|
|
32
|
+
3. Format and display results with rich context:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
## Search Results: "query" (hybrid search)
|
|
36
|
+
|
|
37
|
+
**1. [Score: 0.95] [Vector+FTS]**
|
|
38
|
+
Store: claude-code
|
|
39
|
+
File: 📄 path/to/file.ts
|
|
40
|
+
Purpose: → Purpose description here
|
|
41
|
+
Top Terms: 🔑 (in this chunk): concept1, concept2, concept3
|
|
42
|
+
Imports: 📦 (in this chunk): package1, package2
|
|
43
|
+
|
|
44
|
+
**2. [Score: 0.87] [Vector]**
|
|
45
|
+
Store: another-store
|
|
46
|
+
File: 📄 path/to/file.js
|
|
47
|
+
Purpose: → Another purpose here
|
|
48
|
+
Top Terms: 🔑 (in this chunk): other-concept
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
**Found 10 results in 45ms**
|
|
52
|
+
|
|
53
|
+
💡 **Next Steps:**
|
|
54
|
+
- Read file: `Read /path/to/file.ts`
|
|
55
|
+
- Get full code: `mcp__bluera-knowledge__get_full_context("result-id")`
|
|
56
|
+
- Refine search: Use keywords above
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Formatting rules:**
|
|
60
|
+
- Header: `## Search Results: "query" (mode search)` - Extract mode from response (vector/fts/hybrid)
|
|
61
|
+
- Each result on its own block with blank line between
|
|
62
|
+
- Result header: `**N. [Score: X.XX]**`
|
|
63
|
+
- Store: `Store: storeName`
|
|
64
|
+
- File: `File: 📄 filename` (from summary.location, strip repoRoot prefix)
|
|
65
|
+
- Purpose: `Purpose: → purpose text` (from summary.purpose)
|
|
66
|
+
- Footer: `**Found {{totalResults}} results in {{timeMs}}ms**` with separator line above
|
|
67
|
+
|
|
68
|
+
4. For the footer next steps, include:
|
|
69
|
+
- First result's ID in the get_full_context example
|
|
70
|
+
- First result's actual file path in the Read example
|
|
71
|
+
- Use the actual keywords from top results
|
|
72
|
+
|
|
73
|
+
5. If no results:
|
|
74
|
+
```
|
|
75
|
+
No results found for "query"
|
|
76
|
+
|
|
77
|
+
Try:
|
|
78
|
+
- Broadening your search terms
|
|
79
|
+
- Checking indexed stores: /bluera-knowledge:stores
|
|
80
|
+
```
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Search command that uses Python formatter for deterministic table output
|
|
3
|
+
|
|
4
|
+
set -euo pipefail
|
|
5
|
+
|
|
6
|
+
# Parse arguments
|
|
7
|
+
QUERY=""
|
|
8
|
+
STORES=""
|
|
9
|
+
LIMIT=10
|
|
10
|
+
|
|
11
|
+
while [[ $# -gt 0 ]]; do
|
|
12
|
+
case $1 in
|
|
13
|
+
--stores)
|
|
14
|
+
STORES="$2"
|
|
15
|
+
shift 2
|
|
16
|
+
;;
|
|
17
|
+
--limit)
|
|
18
|
+
LIMIT="$2"
|
|
19
|
+
shift 2
|
|
20
|
+
;;
|
|
21
|
+
*)
|
|
22
|
+
# Everything else is the query
|
|
23
|
+
if [ -z "$QUERY" ]; then
|
|
24
|
+
QUERY="$1"
|
|
25
|
+
else
|
|
26
|
+
QUERY="$QUERY $1"
|
|
27
|
+
fi
|
|
28
|
+
shift
|
|
29
|
+
;;
|
|
30
|
+
esac
|
|
31
|
+
done
|
|
32
|
+
|
|
33
|
+
# Remove quotes from query if present
|
|
34
|
+
QUERY=$(echo "$QUERY" | sed 's/^["'\'']*//;s/["'\'']*$//')
|
|
35
|
+
|
|
36
|
+
if [ -z "$QUERY" ]; then
|
|
37
|
+
echo "Error: No search query provided"
|
|
38
|
+
exit 1
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
# Build MCP tool call JSON
|
|
42
|
+
TOOL_INPUT=$(cat <<EOF
|
|
43
|
+
{
|
|
44
|
+
"query": "$QUERY",
|
|
45
|
+
"limit": $LIMIT,
|
|
46
|
+
"detail": "contextual",
|
|
47
|
+
"intent": "find-implementation"
|
|
48
|
+
}
|
|
49
|
+
EOF
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
# Call MCP tool (this would need to be done via Claude)
|
|
53
|
+
# For now, output instructions for Claude
|
|
54
|
+
cat <<EOF
|
|
55
|
+
Please call mcp__bluera-knowledge__search with these parameters and pipe the results through the formatter:
|
|
56
|
+
|
|
57
|
+
Query: $QUERY
|
|
58
|
+
Limit: $LIMIT
|
|
59
|
+
Detail: contextual
|
|
60
|
+
Intent: find-implementation
|
|
61
|
+
|
|
62
|
+
Then execute: echo '<results_json>' | ${CLAUDE_PLUGIN_ROOT}/hooks/format-search-results.py
|
|
63
|
+
EOF
|