[Feature]: Droid (Factory) host adapter for the memory plugin
中文见下
Issue Origin
Observed or reproduced in a real environment
Problem Statement
There is no OpenViking memory integration for local Factory Droid (CLI, interactive and droid exec). Droid has plugins, Claude-Code-style hooks and MCP, and #6880 lists it among the clients that read the Claude Code plugin layout. Three things we measured on Droid CLI 0.232.0 keep claude-code-memory-plugin from covering it as it stands:
- Transcript format. Droid's Stop stdin does carry
transcript_path, but the file (~/.factory/sessions/<cwd>/<id>.jsonl,session_start.version = 2) is not Claude Code's format. Every row is amessagerecord linked byparentId, and hook records, injected context, error notices and Droid's own notices sit in the same stream as the conversation. A fork copies the parent's records into a new file with their original ids. - Plugin root in MCP config. Droid substitutes the plugin root into hook commands but not into a native plugin's MCP config:
${DROID_PLUGIN_ROOT}inargsreaches the process literally, and${VAR}inenvis read as a credential reference, so the server fails to start when it is unset. - Hook stdout.
UserPromptSubmitdoes not fire underdroid exec. In interactive mode Droid uses any non-empty stdout of that hook as context, a bare{}included, and keeps only the first hook's context.
The verified extension surface is written up here: https://github.com/zyaiire/openviking-droid-memory/blob/main/DESIGN.md
Proposed Solution
A community plugin is working at https://github.com/zyaiire/openviking-droid-memory:
droid plugin marketplace add https://github.com/zyaiire/openviking-droid-memory
droid plugin install openviking-memory@openviking-droid-memory
claude-code-memory-plugin/scripts/shared,servers/mcp-proxy.mjsand the four skills are vendored unmodified atd2ef5dfa(0.7.22), with a hash per file checked in tests.- The Droid side is its own hook entries, modeled on upstream's, with client id
droid(plugin.droidinovcli.conf) and OpenViking sessions nameddr-<droid session id>. - Capture reads only the session file. It follows the main
parentIdchain, drops the part of a fork that belongs to the parent session, and sends{role, content, turn_id}with the recordidasturn_id. Stop commits once pending tokens reachcommitTokenThreshold; PreCompact and SessionEnd always commit. - Hooks print the context envelope only when they inject, and nothing otherwise.
- The MCP proxy starts through a short inline launcher that finds the install under
~/.factory/plugins/installed_plugins/.
It was run against Droid 0.232.0 and a live OpenViking server: profile injection, recall, an MCP tool call, capture and commit under droid exec, /compress and /exit. npm test runs 31 tests against transcripts recorded from Droid.
Questions for maintainers
- Would you like a Droid host upstream, or should this stay a community plugin? Either way, could
droidbe added toHARNESS_KEYSso the doctor acceptsplugin.droid? - Would a pluggable transcript decoder in
claude-code-memory-pluginbe welcome? Hosts with Claude-style hooks but their own transcript format could then reuse the capture entries instead of porting them. - Is a host record id (one per message, not one per turn) the intended use of
turn_id?
Alternatives Considered
- Installing the Claude Code plugin on Droid directly (#6880). We did not run this end to end. Its capture parses Claude Code transcript records, and its
.mcp.jsondepends on the plugin root being substituted, which we saw Droid not do for a native plugin. - Capturing from Stop stdin: it carries no conversation text.
Feature Area
Other
Use Case
Using Droid alongside other agents on the same machine, all sharing one OpenViking memory: profile at session start, recall on prompt submit, capture of each turn, commit before compaction and at session end, plus the OpenViking MCP tools and skills.
Contribution
- [x] I am willing to contribute to implementing this feature
Related: #7267 (Devin).
中文
本机 Factory Droid(CLI,交互模式与 droid exec)目前没有 OpenViking 记忆集成。Droid 支持插件、Claude Code 风格的 hook 和 MCP,#6880 也把它列为能读 Claude Code 插件布局的客户端。但我们在 Droid CLI 0.232.0 上实测到三点,使 claude-code-memory-plugin 不能原样覆盖它:
- 会话文件格式不同。 Droid 的 Stop stdin 带
transcript_path,但文件不是 Claude Code 的格式:每行是用parentId串起来的message记录,hook 记录、注入的上下文、错误提示和 Droid 自己的提示与对话混在同一个流里;fork 会把父会话的记录连同原 id 复制到新文件。 - MCP 配置里不替换插件根目录。 hook 命令里会替换,原生插件的 MCP 配置里不会:
args中的${DROID_PLUGIN_ROOT}原样传给进程,env中的${VAR}被当作凭据引用,未设置时服务启动失败。 - hook 输出。
droid exec下不触发UserPromptSubmit。交互模式下,这个 hook 的任何非空输出(包括{})都会被当作上下文,而且只取第一个 hook 的上下文。
已验证的扩展面见 https://github.com/zyaiire/openviking-droid-memory/blob/main/DESIGN.md
社区插件已经可用:https://github.com/zyaiire/openviking-droid-memory 。上游的共享运行时、MCP 代理和四个 skill 原样 vendor 并固定在 d2ef5dfa;Droid 专有的 hook 入口、会话解码器和 MCP 启动器自己实现;客户端 id 为 droid,OpenViking 会话名为 dr-<droid 会话 id>。已在 Droid 0.232.0 和真实 OpenViking 服务端上跑通画像注入、召回、MCP 工具调用、捕获与提交、/compress 和 /exit。
想请维护者回答的问题:
- 是否欢迎上游收录 Droid 宿主,还是保持社区插件?无论哪种,能否把
droid加进HARNESS_KEYS,让 doctor 认识plugin.droid? - 是否欢迎在
claude-code-memory-plugin里把 transcript 解码做成可插拔的?这样 hook 是 Claude 风格、但会话格式自成一套的宿主可以直接复用捕获入口,不必移植。 - 用宿主的记录 id(每条消息一个,而不是每轮一个)当
turn_id,符合设计意图吗?
感谢反馈,但我们精力有限,只维护主流的框架,其他的可以直接使用 openviking gateway,这个会适配任何的agent框架