agent-working-memory 0.6.0 → 0.7.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/README.md +19 -9
- package/dist/adapters/claude-code.d.ts +4 -0
- package/dist/adapters/claude-code.d.ts.map +1 -0
- package/dist/adapters/claude-code.js +218 -0
- package/dist/adapters/claude-code.js.map +1 -0
- package/dist/adapters/codex.d.ts +4 -0
- package/dist/adapters/codex.d.ts.map +1 -0
- package/dist/adapters/codex.js +226 -0
- package/dist/adapters/codex.js.map +1 -0
- package/dist/adapters/common.d.ts +34 -0
- package/dist/adapters/common.d.ts.map +1 -0
- package/dist/adapters/common.js +145 -0
- package/dist/adapters/common.js.map +1 -0
- package/dist/adapters/cursor.d.ts +4 -0
- package/dist/adapters/cursor.d.ts.map +1 -0
- package/dist/adapters/cursor.js +138 -0
- package/dist/adapters/cursor.js.map +1 -0
- package/dist/adapters/http.d.ts +4 -0
- package/dist/adapters/http.d.ts.map +1 -0
- package/dist/adapters/http.js +88 -0
- package/dist/adapters/http.js.map +1 -0
- package/dist/adapters/index.d.ts +7 -0
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/index.js +21 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/adapters/types.d.ts +65 -0
- package/dist/adapters/types.d.ts.map +1 -0
- package/dist/adapters/types.js +4 -0
- package/dist/adapters/types.js.map +1 -0
- package/dist/api/routes.d.ts.map +1 -1
- package/dist/api/routes.js +1 -0
- package/dist/api/routes.js.map +1 -1
- package/dist/cli.js +104 -230
- package/dist/cli.js.map +1 -1
- package/dist/coordination/events.d.ts +59 -0
- package/dist/coordination/events.d.ts.map +1 -0
- package/dist/coordination/events.js +28 -0
- package/dist/coordination/events.js.map +1 -0
- package/dist/coordination/index.d.ts +10 -1
- package/dist/coordination/index.d.ts.map +1 -1
- package/dist/coordination/index.js +87 -3
- package/dist/coordination/index.js.map +1 -1
- package/dist/coordination/peer-decisions.d.ts +40 -0
- package/dist/coordination/peer-decisions.d.ts.map +1 -0
- package/dist/coordination/peer-decisions.js +82 -0
- package/dist/coordination/peer-decisions.js.map +1 -0
- package/dist/coordination/plugin-loader.d.ts +18 -0
- package/dist/coordination/plugin-loader.d.ts.map +1 -0
- package/dist/coordination/plugin-loader.js +55 -0
- package/dist/coordination/plugin-loader.js.map +1 -0
- package/dist/coordination/plugin.d.ts +40 -0
- package/dist/coordination/plugin.d.ts.map +1 -0
- package/dist/coordination/plugin.js +22 -0
- package/dist/coordination/plugin.js.map +1 -0
- package/dist/coordination/routes.d.ts +2 -1
- package/dist/coordination/routes.d.ts.map +1 -1
- package/dist/coordination/routes.js +899 -76
- package/dist/coordination/routes.js.map +1 -1
- package/dist/coordination/schema.d.ts.map +1 -1
- package/dist/coordination/schema.js +72 -14
- package/dist/coordination/schema.js.map +1 -1
- package/dist/coordination/schemas.d.ts +84 -3
- package/dist/coordination/schemas.d.ts.map +1 -1
- package/dist/coordination/schemas.js +71 -1
- package/dist/coordination/schemas.js.map +1 -1
- package/dist/coordination/stale.d.ts.map +1 -1
- package/dist/coordination/stale.js +2 -1
- package/dist/coordination/stale.js.map +1 -1
- package/dist/coordination/types.d.ts +252 -0
- package/dist/coordination/types.d.ts.map +1 -0
- package/dist/coordination/types.js +8 -0
- package/dist/coordination/types.js.map +1 -0
- package/dist/coordination/write-mutex.d.ts +26 -0
- package/dist/coordination/write-mutex.d.ts.map +1 -0
- package/dist/coordination/write-mutex.js +63 -0
- package/dist/coordination/write-mutex.js.map +1 -0
- package/dist/core/embeddings.d.ts +2 -0
- package/dist/core/embeddings.d.ts.map +1 -1
- package/dist/core/embeddings.js +4 -0
- package/dist/core/embeddings.js.map +1 -1
- package/dist/core/hebbian.d.ts +25 -1
- package/dist/core/hebbian.d.ts.map +1 -1
- package/dist/core/hebbian.js +71 -3
- package/dist/core/hebbian.js.map +1 -1
- package/dist/engine/activation.d.ts +22 -4
- package/dist/engine/activation.d.ts.map +1 -1
- package/dist/engine/activation.js +152 -76
- package/dist/engine/activation.js.map +1 -1
- package/dist/engine/consolidation.d.ts.map +1 -1
- package/dist/engine/consolidation.js +15 -6
- package/dist/engine/consolidation.js.map +1 -1
- package/dist/engine/retraction.d.ts +3 -1
- package/dist/engine/retraction.d.ts.map +1 -1
- package/dist/engine/retraction.js +19 -6
- package/dist/engine/retraction.js.map +1 -1
- package/dist/index.js +6 -18
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +61 -4
- package/dist/mcp.js.map +1 -1
- package/dist/storage/sqlite.d.ts +23 -1
- package/dist/storage/sqlite.d.ts.map +1 -1
- package/dist/storage/sqlite.js +112 -3
- package/dist/storage/sqlite.js.map +1 -1
- package/dist/types/engram.d.ts +1 -0
- package/dist/types/engram.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/adapters/claude-code.ts +234 -0
- package/src/adapters/codex.ts +262 -0
- package/src/adapters/common.ts +172 -0
- package/src/adapters/cursor.ts +150 -0
- package/src/adapters/http.ts +100 -0
- package/src/adapters/index.ts +31 -0
- package/src/adapters/types.ts +75 -0
- package/src/api/routes.ts +2 -0
- package/src/cli.ts +107 -238
- package/src/coordination/events.ts +90 -0
- package/src/coordination/index.ts +102 -3
- package/src/coordination/peer-decisions.ts +105 -0
- package/src/coordination/plugin-loader.ts +60 -0
- package/src/coordination/plugin.ts +44 -0
- package/src/coordination/routes.ts +1176 -105
- package/src/coordination/schema.ts +67 -14
- package/src/coordination/schemas.ts +85 -1
- package/src/coordination/stale.ts +3 -2
- package/src/coordination/types.ts +311 -0
- package/src/coordination/write-mutex.ts +69 -0
- package/src/core/embeddings.ts +5 -0
- package/src/core/hebbian.ts +84 -3
- package/src/engine/activation.ts +149 -73
- package/src/engine/consolidation.ts +15 -6
- package/src/engine/retraction.ts +22 -6
- package/src/index.ts +6 -15
- package/src/mcp.ts +77 -4
- package/src/storage/sqlite.ts +116 -3
- package/src/types/engram.ts +1 -0
package/README.md
CHANGED
|
@@ -65,7 +65,9 @@ Most "memory for AI" projects are vector databases with a retrieval wrapper. AWM
|
|
|
65
65
|
| **Over time** | Grows forever, gets noisier | Consolidation: diameter-enforced clustering, cross-topic bridges, synaptic-tagged decay |
|
|
66
66
|
| **Forgetting** | Manual cleanup | Cognitive forgetting: unused memories fade, reinforced knowledge persists (access-count modulated) |
|
|
67
67
|
| **Feedback** | None | Useful/not-useful signals tune confidence and retrieval rank |
|
|
68
|
-
| **Correction** | Delete and re-insert | Retraction: wrong memories invalidated, corrections linked, penalties propagate |
|
|
68
|
+
| **Correction** | Delete and re-insert | Retraction: wrong memories invalidated, corrections linked, penalties propagate (depth 2, decaying) |
|
|
69
|
+
| **Graph** | None or single graph | Multi-graph: semantic, temporal, causal, entity — independent traversal with fused scoring |
|
|
70
|
+
| **Learning** | Unconditional co-activation | Validation-gated: edges strengthen only on positive feedback (Kairos-inspired) |
|
|
69
71
|
| **Noise rejection** | None | Multi-channel agreement gate: requires 2+ retrieval channels to agree before returning results |
|
|
70
72
|
| **Duplicates** | Stored repeatedly | Reinforce-on-duplicate: near-exact matches boost existing memory instead of creating copies |
|
|
71
73
|
|
|
@@ -394,22 +396,30 @@ npm run test:locomo # LoCoMo industry benchmark (28.2%)
|
|
|
394
396
|
|
|
395
397
|
All three ML models run locally via ONNX. No external API calls for retrieval. The entire system is a single SQLite file + a Node.js process.
|
|
396
398
|
|
|
397
|
-
## What's New in v0.
|
|
399
|
+
## What's New in v0.7.0
|
|
400
|
+
|
|
401
|
+
- **Workspace-scoped recall** — `memory_recall` can now search across all agents in a workspace. Essential for hive workflows where decisions and discoveries need to be instantly available to all agents. Set `AWM_WORKSPACE` env var or pass `workspace` parameter. Standalone agents unaffected.
|
|
402
|
+
- **Validation-gated Hebbian learning** (Kairos-inspired) — associations only strengthen when `memory_feedback(useful=true)` confirms the retrieval was valuable. Prevents hub toxicity from noisy co-retrieval. No feedback = neutral. Negative feedback = slight weakening.
|
|
403
|
+
- **Multi-graph traversal** (MAGMA-inspired) — graph walk decomposed into four orthogonal sub-graphs (semantic, temporal, causal, entity), each with independent beam search and specialized scoring. Boosts fused across sub-graphs. Inspired by MAGMA's 45.5% accuracy gains.
|
|
404
|
+
- **Power-law edge decay** (DASH model) — edges decay via power law instead of exponential. Retains valuable old associations ~5x longer at 30 days. Matches empirical human forgetting curves.
|
|
405
|
+
|
|
406
|
+
### v0.6.1
|
|
407
|
+
|
|
408
|
+
- Embedding version tracking, batch backfill, deeper retraction propagation, retrieval timeouts, channel push delivery.
|
|
409
|
+
|
|
410
|
+
### v0.6.0
|
|
398
411
|
|
|
399
412
|
- **Memory taxonomy** — memories classified as `episodic`, `semantic`, `procedural`, or `unclassified`. Auto-classified on write. Filter by type on recall.
|
|
400
|
-
- **Query-adaptive retrieval** — pipeline adapts to query type: `targeted`
|
|
401
|
-
- **Decision propagation** — decisions
|
|
402
|
-
- **
|
|
403
|
-
- **Task priority & dependencies** — priority field (0-10) and `blocked_by` for task ordering.
|
|
404
|
-
- **Eval harness** — `npm run eval` benchmarks retrieval, associative, redundancy, and temporal performance with ablation mode.
|
|
413
|
+
- **Query-adaptive retrieval** — pipeline adapts to query type: `targeted` | `exploratory` | `balanced` | `auto`.
|
|
414
|
+
- **Decision propagation** — decisions broadcast to coordination layer for cross-agent discovery.
|
|
415
|
+
- **Eval harness** — `npm run eval` benchmarks retrieval, associative, redundancy, and temporal performance.
|
|
405
416
|
- **DB hardening** — busy_timeout, integrity check on startup, hot backups every 10 min, WAL checkpoint on shutdown.
|
|
406
|
-
- **Consolidation recall fix** — redundancy pruning transfers associations and tags to survivor memory.
|
|
407
417
|
|
|
408
418
|
See [CHANGELOG.md](CHANGELOG.md) for full details.
|
|
409
419
|
|
|
410
420
|
## Project Status
|
|
411
421
|
|
|
412
|
-
AWM is in active development (v0.
|
|
422
|
+
AWM is in active development (v0.7.0). The core memory pipeline, consolidation system, multi-agent coordination, and MCP integration are stable and used daily in production coding workflows.
|
|
413
423
|
|
|
414
424
|
- Core retrieval and consolidation: **stable**
|
|
415
425
|
- MCP tools and Claude Code integration: **stable**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-code.d.ts","sourceRoot":"","sources":["../../src/adapters/claude-code.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,UAAU,EAAkC,MAAM,YAAY,CAAC;AAG7E,QAAA,MAAM,OAAO,EAAE,UAwNd,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
// Copyright 2026 Robert Winter / Complete Ideas
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
/**
|
|
4
|
+
* Claude Code adapter — writes .mcp.json, CLAUDE.md, and hooks.
|
|
5
|
+
*
|
|
6
|
+
* This is a direct extraction of the original setup() behavior.
|
|
7
|
+
* Zero behavioral change from the monolithic version.
|
|
8
|
+
*/
|
|
9
|
+
import { readFileSync, writeFileSync, mkdirSync, existsSync } from 'node:fs';
|
|
10
|
+
import { join, dirname, basename } from 'node:path';
|
|
11
|
+
import { resolveMcpCommand, homedir, AWM_INSTRUCTION_CONTENT } from './common.js';
|
|
12
|
+
const adapter = {
|
|
13
|
+
id: 'claude-code',
|
|
14
|
+
name: 'Claude Code',
|
|
15
|
+
supportsProjectScope: true,
|
|
16
|
+
supportsGlobalScope: true,
|
|
17
|
+
writeMcpConfig(ctx) {
|
|
18
|
+
const mcpCmd = resolveMcpCommand(ctx);
|
|
19
|
+
const mcpConfig = { ...mcpCmd, env: ctx.envVars };
|
|
20
|
+
// Global: ~/.mcp.json (standard MCP location, all projects)
|
|
21
|
+
// Project: .claude/mcp.json (Claude Code's native project scope)
|
|
22
|
+
const mcpJsonPath = ctx.isGlobal
|
|
23
|
+
? join(homedir(), '.mcp.json')
|
|
24
|
+
: join(ctx.cwd, '.claude', 'mcp.json');
|
|
25
|
+
const mcpDir = dirname(mcpJsonPath);
|
|
26
|
+
if (!existsSync(mcpDir)) {
|
|
27
|
+
mkdirSync(mcpDir, { recursive: true });
|
|
28
|
+
}
|
|
29
|
+
let existing = {};
|
|
30
|
+
if (existsSync(mcpJsonPath)) {
|
|
31
|
+
try {
|
|
32
|
+
existing = JSON.parse(readFileSync(mcpJsonPath, 'utf-8'));
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
existing = {};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (!existing.mcpServers)
|
|
39
|
+
existing.mcpServers = {};
|
|
40
|
+
existing.mcpServers['agent-working-memory'] = mcpConfig;
|
|
41
|
+
writeFileSync(mcpJsonPath, JSON.stringify(existing, null, 2) + '\n');
|
|
42
|
+
return `MCP config: ${mcpJsonPath}`;
|
|
43
|
+
},
|
|
44
|
+
writeInstructions(ctx, skip) {
|
|
45
|
+
const claudeMdPath = ctx.isGlobal
|
|
46
|
+
? join(homedir(), '.claude', 'CLAUDE.md')
|
|
47
|
+
: join(ctx.cwd, 'CLAUDE.md');
|
|
48
|
+
if (skip)
|
|
49
|
+
return 'CLAUDE.md: skipped (--no-instructions)';
|
|
50
|
+
// Ensure parent directory exists
|
|
51
|
+
const dir = dirname(claudeMdPath);
|
|
52
|
+
if (!existsSync(dir)) {
|
|
53
|
+
mkdirSync(dir, { recursive: true });
|
|
54
|
+
}
|
|
55
|
+
if (existsSync(claudeMdPath)) {
|
|
56
|
+
const content = readFileSync(claudeMdPath, 'utf-8');
|
|
57
|
+
if (content.includes('## Memory (AWM)')) {
|
|
58
|
+
return 'CLAUDE.md: already has AWM section (skipped)';
|
|
59
|
+
}
|
|
60
|
+
writeFileSync(claudeMdPath, content.trimEnd() + '\n\n' + AWM_INSTRUCTION_CONTENT);
|
|
61
|
+
return 'CLAUDE.md: appended AWM workflow section';
|
|
62
|
+
}
|
|
63
|
+
const title = ctx.isGlobal ? '# Global Instructions' : `# ${basename(ctx.cwd)}`;
|
|
64
|
+
writeFileSync(claudeMdPath, `${title}\n\n${AWM_INSTRUCTION_CONTENT}`);
|
|
65
|
+
return 'CLAUDE.md: created with AWM workflow section';
|
|
66
|
+
},
|
|
67
|
+
writeHooks(ctx, skip) {
|
|
68
|
+
if (skip)
|
|
69
|
+
return 'Hooks: skipped (--no-hooks)';
|
|
70
|
+
const settingsPath = join(homedir(), '.claude', 'settings.json');
|
|
71
|
+
let settings = {};
|
|
72
|
+
if (existsSync(settingsPath)) {
|
|
73
|
+
try {
|
|
74
|
+
settings = JSON.parse(readFileSync(settingsPath, 'utf-8'));
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
settings = {};
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (!settings.hooks)
|
|
81
|
+
settings.hooks = {};
|
|
82
|
+
const hookUrl = `http://127.0.0.1:${ctx.hookPort}/hooks/checkpoint`;
|
|
83
|
+
// Stop — remind Claude to write/recall/switch tasks
|
|
84
|
+
settings.hooks.Stop = [{
|
|
85
|
+
matcher: '',
|
|
86
|
+
hooks: [{
|
|
87
|
+
type: 'command',
|
|
88
|
+
command: 'echo "MEMORY: (1) Did you learn anything new? Call memory_write. (2) Are you about to work on a topic you might have prior knowledge about? Call memory_recall. (3) Switching tasks? Call memory_task_begin."',
|
|
89
|
+
timeout: 5,
|
|
90
|
+
async: true,
|
|
91
|
+
}],
|
|
92
|
+
}];
|
|
93
|
+
// Multi-port fallback for separate memory pools
|
|
94
|
+
const altPort = ctx.hookPort === '8401' ? '8402' : '8401';
|
|
95
|
+
const hookUrlAlt = `http://127.0.0.1:${altPort}/hooks/checkpoint`;
|
|
96
|
+
const buildHookCmd = (event, maxTime) => {
|
|
97
|
+
const primary = `curl -sf -X POST ${hookUrl} -H "Content-Type: application/json" -H "Authorization: Bearer ${ctx.hookSecret}" -d "{\\"hook_event_name\\":\\"${event}\\"}" --max-time ${maxTime}`;
|
|
98
|
+
const fallback = `curl -sf -X POST ${hookUrlAlt} -H "Content-Type: application/json" -H "Authorization: Bearer ${ctx.hookSecret}" -d "{\\"hook_event_name\\":\\"${event}\\"}" --max-time ${maxTime}`;
|
|
99
|
+
return `${primary} || ${fallback}`;
|
|
100
|
+
};
|
|
101
|
+
// PreCompact — auto-checkpoint before context compaction
|
|
102
|
+
settings.hooks.PreCompact = [{
|
|
103
|
+
matcher: '',
|
|
104
|
+
hooks: [{
|
|
105
|
+
type: 'command',
|
|
106
|
+
command: buildHookCmd('PreCompact', 5),
|
|
107
|
+
timeout: 10,
|
|
108
|
+
}],
|
|
109
|
+
}];
|
|
110
|
+
// SessionEnd — auto-checkpoint on session close
|
|
111
|
+
settings.hooks.SessionEnd = [{
|
|
112
|
+
matcher: '',
|
|
113
|
+
hooks: [{
|
|
114
|
+
type: 'command',
|
|
115
|
+
command: buildHookCmd('SessionEnd', 2),
|
|
116
|
+
timeout: 5,
|
|
117
|
+
}],
|
|
118
|
+
}];
|
|
119
|
+
const settingsDir = dirname(settingsPath);
|
|
120
|
+
if (!existsSync(settingsDir)) {
|
|
121
|
+
mkdirSync(settingsDir, { recursive: true });
|
|
122
|
+
}
|
|
123
|
+
writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + '\n');
|
|
124
|
+
return `Hooks: Stop + PreCompact + SessionEnd (port ${ctx.hookPort})`;
|
|
125
|
+
},
|
|
126
|
+
diagnose(ctx) {
|
|
127
|
+
const results = [];
|
|
128
|
+
// Check MCP config — Claude Code reads from both locations, check all
|
|
129
|
+
const globalPath = join(homedir(), '.mcp.json');
|
|
130
|
+
const projectPath = join(ctx.cwd, '.claude', 'mcp.json');
|
|
131
|
+
const candidates = [projectPath, globalPath];
|
|
132
|
+
let foundConfig = false;
|
|
133
|
+
for (const mcpJsonPath of candidates) {
|
|
134
|
+
if (!existsSync(mcpJsonPath))
|
|
135
|
+
continue;
|
|
136
|
+
try {
|
|
137
|
+
const config = JSON.parse(readFileSync(mcpJsonPath, 'utf-8'));
|
|
138
|
+
if (config.mcpServers?.['agent-working-memory']) {
|
|
139
|
+
results.push({ check: 'MCP config', status: 'ok', message: `AWM registered in ${mcpJsonPath}` });
|
|
140
|
+
foundConfig = true;
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
catch { /* not valid JSON, skip */ }
|
|
145
|
+
}
|
|
146
|
+
if (!foundConfig) {
|
|
147
|
+
results.push({
|
|
148
|
+
check: 'MCP config',
|
|
149
|
+
status: 'fail',
|
|
150
|
+
message: 'No AWM MCP config found',
|
|
151
|
+
fix: `Run: awm setup claude-code${ctx.isGlobal ? ' --global' : ''}`,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
// Check MCP entrypoint
|
|
155
|
+
if (ctx.hasDist) {
|
|
156
|
+
results.push({ check: 'MCP entrypoint', status: 'ok', message: `dist/mcp.js exists` });
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
results.push({
|
|
160
|
+
check: 'MCP entrypoint',
|
|
161
|
+
status: 'warn',
|
|
162
|
+
message: 'dist/mcp.js not found — using dev mode (npx tsx)',
|
|
163
|
+
fix: 'Run: npm run build',
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
// Check database
|
|
167
|
+
if (existsSync(ctx.dbPath)) {
|
|
168
|
+
results.push({ check: 'Database', status: 'ok', message: ctx.dbPath });
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
results.push({ check: 'Database', status: 'warn', message: `${ctx.dbPath} not found (will be created on first use)` });
|
|
172
|
+
}
|
|
173
|
+
// Check CLAUDE.md
|
|
174
|
+
const claudeMdPath = ctx.isGlobal
|
|
175
|
+
? join(homedir(), '.claude', 'CLAUDE.md')
|
|
176
|
+
: join(ctx.cwd, 'CLAUDE.md');
|
|
177
|
+
if (existsSync(claudeMdPath)) {
|
|
178
|
+
const content = readFileSync(claudeMdPath, 'utf-8');
|
|
179
|
+
if (content.includes('## Memory (AWM)')) {
|
|
180
|
+
results.push({ check: 'Instructions', status: 'ok', message: `CLAUDE.md has AWM section` });
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
results.push({
|
|
184
|
+
check: 'Instructions',
|
|
185
|
+
status: 'warn',
|
|
186
|
+
message: `CLAUDE.md exists but missing AWM section`,
|
|
187
|
+
fix: `Run: awm setup claude-code${ctx.isGlobal ? ' --global' : ''}`,
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
results.push({ check: 'Instructions', status: 'warn', message: `CLAUDE.md not found` });
|
|
193
|
+
}
|
|
194
|
+
// Check hooks
|
|
195
|
+
const settingsPath = join(homedir(), '.claude', 'settings.json');
|
|
196
|
+
if (existsSync(settingsPath)) {
|
|
197
|
+
try {
|
|
198
|
+
const settings = JSON.parse(readFileSync(settingsPath, 'utf-8'));
|
|
199
|
+
const hasHooks = settings.hooks?.PreCompact && settings.hooks?.SessionEnd;
|
|
200
|
+
if (hasHooks) {
|
|
201
|
+
results.push({ check: 'Hooks', status: 'ok', message: 'PreCompact + SessionEnd configured' });
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
results.push({ check: 'Hooks', status: 'warn', message: 'Hooks partially configured' });
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
catch {
|
|
208
|
+
results.push({ check: 'Hooks', status: 'warn', message: 'settings.json is not valid JSON' });
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
results.push({ check: 'Hooks', status: 'warn', message: 'No hooks configured (auto-checkpoint disabled)' });
|
|
213
|
+
}
|
|
214
|
+
return results;
|
|
215
|
+
},
|
|
216
|
+
};
|
|
217
|
+
export default adapter;
|
|
218
|
+
//# sourceMappingURL=claude-code.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-code.js","sourceRoot":"","sources":["../../src/adapters/claude-code.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,sCAAsC;AAEtC;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAA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O,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../src/adapters/codex.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,UAAU,EAAkC,MAAM,YAAY,CAAC;AA4G7E,QAAA,MAAM,OAAO,EAAE,UA2Id,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
// Copyright 2026 Robert Winter / Complete Ideas
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
/**
|
|
4
|
+
* Codex CLI adapter — writes TOML config, AGENTS.md instructions.
|
|
5
|
+
*
|
|
6
|
+
* Codex stores MCP config in ~/.codex/config.toml (global only).
|
|
7
|
+
* Uses snake_case [mcp_servers.name] sections.
|
|
8
|
+
*/
|
|
9
|
+
import { readFileSync, writeFileSync, mkdirSync, existsSync } from 'node:fs';
|
|
10
|
+
import { join, dirname, basename } from 'node:path';
|
|
11
|
+
import { resolveMcpCommand, homedir, AWM_INSTRUCTION_CONTENT } from './common.js';
|
|
12
|
+
function parseTOML(content) {
|
|
13
|
+
const doc = { sections: new Map(), preamble: [] };
|
|
14
|
+
let currentSection = '';
|
|
15
|
+
const lines = content.split('\n');
|
|
16
|
+
for (const line of lines) {
|
|
17
|
+
const trimmed = line.trim();
|
|
18
|
+
// Section header
|
|
19
|
+
const sectionMatch = trimmed.match(/^\[([^\]]+)\]$/);
|
|
20
|
+
if (sectionMatch) {
|
|
21
|
+
currentSection = sectionMatch[1];
|
|
22
|
+
if (!doc.sections.has(currentSection)) {
|
|
23
|
+
doc.sections.set(currentSection, {});
|
|
24
|
+
}
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
// Skip comments and empty lines
|
|
28
|
+
if (!trimmed || trimmed.startsWith('#')) {
|
|
29
|
+
if (!currentSection)
|
|
30
|
+
doc.preamble.push(line);
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
// Key = value
|
|
34
|
+
const eqIdx = trimmed.indexOf('=');
|
|
35
|
+
if (eqIdx === -1) {
|
|
36
|
+
if (!currentSection)
|
|
37
|
+
doc.preamble.push(line);
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
const key = trimmed.slice(0, eqIdx).trim();
|
|
41
|
+
const rawVal = trimmed.slice(eqIdx + 1).trim();
|
|
42
|
+
if (!currentSection) {
|
|
43
|
+
if (!doc.sections.has(''))
|
|
44
|
+
doc.sections.set('', {});
|
|
45
|
+
doc.sections.get('')[key] = parseTomlValue(rawVal);
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
if (!doc.sections.has(currentSection)) {
|
|
49
|
+
doc.sections.set(currentSection, {});
|
|
50
|
+
}
|
|
51
|
+
doc.sections.get(currentSection)[key] = parseTomlValue(rawVal);
|
|
52
|
+
}
|
|
53
|
+
return doc;
|
|
54
|
+
}
|
|
55
|
+
function parseTomlValue(raw) {
|
|
56
|
+
// Array: ["a", "b"]
|
|
57
|
+
if (raw.startsWith('[')) {
|
|
58
|
+
const inner = raw.slice(1, raw.lastIndexOf(']'));
|
|
59
|
+
return inner.split(',')
|
|
60
|
+
.map(s => s.trim().replace(/^["']|["']$/g, ''))
|
|
61
|
+
.filter(s => s.length > 0);
|
|
62
|
+
}
|
|
63
|
+
// Quoted string
|
|
64
|
+
return raw.replace(/^["']|["']$/g, '');
|
|
65
|
+
}
|
|
66
|
+
function serializeTOML(doc) {
|
|
67
|
+
const lines = [];
|
|
68
|
+
// Preamble (top-level content before any section)
|
|
69
|
+
if (doc.preamble.length > 0) {
|
|
70
|
+
lines.push(...doc.preamble);
|
|
71
|
+
if (lines.length > 0 && lines[lines.length - 1].trim() !== '') {
|
|
72
|
+
lines.push('');
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
for (const [section, values] of doc.sections) {
|
|
76
|
+
if (section === '')
|
|
77
|
+
continue; // already in preamble
|
|
78
|
+
lines.push(`[${section}]`);
|
|
79
|
+
for (const [key, val] of Object.entries(values)) {
|
|
80
|
+
if (Array.isArray(val)) {
|
|
81
|
+
const items = val.map(v => `"${v}"`).join(', ');
|
|
82
|
+
lines.push(`${key} = [${items}]`);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
lines.push(`${key} = "${val}"`);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
lines.push('');
|
|
89
|
+
}
|
|
90
|
+
return lines.join('\n');
|
|
91
|
+
}
|
|
92
|
+
// ─── Adapter ──────────────────────────────────────────
|
|
93
|
+
const adapter = {
|
|
94
|
+
id: 'codex',
|
|
95
|
+
name: 'Codex',
|
|
96
|
+
supportsProjectScope: false,
|
|
97
|
+
supportsGlobalScope: true,
|
|
98
|
+
writeMcpConfig(ctx) {
|
|
99
|
+
if (!ctx.isGlobal) {
|
|
100
|
+
console.log(' Note: Codex only supports global MCP config. Using --global automatically.');
|
|
101
|
+
}
|
|
102
|
+
const configPath = join(homedir(), '.codex', 'config.toml');
|
|
103
|
+
const mcpCmd = resolveMcpCommand(ctx);
|
|
104
|
+
// Read existing config or start fresh
|
|
105
|
+
let doc;
|
|
106
|
+
if (existsSync(configPath)) {
|
|
107
|
+
doc = parseTOML(readFileSync(configPath, 'utf-8'));
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
doc = { sections: new Map(), preamble: [] };
|
|
111
|
+
mkdirSync(dirname(configPath), { recursive: true });
|
|
112
|
+
}
|
|
113
|
+
// Write the MCP server section
|
|
114
|
+
const sectionName = 'mcp_servers.agent-working-memory';
|
|
115
|
+
doc.sections.set(sectionName, {
|
|
116
|
+
command: mcpCmd.command,
|
|
117
|
+
args: mcpCmd.args,
|
|
118
|
+
});
|
|
119
|
+
// Write env vars in a sub-section
|
|
120
|
+
const envSection = `${sectionName}.env`;
|
|
121
|
+
const envEntries = {};
|
|
122
|
+
for (const [key, val] of Object.entries(ctx.envVars)) {
|
|
123
|
+
envEntries[key] = val;
|
|
124
|
+
}
|
|
125
|
+
doc.sections.set(envSection, envEntries);
|
|
126
|
+
writeFileSync(configPath, serializeTOML(doc));
|
|
127
|
+
return `MCP config: ${configPath}`;
|
|
128
|
+
},
|
|
129
|
+
writeInstructions(ctx, skip) {
|
|
130
|
+
const agentsMdPath = join(ctx.cwd, 'AGENTS.md');
|
|
131
|
+
if (skip)
|
|
132
|
+
return 'AGENTS.md: skipped (--no-instructions)';
|
|
133
|
+
if (existsSync(agentsMdPath)) {
|
|
134
|
+
const content = readFileSync(agentsMdPath, 'utf-8');
|
|
135
|
+
if (content.includes('## Memory (AWM)')) {
|
|
136
|
+
return 'AGENTS.md: already has AWM section (skipped)';
|
|
137
|
+
}
|
|
138
|
+
writeFileSync(agentsMdPath, content.trimEnd() + '\n\n' + AWM_INSTRUCTION_CONTENT);
|
|
139
|
+
return 'AGENTS.md: appended AWM workflow section';
|
|
140
|
+
}
|
|
141
|
+
const title = `# ${basename(ctx.cwd)} — Agent Instructions`;
|
|
142
|
+
writeFileSync(agentsMdPath, `${title}\n\n${AWM_INSTRUCTION_CONTENT}`);
|
|
143
|
+
return 'AGENTS.md: created with AWM workflow section';
|
|
144
|
+
},
|
|
145
|
+
writeHooks(_ctx, _skip) {
|
|
146
|
+
return 'Hooks: not supported by Codex (auto-checkpoint unavailable)';
|
|
147
|
+
},
|
|
148
|
+
diagnose(ctx) {
|
|
149
|
+
const results = [];
|
|
150
|
+
// Check TOML config
|
|
151
|
+
const configPath = join(homedir(), '.codex', 'config.toml');
|
|
152
|
+
if (!existsSync(configPath)) {
|
|
153
|
+
results.push({
|
|
154
|
+
check: 'MCP config',
|
|
155
|
+
status: 'fail',
|
|
156
|
+
message: `${configPath} not found`,
|
|
157
|
+
fix: 'Run: awm setup codex',
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
try {
|
|
162
|
+
const doc = parseTOML(readFileSync(configPath, 'utf-8'));
|
|
163
|
+
if (doc.sections.has('mcp_servers.agent-working-memory')) {
|
|
164
|
+
results.push({ check: 'MCP config', status: 'ok', message: `AWM registered in ${configPath}` });
|
|
165
|
+
// Verify the command points to a real file
|
|
166
|
+
const section = doc.sections.get('mcp_servers.agent-working-memory');
|
|
167
|
+
const args = section.args;
|
|
168
|
+
if (Array.isArray(args) && args.length > 0) {
|
|
169
|
+
const entrypoint = args[args.length - 1];
|
|
170
|
+
if (existsSync(entrypoint)) {
|
|
171
|
+
results.push({ check: 'MCP entrypoint', status: 'ok', message: entrypoint });
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
results.push({
|
|
175
|
+
check: 'MCP entrypoint',
|
|
176
|
+
status: 'fail',
|
|
177
|
+
message: `Configured entrypoint not found: ${entrypoint}`,
|
|
178
|
+
fix: 'Run: npm run build (in AWM package) then awm setup codex',
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
results.push({
|
|
185
|
+
check: 'MCP config',
|
|
186
|
+
status: 'fail',
|
|
187
|
+
message: 'config.toml exists but missing agent-working-memory section',
|
|
188
|
+
fix: 'Run: awm setup codex',
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
catch {
|
|
193
|
+
results.push({ check: 'MCP config', status: 'fail', message: `${configPath} could not be parsed` });
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
// Check database
|
|
197
|
+
if (existsSync(ctx.dbPath)) {
|
|
198
|
+
results.push({ check: 'Database', status: 'ok', message: ctx.dbPath });
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
results.push({ check: 'Database', status: 'warn', message: `${ctx.dbPath} not found (will be created on first use)` });
|
|
202
|
+
}
|
|
203
|
+
// Check AGENTS.md
|
|
204
|
+
const agentsMdPath = join(ctx.cwd, 'AGENTS.md');
|
|
205
|
+
if (existsSync(agentsMdPath)) {
|
|
206
|
+
const content = readFileSync(agentsMdPath, 'utf-8');
|
|
207
|
+
if (content.includes('## Memory (AWM)')) {
|
|
208
|
+
results.push({ check: 'Instructions', status: 'ok', message: 'AGENTS.md has AWM section' });
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
results.push({
|
|
212
|
+
check: 'Instructions',
|
|
213
|
+
status: 'warn',
|
|
214
|
+
message: 'AGENTS.md exists but missing AWM section',
|
|
215
|
+
fix: 'Run: awm setup codex',
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
results.push({ check: 'Instructions', status: 'warn', message: 'AGENTS.md not found' });
|
|
221
|
+
}
|
|
222
|
+
return results;
|
|
223
|
+
},
|
|
224
|
+
};
|
|
225
|
+
export default adapter;
|
|
226
|
+
//# sourceMappingURL=codex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex.js","sourceRoot":"","sources":["../../src/adapters/codex.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,sCAAsC;AAEtC;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAEpD,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAgBlF,SAAS,SAAS,CAAC,OAAe;IAChC,MAAM,GAAG,GAAY,EAAE,QAAQ,EAAE,IAAI,GAAG,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IAC3D,IAAI,cAAc,GAAG,EAAE,CAAC;IACxB,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAElC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAE5B,iBAAiB;QACjB,MAAM,YAAY,GAAG,OAAO,CA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AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { SetupContext } from './types.js';
|
|
2
|
+
/** Resolve the AWM package root (where src/ and dist/ live). */
|
|
3
|
+
export declare function resolvePackageRoot(): string;
|
|
4
|
+
/** Resolve the database path — default to <packageRoot>/data/memory.db. */
|
|
5
|
+
export declare function resolveDbPath(packageRoot: string, explicit?: string | null): string;
|
|
6
|
+
/** Read or generate the hook secret token. */
|
|
7
|
+
export declare function resolveHookSecret(dbPath: string): string;
|
|
8
|
+
/** Build environment variables for the MCP server process. */
|
|
9
|
+
export declare function buildEnvVars(dbPath: string, agentId: string, hookPort: string, hookSecret: string, isWindows: boolean): Record<string, string>;
|
|
10
|
+
/**
|
|
11
|
+
* Resolve the MCP server command + args.
|
|
12
|
+
*
|
|
13
|
+
* Prefers absolute path to dist/mcp.js (works from any cwd).
|
|
14
|
+
* Falls back to npx tsx src/mcp.ts for dev mode.
|
|
15
|
+
*/
|
|
16
|
+
export declare function resolveMcpCommand(ctx: SetupContext): {
|
|
17
|
+
command: string;
|
|
18
|
+
args: string[];
|
|
19
|
+
};
|
|
20
|
+
/** Build a full SetupContext from parsed CLI flags. */
|
|
21
|
+
export declare function buildSetupContext(opts: {
|
|
22
|
+
agentId?: string;
|
|
23
|
+
dbPath?: string | null;
|
|
24
|
+
isGlobal: boolean;
|
|
25
|
+
hookPort: string;
|
|
26
|
+
}): SetupContext;
|
|
27
|
+
/** Home directory. */
|
|
28
|
+
export declare function homedir(): string;
|
|
29
|
+
/**
|
|
30
|
+
* Core AWM instruction snippet — shared across all adapters.
|
|
31
|
+
* Each adapter wraps this in the appropriate file format.
|
|
32
|
+
*/
|
|
33
|
+
export declare const AWM_INSTRUCTION_CONTENT: string;
|
|
34
|
+
//# sourceMappingURL=common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/adapters/common.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAK/C,gEAAgE;AAChE,wBAAgB,kBAAkB,IAAI,MAAM,CAG3C;AAED,2EAA2E;AAC3E,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAOnF;AAED,8CAA8C;AAC9C,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAUxD;AAED,8DAA8D;AAC9D,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,OAAO,GACjB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAOxB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,YAAY,GAAG;IACpD,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,CAkBA;AAED,uDAAuD;AACvD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,YAAY,CA6Bf;AAED,sBAAsB;AACtB,wBAAgB,OAAO,IAAI,MAAM,CAEhC;AAID;;;GAGG;AACH,eAAO,MAAM,uBAAuB,QA6BvB,CAAC"}
|