@aitytech/agentkits-memory 1.0.0 → 1.0.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 AityTech
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,34 +1,162 @@
1
- # @agentkits/memory
2
-
3
- Project-scoped memory system for AgentKits with SQLite storage and optional HNSW vector search.
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/aitytech/agentkits-memory/main/assets/logo.svg" alt="AgentKits Logo" width="80" height="80">
3
+ </p>
4
+
5
+ <h1 align="center">AgentKits Memory</h1>
6
+
7
+ <p align="center">
8
+ <em>by <strong>AityTech</strong></em>
9
+ </p>
10
+
11
+ <p align="center">
12
+ <a href="https://www.npmjs.com/package/@aitytech/agentkits-memory"><img src="https://img.shields.io/npm/v/@aitytech/agentkits-memory.svg" alt="npm"></a>
13
+ <img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License">
14
+ <img src="https://img.shields.io/badge/Claude_Code-Compatible-blueviolet" alt="Claude Code">
15
+ <img src="https://img.shields.io/badge/Cursor-Compatible-blue" alt="Cursor">
16
+ <img src="https://img.shields.io/badge/Copilot-Compatible-green" alt="Copilot">
17
+ <img src="https://img.shields.io/badge/Windsurf-Compatible-cyan" alt="Windsurf">
18
+ <img src="https://img.shields.io/badge/Cline-Compatible-orange" alt="Cline">
19
+ </p>
20
+
21
+ <p align="center">
22
+ <strong>Persistent Memory System for AI Coding Assistants via MCP</strong>
23
+ </p>
24
+
25
+ <p align="center">
26
+ <em>Fast. Local. Zero external dependencies.</em>
27
+ </p>
28
+
29
+ <p align="center">
30
+ Store decisions, patterns, errors, and context that persists across sessions.<br>
31
+ No cloud. No API keys. No setup. Just works.
32
+ </p>
33
+
34
+ <p align="center">
35
+ <a href="#quick-start">Quick Start</a> •
36
+ <a href="#web-viewer">Web Viewer</a> •
37
+ <a href="#features">Features</a> •
38
+ <a href="#agentkits-ecosystem">Ecosystem</a> •
39
+ <a href="https://agentkits.net">agentkits.net</a>
40
+ </p>
41
+
42
+ ---
4
43
 
5
44
  ## Features
6
45
 
7
- - **Project-Scoped Storage**: Memory is stored in `.claude/memory/memory.db` within your project
8
- - **SQLite + WASM**: Cross-platform compatibility (Windows, macOS, Linux)
9
- - **Optional Vector Search**: HNSW indexing for semantic similarity search
10
- - **Session Tracking**: Track Claude Code sessions with checkpoints
11
- - **Migration Support**: Migrate from existing `.claude/memory/*.md` files
12
- - **Backward Compatible**: Export to markdown for git-friendly backups
46
+ | Feature | Benefit |
47
+ |---------|---------|
48
+ | **100% Local** | All data stays on your machine. No cloud, no API keys, no accounts |
49
+ | **Blazing Fast** | SQLite + WASM = instant queries, zero latency |
50
+ | **Zero Config** | Works out of the box. No database setup required |
51
+ | **Cross-Platform** | Windows, macOS, Linux - same code, same speed |
52
+ | **MCP Server** | `memory_save`, `memory_search`, `memory_recall`, `memory_list`, `memory_status` |
53
+ | **Web Viewer** | Browser UI to view, add, edit, delete memories |
54
+ | **Vector Search** | Optional HNSW semantic similarity (no external service) |
55
+ | **Auto-Capture** | Hooks for session context, tool usage, summaries |
56
+ | **Git-Friendly** | Export to markdown for version control |
57
+
58
+ ---
59
+
60
+ ## Web Viewer
13
61
 
14
- ## Installation
62
+ View and manage your memories through a modern web interface.
15
63
 
16
64
  ```bash
17
- npm install @agentkits/memory
18
- # or
19
- pnpm add @agentkits/memory
65
+ npx agentkits-memory-web
20
66
  ```
21
67
 
