agent-working-memory 0.3.0 → 0.3.2

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/README.md CHANGED
@@ -34,42 +34,104 @@ AWM is modeled on established cognitive science — ACT-R activation decay, Hebb
34
34
  | Real-World | **93.1% EXCELLENT** | 300 code chunks from a 71K-line production monorepo |
35
35
  | Token Savings | **64.5% savings** | Memory-guided context vs full conversation history |
36
36
 
37
- ## Getting Started
37
+ ## Quick Start — Claude Code (Recommended)
38
+
39
+ The fastest way to use AWM. Two commands, works in every project.
38
40
 
39
41
  ### Prerequisites
40
42
 
41
- You need **Node.js 20 or newer** installed on your machine. That's it no Python, no Docker, no API keys, no cloud accounts.
43
+ **Node.js 20+** download from [nodejs.org](https://nodejs.org) if needed. Check with `node --version`.
44
+
45
+ ### Install
42
46
 
43
- **Don't have Node.js?** Download the LTS version from [nodejs.org](https://nodejs.org). Run `node --version` in your terminal to check — if you see `v20.x.x` or higher, you're good.
47
+ ```bash
48
+ npm install -g agent-working-memory
49
+ ```
44
50
 
45
- ### Step 1: Get the Code
51
+ ### Setup (Global one brain for all projects)
46
52
 
47
53
  ```bash
48
- git clone https://github.com/CompleteIdeas/AgentWorkingMemory.git
49
- cd AgentWorkingMemory
54
+ awm setup --global
50
55
  ```
51
56
 
52
- ### Step 2: Install Dependencies
57
+ This writes `~/.mcp.json` so Claude Code picks up AWM everywhere. One unified memory across all your work.
58
+
59
+ **Restart Claude Code** to load the MCP server. The first conversation will download three small ML models (~124MB, cached locally). After that, everything runs on your machine — no API keys, no cloud calls.
60
+
61
+ ### Setup (Per-project)
62
+
63
+ If you prefer isolated memory per project instead:
53
64
 
54
65
  ```bash
55
- npm install
66
+ cd your-project
67
+ awm setup
68
+ ```
69
+
70
+ This creates `.mcp.json` in the current directory and appends workflow instructions to `CLAUDE.md`. Use `--agent-id my-project` to customize the agent identifier.
71
+
72
+ ### What Claude gets
73
+
74
+ After restarting Claude Code, 11 memory tools appear automatically:
75
+
76
+ | Tool | What it does |
77
+ |------|-------------|
78
+ | `memory_write` | Store a memory with salience metadata |
79
+ | `memory_recall` | Retrieve relevant memories by context |
80
+ | `memory_feedback` | Tell AWM if a memory was useful or not |
81
+ | `memory_retract` | Mark a wrong memory as invalid |
82
+ | `memory_stats` | View memory health metrics |
83
+ | `memory_checkpoint` | Save execution state (survives context compaction) |
84
+ | `memory_restore` | Recover state + relevant context at conversation start |
85
+ | `memory_task_add` | Create a prioritized task |
86
+ | `memory_task_update` | Change task status/priority |
87
+ | `memory_task_list` | List tasks by status |
88
+ | `memory_task_next` | Get the highest-priority actionable task |
89
+
90
+ You don't need to tell Claude to "use memory." Once connected, Claude will automatically write important decisions, recall relevant context, and learn from feedback. Over time, it builds up knowledge that persists across every conversation.
91
+
92
+ ### Optional: Add workflow instructions to CLAUDE.md
93
+
94
+ For per-project setups, `awm setup` does this automatically. For global setups, add this to any project's `CLAUDE.md` where you want explicit memory guidance:
95
+
96
+ ```markdown
97
+ ## Memory (AWM)
98
+ You have persistent memory via the agent-working-memory MCP server.
99
+ - At conversation start: call memory_restore to recover previous context
100
+ - When you learn something important: call memory_write
101
+ - When you need past context: call memory_recall
102
+ - Before long operations: call memory_checkpoint to save your state
103
+ - After using a recalled memory: call memory_feedback (useful/not-useful)
56
104
  ```
57
105
 
58
- This installs everything AWM needs. Takes about a minute depending on your internet connection.
106
+ ---
107
+
108
+ ## HTTP API (Alternative)
59
109
 
60
- ### Step 3: Start the Server
110
+ If you want to use AWM outside of Claude Code (custom agents, scripts, etc.), you can run the HTTP server directly.
111
+
112
+ ### From npm
61
113
 
62
114
  ```bash
115
+ npm install -g agent-working-memory
116
+ awm serve
117
+ ```
118
+
119
+ ### From source
120
+
121
+ ```bash
122
+ git clone https://github.com/CompleteIdeas/agent-working-memory.git
123
+ cd agent-working-memory
124
+ npm install
63
125
  npx tsx src/index.ts
64
126
  ```
65
127
 
66
- **The first time you run this, it downloads three small ML models (~124MB total).** These are cached locally in a `models/` folder — you'll never need to download them again. No API keys, no cloud calls. Everything runs on your machine.
128
+ **The first time you run this, it downloads three small ML models (~124MB total).** These are cached locally in a `models/` folder. No API keys, no cloud calls. Everything runs on your machine.
67
129
 
68
130
  Once you see `AWM server listening on port 8400`, the server is ready.
69
131
 
70
- ### Step 4: Try It Out
132
+ ### Try it
71
133
 
72
- Open a second terminal. Write a memory:
134
+ Write a memory:
73
135
 
74
136
  ```bash
75
137
  curl -X POST http://localhost:8400/memory/write \
@@ -84,7 +146,7 @@ curl -X POST http://localhost:8400/memory/write \
84
146
  }'
85
147
  ```
86
148
 
87
- Now recall it by asking a question:
149
+ Recall it:
88
150
 
89
151
  ```bash
90
152
  curl -X POST http://localhost:8400/memory/activate \
@@ -95,65 +157,15 @@ curl -X POST http://localhost:8400/memory/activate \
95
157
  }'
96
158
  ```
97
159
 
98
- You should see the memory come back with a relevance score and an explanation of why it matched. That's the 10-phase retrieval pipeline doing its thing.
99
-
100
- ### Tips for Technical People
101
-
102
- - **Change the port:** `AWM_PORT=3000 npx tsx src/index.ts`
103
- - **Custom database location:** `AWM_DB_PATH=/path/to/memory.db npx tsx src/index.ts`
104
- - **Run unit tests:** `npx vitest run` (47 tests, no server needed)
105
- - **Run eval suite:** Start the server first, then `npm run test:self` in another terminal
106
- - **Data lives in a single file:** `memory.db` in the project root (SQLite). Back it up, move it, delete it to start fresh.
107
- - **Models are cached locally:** First run downloads to `models/`. No network calls after that.
108
-
109
- ---
110
-
111
- ## Using with Claude Code (MCP Integration)
112
-
113
- This is the main use case — giving Claude Code persistent memory across conversations. AWM connects to Claude Code through the [Model Context Protocol (MCP)](https://modelcontextprotocol.io), which lets Claude use AWM's memory tools directly.
114
-
115
- ### Step 1: Find your project's MCP config
116
-
117
- In the project where you want Claude to have memory, create or edit `.mcp.json` in the project root:
118
-
119
- ```json
120
- {
121
- "mcpServers": {
122
- "agent-working-memory": {
123
- "command": "npx",
124
- "args": ["tsx", "C:/path/to/AgentWorkingMemory/src/mcp.ts"],
125
- "env": {
126
- "AWM_DB_PATH": "C:/path/to/memory.db",
127
- "AWM_AGENT_ID": "claude-code"
128
- }
129
- }
130
- }
131
- }
132
- ```
133
-
134
- **Replace the paths** with the actual location where you cloned AgentWorkingMemory. Use forward slashes even on Windows.
135
-
136
- ### Step 2: Restart Claude Code
137
-
138
- Close and reopen Claude Code (or run `/mcp` to reload). Claude will now have 9 new tools:
139
-
140
- | Tool | What it does |
141
- |------|-------------|
142
- | `memory_write` | Store a memory with salience metadata |
143
- | `memory_recall` | Retrieve relevant memories by context |
144
- | `memory_feedback` | Tell AWM if a memory was useful or not |
145
- | `memory_retract` | Mark a wrong memory as invalid |
146
- | `memory_stats` | View memory health metrics |
147
- | `memory_task_add` | Create a prioritized task |
148
- | `memory_task_update` | Change task status/priority |
149
- | `memory_task_list` | List tasks by status |
150
- | `memory_task_next` | Get the highest-priority actionable task |
151
-
152
- ### Step 3: Use it naturally
153
-
154
- You don't need to tell Claude to "use memory." Once MCP is connected, Claude will automatically write important decisions, recall relevant context, and learn from feedback. Over time, it builds up project knowledge that persists across every conversation.
160
+ ### Configuration
155
161
 
156
- **Pro tip:** You can use the same `memory.db` file across multiple projects if you want shared knowledge. Or use different databases per project for isolation — your call.
162
+ - **Change the port:** `awm serve --port 3000` or `AWM_PORT=3000`
163
+ - **Custom database:** `AWM_DB_PATH=/path/to/memory.db`
164
+ - **API key auth:** Set `AWM_API_KEY=your-secret` in `.env` — requests need `Authorization: Bearer your-secret` or `x-api-key: your-secret`
165
+ - **Run tests:** `npx vitest run` (65 tests)
166
+ - **Run eval suite:** `npm run test:self`
167
+ - **Data is a single file:** `data/memory.db` (SQLite). Back it up, move it, delete it to start fresh.
168
+ - **Models cached locally:** First run downloads to `models/`. No network after that.
157
169
 
158
170
  ---
159
171
 
package/dist/cli.js CHANGED
@@ -12,6 +12,7 @@ import { readFileSync, writeFileSync, mkdirSync, existsSync } from 'node:fs';
12
12
  import { resolve, basename, join, dirname } from 'node:path';
13
13
  import { execSync } from 'node:child_process';
14
14
  import { fileURLToPath } from 'node:url';
15
+ import { homedir as osHomedir } from 'node:os';
15
16
  const __filename = fileURLToPath(import.meta.url);
16
17
  const __dirname = dirname(__filename);
17
18
  // Load .env if present
@@ -39,16 +40,18 @@ function printUsage() {
39
40
  AgentWorkingMemory — Cognitive memory for AI agents
40
41
 
41
42
  Usage:
42
- awm setup [--agent-id <id>] [--db-path <path>] [--no-claude-md]
43
- Configure MCP for current project
43
+ awm setup [--global] [--agent-id <id>] [--db-path <path>] [--no-claude-md]
44
+ Configure MCP for Claude Code
44
45
  awm mcp Start MCP server (used by Claude Code)
45
46
  awm serve [--port <port>] Start HTTP API server
46
47
  awm health [--port <port>] Check server health
47
48
 
48
49
  Setup:
49
- Run 'awm setup' in your project directory. This creates .mcp.json
50
- and appends workflow instructions to CLAUDE.md so Claude Code
51
- automatically connects to your memory layer.
50
+ awm setup --global Recommended. Writes ~/.mcp.json so AWM is available
51
+ in every project one brain across all your work.
52
+
53
+ awm setup Project-level. Writes .mcp.json in the current directory
54
+ and appends workflow instructions to CLAUDE.md.
52
55
 
53
56
  Use --no-claude-md to skip CLAUDE.md modification.
54
57
  Restart Claude Code after setup to pick up the new MCP server.
@@ -62,6 +65,7 @@ function setup() {
62
65
  let agentId = projectName;
63
66
  let dbPath = null;
64
67
  let skipClaudeMd = false;
68
+ let isGlobal = false;
65
69
  for (let i = 1; i < args.length; i++) {
66
70
  if (args[i] === '--agent-id' && args[i + 1]) {
67
71
  agentId = args[++i];
@@ -72,6 +76,10 @@ function setup() {
72
76
  else if (args[i] === '--no-claude-md') {
73
77
  skipClaudeMd = true;
74
78
  }
79
+ else if (args[i] === '--global') {
80
+ isGlobal = true;
81
+ agentId = 'claude'; // unified agent ID for global setup
82
+ }
75
83
  }
76
84
  // Find the package root (where src/mcp.ts lives)
77
85
  const packageRoot = resolve(__dirname, '..');
@@ -123,7 +131,7 @@ function setup() {
123
131
  };
124
132
  }
125
133
  // Read or create .mcp.json
126
- const mcpJsonPath = join(cwd, '.mcp.json');
134
+ const mcpJsonPath = isGlobal ? join(osHomedir(), '.mcp.json') : join(cwd, '.mcp.json');
127
135
  let existing = { mcpServers: {} };
128
136
  if (existsSync(mcpJsonPath)) {
129
137
  try {
@@ -151,7 +159,16 @@ You have persistent memory via the agent-working-memory MCP server.
151
159
  - To retract incorrect info: call memory_retract
152
160
  - To manage tasks: call memory_task_add, memory_task_update, memory_task_list, memory_task_next
153
161
  `;
154
- const claudeMdPath = join(cwd, 'CLAUDE.md');
162
+ // For global: write to ~/.claude/CLAUDE.md (loaded by Claude Code in every session)
163
+ // For project: write to ./CLAUDE.md in the current directory
164
+ const claudeMdPath = isGlobal
165
+ ? join(osHomedir(), '.claude', 'CLAUDE.md')
166
+ : join(cwd, 'CLAUDE.md');
167
+ // Ensure parent directory exists (for ~/.claude/CLAUDE.md)
168
+ const claudeMdDir = dirname(claudeMdPath);
169
+ if (!existsSync(claudeMdDir)) {
170
+ mkdirSync(claudeMdDir, { recursive: true });
171
+ }
155
172
  if (skipClaudeMd) {
156
173
  claudeMdAction = ' CLAUDE.md: skipped (--no-claude-md)';
157
174
  }
@@ -166,11 +183,13 @@ You have persistent memory via the agent-working-memory MCP server.
166
183
  }
167
184
  }
168
185
  else {
169
- writeFileSync(claudeMdPath, `# ${basename(cwd)}\n${claudeMdSnippet}`);
186
+ const title = isGlobal ? '# Global Instructions' : `# ${basename(cwd)}`;
187
+ writeFileSync(claudeMdPath, `${title}\n${claudeMdSnippet}`);
170
188
  claudeMdAction = ' CLAUDE.md: created with AWM workflow section';
171
189
  }
190
+ const scope = isGlobal ? 'globally (all projects)' : cwd;
172
191
  console.log(`
173
- AWM configured for: ${cwd}
192
+ AWM configured ${isGlobal ? 'globally' : 'for: ' + cwd}
174
193
 
175
194
  Agent ID: ${agentId}
176
195
  DB path: ${dbPath}
@@ -179,7 +198,7 @@ ${claudeMdAction}
179
198
 
180
199
  Next steps:
181
200
  1. Restart Claude Code to pick up the MCP server
182
- 2. The memory tools will appear automatically
201
+ 2. The memory tools will appear automatically${isGlobal ? '\n 3. One brain across all your projects — no per-project setup needed' : ''}
183
202
  `.trim());
184
203
  }
185
204
  // ─── MCP ──────────────────────────────────────
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA;;;;;;;;GAQG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtC,uBAAuB;AACvB,IAAI,CAAC;IACH,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,CAAC,CAAC;IAC/C,MAAM,UAAU,GAAG,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAClD,KAAK,MAAM,IAAI,IAAI,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1C,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAC5B,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,SAAS;QAClD,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACnC,IAAI,KAAK,KAAK,CAAC,CAAC;YAAE,SAAS;QAC3B,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,KAA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AK,OAAO;QACV,KAAK,EAAE,CAAC;QACR,MAAM;IACR,KAAK,QAAQ;QACX,MAAM,EAAE,CAAC;QACT,MAAM;IACR,KAAK,QAAQ,CAAC;IACd,KAAK,IAAI,CAAC;IACV,KAAK,SAAS;QACZ,UAAU,EAAE,CAAC;QACb,MAAM;IACR;QACE,OAAO,CAAC,KAAK,CAAC,oBAAoB,OAAO,EAAE,CAAC,CAAC;QAC7C,UAAU,EAAE,CAAC;QACb,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-working-memory",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Cognitive memory layer for AI agents — activation-based retrieval, salience filtering, associative connections",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/src/cli.ts CHANGED
@@ -14,6 +14,7 @@ import { readFileSync, writeFileSync, mkdirSync, existsSync } from 'node:fs';
14
14
  import { resolve, basename, join, dirname } from 'node:path';
15
15
  import { execSync } from 'node:child_process';
16
16
  import { fileURLToPath } from 'node:url';
17
+ import { homedir as osHomedir } from 'node:os';
17
18
 
18
19
  const __filename = fileURLToPath(import.meta.url);
19
20
  const __dirname = dirname(__filename);
@@ -41,16 +42,18 @@ function printUsage() {
41
42
  AgentWorkingMemory — Cognitive memory for AI agents
42
43
 
43
44
  Usage:
44
- awm setup [--agent-id <id>] [--db-path <path>] [--no-claude-md]
45
- Configure MCP for current project
45
+ awm setup [--global] [--agent-id <id>] [--db-path <path>] [--no-claude-md]
46
+ Configure MCP for Claude Code
46
47
  awm mcp Start MCP server (used by Claude Code)
47
48
  awm serve [--port <port>] Start HTTP API server
48
49
  awm health [--port <port>] Check server health
49
50
 
50
51
  Setup:
51
- Run 'awm setup' in your project directory. This creates .mcp.json
52
- and appends workflow instructions to CLAUDE.md so Claude Code
53
- automatically connects to your memory layer.
52
+ awm setup --global Recommended. Writes ~/.mcp.json so AWM is available
53
+ in every project one brain across all your work.
54
+
55
+ awm setup Project-level. Writes .mcp.json in the current directory
56
+ and appends workflow instructions to CLAUDE.md.
54
57
 
55
58
  Use --no-claude-md to skip CLAUDE.md modification.
56
59
  Restart Claude Code after setup to pick up the new MCP server.
@@ -67,6 +70,7 @@ function setup() {
67
70
  let agentId = projectName;
68
71
  let dbPath: string | null = null;
69
72
  let skipClaudeMd = false;
73
+ let isGlobal = false;
70
74
 
71
75
  for (let i = 1; i < args.length; i++) {
72
76
  if (args[i] === '--agent-id' && args[i + 1]) {
@@ -75,6 +79,9 @@ function setup() {
75
79
  dbPath = args[++i];
76
80
  } else if (args[i] === '--no-claude-md') {
77
81
  skipClaudeMd = true;
82
+ } else if (args[i] === '--global') {
83
+ isGlobal = true;
84
+ agentId = 'claude'; // unified agent ID for global setup
78
85
  }
79
86
  }
80
87
 
@@ -132,7 +139,7 @@ function setup() {
132
139
  }
133
140
 
134
141
  // Read or create .mcp.json
135
- const mcpJsonPath = join(cwd, '.mcp.json');
142
+ const mcpJsonPath = isGlobal ? join(osHomedir(), '.mcp.json') : join(cwd, '.mcp.json');
136
143
  let existing: any = { mcpServers: {} };
137
144
  if (existsSync(mcpJsonPath)) {
138
145
  try {
@@ -161,7 +168,18 @@ You have persistent memory via the agent-working-memory MCP server.
161
168
  - To manage tasks: call memory_task_add, memory_task_update, memory_task_list, memory_task_next
162
169
  `;
163
170
 
164
- const claudeMdPath = join(cwd, 'CLAUDE.md');
171
+ // For global: write to ~/.claude/CLAUDE.md (loaded by Claude Code in every session)
172
+ // For project: write to ./CLAUDE.md in the current directory
173
+ const claudeMdPath = isGlobal
174
+ ? join(osHomedir(), '.claude', 'CLAUDE.md')
175
+ : join(cwd, 'CLAUDE.md');
176
+
177
+ // Ensure parent directory exists (for ~/.claude/CLAUDE.md)
178
+ const claudeMdDir = dirname(claudeMdPath);
179
+ if (!existsSync(claudeMdDir)) {
180
+ mkdirSync(claudeMdDir, { recursive: true });
181
+ }
182
+
165
183
  if (skipClaudeMd) {
166
184
  claudeMdAction = ' CLAUDE.md: skipped (--no-claude-md)';
167
185
  } else if (existsSync(claudeMdPath)) {
@@ -173,12 +191,14 @@ You have persistent memory via the agent-working-memory MCP server.
173
191
  claudeMdAction = ' CLAUDE.md: appended AWM workflow section';
174
192
  }
175
193
  } else {
176
- writeFileSync(claudeMdPath, `# ${basename(cwd)}\n${claudeMdSnippet}`);
194
+ const title = isGlobal ? '# Global Instructions' : `# ${basename(cwd)}`;
195
+ writeFileSync(claudeMdPath, `${title}\n${claudeMdSnippet}`);
177
196
  claudeMdAction = ' CLAUDE.md: created with AWM workflow section';
178
197
  }
179
198
 
199
+ const scope = isGlobal ? 'globally (all projects)' : cwd;
180
200
  console.log(`
181
- AWM configured for: ${cwd}
201
+ AWM configured ${isGlobal ? 'globally' : 'for: ' + cwd}
182
202
 
183
203
  Agent ID: ${agentId}
184
204
  DB path: ${dbPath}
@@ -187,7 +207,7 @@ ${claudeMdAction}
187
207
 
188
208
  Next steps:
189
209
  1. Restart Claude Code to pick up the MCP server
190
- 2. The memory tools will appear automatically
210
+ 2. The memory tools will appear automatically${isGlobal ? '\n 3. One brain across all your projects — no per-project setup needed' : ''}
191
211
  `.trim());
192
212
  }
193
213