github rohitg00/agentmemory v0.9.9
v0.9.9 — pinned slot injection + MiniMax env loader

3 hours ago

Two field-reported regressions closed: pinned memory slots never reached SessionStart context (the renderPinnedContext and listPinnedSlots helpers shipped in v0.7 had no callers), and the MiniMax compression provider read its base URL straight off process.env, missing ~/.agentmemory/.env values that the rest of agentmemory loads through the shared merged-env path.

Fixed

Pinned memory slots are now actually injected into SessionStart context

@wyh0626 traced (#286) that renderPinnedContext (src/functions/slots.ts:182) and listPinnedSlots (src/functions/slots.ts:169) — introduced in #182 — had zero callers in src/:

$ git grep renderPinnedContext src/
src/functions/slots.ts:182:export function renderPinnedContext(...)

$ git grep listPinnedSlots src/
src/functions/slots.ts:169:export async function listPinnedSlots(...)

mem::context (the function /agentmemory/session/start invokes and that session-start.mjs reads back into Claude Code) read profile / sessions / summaries / observations but never slots, so anything an agent wrote into a pinned slot via mem::slot-replace / mem::slot-append / mem::slot-reflect sat in KV and never reached the next session.

The mem::slot-reflect writer fires on the Stop hook when AGENTMEMORY_REFLECT=true and persists into pending_items / session_patterns / project_context — the reflect → next-session loop was open.

The fix wires listPinnedSlotsrenderPinnedContext into mem::context behind isSlotsEnabled(), matching the existing isGraphExtractionEnabled() gate convention:

if (isSlotsEnabled()) {
  const slotContent = renderPinnedContext(
    await listPinnedSlots(kv).catch(() => []),
  );
  if (slotContent) {
    blocks.push({
      type: "memory",
      content: slotContent,
      tokens: estimateTokens(slotContent),
      recency: Date.now(),
    });
  }
}

recency: Date.now() so the pinned block sorts to the top of the budget-bounded selection.

Verify:

# server: AGENTMEMORY_SLOTS=true AGENTMEMORY_INJECT_CONTEXT=true
curl -X POST localhost:3111/agentmemory/slot/replace \
  -H 'Content-Type: application/json' \
  -d '{"label":"tool_guidelines","content":"rule-alpha"}'

curl -X POST localhost:3111/agentmemory/session/start \
  -H 'Content-Type: application/json' \
  -d '{"sessionId":"s1","project":"/tmp","cwd":"/tmp"}'

Before: "context": "" (0 chars).
After: context contains the tool_guidelines slot wrapped in <agentmemory-context>.

AGENTMEMORY_SLOTS=false (the default) keeps the existing behaviour untouched.

(#288, closes #286 — thanks @wyh0626 for the precise zero-callers trace and the six-case regression suite covering global / multi-sort / unpinned-skip / empty-skip / project-shadows-global / gate-off)

MiniMax provider now honors MINIMAX_BASE_URL from ~/.agentmemory/.env, with the default pointed at the current Anthropic-compatible host

@rager306 reported (#285) v0.9.8 MiniMax compression failing MiniMax API error 401: invalid api key against a verified-good key:

  • Direct curl https://api.minimax.io/anthropic/v1/messages with the same key → 200 OK.
  • Control curl https://api.minimaxi.com/anthropic/v1/messages with the same key → 401.

The 401 was the stale fallback host answering — the key was fine.

Root cause: split-brain env source. src/config.ts (provider detection + API-key load) reads ~/.agentmemory/.env through the merged getMergedEnv() loader; src/providers/minimax.ts read MINIMAX_BASE_URL straight off process.env:

// before
this.baseUrl =
  process.env['MINIMAX_BASE_URL'] || 'https://api.minimaxi.com/anthropic'

Deployments that kept MiniMax config in ~/.agentmemory/.env only (systemd / launchd / --env-file not exported into the worker shell) got the key loaded but the base URL fell through to the stale default.

The provider now resolves MINIMAX_BASE_URL via getEnvVar() (same merged loader the rest of agentmemory uses), and the default is bumped from api.minimaxi.com to api.minimax.io/anthropic per MiniMax's current Anthropic-compatible docs:

// after
this.baseUrl =
  getEnvVar('MINIMAX_BASE_URL') || 'https://api.minimax.io/anthropic'

Existing users on the legacy host can still override via MINIMAX_BASE_URL either in ~/.agentmemory/.env or the process env.

(#289, closes #285 — thanks @rager306 for the precise repro and the local-patch verification)

Changed

  • @agentmemory/mcp package version bumped 0.9.8 → 0.9.9 to lockstep with the main package.

Install / upgrade

npm i -g @agentmemory/agentmemory@0.9.9
# or
npx @agentmemory/agentmemory

# MCP standalone shim
npx -y @agentmemory/mcp

Full changelog: v0.9.8...v0.9.9

Don't miss a new agentmemory release

NewReleases is sending notifications on new releases.