68
+ Then open **http://localhost:1905** in your browser.
69
+
70
+ ### Memory List
71
+
72
+ Browse all stored memories with search and namespace filtering.
73
+
74
+ ![Memory List](https://raw.githubusercontent.com/aitytech/agentkits-memory/main/assets/agentkits-memory-memory-list.png)
75
+
76
+ ### Add Memory
77
+
78
+ Create new memories with key, namespace, type, content, and tags.
79
+
80
+ ![Add Memory](https://raw.githubusercontent.com/aitytech/agentkits-memory/main/assets/agentkits-memory-add-memory.png)
81
+
82
+ ### Memory Details
83
+
84
+ View full memory details with edit and delete options.
85
+
86
+ ![Memory Detail](https://raw.githubusercontent.com/aitytech/agentkits-memory/main/assets/agentkits-memory-memory-detail.png)
87
+
88
+ ---
89
+
22
90
  ## Quick Start
23
91
 
92
+ ### 1. Install
93
+
94
+ ```bash
95
+ npm install @aitytech/agentkits-memory
96
+ ```
97
+
98
+ ### 2. Configure MCP Server
99
+
100
+ Add to your `.mcp.json` (or `.claude/.mcp.json`):
101
+
102
+ ```json
103
+ {
104
+ "mcpServers": {
105
+ "memory": {
106
+ "command": "npx",
107
+ "args": ["agentkits-memory-server"]
108
+ }
109
+ }
110
+ }
111
+ ```
112
+
113
+ ### 3. Use Memory Tools
114
+
115
+ Once configured, your AI assistant can use these tools:
116
+
117
+ | Tool | Description |
118
+ |------|-------------|
119
+ | `memory_save` | Save decisions, patterns, errors, or context |
120
+ | `memory_search` | Search memories using semantic similarity |
121
+ | `memory_recall` | Recall everything about a specific topic |
122
+ | `memory_list` | List recent memories |
123
+ | `memory_status` | Check memory system status |
124
+
125
+ ---
126
+
127
+ ## CLI Commands
128
+
129
+ ```bash
130
+ # Start MCP server
131
+ npx agentkits-memory-server
132
+
133
+ # Start web viewer (port 1905)
134
+ npx agentkits-memory-web
135
+
136
+ # View stored memories (terminal)
137
+ npx agentkits-memory-viewer
138
+
139
+ # Save memory from CLI
140
+ npx agentkits-memory-save "Use JWT with refresh tokens" --category pattern --tags auth,security
141
+
142
+ # Setup hooks for auto-capture
143
+ npx agentkits-memory-setup
144
+ ```
145
+
146
+ ---
147
+
148
+ ## Programmatic Usage
149
+
24
150
  ```typescript
25
- import { ProjectMemoryService } from '@agentkits/memory';
151
+ import { ProjectMemoryService } from '@aitytech/agentkits-memory';
26
152
 
27
- // Initialize memory for current project
28
- const memory = new ProjectMemoryService('.claude/memory');
153
+ const memory = new ProjectMemoryService({
154
+ baseDir: '.claude/memory',
155
+ dbFilename: 'memory.db',
156
+ });
29
157
  await memory.initialize();
30
158
 
31
- // Store an entry
159
+ // Store a memory
32
160
  await memory.storeEntry({
33
161
  key: 'auth-pattern',
34
162
  content: 'Use JWT with refresh tokens for authentication',
@@ -36,11 +164,11 @@ await memory.storeEntry({
36
164
  tags: ['auth', 'security'],
37
165
  });
38
166
 
39
- // Query entries
40
- const patterns = await memory.query({
167
+ // Query memories
168
+ const results = await memory.query({
41
169
  type: 'hybrid',
42
170
  namespace: 'patterns',
43
- tags: ['auth'],
171
+ content: 'authentication',
44
172
  limit: 10,
45
173
  });
46
174
 
@@ -48,84 +176,60 @@ const patterns = await memory.query({
48
176
  const entry = await memory.getByKey('patterns', 'auth-pattern');
49
177
  ```
50
178
 
51
- ## Session Management
179
+ ---
52
180
 
53
- ```typescript
54
- // Start a new session
55
- await memory.startSession();
181
+ ## Auto-Capture Hooks
56
182
 
57
- // Create checkpoints during work
58
- await memory.checkpoint('Completed authentication setup');
59
- await memory.checkpoint('Added user registration');
183
+ The package includes hooks for automatically capturing AI coding sessions:
60
184
 
61
- // End session with summary
62
- await memory.endSession('Successfully implemented auth flow');
185
+ | Hook | Trigger | Action |
186
+ |------|---------|--------|
187
+ | `context` | Session Start | Injects previous session context |
188
+ | `session-init` | First User Prompt | Initializes session record |
189
+ | `observation` | After Tool Use | Captures tool usage |
190
+ | `summarize` | Session End | Generates session summary |
63
191
 
64
- // Get recent sessions
65
- const sessions = await memory.getRecentSessions(5);
192
+ Setup hooks:
193
+ ```bash
194
+ npx agentkits-memory-setup
66
195
  ```
67
196
 
68
- ## Migration from Markdown
69
-
70
- ```typescript
71
- // Migrate existing .claude/memory/*.md files
72
- const result = await memory.migrateFromMarkdown();
73
- console.log(result.summary);
74
- // Output: "Migrated 24/24 entries"
197
+ Or manually copy `hooks.json` to your project:
198
+ ```bash
199
+ cp node_modules/@aitytech/agentkits-memory/hooks.json .claude/hooks.json
75
200
  ```
76
201
 
77
- ## Semantic Search (Optional)
202
+ ---
78
203
 
79
- ```typescript
80
- import { createEmbeddingMemory } from '@agentkits/memory';
81
-
82
- // Create memory with embedding support
83
- const memory = createEmbeddingMemory(
84
- '.claude/memory',
85
- async (text) => {
86
- // Your embedding function (e.g., OpenAI, local model)
87
- return await embeddings.embed(text);
88
- },
89
- 384 // dimensions
90
- );
204
+ ## Memory Categories
91
205
 
92
- await memory.initialize();
206
+ | Category | Use Case |
207
+ |----------|----------|
208
+ | `decision` | Architecture decisions, ADRs |
209
+ | `pattern` | Reusable code patterns |
210
+ | `error` | Error solutions and fixes |
211
+ | `context` | Project context and facts |
212
+ | `observation` | Session observations |
93
213
 
94
- // Semantic search
95
- const similar = await memory.semanticSearch('how to authenticate users', 5);
96
- ```
214
+ ---
97
215
 
98
- ## Export to Markdown
216
+ ## Storage
99
217
 
100
- ```typescript
101
- // Export namespace to markdown (for git)
102
- await memory.exportToMarkdown('patterns');
103
- // Creates: .claude/memory/patterns.md
218
+ Memories are stored in `.claude/memory/memory.db` within your project directory.
104
219
 
105
- // Export all namespaces
106
- const files = await memory.exportAllToMarkdown();
220
+ ```
221
+ .claude/memory/
222
+ ├── memory.db # SQLite database
223
+ ├── memory.db-wal # Write-ahead log (temp)
224
+ └── exports/ # Optional markdown exports
107
225
  ```
108
226
 
109
- ## Default Namespaces
110
-
111
- The memory system uses these default namespaces (matching existing `.md` file structure):
112
-
113
- | Namespace | Type | Purpose |
114
- |-----------|------|---------|
115
- | `context` | semantic | Project context and facts |
116
- | `active-context` | episodic | Current work focus |
117
- | `session-state` | episodic | Session handoff notes |
118
- | `progress` | episodic | Feature tracking |
119
- | `patterns` | semantic | Reusable code patterns |
120
- | `decisions` | procedural | ADRs and decisions |
121
- | `errors` | procedural | Error solutions |
227
+ ---
122
228
 
123
229
  ## API Reference
124
230
 
125
231
  ### ProjectMemoryService
126
232
 
127
- #### Configuration
128
-
129
233
  ```typescript
130
234
  interface ProjectMemoryConfig {
131
235
  baseDir: string; // Default: '.claude/memory'
@@ -136,115 +240,80 @@ interface ProjectMemoryConfig {
136
240
  cacheEnabled: boolean; // Default: true
137
241
  cacheSize: number; // Default: 1000
138
242
  cacheTtl: number; // Default: 300000 (5 min)
139
- autoPersistInterval: number; // Default: 10000 (10 sec)
140
- maxEntries: number; // Default: 100000
141
- verbose: boolean; // Default: false
142
243
  }
143
244
  ```
144
245
 
145
- #### Methods
246
+ ### Methods
146
247
 
147
248
  | Method | Description |
148
249
  |--------|-------------|
149
250
  | `initialize()` | Initialize the memory service |
150
251
  | `shutdown()` | Shutdown and persist changes |
151
- | `store(entry)` | Store a memory entry |
152
- | `storeEntry(input)` | Store from simple input |
252
+ | `storeEntry(input)` | Store a memory entry |
153
253
  | `get(id)` | Get entry by ID |
154
254
  | `getByKey(namespace, key)` | Get entry by namespace and key |
155
255
  | `update(id, update)` | Update an entry |
156
256
  | `delete(id)` | Delete an entry |
157
257
  | `query(query)` | Query entries with filters |
158
- | `search(embedding, options)` | Vector similarity search |
159
- | `semanticSearch(content, k)` | Search by content string |
258
+ | `semanticSearch(content, k)` | Semantic similarity search |
160
259
  | `count(namespace?)` | Count entries |
161
260
  | `listNamespaces()` | List all namespaces |
162
- | `clearNamespace(namespace)` | Clear a namespace |
163
- | `startSession()` | Start new session |
164
- | `checkpoint(description)` | Create checkpoint |
165
- | `endSession(summary?)` | End current session |
166
- | `migrateFromMarkdown()` | Migrate from .md files |
167
261
  | `exportToMarkdown(namespace)` | Export to markdown |
168
262
  | `getStats()` | Get statistics |
169
- | `healthCheck()` | Health check |
170
263
 
171
- ## Architecture
264
+ ---
172
265
 
173
- ```
174
- .claude/memory/
175
- ├── memory.db # SQLite database (primary storage)
176
- ├── memory.db-wal # Write-ahead log (temp)
177
- └── exports/ # Optional markdown exports
178
- ├── patterns.md
179
- ├── decisions.md
180
- └── ...
181
- ```
266
+ ## Requirements
182
267
 
183
- ## Performance
268
+ - Node.js >= 18.0.0
269
+ - MCP-compatible AI coding assistant
184
270
 
185
- | Operation | Time |
186
- |-----------|------|
187
- | Store entry | <5ms |
188
- | Get by ID | <2ms (cached: <0.1ms) |
189
- | Query (100 results) | <10ms |
190
- | Vector search (10k entries) | <5ms (with HNSW) |
191
- | Migration (100 files) | <2s |
271
+ ---
192
272
 
193
- ## Claude Code Hooks (Auto-Capture)
273
+ ## AgentKits Ecosystem
194
274
 
195
- The memory package includes a lightweight hook system for automatically capturing Claude Code sessions.
275
+ **AgentKits Memory** is part of the AgentKits ecosystem by AityTech - tools that make AI coding assistants smarter.
196
276
 
197
- ### Quick Setup
277
+ | Product | Description | Link |
278
+ |---------|-------------|------|
279
+ | **AgentKits Engineer** | 28 specialized agents, 100+ skills, enterprise patterns | [GitHub](https://github.com/aitytech/agentkits-engineer) |
280
+ | **AgentKits Marketing** | AI-powered marketing content generation | [GitHub](https://github.com/aitytech/agentkits-marketing) |
281
+ | **AgentKits Memory** | Persistent memory for AI assistants (this package) | [npm](https://www.npmjs.com/package/@aitytech/agentkits-memory) |
198
282
 
199
- 1. Install the package globally or in your project:
200
- ```bash
201
- npm install -g @agentkits/memory
202
- # or
203
- npm install @agentkits/memory
204
- ```
283
+ <p align="center">
284
+ <a href="https://agentkits.net">
285
+ <img src="https://img.shields.io/badge/Visit-agentkits.net-blue?style=for-the-badge" alt="agentkits.net">
286
+ </a>
287
+ </p>
205
288
 
206
- 2. Copy the hooks configuration to your project:
207
- ```bash
208
- cp node_modules/@agentkits/memory/hooks.json .claude/hooks.json
209
- ```
289
+ ---
210
290
 
211
- 3. Claude Code will now automatically:
212
- - Inject previous session context on start
213
- - Track all tool usage during the session
214
- - Generate session summaries on exit
291
+ ## Star History
215
292
 
216
- ### Hook Events
293
+ <a href="https://star-history.com/#aitytech/agentkits-memory&Date">
294
+ <picture>
295
+ <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=aitytech/agentkits-memory&type=Date&theme=dark" />
296
+ <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=aitytech/agentkits-memory&type=Date" />
297
+ <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=aitytech/agentkits-memory&type=Date" />
298
+ </picture>
299
+ </a>
217
300
 
218
- | Event | Trigger | Action |
219
- |-------|---------|--------|
220
- | `context` | SessionStart | Injects memory context |
221
- | `session-init` | UserPromptSubmit | Initializes session record |
222
- | `observation` | PostToolUse | Captures tool usage |
223
- | `summarize` | Stop | Generates session summary |
301
+ ---
224
302
 
225
- ### Manual Hook Usage
226
-
227
- ```typescript
228
- import { createContextHook, createObservationHook } from '@agentkits/memory/hooks';
229
-
230
- // Create hook handlers
231
- const contextHook = createContextHook(process.cwd());
232
- const observationHook = createObservationHook(process.cwd());
233
-
234
- // Execute hooks
235
- const result = await contextHook.execute(input);
236
- ```
237
-
238
- ### Database Location
303
+ ## License
239
304
 
240
- Hook data is stored in `.claude/memory/hooks.db` within your project directory.
305
+ MIT
241
306
 
242
- ### Skipped Tools
307
+ ---
243
308
 
244
- Internal tools that are not captured:
245
- - `TodoWrite`, `TodoRead`
246
- - `AskFollowupQuestion`, `AttemptCompletion`
309
+ <p align="center">
310
+ <strong>Give your AI assistant memory that persists.</strong>
311
+ </p>
247
312
 
248
- ## License
313
+ <p align="center">
314
+ <em>AgentKits Memory by AityTech</em>
315
+ </p>
249
316
 
250
- MIT - Based on claude-flow memory system (AGPL-3.0)
317
+ <p align="center">
318
+ Star this repo if it helps your AI remember.
319
+ </p>
@@ -0,0 +1,24 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40">
2
+ <defs>
3
+ <linearGradient id="logoGrad" x1="0%" y1="0%" x2="100%" y2="100%">
4
+ <stop offset="0%" style="stop-color:#2563EB"/>
5
+ <stop offset="100%" style="stop-color:#3B82F6"/>
6
+ </linearGradient>
7
+ </defs>
8
+ <!-- Background -->
9
+ <rect width="40" height="40" rx="8" fill="url(#logoGrad)"/>
10
+ <!-- Central hub -->
11
+ <circle cx="20" cy="20" r="5" fill="#fff"/>
12
+ <!-- Nodes -->
13
+ <circle cx="20" cy="9" r="3" fill="#fff"/>
14
+ <circle cx="20" cy="31" r="3" fill="#fff"/>
15
+ <circle cx="9" cy="20" r="3" fill="#fff"/>
16
+ <circle cx="31" cy="20" r="3" fill="#fff"/>
17
+ <!-- Connections -->
18
+ <line x1="20" y1="15" x2="20" y2="12" stroke="#fff" stroke-width="1.5" stroke-linecap="round"/>
19
+ <line x1="20" y1="25" x2="20" y2="28" stroke="#fff" stroke-width="1.5" stroke-linecap="round"/>
20
+ <line x1="15" y1="20" x2="12" y2="20" stroke="#fff" stroke-width="1.5" stroke-linecap="round"/>
21
+ <line x1="25" y1="20" x2="28" y2="20" stroke="#fff" stroke-width="1.5" stroke-linecap="round"/>
22
+ <!-- Center dot -->
23
+ <circle cx="20" cy="20" r="2" fill="#2563EB"/>
24
+ </svg>
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * AgentKits Memory Web Viewer
4
+ *
5
+ * Web-based viewer for memory database with CRUD support.
6
+ *
7
+ * Usage:
8
+ * npx agentkits-memory-web [--port=1905]
9
+ *
10
+ * @module @aitytech/agentkits-memory/cli/web-viewer
11
+ */
12
+ export {};
13
+ //# sourceMappingURL=web-viewer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-viewer.d.ts","sourceRoot":"","sources":["../../src/cli/web-viewer.ts"],"names":[],"mappings":";AACA;;;;;;;;;GASG"}