๐ง Memory that persists
+Decisions, preferences, and project context carry across sessions, so your agent stops re-learning your stack on every run.
+diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 09fed2b..dde660d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,20 +32,15 @@ jobs: test: runs-on: ubuntu-latest - env: - OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} - PI_E2E_PROVIDER: openai - PI_E2E_MODEL: gpt-4o-mini steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 20 cache: npm + - uses: oven-sh/setup-bun@v2 + with: + bun-version: latest - run: npm ci - - name: Run e2e tests - if: ${{ env.OPENAI_API_KEY != '' }} - run: npm test - - name: Skip e2e tests (missing OPENAI_API_KEY) - if: ${{ env.OPENAI_API_KEY == '' }} - run: echo "Skipping e2e tests. Add an OPENAI_API_KEY repository secret to enable." + - run: npm run test:unit + - run: npm run test:cli diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml index 512cf45..8719f51 100644 --- a/.github/workflows/publish-npm.yml +++ b/.github/workflows/publish-npm.yml @@ -21,5 +21,28 @@ jobs: node-version: 20 cache: npm registry-url: "https://registry.npmjs.org" + - uses: oven-sh/setup-bun@v2 + with: + bun-version: latest - run: npm ci + - name: Verify tag matches package.json version + shell: bash + run: | + case "$GITHUB_REF" in + refs/tags/v*) ;; + *) + echo "Publishing requires a v* tag ref; got $GITHUB_REF." >&2 + echo "For manual runs, dispatch the workflow from the release tag." >&2 + exit 1 + ;; + esac + tag="${GITHUB_REF_NAME#v}" + pkg="$(node -p "require('./package.json').version")" + if [ "$tag" != "$pkg" ]; then + echo "Tag $GITHUB_REF_NAME does not match package.json version $pkg" >&2 + exit 1 + fi + - run: npm run lint + - run: npm run build + - run: npm test - run: npm publish diff --git a/README.md b/README.md index 591edd6..196f9c1 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,25 @@ -# agent-memory (agentmemory) +# agent-memory -`agentmemory` is the canonical GitHub repository for the `agent-memory` CLI (`myagentmemory` on npm). +**Persistent memory for AI coding agents.** Give [Claude Code](https://claude.ai/code), [OpenAI Codex](https://github.com/openai/codex), [Cursor](https://cursor.com), and Agent (Cursor CLI) a memory that survives across sessions โ long-term facts, daily logs, topic notes, and a scratchpad checklist, stored as plain markdown and searchable with [qmd](https://github.com/tobi/qmd)-powered semantic search. -Persistent memory for coding agents โ [Claude Code](https://claude.ai/code), [OpenAI Codex](https://github.com/openai/codex), Cursor, and Agent (Cursor CLI). Local-first markdown memory with [qmd](https://github.com/tobi/qmd)-powered semantic search and automatic context injection. +[](https://www.npmjs.com/package/myagentmemory) +[](https://www.npmjs.com/package/myagentmemory) +[](LICENSE) +[](https://jayzeng.github.io/agentmemory/) -Project site (GitHub Pages): https://jayzeng.github.io/agentmemory/ +**[๐ Website & quickstart โ](https://jayzeng.github.io/agentmemory/)** ยท [Install](#installation) ยท [CLI commands](#cli-commands) ยท [How it works](#how-it-works) -Search aliases: -- `agentmemory` (GitHub repo + Homebrew tap) -- `agent-memory` (CLI command/binary) -- `myagentmemory` (npm package name) -- `coding agent memory` / `AI coding memory` +## Why agent-memory? -GitHub metadata assets: -- Social preview image: `.github/assets/social-preview.png` (1280x640) -- Release notes template: `.github/release.yml` (used by GitHub auto-generated release notes) -- Landing page source: `docs/index.html` (deployed by `.github/workflows/deploy-pages.yml`) +Coding agents forget everything between sessions. `agent-memory` gives them a durable, local-first memory so they stop re-learning your stack, your preferences, and past decisions on every run. -Thanks to https://github.com/skyfallsin/pi-mem for inspiration. +- ๐ง **Memory that persists** โ decisions, preferences, and project context carry across sessions instead of starting cold. +- ๐ **Plain markdown, local-first** โ every memory is a readable, git-friendly file on disk. No database, no cloud, no lock-in. +- ๐ **Semantic search** โ optional [qmd](https://github.com/tobi/qmd) integration adds keyword, semantic, and hybrid search across all memory files. +- โก **Automatic context injection** โ relevant past memories surface into each turn, no manual tool calls required. +- ๐ค **One memory, every agent** โ the same store is shared across Claude Code, Codex, Cursor, and Agent. -Long-term facts, daily logs, topic/event notes, and a scratchpad checklist stored as plain markdown files. Optional qmd integration adds keyword, semantic, and hybrid search across all memory files, plus automatic selective injection of relevant past memories into every turn. +> **Naming:** `agentmemory` is the GitHub repo (and Homebrew tap), `myagentmemory` is the npm package, and `agent-memory` is the installed CLI binary. Also known as *coding agent memory* or *AI coding memory*. ## Installation @@ -48,11 +48,7 @@ agent-memory install-skills agent-memory uninstall-skills ``` -### Pi users - -If you're on Pi and prefer a native extension, use `pi-memory` (https://github.com/jayzeng/pi-memory) instead of installing this skill. The CLI + skill workflow here is the cross-platform alternative, and works fine on Pi without any extension. - -This installs: +`install-skills` writes a SKILL.md into each agent's config directory: - `~/.claude/skills/agent-memory/SKILL.md` โ Claude Code skill - `~/.codex/skills/agent-memory/SKILL.md` โ Codex skill - `~/.cursor/skills/agent-memory/SKILL.md` โ Cursor skill @@ -62,6 +58,10 @@ This installs: - `%USERPROFILE%\.cursor\skills\agent-memory\SKILL.md` โ Cursor skill (Windows) - `%USERPROFILE%\.agents\skills\agent-memory\SKILL.md` โ Agent CLI skill (Windows) +### Pi users + +If you're on Pi and prefer a native extension, use `pi-memory` (https://github.com/jayzeng/pi-memory) instead of installing this skill. The CLI + skill workflow here is the cross-platform alternative, and works fine on Pi without any extension. + ### Optional: Enable search with qmd When qmd is installed, the collection is automatically set up via `agent-memory init`. @@ -80,22 +80,21 @@ Without qmd, all core tools (write/read/scratchpad) work normally. Only `memory_ ## Architecture ``` - โโโโโโโโโโโโโโโโ - โ src/core.ts โ โ all logic (paths, truncation, scratchpad, - โ โ context builder, qmd, tool functions) - โโโโโโโโฌโโโโโโโโ - โ - โโโโโโดโโโโโโโโโโโโโโโโโโ - โผ โผ - โโโโโโโโโโโโ โโโโโโโโโโโโโโโโ - โ src/ โ โ skills/ โ - โ cli.ts โ โ โโ claude-code/SKILL.md - โ โ โ โโ codex/SKILL.md - โ โ โ โโ cursor/SKILL.md - โ โ โ โโ agent/SKILL.md - โโโโโโโโโโโโ โโโโโโโโโโโโโโโโ - CLI binary instruction files - `agent-memory` that invoke CLI + โโโโโโโโโโโโโโโโโ + โ src/core.ts โ โ all logic: paths, truncation, scratchpad, + โโโโโโโโโฌโโโโโโโโ context builder, qmd, tool functions + โ + โโโโโโดโโโโโโ + โผ โผ + โโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโ + โ src/ โ โ skills/ โ + โ cli.ts โ โ โโ claude-code/SKILL.md โ + โ โ โ โโ codex/SKILL.md โ + โ โ โ โโ cursor/SKILL.md โ + โ โ โ โโ agent/SKILL.md โ + โโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโ + CLI binary instruction files + `agent-memory` that invoke the CLI ``` The memory directory defaults to `~/.agent-memory/`. Override with `AGENT_MEMORY_DIR` env var or `--dir` flag. @@ -130,14 +129,14 @@ If the first search doesn't find what you need, try rephrasing or switching mode ``` ~/.agent-memory/ - MEMORY.md # Curated long-term memory - SCRATCHPAD.md # Checklist of things to fix/remember + MEMORY.md # Curated long-term memory + SCRATCHPAD.md # Checklist of things to fix/remember daily/ - 2026-02-15.md # Daily append-only log + 2026-02-15.md # Daily append-only log 2026-02-14.md ... topics/ - auth.md # Topic/event log linked back to daily entries + auth.md # Topic/event log linked back to daily entries ``` ## Topic notes @@ -165,7 +164,7 @@ Before every agent turn, the following are injected into the system prompt (in p Total injection is capped at 16K chars. When qmd is unavailable, step 3 is skipped and the rest works as before. -For Claude Code, context is injected via the `!`agent-memory context`` syntax in the SKILL.md. For Codex, Cursor, and Agent, the agent runs `agent-memory context` at session start. +For Claude Code, context is injected via the `!`agent-memory context --no-search`` syntax in the SKILL.md. For Codex, Cursor, and Agent, the agent runs `agent-memory context` at session start. ### Selective injection @@ -233,7 +232,7 @@ agent-memory install-skills ```bash # Confirm package name is available -npm view agent-memory +npm view myagentmemory # Bump version (choose patch/minor/major) npm version patch @@ -242,13 +241,23 @@ npm version patch npm publish --access public ``` +### Repository assets (maintainers) + +- **Social preview image:** `.github/assets/social-preview.png` (1280ร640) +- **Release notes template:** `.github/release.yml` (used by GitHub auto-generated release notes) +- **Landing page source:** `docs/index.html` (deployed by `.github/workflows/deploy-pages.yml`) + +## Acknowledgments + +Inspired by [skyfallsin/pi-mem](https://github.com/skyfallsin/pi-mem). Semantic search is powered by [qmd](https://github.com/tobi/qmd). + ## Changelog -### 0.5.0 +### 0.4.12 - **Removed pi extension**: Removed `index.ts` and all pi-specific code (`@mariozechner/pi-ai`, `@mariozechner/pi-coding-agent`, `@sinclair/typebox` peer dependencies). - **Standalone tool functions**: Extracted `memoryWrite()`, `memoryRead()`, `scratchpadAction()`, `memorySearch()` into `src/core.ts` as standalone functions usable without any framework. -- **Renamed package**: `pi-memory` โ `agent-memory`. +- **Renamed package**: `pi-memory` โ `myagentmemory` (npm); the CLI binary is `agent-memory`. - **Renamed env var**: `PI_MEMORY_QMD_UPDATE` โ `AGENT_MEMORY_QMD_UPDATE` (old name still works as fallback). - **Default memory directory**: Now always `~/.agent-memory/`. - **Removed pi-specific tests**: Deleted `test/e2e.ts`, `test/eval-recall.ts`, `test/unit.ts`. diff --git a/docs/index.html b/docs/index.html index fffa1cc..11099d0 100644 --- a/docs/index.html +++ b/docs/index.html @@ -3,11 +3,54 @@
-Persistent memory extension for coding agents
+Persistent memory for coding agents ยท CLI + skills
- agentmemory gives your coding agent durable memory with local markdown files, daily logs, scratchpad - checklists, and qmd-powered semantic search. + agentmemory gives your coding agent a durable, local-first memory โ long-term facts, daily logs, topic + notes, and a scratchpad checklist, all stored as plain markdown you can read, edit, and commit. Optional + qmd semantic search surfaces the right memory into every turn, + automatically.
++ Coding agents start every session from zero. agentmemory is the memory layer that makes them + remember โ without a database, a cloud account, or vendor lock-in. +
+Decisions, preferences, and project context carry across sessions, so your agent stops re-learning your stack on every run.
+Every memory is a readable file on disk โ diff it, edit it, commit it to git. No database, no cloud, no lock-in.
+Optional qmd integration adds keyword, semantic, and hybrid search across every memory file you've ever written.
+Relevant past memories surface into each turn on their own โ no manual tool calls, no copy-pasting context.
+The same store is shared across Claude Code, Codex, Cursor, and Agent โ switch tools without losing what they know.
+Two commands: init and install-skills. Works the moment you install it, qmd or not.
Most memory tools are cloud services with their own SDK and storage. agentmemory is the opposite: files you own, on the agents you already use.
+| + | agentmemory | +Hosted memory SaaS | +A single CLAUDE.md | +
|---|---|---|---|
| Storage | +Local markdown files | +Vendor cloud | +One local file | +
| Search | +Keyword + semantic (qmd) | +Vector DB | +None | +
| Auto context injection | +Yes | +Varies | +Manual | +
| Works across agents | +Claude Code ยท Codex ยท Cursor ยท Agent | +SDK per app | +Per project | +
| Account required | +No | +Yes | +No | +
Memory is just markdown. Here's what your agent reads back at the start of every session.
+# ~/.agent-memory/MEMORY.md + +## Stack +Postgres for all backend services. #decision [[database-choice]] +URL-prefix API versioning (/v1/) to avoid CDN cache issues. #lesson + +## Preferences +Neovim + LazyVim. Conventional commits. Run tests before every push. + +# Recall it later, in any agent: +$ agent-memory search --query "how do we version the API" --mode semantic +โ URL-prefix API versioning (/v1/) to avoid CDN cache issues. ++
Grab the CLI, create your memory store, and wire it into every agent you use.
+Install extension prompts for Claude Code, Codex, Cursor, and Agent CLI.
+Wire memory into Claude Code, Codex, Cursor, and Agent CLI in one command.
agent-memory install-skills
@@ -366,7 +641,7 @@