agentmemory icon indicating copy to clipboard operation
agentmemory copied to clipboard

Add multi-IDE installer support for OpenCode, Cursor, Codex, Roo, and Kilo

Open RaviTharuma opened this issue 6 months ago • 3 comments

Summary

  • add a first-party agentmemory install CLI command for OpenCode, Cursor, Codex, Roo, Kilo, PI, Hermes, and OpenClaw targets
  • ship new Cursor and Codex hook entrypoints and generate the corresponding host config files plus MCP wiring
  • preserve deep native integrations for Claude/OpenClaw/Hermes/PI while adding best-available automatic capture for hosts that only expose MCP or file-watch surfaces

What changed

  • added src/installers.ts with target-specific installers
  • added new hook adapters: src/hooks/cursor.ts and src/hooks/codex.ts
  • wired agentmemory install into src/cli.ts
  • updated tsdown.config.ts so the new hook scripts are built into both dist/hooks and tracked plugin/scripts
  • added focused tests in test/installers.test.ts

QA

  • npm run build
  • npx vitest run test/installers.test.ts
  • manual installer runs for:
    • node dist/cli.mjs install opencode --project-root <tmp>
    • node dist/cli.mjs install cursor --project-root <tmp>
    • node dist/cli.mjs install codex --project-root <tmp>
    • node dist/cli.mjs install roo --project-root <tmp>
    • node dist/cli.mjs install kilo --project-root <tmp> and inspection of generated files/configs

Notes

  • Roo Code and Kilo Code currently receive best-available MCP config generation; they do not expose the same native lifecycle hook surface as Claude/Cursor/OpenCode
  • OpenCode gets both an MCP entry and a generated plugin that forwards session/file/command events into the existing agentmemory hook pipeline

Summary by CodeRabbit

  • New Features

    • Added an install CLI command to install Agent Memory integrations for OpenCode, Cursor, Codex, Roo, Kilo, PI, OpenClaw, and Hermes.
    • Added Cursor and Codex hook and CLI scripts to emit session start/observe/tool-use/stop events and surface returned context.
  • Chores

    • Installer generates and merges editor/plugin configuration and integration artifacts across multiple targets.
  • Tests

    • Expanded tests to verify installer outputs and safe merging into existing configs.

Review Change Stack

RaviTharuma avatar May 11 '26 21:05 RaviTharuma

@RaviTharuma is attempting to deploy a commit to the rohitg00's projects Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar May 11 '26 21:05 vercel[bot]

📝 Walkthrough

Walkthrough

Adds an agentmemory install CLI, installer implementation, Codex/Cursor hook sources and compiled plugin scripts, build config updates, and tests to install agentmemory integrations across multiple editor targets.

Changes

AgentMemory Installation Framework

Layer / File(s) Summary
CLI Install Command
src/cli.ts
agentmemory install handler parses target and flags, dynamically imports installers.js, calls installTarget, and reports files/notes.
Build Configuration
tsdown.config.ts
Adds src/hooks/cursor.ts and src/hooks/codex.ts to hookEntries, enabling builds to dist/hooks and plugin/scripts.
Codex plugin script (compiled)
plugin/scripts/codex.mjs
Reads stdin JSON, posts session/observe/end requests to Agent Memory, writes returned context on session start, and swallows network errors.
Cursor plugin script (compiled)
plugin/scripts/cursor.mjs
Infers Cursor events from stdin JSON, posts observations and session lifecycle events to Agent Memory, writes returned context on session start, and ignores failures.
Codex hook source
src/hooks/codex.ts
TypeScript hook: payload type, auth headers, stdin parsing, event-driven REST calls, timed aborts, and non-blocking error handling.
Cursor hook source
src/hooks/cursor.ts
TypeScript hook: payload type, event inference, session/project helpers, observe/session endpoints, and main routing for cursor events.
Installers: Types & Core Helpers
src/installers.ts
Exports InstallTarget/InstallResult; adds filesystem, JSON (comment-stripping), packageRoot, and hook command utilities.
Installers: Target Implementations
src/installers.ts
Per-target install logic: OpenCode plugin + opencode.json{c}, Cursor mcp.json merge, Codex config.toml + hooks, Roo/Kilo/PI/OpenClaw/Hermes handling, MCP merge helpers, recursive copy, and installTarget orchestrator.
Installation Tests
test/installers.test.ts
Vitest suite creating temp roots and asserting generated files/configs for opencode, cursor, codex, roo, and kilo, including merge and JSONC-path behaviors.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐰 I nibble lines and patch the trees,

I stitch the hooks with nimble knees,
Cursor listens, Codex sings,
Installers plant configurable springs,
A rabbit hops — integrations breeze.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding a multi-IDE installer command with support for multiple IDE targets (OpenCode, Cursor, Codex, Roo, Kilo, and others mentioned in objectives).
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • [ ] Create PR with unit tests

[!WARNING] There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.

[!TIP]

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar May 11 '26 21:05 coderabbitai[bot]

Addressed the actionable review feedback in commit 2e7e169:\n\n- reused a single timestamp in the Codex and Cursor hook handlers\n- switched installer path resolution to fileURLToPath for cross-platform correctness\n- fixed the generated OpenCode plugin to keep one stable session id across events\n\nRe-ran verification after the fixes:\n- npm run build\n- npx vitest run test/installers.test.ts\n- manual installer QA for OpenCode, Cursor, Codex, Roo, and Kilo\n\nI also checked the PR review threads — the actionable CodeRabbit threads are already marked resolved on GitHub after the update. The remaining Vercel failure is an authorization gate on the upstream team side rather than a code issue.

RaviTharuma avatar May 12 '26 05:05 RaviTharuma

Thanks @RaviTharuma — multi-IDE wiring lives in agentmemory connect now. Latest batch (#677) brought it to 16 adapters.

rohitg00 avatar May 27 '26 18:05 rohitg00