agent-knowledge 1.2.0 → 1.3.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/CHANGELOG.md +86 -13
- package/README.md +51 -34
- package/dist/dashboard.d.ts +1 -0
- package/dist/dashboard.d.ts.map +1 -1
- package/dist/dashboard.js +76 -23
- package/dist/dashboard.js.map +1 -1
- package/dist/embeddings/anthropic.d.ts.map +1 -1
- package/dist/embeddings/anthropic.js +2 -1
- package/dist/embeddings/anthropic.js.map +1 -1
- package/dist/embeddings/gemini.d.ts.map +1 -1
- package/dist/embeddings/gemini.js +2 -1
- package/dist/embeddings/gemini.js.map +1 -1
- package/dist/embeddings/local.d.ts.map +1 -1
- package/dist/embeddings/local.js +3 -0
- package/dist/embeddings/local.js.map +1 -1
- package/dist/knowledge/consolidate.d.ts +46 -0
- package/dist/knowledge/consolidate.d.ts.map +1 -0
- package/dist/knowledge/consolidate.js +164 -0
- package/dist/knowledge/consolidate.js.map +1 -0
- package/dist/knowledge/distill.d.ts.map +1 -1
- package/dist/knowledge/distill.js +4 -2
- package/dist/knowledge/distill.js.map +1 -1
- package/dist/knowledge/graph.d.ts.map +1 -1
- package/dist/knowledge/graph.js +2 -1
- package/dist/knowledge/graph.js.map +1 -1
- package/dist/knowledge/reflect.d.ts +33 -0
- package/dist/knowledge/reflect.d.ts.map +1 -0
- package/dist/knowledge/reflect.js +115 -0
- package/dist/knowledge/reflect.js.map +1 -0
- package/dist/knowledge/scoring.d.ts.map +1 -1
- package/dist/knowledge/scoring.js +2 -1
- package/dist/knowledge/scoring.js.map +1 -1
- package/dist/knowledge/search.d.ts.map +1 -1
- package/dist/knowledge/search.js +4 -7
- package/dist/knowledge/search.js.map +1 -1
- package/dist/knowledge/store.d.ts.map +1 -1
- package/dist/knowledge/store.js +4 -3
- package/dist/knowledge/store.js.map +1 -1
- package/dist/search/excerpt.d.ts.map +1 -1
- package/dist/search/excerpt.js +2 -1
- package/dist/search/excerpt.js.map +1 -1
- package/dist/search/tfidf.d.ts +1 -0
- package/dist/search/tfidf.d.ts.map +1 -1
- package/dist/search/tfidf.js +38 -3
- package/dist/search/tfidf.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +103 -534
- package/dist/server.js.map +1 -1
- package/dist/sessions/parser.d.ts.map +1 -1
- package/dist/sessions/parser.js +12 -10
- package/dist/sessions/parser.js.map +1 -1
- package/dist/sessions/search.js +17 -3
- package/dist/sessions/search.js.map +1 -1
- package/dist/sessions/summary.d.ts.map +1 -1
- package/dist/sessions/summary.js +6 -3
- package/dist/sessions/summary.js.map +1 -1
- package/dist/tool-handlers.d.ts +42 -0
- package/dist/tool-handlers.d.ts.map +1 -0
- package/dist/tool-handlers.js +425 -0
- package/dist/tool-handlers.js.map +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +6 -4
- package/dist/types.js.map +1 -1
- package/dist/ui/app.js +86 -847
- package/dist/ui/index.html +17 -0
- package/dist/ui/render-knowledge.js +233 -0
- package/dist/ui/render-panel.js +350 -0
- package/dist/ui/render-search.js +109 -0
- package/dist/ui/render-sessions.js +234 -0
- package/dist/ui/styles.css +91 -0
- package/dist/ui/ui-utils.js +196 -0
- package/dist/vectorstore/store.d.ts +25 -44
- package/dist/vectorstore/store.d.ts.map +1 -1
- package/dist/vectorstore/store.js +167 -167
- package/dist/vectorstore/store.js.map +1 -1
- package/docs/ARCHITECTURE.md +29 -1
- package/docs/DASHBOARD.md +7 -0
- package/package.json +1 -1
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -40,7 +40,7 @@ graph TB
|
|
|
40
40
|
```
|
|
41
41
|
src/
|
|
42
42
|
index.ts Entry point — MCP stdio + dashboard auto-start
|
|
43
|
-
server.ts
|
|
43
|
+
server.ts 6 tool definitions, request routing, error handling
|
|
44
44
|
dashboard.ts HTTP + WebSocket server, REST API, file watcher
|
|
45
45
|
types.ts KnowledgeConfig interface, getConfig()
|
|
46
46
|
knowledge/
|
|
@@ -49,6 +49,8 @@ src/
|
|
|
49
49
|
git.ts git pull/push/sync with execSync + timeouts
|
|
50
50
|
graph.ts Knowledge graph — edges table, link/unlink/BFS traversal
|
|
51
51
|
scoring.ts Confidence/decay scoring — entry_scores table, auto-promotion
|
|
52
|
+
consolidate.ts Memory consolidation — TF-IDF duplicate detection, cluster grouping
|
|
53
|
+
reflect.ts Reflection cycle — surfaces unconnected entries, generates prompts
|
|
52
54
|
sessions/
|
|
53
55
|
parser.ts Multi-format parsing with mtime cache + adapter dispatch
|
|
54
56
|
search.ts TF-IDF ranked search with 60s global index cache
|
|
@@ -122,6 +124,8 @@ CREATE TABLE edges (
|
|
|
122
124
|
- **links()** — list edges for a given entry or rel_type
|
|
123
125
|
- **traverse()** — BFS from a starting entry to configurable depth, returns nodes and edges visited
|
|
124
126
|
|
|
127
|
+
All four operations are exposed via the single `knowledge_graph` tool with an `action` parameter (`link`, `unlink`, `list`, `traverse`).
|
|
128
|
+
|
|
125
129
|
**Auto-linking**: On `knowledge_write`, the top-3 most similar existing entries are found via cosine similarity against the vector store. Entries with similarity > 0.7 get automatic `related_to` edges created.
|
|
126
130
|
|
|
127
131
|
## Confidence & Decay Scoring
|
|
@@ -157,6 +161,30 @@ finalScore = baseRelevance * 0.5^(daysSinceLastAccess / 90) * maturityMultiplier
|
|
|
157
161
|
|
|
158
162
|
Access count increments on `knowledge_read`. Maturity transitions happen automatically when thresholds are crossed. Search results from `knowledge_search` apply the decay formula to blend relevance with freshness and confidence.
|
|
159
163
|
|
|
164
|
+
## Memory Consolidation
|
|
165
|
+
|
|
166
|
+
### consolidate.ts
|
|
167
|
+
|
|
168
|
+
Detects near-duplicate knowledge entries using TF-IDF similarity scoring.
|
|
169
|
+
|
|
170
|
+
**`checkDuplicates()`** — called after `knowledge_write`. Builds a TF-IDF index from all entries, queries with the written content, and returns entries exceeding a configurable similarity threshold (default: 0.6). Warnings are included in the write response.
|
|
171
|
+
|
|
172
|
+
**`consolidate()`** — batch scan for `knowledge_consolidate`. Computes pairwise TF-IDF similarities for all entries in a category (or globally), groups entries above threshold (default: 0.5) into clusters using union-find, and returns clusters with representative entries and pairwise similarity scores.
|
|
173
|
+
|
|
174
|
+
## Reflection Cycle
|
|
175
|
+
|
|
176
|
+
### reflect.ts
|
|
177
|
+
|
|
178
|
+
Surfaces unconnected knowledge entries and prepares structured prompts for agent-driven graph enrichment.
|
|
179
|
+
|
|
180
|
+
**`reflect()`** — reads all entries, queries the knowledge graph for edges, identifies entries with zero connections, and generates a structured markdown prompt listing:
|
|
181
|
+
|
|
182
|
+
1. Unconnected entries with titles, categories, tags, and 300-char content summaries
|
|
183
|
+
2. Connected entries as potential link targets
|
|
184
|
+
3. Instructions for the agent to call `knowledge_link` with suggested relationships
|
|
185
|
+
|
|
186
|
+
Does NOT call an LLM — the calling agent processes the prompt in its own context and makes `knowledge_graph(action: "link")` calls based on its analysis.
|
|
187
|
+
|
|
160
188
|
## Session Module
|
|
161
189
|
|
|
162
190
|
### Multi-Source Architecture
|
package/docs/DASHBOARD.md
CHANGED
|
@@ -24,6 +24,11 @@ Card grid of knowledge entries. Each card shows:
|
|
|
24
24
|
|
|
25
25
|
Category filter chips at the top: All, Projects, People, Decisions, Workflows, Notes. Search bar for filtering entries by title.
|
|
26
26
|
|
|
27
|
+
**Header action buttons:**
|
|
28
|
+
|
|
29
|
+
- **Duplicates** — scans all entries for near-duplicates using TF-IDF similarity. Entries in duplicate clusters get a warning icon on their card. Opens a side panel showing clusters with pairwise similarity scores. Click any entry in a cluster to view it.
|
|
30
|
+
- **Reflect** — finds entries with no graph connections. Opens a side panel listing unconnected entries with content summaries and instructions for creating new links.
|
|
31
|
+
|
|
27
32
|
Click a card to open the side panel with rendered markdown content, score details, and related entries.
|
|
28
33
|
|
|
29
34
|
## Search Tab
|
|
@@ -111,6 +116,8 @@ File watcher monitors `src/ui/` for `.html`, `.css`, `.js` changes. On change, b
|
|
|
111
116
|
| GET | `/api/knowledge/search?q=` | Search knowledge |
|
|
112
117
|
| GET | `/api/knowledge/:path` | Read entry (with score data) |
|
|
113
118
|
| GET | `/api/knowledge/:path/links` | Graph edges for entry |
|
|
119
|
+
| GET | `/api/knowledge/consolidate?threshold=` | Duplicate cluster analysis |
|
|
120
|
+
| GET | `/api/knowledge/reflect?max_entries=` | Unconnected entries + prompt |
|
|
114
121
|
| GET | `/api/sessions` | List sessions |
|
|
115
122
|
| GET | `/api/sessions/search?q=&role=&ranked=` | Search sessions |
|
|
116
123
|
| GET | `/api/sessions/recall?scope=&q=` | Scoped recall |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-knowledge",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Cross-session memory and recall for AI agents — git-synced knowledge base, knowledge graph, confidence scoring, hybrid semantic+TF-IDF search, auto-distillation with secrets scrubbing",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|