diff --git a/.cursor-plugin/plugin.json b/.cursor-plugin/plugin.json index 7fe3ea1feb..f1c6698cc1 100644 --- a/.cursor-plugin/plugin.json +++ b/.cursor-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "agentmemory", - "version": "0.9.29", + "version": "0.9.30", "description": "Persistent memory for Cursor: auto-captures sessions, prompts, and tool use via hooks, recalls with hybrid BM25 + vector + graph search, and exposes 54 memory tools over MCP. Keyless by default, runs entirely on your machine.", "author": { "name": "Rohit Ghumare", diff --git a/.env.example b/.env.example index 7afb54b8ae..6f112252d5 100644 --- a/.env.example +++ b/.env.example @@ -150,6 +150,7 @@ # AGENTMEMORY_IMAGE_EMBEDDINGS=true # Enable image embeddings when an image provider is present (experimental). # AGENTMEMORY_AUDIT_RETENTION_MONTHS=6 # Drop whole audit-log month scopes older than N months on a daily sweep. Default 0 = keep audit history forever. # AGENTMEMORY_AUDIT_MIGRATE_MAX_BYTES=33554432 # Largest legacy mem:audit scope file the one-time migration will read locally. Default 32 MiB; bigger or unreadable stores are left frozen. +# AGENTMEMORY_AUDIT_INDEX_PERSIST=false # Set to 1 or true to audit index migration and cleanup writes (debugging only) # AGENTMEMORY_INDEX_SAVE_INTERVAL_MS=600000 # Minimum time between search index saves; shutdown and deletes still save immediately. # AGENTMEMORY_VECTOR_BUCKET_SIZE=500 # Vectors held per storage bucket before a new bucket opens; a save only rewrites buckets it changed. # AGENTMEMORY_VECTOR_BACKFILL_MAX=500 # Batch size for re-embedding vectors missing since the last save (continues across restarts); also caps the whole-store opt-in per boot. diff --git a/AGENTS.md b/AGENTS.md index 02de31a366..b7b5bb4d1b 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -11,29 +11,19 @@ agentmemory is a persistent memory system for AI coding agents, built on iii-eng ## Consistency Rules -**When adding or removing MCP tools, you MUST update ALL of the following:** +**Before every commit, run `npm run docs:sync` and commit what it changes.** It computes MCP tool counts (all, core, local fallback), REST endpoints, skills, hooks, tests, iii functions, source files, lines of code and KV scopes from the source, and rewrites them in README.md, the translated READMEs, AGENTS.md, INSTALL_FOR_AGENTS.md, plugin manifests, integration READMEs, the stat badges and the `src/index.ts` banner. The last synced values live in `scripts/docs-sync.state.json`; commit that file with the rest. `npm run docs:check` exits non-zero when anything is out of date. When the sync prints `check left in `, open that line: either fix it by hand or add its noun to the fact in `scripts/docs-sync.ts` so the next sync catches it. Never hand-edit these numbers or versions in the docs; change the source and sync. + +**When adding or removing MCP tools, update:** 1. `src/mcp/tools-registry.ts` — tool definition + `getAllTools()` array 2. `src/mcp/server.ts` — handler case in the `mcp::tools::call` switch 3. `src/triggers/api.ts` — REST endpoint registration -4. `src/index.ts` — function registration + endpoint count in the log line +4. `src/index.ts` — function registration 5. `test/mcp-standalone.test.ts` — tool count assertion -6. `README.md` — tool counts (search for "MCP tools") -7. `plugin/.claude-plugin/plugin.json` — tool count in description -8. `plugin/plugin.json` and `plugin/.mcp.copilot.json` (when present) — tool count or MCP exposure -**When adding REST endpoints, you MUST update:** +**When adding REST endpoints, update:** 1. `src/triggers/api.ts` — endpoint registration -2. `src/index.ts` — endpoint count in the log line -3. `README.md` — endpoint count (search for "REST endpoints" and "endpoints on port") - -**When bumping version, you MUST update ALL of the following:** -1. `package.json` — version field -2. `src/version.ts` — VERSION constant and type union -3. `src/types.ts` — ExportData version union -4. `src/functions/export-import.ts` — supportedVersions set -5. `test/export-import.test.ts` — version assertion -6. `plugin/.claude-plugin/plugin.json` — version field -7. `plugin/plugin.json` (when present) — version field + +**When bumping version, change only `package.json`.** `npm run docs:sync` carries the new version into `src/version.ts`, the `src/types.ts` ExportData union, the `supportedVersions` set in `src/functions/export-import.ts`, every plugin and package manifest that shared the old version, the deploy templates, the AGENTS.md stats heading, and CHANGELOG.md (the Unreleased section becomes the new version with today's date, plus its compare link). **When adding new KV scopes:** 1. `src/state/schema.ts` — add to the KV object @@ -111,17 +101,17 @@ Hook scripts in `src/hooks/` are standalone Node.js scripts (no iii-sdk import). ## Testing -- All tests must pass before PR: `npm test` (1,596+ tests) +- Before every commit run, in order: `npm run build`, `npm run skills:gen`, `npm run docs:sync`, `npm run skills:check`, `npm test` (2,500+ tests). Commit anything the generators changed. CI runs the same build, skills check and tests. - Before any npm publish: `npm run release:gate` must pass. It installs the packed tarballs into a clean home and runs capture, recovery, restart, export/import, MCP and status checks against the installed CLI (see CONTRIBUTING.md, Release process) - Mock pattern: `vi.mock("iii-sdk")` with mock `sdk.trigger`, `kv.get/set/list` - Test files go in `test/` with `.test.ts` extension - Follow existing patterns in `test/crystallize.test.ts` for function tests -## Current Stats (v0.9.29) +## Current Stats (v0.9.30) - 54 MCP tools (8 visible by default, `AGENTMEMORY_TOOLS=all` for all) - 138 REST endpoints - 6 MCP resources, 3 MCP prompts - 12 hooks, 17 skills -- 260+ iii functions -- 1,596+ tests +- 311+ iii functions +- 2,500+ tests diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d5c598570..77bc391555 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,35 +6,128 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), ## [Unreleased] -### Changed +## [0.9.30] - 2026-10-06 + +Scale, durability and safety release. The iii engine moves from 0.11.2 to 0.22.1. The stores that grew without bound on shared daemons (graph provenance, the audit log, the vector index, the viewer stream backlog) are bounded and heal themselves at boot. Capture is durable end to end: the server accepts each observation into a persistent inbox with a restart-safe event id, and hooks keep an offline spool while the server is down. Vectors survive a force-kill through a pending log. The REST API requires auth by default. Redis becomes an opt-in state backend, and the viewer is rebuilt around one snapshot plus live stream events with a Health page backed by `GET /agentmemory/status`. Every publish now goes through a release gate that installs the packed tarballs and runs capture and recovery against them. Contributions from david-waltermire, a652, cbsincool, dmazhukov and Tyxiel, with earlier work by DaveCole, Srinath279, joyjit and cristianbdev carried into merged PRs. + +### Breaking changes + +- **Auth is on by default** (#1462). When `AGENTMEMORY_SECRET` is not set, the server generates a secret into `~/.agentmemory/secret` (mode 0600) on first start. The CLI, viewer, hooks, MCP server and shim, `agentmemory connect` configs and the bundled integrations read it for loopback URLs, so they keep working with no change. Hand-written requests to `:3111` now need `Authorization: Bearer $(cat ~/.agentmemory/secret)`. An explicit `AGENTMEMORY_SECRET` still wins, and mesh sync still requires an explicit one. +- **File import and export paths are confined** (#1462). `/compress-file`, `/replay/import-jsonl`, `/graph/import-graphify`, the Obsidian export and `/migrate` resolve symlinks and only accept paths inside the data dir, `~/.agentmemory` or a directory listed in `AGENTMEMORY_IMPORT_ROOT`. `/replay/import-jsonl` also keeps its default `~/.claude/projects`. +- **Browser writes need JSON and an allowed origin** (#1462). `POST`, `PUT`, `PATCH` and `DELETE` requests with a body must send `Content-Type: application/json`, and a present `Origin` header must be a loopback origin for the configured ports, the viewer's own origin, or listed in `VIEWER_ALLOWED_ORIGINS`. Clients that send no `Origin` (CLI, hooks, MCP, curl) are unaffected. +- **`AGENTMEMORY_VECTOR_BACKFILL_MAX` is now a batch size** (#1467). Recovery re-embeds missing vectors in batches of this size until the backlog is empty, across restarts, instead of stopping at the cap once per boot. +- **iii engine 0.22.1** (#1396, #1397). Keep the `iii-` prefixed builtin worker names (`iii-http`, `iii-state`, `iii-queue`, `iii-pubsub`, `iii-cron`) in any custom config: on 0.22.1 the bare names resolve to standalone registry workers. +- **Hooks skip agentmemory's own tools** (#1452). PostToolUse no longer captures `memory_*` MCP calls or `toolsearch`, `listmcpresources` and `fetchmcpresource`. +- **Changed response shapes.** + - `mem::forget`, `mem::governance-delete` and `mem::governance-bulk` count only records that were really deleted. Absent ids come back in `notFound` and failed deletes in `failed` and `failures`, with `success: false` when anything failed. `governance-bulk` refuses an empty filter and unsupported keys on both the dry run and the live call (#1449). + - `GET /agentmemory/audit` and the `memory_audit` MCP tool return `{ entries, legacyFrozen, legacyFrozenBytes }`; the MCP tool used to return a bare list (#1419). + - `GET /agentmemory/memories` returns newest first and adds `nextCursor` (plus `search` and `facets` when requested) (#1433). + - `GET /agentmemory/export` returns 413 with the refusal body (`oversized`, `bytes`, `limitBytes`, `stoppedAt`) instead of 200 when the export is too large (#1422, #1449). + - `POST /agentmemory/session/end` for an unknown, malformed or already completed session returns 200 with `ended: false` and writes nothing (#1252). + - `memory_patterns` / `mem::patterns` reads the 50 most recent sessions by default (`limit`, max 500) and stops after 5,000 observations (#1424). + - Consolidation decay applies at most once per decay period, and `results.decay` reports `{ scanned, written }` per tier (#1417). + +### Upgrade notes + +- Scripts or tools that call the REST API by hand on `:3111`: add `Authorization: Bearer $(cat ~/.agentmemory/secret)`, or set your own `AGENTMEMORY_SECRET` and send that. +- Imports or exports from folders outside `~/.agentmemory` and the data dir: list those folders in `AGENTMEMORY_IMPORT_ROOT` (separate several with `:`, or `;` on Windows). +- A web page on another origin that writes through the viewer: add its origin to `VIEWER_ALLOWED_ORIGINS`. +- Nothing else is required. Stores load unchanged, and the one-time migrations below run by themselves. -- **iii engine and `iii-sdk` move from 0.11.2 to 0.22.1, with `@iii-dev/helpers` 0.22.1 alongside.** Same release on both sides, as before; the CLI downloads the pinned engine into `~/.agentmemory/bin`, the bundled `docker-compose.yml` pulls `iiidev/iii:0.22.1`, and `agentmemory upgrade` pins both packages to the version this package was built against. The deploy templates under `deploy/` install the published npm package, so their engine pair moves together with `AGENTMEMORY_VERSION` at release time. 0.22.x is the last engine line before 0.23 removes the `config.yaml` worker lifecycle the CLI relies on; it carries the upstream fix that keeps HTTP routes owned by the reconnecting worker, so `/agentmemory/*` no longer answers 404 after the engine reconnects (#1013), and its Node SDK bounds WebSocket connect attempts and detects half-open sockets. The bundled configs keep the `iii-` prefixed builtin workers (`iii-http`, `iii-state`, `iii-queue`, `iii-pubsub`, `iii-cron`): on 0.22.1 the unprefixed names resolve to the standalone registry workers, which is the 0.23 migration. Existing state stores load unchanged. -- **Runtime config is re-seeded on every start.** Engines from 0.19.4 on persist each builtin worker's `config:` block on first boot (0.22 writes `config/.yaml` next to the config file; earlier engines wrote `data/configuration/` under the working directory) and treat that copy as the source of truth afterwards, which would have made `--port`, `--instance` and data-dir changes silently ineffective after the first run. The CLI now clears those persisted entries in both locations right before it spawns the engine, so the runtime config it renders from your environment is the seed every time. If one of them cannot be removed, `agentmemory start` stops with the path instead of launching an engine that would ignore the requested ports. The bundled `docker-compose.yml` keeps the same directory on a tmpfs so container starts behave the same way. -- Dependabot no longer proposes `iii-sdk` bumps; the engine pin and the SDK version are updated together by hand. -- The deploy Dockerfiles (`deploy/fly`, `railway`, `render`, `coolify`) refuse to build when `III_VERSION` and `III_SDK_VERSION` differ, so overriding the engine tag alone can no longer produce a worker that speaks the wrong wire protocol. -- **The pinned engine starts quiet.** The CLI spawns it with `--no-update-check` (no update or security-advisory lookups against GitHub at boot) and with iii's anonymous usage telemetry off (`III_TELEMETRY_ENABLED=false` unless you export the variable yourself); the bundled compose file passes the same flag and variable. -- The deploy entrypoints (`deploy/*/entrypoint.sh`) generate the same observability settings as the bundled `iii-config.yaml` (`sampling_ratio: 0.1`, console log output off) instead of full sampling with console logs, the combination behind the log feedback loop fixed in 0.9.22. -- The README section on extending agentmemory with registry workers no longer lists builtins that already ship in `iii-config.yaml`, uses the current registry names (`database` replaced `iii-database`), and says where a custom config lives (`~/.agentmemory/iii-config.yaml`). +### What happens on the first start + +- **Graph provenance is compacted once in the background.** Every node, edge, superseded edge and the cached snapshot is trimmed to 32 observation ids in slices, without blocking boot, search or the viewer. Progress is saved and resumes after a restart. `AGENTMEMORY_GRAPH_COMPACT_ON_BOOT=false` skips it; `POST /agentmemory/graph/compact` runs it by hand (#1455). +- **The audit log moves to monthly scopes** (`mem:audit:YYYY-MM`) with a one-time background migration. A legacy scope larger than `AGENTMEMORY_AUDIT_MIGRATE_MAX_BYTES` (default 32 MiB) or unreadable is left frozen and reported as `legacyFrozen` (#1419). +- **The vector index migrates to buckets** (`AGENTMEMORY_VECTOR_BUCKET_SIZE`, default 500) by copying vectors, with no embedding calls. BM25 is no longer persisted and is rebuilt at every boot (#1416). +- **State is saved every 2 s** instead of 5 s, and `agentmemory stop` waits for the engine flush, so it takes a few seconds longer (#1457, #1449). +- **Stale sessions are marked abandoned** after `AGENTMEMORY_SESSION_SWEEP_STALE_HOURS` (default 24) by an hourly sweep that deletes nothing (#1453). +- **Viewer stream groups.** Observations stop writing to per-session `mem-live` groups and the shared `viewer` group is capped at `AGENTMEMORY_VIEWER_STREAM_MAX` (default 500). Existing per-session groups are left in place (#1420). ### Added -- **`GET /agentmemory/status` and a Health tab in the viewer.** One report of what is wrong and how to fix it: the health monitor state and alerts, the LLM and embedding providers and the circuit breaker, functions failing on at least 20% of their calls (with a provider-specific fix for summarize, compress and graph extraction), observations missing from the search index (the same exact check the boot reconcile runs), graph snapshot age, ports, uptime, the pinned engine version and every feature flag with how to enable it. Browsers get an HTML page with no scripts and a strict CSP; everything else gets JSON (`?format=json` or `?format=html` force either). Every probe is time-boxed at 5 s so a slow store cannot hang the page. Uses the same bearer auth as the rest of the API. -- **`agentmemory console`** launches the iii web console (workers, functions, triggers, queues, traces) through the pinned engine, against the ports agentmemory resolved, one port above the viewer by default (`--console-port` overrides). Engine 0.22 ships the console as part of `iii` and downloads it on first use, so the "install iii console?" prompt on start and the `skipConsoleInstall` preference are gone; the ready panel now points at the command instead. +- **Durable capture** (#1460). Hooks send a stable event id with every observation (the host tool use id when present, otherwise a hash of the event). The server writes each event to a capture inbox before storing it, keeps completed ids for `AGENTMEMORY_CAPTURE_DEDUP_HOURS`, and answers a replay with the existing observation. Failed writes retry with backoff, also after a restart, and end as dead letters shown on `/status`, the viewer Health page and `GET /agentmemory/capture`, with `POST /agentmemory/capture/retry` to retry them. +- **Offline hook spool** (#1460, #1468). When the server is down, times out or returns a 5xx, hooks keep a copy of the observation in a bounded private spool under the data dir until the engine has saved it. The spool drains at boot and from the next hook that reaches the server. New: `agentmemory capture [--drain]` and `POST /agentmemory/capture/drain`. +- **Vector pending log** (#1467). Every vector added to or removed from the live index is also written to a small pending log. Boot replays it after the snapshot with 0 embedding calls, and whatever is still missing is re-embedded as a durable backlog that resumes after a restart instead of stopping at a 500 cap. `/status` and the viewer show the log size and a paused backfill. +- **Release gate** (#1463). `npm run release:gate` packs `@agentmemory/agentmemory` and `@agentmemory/mcp`, installs both tarballs into a clean home and runs named scenarios against the installed CLI: capture through the bundled hooks, offline capture recovered from the spool, replay dedup after a force kill, dead letters that survive a restart, vectors surviving a crash, stop and start, export and import, the MCP shim, the viewer and `/status`. A Release gate workflow runs it on Ubuntu and macOS. +- **Capture cost bench** (#1464). `npm run bench:capture-costs` measures disk bytes per state scope, engine and worker memory and CPU, hook latency, provider requests, agent-visible context bytes and force-kill recovery, with separate capture and recovery budgets in `benchmark/capture-costs-budgets.json` and a figure in `docs/benchmarks/capture-costs.svg`. Optional Ollama, Redis and crash-offline variants. +- **Codex plugin package** (#1459). The Codex plugin bundles a small stdio bridge that forwards tools, resources and prompts to the configured agentmemory daemon and reports connection errors instead of falling back to a separate store. Authenticated non-loopback connections require HTTPS. `npm run plugin:pack:codex` builds a local package with the six Codex hooks and a review package without lifecycle hooks, and `npm run plugin:verify:published` refuses a release whose runtime, MCP shim and iii versions do not match. +- **Rebuilt viewer that streams every page** (#1433, #1407). One snapshot on connect (`GET /agentmemory/viewer/snapshot`, `GET /agentmemory/counts`), then live `.created/updated/deleted` events with no polling. 12 tabs in four groups with live counts, deep links, keyboard shortcuts and a mobile menu, a memories detail panel with version chain, diff and provenance, sessions with an inline timeline, and a searchable graph. Cursor pagination and facets on memories, sessions and observations, `GET /graph/node` and `GET /observations/locate` back it. +- **`GET /agentmemory/status` and a Health tab in the viewer** (#1408). One report of what is wrong and how to fix it: providers and circuit breaker, failing functions, observations missing from the search index, index save state per leg (#1415), the state backend, graph compaction progress, capture inbox and spool, ports, the pinned engine version and every feature flag. HTML for browsers, JSON otherwise. +- **`GET /agentmemory/consolidation/status`** and a "Memory layers" panel (#1407). +- **Opt-in Redis backend for state and streams**: `AGENTMEMORY_STATE_BACKEND=file|redis` and `AGENTMEMORY_REDIS_URL` (#1425). Use one Redis server per instance, and move data with `agentmemory export` and `import` when switching. +- **`POST /agentmemory/graph/compact`** trims oversized node, edge, edge history and snapshot provenance in slices (#1454, carries #1445 by david-waltermire), and **`AGENTMEMORY_GRAPH_COMPACT_ON_BOOT`** runs it once after upgrade (#1455). +- **Stale session sweep**: `AGENTMEMORY_SESSION_SWEEP_ENABLED` and `AGENTMEMORY_SESSION_SWEEP_STALE_HOURS` (#1453, carries #1411 by cristianbdev). +- **Capture filters for hooks**: `AGENTMEMORY_CAPTURE_ALLOW`, `AGENTMEMORY_CAPTURE_DENY`, `AGENTMEMORY_CAPTURE_OUTPUT_MAX` (default 8000) and `AGENTMEMORY_PRE_COMPACT_BUDGET` (default 1500, 0 disables) (#1452, carries #994 by joyjit). +- **`AGENTMEMORY_AUDIT_INDEX_PERSIST`** (off by default) re-enables index persistence audit rows for debugging (#1182 by dmazhukov). +- **`AGENTMEMORY_AUDIT_RETENTION_MONTHS`** and **`AGENTMEMORY_AUDIT_MIGRATE_MAX_BYTES`** for the monthly audit log (#1419). +- **`AGENTMEMORY_STATE_SAVE_INTERVAL_MS`**, **`AGENTMEMORY_INDEX_SAVE_INTERVAL_MS`**, **`AGENTMEMORY_VECTOR_BUCKET_SIZE`**, **`AGENTMEMORY_VECTOR_BACKFILL`** and **`AGENTMEMORY_VIEWER_STREAM_MAX`** (#1457, #1415, #1416, #1420). +- **`agentmemory console`** launches the iii web console through the pinned engine; the "install iii console?" prompt and the `skipConsoleInstall` preference are gone (#1397). +- **Multi-instance installs**: `--instance N` gets its own port quartet, data directory and lifecycle state, and `--port` derives the other ports (#892). +- Procedures are extracted from finished sessions when consolidation is on and an LLM provider is configured (#1407). +- `memory_patterns` takes an optional `limit` (#1424). `POST /lessons` accepts `sourceIds`, and `mem::evolve` returns 409, 400 and 404 errors (#1433). +- **OpenCode 2 support in the OpenCode plugin** (#1476, building on #1451 by Tyxiel). One `agentmemory-capture.ts` serves both plugin APIs: OpenCode 2 loads its `setup()` entry and OpenCode 1.x keeps the existing hooks. On OpenCode 2 it captures prompts, tool calls with their output, the assistant's answer, step and compaction events, injects memory on every model call, and requests a summary when a run finishes. Checked in live sessions on OpenCode 2.0.24, 1.18.34 and 1.17.10. ### Fixed -- **The "Memory elevated" alert no longer fires on a healthy process (#1406).** The health check divided the heap in use by the heap Node had allocated so far, which Node keeps just above what is in use, so a normal process read 90% or more and raised the alert once its memory passed 512 MB. The check now divides by the V8 heap limit, which is about 4 GB on 64-bit Node by default, and the viewer's Heap gauge shows used against that limit. The reported 589 of 629 MB is 14% of the limit and no longer alerts. -- **The viewer updates from the live stream instead of re-fetching, and stops blinking.** The dashboard used to wipe itself to "Loading dashboard..." and re-fetch everything on a 30 s timer and on every stream event; on an idle store that was 73 rebuilds and 20 requests a minute, and 21 live events cost 200 requests. The worker now pushes `session.updated`, `session.deleted`, `memory.updated` and `memory.deleted` on the `mem-live` viewer group next to the existing observation and `session.activity` events (which the viewer used to drop because it read the wrong field), and the viewer applies them to what is on screen: sessions, observation counts, session status and the memory total update with zero requests, redraws are batched to at most one every 250 ms and skipped when nothing changed. The 30 s timer is gone, no refresh path blanks a loaded view, and polling remains only as the fallback when the stream cannot connect (#921, #1340). The viewer now connects with the stream mode engine 0.22 serves first instead of failing twice on the other one. Live buffers on the Timeline and Activity tabs are capped at a few hundred entries so a large stream backlog cannot freeze the tab (#609). When the stream reconnects, the loaded views re-fetch once so changes made while it was down show up, and a list that was loading when live events arrived replays them, so a deleted session does not come back. Session counts no longer reload or blank the open session detail, bursts of memory events coalesce into one list reload, and with an isolated agent scope (`AGENT_ID` plus `AGENTMEMORY_AGENT_SCOPE=isolated`) the worker only pushes that agent's sessions and memories. -- **A failed dashboard refresh keeps the last data.** Panels that fail to refresh keep their previous values behind a "could not refresh" note instead of flipping to the new-install screen; a first load that cannot reach the API shows a retry button (#1340). -- **Dashboard numbers match the API.** The Memories card uses the server total instead of counting a capped list (#1279, #951), token savings only counts sessions that produced observations (#944), and the Graph Nodes card shows when its snapshot was taken. -- **Session summaries stored as objects render as text instead of `[object Object]`** (#1229), and tags stored as a comma-separated string no longer break the Actions, Lessons or Sessions views (#906). -- **`GET /agentmemory/memories` returns newest first**, so a `limit` page shows the latest memories rather than the oldest (#990). -- **Rebuild Graph asks before replaying the corpus**, ignores repeat clicks while it runs, and reports how many sessions, nodes and edges it produced (#1383). -- **The dashboard explains consolidation instead of showing three bare counters.** Semantic Memory, Procedural Memory and Consolidation Status are one "Memory layers" panel: each layer says what it is built from, how many items it holds, and whether it is off (with the exact setting to change), waiting (for example "3 of 5 session summaries needed"), ready, active with the last run's output, or failed with the error. The consolidation pipeline now stores each run's per-tier results, served at `GET /agentmemory/consolidation/status`. -- **Procedures are extracted from finished sessions.** Procedural memory only came from a cross-session pass that needs two pattern memories each seen in two or more sessions, so it stayed empty on almost every install, and `mem::skill-extract` (which turns one session with a summary and three or more observations into a procedure) had no caller. It now runs for the stopping session inside the existing consolidation cooldown, only when consolidation is on and an LLM provider is configured, so it adds at most one LLM call per cooldown window and none on keyless installs. -- **The viewer reconnects its live stream when the tab becomes visible again** after a sleep or network drop, instead of staying disconnected until a manual reload (#1370). -- **The search index snapshot is written continuously, not only on clean shutdown.** Every observation, compression result and memory save now schedules the debounced snapshot write, and bulk indexing (import, replay, rebuild) does the same. Before, the BM25/vector snapshot was written only by a graceful shutdown; after a crash, `kill -9` or power loss the worker booted the stale snapshot, skipped the rebuild because the snapshot was not empty, and every observation captured since the last clean stop stayed invisible to search for good. On boot the worker now also compares the loaded snapshot against each session's observation count and re-indexes whatever is missing. Re-adding an observation under an id that is already indexed (compression replacing the synthetic entry) now replaces the index document instead of stacking postings on top of the old ones. -- **Worker shutdown no longer hangs when the engine is already gone.** The SIGTERM handler waited on a state write that can never land while the SDK is reconnecting, so `agentmemory stop` had to SIGKILL an orphaned worker after its grace period. The final index flush and the SDK shutdown are now time-boxed at 4 s each, with a hard exit at 8 s, and open viewer connections are closed instead of awaited. `agentmemory stop` gives an orphaned worker that full budget before escalating to SIGKILL. +- **Repeated identical prompts are kept** (#1468). Hooks whose host sends no event id or time now include the hook timestamp in the id, so typing the same prompt twice stores it twice; retries still reuse the stored id. +- **Cursor prompts are stored once** (#1470). A per-session prompt ledger matches the session-end transcript back-fill against live captures, so a back-filled prompt is answered as a duplicate instead of stored a second time. Live prompts are never deduped by content. +- **Concurrent spool writers cannot overwrite each other** (#1468), and printed recovery commands (dead letter retry, spool drain, graph compact, the status page example) send the bearer token. +- **Graph provenance is bounded.** Each node and edge records only its own observation ids, capped at 32, which stops huge graph rows from crash-looping the worker during search (#1454, carries #1445 by david-waltermire). +- **Search skips graph retrieval when `AGENTMEMORY_GRAPH_WEIGHT=0`** (#1446 by david-waltermire). +- **A failed graph snapshot read no longer zeroes the snapshot**; the delta is aborted instead (#1384 by cbsincool). +- **The graph snapshot total can no longer be lower than the nodes it returns** (#1385 by cbsincool). +- **Ending an unknown session no longer creates a partial row** that hung the sessions listing (#1252 by a652). +- **Memories and vectors written just before `agentmemory stop` survive the restart** (#1449). +- **Forget and governance deletes count and audit only real deletions** (#1449). +- **Export refuses an oversized payload before assembling it** and the REST endpoint returns 413; the MCP shim surfaces the refusal (#1449, #1422). +- **Session and graph read-modify-write paths take locks**, closing lost updates when several agents share one daemon (#1421). +- **Hooks no longer exit before their observe request is sent** on a slow start (#1456). +- **A fresh vector index is checkpointed within 5 s** and observations keep a bounded, sanitized copy of their source for replay and export (#1448). +- **Runtime config is re-seeded on every start**, so `--port`, `--instance` and data-dir changes take effect after the first run (#1396, #1397). +- **The "Memory elevated" alert no longer fires on a healthy process** (#1409). +- **The viewer stops blinking and keeps data on a failed refresh**, and dashboard numbers match the API (#1407). +- Consolidation and provider detection use the same check, and functions that need an LLM show as off instead of failed (#1433). +- Worker shutdown no longer hangs when the engine is already gone (#1396). +- Fresh installs are portable and persistent, and native and Docker removal stops the worker before the engine (#892). +- **`OPENAI_EMBEDDING_API_KEY` is honored** when the embedding provider is auto-detected or chosen, and wins over `OPENAI_API_KEY`; blank keys count as unset (#1472). +- **SessionStart context reaches hosts that expect structured hook output.** When the hook input names the `SessionStart` event, context is returned as `hookSpecificOutput.additionalContext`; hosts that send no event name still get plain text (#1472). + +### Security + +- **Request hardening** (#1462, supersedes #878 by DaveCole and #922 by Srinath279). Auth on by default, origin and content type checks on writes, and confined file paths, as described under Breaking changes. Confined files are replaced only after the new content is fully written, and a destination that is a symlink is refused. +- **Scrubbing on every write** (#1462). Write functions run the secret scrubber on their input, and compression, summary, crystal, graph, replay, team share, session title, commit message and image description text is scrubbed before storage. New patterns cover PEM private key blocks and credentials in URLs. Stored text is escaped before it goes into the injected context block. +- **Clients resolve the API secret the same way as the server** (#1462): environment first, then `~/.agentmemory/.env`, then the generated secret file, and the stored secret is only sent to loopback URLs. +- **Supply chain** (#1461). The automatic engine installer verifies the downloaded archive against a SHA-256 pinned in the CLI for each platform before extracting it, and refuses an unpinned version or platform. `npm run engine:hashes` refreshes the pins. Installer paths reach the shell as arguments, so a home directory containing shell syntax is never evaluated. The CI workflow runs with read-only permissions, and the deploy Dockerfiles check that the copied iii binary matches `III_VERSION`. +- `GET /agentmemory/status` serves HTML with no scripts under a strict CSP and the same bearer auth as the rest of the API (#1408). +- The Redis URL stays out of files and output (#1425). +- `mem::governance-bulk` cannot widen a dry run to the whole store (#1449). +- The pinned engine starts with `--no-update-check` and iii's anonymous usage telemetry off (#1396). +- A profile read no longer writes a `share` audit entry (#1433). + +### Performance + +- **Vectors are stored per key in fill-and-roll buckets**, so a save rewrites a few buckets instead of the whole index and the store no longer hits V8's string limit at about 49,000 vectors (#1416). +- **Index saves are throttled and each leg reports its own state**, so one failing leg no longer skips the others (#1415). +- **The audit log lives in monthly scopes** read newest first (#1419). +- **Session start context and observation lookups use small secondary indexes** instead of listing every session (#1418). +- **`mem::remember` calls the embedding provider outside the global save lock** (#1423). +- **`mem::patterns` is bounded** to recent sessions and an observation budget (#1424). +- **Consolidation decay writes only rows that changed** (#1417). +- **The viewer stream backlog is bounded** (#1420). +- **Faster state saves**, `MALLOC_ARENA_MAX=2` for the engine on Linux, and a higher open-file limit in Docker and deploy entrypoints (#1457). + +### Docs and internal + +- **agent-memory.dev is rebuilt** around use cases and sourced proof: agent sessions showing what memory changes, a view of the 1,571 tokens the next session gets out of a month of history, live GitHub and all-time npm numbers, and new /benchmarks, /security, /privacy, /changelog and /vs comparison pages. It ships robots.txt, a sitemap, llms.txt and llms-full.txt, and link previews now point at agent-memory.dev instead of a parked domain. +- `npm run docs:sync` and `npm run docs:check` keep the documented counts and versions in README, the translated READMEs and AGENTS.md in step with the code. +- The README documents auth by default, request rules, file path roots, the capture inbox and spool, and the pending vector log (#1460, #1462, #1467). +- The README, the config skill reference and `agentmemory --help` document `AGENTMEMORY_III_CONFIG` and the engine bind address, including the Docker engine config (#1472). +- Code and tests no longer cite issue or PR numbers (#1469). +- The `index_persist` audit gating suite is restored against bucketed persistence and monthly audit scopes (#1477), originally written by dmazhukov in #1182. +- Unit tests grew from about 1,700 to more than 2,400. +- Dependabot no longer proposes `iii-sdk` bumps; the engine pin and the SDK move together by hand (#1396). `dotenv` 18.0.3 (#1430) and `@types/node` 26.6.2 (#1401, #1400). +- The deploy Dockerfiles refuse to build when `III_VERSION` and `III_SDK_VERSION` differ (#1396). +- Thanks to MarvinFS (discussion #1358), inix-x, sbynode-ux, ErikBPF and cmondragon023, whose measurements and earlier PRs shaped the scaling work. ## [0.9.29] — 2026-08-16 @@ -168,6 +261,7 @@ Wave release closing several breaking regressions reported against v0.9.26, plus - `/agentmemory:forget` skill still calls `memory_governance_delete` which only touches `KV.memories` and never observations ([#833](https://github.com/rohitg00/agentmemory/issues/833)). Skill rewrite + new `memory_forget` MCP tool tracked separately. - `crypto.randomUUID()` global-only on Node <19 ([#715](https://github.com/rohitg00/agentmemory/issues/715)). Drop-in import fix tracked. +[0.9.30]: https://github.com/rohitg00/agentmemory/compare/v0.9.29...v0.9.30 [0.9.29]: https://github.com/rohitg00/agentmemory/compare/v0.9.28...v0.9.29 [0.9.28]: https://github.com/rohitg00/agentmemory/compare/v0.9.27...v0.9.28 [0.9.27]: https://github.com/rohitg00/agentmemory/compare/v0.9.26...v0.9.27 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7a9a8e45d0..6e58c49d0c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -93,16 +93,7 @@ PRs with commits lacking sign-off will not merge. ## Release process -Maintainers cut releases. Every bump touches these files in lockstep (the consistency tests fail if the trio of doc counts or any version drifts): - -1. `package.json` -2. `src/version.ts` -3. `plugin/.claude-plugin/plugin.json` -4. `plugin/plugin.json` -5. `plugin/.codex-plugin/plugin.json` -6. `packages/mcp/package.json` -7. `src/types.ts` (`ExportData.version` union) -8. `src/functions/export-import.ts` (`supportedVersions` Set) +Maintainers cut releases. To bump the version, change only `package.json`, then run `npm run docs:sync`. It carries the new version into `src/version.ts`, the `ExportData.version` union in `src/types.ts`, the `supportedVersions` set in `src/functions/export-import.ts`, every plugin and package manifest that shared the old version, the deploy templates, the AGENTS.md stats heading, and CHANGELOG.md (the Unreleased section becomes the new version with today's date and its compare link). Commit everything it changes, and check with `npm run docs:check`. No lockfiles are committed. `test/export-import.test.ts` asserts against the `VERSION` constant, so it needs no per-release edit. Run `npm run skills:gen` if the endpoint or env surface changed. diff --git a/README.md b/README.md index 71235b98f5..324636bcc4 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 1,674+ tests passing + 2,500+ tests passing

@@ -611,31 +611,33 @@ codex plugin add agentmemory@agentmemory The Codex plugin ships from the same `plugin/` directory as the Claude Code plugin. It registers: -- `@agentmemory/mcp` as an MCP server (proxies all 54 tools when `AGENTMEMORY_URL` points at a running agentmemory server; falls back to 7 tools locally when no server is reachable) +- A bundled stdio MCP bridge to the running daemon, with no npm download or fallback store. See the [local Codex guide](docs/plugins/codex-local.md) to test an unreleased build. - 6 lifecycle hooks: `SessionStart`, `UserPromptSubmit`, `PreToolUse`, `PostToolUse`, `PreCompact`, `Stop` - 9 invocable skills: `/recall`, `/remember`, `/session-history`, `/forget`, `/recap`, `/handoff`, `/lesson`, `/commit-context`, `/commit-history`, plus 8 reference skills the agent loads on demand (memory discipline, MCP tools, REST API, config, agents, hooks, architecture, and the skill-authoring guide) Codex's hook engine injects `CLAUDE_PLUGIN_ROOT` into hook subprocesses (per [`codex-rs/hooks/src/engine/discovery.rs`](https://github.com/openai/codex/blob/main/codex-rs/hooks/src/engine/discovery.rs)), so the same hook scripts work across both hosts without duplication. Subagent / SessionEnd / Notification / TaskCompleted / PostToolUseFailure events are Claude-Code-only and are not registered for Codex. -#### Codex Desktop: plugin hooks currently silent (workaround available) +#### Codex hook trust and compatibility -`CodexHooks` and `PluginHooks` are both stable + default-enabled in [`codex-rs/features/src/lib.rs`](https://github.com/openai/codex/blob/main/codex-rs/features/src/lib.rs), but Codex Desktop builds currently do not dispatch plugin-local `hooks.json` ([openai/codex#16430](https://github.com/openai/codex/issues/16430)). MCP tools still work; only the lifecycle observations are missing. +Native plugin hook dispatch is verified with Codex CLI 0.150.1. Trust the plugin hooks before expecting capture. Desktop behavior depends on its bundled runtime; check `/hooks` and confirm a captured event before enabling a workaround. -Until upstream lands the fix, mirror the same hook commands into the global `~/.codex/hooks.json`: +If your host requires global hooks, mirror the commands into `~/.codex/hooks.json`. When MCP is already wired, the current connector needs `--force` to reach hook installation: ```bash -agentmemory connect codex --with-hooks +agentmemory connect codex --with-hooks --force ``` -This adds an idempotent block to `~/.codex/hooks.json` referencing absolute paths to the bundled scripts (no `${CLAUDE_PLUGIN_ROOT}` expansion needed at user-scope). Re-run the same command after upgrading agentmemory to refresh paths. User entries in the same file are preserved; only previous agentmemory entries are replaced. +This merges global hooks and rewrites the agentmemory MCP entry, preserving unrelated entries. Review any custom agentmemory endpoint settings before using `--force`. Re-run after upgrading to refresh script paths. Enable either native plugin hooks or global copies to avoid duplicate capture. ### GitHub Copilot CLI +For VS Code agent mode, use the [Copilot MCP and automatic-capture guide](docs/plugins/copilot.md#vs-code-copilot-local-agent-sessions). The CLI connector does not configure VS Code. + ```bash # MCP-only wiring agentmemory connect copilot-cli -# Full hooks/skills plugin from the GitHub subdir +# Alternatively, full hooks/skills plugin from the GitHub subdir copilot plugin install rohitg00/agentmemory:plugin ``` @@ -739,14 +741,14 @@ The agentmemory entry is the **same MCP server block** across every host that us | **GitHub Copilot CLI (full plugin)** | Copilot plugin install | `copilot plugin install rohitg00/agentmemory:plugin` for the plugin from the GitHub subdir. | | **OpenClaw** | OpenClaw MCP config | Same `mcpServers` block. Deeper: `openclaw plugins install ./integrations/openclaw` claims OpenClaw's memory slot (auto-switches from `memory-core`); set `plugins.entries.agentmemory.hooks.allowConversationAccess=true` or turn capture is silently blocked. See [`integrations/openclaw`](integrations/openclaw/). | | **Codex CLI (MCP only)** | `.codex/config.toml` | TOML shape: `codex mcp add agentmemory -- npx -y @agentmemory/mcp`, or add `[mcp_servers.agentmemory]` manually. | -| **Codex CLI (full plugin)** | Codex plugin marketplace | `codex plugin marketplace add rohitg00/agentmemory` then `codex plugin add agentmemory@agentmemory`. Registers MCP + 6 lifecycle hooks (SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, PreCompact, Stop) + 17 skills. On Codex Desktop, also run `agentmemory connect codex --with-hooks` until [openai/codex#16430](https://github.com/openai/codex/issues/16430) lands; plugin hooks are currently silent there. | +| **Codex CLI (full plugin)** | Codex plugin marketplace | `codex plugin marketplace add rohitg00/agentmemory` then `codex plugin add agentmemory@agentmemory`. Registers MCP + 6 lifecycle hooks + 17 skills. Trust hooks and verify capture in your host; see [Codex setup and validation](docs/plugins/codex-local.md). | | **OpenCode (MCP only)** | `opencode.json` | Different shape: top-level `mcp` key, command as array: `{"mcp": {"agentmemory": {"type": "local", "command": ["npx", "-y", "@agentmemory/mcp"], "enabled": true}}}`. | | **OpenCode (full plugin)** | `plugin/opencode/` | 22 auto-capture hooks covering session lifecycle, messages, tools, errors. Project attribution is per-session, so one OpenCode process spanning several repositories files each session under its own project. Two slash commands (`/recall`, `/remember`). Copy `plugin/opencode/` into your OpenCode workspace and add the plugin entry to `opencode.json`. See [`plugin/opencode/README.md`](plugin/opencode/README.md) for the full hook table + gap analysis. | | **pi** | `~/.pi/agent/extensions/agentmemory` | `agentmemory connect pi` installs the bundled extension into pi's auto-discovery directory (recall on agent start, capture on agent end, `memory_search` / `memory_save` / `memory_health` tools, `/agentmemory-status`). `/reload` in a running pi picks it up. [`integrations/pi`](integrations/pi/) is also a pi package (`pi install ./integrations/pi` from a checkout). | | **Hermes Agent** | `~/.hermes/config.yaml` | `cp -r integrations/hermes ~/.hermes/plugins/agentmemory` + `memory.provider: agentmemory` gives the 6-hook memory provider (prefetch, turn capture, session end, pre-compress, MEMORY.md mirroring, system prompt block). Validate with `hermes plugins doctor` and `hermes memory status`. See [`integrations/hermes`](integrations/hermes/). | | **Qwen Code** | `~/.qwen/settings.json` | `agentmemory connect qwen` writes the standard `mcpServers` block. Hook payload is field-compatible with Claude Code, so the existing 12-hook scripts work without modification; wire them via the `hooks` section in the same `settings.json`. | -| **Antigravity** (replaces Gemini CLI) | `mcp_config.json` (in Antigravity's User dir) | `agentmemory connect antigravity` writes the standard `mcpServers` block. macOS: `~/Library/Application Support/Antigravity/User/`. Linux: `~/.config/Antigravity/User/`. Use after the 2026-06-18 Gemini CLI sunset. | -| **Antigravity CLI** (`agy`) | `~/.gemini/config/mcp_config.json` | `agentmemory connect antigravity-cli`. The `agy` CLI keeps its own config under `~/.gemini/`, separate from the Antigravity IDE above. Pass `--with-hooks` for native auto-capture via `~/.gemini/config/hooks.json`. | +| **Antigravity IDE / 2.0** | `~/.gemini/config/mcp_config.json` | `agentmemory connect antigravity --with-hooks` installs MCP and capture hooks in the shared customization directory. See [Antigravity setup and limits](docs/plugins/antigravity.md). | +| **Antigravity CLI** (`agy`) | `~/.gemini/config/mcp_config.json` | `agentmemory connect antigravity-cli --with-hooks` uses the same MCP and hook configuration as current IDE versions. Existing installations should refresh with `--force`; see the [upgrade notes](docs/plugins/antigravity.md). | | **Kiro** | `~/.kiro/settings/mcp.json` | `agentmemory connect kiro` writes the user-level config. Workspace overrides go in `.kiro/settings/mcp.json` next to your code. | | **Warp** | `~/.warp/.mcp.json` | `agentmemory connect warp` writes the standard `mcpServers` block. Warp also auto-discovers skills from `.claude/skills/`; once the Claude Code plugin is installed the 8 agentmemory skills (`remember`, `recall`, `recap`, `handoff`, `forget`, `commit-context`, `commit-history`, `session-history`) appear natively in Warp's slash-command palette. | | **Cline (CLI)** | `~/.cline/mcp.json` | `agentmemory connect cline` writes the standard `mcpServers` block. VS Code extension users: paste the same block via Cline Settings → MCP Servers → Edit JSON. | @@ -1190,7 +1192,14 @@ cp plugin/opencode/commands/*.md ~/.config/opencode/commands/

Real-Time Viewer

-Auto-starts on port `3113`. Live observation stream with a stream status indicator, a two-pane session explorer (list beside a sticky detail panel on wide screens), memory and lesson rows that expand to the full stored record including raw JSON and origin provenance, a knowledge graph that clusters nodes by type while relations are sparse, session replay, and a health dashboard. +Auto-starts on port `3113`. The viewer loads one snapshot when it connects (`GET /agentmemory/viewer/snapshot`) and then applies live stream events: new memories, lessons, observations, audit entries, graph changes and health updates appear without polling or page reloads. The only other requests are the actions you click, "load more" pages and searches. When the stream drops, the viewer shows how old its numbers are, reconnects with backoff and resyncs from one snapshot. + +- **12 tabs in four groups** with live counts, deep links (`#memories/`, `#sessions/?obs=`, `#graph/`, `#health/consolidation`), keyboard shortcuts and a mobile menu. +- **Memories:** server-side search, filters by project, agent and type, a detail panel with the version chain and a word diff, provenance links, copy buttons for the id, the MCP call and a curl command, edit (a new version), forget with confirmation, bulk forget and JSON export. +- **Sessions:** an inline observation timeline with readable tool input and output, filters and paging, and the memories and lessons each session produced. +- **Graph:** search, node detail with relations and sources, a legend that does not rely on colour alone, and zoom controls. +- **Health:** the live version of `GET /agentmemory/status`. Every problem comes with its fix, plus the state backend, index save state, graph provenance compaction progress and a consolidation explainer with the real thresholds. +- **Audit, Activity, Profile, Replay, Lessons, Actions and Crystals** pages, each with an empty state that says what the section is, why it is empty and the command that fills it, and a `?` glossary tooltip on every term and number. ```bash open http://localhost:3113 @@ -1377,7 +1386,7 @@ fi | Prometheus / Grafana | iii OTEL + health monitor | | Custom plugin systems | `iii worker add ` | -**184 source files · ~42,200 LOC · 1,674 tests · 264 functions · 50 KV scopes**, all on three primitives. No `agentmemory plugin install`. The plugin system is iii itself. +**219 source files · ~52,000 LOC · 2,500+ tests · 311 functions · 60 KV scopes**, all on three primitives. No `agentmemory plugin install`. The plugin system is iii itself. --- @@ -1677,6 +1686,36 @@ Create `~/.agentmemory/.env`: # CLAUDE_MEMORY_BRIDGE=false # SNAPSHOT_ENABLED=false +# Storage and durability +# AGENTMEMORY_STATE_BACKEND=file # file (default) or redis; see "Storage backend" below +# AGENTMEMORY_REDIS_URL=redis://localhost:6379 # Required with redis, plain redis:// only +# AGENTMEMORY_STATE_SAVE_INTERVAL_MS=2000 # How often the engine writes file state to disk. + # A hard kill loses at most this window. +# AGENTMEMORY_INDEX_SAVE_INTERVAL_MS=600000 # Minimum time between search index saves; + # shutdown and deletes still save at once. +# AGENTMEMORY_GRAPH_COMPACT_ON_BOOT=true # One-time background trim of oversized graph + # provenance; false skips it + +# Sessions +# AGENTMEMORY_SESSION_SWEEP_ENABLED=true # Hourly sweep marks sessions left active past + # the threshold as abandoned. Deletes nothing; + # new activity makes the session active again. +# AGENTMEMORY_SESSION_SWEEP_STALE_HOURS=24 + +# Capture filters (hooks) +# AGENTMEMORY_CAPTURE_ALLOW= # Comma or space list of tool names or globs; + # when set, only these tools are captured +# AGENTMEMORY_CAPTURE_DENY= # Extra names or globs to skip, added to the + # defaults: memory_*, toolsearch, + # listmcpresources, fetchmcpresource +# AGENTMEMORY_CAPTURE_OUTPUT_MAX=8000 # Max characters of tool output per observation +# AGENTMEMORY_PRE_COMPACT_BUDGET=1500 # Token budget for PreCompact context; 0 disables + +# Audit log +# AGENTMEMORY_AUDIT_RETENTION_MONTHS=0 # Drop month scopes older than N months; 0 keeps all +# AGENTMEMORY_AUDIT_INDEX_PERSIST=false # 1 or true records index migration and cleanup + # rows (debugging only) + # Team # TEAM_ID= # USER_ID= @@ -1710,6 +1749,8 @@ curl -H "Authorization: Bearer $(cat ~/.agentmemory/secret)" http://localhost:31 | Method | Path | Description | |--------|------|-------------| | `GET` | `/agentmemory/health` | Health check (always public) | +| `GET` | `/agentmemory/status` | What is wrong and how to fix it (HTML for browsers, JSON otherwise) | +| `GET` | `/agentmemory/viewer/snapshot` | Everything the viewer shows, in one response | | `POST` | `/agentmemory/session/start` | Start session + get context | | `POST` | `/agentmemory/session/end` | End session | | `POST` | `/agentmemory/observe` | Capture observation (see capture delivery below) | @@ -1769,7 +1810,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Content-Type: a ```bash npm run dev # Hot reload npm run build # Production build -npm test # 1,674 tests +npm test # 2,500+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.de-DE.md b/READMEs/README.de-DE.md index 02631d18af..4b03c7390e 100644 --- a/READMEs/README.de-DE.md +++ b/READMEs/README.de-DE.md @@ -50,7 +50,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 1,674+ tests passing + 2,500+ tests passing

@@ -1227,7 +1227,7 @@ Volle Registry: [workers.iii.dev](https://workers.iii.dev). Jeder Worker dort ko | Prometheus / Grafana | iii OTEL + Health-Monitor | | Eigene Plugin-Systeme | `iii worker add ` | -**182 Quelldateien · ~41.600 LOC · 1.674 Tests · 264 Funktionen · 50 KV-Scopes**, alles auf drei Primitiven. Kein `agentmemory plugin install`. Das Plugin-System ist iii selbst. +**219 Quelldateien · ~52.000 LOC · 2.500+ Tests · 311 Funktionen · 60 KV-Scopes**, alles auf drei Primitiven. Kein `agentmemory plugin install`. Das Plugin-System ist iii selbst. --- @@ -1526,7 +1526,7 @@ CONSOLIDATION_ENABLED=true

API

-124 Endpunkte auf Port `3111`. Die REST API bindet sich standardmäßig an `127.0.0.1`. Geschützte Endpunkte verlangen `Authorization: Bearer `, wenn `AGENTMEMORY_SECRET` gesetzt ist, und Mesh-Sync-Endpunkte erfordern `AGENTMEMORY_SECRET` auf beiden Peers. +138 Endpunkte auf Port `3111`. Die REST API bindet sich standardmäßig an `127.0.0.1`. Geschützte Endpunkte verlangen `Authorization: Bearer `, und Mesh-Sync-Endpunkte erfordern ein explizit gesetztes `AGENTMEMORY_SECRET` auf beiden Peers.
Wichtige Endpunkte @@ -1560,7 +1560,7 @@ Volle Endpunktliste: [`src/triggers/api.ts`](../src/triggers/api.ts) ```bash npm run dev # Hot reload npm run build # Production build -npm test # 1,674 tests +npm test # 2,500+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.es-ES.md b/READMEs/README.es-ES.md index a01a1618c1..f2ab50822b 100644 --- a/READMEs/README.es-ES.md +++ b/READMEs/README.es-ES.md @@ -50,7 +50,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 1,674+ tests passing + 2,500+ tests passing

@@ -1220,7 +1220,7 @@ Registro completo: [workers.iii.dev](https://workers.iii.dev). Cada worker allí | Prometheus / Grafana | iii OTEL + monitor de salud | | Sistemas de plugins propios | `iii worker add ` | -**182 ficheros de código · ~41.600 LOC · 1.674 tests · 264 funciones · 50 scopes KV**, todo sobre tres primitivos. No hay `agentmemory plugin install`. El sistema de plugins es iii mismo. +**219 ficheros de código · ~52.000 LOC · 2.500+ tests · 311 funciones · 60 scopes KV**, todo sobre tres primitivos. No hay `agentmemory plugin install`. El sistema de plugins es iii mismo. --- @@ -1519,7 +1519,7 @@ Crea `~/.agentmemory/.env`:

API

-124 endpoints en el puerto `3111`. La REST API se enlaza a `127.0.0.1` por defecto. Los endpoints protegidos requieren `Authorization: Bearer ` cuando `AGENTMEMORY_SECRET` está definido, y los endpoints de mesh sync requieren `AGENTMEMORY_SECRET` en ambos peers. +138 endpoints en el puerto `3111`. La REST API se enlaza a `127.0.0.1` por defecto. Los endpoints protegidos requieren `Authorization: Bearer `, y los endpoints de mesh sync requieren un `AGENTMEMORY_SECRET` definido explícitamente en ambos peers.
Endpoints principales @@ -1553,7 +1553,7 @@ Lista completa de endpoints: [`src/triggers/api.ts`](../src/triggers/api.ts) ```bash npm run dev # Hot reload npm run build # Production build -npm test # 1,674 tests +npm test # 2,500+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.fr-FR.md b/READMEs/README.fr-FR.md index 7261aea409..d12fc29a44 100644 --- a/READMEs/README.fr-FR.md +++ b/READMEs/README.fr-FR.md @@ -50,7 +50,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 1,674+ tests passing + 2,500+ tests passing

@@ -1227,7 +1227,7 @@ Registre complet : [workers.iii.dev](https://workers.iii.dev). Chaque worker là | Prometheus / Grafana | iii OTEL + moniteur de santé | | Systèmes de plugins personnalisés | `iii worker add ` | -**182 fichiers sources · ~41 600 LOC · 1 619 tests · 264 fonctions · 50 scopes KV**, tout sur trois primitives. Pas de `agentmemory plugin install`. Le système de plugins, c'est iii lui-même. +**219 fichiers sources · ~52 000 LOC · 2 500+ tests · 311 fonctions · 60 scopes KV**, tout sur trois primitives. Pas de `agentmemory plugin install`. Le système de plugins, c'est iii lui-même. --- @@ -1526,7 +1526,7 @@ Créez `~/.agentmemory/.env` :

API

-124 endpoints sur le port `3111`. L'API REST se lie à `127.0.0.1` par défaut. Les endpoints protégés exigent `Authorization: Bearer ` lorsque `AGENTMEMORY_SECRET` est défini, et les endpoints de mesh sync exigent `AGENTMEMORY_SECRET` sur les deux pairs. +138 endpoints sur le port `3111`. L'API REST se lie à `127.0.0.1` par défaut. Les endpoints protégés exigent `Authorization: Bearer `, et les endpoints de mesh sync exigent un `AGENTMEMORY_SECRET` défini explicitement sur les deux pairs.
Endpoints clés @@ -1560,7 +1560,7 @@ Liste complète des endpoints : [`src/triggers/api.ts`](../src/triggers/api.ts) ```bash npm run dev # Hot reload npm run build # Production build -npm test # 1,674 tests +npm test # 2,500+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.hi-IN.md b/READMEs/README.hi-IN.md index aa959dd3f4..08013d8d5d 100644 --- a/READMEs/README.hi-IN.md +++ b/READMEs/README.hi-IN.md @@ -50,7 +50,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 1,674+ tests passing + 2,500+ tests passing

@@ -1209,7 +1209,7 @@ Full registry: [workers.iii.dev](https://workers.iii.dev)। वहाँ हर | Prometheus / Grafana | iii OTEL + health monitor | | Custom plugin systems | `iii worker add ` | -**184 source files · ~42,200 LOC · 1,674 tests · 264 functions · 50 KV scopes**, सब कुछ तीन primitives पर। कोई `agentmemory plugin install` नहीं। Plugin system iii स्वयं है। +**219 source files · ~52,000 LOC · 2,500+ tests · 311 functions · 60 KV scopes**, सब कुछ तीन primitives पर। कोई `agentmemory plugin install` नहीं। Plugin system iii स्वयं है। --- @@ -1508,7 +1508,7 @@ CONSOLIDATION_ENABLED=true

API

-Port `3111` पर 124 endpoints। REST API default रूप से `127.0.0.1` से bind होता है। `AGENTMEMORY_SECRET` set होने पर protected endpoints `Authorization: Bearer ` की आवश्यकता रखते हैं, और mesh sync endpoints दोनों peers पर `AGENTMEMORY_SECRET` की आवश्यकता रखते हैं। +Port `3111` पर 138 endpoints। REST API default रूप से `127.0.0.1` से bind होता है। Protected endpoints `Authorization: Bearer ` की आवश्यकता रखते हैं, और mesh sync endpoints दोनों peers पर स्पष्ट रूप से set किए गए `AGENTMEMORY_SECRET` की आवश्यकता रखते हैं।
मुख्य endpoints @@ -1542,7 +1542,7 @@ Full endpoint list: [`src/triggers/api.ts`](../src/triggers/api.ts) ```bash npm run dev # Hot reload npm run build # Production build -npm test # 1,674 tests +npm test # 2,500+ tests npm run test:integration # API tests (running services की आवश्यकता है) ``` diff --git a/READMEs/README.ja-JP.md b/READMEs/README.ja-JP.md index 0badfa5c99..4efde4f5de 100644 --- a/READMEs/README.ja-JP.md +++ b/READMEs/README.ja-JP.md @@ -50,7 +50,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 1,674+ tests passing + 2,500+ tests passing

@@ -1230,7 +1230,7 @@ iii worker add mcp # agentmemory MCP の横に汎用 MCP ホス | Prometheus / Grafana | iii OTEL + ヘルスモニタ | | カスタムプラグインシステム | `iii worker add ` | -**182 ソースファイル · ~41,600 LOC · 1,619 テスト · 264 functions · 50 KV スコープ** — すべて 3 つのプリミティブの上に。`agentmemory plugin install` はありません。プラグインシステムは iii そのものです。 +**219 ソースファイル · ~52,000 LOC · 2,500+ テスト · 311 functions · 60 KV スコープ** — すべて 3 つのプリミティブの上に。`agentmemory plugin install` はありません。プラグインシステムは iii そのものです。 --- @@ -1529,7 +1529,7 @@ CONSOLIDATION_ENABLED=true

API

-ポート `3111` 上の 124 エンドポイント。REST API はデフォルトで `127.0.0.1` にバインドします。`AGENTMEMORY_SECRET` が設定されている場合、保護されたエンドポイントは `Authorization: Bearer ` を要求し、mesh sync エンドポイントは両ピアで `AGENTMEMORY_SECRET` を要求します。 +ポート `3111` 上の 138 エンドポイント。REST API はデフォルトで `127.0.0.1` にバインドします。保護されたエンドポイントは `Authorization: Bearer ` を要求し、mesh sync エンドポイントは両ピアで明示的に設定された `AGENTMEMORY_SECRET` を要求します。
主要エンドポイント @@ -1563,7 +1563,7 @@ CONSOLIDATION_ENABLED=true ```bash npm run dev # ホットリロード npm run build # 本番ビルド -npm test # 1,619 テスト +npm test # 2,500+ テスト npm run test:integration # API テスト(サービス起動が必要) ``` diff --git a/READMEs/README.ko-KR.md b/READMEs/README.ko-KR.md index 1c3ae696ae..d6c0cad14b 100644 --- a/READMEs/README.ko-KR.md +++ b/READMEs/README.ko-KR.md @@ -50,7 +50,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 1,674+ tests passing + 2,500+ tests passing

@@ -1209,7 +1209,7 @@ iii worker add mcp # generic MCP host alongside the agentmemory | Prometheus / Grafana | iii OTEL + 헬스 모니터 | | 사용자 정의 플러그인 시스템 | `iii worker add ` | -**182개 소스 파일 · ~41,600 LOC · 1,674 tests · 264개 함수 · 50개 KV 스코프**, 모두 세 가지 프리미티브 위에. `agentmemory plugin install`이 없습니다. 플러그인 시스템은 iii 자체입니다. +**219개 소스 파일 · ~52,000 LOC · 2,500+ tests · 311개 함수 · 60개 KV 스코프**, 모두 세 가지 프리미티브 위에. `agentmemory plugin install`이 없습니다. 플러그인 시스템은 iii 자체입니다. --- @@ -1508,7 +1508,7 @@ CONSOLIDATION_ENABLED=true

API

-`3111` 포트의 124개 엔드포인트. REST API는 기본적으로 `127.0.0.1`에 바인딩됩니다. 보호된 엔드포인트는 `AGENTMEMORY_SECRET`이 설정되었을 때 `Authorization: Bearer `를 요구하며, mesh sync 엔드포인트는 양쪽 피어 모두에서 `AGENTMEMORY_SECRET`을 요구합니다. +`3111` 포트의 138개 엔드포인트. REST API는 기본적으로 `127.0.0.1`에 바인딩됩니다. 보호된 엔드포인트는 `Authorization: Bearer `를 요구하며, mesh sync 엔드포인트는 양쪽 피어 모두에서 명시적으로 설정된 `AGENTMEMORY_SECRET`을 요구합니다.
주요 엔드포인트 @@ -1542,7 +1542,7 @@ CONSOLIDATION_ENABLED=true ```bash npm run dev # Hot reload npm run build # Production build -npm test # 1,674 tests +npm test # 2,500+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.pt-BR.md b/READMEs/README.pt-BR.md index 0dc6643d57..49182ae6bb 100644 --- a/READMEs/README.pt-BR.md +++ b/READMEs/README.pt-BR.md @@ -50,7 +50,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 1,674+ tests passing + 2,500+ tests passing

@@ -1220,7 +1220,7 @@ Registry completo: [workers.iii.dev](https://workers.iii.dev). Todo worker lá s | Prometheus / Grafana | iii OTEL + monitor de saúde | | Sistemas de plugin customizados | `iii worker add ` | -**182 arquivos de código · ~41.600 LOC · 1.674 tests · 264 funções · 50 escopos KV**, tudo em cima de três primitivos. Sem `agentmemory plugin install`. O sistema de plugins é o próprio iii. +**219 arquivos de código · ~52.000 LOC · 2.500+ tests · 311 funções · 60 escopos KV**, tudo em cima de três primitivos. Sem `agentmemory plugin install`. O sistema de plugins é o próprio iii. --- @@ -1519,7 +1519,7 @@ Crie `~/.agentmemory/.env`:

API

-124 endpoints na porta `3111`. A REST API faz bind em `127.0.0.1` por padrão. Endpoints protegidos exigem `Authorization: Bearer ` quando `AGENTMEMORY_SECRET` está definido, e endpoints de mesh sync exigem `AGENTMEMORY_SECRET` em ambos os peers. +138 endpoints na porta `3111`. A REST API faz bind em `127.0.0.1` por padrão. Endpoints protegidos exigem `Authorization: Bearer `, e endpoints de mesh sync exigem um `AGENTMEMORY_SECRET` definido explicitamente em ambos os peers.
Endpoints principais @@ -1553,7 +1553,7 @@ Lista completa de endpoints: [`src/triggers/api.ts`](../src/triggers/api.ts) ```bash npm run dev # Hot reload npm run build # Production build -npm test # 1,674 tests +npm test # 2,500+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.ru-RU.md b/READMEs/README.ru-RU.md index f41b0207b7..604277a6eb 100644 --- a/READMEs/README.ru-RU.md +++ b/READMEs/README.ru-RU.md @@ -50,7 +50,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 1,674+ tests passing + 2,500+ tests passing

@@ -1227,7 +1227,7 @@ iii worker add mcp # generic MCP host alongside the agentmemory | Prometheus / Grafana | iii OTEL + монитор состояния | | Самописные плагинные системы | `iii worker add ` | -**182 исходных файла · ~41 600 LOC · 1 619 тестов · 264 функции · 50 KV-scope'ов** — всё на трёх примитивах. Никакого `agentmemory plugin install`. Плагинная система — это сам iii. +**219 исходных файла · ~52 000 LOC · 2 500+ тестов · 311 функции · 60 KV-scope'ов** — всё на трёх примитивах. Никакого `agentmemory plugin install`. Плагинная система — это сам iii. --- @@ -1526,7 +1526,7 @@ CONSOLIDATION_ENABLED=true

API

-124 эндпоинта на порту `3111`. REST API по умолчанию слушает на `127.0.0.1`. Защищённые эндпоинты требуют `Authorization: Bearer `, когда установлен `AGENTMEMORY_SECRET`, а эндпоинты mesh-синхронизации требуют `AGENTMEMORY_SECRET` на обоих узлах. +138 эндпоинта на порту `3111`. REST API по умолчанию слушает на `127.0.0.1`. Защищённые эндпоинты требуют `Authorization: Bearer `, а эндпоинты mesh-синхронизации требуют явно заданного `AGENTMEMORY_SECRET` на обоих узлах.
Ключевые эндпоинты @@ -1560,7 +1560,7 @@ CONSOLIDATION_ENABLED=true ```bash npm run dev # Hot reload npm run build # Production build -npm test # 1,674 tests +npm test # 2,500+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.tr-TR.md b/READMEs/README.tr-TR.md index ae7923d597..ca1df27b76 100644 --- a/READMEs/README.tr-TR.md +++ b/READMEs/README.tr-TR.md @@ -50,7 +50,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 1,674+ tests passing + 2,500+ tests passing

@@ -1229,7 +1229,7 @@ Tam kayıt defteri: [workers.iii.dev](https://workers.iii.dev). Oradaki her work | Prometheus / Grafana | iii OTEL + sağlık monitörü | | Özel eklenti sistemleri | `iii worker add ` | -**182 kaynak dosya · ~41,600 LOC · 1,619 test · 264 fonksiyon · 50 KV scope**, hepsi üç primitif üzerinde. `agentmemory plugin install` yok. Eklenti sistemi iii'nin kendisi. +**219 kaynak dosya · ~52,000 LOC · 2,500+ test · 311 fonksiyon · 60 KV scope**, hepsi üç primitif üzerinde. `agentmemory plugin install` yok. Eklenti sistemi iii'nin kendisi. --- @@ -1528,7 +1528,7 @@ CONSOLIDATION_ENABLED=true

API

-`3111` portunda 124 endpoint. REST API varsayılan olarak `127.0.0.1`'e bağlanır. `AGENTMEMORY_SECRET` ayarlandığında korumalı endpoint'ler `Authorization: Bearer ` gerektirir ve mesh sync endpoint'leri her iki eşte de `AGENTMEMORY_SECRET` gerektirir. +`3111` portunda 138 endpoint. REST API varsayılan olarak `127.0.0.1`'e bağlanır. Korumalı endpoint'ler `Authorization: Bearer ` gerektirir ve mesh sync endpoint'leri her iki eşte de açıkça ayarlanmış bir `AGENTMEMORY_SECRET` gerektirir.
Önemli endpoint'ler @@ -1562,7 +1562,7 @@ Tam endpoint listesi: [`src/triggers/api.ts`](../src/triggers/api.ts) ```bash npm run dev # Hot reload npm run build # Production build -npm test # 1,674 tests +npm test # 2,500+ tests npm run test:integration # API testleri (çalışan servisler gerektirir) ``` diff --git a/READMEs/README.zh-CN.md b/READMEs/README.zh-CN.md index 7f7c8a03f2..2a0c590d51 100644 --- a/READMEs/README.zh-CN.md +++ b/READMEs/README.zh-CN.md @@ -50,7 +50,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 1,674+ tests passing + 2,500+ tests passing

@@ -1226,7 +1226,7 @@ iii worker add mcp # 在 agentmemory 的 MCP 旁开通用 MCP | Prometheus / Grafana | iii OTEL + 健康监控 | | 自定义插件系统 | `iii worker add ` | -**182 个源文件 · ~41,600 行代码 · 1,619 个测试 · 264 个函数 · 50 个 KV 作用域**,全部基于三种原语。没有 `agentmemory plugin install`。插件系统就是 iii 本身。 +**219 个源文件 · ~52,000 行代码 · 2,500+ 个测试 · 311 个函数 · 60 个 KV 作用域**,全部基于三种原语。没有 `agentmemory plugin install`。插件系统就是 iii 本身。 --- @@ -1525,7 +1525,7 @@ CONSOLIDATION_ENABLED=true

API

-端口 `3111` 上的 124 个端点。REST API 默认绑定 `127.0.0.1`。当 `AGENTMEMORY_SECRET` 已设置时,受保护端点需要 `Authorization: Bearer `,网状同步端点要求两端都设置 `AGENTMEMORY_SECRET`。 +端口 `3111` 上的 138 个端点。REST API 默认绑定 `127.0.0.1`。受保护端点需要 `Authorization: Bearer `,网状同步端点要求两端都显式设置 `AGENTMEMORY_SECRET`。
关键端点 @@ -1559,7 +1559,7 @@ CONSOLIDATION_ENABLED=true ```bash npm run dev # 热重载 npm run build # 生产构建 -npm test # 1,619 测试 +npm test # 2,500+ 测试 npm run test:integration # API 测试(需要服务运行中) ``` diff --git a/READMEs/README.zh-TW.md b/READMEs/README.zh-TW.md index bf7362d354..f82a3dd6f4 100644 --- a/READMEs/README.zh-TW.md +++ b/READMEs/README.zh-TW.md @@ -50,7 +50,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 1,674+ tests passing + 2,500+ tests passing

@@ -1226,7 +1226,7 @@ iii worker add mcp # 在 agentmemory 的 MCP 旁開設通用 MCP | Prometheus / Grafana | iii OTEL + 健康監控 | | 自訂外掛系統 | `iii worker add ` | -**182 個原始檔 · ~41,600 行程式碼 · 1,619 測試 · 264 個函式 · 50 個 KV 範圍**,全部基於三種原語。沒有 `agentmemory plugin install`。外掛系統就是 iii 本身。 +**219 個原始檔 · ~52,000 行程式碼 · 2,500+ 測試 · 311 個函式 · 60 個 KV 範圍**,全部基於三種原語。沒有 `agentmemory plugin install`。外掛系統就是 iii 本身。 --- @@ -1525,7 +1525,7 @@ CONSOLIDATION_ENABLED=true

API

-連接埠 `3111` 上的 124 個端點。REST API 預設繫結 `127.0.0.1`。當 `AGENTMEMORY_SECRET` 已設定時,受保護端點需要 `Authorization: Bearer `,網狀同步端點要求兩端都設定 `AGENTMEMORY_SECRET`。 +連接埠 `3111` 上的 138 個端點。REST API 預設繫結 `127.0.0.1`。受保護端點需要 `Authorization: Bearer `,網狀同步端點要求兩端都明確設定 `AGENTMEMORY_SECRET`。
關鍵端點 @@ -1559,7 +1559,7 @@ CONSOLIDATION_ENABLED=true ```bash npm run dev # 熱重新載入 npm run build # 生產建置 -npm test # 1,619 測試 +npm test # 2,500+ 測試 npm run test:integration # API 測試(需要服務執行中) ``` diff --git a/assets/tags/light/stat-tests.svg b/assets/tags/light/stat-tests.svg index f4675bd97a..1bb69e34ce 100644 --- a/assets/tags/light/stat-tests.svg +++ b/assets/tags/light/stat-tests.svg @@ -1,5 +1,5 @@ - + - 1648+ + 2500+ TESTS PASSING diff --git a/assets/tags/stat-tests.svg b/assets/tags/stat-tests.svg index a7599939cd..44c9fc27f9 100644 --- a/assets/tags/stat-tests.svg +++ b/assets/tags/stat-tests.svg @@ -1,5 +1,5 @@ - + - 1648+ + 2500+ TESTS PASSING diff --git a/deploy/coolify/Dockerfile b/deploy/coolify/Dockerfile index 8a100474f8..62105fcbde 100644 --- a/deploy/coolify/Dockerfile +++ b/deploy/coolify/Dockerfile @@ -1,12 +1,12 @@ -ARG III_VERSION=0.11.2 +ARG III_VERSION=0.22.1 FROM iiidev/iii:${III_VERSION} AS iii-image FROM node:22-slim -ARG AGENTMEMORY_VERSION=0.9.29 -ARG III_VERSION=0.11.2 -ARG III_SDK_VERSION=0.11.2 +ARG AGENTMEMORY_VERSION=0.9.30 +ARG III_VERSION=0.22.1 +ARG III_SDK_VERSION=0.22.1 RUN apt-get update \ && apt-get install -y --no-install-recommends openssl ca-certificates tini gosu curl \ diff --git a/deploy/coolify/docker-compose.yml b/deploy/coolify/docker-compose.yml index b34823dbc6..62c078acdf 100644 --- a/deploy/coolify/docker-compose.yml +++ b/deploy/coolify/docker-compose.yml @@ -4,9 +4,9 @@ services: context: . dockerfile: Dockerfile args: - AGENTMEMORY_VERSION: "0.9.29" - III_VERSION: "0.11.2" - III_SDK_VERSION: "0.11.2" + AGENTMEMORY_VERSION: "0.9.30" + III_VERSION: "0.22.1" + III_SDK_VERSION: "0.22.1" restart: unless-stopped environment: SERVICE_FQDN_AGENTMEMORY_3111: ${SERVICE_FQDN_AGENTMEMORY_3111} diff --git a/deploy/fly/Dockerfile b/deploy/fly/Dockerfile index 1a0198792b..3abf36632f 100644 --- a/deploy/fly/Dockerfile +++ b/deploy/fly/Dockerfile @@ -1,12 +1,12 @@ -ARG III_VERSION=0.11.2 +ARG III_VERSION=0.22.1 FROM iiidev/iii:${III_VERSION} AS iii-image FROM node:22-slim -ARG AGENTMEMORY_VERSION=0.9.29 -ARG III_VERSION=0.11.2 -ARG III_SDK_VERSION=0.11.2 +ARG AGENTMEMORY_VERSION=0.9.30 +ARG III_VERSION=0.22.1 +ARG III_SDK_VERSION=0.22.1 RUN apt-get update \ && apt-get install -y --no-install-recommends openssl ca-certificates tini gosu curl \ diff --git a/deploy/railway/Dockerfile b/deploy/railway/Dockerfile index 1a0198792b..3abf36632f 100644 --- a/deploy/railway/Dockerfile +++ b/deploy/railway/Dockerfile @@ -1,12 +1,12 @@ -ARG III_VERSION=0.11.2 +ARG III_VERSION=0.22.1 FROM iiidev/iii:${III_VERSION} AS iii-image FROM node:22-slim -ARG AGENTMEMORY_VERSION=0.9.29 -ARG III_VERSION=0.11.2 -ARG III_SDK_VERSION=0.11.2 +ARG AGENTMEMORY_VERSION=0.9.30 +ARG III_VERSION=0.22.1 +ARG III_SDK_VERSION=0.22.1 RUN apt-get update \ && apt-get install -y --no-install-recommends openssl ca-certificates tini gosu curl \ diff --git a/deploy/render/Dockerfile b/deploy/render/Dockerfile index 1a0198792b..3abf36632f 100644 --- a/deploy/render/Dockerfile +++ b/deploy/render/Dockerfile @@ -1,12 +1,12 @@ -ARG III_VERSION=0.11.2 +ARG III_VERSION=0.22.1 FROM iiidev/iii:${III_VERSION} AS iii-image FROM node:22-slim -ARG AGENTMEMORY_VERSION=0.9.29 -ARG III_VERSION=0.11.2 -ARG III_SDK_VERSION=0.11.2 +ARG AGENTMEMORY_VERSION=0.9.30 +ARG III_VERSION=0.22.1 +ARG III_SDK_VERSION=0.22.1 RUN apt-get update \ && apt-get install -y --no-install-recommends openssl ca-certificates tini gosu curl \ diff --git a/deploy/render/render.yaml b/deploy/render/render.yaml index d1871d5795..17150b74b8 100644 --- a/deploy/render/render.yaml +++ b/deploy/render/render.yaml @@ -15,8 +15,8 @@ services: - key: PORT value: "3111" - key: AGENTMEMORY_VERSION - value: "0.9.29" + value: "0.9.30" - key: III_VERSION - value: "0.11.2" + value: "0.22.1" - key: III_SDK_VERSION - value: "0.11.2" + value: "0.22.1" diff --git a/docs/plugins/antigravity.md b/docs/plugins/antigravity.md new file mode 100644 index 0000000000..1284676fac --- /dev/null +++ b/docs/plugins/antigravity.md @@ -0,0 +1,69 @@ +# Agent Memory for Antigravity + +Start the Agent Memory daemon, then configure the surface you use: + +```sh +agentmemory connect antigravity-cli --with-hooks +# Antigravity IDE or 2.0: +agentmemory connect antigravity --with-hooks +``` + +Current Antigravity surfaces share `~/.gemini/config/mcp_config.json` and +`~/.gemini/config/hooks.json`. Workspace overrides live in `.agents/`. Restart the +host after installation. In the CLI, `agy mcp list` lists configured servers and +`/hooks` shows active hooks. This integration uses the MCP connector and bundled +hook scripts; the repository does not yet ship an Antigravity plugin bundle. + +Older Agent Memory connectors wrote the IDE config into its application-support +directory and used shell-style environment defaults that Antigravity does not +expand. After upgrading, inspect your agentmemory MCP settings, then rerun the +appropriate command with `--force` to refresh that entry. Other servers and hook +bundles are preserved. Custom values on the agentmemory entry must be reapplied. + +Launch the host with `AGENTMEMORY_URL` for a custom daemon endpoint and +`AGENTMEMORY_SECRET` when remote authentication requires it. The generated entry +inherits the process environment. Local clients also read the daemon-generated +credential. Do not paste secrets into committed configuration. + +## Capture behavior + +- The first model invocation opens the session. With + `AGENTMEMORY_INJECT_CONTEXT=true`, recalled context is passed back through + Antigravity's `injectSteps` response. +- Tool names, inputs, and reported failures are captured. Native PostToolUse + payloads currently omit successful tool output, so full output replay is not + available through this hook alone. +- Explicit user prompts are backfilled from the host transcript when execution + becomes fully idle. Repeated backfills and tool deliveries use stable event IDs. +- Idle Stop closes the session once. Stops with pending background work do not + close it. + +Keep the installed package path free of spaces for Antigravity hook command +compatibility. The installer warns and skips hooks when that condition is not met. +MCP can still be configured. Re-run `connect ... --with-hooks` after moving or +upgrading the package so absolute script paths stay current. + +## Repeat the native CLI test + +```sh +npm run build +AGENTMEMORY_TEST_ANTIGRAVITY=/absolute/path/to/agy node scripts/plugins/test-antigravity-native.mjs +``` + +Verified with Antigravity CLI 1.3.0. The test uses a temporary profile, a synthetic +local Gemini endpoint, and a generated sample file. It checks connector discovery, +inherited MCP environment, recalled context reaching the model, native tool capture, +transcript prompt backfill, and one session lifecycle. It launches the bundled MCP +bridge from the checkout because the release-prep runtime is not yet published. +No Google account credentials or paid model calls are used. + +The live daemon suite also exercises this bridge with the pinned iii engine, +including authentication, shared memory, offline capture recovery, and restart +persistence. IDE UI dispatch, native Windows execution, and an Antigravity plugin +bundle remain unverified or unimplemented. + +Contract references checked October 6, 2026: + +- [MCP configuration](https://antigravity.google/docs/mcp) +- [Hook events and payloads](https://antigravity.google/docs/hooks) +- [CLI model endpoint configuration](https://antigravity.google/docs/cli/install/) diff --git a/docs/plugins/codex-local.md b/docs/plugins/codex-local.md index 030f772e02..c4c8066006 100644 --- a/docs/plugins/codex-local.md +++ b/docs/plugins/codex-local.md @@ -112,6 +112,24 @@ across an engine restart. It launches hook scripts directly; desktop hook dispatch and host trust UI still require a manual host test. The normal test suite skips this check unless the engine path is explicitly set. +To exercise native plugin discovery and hook dispatch with an installed Codex CLI: + +```sh +npm run plugin:pack:codex +AGENTMEMORY_TEST_CODEX=/absolute/path/to/codex node scripts/plugins/test-codex-native.mjs +``` + +The test uses a temporary home and a synthetic local Responses API to make Codex +read one generated file. It checks MCP startup, session context reaching the model, +prompt/tool capture, and session completion. It trusts only the built test plugin +for that invocation through Codex's automation flag. No account credentials or +paid model calls are used. Verified with Codex CLI 0.150.1; desktop trust UI and +PreCompact dispatch are separate checks. + +The current `connect codex --with-hooks` path skips hook installation if MCP is +already wired. The native plugin path above works. For global hooks, inspect your +agentmemory MCP settings before using `--force`, which rewrites that MCP entry. + After publishing the selected runtime and shim versions, run: ```sh diff --git a/docs/plugins/copilot.md b/docs/plugins/copilot.md new file mode 100644 index 0000000000..db0a4593a4 --- /dev/null +++ b/docs/plugins/copilot.md @@ -0,0 +1,110 @@ +# GitHub Copilot setup and capture + +MCP exposes memory tools. Automatic observation capture requires hooks as well. A working tool list alone does not prove that Copilot activity is being saved. + +## Start the persistent service + +Install Agent Memory and run its setup in a separate terminal: + +```sh +npm install -g @agentmemory/agentmemory@latest +agentmemory +``` + +Then check `agentmemory status`. The API normally listens on port 3111; the viewer uses port 3113. A missing LLM provider disables optional compression and summarization. Capture, explicit saves, and keyword recall still work without a provider key. A Copilot subscription does not configure an Agent Memory LLM provider. + +For this unreleased branch, run `npm run build` and use `node dist/cli.mjs` instead of the published CLI. Do not assume npm's latest version includes release-branch fixes. + +## Copilot CLI + +Choose either the full plugin or MCP-only wiring: + +```sh +# Full plugin: MCP, skills, and lifecycle capture +copilot plugin install rohitg00/agentmemory:plugin + +# Alternatively, tools and usage instructions without automatic capture +agentmemory connect copilot-cli +``` + +For a checkout of this branch, use `copilot plugin install /absolute/path/to/agentmemory/plugin`. Restart Copilot after installation or `copilot plugin update agentmemory`. Direct installs work in Copilot CLI 1.0.92 but that client warns that future versions will require marketplace installs. + +The full plugin runs the bundled Node.js MCP bridge. Copilot loads the shared `.mcp.json` ahead of the manifest's `.mcp.copilot.json` reference, so both configurations must use that bridge. It forwards to the same persistent daemon as the hooks, reads locally generated credentials, and reports connection failures without switching to an in-memory store. It requires Node.js on Copilot's PATH and a running Agent Memory daemon. + +The bridge and hooks inherit `AGENTMEMORY_URL` and `AGENTMEMORY_SECRET` from the host environment. Local credentials are also read from `~/.agentmemory/.env` or `~/.agentmemory/secret`. For remote servers, set the URL and secret explicitly; use HTTPS for authenticated remote MCP connections. Tool visibility is controlled by the daemon's `AGENTMEMORY_TOOLS` setting. + +Capture runs by default. To also inject recalled context at session start, launch Copilot with `AGENTMEMORY_INJECT_CONTEXT=true` in its environment. Copilot CLI consumes JSON `additionalContext`; VS Code uses `hookSpecificOutput.additionalContext`. + +## VS Code Copilot: local agent sessions + +`agentmemory connect copilot-cli` configures the standalone CLI, not VS Code. VS Code currently requires manual MCP and hook configuration. These instructions target local agent sessions; remote Agent Host sessions have their own hook environment. + +Find the global package directory with `npm root -g`. In the examples below, replace `/ABSOLUTE/PACKAGE` with that directory followed by `/@agentmemory/agentmemory`. For a source checkout, use the checkout directory after building it. On Windows, use forward slashes in JSON paths or escape backslashes. + +Merge this entry into `.vscode/mcp.json`, preserving your existing servers. VS Code uses `servers` as the top-level key: + +```json +{ + "servers": { + "agentmemory": { + "type": "stdio", + "command": "node", + "args": ["/ABSOLUTE/PACKAGE/plugin/scripts/plugin-bridge.mjs"] + } + } +} +``` + +The bundled bridge is present in the 0.9.30 release branch. Before that release is published, use a built checkout for this setup. + +For automatic capture, create `.github/hooks/agentmemory.json` in the workspace: + +```json +{ + "hooks": { + "SessionStart": [ + { + "type": "command", + "command": "node \"/ABSOLUTE/PACKAGE/plugin/scripts/session-start.mjs\"" + } + ], + "UserPromptSubmit": [ + { + "type": "command", + "command": "node \"/ABSOLUTE/PACKAGE/plugin/scripts/prompt-submit.mjs\"" + } + ], + "PostToolUse": [ + { + "type": "command", + "command": "node \"/ABSOLUTE/PACKAGE/plugin/scripts/post-tool-use.mjs\"" + } + ], + "Stop": [ + { + "type": "command", + "command": "node \"/ABSOLUTE/PACKAGE/plugin/scripts/stop.mjs\"" + } + ] + } +} +``` + +Enable `chat.useHooks` and trust the workspace, then start a new local agent session. This captures prompts and completed tool calls as they happen; it does not require deleting a chat or closing VS Code. `Stop` requests session summarization after an agent turn. To inject recalled context, add `"env": { "AGENTMEMORY_INJECT_CONTEXT": "true" }` to the SessionStart entry. + +Keep machine-specific absolute paths local, or adjust them for each machine. The hooks must run where the package, daemon, and memory data directory are accessible. If the daemon uses a custom `AGENTMEMORY_DATA_DIR`, pass the same directory to the hooks so offline capture is recovered on restart. + +## Verify data, not just connectivity + +1. Ask Copilot to save a unique synthetic fact with `memory_save`, then recall it with `memory_smart_search` in a new session. +2. Ask Copilot to read a small project file. Check `memory_sessions` for that session and a nonzero observation count. MCP-only setups need explicit saves; they do not automatically capture reads. +3. Run `agentmemory capture --json` to inspect offline spool records and failed capture delivery. `agentmemory capture --drain` requests recovery once the service is running. +4. If an older MCP log says `falling back to local InMemoryKV`, check the running daemon and update the MCP configuration. That fallback does not provide durable cross-session memory. + +References: [Copilot plugin configuration](https://docs.github.com/en/copilot/reference/copilot-cli-reference/cli-plugin-reference), [Copilot hook payloads](https://docs.github.com/en/copilot/reference/hooks-reference), [VS Code local hooks](https://code.visualstudio.com/docs/agents/reference/hooks-reference), [VS Code hook configuration](https://code.visualstudio.com/docs/agent-customization/hooks). + +## Maintainer checks + +After building, `node scripts/plugins/test-copilot-native.mjs` runs the actual Copilot plugin installer and runtime against a local synthetic model and capture server. Set `AGENTMEMORY_TEST_COPILOT` to the client executable and `AGENTMEMORY_TEST_COPILOT_SDK` to that client's bundled `copilot-sdk/index.js`. It uses a temporary home and project, verifies the loaded MCP command and skills, then checks prompt/tool capture and context delivery. It does not require a Copilot account or send project data to a model provider. + +To separately verify persistent storage and recovery with the pinned iii engine, build the Codex package with `node scripts/plugins/package-codex.mjs`, then set `AGENTMEMORY_TEST_III` to the engine executable and run `node node_modules/vitest/vitest.mjs run test/codex-live-daemon.test.ts`. That suite exercises both Codex and Copilot configurations. diff --git a/integrations/hermes/plugin.yaml b/integrations/hermes/plugin.yaml index 4d647c8a81..25b3dc951e 100644 --- a/integrations/hermes/plugin.yaml +++ b/integrations/hermes/plugin.yaml @@ -1,5 +1,5 @@ name: agentmemory -version: 0.9.29 +version: 0.9.30 description: "Persistent cross-session memory for Hermes Agent via agentmemory. 95.2% retrieval accuracy on LongMemEval." author: "Rohit Ghumare" homepage: "https://github.com/rohitg00/agentmemory" diff --git a/integrations/openclaw/README.md b/integrations/openclaw/README.md index 29c3a682eb..9f6891723e 100644 --- a/integrations/openclaw/README.md +++ b/integrations/openclaw/README.md @@ -13,7 +13,7 @@

- 43 MCP tools + 54 MCP tools OpenClaw memory plugin 95.2% R@5 Self-hosted @@ -29,7 +29,7 @@ ```text Install agentmemory for OpenClaw. Run `npx @agentmemory/agentmemory` in a separate terminal to start the memory server on localhost:3111. -For zero-code setup, add this MCP server so OpenClaw gets all 43 memory tools: +For zero-code setup, add this MCP server so OpenClaw gets all 54 memory tools: { "mcpServers": { @@ -88,7 +88,7 @@ Then add to your OpenClaw MCP config: } ``` -OpenClaw now has access to all 43 MCP tools including `memory_recall`, `memory_save`, `memory_smart_search`, `memory_timeline`, `memory_profile`, and more. +OpenClaw now has access to all 54 MCP tools including `memory_recall`, `memory_save`, `memory_smart_search`, `memory_timeline`, `memory_profile`, and more. ## Option 2: OpenClaw memory plugin (deeper integration) diff --git a/integrations/openclaw/openclaw.plugin.json b/integrations/openclaw/openclaw.plugin.json index aa990ccdf5..e6b67e090f 100644 --- a/integrations/openclaw/openclaw.plugin.json +++ b/integrations/openclaw/openclaw.plugin.json @@ -3,7 +3,7 @@ "kind": "memory", "name": "agentmemory", "description": "Persistent cross-session memory for OpenClaw via agentmemory.", - "version": "0.9.29", + "version": "0.9.30", "configSchema": { "type": "object", "additionalProperties": false, diff --git a/integrations/openclaw/package.json b/integrations/openclaw/package.json index 75232379c7..d22e1c4dd8 100644 --- a/integrations/openclaw/package.json +++ b/integrations/openclaw/package.json @@ -1,6 +1,6 @@ { "name": "agentmemory", - "version": "0.9.29", + "version": "0.9.30", "type": "module", "openclaw": { "extensions": [ diff --git a/package.json b/package.json index c0544dca7b..0441e623f7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@agentmemory/agentmemory", - "version": "0.9.29", + "version": "0.9.30", "description": "Persistent memory for AI coding agents, powered by iii-engine's three primitives", "type": "module", "main": "dist/index.mjs", @@ -29,6 +29,8 @@ "skills:gen": "tsx scripts/skills/generate.ts", "engine:hashes": "node scripts/engine-hashes.mjs", "skills:check": "tsx scripts/skills/generate.ts --check && tsx scripts/skills/check.ts", + "docs:sync": "tsx scripts/docs-sync.ts", + "docs:check": "tsx scripts/docs-sync.ts --check", "plugin:pack:codex": "npm run build && node scripts/plugins/package-codex.mjs", "plugin:verify:published": "node scripts/plugins/verify-published.mjs", "test:plugin:live": "node scripts/plugins/test-live.mjs", diff --git a/packages/mcp/package.json b/packages/mcp/package.json index c88f9c89e5..0d90a18b81 100644 --- a/packages/mcp/package.json +++ b/packages/mcp/package.json @@ -1,6 +1,6 @@ { "name": "@agentmemory/mcp", - "version": "0.9.29", + "version": "0.9.30", "description": "Standalone MCP server for agentmemory — thin shim that re-exposes @agentmemory/agentmemory's MCP entrypoint", "type": "module", "bin": { @@ -28,7 +28,7 @@ "homepage": "https://github.com/rohitg00/agentmemory#readme", "bugs": "https://github.com/rohitg00/agentmemory/issues", "dependencies": { - "@agentmemory/agentmemory": "~0.9.0" + "@agentmemory/agentmemory": "~0.9.30" }, "publishConfig": { "access": "public", diff --git a/plugin/.claude-plugin/plugin.json b/plugin/.claude-plugin/plugin.json index ab798622e2..44e0dac552 100644 --- a/plugin/.claude-plugin/plugin.json +++ b/plugin/.claude-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "agentmemory", - "version": "0.9.29", + "version": "0.9.30", "description": "Persistent memory for AI coding agents -- captures tool usage, compresses via LLM, injects context into future sessions. 12 hooks, 54 MCP tools, 17 skills, real-time viewer.", "author": { "name": "Rohit Ghumare", diff --git a/plugin/.codex-plugin/plugin.json b/plugin/.codex-plugin/plugin.json index a58536ed87..b79927a6cc 100644 --- a/plugin/.codex-plugin/plugin.json +++ b/plugin/.codex-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "agentmemory", - "version": "0.9.29", + "version": "0.9.30", "description": "Local persistent memory for coding agents. Recall decisions, resume sessions, learn from corrections, and manage memory through 54 MCP tools and 17 skills. Optional capture through 6 Codex hooks.", "author": { "name": "Rohit Ghumare", diff --git a/plugin/.devin-plugin/plugin.json b/plugin/.devin-plugin/plugin.json index ce59219744..f4e00e4885 100644 --- a/plugin/.devin-plugin/plugin.json +++ b/plugin/.devin-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "agentmemory", - "version": "0.9.29", + "version": "0.9.30", "description": "Persistent memory for AI coding agents. Captures sessions, recalls with hybrid BM25 + vector + graph search, and exposes 54 memory tools over MCP. Keyless by default, runs on your machine.", "author": { "name": "Rohit Ghumare", diff --git a/plugin/.mcp.copilot.json b/plugin/.mcp.copilot.json index 827330add9..347d953761 100644 --- a/plugin/.mcp.copilot.json +++ b/plugin/.mcp.copilot.json @@ -2,13 +2,8 @@ "mcpServers": { "agentmemory": { "type": "local", - "command": "npx", - "args": ["-y", "@agentmemory/mcp"], - "env": { - "AGENTMEMORY_URL": "${AGENTMEMORY_URL:-http://localhost:3111}", - "AGENTMEMORY_SECRET": "${AGENTMEMORY_SECRET:-}", - "AGENTMEMORY_TOOLS": "${AGENTMEMORY_TOOLS:-all}" - }, + "command": "node", + "args": ["${COPILOT_PLUGIN_ROOT}/scripts/plugin-bridge.mjs"], "tools": ["*"] } } diff --git a/plugin/.mcp.json b/plugin/.mcp.json index 37f7754fff..bae045eb12 100644 --- a/plugin/.mcp.json +++ b/plugin/.mcp.json @@ -1,13 +1,8 @@ { "mcpServers": { "agentmemory": { - "command": "npx", - "args": ["-y", "@agentmemory/mcp"], - "env": { - "AGENTMEMORY_URL": "${AGENTMEMORY_URL:-http://localhost:3111}", - "AGENTMEMORY_SECRET": "${AGENTMEMORY_SECRET:-}", - "AGENTMEMORY_TOOLS": "${AGENTMEMORY_TOOLS:-all}" - } + "command": "node", + "args": ["${CLAUDE_PLUGIN_ROOT}/scripts/plugin-bridge.mjs"] } } } diff --git a/plugin/hooks/hooks.copilot.json b/plugin/hooks/hooks.copilot.json index b7d09f8bcf..8501fa0851 100644 --- a/plugin/hooks/hooks.copilot.json +++ b/plugin/hooks/hooks.copilot.json @@ -4,68 +4,68 @@ "sessionStart": [ { "type": "command", - "command": "node ${COPILOT_PLUGIN_ROOT}/scripts/session-start.mjs" + "command": "node \"${COPILOT_PLUGIN_ROOT}/scripts/session-start.mjs\"" } ], "userPromptSubmitted": [ { "type": "command", - "command": "node ${COPILOT_PLUGIN_ROOT}/scripts/prompt-submit.mjs" + "command": "node \"${COPILOT_PLUGIN_ROOT}/scripts/prompt-submit.mjs\"" } ], "preToolUse": [ { "type": "command", "matcher": "edit|write|create|read|view|glob|grep", - "command": "node ${COPILOT_PLUGIN_ROOT}/scripts/pre-tool-use.mjs" + "command": "node \"${COPILOT_PLUGIN_ROOT}/scripts/pre-tool-use.mjs\"" } ], "postToolUse": [ { "type": "command", - "command": "node ${COPILOT_PLUGIN_ROOT}/scripts/post-tool-use.mjs" + "command": "node \"${COPILOT_PLUGIN_ROOT}/scripts/post-tool-use.mjs\"" } ], "postToolUseFailure": [ { "type": "command", - "command": "node ${COPILOT_PLUGIN_ROOT}/scripts/post-tool-failure.mjs" + "command": "node \"${COPILOT_PLUGIN_ROOT}/scripts/post-tool-failure.mjs\"" } ], "preCompact": [ { "type": "command", - "command": "node ${COPILOT_PLUGIN_ROOT}/scripts/pre-compact.mjs" + "command": "node \"${COPILOT_PLUGIN_ROOT}/scripts/pre-compact.mjs\"" } ], "agentStop": [ { "type": "command", - "command": "node ${COPILOT_PLUGIN_ROOT}/scripts/stop.mjs" + "command": "node \"${COPILOT_PLUGIN_ROOT}/scripts/stop.mjs\"" } ], "sessionEnd": [ { "type": "command", - "command": "node ${COPILOT_PLUGIN_ROOT}/scripts/session-end.mjs" + "command": "node \"${COPILOT_PLUGIN_ROOT}/scripts/session-end.mjs\"" } ], "subagentStart": [ { "type": "command", - "command": "node ${COPILOT_PLUGIN_ROOT}/scripts/subagent-start.mjs" + "command": "node \"${COPILOT_PLUGIN_ROOT}/scripts/subagent-start.mjs\"" } ], "subagentStop": [ { "type": "command", - "command": "node ${COPILOT_PLUGIN_ROOT}/scripts/subagent-stop.mjs" + "command": "node \"${COPILOT_PLUGIN_ROOT}/scripts/subagent-stop.mjs\"" } ], "notification": [ { "type": "command", - "command": "node ${COPILOT_PLUGIN_ROOT}/scripts/notification.mjs" + "command": "node \"${COPILOT_PLUGIN_ROOT}/scripts/notification.mjs\"" } ] } diff --git a/plugin/opencode/plugin.json b/plugin/opencode/plugin.json index cf06cee5a2..02a334f7a5 100644 --- a/plugin/opencode/plugin.json +++ b/plugin/opencode/plugin.json @@ -1,6 +1,6 @@ { "name": "agentmemory-capture", - "version": "0.9.29", + "version": "0.9.30", "description": "OpenCode plugin for agentmemory — full Claude Code hook parity: session lifecycle (create/idle/status/compacted/update/diff/delete/error), messages & prompts (chat.message, message.updated user+assistant, message.removed), tool lifecycle (ToolPart states with timing), part tracking (subtask, step-finish, reasoning, file, patch, compaction, agent, retry), file enrichment pipeline, permissions, task tracking (w/ priority), commands, config & model tracking. 22 hooks, 2 slash commands.", "author": { "name": "Rohit Ghumare", diff --git a/plugin/plugin.json b/plugin/plugin.json index 09ab9ba204..2577bd9e03 100644 --- a/plugin/plugin.json +++ b/plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "agentmemory", - "version": "0.9.29", + "version": "0.9.30", "description": "Persistent memory for AI coding agents -- captures tool usage, compresses via LLM, injects context into future sessions. 12 hooks, 54 MCP tools, 17 skills, real-time viewer.", "author": { "name": "Rohit Ghumare", diff --git a/plugin/scripts/antigravity-bridge.mjs b/plugin/scripts/antigravity-bridge.mjs index 12d72ba90a..0722274a4d 100755 --- a/plugin/scripts/antigravity-bridge.mjs +++ b/plugin/scripts/antigravity-bridge.mjs @@ -1,6 +1,7 @@ #!/usr/bin/env node import { spawnSync } from "node:child_process"; -import { dirname, join, resolve } from "node:path"; +import { realpathSync } from "node:fs"; +import { dirname, join } from "node:path"; import { fileURLToPath } from "node:url"; //#region src/hooks/antigravity-bridge.ts const SCRIPTS_DIR = dirname(fileURLToPath(import.meta.url)); @@ -62,7 +63,8 @@ function normalizePayload(event, raw) { out["native_tool_name"] = rawName; } out["tool_input"] = args; - const result = toolCall["result"] ?? raw["toolResult"] ?? raw["result"]; + if (out["tool_use_id"] === void 0 && Number.isInteger(raw["stepIdx"]) && raw["stepIdx"] >= 0) out["tool_use_id"] = `step:${raw["stepIdx"]}`; + const result = toolCall["result"] ?? raw["toolResult"] ?? raw["result"] ?? firstString(raw["error"]); if (result !== void 0) out["tool_result"] = result; } return out; @@ -71,15 +73,16 @@ function targetsFor(event, raw) { switch (event) { case "PreInvocation": { const n = raw["invocationNum"]; - return typeof n !== "number" || n <= 1 ? ["session-start.mjs", "prompt-submit.mjs"] : ["prompt-submit.mjs"]; + return typeof n !== "number" || n === 0 ? ["session-start.mjs"] : []; } case "PreToolUse": return ["pre-tool-use.mjs"]; case "PostToolUse": return ["post-tool-use.mjs"]; - case "Stop": return ["stop.mjs", "session-end.mjs"]; + case "Stop": return raw["fullyIdle"] === false ? [] : ["session-end.mjs"]; default: return []; } } -function responseFor(event) { +function responseFor(event, context = "") { + if (event === "PreInvocation" && context) return JSON.stringify({ injectSteps: [{ ephemeralMessage: context }] }); return event === "PreToolUse" ? "{\"decision\":\"allow\"}" : "{}"; } async function main() { @@ -95,17 +98,23 @@ async function main() { } if (!raw || typeof raw !== "object") return; const payload = JSON.stringify(normalizePayload(event, raw)); - for (const script of targetsFor(event, raw)) spawnSync(process.execPath, [join(SCRIPTS_DIR, script)], { - input: payload, - stdio: [ - "pipe", - "ignore", - "ignore" - ] - }); + let context = ""; + for (const script of targetsFor(event, raw)) { + const child = spawnSync(process.execPath, [join(SCRIPTS_DIR, script)], { + input: payload, + encoding: "utf8", + stdio: [ + "pipe", + "pipe", + "ignore" + ] + }); + if (event === "PreInvocation" && script === "session-start.mjs" && child.status === 0) context = child.stdout?.trim() ?? ""; + } + return context; } -if (process.argv[1] !== void 0 && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) main().catch(() => {}).finally(() => { - process.stdout.write(responseFor(process.argv[2] ?? "")); +if (process.argv[1] !== void 0 && realpathSync(process.argv[1]) === fileURLToPath(import.meta.url)) main().catch(() => void 0).then((context) => { + process.stdout.write(responseFor(process.argv[2] ?? "", context)); process.exit(0); }); //#endregion diff --git a/plugin/scripts/plugin-bridge.mjs b/plugin/scripts/plugin-bridge.mjs index bdaf256bde..4f00ed58f7 100644 --- a/plugin/scripts/plugin-bridge.mjs +++ b/plugin/scripts/plugin-bridge.mjs @@ -1,9 +1,9 @@ import { pathToFileURL } from "node:url"; -import { readFileSync } from "node:fs"; +import { readFileSync, realpathSync } from "node:fs"; import { homedir } from "node:os"; import { join } from "node:path"; //#region src/version.ts -const VERSION = "0.9.29"; +const VERSION = "0.9.30"; //#endregion //#region src/secret-store.ts const SECRET_KEY = "AGENTMEMORY_SECRET"; @@ -368,7 +368,7 @@ function createPluginBridge() { } }; } -if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) try { +if (process.argv[1] && import.meta.url === pathToFileURL(realpathSync(process.argv[1])).href) try { createStdioTransport(createPluginBridge()).start(); } catch { process.stderr.write("[agentmemory] Invalid MCP configuration. Check AGENTMEMORY_URL; authenticated non-loopback URLs require HTTPS.\n"); diff --git a/plugin/scripts/session-end.mjs b/plugin/scripts/session-end.mjs index c98f569c94..9e98b27586 100755 --- a/plugin/scripts/session-end.mjs +++ b/plugin/scripts/session-end.mjs @@ -57,6 +57,13 @@ function extractTranscriptPrompts(data) { } catch { continue; } + if (msg.type === "USER_INPUT" && msg.source === "USER_EXPLICIT" && typeof msg.content === "string") { + if (prompts.length >= 50) return prompts; + const match = msg.content.match(/\n?([\s\S]*?)\n?<\/USER_REQUEST>/); + const text = (match ? match[1] : msg.content).trim(); + if (text) prompts.push(text.slice(0, 8e3)); + continue; + } if (msg.role !== "user") continue; for (const block of msg.message?.content ?? []) { if (prompts.length >= 50) return prompts; diff --git a/plugin/scripts/session-start.mjs b/plugin/scripts/session-start.mjs index 4a68ef54e2..e2c83b0234 100755 --- a/plugin/scripts/session-start.mjs +++ b/plugin/scripts/session-start.mjs @@ -124,6 +124,7 @@ function wantsStructuredOutput(data) { return data.hook_event_name === "SessionStart" && !isPlainTextHost(); } function contextPayload(data, context) { + if (process.env["COPILOT_PLUGIN_ROOT"] && !data.hook_event_name) return JSON.stringify({ additionalContext: context }); if (typeof data.cursor_version === "string" || data.hook_event_name === "sessionStart") return JSON.stringify({ additional_context: context }); if (wantsStructuredOutput(data)) return JSON.stringify({ hookSpecificOutput: { hookEventName: "SessionStart", diff --git a/plugin/skills/agentmemory-agents/REFERENCE.md b/plugin/skills/agentmemory-agents/REFERENCE.md index 57702319df..989d258fde 100644 --- a/plugin/skills/agentmemory-agents/REFERENCE.md +++ b/plugin/skills/agentmemory-agents/REFERENCE.md @@ -7,8 +7,8 @@ Generated from `src/cli/connect/index.ts`. Do not edit the block below by hand; | Agent | Name | Protocol | | --- | --- | --- | -| Antigravity | `antigravity` | Using MCP via mcp_config.json. Antigravity replaces Gemini CLI (sunset 2026-06-18). | -| Antigravity CLI (agy) | `antigravity-cli` | Using MCP via ~/.gemini/config/mcp_config.json (the agy CLI, not the Antigravity IDE, that one is `connect antigravity`). The `/mcp` slash command inside agy lists configured servers. Pass --with-hooks to also install the native ~/.gemini/config/hooks.json auto-capture hooks. | +| Antigravity | `antigravity` | Using MCP via ~/.gemini/config/mcp_config.json, shared by current Antigravity surfaces. Pass --with-hooks for capture through ~/.gemini/config/hooks.json. | +| Antigravity CLI (agy) | `antigravity-cli` | Using MCP via ~/.gemini/config/mcp_config.json, shared with current Antigravity IDE versions. The `/mcp` slash command inside agy lists configured servers. Pass --with-hooks to also install the native ~/.gemini/config/hooks.json auto-capture hooks. | | Claude Code | `claude-code` | Using MCP. Hooks are also available, see https://github.com/rohitg00/agentmemory#claude-code-one-block-paste-it. | | Cline | `cline` | Using MCP via ~/.cline/mcp.json (CLI). VS Code users: add the same block via Cline Settings → MCP Servers → Edit JSON. | | Codex CLI | `codex` | Using MCP. Hooks ship via the Codex plugin; on Codex Desktop, also pass --with-hooks to install the global hooks.json workaround. | diff --git a/scripts/docs-sync.state.json b/scripts/docs-sync.state.json new file mode 100644 index 0000000000..4fab8b8840 --- /dev/null +++ b/scripts/docs-sync.state.json @@ -0,0 +1,38 @@ +{ + "version": "0.9.30", + "facts": { + "mcpTools": [ + "54" + ], + "coreTools": [ + "8" + ], + "fallbackTools": [ + "7" + ], + "restEndpoints": [ + "138" + ], + "skills": [ + "17" + ], + "hooks": [ + "12" + ], + "tests": [ + "2500+" + ], + "functions": [ + "311" + ], + "sourceFiles": [ + "219" + ], + "loc": [ + "52000" + ], + "kvScopes": [ + "60" + ] + } +} diff --git a/scripts/docs-sync.ts b/scripts/docs-sync.ts new file mode 100644 index 0000000000..8b1284a68b --- /dev/null +++ b/scripts/docs-sync.ts @@ -0,0 +1,331 @@ +import { execFileSync } from "node:child_process"; +import { existsSync, readFileSync, writeFileSync } from "node:fs"; +import { dirname, join } from "node:path"; +import { fileURLToPath } from "node:url"; +import { ESSENTIAL_TOOLS, getAllTools } from "../src/mcp/tools-registry.js"; + +const ROOT = join(dirname(fileURLToPath(import.meta.url)), ".."); +const STATE_PATH = "scripts/docs-sync.state.json"; +const CHECK = process.argv.includes("--check"); +const REPO_URL = "https://github.com/rohitg00/agentmemory"; + +type State = { version: string; facts: Record }; + +interface Fact { + key: string; + label: string; + value: () => string | null; + nouns: string[]; + before?: string; + badge?: string; +} + +function read(path: string): string { + return readFileSync(join(ROOT, path), "utf-8"); +} + +function trackedFiles(): string[] { + return execFileSync("git", ["ls-files", "--cached", "--others", "--exclude-standard"], { cwd: ROOT, encoding: "utf-8" }) + .split("\n") + .filter((f) => f && existsSync(join(ROOT, f))); +} + +function countMatches(path: string, pattern: RegExp): number { + return read(path).match(pattern)?.length ?? 0; +} + +function floorTo(n: number, step: number): number { + return Math.floor(n / step) * step; +} + +function countHookTypes(): number { + const union = read("src/types.ts").match(/export type HookType\s*=([\s\S]*?);/); + return union ? union[1].split("|").filter((s) => /^\s*["'`]/.test(s)).length : 0; +} + +function countKvScopes(): number { + const src = read("src/state/schema.ts"); + const body = src.slice(src.indexOf("export const KV = {")); + return (body.slice(0, body.indexOf("\n};")).match(/^ {2}\w+:/gm) ?? []).length; +} + +function countFallbackTools(): number { + const src = read("src/mcp/standalone.ts"); + const body = src.slice(src.indexOf("const IMPLEMENTED_TOOLS = new Set([")); + return (body.slice(0, body.indexOf("]);")).match(/"memory_\w+"/g) ?? []).length; +} + +function sourceFiles(): string[] { + return trackedFiles().filter((f) => f.startsWith("src/") && f.endsWith(".ts")); +} + +function countTests(): number | null { + try { + const out = execFileSync( + process.execPath, + [join(ROOT, "node_modules/vitest/vitest.mjs"), "list", "--json", "--exclude", "test/integration.test.ts"], + { cwd: ROOT, encoding: "utf-8", maxBuffer: 64 * 1024 * 1024, stdio: ["ignore", "pipe", "ignore"] }, + ); + return (JSON.parse(out) as unknown[]).length; + } catch { + return null; + } +} + +const TOOL_NOUNS = [ + "MCP tools", "MCP-Tools", "memory tools", "tools", "tool", "outils", "herramientas", "ferramentas", + "Werkzeuge", "инструмент", "ツール", "个工具", "個工具", "工具", "개의 도구", "개 도구", "araç", "टूल", +]; + +const FACTS: Fact[] = [ + { + key: "mcpTools", + label: "MCP tools", + value: () => String(getAllTools().length), + nouns: [...TOOL_NOUNS, "个", "個", "개", "'ü"], + badge: "stat-tools.svg", + }, + { + key: "coreTools", + label: "core tools", + value: () => String(ESSENTIAL_TOOLS.size), + nouns: ["core tools", "visible by default", "个必备工具", ...TOOL_NOUNS], + before: "(?:\"core\" \\(|core\\) \\(|AGENTMEMORY_TOOLS=core`[^\\n]{0,40}?|lean |The |\\()", + }, + { + key: "fallbackTools", + label: "local fallback tools", + value: () => String(countFallbackTools()), + nouns: [...TOOL_NOUNS, "个工具", "-Tool"], + }, + { + key: "restEndpoints", + label: "REST endpoints", + value: () => String(countMatches("src/triggers/api.ts", /api_path:\s*["`]/g)), + nouns: [ + "REST endpoints", "REST API endpoints", "endpoints", "endpoint", "Endpunkte", "эндпоинт", + "个端点", "個端點", "개 엔드포인트", "개의 엔드포인트", "エンドポイント", "uç nokta", "एंडपॉइंट", + ], + }, + { + key: "skills", + label: "skills", + value: () => String(trackedFiles().filter((f) => /^plugin\/skills\/[^/_][^/]*\/SKILL\.md$/.test(f)).length), + nouns: ["native skills", "skills", "skill", "SKILL", "個の skills", "個 skills", "個 Skills", "개의 skills", "개 skills", "навык"], + }, + { + key: "hooks", + label: "hooks", + value: () => String(countHookTypes()), + nouns: [ + "auto hooks", "hooks", "hook", "-hook", "scripts de hooks", "Hook-Skripte", "хук", "скриптов хуков", + "フック", "훅", + ], + badge: "stat-hooks.svg", + }, + { + key: "tests", + label: "tests", + value: () => { + const n = countTests(); + return n === null ? null : `${floorTo(n, 100)}+`; + }, + nouns: ["tests passing", "tests", "Tests", "test", "个测试", "個測試", "testes", "pruebas", "тест", "テスト", "测试", "測試", "테스트"], + badge: "stat-tests.svg", + }, + { + key: "functions", + label: "iii functions", + value: () => String(sourceFiles().reduce((n, f) => n + (read(f).match(/registerFunction\(/g)?.length ?? 0), 0)), + nouns: ["iii functions", "functions", "funciones", "funções", "fonctions", "Funktionen", "функци", "個函式", "个函数", "개 함수", "개의 함수", "fonksiyon"], + }, + { + key: "sourceFiles", + label: "source files", + value: () => String(sourceFiles().length), + nouns: ["source files", "fichiers sources", "ficheros de código", "arquivos de código", "archivos fuente", "arquivos-fonte", "arquivos fonte", "fichiers source", "Quelldateien", "исходных файл", "個原始檔", "个源文件", "개 소스 파일", "개의 소스 파일", "ソースファイル", "kaynak dosya"], + }, + { + key: "loc", + label: "lines of code", + value: () => String(floorTo(sourceFiles().reduce((n, f) => n + read(f).split("\n").length, 0), 1000)), + nouns: ["LOC", "行程式碼", "行代码", "行のコード"], + before: "~", + }, + { + key: "kvScopes", + label: "KV scopes", + value: () => String(countKvScopes()), + nouns: ["KV scopes", "KV-Scopes", "KV scope", "KV-scope", "scopes KV", "scopes de KV", "escopos KV", "областей KV", "個 KV", "个 KV", "개 KV", "KV スコープ", "KV kapsam"], + }, +]; + +const EXCLUDED = [ + /^CHANGELOG\.md$/, + /^test\//, + /^benchmark\//, + /^docs\/benchmarks\//, + /^eval\//, + /^website\/lib\/generated-meta\.json$/, + /(^|\/)package-lock\.json$/, + /^scripts\/docs-sync/, +]; +const TEXT_FILE = /\.(md|mdx|json|ts|tsx|mjs|yml|yaml|html)$/; + +function escapeRegex(s: string): string { + return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); +} + +function numberPattern(display: string): string { + const digits = display.replace(/\D/g, ""); + const groups: string[] = []; + for (let end = digits.length; end > 0; end -= 3) groups.unshift(digits.slice(Math.max(0, end - 3), end)); + return groups.join("[,.\\u00a0\\u202f ]?"); +} + +function formatLike(matched: string, next: string): string { + const separator = matched.match(/\d([,.   ])\d{3}(?!\d)/)?.[1]; + const digits = next.replace(/\D/g, ""); + if (!separator || digits.length < 4) return digits; + return digits.replace(/\B(?=(\d{3})+(?!\d))/g, separator); +} + +function factRegex(fact: Fact, old: string): RegExp { + const nouns = [...fact.nouns].sort((a, b) => b.length - a.length).map(escapeRegex).join("|"); + const before = fact.before ? `(?<=${fact.before})` : ""; + return new RegExp( + `${before}(? { + const formatted = formatLike(num, next); + return next.endsWith("+") ? `${formatted}+` : `${formatted}${plus}`; + }); + if (fact.badge) { + out = out.replace(new RegExp(`>${escapeRegex(old)}\\+?<`, "g"), `>${next}<`); + out = out.replace(new RegExp(`(aria-label="[^"]*?)${escapeRegex(old)}\\+?(")`, "g"), `$1${next}$2`); + } + } + return out; +} + +const VERSION_FILES: Array<{ file: RegExp; pattern: (v: string) => RegExp; replace: (v: string) => string }> = [ + { file: /(^|\/)(package|plugin|openclaw\.plugin)\.json$/, pattern: (v) => new RegExp(`("version":\\s*")${escapeRegex(v)}(")`), replace: (v) => `$1${v}$2` }, + { file: /^integrations\/hermes\/plugin\.yaml$/, pattern: (v) => new RegExp(`^(version:\\s*)${escapeRegex(v)}$`, "m"), replace: (v) => `$1${v}` }, + { file: /^deploy\/.*(Dockerfile|\.ya?ml)$/, pattern: (v) => new RegExp(`(AGENTMEMORY_VERSION[=:]\\s*"?|value:\\s*")${escapeRegex(v)}\\b`, "g"), replace: (v) => `$1${v}` }, + { file: /^src\/version\.ts$/, pattern: (v) => new RegExp(`(VERSION = ")${escapeRegex(v)}(")`), replace: (v) => `$1${v}$2` }, + { file: /^AGENTS\.md$/, pattern: (v) => new RegExp(`(## Current Stats \\(v)${escapeRegex(v)}(\\))`), replace: (v) => `$1${v}$2` }, + { file: /^packages\/mcp\/package\.json$/, pattern: (v) => new RegExp(`("@agentmemory/agentmemory":\\s*"~?)${escapeRegex(v)}(")`), replace: (v) => `$1${v}$2` }, +]; + +function syncVersion(files: Map, from: string, to: string): void { + for (const [path, text] of files) { + let next = text; + for (const rule of VERSION_FILES.filter((r) => r.file.test(path))) next = next.replace(rule.pattern(from), rule.replace(to)); + if (next !== text) files.set(path, next); + } + const types = files.get("src/types.ts"); + if (types && !types.includes(`"${to}"`)) { + files.set("src/types.ts", types.replace(new RegExp(`(version: [^\\n]*"${escapeRegex(from)}")`), `$1 | "${to}"`)); + } + const exportImport = files.get("src/functions/export-import.ts"); + if (exportImport && !exportImport.includes(`"${to}"`)) { + files.set( + "src/functions/export-import.ts", + exportImport.replace(new RegExp(`(supportedVersions = new Set\\(\\[[^\\]]*"${escapeRegex(from)}")`), `$1, "${to}"`), + ); + } + const changelog = files.get("CHANGELOG.md"); + if (changelog && !changelog.includes(`## [${to}]`)) { + const date = new Date().toISOString().slice(0, 10); + let next = changelog.replace(/^## \[Unreleased\]\s*$/m, `## [Unreleased]\n\n## [${to}] — ${date}`); + next = next.replace(/^(\[[0-9][^\]]*\]: )/m, `[${to}]: ${REPO_URL}/compare/v${from}...v${to}\n$1`); + files.set("CHANGELOG.md", next); + } +} + +function main(): void { + const state = JSON.parse(read(STATE_PATH)) as State; + const paths = trackedFiles().filter((f) => (TEXT_FILE.test(f) || /Dockerfile$/.test(f) || /stat-[a-z]+\.svg$/.test(f)) && !EXCLUDED.some((r) => r.test(f))); + const files = new Map(paths.map((p) => [p, read(p)] as const)); + const original = new Map(files); + const nextState: State = { version: state.version, facts: { ...state.facts } }; + const report: string[] = []; + const failed: string[] = []; + + const version = (JSON.parse(read("package.json")) as { version: string }).version; + if (version !== state.version) { + for (const extra of ["src/types.ts", "src/functions/export-import.ts", "CHANGELOG.md"]) { + if (!files.has(extra)) files.set(extra, read(extra)); + if (!original.has(extra)) original.set(extra, read(extra)); + } + syncVersion(files, state.version, version); + report.push(`version: ${state.version} -> ${version}`); + nextState.version = version; + } + + for (const fact of FACTS) { + const next = fact.value(); + if (next === null) { + report.push(`${fact.label}: skipped (could not compute)`); + failed.push(fact.label); + continue; + } + const olds = state.facts[fact.key] ?? []; + if (olds.length === 1 && olds[0] === next) continue; + for (const [path, text] of files) { + if (fact.badge && path.endsWith(".svg") && !path.endsWith(fact.badge)) continue; + if (!fact.badge && path.endsWith(".svg")) continue; + files.set(path, replaceFact(text, fact, olds, next)); + } + report.push(`${fact.label}: ${olds.join(", ")} -> ${next}`); + nextState.facts[fact.key] = [next]; + } + + const changed = [...files].filter(([p, t]) => original.get(p) !== t).map(([p]) => p); + const stateChanged = JSON.stringify(nextState) !== JSON.stringify(state); + + if (CHECK) { + if (failed.length > 0) { + console.error(`docs-sync: could not compute ${failed.join(", ")}, so the check is incomplete.`); + process.exit(1); + } + if (changed.length === 0 && !stateChanged) { + console.log("docs-sync: documented numbers and versions are current."); + return; + } + console.error("docs-sync: documented numbers or versions are out of date."); + for (const line of report) console.error(` ${line}`); + for (const p of changed) console.error(` would update ${p}`); + console.error("Run `npm run docs:sync` and commit the result."); + process.exit(1); + } + + for (const fact of FACTS) { + const next = nextState.facts[fact.key]?.[0]; + for (const old of state.facts[fact.key] ?? []) { + if (!next || old.replace(/\D/g, "") === next.replace(/\D/g, "")) continue; + const leftover = new RegExp(`(? { + if (leftover.test(line)) report.push(`check ${fact.label} ${old} left in ${path}:${i + 1}`); + leftover.lastIndex = 0; + }); + } + } + } + + for (const p of changed) writeFileSync(join(ROOT, p), files.get(p)!, "utf-8"); + if (stateChanged) writeFileSync(join(ROOT, STATE_PATH), JSON.stringify(nextState, null, 2) + "\n", "utf-8"); + for (const line of report) console.log(`docs-sync: ${line}`); + console.log(`docs-sync: ${changed.length} file(s) updated.`); +} + +main(); diff --git a/scripts/plugins/test-antigravity-native.mjs b/scripts/plugins/test-antigravity-native.mjs new file mode 100644 index 0000000000..2b2c7a3e3e --- /dev/null +++ b/scripts/plugins/test-antigravity-native.mjs @@ -0,0 +1,214 @@ +import assert from "node:assert/strict"; +import { execFileSync, spawn } from "node:child_process"; +import { + mkdirSync, + mkdtempSync, + realpathSync, + writeFileSync, + readFileSync, + rmSync, +} from "node:fs"; +import { createServer } from "node:http"; +import { tmpdir } from "node:os"; +import { dirname, join, resolve } from "node:path"; +import { fileURLToPath } from "node:url"; +const repo = resolve(dirname(fileURLToPath(import.meta.url)), "../.."); +const cli = process.env.AGENTMEMORY_TEST_ANTIGRAVITY || "agy"; +const root = realpathSync( + mkdtempSync(join(tmpdir(), "agentmemory-agy-native-")), +); +const work = join(root, "project"); +mkdirSync(work); +mkdirSync(join(root, ".gemini/antigravity-cli"), { recursive: true }); +writeFileSync( + join(work, "sample.txt"), + "antigravity synthetic capture verification", +); +writeFileSync( + join(root, ".gemini/antigravity-cli/settings.json"), + JSON.stringify({ modelProvider: "gemini" }), +); +const requests = [], + models = []; +const server = createServer(async (req, res) => { + let raw = ""; + for await (const chunk of req) raw += chunk; + const body = raw ? JSON.parse(raw) : {}; + if (req.url.startsWith("/agentmemory/")) { + requests.push({ path: req.url, body }); + res.setHeader("content-type", "application/json"); + return res.end( + JSON.stringify( + req.url.endsWith("/mcp/tools") + ? { tools: [] } + : { context: "SYNTHETIC_AGY_CONTEXT", accepted: true }, + ), + ); + } + models.push({ path: req.url, body }); + const done = !body.tools || models.filter((m) => m.body.tools).length > 1; + const part = done + ? { text: "Synthetic test completed." } + : { + functionCall: { + name: "view_file", + args: { + AbsolutePath: join(work, "sample.txt"), + toolSummary: "Synthetic file check", + toolAction: "Reading test file", + }, + }, + }; + const response = { + candidates: [ + { + content: { role: "model", parts: [part] }, + finishReason: "STOP", + index: 0, + }, + ], + usageMetadata: { + promptTokenCount: 10, + candidatesTokenCount: 10, + totalTokenCount: 20, + }, + }; + if (req.url.includes("alt=sse")) { + res.setHeader("content-type", "text/event-stream"); + res.end(`data: ${JSON.stringify(response)}\n\n`); + } else { + res.setHeader("content-type", "application/json"); + res.end(JSON.stringify(response)); + } +}); +const env = Object.fromEntries( + Object.entries(process.env).filter(([k]) => + ["PATH", "TMPDIR", "TEMP", "SYSTEMROOT", "LANG"].includes(k), + ), +); +Object.assign(env, { + HOME: root, + USERPROFILE: root, + GEMINI_API_KEY: "synthetic-local-only", + AGENTMEMORY_INJECT_CONTEXT: "true", + AGENTMEMORY_DATA_DIR: join(root, "capture"), +}); +try { + await new Promise((r, j) => + server.once("error", j).listen(0, "127.0.0.1", r), + ); + const base = `http://127.0.0.1:${server.address().port}`; + env.AGENTMEMORY_URL = base; + env.GOOGLE_GEMINI_BASE_URL = base; + console.log( + execFileSync(cli, ["--version"], { + env, + encoding: "utf8", + timeout: 30_000, + }).trim(), + ); + execFileSync( + process.execPath, + [join(repo, "dist/cli.mjs"), "connect", "antigravity-cli", "--with-hooks"], + { env, cwd: work, encoding: "utf8", timeout: 30_000 }, + ); + assert.match( + execFileSync(cli, ["mcp", "list"], { + env, + cwd: work, + encoding: "utf8", + timeout: 30_000, + }), + /agentmemory.*npx -y @agentmemory\/mcp/, + ); + // Keep the connector's environment settings, but exercise this unpublished build. + writeFileSync( + join(root, ".gemini/config/mcp_config.json"), + JSON.stringify({ + mcpServers: { + agentmemory: { + command: process.execPath, + args: [join(repo, "plugin/scripts/plugin-bridge.mjs")], + env: JSON.parse( + readFileSync(join(root, ".gemini/config/mcp_config.json"), "utf8"), + ).mcpServers.agentmemory.env, + }, + }, + }), + ); + const child = spawn( + cli, + [ + "--print", + "Read sample.txt using view_file.", + "--output-format", + "json", + "--print-timeout", + "20s", + "--sandbox", + ], + { env, cwd: work, stdio: ["ignore", "pipe", "pipe"] }, + ); + let out = "", + err = ""; + child.stdout.on("data", (d) => (out += d)); + child.stderr.on("data", (d) => (err += d)); + const t = setTimeout(() => child.kill("SIGTERM"), 35000); + const code = await new Promise((r, j) => { + child.on("exit", r); + child.on("error", j); + }); + clearTimeout(t); + assert.equal(code, 0, err); + const result = JSON.parse(out); + assert.equal(result.status, "SUCCESS"); + assert.match(result.response, /Synthetic test completed/); + const turns = models.filter((m) => m.body.tools); + assert.equal(turns.length, 2); + assert.ok( + JSON.stringify(turns[0]).includes("SYNTHETIC_AGY_CONTEXT"), + "recalled context must reach the model", + ); + assert.ok( + JSON.stringify(turns[1]).includes( + "antigravity synthetic capture verification", + ), + "native file read must reach the model", + ); + assert.ok( + requests.some((r) => r.path === "/agentmemory/mcp/tools"), + "connector environment must reach the bundled MCP bridge", + ); + assert.equal( + requests.filter((r) => r.path === "/agentmemory/session/start").length, + 1, + ); + assert.equal( + requests.filter((r) => r.path === "/agentmemory/session/end").length, + 1, + ); + const prompts = requests.filter((r) => r.body.hookType === "prompt_submit"); + assert.deepEqual( + prompts.map((r) => r.body.data.prompt), + ["Read sample.txt using view_file."], + ); + const captures = requests.filter((r) => r.body.hookType === "post_tool_use"); + assert.equal(captures.length, 1); + assert.equal(captures[0].body.data.tool_name, "read"); + assert.equal( + captures[0].body.data.tool_input.file_path, + join(work, "sample.txt"), + ); + assert.ok( + requests + .filter((r) => r.body.hookType) + .every((r) => r.body.sessionId === result.conversation_id), + ); + console.log( + "PASS: native Antigravity connector, bundled MCP, context injection, tool capture, transcript prompt backfill, and one session lifecycle. Synthetic model and capture server only.", + ); +} finally { + server.closeAllConnections(); + await new Promise((r) => server.close(r)); + rmSync(root, { recursive: true, force: true }); +} diff --git a/scripts/plugins/test-codex-native.mjs b/scripts/plugins/test-codex-native.mjs new file mode 100644 index 0000000000..a84ce078ac --- /dev/null +++ b/scripts/plugins/test-codex-native.mjs @@ -0,0 +1,204 @@ +import assert from "node:assert/strict"; +import { execFileSync, spawn } from "node:child_process"; +import { + mkdirSync, + mkdtempSync, + realpathSync, + writeFileSync, + rmSync, +} from "node:fs"; +import { createServer } from "node:http"; +import { tmpdir } from "node:os"; +import { dirname, join, resolve } from "node:path"; +import { fileURLToPath } from "node:url"; +const repo = resolve(dirname(fileURLToPath(import.meta.url)), "../.."); +const cli = process.env.AGENTMEMORY_TEST_CODEX || "codex"; +const root = realpathSync( + mkdtempSync(join(tmpdir(), "agentmemory codex native ")), +); +const work = join(root, "project"); +mkdirSync(work); +mkdirSync(join(root, ".codex")); +writeFileSync(join(work, "sample.txt"), "codex synthetic capture verification"); +const requests = [], + models = []; +const context = "SYNTHETIC_CODEX_CONTEXT"; +const server = createServer(async (req, res) => { + let raw = ""; + for await (const chunk of req) raw += chunk; + const body = raw ? JSON.parse(raw) : {}; + if (req.url.startsWith("/agentmemory/")) { + requests.push({ path: req.url, body }); + res.setHeader("content-type", "application/json"); + return res.end( + JSON.stringify( + req.url.endsWith("/mcp/tools") + ? { tools: [] } + : { context, accepted: true }, + ), + ); + } + models.push(body); + const done = models.length > 1; + const item = done + ? { + id: "msg_synthetic", + type: "message", + role: "assistant", + status: "completed", + content: [ + { + type: "output_text", + text: "Synthetic test completed.", + annotations: [], + }, + ], + } + : { + id: "fc_synthetic", + type: "function_call", + call_id: "call_synthetic", + name: "exec_command", + arguments: JSON.stringify({ + cmd: "cat sample.txt", + max_output_tokens: 100, + }), + }; + res.setHeader("content-type", "text/event-stream"); + const emit = (type, data) => + res.write(`event: ${type}\ndata: ${JSON.stringify({ type, ...data })}\n\n`); + emit("response.created", { + response: { + id: "resp_synthetic", + object: "response", + status: "in_progress", + output: [], + }, + }); + emit("response.output_item.added", { + output_index: 0, + item: done ? { ...item, content: [] } : { ...item, arguments: "" }, + }); + if (done) + emit("response.output_text.delta", { + item_id: item.id, + output_index: 0, + content_index: 0, + delta: "Synthetic test completed.", + }); + emit("response.output_item.done", { output_index: 0, item }); + emit("response.completed", { + response: { + id: "resp_synthetic", + object: "response", + status: "completed", + output: [item], + usage: { input_tokens: 10, output_tokens: 10, total_tokens: 20 }, + }, + }); + res.end(); +}); +const env = Object.fromEntries( + Object.entries(process.env).filter(([k]) => + ["PATH", "TMPDIR", "TEMP", "SYSTEMROOT", "LANG"].includes(k), + ), +); +Object.assign(env, { + HOME: root, + USERPROFILE: root, + CODEX_HOME: join(root, ".codex"), + AGENTMEMORY_INJECT_CONTEXT: "true", + AGENTMEMORY_DATA_DIR: join(root, "capture"), +}); +try { + await new Promise((r, j) => + server.once("error", j).listen(0, "127.0.0.1", r), + ); + const base = `http://127.0.0.1:${server.address().port}`; + env.AGENTMEMORY_URL = base; + console.log( + execFileSync(cli, ["--version"], { env, encoding: "utf8" }).trim(), + ); + execFileSync( + cli, + ["plugin", "marketplace", "add", join(repo, "dist/plugins"), "--json"], + { env, cwd: work, encoding: "utf8", timeout: 30_000 }, + ); + execFileSync( + cli, + ["plugin", "add", "agentmemory@agentmemory-local-preview", "--json"], + { env, cwd: work, encoding: "utf8", timeout: 30_000 }, + ); + const args = [ + "exec", + "--skip-git-repo-check", + "--dangerously-bypass-hook-trust", + "--json", + "--sandbox", + "read-only", + "-C", + work, + "-c", + 'model="synthetic"', + "-c", + 'model_provider="synthetic"', + "-c", + `model_providers.synthetic={name="Synthetic local test",base_url="${base}/v1",wire_api="responses",requires_openai_auth=false}`, + "-c", + "features.hooks=true", + "Read sample.txt using exec_command.", + ]; + const child = spawn(cli, args, { + env, + cwd: work, + stdio: ["ignore", "pipe", "pipe"], + }); + let out = "", + err = ""; + child.stdout.on("data", (d) => (out += d)); + child.stderr.on("data", (d) => (err += d)); + const t = setTimeout(() => child.kill("SIGTERM"), 45000); + const code = await new Promise((r, j) => { + child.on("exit", r); + child.on("error", j); + }); + clearTimeout(t); + assert.equal(code, 0, err); + assert.equal(models.length, 2); + assert.ok(out.includes("Synthetic test completed.")); + assert.ok( + JSON.stringify(models[1]).includes("codex synthetic capture verification"), + "native file read must reach the model", + ); + assert.ok(JSON.stringify(models).includes(context)); + assert.ok(requests.some((r) => r.path === "/agentmemory/session/start")); + assert.ok(requests.some((r) => r.body.hookType === "prompt_submit")); + assert.ok( + requests.some( + (r) => + r.body.hookType === "post_tool_use" && + r.body.data.tool_output.includes( + "codex synthetic capture verification", + ), + ), + ); + assert.ok(requests.some((r) => r.path === "/agentmemory/mcp/tools")); + const session = requests.find((r) => r.path === "/agentmemory/session/start") + .body.sessionId; + assert.ok( + requests + .filter((r) => r.body.hookType) + .every((r) => r.body.sessionId === session), + ); + assert.equal( + requests.filter((r) => r.path === "/agentmemory/session/end").length, + 1, + ); + console.log( + "PASS: native Codex plugin install, bundled MCP, context injection, prompt/tool capture, and session end. Synthetic model and capture server only.", + ); +} finally { + server.closeAllConnections(); + await new Promise((r) => server.close(r)); + rmSync(root, { recursive: true, force: true }); +} diff --git a/scripts/plugins/test-copilot-native.mjs b/scripts/plugins/test-copilot-native.mjs new file mode 100644 index 0000000000..517e026484 --- /dev/null +++ b/scripts/plugins/test-copilot-native.mjs @@ -0,0 +1,100 @@ +import assert from "node:assert/strict"; +import { execFileSync } from "node:child_process"; +import { cpSync, mkdirSync, mkdtempSync, realpathSync, rmSync, writeFileSync } from "node:fs"; +import { createServer } from "node:http"; +import { tmpdir } from "node:os"; +import { dirname, join, resolve } from "node:path"; +import { fileURLToPath, pathToFileURL } from "node:url"; + +const cli = process.env.AGENTMEMORY_TEST_COPILOT; +const sdk = process.env.AGENTMEMORY_TEST_COPILOT_SDK; +if (!cli || !sdk) { + console.error("Set AGENTMEMORY_TEST_COPILOT to the Copilot executable and AGENTMEMORY_TEST_COPILOT_SDK to its bundled copilot-sdk/index.js. Run npm run build first."); + process.exit(1); +} +const { CopilotClient, RuntimeConnection, approveAll } = await import(pathToFileURL(resolve(sdk)).href); +const repo = resolve(dirname(fileURLToPath(import.meta.url)), "../.."); +const root = realpathSync(mkdtempSync(join(tmpdir(), "agentmemory copilot native "))); +const work = join(root, "project"); +const plugin = join(root, "plugin with spaces"); +const sample = "copilot synthetic capture verification"; +const context = "SYNTHETIC_SESSION_CONTEXT"; +mkdirSync(work); +writeFileSync(join(work, "sample.txt"), sample); +cpSync(join(repo, "plugin"), plugin, { recursive: true }); +const requests = []; +const modelRequests = []; +const server = createServer(async (req, res) => { + try { + let raw = ""; + for await (const chunk of req) raw += chunk; + const body = raw ? JSON.parse(raw) : {}; + res.setHeader("content-type", "application/json"); + if (req.url.startsWith("/agentmemory/")) { + requests.push({ path: req.url, body }); + if (req.url.endsWith("/mcp/tools")) return res.end(JSON.stringify({ tools: [] })); + return res.end(JSON.stringify({ context, accepted: true })); + } + modelRequests.push(body); + const done = modelRequests.length > 1; + const message = done + ? { role: "assistant", content: "Synthetic test completed." } + : { role: "assistant", content: null, tool_calls: [{ id: "call_synthetic", type: "function", + function: { name: "view", arguments: JSON.stringify({ path: join(work, "sample.txt") }) } }] }; + res.end(JSON.stringify({ id: "synthetic", object: "chat.completion", created: 1, model: "synthetic", + choices: [{ index: 0, message, finish_reason: done ? "stop" : "tool_calls" }], + usage: { prompt_tokens: 10, completion_tokens: 10, total_tokens: 20 } })); + } catch { + res.writeHead(500); + res.end('{}'); + } +}); +const env = Object.fromEntries(Object.entries(process.env).filter(([key]) => + ["PATH", "TMPDIR", "TEMP", "SYSTEMROOT", "LANG"].includes(key))); +Object.assign(env, { HOME: root, USERPROFILE: root, COPILOT_HOME: join(root, ".copilot"), + COPILOT_CACHE_HOME: join(root, "cache"), COPILOT_AUTO_UPDATE: "false", AGENTMEMORY_INJECT_CONTEXT: "true", + AGENTMEMORY_DATA_DIR: join(root, "capture") }); +let client; +let session; +try { + await new Promise((done, reject) => server.once("error", reject).listen(0, "127.0.0.1", done)); + const base = `http://127.0.0.1:${server.address().port}`; + env.AGENTMEMORY_URL = base; + console.log(execFileSync(cli, ["--version"], { env, encoding: "utf8", timeout: 30_000 }).trim()); + execFileSync(cli, ["plugin", "install", plugin], { env, cwd: work, encoding: "utf8", timeout: 30_000, stdio: ["ignore", "pipe", "pipe"] }); + const servers = JSON.parse(execFileSync(cli, ["mcp", "list", "--json"], { env, cwd: work, encoding: "utf8", timeout: 30_000 })); + assert.equal(servers.mcpServers.agentmemory.command, "node"); + assert.match(servers.mcpServers.agentmemory.args[0], /scripts\/plugin-bridge\.mjs$/); + const skills = JSON.parse(execFileSync(cli, ["skill", "list", "--json"], { env, cwd: work, encoding: "utf8", timeout: 30_000 })); + const pluginSkills = skills.filter((skill) => skill.source === "plugin"); + assert.ok(pluginSkills.some((skill) => skill.name === "remember")); + client = new CopilotClient({ connection: RuntimeConnection.forStdio({ path: cli }), + baseDirectory: env.COPILOT_HOME, workingDirectory: work, useLoggedInUser: false, env, logLevel: "error" }); + await client.start(); + session = await client.createSession({ model: "synthetic", provider: { type: "openai", baseUrl: `${base}/v1` }, + workingDirectory: work, enableFileHooks: true, enableConfigDiscovery: true, + availableTools: ["view"], streaming: false, onPermissionRequest: approveAll }); + const result = await session.sendAndWait("Read sample.txt using view.", 30_000); + assert.equal(result?.data?.content, "Synthetic test completed."); + await session.disconnect(); + session = undefined; + assert.equal(modelRequests.length, 2); + assert.ok(JSON.stringify(modelRequests).includes(context), "SessionStart context must reach the model"); + assert.ok(requests.some((r) => r.path === "/agentmemory/mcp/tools"), "the bundled MCP bridge must connect"); + const start = requests.find((r) => r.path === "/agentmemory/session/start"); + assert.ok(start); + for (const type of ["prompt_submit", "post_tool_use"]) { + const observation = requests.find((r) => r.body.hookType === type); + assert.ok(observation, `missing ${type} capture`); + assert.equal(observation.body.sessionId, start.body.sessionId); + if (type === "post_tool_use") assert.equal(observation.body.data.tool_output, sample); + } + assert.ok(requests.some((r) => r.path === "/agentmemory/session/end")); + console.log(`PASS: native plugin install, ${pluginSkills.length} plugin skills, bundled MCP, SessionStart context, prompt/tool capture, and session end. Synthetic model and capture server only.`); +} finally { + if (session) await session.disconnect(); + if (client) await client.stop(); + server.closeAllConnections(); + await new Promise((done) => server.close(done)); + rmSync(root, { recursive: true, force: true }); +} diff --git a/src/cli/connect/antigravity-cli.ts b/src/cli/connect/antigravity-cli.ts index af64870fd1..05cc5b72fe 100644 --- a/src/cli/connect/antigravity-cli.ts +++ b/src/cli/connect/antigravity-cli.ts @@ -18,11 +18,8 @@ import { writeJsonAtomic, } from "./util.js"; -// The `agy` CLI shares no configuration with the Antigravity IDE that -// `antigravity.ts` wires — it reads MCP from ~/.gemini/config/mcp_config.json -// and hooks from ~/.gemini/config/hooks.json (per-workspace overrides in -// /.agents/hooks.json). Detection keys off ~/.gemini/antigravity-cli/, -// which only the CLI creates; ~/.gemini/ alone would also match Gemini CLI. +// Current Antigravity surfaces share ~/.gemini/config customizations. +// Detection keys off the CLI's own state directory, not Gemini CLI's home. // Sources: antigravity.google/docs/hooks, antigravity.google/docs/cli/using const GEMINI_DIR = join(homedir(), ".gemini"); const ANTIGRAVITY_CLI_DIR = join(GEMINI_DIR, "antigravity-cli"); @@ -34,9 +31,12 @@ export const adapter = createJsonMcpAdapter({ displayName: "Antigravity CLI (agy)", detectDir: ANTIGRAVITY_CLI_DIR, configPath: join(CUSTOMIZATION_DIR, "mcp_config.json"), + // agy does not expand shell-style ${NAME:-default} values. Inherit the + // runtime environment so custom endpoints and credentials survive. + extraEntryFields: { env: {} }, docs: "https://github.com/rohitg00/agentmemory#other-agents", protocolNote: - "→ Using MCP via ~/.gemini/config/mcp_config.json (the agy CLI, not the Antigravity IDE — that one is `connect antigravity`). The `/mcp` slash command inside agy lists configured servers. Pass --with-hooks to also install the native ~/.gemini/config/hooks.json auto-capture hooks.", + "→ Using MCP via ~/.gemini/config/mcp_config.json, shared with current Antigravity IDE versions. The `/mcp` slash command inside agy lists configured servers. Pass --with-hooks to also install the native ~/.gemini/config/hooks.json auto-capture hooks.", installHooks: installAntigravityCliHooks, }); @@ -44,7 +44,7 @@ export const adapter = createJsonMcpAdapter({ * Merge the bundled `plugin/hooks/hooks.antigravity.json` into * `~/.gemini/config/hooks.json`, replacing only the bundle agentmemory owns. */ -function installAntigravityCliHooks(opts: ConnectOptions): ConnectResult { +export function installAntigravityCliHooks(opts: ConnectOptions): ConnectResult { let pluginRoot: string; try { pluginRoot = findPluginRoot(); diff --git a/src/cli/connect/antigravity.ts b/src/cli/connect/antigravity.ts index 559a7b7c53..a434d07182 100644 --- a/src/cli/connect/antigravity.ts +++ b/src/cli/connect/antigravity.ts @@ -1,25 +1,28 @@ +import { existsSync } from "node:fs"; import { homedir, platform } from "node:os"; import { join } from "node:path"; import { createJsonMcpAdapter } from "./json-mcp-adapter.js"; +import { installAntigravityCliHooks } from "./antigravity-cli.js"; -// Antigravity stores MCP config in mcp_config.json under its app -// support directory. The schema follows the standard MCP envelope — -// `{ mcpServers: { ... } }`. Path varies by platform: -// macOS: ~/Library/Application Support/Antigravity/User/mcp_config.json -// Linux: ~/.config/Antigravity/User/mcp_config.json -// Windows: %APPDATA%/Antigravity/User/mcp_config.json -// Connect is gated on win32 elsewhere; we cover macOS + Linux here. -const ANTIGRAVITY_DIR = +const LEGACY_USER_DIR = platform() === "darwin" ? join(homedir(), "Library", "Application Support", "Antigravity", "User") : join(homedir(), ".config", "Antigravity", "User"); -export const adapter = createJsonMcpAdapter({ +const CUSTOMIZATION_DIR = join(homedir(), ".gemini", "config"); +const mcpAdapter = createJsonMcpAdapter({ name: "antigravity", displayName: "Antigravity", - detectDir: ANTIGRAVITY_DIR, - configPath: join(ANTIGRAVITY_DIR, "mcp_config.json"), + detectDir: join(homedir(), ".gemini", "antigravity-ide"), + configPath: join(CUSTOMIZATION_DIR, "mcp_config.json"), + extraEntryFields: { env: {} }, docs: "https://github.com/rohitg00/agentmemory#other-agents", protocolNote: - "→ Using MCP via mcp_config.json. Antigravity replaces Gemini CLI (sunset 2026-06-18).", + "→ Using MCP via ~/.gemini/config/mcp_config.json, shared by current Antigravity surfaces. Pass --with-hooks for capture through ~/.gemini/config/hooks.json.", + installHooks: installAntigravityCliHooks, }); + +export const adapter = { + ...mcpAdapter, + detect: () => mcpAdapter.detect() || existsSync(join(homedir(), ".gemini", "antigravity")) || existsSync(LEGACY_USER_DIR), +}; diff --git a/src/functions/export-import.ts b/src/functions/export-import.ts index eb49f01233..c2a0add01e 100644 --- a/src/functions/export-import.ts +++ b/src/functions/export-import.ts @@ -226,7 +226,7 @@ export function registerExportImportFunction(sdk: IIIClient, kv: StateKV): void const strategy = data.strategy || "merge"; const importData = data.exportData; - const supportedVersions = new Set(["0.3.0", "0.4.0", "0.5.0", "0.6.0", "0.6.1", "0.7.0", "0.7.2", "0.7.3", "0.7.4", "0.7.5", "0.7.6", "0.7.7", "0.7.9", "0.8.0", "0.8.1", "0.8.2", "0.8.3", "0.8.4", "0.8.5", "0.8.6", "0.8.7", "0.8.8", "0.8.9", "0.8.10", "0.8.11", "0.8.12", "0.8.13", "0.9.0", "0.9.1", "0.9.2", "0.9.3", "0.9.4", "0.9.5", "0.9.6", "0.9.7", "0.9.8", "0.9.9", "0.9.10", "0.9.11", "0.9.12", "0.9.13", "0.9.14", "0.9.15", "0.9.16", "0.9.17", "0.9.18", "0.9.19", "0.9.20", "0.9.21", "0.9.22", "0.9.23", "0.9.24", "0.9.25", "0.9.26", "0.9.27", "0.9.28", "0.9.29"]); + const supportedVersions = new Set(["0.3.0", "0.4.0", "0.5.0", "0.6.0", "0.6.1", "0.7.0", "0.7.2", "0.7.3", "0.7.4", "0.7.5", "0.7.6", "0.7.7", "0.7.9", "0.8.0", "0.8.1", "0.8.2", "0.8.3", "0.8.4", "0.8.5", "0.8.6", "0.8.7", "0.8.8", "0.8.9", "0.8.10", "0.8.11", "0.8.12", "0.8.13", "0.9.0", "0.9.1", "0.9.2", "0.9.3", "0.9.4", "0.9.5", "0.9.6", "0.9.7", "0.9.8", "0.9.9", "0.9.10", "0.9.11", "0.9.12", "0.9.13", "0.9.14", "0.9.15", "0.9.16", "0.9.17", "0.9.18", "0.9.19", "0.9.20", "0.9.21", "0.9.22", "0.9.23", "0.9.24", "0.9.25", "0.9.26", "0.9.27", "0.9.28", "0.9.29", "0.9.30"]); if (!supportedVersions.has(importData.version)) { return { success: false, diff --git a/src/hooks/antigravity-bridge.ts b/src/hooks/antigravity-bridge.ts index 60e65bac74..8abfd07b6f 100644 --- a/src/hooks/antigravity-bridge.ts +++ b/src/hooks/antigravity-bridge.ts @@ -1,13 +1,14 @@ #!/usr/bin/env node import { spawnSync } from "node:child_process"; -import { dirname, join, resolve } from "node:path"; +import { realpathSync } from "node:fs"; +import { dirname, join } from "node:path"; import { fileURLToPath } from "node:url"; // Antigravity CLI (`agy`) bridge — sits in front of the canonical hooks // because three parts of agy's contract make them unusable as direct // `command` targets: only five events exist (no SessionStart/SessionEnd/ -// UserPromptSubmit, so the lifecycle is synthesized from PreInvocation and -// Stop); the payload is camelCase and nests tool calls under `toolCall`; and +// UserPromptSubmit, so session boundaries use PreInvocation and Stop and +// prompts come from the transcript); tool calls are nested under `toolCall`; and // stdout must be a JSON object, which `pre-tool-use.mjs` breaks when // AGENTMEMORY_INJECT_CONTEXT=true makes it write raw context text. // @@ -117,7 +118,10 @@ export function normalizePayload(event: string, raw: Json): Json { out["native_tool_name"] = rawName; } out["tool_input"] = args; - const result = toolCall["result"] ?? raw["toolResult"] ?? raw["result"]; + if (out["tool_use_id"] === undefined && Number.isInteger(raw["stepIdx"]) && (raw["stepIdx"] as number) >= 0) { + out["tool_use_id"] = `step:${raw["stepIdx"]}`; + } + const result = toolCall["result"] ?? raw["toolResult"] ?? raw["result"] ?? firstString(raw["error"]); if (result !== undefined) out["tool_result"] = result; } @@ -125,25 +129,20 @@ export function normalizePayload(event: string, raw: Json): Json { } // Map an Antigravity event to the bundled scripts it should drive. -// PreInvocation stands in for both SessionStart and UserPromptSubmit: the -// first invocation of a conversation opens the session, every later one is a -// fresh user turn. PostInvocation is deliberately unmapped — PostToolUse -// already captures the work, and firing again would double-record it. +// PreInvocation fires per model call, not per user prompt. Antigravity omits +// prompt text from that payload; session-end backfills it from the transcript. export function targetsFor(event: string, raw: Json): string[] { switch (event) { case "PreInvocation": { const n = raw["invocationNum"]; - const isFirst = typeof n !== "number" || n <= 1; - return isFirst - ? ["session-start.mjs", "prompt-submit.mjs"] - : ["prompt-submit.mjs"]; + return typeof n !== "number" || n === 0 ? ["session-start.mjs"] : []; } case "PreToolUse": return ["pre-tool-use.mjs"]; case "PostToolUse": return ["post-tool-use.mjs"]; case "Stop": - return ["stop.mjs", "session-end.mjs"]; + return raw["fullyIdle"] === false ? [] : ["session-end.mjs"]; default: return []; } @@ -152,8 +151,11 @@ export function targetsFor(event: string, raw: Json): string[] { // The stdout contract, per event. agy treats a PreToolUse response without // `decision` as a denial, so a bare `{}` there makes it refuse every matched // tool call (verified on 1.0.15). No other event carries a permission -// decision, so they stay on `{}` — sending one would override user settings. -export function responseFor(event: string): string { +// decision. PreInvocation can inject recalled context as an ephemeral step. +export function responseFor(event: string, context = ""): string { + if (event === "PreInvocation" && context) { + return JSON.stringify({ injectSteps: [{ ephemeralMessage: context }] }); + } return event === "PreToolUse" ? '{"decision":"allow"}' : "{}"; } @@ -175,19 +177,22 @@ async function main() { if (!raw || typeof raw !== "object") return; const payload = JSON.stringify(normalizePayload(event, raw)); + let context = ""; for (const script of targetsFor(event, raw)) { // Synchronous so the hook process does not exit before the capture // POSTs are issued. Each bundled hook already caps its own fetch // timeout, so the worst case here is bounded by those. - spawnSync(process.execPath, [join(SCRIPTS_DIR, script)], { + const child = spawnSync(process.execPath, [join(SCRIPTS_DIR, script)], { input: payload, - // Child stdout is discarded on purpose: Antigravity parses this - // process's stdout as the hook response, and the bundled scripts - // emit prose when context injection is enabled. - stdio: ["pipe", "ignore", "ignore"], + encoding: "utf8", + stdio: ["pipe", "pipe", "ignore"], }); + if (event === "PreInvocation" && script === "session-start.mjs" && child.status === 0) { + context = child.stdout?.trim() ?? ""; + } } + return context; } // Guarded so the pure helpers above stay importable from tests without the @@ -195,16 +200,16 @@ async function main() { // needs no such guard. const invokedDirectly = process.argv[1] !== undefined && - resolve(process.argv[1]) === fileURLToPath(import.meta.url); + realpathSync(process.argv[1]) === fileURLToPath(import.meta.url); if (invokedDirectly) { main() - .catch(() => {}) - .finally(() => { + .catch(() => undefined) + .then((context) => { // Always a well-formed, non-blocking response, emitted even when the // capture above threw or the payload was unparseable — a hook that // writes nothing is as fatal to PreToolUse as one that writes `{}`. - process.stdout.write(responseFor(process.argv[2] ?? "")); + process.stdout.write(responseFor(process.argv[2] ?? "", context)); process.exit(0); }); } diff --git a/src/hooks/session-end.ts b/src/hooks/session-end.ts index 6189591879..8de003192d 100644 --- a/src/hooks/session-end.ts +++ b/src/hooks/session-end.ts @@ -23,6 +23,9 @@ function extractTranscriptPrompts(data: Record): string[] { if (!line.trim()) continue; let msg: { role?: string; + type?: string; + source?: string; + content?: unknown; message?: { content?: Array<{ type?: string; text?: string }> }; }; try { @@ -30,6 +33,13 @@ function extractTranscriptPrompts(data: Record): string[] { } catch { continue; } + if (msg.type === "USER_INPUT" && msg.source === "USER_EXPLICIT" && typeof msg.content === "string") { + if (prompts.length >= 50) return prompts; + const match = msg.content.match(/\n?([\s\S]*?)\n?<\/USER_REQUEST>/); + const text = (match ? match[1] : msg.content).trim(); + if (text) prompts.push(text.slice(0, 8000)); + continue; + } if (msg.role !== "user") continue; for (const block of msg.message?.content ?? []) { if (prompts.length >= 50) return prompts; diff --git a/src/hooks/session-start.ts b/src/hooks/session-start.ts index 2103216dca..91542130b0 100644 --- a/src/hooks/session-start.ts +++ b/src/hooks/session-start.ts @@ -38,6 +38,9 @@ function wantsStructuredOutput(data: Record): boolean { } function contextPayload(data: Record, context: string): string { + if (process.env["COPILOT_PLUGIN_ROOT"] && !data.hook_event_name) { + return JSON.stringify({ additionalContext: context }); + } if ( typeof data.cursor_version === "string" || data.hook_event_name === "sessionStart" diff --git a/src/mcp/plugin-bridge.ts b/src/mcp/plugin-bridge.ts index 49fbe8d4e9..0196788103 100644 --- a/src/mcp/plugin-bridge.ts +++ b/src/mcp/plugin-bridge.ts @@ -1,4 +1,5 @@ import { pathToFileURL } from "node:url"; +import { realpathSync } from "node:fs"; import { VERSION } from "../version.js"; import { resolveClientSecret } from "../secret-store.js"; import { resolveEnvOrEmpty } from "./rest-proxy.js"; @@ -116,7 +117,7 @@ export function createPluginBridge(): RequestHandler { }; } -if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) { +if (process.argv[1] && import.meta.url === pathToFileURL(realpathSync(process.argv[1])).href) { try { createStdioTransport(createPluginBridge()).start(); } catch { diff --git a/src/types.ts b/src/types.ts index 02c1b52098..f9a1298f0e 100644 --- a/src/types.ts +++ b/src/types.ts @@ -356,7 +356,7 @@ export interface ExportPagination { } export interface ExportData { - version: "0.3.0" | "0.4.0" | "0.5.0" | "0.6.0" | "0.6.1" | "0.7.0" | "0.7.2" | "0.7.3" | "0.7.4" | "0.7.5" | "0.7.6" | "0.7.7" | "0.7.9" | "0.8.0" | "0.8.1" | "0.8.2" | "0.8.3" | "0.8.4" | "0.8.5" | "0.8.6" | "0.8.7" | "0.8.8" | "0.8.9" | "0.8.10" | "0.8.11" | "0.8.12" | "0.8.13" | "0.9.0" | "0.9.1" | "0.9.2" | "0.9.3" | "0.9.4" | "0.9.5" | "0.9.6" | "0.9.7" | "0.9.8" | "0.9.9" | "0.9.10" | "0.9.11" | "0.9.12" | "0.9.13" | "0.9.14" | "0.9.15" | "0.9.16" | "0.9.17" | "0.9.18" | "0.9.19" | "0.9.20" | "0.9.21" | "0.9.22" | "0.9.23" | "0.9.24" | "0.9.25" | "0.9.26" | "0.9.27" | "0.9.28" | "0.9.29"; + version: "0.3.0" | "0.4.0" | "0.5.0" | "0.6.0" | "0.6.1" | "0.7.0" | "0.7.2" | "0.7.3" | "0.7.4" | "0.7.5" | "0.7.6" | "0.7.7" | "0.7.9" | "0.8.0" | "0.8.1" | "0.8.2" | "0.8.3" | "0.8.4" | "0.8.5" | "0.8.6" | "0.8.7" | "0.8.8" | "0.8.9" | "0.8.10" | "0.8.11" | "0.8.12" | "0.8.13" | "0.9.0" | "0.9.1" | "0.9.2" | "0.9.3" | "0.9.4" | "0.9.5" | "0.9.6" | "0.9.7" | "0.9.8" | "0.9.9" | "0.9.10" | "0.9.11" | "0.9.12" | "0.9.13" | "0.9.14" | "0.9.15" | "0.9.16" | "0.9.17" | "0.9.18" | "0.9.19" | "0.9.20" | "0.9.21" | "0.9.22" | "0.9.23" | "0.9.24" | "0.9.25" | "0.9.26" | "0.9.27" | "0.9.28" | "0.9.29" | "0.9.30"; exportedAt: string; sessions: Session[]; observations: Record; diff --git a/src/version.ts b/src/version.ts index 2d78ca2d9d..95b0e98ee9 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1,2 +1,2 @@ -export const VERSION = "0.9.29"; +export const VERSION = "0.9.30"; export const III_PINNED_VERSION = "0.22.1"; diff --git a/test/antigravity-connect-hooks.test.ts b/test/antigravity-connect-hooks.test.ts index 7b33f1e6dd..1bb043aa7d 100644 --- a/test/antigravity-connect-hooks.test.ts +++ b/test/antigravity-connect-hooks.test.ts @@ -311,6 +311,16 @@ describe("antigravity bridge payload normalization", () => { ); }); + it("preserves native failures and the trajectory step used for replay deduplication", () => { + const out = normalizePayload("PostToolUse", { + stepIdx: 0, + toolCall: { name: "run_command", args: { CommandLine: "npm test" } }, + error: "exit status 1", + }); + expect(out["tool_use_id"]).toBe("step:0"); + expect(out["tool_result"]).toBe("exit status 1"); + }); + it("falls back to a placeholder session id rather than dropping the event", () => { expect(normalizePayload("Stop", {})["session_id"]).toBe("unknown"); }); @@ -352,13 +362,11 @@ describe("antigravity bridge stdout contract", () => { describe("antigravity bridge event routing", () => { it("opens the session on the first invocation only", () => { - expect(targetsFor("PreInvocation", { invocationNum: 1 })).toEqual([ + expect(targetsFor("PreInvocation", { invocationNum: 0 })).toEqual([ "session-start.mjs", - "prompt-submit.mjs", - ]); - expect(targetsFor("PreInvocation", { invocationNum: 4 })).toEqual([ - "prompt-submit.mjs", ]); + expect(targetsFor("PreInvocation", { invocationNum: 1 })).toEqual([]); + expect(targetsFor("PreInvocation", { invocationNum: 4 })).toEqual([]); }); it("treats a missing invocationNum as the first invocation", () => { @@ -366,7 +374,8 @@ describe("antigravity bridge event routing", () => { }); it("closes the session on Stop", () => { - expect(targetsFor("Stop", {})).toEqual(["stop.mjs", "session-end.mjs"]); + expect(targetsFor("Stop", {})).toEqual(["session-end.mjs"]); + expect(targetsFor("Stop", { fullyIdle: false })).toEqual([]); }); it("ignores PostInvocation to avoid double-capturing a turn", () => { diff --git a/test/antigravity-runtime.test.ts b/test/antigravity-runtime.test.ts new file mode 100644 index 0000000000..362ee69023 --- /dev/null +++ b/test/antigravity-runtime.test.ts @@ -0,0 +1,122 @@ +import { afterEach, describe, expect, it } from "vitest"; +import { execFile } from "node:child_process"; +import { promisify } from "node:util"; +import { createServer, type Server } from "node:http"; +import { mkdtempSync, rmSync, symlinkSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join, resolve } from "node:path"; + +const exec = promisify(execFile); +let server: Server | undefined; +let root: string; +afterEach(async () => { + if (server) await new Promise((done) => server!.close(() => done())); + if (root) rmSync(root, { recursive: true, force: true }); +}); + +describe("bundled Antigravity bridge", () => { + it("injects context, captures transcript prompts and tool identities, and closes only when idle", async () => { + root = mkdtempSync(join(tmpdir(), "am-agy-runtime-")); + const plugin = join(root, "plugin"); + symlinkSync( + resolve(__dirname, "../plugin"), + plugin, + process.platform === "win32" ? "junction" : "dir", + ); + const posts: Array<{ path: string; body: any }> = []; + server = createServer(async (req, res) => { + let raw = ""; + for await (const chunk of req) raw += chunk; + posts.push({ path: req.url!, body: JSON.parse(raw || "{}") }); + res.setHeader("content-type", "application/json"); + res.end(JSON.stringify({ context: "Synthetic recalled decision" })); + }); + await new Promise((done) => server!.listen(0, "127.0.0.1", done)); + const port = (server.address() as { port: number }).port; + const transcriptPath = join(root, "transcript.jsonl"); + writeFileSync( + transcriptPath, + [ + { + step_index: 0, + type: "USER_INPUT", + source: "USER_EXPLICIT", + content: + "\nRead sample.txt.\n\nsynthetic metadata", + }, + { + step_index: 1, + type: "PLANNER_RESPONSE", + source: "MODEL", + content: "Not a user prompt", + }, + { + step_index: 2, + type: "USER_INPUT", + source: "SYSTEM", + content: "Not an explicit user prompt", + }, + ] + .map((row) => JSON.stringify(row)) + .join("\n"), + ); + const run = async (event: string, extra = {}) => { + const child = exec( + process.execPath, + [join(plugin, "scripts/antigravity-bridge.mjs"), event], + { + env: { + ...process.env, + AGENTMEMORY_URL: `http://127.0.0.1:${port}`, + AGENTMEMORY_INJECT_CONTEXT: "true", + AGENTMEMORY_DATA_DIR: join(root, "capture"), + }, + timeout: 15_000, + }, + ); + child.child.stdin!.end( + JSON.stringify({ + conversationId: "ag-test", + workspacePaths: [root], + transcriptPath, + ...extra, + }), + ); + return JSON.parse((await child).stdout); + }; + expect(await run("PreInvocation", { invocationNum: 0 })).toEqual({ + injectSteps: [{ ephemeralMessage: "Synthetic recalled decision" }], + }); + expect(await run("PreInvocation", { invocationNum: 1 })).toEqual({}); + expect( + await run("PreToolUse", { + toolCall: { name: "view_file", args: { AbsolutePath: "/repo/a.ts" } }, + }), + ).toEqual({ decision: "allow" }); + const tool = { + stepIdx: 2, + toolCall: { name: "view_file", args: { AbsolutePath: "/repo/a.ts" } }, + }; + await run("PostToolUse", tool); + await run("PostToolUse", tool); + await run("Stop", { fullyIdle: false }); + expect(posts.filter((p) => p.path.endsWith("/session/end"))).toHaveLength( + 0, + ); + await run("Stop", { fullyIdle: true }); + expect(posts.filter((p) => p.path.endsWith("/session/start"))).toHaveLength( + 1, + ); + expect(posts.filter((p) => p.path.endsWith("/session/end"))).toHaveLength( + 1, + ); + const prompts = posts.filter((p) => p.body.hookType === "prompt_submit"); + expect(prompts.map((p) => p.body.data.prompt)).toEqual([ + "Read sample.txt.", + ]); + const tools = posts.filter((p) => p.body.hookType === "post_tool_use"); + expect(tools).toHaveLength(2); + expect(tools[0].body.data.tool_name).toBe("read"); + expect(tools[0].body.eventId).toBe(tools[1].body.eventId); + }, 30_000); +}); diff --git a/test/capture-review-fixes.test.ts b/test/capture-review-fixes.test.ts index 7db797d937..5b64fc27b9 100644 --- a/test/capture-review-fixes.test.ts +++ b/test/capture-review-fixes.test.ts @@ -132,7 +132,7 @@ describe("spool operations without the lock", () => { function statusInputs(capture: CaptureStatus | null | undefined): StatusInputs { return { now: new Date("2026-10-02T12:00:00.000Z"), - version: "0.10.0", + version: "0.9.30", engineVersion: "0.22.1", uptimeSeconds: 60, stateBackend: "file", diff --git a/test/codex-live-daemon.test.ts b/test/codex-live-daemon.test.ts index 1208e8902b..7d9aa342d2 100644 --- a/test/codex-live-daemon.test.ts +++ b/test/codex-live-daemon.test.ts @@ -1,6 +1,6 @@ -import { afterAll, describe, expect, it } from "vitest"; +import { afterEach, describe, expect, it } from "vitest"; import { spawn, execFileSync, type ChildProcess } from "node:child_process"; -import { mkdtempSync, readFileSync, writeFileSync, rmSync, mkdirSync } from "node:fs"; +import { mkdtempSync, readFileSync, writeFileSync, rmSync, mkdirSync, cpSync } from "node:fs"; import { homedir, tmpdir } from "node:os"; import { join, resolve } from "node:path"; import { createServer } from "node:net"; @@ -24,7 +24,7 @@ async function stop(child: ChildProcess) { children.delete(child); } -afterAll(async () => { +afterEach(async () => { await Promise.all([...children].map(stop)); if (sandbox) rmSync(sandbox, { recursive: true, force: true }); }); @@ -77,7 +77,7 @@ function mcp(script: string, cwd: string, env: NodeJS.ProcessEnv) { return { child, request, tool }; } -describe.skipIf(!engineBin)("local plugin against the pinned iii daemon", () => { +describe.skipIf(!engineBin).each(["codex", "copilot", "antigravity"] as const)("%s plugin against the pinned iii daemon", (host) => { it("authenticates locally, captures and recovers hooks, shares memory, and persists across restart", async () => { // vitest.config.ts isolates user configuration for the entire test process. expect(homedir()).toContain("agentmemory-test-home-"); @@ -112,8 +112,12 @@ describe.skipIf(!engineBin)("local plugin against the pinned iii daemon", () => } throw new Error(`Daemon failed to become ready:\n${engine.diagnostic()}\n${worker.diagnostic()}`); }; - const packaged = join(root, "dist/plugins/agentmemory-codex-local"); - const codex = mcp(join(packaged, "scripts/plugin-bridge.mjs"), packaged, env); + const packaged = host === "codex" ? join(root, "dist/plugins/agentmemory-codex-local") : join(sandbox, `${host} plugin`); + if (host !== "codex") cpSync(join(root, "plugin"), packaged, { recursive: true }); + const configPath = join(packaged, ".mcp.json"); + const mcpConfig = JSON.parse(readFileSync(configPath, "utf8")).mcpServers.agentmemory; + const bridge = resolve(packaged, mcpConfig.args[0].replaceAll("${CLAUDE_PLUGIN_ROOT}", packaged)); + const codex = mcp(bridge, packaged, env); await codex.request("initialize", { protocolVersion: "2025-11-25" }); expect((await codex.request("tools/list")).error).toBeDefined(); let running = await daemon(); @@ -134,11 +138,42 @@ describe.skipIf(!engineBin)("local plugin against the pinned iii daemon", () => const cwd = join(sandbox, "smoke-alpha"); mkdirSync(cwd); const sessionId = `ses_${token}`; + let step = 0; const hook = async (name: string, input: Record) => { - const { child, diagnostic } = launch(process.execPath, [join(packaged, `scripts/${name}.mjs`)], cwd, env); + const event = { "session-start": "PreInvocation", "post-tool-use": "PostToolUse", stop: "Stop" }[name]; + const args = host === "antigravity" + ? [join(packaged, "scripts/antigravity-bridge.mjs"), event!] + : [join(packaged, `scripts/${name}.mjs`)]; + const { child, diagnostic } = launch(process.execPath, args, cwd, env); child.stdout.resume(); const exit = new Promise((done) => child.once("exit", done)); - child.stdin.end(JSON.stringify({ session_id: sessionId, cwd, ...input })); + const payload: Record = { session_id: sessionId, cwd, ...input }; + if (host === "copilot") { + for (const [from, to] of Object.entries({ session_id: "sessionId", tool_name: "toolName", tool_input: "toolArgs", tool_use_id: "toolUseId" })) { + if (payload[from] !== undefined) { payload[to] = payload[from]; delete payload[from]; } + } + if (payload.tool_response !== undefined) { + payload.toolResult = { resultType: "success", textResultForLlm: payload.tool_response }; + delete payload.tool_response; + } + } + if (host === "antigravity") { + payload.conversationId = sessionId; + payload.workspacePaths = [cwd]; + payload.invocationNum = 0; + payload.fullyIdle = true; + delete payload.session_id; + delete payload.cwd; + if (payload.tool_name) { + payload.stepIdx = step++; + payload.toolCall = { name: "run_command", args: { CommandLine: (payload.tool_input as { cmd: string }).cmd } }; + delete payload.tool_name; + delete payload.tool_input; + delete payload.tool_response; + delete payload.tool_use_id; + } + } + child.stdin.end(JSON.stringify(payload)); const code = await exit; expect(code, diagnostic()).toBe(0); }; diff --git a/test/codex-plugin.test.ts b/test/codex-plugin.test.ts index 6b71119771..6946a36ac4 100644 --- a/test/codex-plugin.test.ts +++ b/test/codex-plugin.test.ts @@ -81,15 +81,11 @@ describe("Codex plugin manifest (developers.openai.com/codex/plugins)", () => { >; }>(join(pluginRoot, ".mcp.json")); - // env interpolation must include defaults so Claude Code (and - // any other MCP host that fails parse on unset ${VAR}) doesn't drop - // the server silently when the user hasn't exported the var. - expect(mcp.mcpServers.agentmemory?.env?.AGENTMEMORY_URL).toMatch( - /\$\{AGENTMEMORY_URL:-/, - ); - expect(mcp.mcpServers.agentmemory?.env?.AGENTMEMORY_SECRET).toMatch( - /\$\{AGENTMEMORY_SECRET:-/, - ); + expect(mcp.mcpServers.agentmemory?.env).toBeUndefined(); + expect(mcp.mcpServers.agentmemory?.command).toBe("node"); + expect(mcp.mcpServers.agentmemory?.args).toEqual([ + "${CLAUDE_PLUGIN_ROOT}/scripts/plugin-bridge.mjs", + ]); }); it("hooks.codex.json contains only events Codex supports (no Subagent / SessionEnd / Notification / TaskCompleted / PostToolUseFailure)", () => { diff --git a/test/connect-new-agents.test.ts b/test/connect-new-agents.test.ts index 3c16a0b0c6..876eda86c6 100644 --- a/test/connect-new-agents.test.ts +++ b/test/connect-new-agents.test.ts @@ -1,5 +1,5 @@ import { describe, it, expect, beforeEach, afterEach, vi } from "vitest"; -import { mkdtempSync, mkdirSync, rmSync, readFileSync, existsSync } from "node:fs"; +import { mkdtempSync, mkdirSync, rmSync, readFileSync, existsSync, writeFileSync } from "node:fs"; import { tmpdir, platform } from "node:os"; import { join } from "node:path"; @@ -76,23 +76,26 @@ describe("connect: Antigravity", () => { rmSync(home, { recursive: true, force: true }); }); - it("writes mcpServers.agentmemory to the platform-specific config path", async () => { - const isMac = platform() === "darwin"; - const userDir = isMac + it.each(["antigravity", "antigravity-ide", "legacy"])("detects %s and writes the shared config while preserving other servers", async (surface) => { + const legacyDir = platform() === "darwin" ? join(home, "Library", "Application Support", "Antigravity", "User") : join(home, ".config", "Antigravity", "User"); - mkdirSync(userDir, { recursive: true }); + mkdirSync(surface === "legacy" ? legacyDir : join(home, ".gemini", surface), { recursive: true }); + const configDir = join(home, ".gemini", "config"); + mkdirSync(configDir, { recursive: true }); + writeFileSync(join(configDir, "mcp_config.json"), JSON.stringify({ mcpServers: { existing: { command: "custom" } } })); const { adapter } = await import("../src/cli/connect/antigravity.js"); expect(adapter.detect()).toBe(true); - const result = await adapter.install({ dryRun: false, force: false }); + const result = await adapter.install({ dryRun: false, force: false, withHooks: true }); expect(result.kind).toBe("installed"); const cfg = JSON.parse( - readFileSync(join(userDir, "mcp_config.json"), "utf-8"), + readFileSync(join(configDir, "mcp_config.json"), "utf-8"), ); expect(cfg.mcpServers.agentmemory.command).toBe("npx"); - expect(cfg.mcpServers.agentmemory.env.AGENTMEMORY_URL).toMatch( - /\$\{AGENTMEMORY_URL:-/, - ); + expect(cfg.mcpServers.existing).toEqual({ command: "custom" }); + expect(existsSync(join(legacyDir, "mcp_config.json"))).toBe(false); + expect(JSON.parse(readFileSync(join(configDir, "hooks.json"), "utf8")).agentmemory.enabled).toBe(true); + expect(cfg.mcpServers.agentmemory.env).toEqual({}); }); }); diff --git a/test/copilot-plugin.test.ts b/test/copilot-plugin.test.ts index cd01b2d872..3b1295b48d 100644 --- a/test/copilot-plugin.test.ts +++ b/test/copilot-plugin.test.ts @@ -1,5 +1,6 @@ import { describe, expect, it } from "vitest"; -import { readFileSync, existsSync } from "node:fs"; +import { readFileSync, existsSync, mkdtempSync, cpSync, rmSync } from "node:fs"; +import { tmpdir } from "node:os"; import { join, resolve } from "node:path"; import { createServer } from "node:http"; import { spawn } from "node:child_process"; @@ -112,13 +113,9 @@ describe("Copilot MCP config (.mcp.copilot.json)", () => { }>(mcpPath); const server = config.mcpServers.agentmemory; expect(server.type).toBe("local"); - expect(server.command).toBe("npx"); - expect(server.args).toEqual(["-y", "@agentmemory/mcp"]); - expect(server.env["AGENTMEMORY_URL"]).toBe( - "${AGENTMEMORY_URL:-http://localhost:3111}", - ); - expect(server.env["AGENTMEMORY_SECRET"]).toBe("${AGENTMEMORY_SECRET:-}"); - expect(server.env["AGENTMEMORY_TOOLS"]).toBe("${AGENTMEMORY_TOOLS:-all}"); + expect(server.command).toBe("node"); + expect(server.args).toEqual(["${COPILOT_PLUGIN_ROOT}/scripts/plugin-bridge.mjs"]); + expect(server.env).toBeUndefined(); expect(server.tools).toContain("*"); }); }); @@ -198,7 +195,7 @@ describe("Copilot hooks config (hooks/hooks.copilot.json)", () => { for (const entries of Object.values(config.hooks)) { for (const handler of entries) { const cmd = handler.command ?? handler.bash ?? handler.powershell ?? ""; - const match = cmd.match(/\$\{(?:COPILOT_PLUGIN_ROOT|CLAUDE_PLUGIN_ROOT)\}\/(scripts\/[^\s]+)/); + const match = cmd.match(/\$\{(?:COPILOT_PLUGIN_ROOT|CLAUDE_PLUGIN_ROOT)\}\/(scripts\/[^\s"']+)/); if (match) scriptRefs.add(match[1]); } } @@ -216,6 +213,7 @@ describe("Copilot hook scripts", () => { script: string, payload: Record, env: Record = {}, + command?: string, ): Promise<{ requests: ObservedRequest[]; stdout: string }> { const requests: ObservedRequest[] = []; const server = createServer((req, res) => { @@ -244,7 +242,8 @@ describe("Copilot hook scripts", () => { } try { - const child = spawn(process.execPath, [join(pluginRoot, script)], { + const child = spawn(command ?? process.execPath, command ? [] : [join(pluginRoot, script)], { + shell: Boolean(command), env: { ...process.env, AGENTMEMORY_URL: `http://127.0.0.1:${address.port}`, @@ -300,6 +299,39 @@ describe("Copilot hook scripts", () => { }); }); + it("runs the manifest command from an installed path containing spaces", async () => { + const sandbox = mkdtempSync(join(tmpdir(), "copilot plugin ")); + const installed = join(sandbox, "agentmemory"); + cpSync(pluginRoot, installed, { recursive: true }); + try { + const hooks = readJson<{ hooks: Record }>( + join(installed, "hooks/hooks.copilot.json"), + ); + const command = hooks.hooks.postToolUse[0].command.replaceAll("${COPILOT_PLUGIN_ROOT}", installed); + const result = await runHook("", { + sessionId: "copilot-manifest-session", + cwd: sandbox, + toolName: "view", + toolArgs: { path: "sample.txt" }, + toolResult: { resultType: "success", textResultForLlm: "synthetic capture" }, + }, {}, command); + expect(result.requests.find((r) => r.path === "/agentmemory/observe")?.body).toMatchObject({ + sessionId: "copilot-manifest-session", + hookType: "post_tool_use", + data: { tool_name: "view", tool_output: "synthetic capture" }, + }); + } finally { + rmSync(sandbox, { recursive: true, force: true }); + } + }); + + it("returns the JSON context consumed by the native Copilot sessionStart hook", async () => { + const result = await runHook("scripts/session-start.mjs", { + sessionId: "copilot-context", cwd: "/repo", source: "startup", + }, { AGENTMEMORY_INJECT_CONTEXT: "true", COPILOT_PLUGIN_ROOT: pluginRoot }); + expect(JSON.parse(result.stdout)).toEqual({ additionalContext: "remembered context" }); + }); + it("pre-tool-use narrows Copilot sessionId to strings", async () => { const result = await runHook( "scripts/pre-tool-use.mjs", diff --git a/test/graph-compact-boot.test.ts b/test/graph-compact-boot.test.ts index bd1f88de9a..fa81a2ab6c 100644 --- a/test/graph-compact-boot.test.ts +++ b/test/graph-compact-boot.test.ts @@ -336,7 +336,7 @@ describe("AGENTMEMORY_GRAPH_COMPACT_ON_BOOT", () => { describe("graph compaction in /agentmemory/status", () => { const base: StatusInputs = { now: new Date("2026-10-01T12:00:00.000Z"), - version: "0.10.0", + version: "0.9.30", engineVersion: "0.22.1", uptimeSeconds: 10, stateBackend: "file", diff --git a/test/mcp-surface-default.test.ts b/test/mcp-surface-default.test.ts index cb26cd27af..ac50b9094f 100644 --- a/test/mcp-surface-default.test.ts +++ b/test/mcp-surface-default.test.ts @@ -50,18 +50,11 @@ describe("MCP tool surface default", () => { } }); - it("plugin .mcp.json provides default env interpolation so CC parse never fails", () => { - const raw = readFileSync("plugin/.mcp.json", "utf-8"); - const cfg = JSON.parse(raw) as { - mcpServers: { agentmemory: { env: Record } }; - }; - const env = cfg.mcpServers.agentmemory.env; - // Per Claude Code MCP docs: ${VAR} without a default fails config - // parse when VAR is unset, silently dropping the server. ${VAR:-x} - // form is what unblocks fresh installs that haven't exported - // AGENTMEMORY_URL. - expect(env["AGENTMEMORY_URL"]).toMatch(/\$\{AGENTMEMORY_URL:-/); - expect(env["AGENTMEMORY_SECRET"]).toMatch(/\$\{AGENTMEMORY_SECRET:-/); - expect(env["AGENTMEMORY_TOOLS"]).toMatch(/\$\{AGENTMEMORY_TOOLS:-all\}/); + it("plugin MCP uses its bundled bridge and inherits the host environment", () => { + const cfg = JSON.parse(readFileSync("plugin/.mcp.json", "utf-8")); + expect(cfg.mcpServers.agentmemory).toEqual({ + command: "node", + args: ["${CLAUDE_PLUGIN_ROOT}/scripts/plugin-bridge.mjs"], + }); }); }); diff --git a/test/plugin-bridge-entrypoint.test.ts b/test/plugin-bridge-entrypoint.test.ts new file mode 100644 index 0000000000..c128ed361e --- /dev/null +++ b/test/plugin-bridge-entrypoint.test.ts @@ -0,0 +1,24 @@ +import { describe, expect, it } from "vitest"; +import { execFileSync } from "node:child_process"; +import { mkdtempSync, rmSync, symlinkSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join, resolve } from "node:path"; + +describe("bundled MCP bridge entrypoint", () => { + it("answers initialize when the plugin directory is reached through a symlink", () => { + const sandbox = mkdtempSync(join(tmpdir(), "agentmemory-linked-plugin-")); + try { + const linked = join(sandbox, "plugin link"); + symlinkSync(resolve(__dirname, "../plugin"), linked, "junction"); + const output = execFileSync(process.execPath, [join(linked, "scripts/plugin-bridge.mjs")], { + input: JSON.stringify({ jsonrpc: "2.0", id: 1, method: "initialize", params: { protocolVersion: "2025-11-25" } }) + "\n", + encoding: "utf8", + timeout: 5000, + env: { ...process.env, AGENTMEMORY_URL: "http://127.0.0.1:1", AGENTMEMORY_SECRET: "" }, + }); + expect(JSON.parse(output)).toMatchObject({ id: 1, result: { serverInfo: { name: "agentmemory" } } }); + } finally { + rmSync(sandbox, { recursive: true, force: true }); + } + }); +}); diff --git a/test/plugin-published-compatibility.test.ts b/test/plugin-published-compatibility.test.ts index 946a63d726..c0571f0363 100644 --- a/test/plugin-published-compatibility.test.ts +++ b/test/plugin-published-compatibility.test.ts @@ -1,8 +1,8 @@ import { describe, expect, it } from "vitest"; import { publishedCompatibilityErrors } from "../scripts/plugins/verify-published.mjs"; -const local = { version: "0.10.0", dependencies: { "iii-sdk": "0.22.1", "@iii-dev/helpers": "0.22.1" } }; -const shim = { version: "0.10.0", dependencies: { "@agentmemory/agentmemory": "0.10.0" } }; +const local = { version: "0.9.30", dependencies: { "iii-sdk": "0.22.1", "@iii-dev/helpers": "0.22.1" } }; +const shim = { version: "0.9.30", dependencies: { "@agentmemory/agentmemory": "0.9.30" } }; describe("published plugin compatibility gate", () => { it("accepts an exact runtime, engine SDK, helper, and shim match", () => { diff --git a/website/app/benchmarks/page.module.css b/website/app/benchmarks/page.module.css new file mode 100644 index 0000000000..15af8fa976 --- /dev/null +++ b/website/app/benchmarks/page.module.css @@ -0,0 +1,39 @@ +.figure { + margin-bottom: var(--s-8); +} + +.tableWrap { + overflow-x: auto; + border: 1px solid var(--line); + border-radius: var(--radius); + background: var(--surface); +} + +.tableWrap table { + font-variant-numeric: tabular-nums; +} + +.tableWrap td, +.tableWrap th { + white-space: nowrap; +} + +.tableWrap tr:last-child td { + border-bottom: 0; +} + +.tableWrap td:first-child { + color: var(--ink); +} + +.facts { + list-style: none; + padding: 0 !important; +} + +.facts li { + padding: 12px 14px; + border: 1px solid var(--line); + border-radius: var(--radius); + background: var(--surface); +} diff --git a/website/app/benchmarks/page.tsx b/website/app/benchmarks/page.tsx new file mode 100644 index 0000000000..6070b2344e --- /dev/null +++ b/website/app/benchmarks/page.tsx @@ -0,0 +1,243 @@ +import type { Metadata } from "next"; +import { DocPage, Prose } from "@/components/site/Doc"; +import { QuestionDots } from "@/components/site/BenchFigures"; +import { LONGMEMEVAL, TOKENS, src } from "@/lib/site"; +import { BUDGETS, RECOVERY_FACTS, REPRODUCE, TOKEN_SETUP, TYPE_HITS, benchSrc } from "@/lib/bench"; +import s from "./page.module.css"; + +export const metadata: Metadata = { + title: "Benchmarks", + description: + "How agentmemory is measured: LongMemEval-S retrieval recall, token cost per query, crash recovery and the resource budgets the cost bench enforces. Every number links to its source file.", + alternates: { canonical: "/benchmarks" }, +}; + +const pct = (n: number) => `${n.toFixed(1)}%`; +const mib = (kib: number) => `${(kib / 1024).toFixed(0)} MiB`; +const kib = (bytes: number) => `${(bytes / 1024).toFixed(1)} KiB`; +const sec = (ms: number) => `${(ms / 1000).toFixed(1)} s`; + +const TOKEN_ROWS = [ + { name: "Load every observation", r5: 37.0, r10: 55.8, p5: 78.0, ndcg: 80.3, mrr: 82.5, tokens: TOKENS.fullContext }, + { name: "BM25 only, keyless", r5: 43.8, r10: 55.9, p5: 95.0, ndcg: 82.7, mrr: 95.5, tokens: TOKENS.agentmemory }, + { name: "BM25 + local vectors", r5: 43.8, r10: 64.1, p5: 98.0, ndcg: 94.9, mrr: 100.0, tokens: TOKENS.agentmemory }, +]; + +function Src({ href, children }: { href: string; children: string }) { + return ( + + {children} + + ); +} + +export default function BenchmarksPage() { + return ( + +

+ +
+ + +

What is measured

+
    +
  • + Dataset. LongMemEval-S: {LONGMEMEVAL.questions} questions, about 48 sessions and 115K tokens + per question. dataset paper +
  • +
  • + Metric. recall_any@K: does any gold session appear in the top K results. Each question builds + a fresh index from its own sessions and searches with the question text. +
  • +
  • + Embeddings. {LONGMEMEVAL.embedding}. No API key and no LLM in the loop. +
  • +
  • + What it is not. This is retrieval recall, not end-to-end answer accuracy. The official + LongMemEval score adds answer generation and an LLM judge, and we do not claim one. +
  • +
+ +

Retrieval recall

+
+ + + + + + + + + + + + + {[ + { name: "BM25 + vectors", d: LONGMEMEVAL.hybrid }, + { name: "BM25 only, keyless", d: LONGMEMEVAL.bm25 }, + ].map((r) => ( + + + + + + + + + ))} + +
ModeR@5R@10R@20NDCG@10MRR
{r.name}{pct(r.d.r5)}{pct(r.d.r10)}{pct(r.d.r20)}{pct(r.d.ndcg10)}{pct(r.d.mrr)}
+
+

+ Adding local vectors to BM25 lifts R@5 from {pct(LONGMEMEVAL.bm25.r5)} to {pct(LONGMEMEVAL.hybrid.r5)}.{" "} + benchmark/LONGMEMEVAL.md +

+ +

By question type, BM25 + vectors

+
+ + + + + + + + + + + + {LONGMEMEVAL.byType.map((t) => ( + + + + + + + + ))} + +
TypeQuestionsR@5R@10Found at top 5
{t.type}{t.count}{pct(t.r5)}{pct(t.r10)} + {TYPE_HITS.find((h) => h.type === t.type)?.hits[5]} of {t.count} +
+
+

+ Preferences are the hardest type: they depend on implicit statements, and R@5 is {pct(LONGMEMEVAL.byType[5].r5)}. + Knowledge updates and multi-session questions are the strongest. +

+ +

Token cost per query

+

+ A smaller labeled set of coding-session observations: {TOKEN_SETUP.observations} observations across{" "} + {TOKEN_SETUP.sessions} sessions and {TOKEN_SETUP.queries} queries, with {TOKEN_SETUP.model}. The baseline loads + every observation into the prompt. +

+
+ + + + + + + + + + + + + + {TOKEN_ROWS.map((r) => ( + + + + + + + + + + ))} + +
ModeR@5R@10P@5NDCG@10MRRTokens
{r.name}{pct(r.r5)}{pct(r.r10)}{pct(r.p5)}{pct(r.ndcg)}{pct(r.mrr)}{r.tokens.toLocaleString("en-US")}
+
+

+ {TOKENS.agentmemory.toLocaleString("en-US")} tokens instead of {TOKENS.fullContext.toLocaleString("en-US")} is{" "} + {TOKENS.savedPct}% fewer, with higher precision, measured on v0.6.0.{" "} + benchmark/REAL-EMBEDDINGS.md +

+ +

Crash recovery

+

+ The cost bench runs the built package in an isolated home, captures N observations, kills the whole process + tree with SIGKILL, boots it again and checks that nothing was lost. +

+
    + {RECOVERY_FACTS.map((f) => ( +
  • + {f.value} {f.label} +
  • + ))} +
+

+ docs/benchmarks/capture-costs.svg{" "} + benchmark/README.md +

+ +

Resource budgets

+

+ The cost bench checks each run against these ceilings. They were derived from repeated runs, taking the worst run plus + headroom, so they are upper limits rather than typical values, and they depend on the machine that runs them. + The embed profile uses 768-dimension vectors. +

+
+ + + + + + + + + + + + + + {BUDGETS.map((b) => ( + + + + + + + + + + ))} + +
ProfileObservationsHook p95Index ready after killDisk per observationIdle memorySearch tokens p50
{b.profile}{b.n.toLocaleString("en-US")}{b.hookP95Ms} ms{sec(b.recoveryIndexReadyMs)}{kib(b.diskPerObsBytes)}{mib(b.idleRssKiB)}{b.searchTokensP50}
+
+

+ benchmark/capture-costs-budgets.json +

+ +

Reproduce

+

Retrieval, from the repository root, after downloading the dataset:

+
+          {`${REPRODUCE.download}\n\n${REPRODUCE.bm25}\n${REPRODUCE.hybrid}`}
+        
+

Costs and crash recovery, against the built package:

+
+          {REPRODUCE.costs}
+        
+

+ Scripts: benchmark/longmemeval-bench.ts{" "} + benchmark/real-embeddings-eval.ts +

+
+ + ); +} diff --git a/website/app/changelog/changelog.module.css b/website/app/changelog/changelog.module.css new file mode 100644 index 0000000000..61a13bb732 --- /dev/null +++ b/website/app/changelog/changelog.module.css @@ -0,0 +1,116 @@ +.layout { + display: grid; + grid-template-columns: 200px minmax(0, 1fr); + gap: clamp(24px, 5vw, 72px); + align-items: start; +} + +.toc { + position: sticky; + top: 84px; + display: grid; + gap: var(--s-3); +} + +.toc > :global(.mono) { + font-size: var(--t-12); + letter-spacing: var(--track-mono); + text-transform: uppercase; + color: var(--muted); +} + +.toc ul { + list-style: none; + margin: 0; + padding: 0; + display: grid; + gap: 2px; + border-left: 1px solid var(--line); +} + +.toc a { + display: flex; + justify-content: space-between; + gap: var(--s-2); + padding: 4px 0 4px 12px; + margin-left: -1px; + border-left: 1px solid transparent; + font-size: var(--t-12); + color: var(--muted); + transition: color var(--dur-1) ease, border-color var(--dur-1) ease; +} + +.toc a :global(.mono) { + color: var(--ink-2); +} + +.toc a:hover { + color: var(--ink); + border-left-color: var(--ink); +} + +.releases { + display: grid; + gap: var(--s-8); + min-width: 0; +} + +.release { + display: grid; + gap: var(--s-4); + scroll-margin-top: 84px; + min-width: 0; +} + +.head { + display: flex; + align-items: baseline; + gap: var(--s-4); + padding-bottom: var(--s-3); + border-bottom: 1px solid var(--line); +} + +.head h2 { + font-size: var(--t-31); + letter-spacing: var(--track-head); +} + +.head h2 a:hover { + text-decoration: underline; + text-underline-offset: 4px; +} + +.head time { + font-size: var(--t-12); + color: var(--muted); +} + +.release :global(ul ul) { + margin-top: var(--s-2); +} + +.release :global(h3) { + font-size: var(--t-20); +} + +.more { + padding-top: var(--s-4); +} + +@media (max-width: 900px) { + .layout { + grid-template-columns: minmax(0, 1fr); + } + .toc { + position: static; + } + .toc ul { + grid-template-columns: repeat(2, minmax(0, 1fr)); + border-left: 0; + gap: 0 var(--s-4); + } + .toc a { + padding-left: 0; + border-left: 0; + } +} diff --git a/website/app/changelog/page.tsx b/website/app/changelog/page.tsx new file mode 100644 index 0000000000..06b913bf59 --- /dev/null +++ b/website/app/changelog/page.tsx @@ -0,0 +1,83 @@ +import type { Metadata } from "next"; +import changelog from "@/lib/generated-changelog.json" with { type: "json" }; +import { DocPage, Prose } from "@/components/site/Doc"; +import { Markdown } from "@/lib/markdown"; +import { src } from "@/lib/site"; +import s from "./changelog.module.css"; + +export const metadata: Metadata = { + title: "Changelog", + description: "Every agentmemory release: what changed, what was fixed, and what to do when you upgrade.", + alternates: { canonical: "/changelog" }, +}; + +interface Release { + version: string; + date: string; + body: string; +} + +function formatDate(d: string) { + if (!d) return ""; + const date = new Date(`${d}T00:00:00Z`); + return date.toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric", timeZone: "UTC" }); +} + +export default function ChangelogPage() { + const releases = changelog as Release[]; + return ( + + The latest {releases.length} releases, generated from{" "} + + CHANGELOG.md + {" "} + when the site builds. Older releases are on GitHub. + + } + > +
+ +
+ {releases.map((r) => ( +
+
+

+ v{r.version} +

+ {r.date && ( + + )} +
+ + + +
+ ))} +

+ + All releases on GitHub + +

+
+
+
+ ); +} diff --git a/website/app/globals.css b/website/app/globals.css index d47226785a..e36c12024f 100644 --- a/website/app/globals.css +++ b/website/app/globals.css @@ -1,178 +1,358 @@ :root { - --canvas: #0a0a0a; - --canvas-soft: #1a1c20; - --canvas-card: #191919; - --canvas-mid: #363a3f; - --hairline: #212327; - --ink: #ffffff; - --ink-hover: #fafaf7; - --body: #dadbdf; - --mute: #7d8187; - --sunset: #ff7a17; - --sunset-soft: #ffc285; - --breeze: #a0c3ec; - --ok: #7fce9a; - --radius-card: 8px; - --radius-pill: 9999px; - --border-ghost: rgba(255, 255, 255, 0.25); -} - -* { + --bg: #fafafa; + --surface: #ffffff; + --sunk: #f2f2f2; + --ink: #0a0a0a; + --ink-2: #3a3a3a; + --muted: #6b6b6b; + --faint: #a3a3a3; + --line: #e6e6e6; + --line-2: #d0d0d0; + --invert-bg: #0a0a0a; + --invert-ink: #fafafa; + --dot: rgba(10, 10, 10, 0.16); + --dot-on: #0a0a0a; + --shadow: 0 1px 0 rgba(0, 0, 0, 0.04), 0 8px 24px -12px rgba(0, 0, 0, 0.12); + --accent: #ff7a17; + --accent-strong: #e26a0f; + --accent-ink: #b8520a; + --accent-soft: rgba(255, 122, 23, 0.12); + + --t-12: 0.75rem; + --t-14: 0.875rem; + --t-16: 1rem; + --t-20: 1.25rem; + --t-25: 1.5625rem; + --t-31: clamp(1.5rem, 1.2rem + 1.2vw, 1.953rem); + --t-39: clamp(1.75rem, 1.3rem + 1.9vw, 2.441rem); + --t-49: clamp(2rem, 1.3rem + 2.9vw, 3.052rem); + --t-76: clamp(2.5rem, 1.2rem + 5.4vw, 4.768rem); + + --lh-tight: 1.04; + --lh-snug: 1.2; + --lh-body: 1.6; + --track-display: -0.035em; + --track-head: -0.02em; + --track-mono: 0.06em; + + --s-1: 4px; + --s-2: 8px; + --s-3: 12px; + --s-4: 16px; + --s-5: 24px; + --s-6: 32px; + --s-7: 48px; + --s-8: 64px; + --s-9: 96px; + --s-10: 128px; + + --radius: 6px; + --radius-lg: 10px; + --max: 1200px; + --gutter: clamp(16px, 4vw, 40px); + + --ease-out: cubic-bezier(0.23, 1, 0.32, 1); + --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1); + --dur-1: 160ms; + --dur-2: 240ms; + --dur-3: 420ms; + + color-scheme: light; +} + +@media (prefers-color-scheme: dark) { + :root:not([data-theme="light"]) { + --bg: #0a0a0a; + --surface: #111111; + --sunk: #161616; + --ink: #f2f2f2; + --ink-2: #c8c8c8; + --muted: #8f8f8f; + --faint: #5c5c5c; + --line: #222222; + --line-2: #333333; + --invert-bg: #f2f2f2; + --invert-ink: #0a0a0a; + --dot: rgba(242, 242, 242, 0.16); + --dot-on: #f2f2f2; + --shadow: 0 1px 0 rgba(255, 255, 255, 0.03), 0 8px 24px -12px rgba(0, 0, 0, 0.6); + --accent-ink: #ff8f5e; + --accent-soft: rgba(255, 122, 23, 0.16); + color-scheme: dark; + } +} + +:root[data-theme="dark"] { + --bg: #0a0a0a; + --surface: #111111; + --sunk: #161616; + --ink: #f2f2f2; + --ink-2: #c8c8c8; + --muted: #8f8f8f; + --faint: #5c5c5c; + --line: #222222; + --line-2: #333333; + --invert-bg: #f2f2f2; + --invert-ink: #0a0a0a; + --dot: rgba(242, 242, 242, 0.16); + --dot-on: #f2f2f2; + --shadow: 0 1px 0 rgba(255, 255, 255, 0.03), 0 8px 24px -12px rgba(0, 0, 0, 0.6); + --accent-ink: #ff8f5e; + --accent-soft: rgba(255, 122, 23, 0.16); + color-scheme: dark; +} + +*, +*::before, +*::after { box-sizing: border-box; } -html, +html { + -webkit-text-size-adjust: 100%; + scroll-padding-top: 72px; +} + body { margin: 0; - padding: 0; - background: var(--canvas); - color: var(--body); - font-family: var(--font-sans), Inter, system-ui, -apple-system, sans-serif; - font-size: 16px; - line-height: 1.5; + background: var(--bg); + color: var(--ink-2); + font-family: var(--font-sans), system-ui, -apple-system, sans-serif; + font-size: var(--t-16); + line-height: var(--lh-body); -webkit-font-smoothing: antialiased; - scroll-behavior: smooth; + -moz-osx-font-smoothing: grayscale; + text-rendering: optimizeLegibility; + overflow-x: clip; +} + +h1, +h2, +h3, +h4 { + color: var(--ink); + margin: 0; + font-weight: 560; + letter-spacing: var(--track-head); + line-height: var(--lh-snug); + text-wrap: balance; +} + +p { + margin: 0; + text-wrap: pretty; } a { color: inherit; text-decoration: none; - transition: color 160ms ease; -} -a:hover { - color: var(--ink); } button { - font-family: inherit; - cursor: pointer; - background: none; - border: none; + font: inherit; color: inherit; + background: none; + border: 0; + padding: 0; + cursor: pointer; +} + +code, +kbd, +pre, +.mono { + font-family: var(--font-mono), ui-monospace, "SF Mono", Menlo, monospace; +} + +img, +svg, +canvas { + display: block; + max-width: 100%; +} + +img, +video { + filter: grayscale(1); } :focus-visible { - outline: 2px solid rgba(255, 255, 255, 0.55); + outline: 2px solid var(--accent); outline-offset: 3px; + border-radius: 2px; } ::selection { - background: var(--sunset); - color: var(--canvas); + background: var(--accent); + color: #0a0a0a; } -/* Reveal animation */ -.reveal { - opacity: 0; - transform: translateY(32px); - transition: opacity 600ms ease, - transform 600ms cubic-bezier(0.2, 0.8, 0.2, 1); +.wrap { + width: 100%; + max-width: var(--max); + margin: 0 auto; + padding: 0 var(--gutter); } -.reveal.is-visible { - opacity: 1; - transform: translateY(0); + +.eyebrow { + font-family: var(--font-mono), ui-monospace, monospace; + font-size: var(--t-12); + letter-spacing: var(--track-mono); + text-transform: uppercase; + color: var(--accent-ink); + display: inline-flex; + align-items: center; + gap: var(--s-2); } -@media (prefers-reduced-motion: reduce) { - *, - *::before, - *::after { - animation-duration: 0.001ms !important; - transition-duration: 0.001ms !important; - } +.eyebrow::before { + content: ""; + width: 6px; + height: 6px; + background: var(--accent); + border-radius: 1px; +} + +.section { + padding: var(--s-10) 0; + border-top: 1px solid var(--line); + position: relative; +} + +.section-head { + display: grid; + gap: var(--s-4); + max-width: 760px; + margin-bottom: var(--s-8); +} + +.section-head h2 { + font-size: var(--t-49); + letter-spacing: var(--track-display); + line-height: 1.08; +} + +.section-head p { + font-size: var(--t-20); + line-height: 1.5; + color: var(--muted); + max-width: 640px; } -/* Buttons shared — pill shapes, quiet states */ .btn { display: inline-flex; align-items: center; - justify-content: center; - gap: 8px; - padding: 12px 24px; - font-size: 14px; - font-weight: 500; - letter-spacing: 0; - line-height: 20px; - border: 1px solid transparent; - border-radius: var(--radius-pill); - transition: - background 200ms ease, - color 200ms ease, - border-color 200ms ease, - opacity 200ms ease; - cursor: pointer; + gap: var(--s-2); + height: 44px; + padding: 0 var(--s-5); + border-radius: var(--radius); + font-size: var(--t-14); + font-weight: 520; + white-space: nowrap; + transition: transform var(--dur-1) var(--ease-out), background-color var(--dur-1) ease, + border-color var(--dur-1) ease, color var(--dur-1) ease; +} + +.btn:active { + transform: scale(0.97); } -.btn--accent { + +.btn-solid { background: var(--ink); - color: var(--canvas); - border-color: var(--ink); - padding: 14px 28px; -} -.btn--accent:hover { - background: var(--ink-hover); - border-color: var(--ink-hover); - color: var(--canvas); -} -.btn--sunset { - background: var(--sunset); - color: var(--canvas); - border-color: var(--sunset); - padding: 14px 28px; -} -.btn--sunset:hover { - background: #ff8b35; - border-color: #ff8b35; - color: var(--canvas); -} -.btn--ghost { - background: transparent; - color: var(--ink); - border-color: var(--border-ghost); + color: var(--bg); } -.btn--ghost:hover { - background: rgba(255, 255, 255, 0.06); - border-color: var(--border-ghost); + +.btn-ghost { + border: 1px solid var(--line-2); color: var(--ink); } -.btn--small { - padding: 8px 16px; - font-size: 13px; + +@media (hover: hover) and (pointer: fine) { + .btn-solid:hover { + background: var(--ink-2); + } + .btn-ghost:hover { + border-color: var(--ink); + } } -/* Shared section head */ -.section-head { - max-width: 1200px; - margin: 0 auto 56px; - padding: 0 40px; -} -.section-eyebrow { - display: inline-block; - font-family: var(--font-mono), ui-monospace, SFMono-Regular, Menlo, monospace; - font-size: 12px; - letter-spacing: 1.4px; - color: var(--mute); - text-transform: uppercase; - margin-bottom: 20px; +.reveal { + opacity: 0; + transform: translateY(12px); + transition: opacity 700ms var(--ease-out), transform 700ms var(--ease-out); + transition-delay: var(--d, 0ms); } -.section-title { - font-size: clamp(34px, 4.6vw, 56px); - font-weight: 400; - line-height: 1.06; - letter-spacing: -0.03em; - color: var(--ink); - margin: 0 0 20px; - text-wrap: balance; + +.reveal.is-in { + opacity: 1; + transform: none; } -.section-lede { - max-width: 660px; - font-size: 16px; - line-height: 1.65; - color: var(--body); - margin: 0; + +.src { + font-family: var(--font-mono), ui-monospace, monospace; + font-size: var(--t-12); + color: var(--muted); + border-bottom: 1px dotted var(--line-2); + transition: color var(--dur-1) ease, border-color var(--dur-1) ease; +} + +.src:hover { + color: var(--accent-ink); + border-color: var(--accent); +} + +.theme-dark-only { + display: none !important; +} + +:root[data-theme="dark"] .theme-dark-only { + display: block !important; +} + +:root[data-theme="dark"] .theme-light-only { + display: none !important; +} + +@media (prefers-color-scheme: dark) { + :root:not([data-theme="light"]) .theme-dark-only { + display: block !important; + } + :root:not([data-theme="light"]) .theme-light-only { + display: none !important; + } +} + +.sr-only { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + white-space: nowrap; + border: 0; } -@media (max-width: 640px) { +@media (max-width: 720px) { + .section { + padding: var(--s-9) 0; + } .section-head { - padding: 0 20px; + margin-bottom: var(--s-7); + } + .section-head p { + font-size: var(--t-16); + } +} + +@media (prefers-reduced-motion: reduce) { + .reveal { + opacity: 1; + transform: none; + transition: none; + } + html { + scroll-behavior: auto; } } diff --git a/website/app/layout.tsx b/website/app/layout.tsx index d7eca9dbb0..68fb88cdcd 100644 --- a/website/app/layout.tsx +++ b/website/app/layout.tsx @@ -1,57 +1,67 @@ import type { Metadata, Viewport } from "next"; -import { Inter, JetBrains_Mono } from "next/font/google"; +import { Geist, Geist_Mono } from "next/font/google"; import "./globals.css"; +import { SITE_URL } from "@/lib/site"; -const inter = Inter({ +const sans = Geist({ subsets: ["latin"], variable: "--font-sans", display: "swap", }); -const jetbrains = JetBrains_Mono({ +const mono = Geist_Mono({ subsets: ["latin"], - weight: ["400", "500"], variable: "--font-mono", display: "swap", }); +const description = + "Persistent memory for AI coding agents. agentmemory captures what your agent did, keeps it on your machine, and hands the right context back in the next session. Open source, Apache-2.0."; + export const metadata: Metadata = { - metadataBase: new URL("https://agentmemory.dev"), - title: "agentmemory: persistent memory for AI coding agents", - description: - "Persistent memory for AI coding agents. Capture every session, recall it in the next one. Runs locally with zero external databases. Works with every MCP client.", + metadataBase: new URL(SITE_URL), + title: { + default: "agentmemory: persistent memory for AI coding agents", + template: "%s · agentmemory", + }, + description, + alternates: { canonical: "/" }, icons: { icon: [{ url: "/icon.svg", type: "image/svg+xml" }], apple: "/icon.svg", }, openGraph: { title: "agentmemory", - description: - "Persistent memory for AI coding agents. Runs locally. Zero external databases.", + description, type: "website", url: "/", + siteName: "agentmemory", }, twitter: { card: "summary_large_image", title: "agentmemory", - description: - "Persistent memory for AI coding agents. Runs locally. Zero external databases.", + description, }, }; export const viewport: Viewport = { - themeColor: "#0a0a0a", + themeColor: [ + { media: "(prefers-color-scheme: light)", color: "#fafafa" }, + { media: "(prefers-color-scheme: dark)", color: "#0a0a0a" }, + ], width: "device-width", initialScale: 1, }; -export default function RootLayout({ - children, -}: { - children: React.ReactNode; -}) { +const themeScript = `try{var t=localStorage.getItem("am-theme");if(t==="light"||t==="dark")document.documentElement.dataset.theme=t}catch(e){}`; + +export default function RootLayout({ children }: { children: React.ReactNode }) { return ( - + + +