Repository navigation
feat(aml): AML Cycle 2 Add/Search adapter for AutoMem - #29
jack-arturo wants to merge 1 commit into
Conversation
Dependency-free Node HTTP adapter for the Agent Memory Leaderboard Add/Search contract. /add stores each message in AutoMem before echoing the AML ids (idempotent per request_id), /search returns ranked evidence scoped to the exact user_id, /health probes AutoMem. Search pins tag_match=exact and disables relation/entity expansion and scope fallback rather than relying on server defaults, so one AML user can never see another's records. Refs #28 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e2b2aeb5d4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
|
|
||
| const baseUrl = automemUrl.replace(/\/+$/, ''); | ||
| const completedAdds = new Map(); |
There was a problem hiding this comment.
Persist idempotency across concurrent requests and replicas
When AML retries while the original /add is still in flight, after a process restart, or against the second replica recommended by the README, this process-local map has no completed entry, so the request writes every message again. That violates the endpoint's advertised idempotency and can corrupt recall results with duplicate memories; request IDs need a durable, shared, atomically claimed record rather than an instance-local post-write cache.
Useful? React with 👍 / 👎.
| if (writes.some(upstream => !upstream.ok)) { | ||
| detail(response, 503, 'AutoMem could not persist the memory'); | ||
| return; |
There was a problem hiding this comment.
Clean up or deduplicate partially successful adds
When one message write fails but another succeeds, this returns 503 while leaving the successful memory in AutoMem; the expected AML retry then writes that message again because the request is not recorded as completed. Network rejection is worse because Promise.all can reject while other writes remain in flight. Persist each message idempotently or delete successful writes before reporting failure so a transient upstream error cannot duplicate part of a conversation.
Useful? React with 👍 / 👎.
| method: 'POST', | ||
| headers: upstreamHeaders(automemApiKey), | ||
| body: JSON.stringify({ | ||
| content: formatMessage(message), |
There was a problem hiding this comment.
Handle messages above AutoMem's content limit
When a valid Add request contains an individual message longer than AutoMem's verified 50,000-character /memory limit but remains below this adapter's 1 MB body limit, validation accepts it and forwards it unchanged, causing AutoMem to reject the write and the adapter to report a misleading 503. The repository already guards this limit in runners/beam_shim.py; this adapter should likewise chunk the content or reject it as a contract error before calling AutoMem.
Useful? React with 👍 / 👎.
Live smoke against a local AutoMemStack: a fresh
Readiness finding: vectors land after
|
|
Status: blocked on the explicit human owner sign-off in #28 (division/route, frozen AutoMem version, and public deployment target). Verified current head |
|
Backlog triage (2026-09-28): rechecked current head |
Summary
Adds
runners/aml/: a dependency-free Node adapter that exposes AutoMem through the Agent Memory Leaderboard Add/Search contract, for the Cycle 2 entry (opens 2026-09-20).POST /addwrites every message to AutoMem before echoing the AML ids. It is idempotent perrequest_id, returning 409 for a conflicting replay. It stores the message timestamp and AML ids as memorytimestamp/metadata, witht_invalidset 30 days out.POST /searchrecalls only the exactuser_id(hashed tag). It pinstag_match=exact,expand_relations=false,expand_entities=falseandscope_fallback=falserather than trusting server defaults (thetag_matchdefault isprefix).GET /healthreturns 503 when AutoMem is down.This ports an adapter first built in a private repo and merges in hardening from a duplicate implementation there. Closes nothing yet. The submission itself is gated by #28.
Verification
node --test runners/aml/adapter.test.mjs→ 5/5 pass: Add/echo, scoped Search, cross-user isolation, pinned recall options, idempotency/409, 401/413/422, and 503 health.recallParams()→ HTTP 200, server echoedtag_match: exact, 0 results for an unknown user. This shows the server accepts the pinned params.PORT=18790 node runners/aml/server.mjs→/health503 with AutoMem unreachable,/searchwith an empty query → 422.runners/aml/smoke-live.mjs, which does a write → search → delete round trip. No local AutoMem was up, and I didn't want to write to production without asking. The pre-port version passed it against real AutoMem. The Docker build was also not run (Docker daemon down).Before submission
Owner sign-off is required before any AML evaluation request, smoke, Full run, or publication request. The remaining steps are listed in #28.
🤖 Generated with Claude Code