Adds plugin/skills/build-adapter/SKILL.md — a single-file skill that hands /claude-mem:make-plan a dual-track research brief (claude-mem adapter contract + target platform extension API), then hands off to /claude-mem:do for execution and PR creation. The skill itself carries no architecture content; it names authoritative source files as anchors so subagents read live code. Trigger phrases cover "add claude-mem support for X", "build a claude-mem adapter for X", "integrate claude-mem with X", "make claude-mem work with X". Also includes the planning artifact at .plan/build-adapter-skill.md. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
4.6 KiB
build-adapter
When to use
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.
The one-shot
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.
The brief (paste into make-plan)
Build a claude-mem adapter for .
Deploy two Phase 0 discovery tracks in parallel.
Track A — claude-mem integration contract
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.Track B — platform surface
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.
Synthesis
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 appliesAnti-patterns (MUST NOT)
- 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 templateFinal phase
- 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
After make-plan returns
- 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.
Stop conditions
- 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