marketplace.json was missing required top-level name and owner fields,
and plugins[].source was incorrectly named path. Fixes plugin install
validation error in Claude Code.
Performance:
- auto-forget.ts (#29): concept-bucketed contradiction detection with
pre-tokenized cache, O(n * avg_bucket) instead of O(n^2)
- consolidate.ts (#28): cap LLM calls at 10, process largest concept
groups first
- vector-index.ts (#30): bounded min-heap search replaces full sort,
early skip for low-scoring entries
Scheduling (#36):
- index.ts: setInterval auto-forget (1h default) and consolidation
(2h, opt-in via CONSOLIDATION_ENABLED=true)
- Configurable via AUTO_FORGET_INTERVAL_MS, CONSOLIDATION_INTERVAL_MS
- Timers use .unref() to not prevent process exit
Memory TTL (#63):
- remember.ts: optional ttlDays parameter auto-sets forgetAfter
Plugin (#75):
- plugin.json: version 0.2.0 -> 0.6.0
Closes#28#29#30#36#63#75
- Fix main/bin/start to use .mjs extension (tsdown outputs ESM)
- Remove duplicate shebang banner from standalone build config
- Update integration test: health status "healthy" (v0.4.0), viewer HTML check
- Add POST body to pre-compact hook for claude-bridge sync
* feat: agentmemory v0.4.0 — the memory layer for all AI coding agents
7 new features: Claude Code memory bridge, standalone cross-agent MCP server,
knowledge graph with entity extraction, 4-tier memory consolidation pipeline,
team/shared memory, memory governance with audit trail, git-versioned snapshots.
33 functions, 18 MCP tools, 6 MCP resources, 3 MCP prompts, 49 REST endpoints,
21 KV scopes, 216 tests. All features opt-in via env vars.
* fix: address 28 CodeRabbit findings across v0.4.0 codebase
Critical: Fix bin path mismatch (dist/mcp-standalone.mjs -> dist/standalone.mjs)
Bugs: Fix procedural decay, parseFloat||0.5 for zero values, snapshot restore
missing graphNodes/observations, git catch too broad, N+1 graph query, BFS
duplicate edges, array mutation in audit sort, date validation
Improvements: Lazy readline in transport, JSON-RPC validation, persist error
handling, ID collision prevention, defensive null coalescing for concepts/files,
Windows backslash support in config, direction required for bridge sync tool,
try-catch for audit/governance MCP, team profile fallback teamId, POST body for
bridge sync hook, observations validation for graph-extract endpoint, await in test
* feat: agentmemory v0.4.0 — MCP resources, prompts, enrichment, confidence
Add 4 MCP resources (status, project profile, recent sessions, latest memories),
3 MCP prompts (recall_context, session_handoff, detect_patterns), confidence-scored
memory relations, and a unified enrich endpoint that aggregates file context,
relevant observations, and past bug memories for PreToolUse hook injection.
- Add confidence field to MemoryRelation with auto-scoring from co-occurrence,
recency, and relation type
- Add mem::enrich function aggregating 3 sources with resilient .catch() fallbacks
- Add POST /agentmemory/enrich REST endpoint
- Switch PreToolUse hook from file-context to enrich endpoint with search term extraction
- Add minConfidence filter and confidence-desc sorting to mem::get-related
- 27 new tests (171 total), all passing
* fix: address review findings — input validation, XML escaping, confidence scoring
- enrich.ts: Sort bug memories by recency before slicing top 3; add escapeXml()
for narratives and bug content injected into XML tags
- relations.ts: Use filter+max instead of find() for matchingRelation to pick
highest confidence when multiple edges exist; normalize minConfidence with
Number.isFinite + clamp to [0,1]
- mcp/server.ts: Guard decodeURIComponent with try/catch returning 400 on
malformed percent-encoding; use typeof checks for prompt args instead of
truthy checks; normalize minConfidence/maxHops at MCP layer
- api.ts: Validate files[] and terms[] element types are strings before
calling mem::enrich
- Tests: Add malformed URI and non-string prompt arg test cases (173 total)
New hooks (7):
- PreToolUse: inject file history before edits (Edit/Write/Read/Glob/Grep)
- PostToolUseFailure: capture error patterns for learning
- PreCompact: preserve memory context through compaction
- SubagentStart/SubagentStop: track multi-agent workflows
- Notification: capture permission prompts (tool preferences)
- TaskCompleted: track team task completions
New functions (4):
- mem::file-context: file-centric memory index for PreToolUse
- mem::consolidate: merge observations into long-term memories via LLM
- mem::patterns + mem::generate-rules: detect co-change patterns and recurring errors
- mem::remember + mem::forget: explicit save/delete for long-term memory
MCP server (2 endpoints):
- GET /agentmemory/mcp/tools: list 5 MCP tools (recall, save, file_history, patterns, sessions)
- POST /agentmemory/mcp/call: dispatch tool calls to iii functions
Skills (4):
- /recall [query]: search past observations
- /remember [insight]: save to long-term memory
- /session-history: show past session timeline
- /forget [target]: delete specific memory data
New API endpoints (7):
- POST /agentmemory/file-context
- POST /agentmemory/remember
- POST /agentmemory/forget
- POST /agentmemory/consolidate
- POST /agentmemory/patterns
- POST /agentmemory/generate-rules
- GET/POST /agentmemory/mcp/*
Updated: types (7 new HookTypes, 3 new ObservationTypes), version 0.2.0
1. events.ts: Event triggers were calling api:: functions which
require ApiRequest shape and auth headers. Rewrote to call
core functions (kv.set, sdk.trigger) directly, bypassing auth.
2. All 5 hooks: Missing AGENTMEMORY_SECRET auth header. If secret
was set, every hook would get 401 from the API. Now all hooks
read AGENTMEMORY_SECRET and send Bearer token.
3. observe.ts: stripPrivateData on JSON string could break JSON
structure when replacement text differs in length. Added
try/catch fallback to string coercion.
4. post-tool-use.ts: truncate() for objects did
JSON.parse(str.slice(0, max-1) + '}') which produces invalid
JSON in nearly all cases. Changed to return truncated string.
5. compress.ts: LLM-returned importance was not clamped to 1-10
range. Added Math.max(1, Math.min(10, ...)) with NaN fallback.
6. compress.ts: LLM-returned observation type was not validated
against ObservationType union. Invalid types now fall back to
"other".
7. context.ts: Token estimate for observation blocks only counted
inner content, not the "## Session..." header. Fixed to estimate
the full block text.
8. viewer: WebSocket port now configurable via ?wsPort= query param
for non-default III_STREAMS_PORT configurations.
9. plugin/scripts: Rebuilt with auth header support matching the
updated hook source files.