Skip to content

feat(memorycd): AutoMem adapter overlay for the MemoryCD harness - #35

Draft
jack-arturo wants to merge 1 commit into
mainfrom
feat/memorycd-adapter
Draft

jack-arturo wants to merge 1 commit into
mainfrom
feat/memorycd-adapter

Conversation

@jack-arturo

Copy link
Copy Markdown
Member

Refs #30

Summary

This ports the MemoryCD AutoMem adapter into runners/memorycd/. It was first built in a private automation repo and landed there by mistake. Draft: the only evidence is a 4-user smoke.

The adapter is an overlay for a clean upstream AgentMemoryWorld/MemoryCD clone. This repo does not vendor the harness or its data.

  • automem_method.py: AutoMemMethod, stdlib-only HTTP. For each user it ingests interactions plus one domain-profile node per (user, domain). It links interactions to their profile with PART_OF and the profiles to each other with pairwise RELATES_TO. Recall uses expand_relations=true, scoped to run and user tags.
  • apply_automem_method.py: copies the method into a clone, registers --method automem, and adds an optional anthropic LLM provider.
  • anthropic_compat.py: an OpenAI-chat-shaped wrapper for that provider.
  • create_subset.py: a deterministic small-subset builder.
  • test_automem_method.py: the request-shape contract test.
  • README.md: the former benchmark doc, covering setup, env vars, the run command, the smoke result and known limitations.

Smoke result (2026-09-13): 4 users, not statistically meaningful

Rating prediction with a Books target and Electronics memory, K=4, one held-out rating per user, claude-sonnet-4-6:

Setting Method MAE RMSE
Cross-domain BM25 RAG 0.50 0.71
Cross-domain AutoMem 0.50 0.71
Single-domain BM25 RAG 0.25 0.50
Single-domain AutoMem 0.50 0.71

There is no measurable cross-domain gain. Four users with one prediction each shows only that the pipeline runs end to end. Next steps are in the README and #30: 100+ users per setting, plain vs relation-expanded recall, then a go/no-go.

Port and sanitization

  • Dropped the Node wrapper that loaded the private repo's .env. The README documents AUTOMEM_API_URL, AUTOMEM_API_KEY / AUTOMEM_API_TOKEN, LLM_PROVIDER, and OPENAI_API_KEY / OPENROUTER_API_KEY / ANTHROPIC_API_KEY instead. You now run the clone's .venv/bin/python directly.
  • AutoMemMethod's fallback URL changed from the private repo's local mirror port to this repo's local-stack default, http://localhost:8001. Env-var precedence is unchanged.
  • The usage string now points at runners/memorycd/.
  • Removed from the docs: local absolute and /tmp paths, internal run ids and probe tags, private issue links and tracking labels, and wording about the state of specific credentials. Tracking now points at MemoryCD (ICLR 2026 workshop): cross-domain personalization eval for AutoMem relation linking #30.
  • New in the README, under known limitations (found while porting, code unchanged):
    • The method never deletes what it ingests.
    • user_id is an optional keyword the overlay does not wire into the harness. If upstream omits it, every user shares one anonymous tag and recall competes across users. Check this before a larger run.
    • The Anthropic wrapper hard-codes max_tokens=16, which suits rating_prediction only.
  • Python stays stdlib-only in this repo. anthropic is imported lazily and installed only in the MemoryCD clone's venv.
  • No experiment-registry record was added.

Verification

$ python3 runners/memorycd/test_automem_method.py
AutoMemMethod contract test passed

$ for f in runners/memorycd/*.py; do python3 -m py_compile "$f" && echo "py_compile $f: ok"; done
py_compile runners/memorycd/anthropic_compat.py: ok
py_compile runners/memorycd/apply_automem_method.py: ok
py_compile runners/memorycd/automem_method.py: ok
py_compile runners/memorycd/create_subset.py: ok
py_compile runners/memorycd/test_automem_method.py: ok

$ python3 runners/memorycd/apply_automem_method.py
usage: apply_automem_method.py /path/to/MemoryCD
$ python3 runners/memorycd/apply_automem_method.py <scratch>/not-a-harness
Not a MemoryCD checkout: <scratch>/not-a-harness

The contract test needs no upstream clone. It writes a stub BaseMethod into a temp dir and patches urlopen.

create_subset.py ran on a synthetic 6-user JSONL.gz (not committed, no download). User 1 had only one Books interaction:

Wrote 4 users to <scratch>/subset.jsonl
synthetic-0 {'Books': 3, 'Electronics': 8}
synthetic-2 {'Books': 3, 'Electronics': 8}
synthetic-3 {'Books': 3, 'Electronics': 8}
synthetic-4 {'Books': 3, 'Electronics': 8}
['synthetic-0', 'synthetic-2', 'synthetic-3', 'synthetic-4'] Books >= 2; Electronics >= 1

That output shows the ineligible user skipped and source history trimmed to --max-memory-per-domain 8.

Not verified in this port:

  • There was no live AutoMem run.
  • No upstream MemoryCD clone was made, so apply_automem_method.py's text patches were not run against the current upstream files.
  • No dataset was downloaded.
  • The smoke numbers come from the pre-port run.
  • Whether the upstream harness passes user_id to select_memory is unchecked.

🤖 Generated with Claude Code

Port the MemoryCD AutoMem adapter, first built in a private automation
repo, into runners/memorycd/. It is an overlay for a clean upstream
AgentMemoryWorld/MemoryCD clone: AutoMemMethod (stdlib-only HTTP),
the apply script that registers --method automem and an optional
anthropic provider, the Anthropic compatibility wrapper, a deterministic
subset builder, and the contract test. The benchmark doc becomes the
README, including the 4-user rating-prediction smoke (AutoMem tied BM25
cross-domain, was worse single-domain; 4 users are not statistically
meaningful).

Port changes: the AutoMemMethod fallback URL moves from the private
repo's local mirror port (8780) to this repo's local-stack default,
http://localhost:8001; env var precedence is unchanged. The usage string
points at runners/memorycd/. The README now documents the no-cleanup
behaviour, unverified user_id plumbing, and the Anthropic wrapper's
max_tokens=16 cap as known limitations.

Sanitized: dropped the Node env-loading wrapper (its only job was loading the
private repo's .env) in favour of documented AUTOMEM_API_URL,
AUTOMEM_API_KEY/AUTOMEM_API_TOKEN, LLM_PROVIDER and provider key vars.
Removed local absolute and /tmp paths, internal run ids and probe tags,
private issue links and tracking labels, and credential-status wording.
Tracking is now #30.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@autohub-codex

autohub-codex Bot commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Backlog triage (2026-09-28): rechecked current head f37a49a7948594e0284dbe306506e59117f2cded against main: mergeable/CLEAN, draft, 709 additions across 6 files, with no GitHub checks and no hosted Codex review. Exact blocker: this remains an explicitly pilot-only draft with no recorded repeatable validation against a pinned upstream MemoryCD checkout. The owner must either mark it ready with that command/result (then obtain hosted review), or close it as a pilot record; it is not ready to merge as-is.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

parked-post-launch Parked until after the Dec 15 launch. Not under review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant