myagentmemory 0.4.3
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 +21 -0
- package/README.md +231 -0
- package/dist/agent-memory +0 -0
- package/dist/cli.d.ts +18 -0
- package/dist/cli.js +510 -0
- package/dist/core.d.ts +131 -0
- package/dist/core.js +883 -0
- package/package.json +70 -0
- package/scripts/install-skills.ps1 +48 -0
- package/scripts/install-skills.sh +55 -0
- package/scripts/postinstall.cjs +44 -0
- package/skills/claude-code/SKILL.md +101 -0
- package/skills/codex/SKILL.md +104 -0
- package/src/cli.ts +596 -0
- package/src/core.ts +1082 -0
package/package.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "myagentmemory",
|
|
3
|
+
"version": "0.4.3",
|
|
4
|
+
"description": "Persistent memory for coding agents (Claude Code, Codex) with qmd-powered semantic search across daily logs, long-term memory, and scratchpad",
|
|
5
|
+
"main": "./dist/core.js",
|
|
6
|
+
"types": "./dist/core.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/core.d.ts",
|
|
10
|
+
"default": "./dist/core.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"bin": {
|
|
14
|
+
"agent-memory": "./dist/agent-memory"
|
|
15
|
+
},
|
|
16
|
+
"type": "module",
|
|
17
|
+
"keywords": [
|
|
18
|
+
"memory",
|
|
19
|
+
"search",
|
|
20
|
+
"qmd",
|
|
21
|
+
"scratchpad",
|
|
22
|
+
"daily-log",
|
|
23
|
+
"claude-code",
|
|
24
|
+
"codex",
|
|
25
|
+
"agent-memory",
|
|
26
|
+
"coding-agent"
|
|
27
|
+
],
|
|
28
|
+
"author": "jayzeng",
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "git+https://github.com/jayzeng/agent-memory.git"
|
|
33
|
+
},
|
|
34
|
+
"bugs": {
|
|
35
|
+
"url": "https://github.com/jayzeng/agent-memory/issues"
|
|
36
|
+
},
|
|
37
|
+
"homepage": "https://github.com/jayzeng/agent-memory#readme",
|
|
38
|
+
"files": [
|
|
39
|
+
"src",
|
|
40
|
+
"skills",
|
|
41
|
+
"scripts",
|
|
42
|
+
"dist",
|
|
43
|
+
"README.md",
|
|
44
|
+
"LICENSE"
|
|
45
|
+
],
|
|
46
|
+
"publishConfig": {
|
|
47
|
+
"access": "public"
|
|
48
|
+
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"postinstall": "node scripts/postinstall.cjs",
|
|
51
|
+
"build": "tsc -p tsconfig.json --noEmit",
|
|
52
|
+
"build:lib": "tsc -p tsconfig.build.json",
|
|
53
|
+
"build:cli": "bun build src/cli.ts --compile --outfile dist/agent-memory",
|
|
54
|
+
"prepack": "npm run build:lib && bun run build:cli",
|
|
55
|
+
"lint": "biome check .",
|
|
56
|
+
"test": "bun test test/unit.test.ts",
|
|
57
|
+
"test:unit": "bun test test/unit.test.ts",
|
|
58
|
+
"test:cli": "bun test test/cli.test.ts",
|
|
59
|
+
"install-skills": "bash scripts/install-skills.sh"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@biomejs/biome": "^2.4.0",
|
|
63
|
+
"tsx": "^4.0.0",
|
|
64
|
+
"typescript": "^5.9.3"
|
|
65
|
+
},
|
|
66
|
+
"overrides": {
|
|
67
|
+
"rimraf": "^6.1.3",
|
|
68
|
+
"glob": "^13.0.3"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
$ErrorActionPreference = "Stop"
|
|
2
|
+
|
|
3
|
+
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
4
|
+
$ProjectDir = Split-Path -Parent $ScriptDir
|
|
5
|
+
|
|
6
|
+
# Claude Code skill
|
|
7
|
+
$ClaudeSkillDir = Join-Path $env:USERPROFILE ".claude\\skills\\agent-memory"
|
|
8
|
+
$ClaudeSkillSrc = Join-Path $ProjectDir "skills\\claude-code\\SKILL.md"
|
|
9
|
+
if (Test-Path $ClaudeSkillSrc) {
|
|
10
|
+
New-Item -ItemType Directory -Force -Path $ClaudeSkillDir | Out-Null
|
|
11
|
+
Copy-Item -Force $ClaudeSkillSrc (Join-Path $ClaudeSkillDir "SKILL.md")
|
|
12
|
+
Write-Host "Installed Claude Code skill: $ClaudeSkillDir\\SKILL.md"
|
|
13
|
+
} else {
|
|
14
|
+
Write-Host "Skipping Claude Code skill (skills\\claude-code\\SKILL.md not found)"
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
# Codex skill
|
|
18
|
+
$CodexSkillDir = Join-Path $env:USERPROFILE ".codex\\skills\\agent-memory"
|
|
19
|
+
$CodexSkillSrc = Join-Path $ProjectDir "skills\\codex\\SKILL.md"
|
|
20
|
+
if (Test-Path $CodexSkillSrc) {
|
|
21
|
+
New-Item -ItemType Directory -Force -Path $CodexSkillDir | Out-Null
|
|
22
|
+
Copy-Item -Force $CodexSkillSrc (Join-Path $CodexSkillDir "SKILL.md")
|
|
23
|
+
Write-Host "Installed Codex skill: $CodexSkillDir\\SKILL.md"
|
|
24
|
+
} else {
|
|
25
|
+
Write-Host "Skipping Codex skill (skills\\codex\\SKILL.md not found)"
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
Write-Host ""
|
|
29
|
+
Write-Host "Done."
|
|
30
|
+
Write-Host ""
|
|
31
|
+
|
|
32
|
+
$BinExe = Join-Path $ProjectDir "dist\\agent-memory.exe"
|
|
33
|
+
$Bin = Join-Path $ProjectDir "dist\\agent-memory"
|
|
34
|
+
if (Test-Path $BinExe) {
|
|
35
|
+
Write-Host "Add this directory to your PATH:"
|
|
36
|
+
Write-Host " $(Join-Path $ProjectDir 'dist')"
|
|
37
|
+
} elseif (Test-Path $Bin) {
|
|
38
|
+
Write-Host "Add this directory to your PATH:"
|
|
39
|
+
Write-Host " $(Join-Path $ProjectDir 'dist')"
|
|
40
|
+
} else {
|
|
41
|
+
Write-Host "Build the CLI binary first:"
|
|
42
|
+
Write-Host " bun run build:cli"
|
|
43
|
+
Write-Host "Then add this directory to your PATH:"
|
|
44
|
+
Write-Host " $(Join-Path $ProjectDir 'dist')"
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
Write-Host ""
|
|
48
|
+
Write-Host "Initialize memory: agent-memory init"
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Install agent-memory skills for Claude Code and Codex CLI.
|
|
3
|
+
# Usage: bash scripts/install-skills.sh
|
|
4
|
+
|
|
5
|
+
set -euo pipefail
|
|
6
|
+
|
|
7
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
8
|
+
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
|
|
9
|
+
|
|
10
|
+
# Claude Code skill
|
|
11
|
+
CLAUDE_SKILL_DIR="$HOME/.claude/skills/agent-memory"
|
|
12
|
+
if [ -d "$PROJECT_DIR/skills/claude-code" ]; then
|
|
13
|
+
mkdir -p "$CLAUDE_SKILL_DIR"
|
|
14
|
+
cp "$PROJECT_DIR/skills/claude-code/SKILL.md" "$CLAUDE_SKILL_DIR/SKILL.md"
|
|
15
|
+
echo "Installed Claude Code skill: $CLAUDE_SKILL_DIR/SKILL.md"
|
|
16
|
+
else
|
|
17
|
+
echo "Skipping Claude Code skill (skills/claude-code/ not found)"
|
|
18
|
+
fi
|
|
19
|
+
|
|
20
|
+
# Codex skill
|
|
21
|
+
CODEX_SKILL_DIR="$HOME/.codex/skills/agent-memory"
|
|
22
|
+
if [ -d "$PROJECT_DIR/skills/codex" ]; then
|
|
23
|
+
mkdir -p "$CODEX_SKILL_DIR"
|
|
24
|
+
cp "$PROJECT_DIR/skills/codex/SKILL.md" "$CODEX_SKILL_DIR/SKILL.md"
|
|
25
|
+
echo "Installed Codex skill: $CODEX_SKILL_DIR/SKILL.md"
|
|
26
|
+
else
|
|
27
|
+
echo "Skipping Codex skill (skills/codex/ not found)"
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
echo ""
|
|
31
|
+
echo "Done."
|
|
32
|
+
echo ""
|
|
33
|
+
AGENT_MEMORY_BIN="$PROJECT_DIR/dist/agent-memory"
|
|
34
|
+
if [ -x "$AGENT_MEMORY_BIN" ]; then
|
|
35
|
+
if [ -d "$HOME/.local/bin" ]; then
|
|
36
|
+
if ln -sf "$AGENT_MEMORY_BIN" "$HOME/.local/bin/agent-memory" 2>/dev/null; then
|
|
37
|
+
echo "Linked agent-memory into: $HOME/.local/bin/agent-memory"
|
|
38
|
+
echo "Ensure $HOME/.local/bin is on your PATH."
|
|
39
|
+
else
|
|
40
|
+
echo "Could not link to $HOME/.local/bin (permissions)."
|
|
41
|
+
echo "Add this to your PATH instead:"
|
|
42
|
+
echo " $AGENT_MEMORY_BIN"
|
|
43
|
+
fi
|
|
44
|
+
else
|
|
45
|
+
echo "Make sure 'agent-memory' is on your PATH:"
|
|
46
|
+
echo " $AGENT_MEMORY_BIN"
|
|
47
|
+
fi
|
|
48
|
+
else
|
|
49
|
+
echo "Build the CLI binary first:"
|
|
50
|
+
echo " bun run build:cli"
|
|
51
|
+
echo "Then add it to your PATH:"
|
|
52
|
+
echo " $AGENT_MEMORY_BIN"
|
|
53
|
+
fi
|
|
54
|
+
echo ""
|
|
55
|
+
echo "Initialize memory: agent-memory init"
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const { spawnSync } = require("node:child_process");
|
|
2
|
+
const path = require("node:path");
|
|
3
|
+
|
|
4
|
+
function hasQmd() {
|
|
5
|
+
const result = spawnSync("qmd", ["status"], {
|
|
6
|
+
stdio: "ignore",
|
|
7
|
+
shell: process.platform === "win32",
|
|
8
|
+
});
|
|
9
|
+
return result.status === 0;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function memoryDir() {
|
|
13
|
+
const home = process.env.HOME ?? process.env.USERPROFILE ?? "~";
|
|
14
|
+
return path.join(home, ".agent-memory");
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function configureGitHooks() {
|
|
18
|
+
const result = spawnSync("git", ["rev-parse", "--is-inside-work-tree"], {
|
|
19
|
+
stdio: "ignore",
|
|
20
|
+
shell: process.platform === "win32",
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
if (result.status !== 0) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
spawnSync("git", ["config", "core.hooksPath", ".githooks"], {
|
|
28
|
+
stdio: "ignore",
|
|
29
|
+
shell: process.platform === "win32",
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
configureGitHooks();
|
|
34
|
+
|
|
35
|
+
if (!hasQmd()) {
|
|
36
|
+
const dir = memoryDir();
|
|
37
|
+
console.log("\nagent-memory: qmd not found (required for `memory_search`).\n");
|
|
38
|
+
console.log("Install qmd (requires Bun):");
|
|
39
|
+
console.log(" bun install -g https://github.com/tobi/qmd");
|
|
40
|
+
console.log(" # ensure ~/.bun/bin is in your PATH\n");
|
|
41
|
+
console.log("Then set up the collection (one-time):");
|
|
42
|
+
console.log(` qmd collection add ${dir} --name agent-memory`);
|
|
43
|
+
console.log(" qmd embed\n");
|
|
44
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: agent-memory
|
|
3
|
+
description: Persistent memory across coding sessions — long-term facts, daily logs, scratchpad checklist, and semantic search.
|
|
4
|
+
allowed-tools: Bash(agent-memory *)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Agent Memory
|
|
8
|
+
|
|
9
|
+
You have a persistent memory system. Use it to remember decisions, preferences, lessons learned, and context across sessions.
|
|
10
|
+
|
|
11
|
+
## Current Memory Context
|
|
12
|
+
|
|
13
|
+
!`agent-memory context --no-search 2>/dev/null`
|
|
14
|
+
|
|
15
|
+
## Memory Commands
|
|
16
|
+
|
|
17
|
+
All commands use the `agent-memory` CLI. Examples:
|
|
18
|
+
|
|
19
|
+
### Write to memory
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# Save a long-term fact, decision, or preference
|
|
23
|
+
agent-memory write --target long_term --content "User prefers TypeScript with strict mode"
|
|
24
|
+
|
|
25
|
+
# Overwrite MEMORY.md entirely (use with care)
|
|
26
|
+
agent-memory write --target long_term --content "..." --mode overwrite
|
|
27
|
+
|
|
28
|
+
# Append to today's daily log
|
|
29
|
+
agent-memory write --target daily --content "Fixed auth bug in login.ts — was missing token refresh"
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Read memory
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# Read long-term memory
|
|
36
|
+
agent-memory read --target long_term
|
|
37
|
+
|
|
38
|
+
# Read today's daily log
|
|
39
|
+
agent-memory read --target daily
|
|
40
|
+
|
|
41
|
+
# Read a specific day's log
|
|
42
|
+
agent-memory read --target daily --date 2026-02-15
|
|
43
|
+
|
|
44
|
+
# List all daily logs
|
|
45
|
+
agent-memory read --target list
|
|
46
|
+
|
|
47
|
+
# Read scratchpad
|
|
48
|
+
agent-memory read --target scratchpad
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Manage scratchpad (checklist)
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# Add an item
|
|
55
|
+
agent-memory scratchpad add --text "Review PR #42"
|
|
56
|
+
|
|
57
|
+
# List items
|
|
58
|
+
agent-memory scratchpad list
|
|
59
|
+
|
|
60
|
+
# Mark item as done (matches by substring)
|
|
61
|
+
agent-memory scratchpad done --text "PR #42"
|
|
62
|
+
|
|
63
|
+
# Undo a done item
|
|
64
|
+
agent-memory scratchpad undo --text "PR #42"
|
|
65
|
+
|
|
66
|
+
# Remove all completed items
|
|
67
|
+
agent-memory scratchpad clear_done
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Search memory (requires qmd)
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
# Fast keyword search
|
|
74
|
+
agent-memory search --query "database choice" --mode keyword
|
|
75
|
+
|
|
76
|
+
# Semantic search (finds related concepts)
|
|
77
|
+
agent-memory search --query "how do we handle auth" --mode semantic
|
|
78
|
+
|
|
79
|
+
# Deep hybrid search with reranking
|
|
80
|
+
agent-memory search --query "performance optimization" --mode deep --limit 10
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Setup and status
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# Initialize memory directory and qmd collection
|
|
87
|
+
agent-memory init
|
|
88
|
+
|
|
89
|
+
# Show configuration and status
|
|
90
|
+
agent-memory status
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Guidelines
|
|
94
|
+
|
|
95
|
+
- When someone says "remember this" or asks you to note something, write it immediately using `agent-memory write`
|
|
96
|
+
- Use `--target long_term` for durable facts: decisions, preferences, architecture choices, lessons learned
|
|
97
|
+
- Use `--target daily` for session notes: what you worked on, bugs found, progress updates
|
|
98
|
+
- Use the scratchpad for TODOs, follow-ups, and things to keep in mind
|
|
99
|
+
- Use `#tags` (e.g. `#decision`, `#preference`, `#lesson`) and `[[links]]` (e.g. `[[auth-strategy]]`) in content to improve future search recall
|
|
100
|
+
- Before starting a task, check if relevant context exists via `agent-memory search`
|
|
101
|
+
- At the end of a significant work session, summarize what was done in the daily log
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: agent-memory
|
|
3
|
+
description: Persistent memory across coding sessions — long-term facts, daily logs, scratchpad checklist, and semantic search.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Agent Memory
|
|
7
|
+
|
|
8
|
+
You have a persistent memory system. Use it to remember decisions, preferences, lessons learned, and context across sessions.
|
|
9
|
+
|
|
10
|
+
## Important: Load context at session start
|
|
11
|
+
|
|
12
|
+
At the beginning of each session, run this command to load your memory context:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
agent-memory context --no-search 2>/dev/null
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Memory Commands
|
|
19
|
+
|
|
20
|
+
All commands use the `agent-memory` CLI. Examples:
|
|
21
|
+
|
|
22
|
+
### Write to memory
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Save a long-term fact, decision, or preference
|
|
26
|
+
agent-memory write --target long_term --content "User prefers TypeScript with strict mode"
|
|
27
|
+
|
|
28
|
+
# Overwrite MEMORY.md entirely (use with care)
|
|
29
|
+
agent-memory write --target long_term --content "..." --mode overwrite
|
|
30
|
+
|
|
31
|
+
# Append to today's daily log
|
|
32
|
+
agent-memory write --target daily --content "Fixed auth bug in login.ts — was missing token refresh"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Read memory
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# Read long-term memory
|
|
39
|
+
agent-memory read --target long_term
|
|
40
|
+
|
|
41
|
+
# Read today's daily log
|
|
42
|
+
agent-memory read --target daily
|
|
43
|
+
|
|
44
|
+
# Read a specific day's log
|
|
45
|
+
agent-memory read --target daily --date 2026-02-15
|
|
46
|
+
|
|
47
|
+
# List all daily logs
|
|
48
|
+
agent-memory read --target list
|
|
49
|
+
|
|
50
|
+
# Read scratchpad
|
|
51
|
+
agent-memory read --target scratchpad
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Manage scratchpad (checklist)
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# Add an item
|
|
58
|
+
agent-memory scratchpad add --text "Review PR #42"
|
|
59
|
+
|
|
60
|
+
# List items
|
|
61
|
+
agent-memory scratchpad list
|
|
62
|
+
|
|
63
|
+
# Mark item as done (matches by substring)
|
|
64
|
+
agent-memory scratchpad done --text "PR #42"
|
|
65
|
+
|
|
66
|
+
# Undo a done item
|
|
67
|
+
agent-memory scratchpad undo --text "PR #42"
|
|
68
|
+
|
|
69
|
+
# Remove all completed items
|
|
70
|
+
agent-memory scratchpad clear_done
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Search memory (requires qmd)
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Fast keyword search
|
|
77
|
+
agent-memory search --query "database choice" --mode keyword
|
|
78
|
+
|
|
79
|
+
# Semantic search (finds related concepts)
|
|
80
|
+
agent-memory search --query "how do we handle auth" --mode semantic
|
|
81
|
+
|
|
82
|
+
# Deep hybrid search with reranking
|
|
83
|
+
agent-memory search --query "performance optimization" --mode deep --limit 10
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Setup and status
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# Initialize memory directory and qmd collection
|
|
90
|
+
agent-memory init
|
|
91
|
+
|
|
92
|
+
# Show configuration and status
|
|
93
|
+
agent-memory status
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Guidelines
|
|
97
|
+
|
|
98
|
+
- When someone says "remember this" or asks you to note something, write it immediately using `agent-memory write`
|
|
99
|
+
- Use `--target long_term` for durable facts: decisions, preferences, architecture choices, lessons learned
|
|
100
|
+
- Use `--target daily` for session notes: what you worked on, bugs found, progress updates
|
|
101
|
+
- Use the scratchpad for TODOs, follow-ups, and things to keep in mind
|
|
102
|
+
- Use `#tags` (e.g. `#decision`, `#preference`, `#lesson`) and `[[links]]` (e.g. `[[auth-strategy]]`) in content to improve future search recall
|
|
103
|
+
- Before starting a task, check if relevant context exists via `agent-memory search`
|
|
104
|
+
- At the end of a significant work session, summarize what was done in the daily log
|