agent-knowledge 1.0.11 → 1.0.13
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/CHANGELOG.md +77 -77
- package/LICENSE +21 -21
- package/dist/dashboard.d.ts.map +1 -1
- package/dist/dashboard.js +7 -1
- package/dist/dashboard.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/knowledge/git.js +77 -77
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +5 -1
- package/dist/types.js.map +1 -1
- package/dist/ui/app.js +5 -1
- package/dist/vectorstore/store.d.ts.map +1 -1
- package/dist/vectorstore/store.js +3 -2
- package/dist/vectorstore/store.js.map +1 -1
- package/docs/ARCHITECTURE.md +244 -244
- package/docs/DASHBOARD.md +133 -133
- package/docs/SETUP.md +32 -32
- package/package.json +1 -1
- package/scripts/copy-ui.js +6 -6
package/docs/DASHBOARD.md
CHANGED
|
@@ -1,133 +1,133 @@
|
|
|
1
|
-
# Dashboard
|
|
2
|
-
|
|
3
|
-
The dashboard runs at **http://localhost:3423** and auto-starts with the MCP server.
|
|
4
|
-
|
|
5
|
-
## Tabs
|
|
6
|
-
|
|
7
|
-
| Tab | Purpose |
|
|
8
|
-
| ------------- | --------------------------------------------------------------- |
|
|
9
|
-
| **Knowledge** | Browse knowledge base entries by category |
|
|
10
|
-
| **Search** | TF-IDF ranked search across session transcripts |
|
|
11
|
-
| **Sessions** | Browse and read session conversation logs |
|
|
12
|
-
| **Recall** | Scoped search (errors, plans, configs, tools, files, decisions) |
|
|
13
|
-
|
|
14
|
-
## Knowledge Tab
|
|
15
|
-
|
|
16
|
-
Card grid of knowledge entries. Each card shows:
|
|
17
|
-
|
|
18
|
-
- Category badge with color: projects (blue), people (purple), decisions (orange), workflows (green), notes (yellow)
|
|
19
|
-
- Title and tag pills
|
|
20
|
-
- Last updated date
|
|
21
|
-
|
|
22
|
-
Category filter chips at the top: All, Projects, People, Decisions, Workflows, Notes.
|
|
23
|
-
|
|
24
|
-
Click a card to open the side panel with rendered markdown content.
|
|
25
|
-
|
|
26
|
-
## Search Tab
|
|
27
|
-
|
|
28
|
-
Full-text search across all session transcripts.
|
|
29
|
-
|
|
30
|
-
**Controls:**
|
|
31
|
-
|
|
32
|
-
- Search input with debounce (300ms)
|
|
33
|
-
- Role filter chips: All, User, Assistant
|
|
34
|
-
- Mode toggle: Ranked (TF-IDF) vs Regex
|
|
35
|
-
|
|
36
|
-
**Results show:**
|
|
37
|
-
|
|
38
|
-
- Role badge (user/assistant)
|
|
39
|
-
- Project name
|
|
40
|
-
- Relative timestamp
|
|
41
|
-
- Score bar with numeric value
|
|
42
|
-
- Excerpt with highlighted matching terms
|
|
43
|
-
|
|
44
|
-
Click a result to open the session in the side panel.
|
|
45
|
-
|
|
46
|
-
## Sessions Tab
|
|
47
|
-
|
|
48
|
-
Lists all Claude Code sessions with metadata:
|
|
49
|
-
|
|
50
|
-
- Project name
|
|
51
|
-
- Git branch
|
|
52
|
-
- Message count
|
|
53
|
-
- Date
|
|
54
|
-
- Preview of first user message
|
|
55
|
-
|
|
56
|
-
Project filter dropdown at the top.
|
|
57
|
-
|
|
58
|
-
Click a session to open the side panel with the full conversation rendered as chat bubbles.
|
|
59
|
-
|
|
60
|
-
## Recall Tab
|
|
61
|
-
|
|
62
|
-
Scoped search that pre-filters results by category:
|
|
63
|
-
|
|
64
|
-
| Scope | What it finds |
|
|
65
|
-
| ----------- | ----------------------------------------- |
|
|
66
|
-
| `errors` | Stack traces, exceptions, failed commands |
|
|
67
|
-
| `plans` | Architecture, TODOs, implementation steps |
|
|
68
|
-
| `configs` | Settings, env vars, configuration files |
|
|
69
|
-
| `tools` | MCP tool calls, CLI commands |
|
|
70
|
-
| `files` | File paths, modifications |
|
|
71
|
-
| `decisions` | Trade-offs, rationale, choices |
|
|
72
|
-
|
|
73
|
-
Results use the same format as the Search tab.
|
|
74
|
-
|
|
75
|
-
## Side Panel
|
|
76
|
-
|
|
77
|
-
- Width: 560px, resizable by dragging the left edge
|
|
78
|
-
- Close: X button or press Escape
|
|
79
|
-
- Knowledge entries: rendered as markdown via marked + DOMPurify + highlight.js
|
|
80
|
-
- Sessions: chat bubbles (user = right/accent, assistant = left/surface)
|
|
81
|
-
|
|
82
|
-
## Theming
|
|
83
|
-
|
|
84
|
-
- Toggle: sun/moon button in header
|
|
85
|
-
- Persisted in `localStorage('agent-knowledge-theme')`
|
|
86
|
-
- MD3 design tokens matching agent-comm and agent-tasks dashboards
|
|
87
|
-
- CSS custom properties on `:root`, switched via `data-theme` attribute
|
|
88
|
-
|
|
89
|
-
## Live Reload
|
|
90
|
-
|
|
91
|
-
File watcher monitors `src/ui/` for `.html`, `.css`, `.js` changes. On change, broadcasts `{type: "reload"}` via WebSocket. Connected browsers auto-refresh.
|
|
92
|
-
|
|
93
|
-
## Keyboard Shortcuts
|
|
94
|
-
|
|
95
|
-
| Shortcut | Action |
|
|
96
|
-
| --------------- | ------------------ |
|
|
97
|
-
| `/` or `Ctrl+K` | Focus search input |
|
|
98
|
-
| `Escape` | Close side panel |
|
|
99
|
-
|
|
100
|
-
## REST API
|
|
101
|
-
|
|
102
|
-
| Method | Endpoint | Description |
|
|
103
|
-
| ------ | --------------------------------------- | ---------------- |
|
|
104
|
-
| GET | `/api/knowledge` | List entries |
|
|
105
|
-
| GET | `/api/knowledge/search?q=` | Search knowledge |
|
|
106
|
-
| GET | `/api/knowledge/:path` | Read entry |
|
|
107
|
-
| GET | `/api/sessions` | List sessions |
|
|
108
|
-
| GET | `/api/sessions/search?q=&role=&ranked=` | Search sessions |
|
|
109
|
-
| GET | `/api/sessions/recall?scope=&q=` | Scoped recall |
|
|
110
|
-
| GET | `/api/sessions/:id` | Read session |
|
|
111
|
-
| GET | `/api/sessions/:id/summary` | Session summary |
|
|
112
|
-
| GET | `/health` | Health check |
|
|
113
|
-
|
|
114
|
-
## WebSocket
|
|
115
|
-
|
|
116
|
-
Connects to `ws://localhost:3423` on page load.
|
|
117
|
-
|
|
118
|
-
**State message** (on connect):
|
|
119
|
-
|
|
120
|
-
```json
|
|
121
|
-
{
|
|
122
|
-
"type": "state",
|
|
123
|
-
"knowledge": [...],
|
|
124
|
-
"sessions": [...],
|
|
125
|
-
"stats": { "knowledge_entries": 12, "session_count": 247 }
|
|
126
|
-
}
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
**Reload message** (on file change):
|
|
130
|
-
|
|
131
|
-
```json
|
|
132
|
-
{ "type": "reload" }
|
|
133
|
-
```
|
|
1
|
+
# Dashboard
|
|
2
|
+
|
|
3
|
+
The dashboard runs at **http://localhost:3423** and auto-starts with the MCP server.
|
|
4
|
+
|
|
5
|
+
## Tabs
|
|
6
|
+
|
|
7
|
+
| Tab | Purpose |
|
|
8
|
+
| ------------- | --------------------------------------------------------------- |
|
|
9
|
+
| **Knowledge** | Browse knowledge base entries by category |
|
|
10
|
+
| **Search** | TF-IDF ranked search across session transcripts |
|
|
11
|
+
| **Sessions** | Browse and read session conversation logs |
|
|
12
|
+
| **Recall** | Scoped search (errors, plans, configs, tools, files, decisions) |
|
|
13
|
+
|
|
14
|
+
## Knowledge Tab
|
|
15
|
+
|
|
16
|
+
Card grid of knowledge entries. Each card shows:
|
|
17
|
+
|
|
18
|
+
- Category badge with color: projects (blue), people (purple), decisions (orange), workflows (green), notes (yellow)
|
|
19
|
+
- Title and tag pills
|
|
20
|
+
- Last updated date
|
|
21
|
+
|
|
22
|
+
Category filter chips at the top: All, Projects, People, Decisions, Workflows, Notes.
|
|
23
|
+
|
|
24
|
+
Click a card to open the side panel with rendered markdown content.
|
|
25
|
+
|
|
26
|
+
## Search Tab
|
|
27
|
+
|
|
28
|
+
Full-text search across all session transcripts.
|
|
29
|
+
|
|
30
|
+
**Controls:**
|
|
31
|
+
|
|
32
|
+
- Search input with debounce (300ms)
|
|
33
|
+
- Role filter chips: All, User, Assistant
|
|
34
|
+
- Mode toggle: Ranked (TF-IDF) vs Regex
|
|
35
|
+
|
|
36
|
+
**Results show:**
|
|
37
|
+
|
|
38
|
+
- Role badge (user/assistant)
|
|
39
|
+
- Project name
|
|
40
|
+
- Relative timestamp
|
|
41
|
+
- Score bar with numeric value
|
|
42
|
+
- Excerpt with highlighted matching terms
|
|
43
|
+
|
|
44
|
+
Click a result to open the session in the side panel.
|
|
45
|
+
|
|
46
|
+
## Sessions Tab
|
|
47
|
+
|
|
48
|
+
Lists all Claude Code sessions with metadata:
|
|
49
|
+
|
|
50
|
+
- Project name
|
|
51
|
+
- Git branch
|
|
52
|
+
- Message count
|
|
53
|
+
- Date
|
|
54
|
+
- Preview of first user message
|
|
55
|
+
|
|
56
|
+
Project filter dropdown at the top.
|
|
57
|
+
|
|
58
|
+
Click a session to open the side panel with the full conversation rendered as chat bubbles.
|
|
59
|
+
|
|
60
|
+
## Recall Tab
|
|
61
|
+
|
|
62
|
+
Scoped search that pre-filters results by category:
|
|
63
|
+
|
|
64
|
+
| Scope | What it finds |
|
|
65
|
+
| ----------- | ----------------------------------------- |
|
|
66
|
+
| `errors` | Stack traces, exceptions, failed commands |
|
|
67
|
+
| `plans` | Architecture, TODOs, implementation steps |
|
|
68
|
+
| `configs` | Settings, env vars, configuration files |
|
|
69
|
+
| `tools` | MCP tool calls, CLI commands |
|
|
70
|
+
| `files` | File paths, modifications |
|
|
71
|
+
| `decisions` | Trade-offs, rationale, choices |
|
|
72
|
+
|
|
73
|
+
Results use the same format as the Search tab.
|
|
74
|
+
|
|
75
|
+
## Side Panel
|
|
76
|
+
|
|
77
|
+
- Width: 560px, resizable by dragging the left edge
|
|
78
|
+
- Close: X button or press Escape
|
|
79
|
+
- Knowledge entries: rendered as markdown via marked + DOMPurify + highlight.js
|
|
80
|
+
- Sessions: chat bubbles (user = right/accent, assistant = left/surface)
|
|
81
|
+
|
|
82
|
+
## Theming
|
|
83
|
+
|
|
84
|
+
- Toggle: sun/moon button in header
|
|
85
|
+
- Persisted in `localStorage('agent-knowledge-theme')`
|
|
86
|
+
- MD3 design tokens matching agent-comm and agent-tasks dashboards
|
|
87
|
+
- CSS custom properties on `:root`, switched via `data-theme` attribute
|
|
88
|
+
|
|
89
|
+
## Live Reload
|
|
90
|
+
|
|
91
|
+
File watcher monitors `src/ui/` for `.html`, `.css`, `.js` changes. On change, broadcasts `{type: "reload"}` via WebSocket. Connected browsers auto-refresh.
|
|
92
|
+
|
|
93
|
+
## Keyboard Shortcuts
|
|
94
|
+
|
|
95
|
+
| Shortcut | Action |
|
|
96
|
+
| --------------- | ------------------ |
|
|
97
|
+
| `/` or `Ctrl+K` | Focus search input |
|
|
98
|
+
| `Escape` | Close side panel |
|
|
99
|
+
|
|
100
|
+
## REST API
|
|
101
|
+
|
|
102
|
+
| Method | Endpoint | Description |
|
|
103
|
+
| ------ | --------------------------------------- | ---------------- |
|
|
104
|
+
| GET | `/api/knowledge` | List entries |
|
|
105
|
+
| GET | `/api/knowledge/search?q=` | Search knowledge |
|
|
106
|
+
| GET | `/api/knowledge/:path` | Read entry |
|
|
107
|
+
| GET | `/api/sessions` | List sessions |
|
|
108
|
+
| GET | `/api/sessions/search?q=&role=&ranked=` | Search sessions |
|
|
109
|
+
| GET | `/api/sessions/recall?scope=&q=` | Scoped recall |
|
|
110
|
+
| GET | `/api/sessions/:id` | Read session |
|
|
111
|
+
| GET | `/api/sessions/:id/summary` | Session summary |
|
|
112
|
+
| GET | `/health` | Health check |
|
|
113
|
+
|
|
114
|
+
## WebSocket
|
|
115
|
+
|
|
116
|
+
Connects to `ws://localhost:3423` on page load.
|
|
117
|
+
|
|
118
|
+
**State message** (on connect):
|
|
119
|
+
|
|
120
|
+
```json
|
|
121
|
+
{
|
|
122
|
+
"type": "state",
|
|
123
|
+
"knowledge": [...],
|
|
124
|
+
"sessions": [...],
|
|
125
|
+
"stats": { "knowledge_entries": 12, "session_count": 247 }
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
**Reload message** (on file change):
|
|
130
|
+
|
|
131
|
+
```json
|
|
132
|
+
{ "type": "reload" }
|
|
133
|
+
```
|
package/docs/SETUP.md
CHANGED
|
@@ -203,17 +203,17 @@ OpenCode supports lifecycle hooks via JavaScript/TypeScript plugins. Create a pl
|
|
|
203
203
|
|
|
204
204
|
```typescript
|
|
205
205
|
// .opencode/plugins/agent-knowledge.ts
|
|
206
|
-
import type { Plugin } from
|
|
206
|
+
import type { Plugin } from '@opencode-ai/plugin';
|
|
207
207
|
|
|
208
208
|
export const AgentKnowledgePlugin: Plugin = async ({ client }) => {
|
|
209
209
|
return {
|
|
210
210
|
event: async (event) => {
|
|
211
|
-
if (event.type ===
|
|
211
|
+
if (event.type === 'session.created') {
|
|
212
212
|
// Knowledge base instructions provided via AGENTS.md
|
|
213
213
|
}
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
}
|
|
214
|
+
},
|
|
215
|
+
};
|
|
216
|
+
};
|
|
217
217
|
```
|
|
218
218
|
|
|
219
219
|
Available events: `session.created`, `session.idle`, `tool.execute.before`, `tool.execute.after`, `message.updated`, `file.edited`.
|
|
@@ -224,10 +224,10 @@ Combine with `AGENTS.md` instructions (see below).
|
|
|
224
224
|
|
|
225
225
|
Cursor and Windsurf don't support lifecycle hooks. Use the client's system prompt / instructions file:
|
|
226
226
|
|
|
227
|
-
| Client | Instructions file
|
|
228
|
-
| -------- |
|
|
229
|
-
| Cursor | `.cursorrules`
|
|
230
|
-
| Windsurf | `.windsurfrules`
|
|
227
|
+
| Client | Instructions file |
|
|
228
|
+
| -------- | ----------------- |
|
|
229
|
+
| Cursor | `.cursorrules` |
|
|
230
|
+
| Windsurf | `.windsurfrules` |
|
|
231
231
|
|
|
232
232
|
Add these instructions:
|
|
233
233
|
|
|
@@ -294,22 +294,22 @@ Architecture notes, deployment info, etc.
|
|
|
294
294
|
|
|
295
295
|
## Environment Variables
|
|
296
296
|
|
|
297
|
-
| Variable
|
|
298
|
-
|
|
|
299
|
-
| `KNOWLEDGE_MEMORY_DIR`
|
|
300
|
-
| `CLAUDE_MEMORY_DIR`
|
|
301
|
-
| `CLAUDE_DIR`
|
|
302
|
-
| `KNOWLEDGE_PORT`
|
|
303
|
-
| `KNOWLEDGE_EMBEDDING_PROVIDER`
|
|
304
|
-
| `KNOWLEDGE_EMBEDDING_ALPHA`
|
|
305
|
-
| `KNOWLEDGE_EMBEDDING_IDLE_TIMEOUT`
|
|
306
|
-
| `KNOWLEDGE_EMBEDDING_THREADS`
|
|
307
|
-
| `KNOWLEDGE_EMBEDDING_MODEL`
|
|
308
|
-
| `KNOWLEDGE_GIT_URL`
|
|
309
|
-
| `KNOWLEDGE_AUTO_DISTILL`
|
|
310
|
-
| `KNOWLEDGE_OPENAI_API_KEY` / `OPENAI_API_KEY`
|
|
311
|
-
| `KNOWLEDGE_CLAUDE_API_KEY` / `ANTHROPIC_API_KEY` | —
|
|
312
|
-
| `KNOWLEDGE_GEMINI_API_KEY` / `GEMINI_API_KEY`
|
|
297
|
+
| Variable | Default | Description |
|
|
298
|
+
| ------------------------------------------------ | ----------------- | -------------------------------------------------- |
|
|
299
|
+
| `KNOWLEDGE_MEMORY_DIR` | `~/claude-memory` | Path to git-synced knowledge base |
|
|
300
|
+
| `CLAUDE_MEMORY_DIR` | `~/claude-memory` | Alias (backwards compat) |
|
|
301
|
+
| `CLAUDE_DIR` | `~/.claude` | Claude Code data directory |
|
|
302
|
+
| `KNOWLEDGE_PORT` | `3423` | Dashboard HTTP/WebSocket port |
|
|
303
|
+
| `KNOWLEDGE_EMBEDDING_PROVIDER` | `local` | Embedding provider (local, openai, claude, gemini) |
|
|
304
|
+
| `KNOWLEDGE_EMBEDDING_ALPHA` | `0.5` | Blend weight for semantic vs TF-IDF search (0-1) |
|
|
305
|
+
| `KNOWLEDGE_EMBEDDING_IDLE_TIMEOUT` | — | Idle timeout for embedding worker (ms) |
|
|
306
|
+
| `KNOWLEDGE_EMBEDDING_THREADS` | — | Number of ONNX threads for local embeddings |
|
|
307
|
+
| `KNOWLEDGE_EMBEDDING_MODEL` | — | Model name for embedding provider |
|
|
308
|
+
| `KNOWLEDGE_GIT_URL` | — | Remote git URL for knowledge base sync |
|
|
309
|
+
| `KNOWLEDGE_AUTO_DISTILL` | — | Enable auto-distillation of sessions (true/false) |
|
|
310
|
+
| `KNOWLEDGE_OPENAI_API_KEY` / `OPENAI_API_KEY` | — | API key for OpenAI embeddings |
|
|
311
|
+
| `KNOWLEDGE_CLAUDE_API_KEY` / `ANTHROPIC_API_KEY` | — | API key for Claude/Voyage embeddings |
|
|
312
|
+
| `KNOWLEDGE_GEMINI_API_KEY` / `GEMINI_API_KEY` | — | API key for Gemini embeddings |
|
|
313
313
|
|
|
314
314
|
Set in your shell profile or pass via MCP config:
|
|
315
315
|
|
|
@@ -398,10 +398,10 @@ ls ~/.claude/projects/ # Should contain project directories with .jsonl files
|
|
|
398
398
|
|
|
399
399
|
## Client Comparison
|
|
400
400
|
|
|
401
|
-
| Feature
|
|
402
|
-
|
|
|
403
|
-
| MCP stdio transport
|
|
404
|
-
| Lifecycle hooks
|
|
405
|
-
| Session auto-distill
|
|
406
|
-
| System prompt file
|
|
407
|
-
| REST API fallback
|
|
401
|
+
| Feature | Claude Code | OpenCode | Cursor | Windsurf |
|
|
402
|
+
| -------------------- | ----------- | ------------- | ------------ | -------------- |
|
|
403
|
+
| MCP stdio transport | Yes | Yes | Yes | Yes |
|
|
404
|
+
| Lifecycle hooks | Yes (JSON) | Yes (plugins) | No | No |
|
|
405
|
+
| Session auto-distill | Yes | No | No | No |
|
|
406
|
+
| System prompt file | CLAUDE.md | AGENTS.md | .cursorrules | .windsurfrules |
|
|
407
|
+
| REST API fallback | Yes | Yes | Yes | Yes |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-knowledge",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"description": "Cross-session memory and recall for AI agents — git-synced knowledge base, hybrid semantic+TF-IDF search, auto-distillation with secrets scrubbing",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
package/scripts/copy-ui.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { cpSync } from 'fs';
|
|
2
|
-
import { fileURLToPath } from 'url';
|
|
3
|
-
import { dirname, join } from 'path';
|
|
4
|
-
|
|
5
|
-
const root = join(dirname(fileURLToPath(import.meta.url)), '..');
|
|
6
|
-
cpSync(join(root, 'src', 'ui'), join(root, 'dist', 'ui'), { recursive: true });
|
|
1
|
+
import { cpSync } from 'fs';
|
|
2
|
+
import { fileURLToPath } from 'url';
|
|
3
|
+
import { dirname, join } from 'path';
|
|
4
|
+
|
|
5
|
+
const root = join(dirname(fileURLToPath(import.meta.url)), '..');
|
|
6
|
+
cpSync(join(root, 'src', 'ui'), join(root, 'dist', 'ui'), { recursive: true });
|