agent-knowledge 1.0.0 → 1.0.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.
- package/CHANGELOG.md +77 -77
- package/LICENSE +21 -21
- package/README.md +191 -191
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/knowledge/git.d.ts.map +1 -1
- package/dist/knowledge/git.js +91 -86
- package/dist/knowledge/git.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js.map +1 -1
- package/dist/ui/app.js +38 -114
- package/dist/ui/index.html +21 -65
- package/dist/ui/styles.css +3 -2
- package/dist/vectorstore/store.d.ts.map +1 -1
- package/dist/vectorstore/store.js +32 -32
- package/dist/vectorstore/store.js.map +1 -1
- package/docs/ARCHITECTURE.md +244 -244
- package/docs/DASHBOARD.md +133 -133
- package/docs/SETUP.md +178 -178
- package/package.json +1 -1
- package/scripts/copy-ui.js +6 -6
- package/dist/ui/ui/app.js +0 -811
- package/dist/ui/ui/index.html +0 -300
- package/dist/ui/ui/styles.css +0 -1154
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
|
@@ -1,178 +1,178 @@
|
|
|
1
|
-
# Setup Guide
|
|
2
|
-
|
|
3
|
-
## Prerequisites
|
|
4
|
-
|
|
5
|
-
- **Node.js 20+** (ES modules and TypeScript features)
|
|
6
|
-
- **Git** (for knowledge base sync)
|
|
7
|
-
|
|
8
|
-
```bash
|
|
9
|
-
node --version # v20.0.0 or later
|
|
10
|
-
git --version
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Installation
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
git clone https://github.com/keshrath/agent-knowledge.git
|
|
17
|
-
cd agent-knowledge
|
|
18
|
-
npm install
|
|
19
|
-
npm run build
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
For development with auto-rebuild:
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
npm run dev
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## Configuration in Claude Code
|
|
29
|
-
|
|
30
|
-
### Register the MCP server
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
claude mcp add agent-knowledge -s user \
|
|
34
|
-
-e KNOWLEDGE_MEMORY_DIR="$HOME/claude-memory" \
|
|
35
|
-
-- node /path/to/agent-knowledge/dist/index.js
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
### Permissions
|
|
39
|
-
|
|
40
|
-
Add to `~/.claude/settings.json`:
|
|
41
|
-
|
|
42
|
-
```json
|
|
43
|
-
{
|
|
44
|
-
"permissions": {
|
|
45
|
-
"allow": ["mcp__agent-knowledge__*"]
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
### Verify
|
|
51
|
-
|
|
52
|
-
```bash
|
|
53
|
-
claude mcp list
|
|
54
|
-
# Should show: agent-knowledge ... Connected
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
## Environment Variables
|
|
58
|
-
|
|
59
|
-
| Variable | Default | Description |
|
|
60
|
-
| ---------------------- | ----------------- | --------------------------------- |
|
|
61
|
-
| `KNOWLEDGE_MEMORY_DIR` | `~/claude-memory` | Path to git-synced knowledge base |
|
|
62
|
-
| `CLAUDE_MEMORY_DIR` | `~/claude-memory` | Alias (backwards compat) |
|
|
63
|
-
| `CLAUDE_DIR` | `~/.claude` | Claude Code data directory |
|
|
64
|
-
| `KNOWLEDGE_PORT` | `3423` | Dashboard HTTP/WebSocket port |
|
|
65
|
-
|
|
66
|
-
Set in your shell profile or pass via MCP config:
|
|
67
|
-
|
|
68
|
-
```bash
|
|
69
|
-
export KNOWLEDGE_MEMORY_DIR="$HOME/claude-memory"
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
On Windows (PowerShell):
|
|
73
|
-
|
|
74
|
-
```powershell
|
|
75
|
-
$env:KNOWLEDGE_MEMORY_DIR = "$env:USERPROFILE\claude-memory"
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
## Knowledge Base Setup
|
|
79
|
-
|
|
80
|
-
The knowledge base is a git repository with categorized markdown files.
|
|
81
|
-
|
|
82
|
-
### Clone existing or create new
|
|
83
|
-
|
|
84
|
-
```bash
|
|
85
|
-
# Clone existing
|
|
86
|
-
git clone https://your-git-host/claude-memory.git ~/claude-memory
|
|
87
|
-
|
|
88
|
-
# Or create new
|
|
89
|
-
mkdir -p ~/claude-memory && cd ~/claude-memory && git init
|
|
90
|
-
mkdir projects people decisions workflows notes
|
|
91
|
-
git add . && git commit -m "Initialize knowledge base"
|
|
92
|
-
git remote add origin <your-remote-url>
|
|
93
|
-
git push -u origin main
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
### Directory structure
|
|
97
|
-
|
|
98
|
-
```
|
|
99
|
-
~/claude-memory/
|
|
100
|
-
projects/ # Project context, architecture, tech stacks
|
|
101
|
-
people/ # Team members, contacts, preferences
|
|
102
|
-
decisions/ # Architecture decisions, trade-offs, rationale
|
|
103
|
-
workflows/ # Processes, deployment steps, runbooks
|
|
104
|
-
notes/ # General notes, research, references
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
### Entry format
|
|
108
|
-
|
|
109
|
-
```markdown
|
|
110
|
-
---
|
|
111
|
-
title: My Project
|
|
112
|
-
tags: [typescript, react, postgres]
|
|
113
|
-
updated: 2026-03-25
|
|
114
|
-
---
|
|
115
|
-
|
|
116
|
-
# My Project
|
|
117
|
-
|
|
118
|
-
Architecture notes, deployment info, etc.
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
## Dashboard
|
|
122
|
-
|
|
123
|
-
Auto-starts with the MCP server at **http://localhost:3423**.
|
|
124
|
-
|
|
125
|
-
4 tabs: Knowledge, Search, Sessions, Recall. Supports light/dark theme.
|
|
126
|
-
|
|
127
|
-
Live reload: edit files in `src/ui/` and the browser refreshes automatically.
|
|
128
|
-
|
|
129
|
-
## Multi-Machine Sync
|
|
130
|
-
|
|
131
|
-
| Operation | Git Action | When |
|
|
132
|
-
| ------------------------------------- | ------------------------------ | -------------- |
|
|
133
|
-
| `knowledge_read`, `knowledge_list` | `git pull --rebase` | Before reading |
|
|
134
|
-
| `knowledge_write`, `knowledge_delete` | `git add -A && commit && push` | After writing |
|
|
135
|
-
| `knowledge_sync` | `git pull` then `git push` | Manual trigger |
|
|
136
|
-
|
|
137
|
-
Ensure git credentials are configured (SSH key or credential helper):
|
|
138
|
-
|
|
139
|
-
```bash
|
|
140
|
-
cd ~/claude-memory && git pull && git push # Should work without prompts
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
## Troubleshooting
|
|
144
|
-
|
|
145
|
-
### Port already in use
|
|
146
|
-
|
|
147
|
-
```bash
|
|
148
|
-
# Find the process
|
|
149
|
-
netstat -ano | findstr :3423 # Windows
|
|
150
|
-
lsof -i :3423 # Linux/macOS
|
|
151
|
-
|
|
152
|
-
# Use a different port
|
|
153
|
-
export KNOWLEDGE_PORT=3424
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
### Git authentication failures
|
|
157
|
-
|
|
158
|
-
Verify credentials work manually:
|
|
159
|
-
|
|
160
|
-
```bash
|
|
161
|
-
cd ~/claude-memory && git push
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
Set up SSH keys or a credential helper if prompted.
|
|
165
|
-
|
|
166
|
-
### MCP server not connecting
|
|
167
|
-
|
|
168
|
-
1. Check path points to `dist/index.js` (not `src/index.ts`)
|
|
169
|
-
2. Verify Node.js 20+ is on your PATH
|
|
170
|
-
3. Try running manually: `node /path/to/agent-knowledge/dist/index.js`
|
|
171
|
-
|
|
172
|
-
### No session results
|
|
173
|
-
|
|
174
|
-
Verify session transcripts exist:
|
|
175
|
-
|
|
176
|
-
```bash
|
|
177
|
-
ls ~/.claude/projects/ # Should contain project directories with .jsonl files
|
|
178
|
-
```
|
|
1
|
+
# Setup Guide
|
|
2
|
+
|
|
3
|
+
## Prerequisites
|
|
4
|
+
|
|
5
|
+
- **Node.js 20+** (ES modules and TypeScript features)
|
|
6
|
+
- **Git** (for knowledge base sync)
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
node --version # v20.0.0 or later
|
|
10
|
+
git --version
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
git clone https://github.com/keshrath/agent-knowledge.git
|
|
17
|
+
cd agent-knowledge
|
|
18
|
+
npm install
|
|
19
|
+
npm run build
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
For development with auto-rebuild:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm run dev
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Configuration in Claude Code
|
|
29
|
+
|
|
30
|
+
### Register the MCP server
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
claude mcp add agent-knowledge -s user \
|
|
34
|
+
-e KNOWLEDGE_MEMORY_DIR="$HOME/claude-memory" \
|
|
35
|
+
-- node /path/to/agent-knowledge/dist/index.js
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Permissions
|
|
39
|
+
|
|
40
|
+
Add to `~/.claude/settings.json`:
|
|
41
|
+
|
|
42
|
+
```json
|
|
43
|
+
{
|
|
44
|
+
"permissions": {
|
|
45
|
+
"allow": ["mcp__agent-knowledge__*"]
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Verify
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
claude mcp list
|
|
54
|
+
# Should show: agent-knowledge ... Connected
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Environment Variables
|
|
58
|
+
|
|
59
|
+
| Variable | Default | Description |
|
|
60
|
+
| ---------------------- | ----------------- | --------------------------------- |
|
|
61
|
+
| `KNOWLEDGE_MEMORY_DIR` | `~/claude-memory` | Path to git-synced knowledge base |
|
|
62
|
+
| `CLAUDE_MEMORY_DIR` | `~/claude-memory` | Alias (backwards compat) |
|
|
63
|
+
| `CLAUDE_DIR` | `~/.claude` | Claude Code data directory |
|
|
64
|
+
| `KNOWLEDGE_PORT` | `3423` | Dashboard HTTP/WebSocket port |
|
|
65
|
+
|
|
66
|
+
Set in your shell profile or pass via MCP config:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
export KNOWLEDGE_MEMORY_DIR="$HOME/claude-memory"
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
On Windows (PowerShell):
|
|
73
|
+
|
|
74
|
+
```powershell
|
|
75
|
+
$env:KNOWLEDGE_MEMORY_DIR = "$env:USERPROFILE\claude-memory"
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Knowledge Base Setup
|
|
79
|
+
|
|
80
|
+
The knowledge base is a git repository with categorized markdown files.
|
|
81
|
+
|
|
82
|
+
### Clone existing or create new
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# Clone existing
|
|
86
|
+
git clone https://your-git-host/claude-memory.git ~/claude-memory
|
|
87
|
+
|
|
88
|
+
# Or create new
|
|
89
|
+
mkdir -p ~/claude-memory && cd ~/claude-memory && git init
|
|
90
|
+
mkdir projects people decisions workflows notes
|
|
91
|
+
git add . && git commit -m "Initialize knowledge base"
|
|
92
|
+
git remote add origin <your-remote-url>
|
|
93
|
+
git push -u origin main
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Directory structure
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
~/claude-memory/
|
|
100
|
+
projects/ # Project context, architecture, tech stacks
|
|
101
|
+
people/ # Team members, contacts, preferences
|
|
102
|
+
decisions/ # Architecture decisions, trade-offs, rationale
|
|
103
|
+
workflows/ # Processes, deployment steps, runbooks
|
|
104
|
+
notes/ # General notes, research, references
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Entry format
|
|
108
|
+
|
|
109
|
+
```markdown
|
|
110
|
+
---
|
|
111
|
+
title: My Project
|
|
112
|
+
tags: [typescript, react, postgres]
|
|
113
|
+
updated: 2026-03-25
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
# My Project
|
|
117
|
+
|
|
118
|
+
Architecture notes, deployment info, etc.
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Dashboard
|
|
122
|
+
|
|
123
|
+
Auto-starts with the MCP server at **http://localhost:3423**.
|
|
124
|
+
|
|
125
|
+
4 tabs: Knowledge, Search, Sessions, Recall. Supports light/dark theme.
|
|
126
|
+
|
|
127
|
+
Live reload: edit files in `src/ui/` and the browser refreshes automatically.
|
|
128
|
+
|
|
129
|
+
## Multi-Machine Sync
|
|
130
|
+
|
|
131
|
+
| Operation | Git Action | When |
|
|
132
|
+
| ------------------------------------- | ------------------------------ | -------------- |
|
|
133
|
+
| `knowledge_read`, `knowledge_list` | `git pull --rebase` | Before reading |
|
|
134
|
+
| `knowledge_write`, `knowledge_delete` | `git add -A && commit && push` | After writing |
|
|
135
|
+
| `knowledge_sync` | `git pull` then `git push` | Manual trigger |
|
|
136
|
+
|
|
137
|
+
Ensure git credentials are configured (SSH key or credential helper):
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
cd ~/claude-memory && git pull && git push # Should work without prompts
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Troubleshooting
|
|
144
|
+
|
|
145
|
+
### Port already in use
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
# Find the process
|
|
149
|
+
netstat -ano | findstr :3423 # Windows
|
|
150
|
+
lsof -i :3423 # Linux/macOS
|
|
151
|
+
|
|
152
|
+
# Use a different port
|
|
153
|
+
export KNOWLEDGE_PORT=3424
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Git authentication failures
|
|
157
|
+
|
|
158
|
+
Verify credentials work manually:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
cd ~/claude-memory && git push
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Set up SSH keys or a credential helper if prompted.
|
|
165
|
+
|
|
166
|
+
### MCP server not connecting
|
|
167
|
+
|
|
168
|
+
1. Check path points to `dist/index.js` (not `src/index.ts`)
|
|
169
|
+
2. Verify Node.js 20+ is on your PATH
|
|
170
|
+
3. Try running manually: `node /path/to/agent-knowledge/dist/index.js`
|
|
171
|
+
|
|
172
|
+
### No session results
|
|
173
|
+
|
|
174
|
+
Verify session transcripts exist:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
ls ~/.claude/projects/ # Should contain project directories with .jsonl files
|
|
178
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-knowledge",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
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 });
|