feat(cli): wire memory MCP globally into all MCP-capable agents via setup - #308
Open
codeaholicguy wants to merge 7 commits into
Open
codeaholicguy wants to merge 7 commits into
codeaholicguy wants to merge 7 commits into
Conversation
Extend install/mcp generators with project|user scope (default project, zero behavior change for existing callers). Add Gemini and Cursor generators + env mcpConfigPath entries. Codex user scope writes TOML textually to preserve comments. Setup memory-mcp facade reuses the generators; grok gets a standalone array-based writer.
Setup gains a memory-mcp step for claude, codex, pi (honest skip), gemini, cursor, opencode, grok; new agents are detected via home dot-folders. ai-devkit status reports per-agent memory MCP wiring. Memory tool descriptions rewritten as behavioral instructions (search-before-task). E2E test runs the built CLI in an isolated HOME.
The previous commit's index dropped the new docs, memory-mcp module, Gemini/Cursor generators and their tests even though the working tree was intact and green. Re-commit the full validated state; lint and the full test matrix were run manually against this exact tree.
Lint and full test matrix validated manually (hooks bypassed to avoid the worktree-index incident; gates output captured in progress file).
The e2e spawned the real setup command, which runs the pre-existing pi-session-tracker step when ~/.pi exists. That step requires the pi binary on PATH (absent on CI runners), failing the whole setup run — visible only in the ci.yml Node 20 job because the e2e.yml matrix uses a different config root. pi's honest no-MCP skip stays covered by the setup service unit tests; the e2e now asserts pi's detection-level skip instead. Verified: full cli suite green under Node 20.20.2 with pi stripped from PATH.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ai-devkit setupnow configures the ai-devkit memory MCP server (@ai-devkit/memory) globally (user-level) for every locally detected agent harness with a verified user-scope MCP config surface — zero manual steps, available in every repo.Wired harnesses (each surface verified against official docs/source, links in the design doc & progress file):
~/.claude.jsonmcpServers["ai-devkit-memory"]~/.codex/config.toml[mcp_servers.ai-devkit-memory](textual upsert — comments preserved)~/.gemini/settings.jsonmcpServers["ai-devkit-memory"]~/.cursor/mcp.jsonmcpServers["ai-devkit-memory"]~/.config/opencode/opencode.jsonmcp["ai-devkit-memory"]~/.grok/user-settings.jsonmcp.servers[]upsert byidpi is skipped honestly (no MCP by design; message points at the
memoryskill /ai-devkit memoryCLI). Harnesses without a verifiable stable user-global path (roo, cline, kilocode, junie, kiro, copilot, antigravity, amp, devin) are not wired — adding one later is a single generator.Design rationale
install/mcpgenerator architecture (BaseMcpGenerator plan/apply diff-and-merge + per-harnesstoAgentFormat) is extended to be scope-aware (projectdefault — zero behavior change — and newuserscope). Setup runs user-scope generators non-interactively through a small facade. Documented deviations: (1) Codex user-scope writes TOML textually because a parse/stringify round-trip would destroy comments in the user's globalconfig.toml; (2) Grok's array-based config gets a standalone writer (doesn't fit the map-based generator contract).npx -y @ai-devkit/memory— floats to latest, works in every harness's stdio spawn, no version churn in user configs (pinned/local-path alternatives rejected: stale / machine-specific).ai-devkit-memorykey; foreign entries and formatting are preserved (adversarial fixtures in tests); reruns are byte-stable idempotent (skippedsteps).ai-devkit init/install(additive, covered by the generator test suite).ai-devkit statusgains a read-onlymemory mcprow (wired/not wired/unsupported/errorper detected agent, warning-level, no exit-code regression).packages/memory/src/server.tsrewritten as behavioral instructions (search BEFORE non-trivial tasks, store-after-verified-work, update-instead-of-duplicate) — text only, no logic/schema changes.Validation
$HOME: wires all six harnesses + honest pi skip; rerun byte-stable;--agentvalidation.npm run lint✓ (6 projects) ·npm test✓ (6 projects, cli suite 1291 tests) ·npm run build✓ · typecheck ✓ per package ·oxfmt --check✓ on all touched files (repo has pre-existing fmt debt onmain, untouched).$HOME: full setup table green, codex comment preserved,statusshowsmemory mcp ready · codex: wired · pi: unsupported · ….Risks / notes
Progress file with full phase evidence:
/home/ubuntu/code/agent-remote/memory-mcp-progress.md(branch worktree:.worktrees/feature-setup-memory-mcp).