Skip to content

feat(setup): add Droid agent installer #736

Description

@ahjota

📋 Pre-flight Checks

  • I have searched existing issues and this is not a duplicate
  • I understand this issue needs status:approved before a PR can be opened

🔍 Problem Description

Factory.AI and its Droid CLI do not have first class support in Engram like CC, OpenCode, etc. Droid users like myself have to manually wire up the MCP server, plugin, and Memory Protocol. This is error-prone and misses the first-message tool-loading behavior that makes Engram reliable in other agents.

💡 Proposed Solution

Add a droid agent to engram setup so users can run:

engram setup droid

The command should:

  1. Register mcpServers.engram in ~/.factory/mcp.json with the absolute path to the engram binary.
  2. Extract the UserPromptSubmit hook scripts to ~/.factory/hooks/engram/.
  3. Write a UserPromptSubmit entry to ~/.factory/hooks.json in Droid's standalone format.
  4. Install the Engram plugin from the GitHub marketplace so Droid gets the SessionStart, Stop, PreCompact, SubagentStop hooks and the engram-memory skill.

The user-level UserPromptSubmit hook is required because Droid (like Claude Code) does not execute UserPromptSubmit hooks that are declared inside a plugin, even though it registers and matches them. The user-level hook works around this and forces the agent to load Engram tools on the first message.

Expected output after running engram setup droid:

✓ Installed droid plugin (3 files)
  → /Users/<user>/.factory

Next steps:
  1. Restart Droid so MCP config and hooks are reloaded
  2. Verify ~/.factory/mcp.json includes mcpServers.engram
  3. Verify ~/.factory/hooks.json has a UserPromptSubmit entry for engram
  4. Verify the plugin is installed with: droid plugin list --scope user

📦 Affected Area

CLI (commands, flags)

🔄 Alternatives Considered

  • Native Droid plugin: A first-class .factory-plugin/ plugin could be created, but it would still need the user-level UserPromptSubmit hook because of the plugin-hook limitation. Reusing the existing Claude Code plugin via Droid's marketplace translation avoids duplicating hook scripts.
  • Manual setup: Users could manually edit ~/.factory/mcp.json and ~/.factory/hooks.json, but this is brittle and doesn't handle the absolute binary path or plugin installation.

📎 Additional Context

Validation notes:

  • Droid successfully translates the existing .claude-plugin/ marketplace plugin.
  • Lifecycle hooks (SessionStart, Stop, PreCompact, SubagentStop) from the translated plugin fire correctly.
  • Droid exposes Engram MCP tools as engram___<tool> (e.g. engram___mem_save), so the first-message ToolSearch instruction must use that pattern.
  • droid exec does not appear to fire UserPromptSubmit hooks; interactive droid sessions do.

A working implementation is available at https://github.com/ahjota/engram (branch main, commits 94b4f31 and earlier). Would be more than willing to open a PR here.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions