---
name: build-adapter
description: Use when the user wants claude-mem to work with a new agent, IDE,
or CLI (Cursor, Zed, Aider, Codex, custom agents, etc.). Researches both
claude-mem's adapter contract and the target platform's extension API in
parallel via make-plan, executes the plan via do, and opens a PR. Trigger
phrases: "add claude-mem support for X", "build a claude-mem adapter for X",
"integrate claude-mem with X", "make claude-mem work with X".
---
The user names a target agent, IDE, or CLI tool they want claude-mem to work with. Examples: Zed, Aider, Codex CLI, Continue, a custom in-house agent.
Invoke /claude-mem:make-plan with the brief below, verbatim, substituting
<TARGET> with the user's target platform name.
make-plan already knows how to orchestrate parallel Phase 0 discovery. This brief tells it exactly what to research and what anchors to use.
Build a claude-mem adapter for .
Deploy two Phase 0 discovery tracks in parallel.
Explore subagent reads and reports file:line facts from:
src/cli/adapters/index.ts— theAdapterinterface (normalizeInput, formatOutput, registration)src/cli/adapters/cursor.tsandsrc/cli/adapters/gemini-cli.ts— use these as copy-from templates. Do NOT useclaude-code.ts(too special-cased).src/cli/hook-command.ts— canonicalHookInputschemasrc/services/worker/http/routes/SessionRoutes.ts— ingestion endpoints (POST /api/sessions/observations,POST /api/sessions/summarize,GET /api/sessions/status)src/services/sqlite/migrations.ts— DB schema the adapter writes intoplugin/hooks/hooks.json— hook registration pattern (if the target has a hook mechanism)Report must include: exact
AdapterTS interface, theHookInputfield list, the three ingestion endpoints with request/response shapes, and a one-line diff betweencursor.tsandgemini-cli.tsshowing what varies between adapters.Research subagent uses
WebSearch,WebFetch, andmcp-deepwiki(if is on GitHub) to report:
- Extension/plugin/hook mechanism (name, registration location, config schema)
- Lifecycle events it emits (session start, user message, tool use, session end)
- Tool-use message format
- Session identity — is there a stable session ID the adapter can read?
- Working-directory / project-context propagation
- Prior art — existing memory, observability, or logging plugins that already hook these events. Copy their patterns.
Report must cite URLs + quoted snippets, not paraphrase. Reject and redeploy if the subagent returns conclusions without sources.
Plan the implementation as phases that COPY from
cursor.tsand adjust only where Track B says diverges.
- New file:
src/cli/adapters/<target>.ts- Register in
src/cli/adapters/index.ts- If has a hook mechanism, add a manifest under
plugin/or the appropriate location, mirroringplugin/hooks/hooks.json- If has no hook mechanism, plan uses direct HTTP POSTs to the worker instead
- Tests mirror in
tests/cli/adapters/<target>.test.tsif test convention applies
- Don't invent endpoints not in
SessionRoutes.ts- Don't populate
agent_id/agent_typeunless has true subagents- Don't edit
CHANGELOG.md(auto-generated)- Don't add a skills-registry manifest
- Don't
--no-verify/--amend/ force-push- Don't use
claude-code.tsas the copy-from template
- Smoke test:
npm run build-and-sync, then POST a synthetic observation to/api/sessions/observations, confirm it lands viaGET /api/sessions/statusgit checkout -b adapter/<target>- Commit:
feat(adapter): add <target> adaptergh pr createagainstmainwith a body summarizing both research tracks and linking the key sources
- Show the user the plan. Wait for approval.
- On approval, invoke
/claude-mem:doon the plan. dohandles verification, commit, and PR creation per its own contract.
- Target has no documented extension API and no public repo → ask the user for a docs URL before starting Track B
- Track B finds no session-ID mechanism → flag to user; a direct-HTTP adapter may still be viable but needs explicit session-ID assignment
doverification fails → do NOT open the PR; return control to user