OpenViking icon indicating copy to clipboard operation
OpenViking copied to clipboard

[Feature]: Devin (local CLI / Desktop) host adapter for agent-hook-plugin — capture from sessions.db

Open zyaiire opened this issue 3 weeks ago • 0 comments

中文见下

Issue Origin

Observed or reproduced in a real environment

Problem Statement

agent-hook-plugin has host adapters for Cursor, Kimi Code, Trae and ZCode, but none for Devin (local CLI / Desktop).

Devin for Terminal can install the Claude Code plugin (#6880), but capture does not work there. The Claude plugin's auto-capture.mjs needs transcript_path in Stop stdin and skips without it. Devin's Stop stdin only has hook_event_name, session_id, prompt_id, stop_hook_active and last_assistant_message.

Devin keeps the full conversation in a local SQLite store, ~/.local/share/devin/cli/sessions.db (WAL mode), shared by the CLI and Desktop.

Observed on 2026-11-09 with Devin CLI 3000.11.205, Desktop bundled 3000.11.238 and store schema migration 20:

  • Every message is already in the store when Stop fires, in both CLI and Desktop.
  • Each message has a stable message_id. Context rebuilds copy nodes but keep the same message_id.
  • /compact starts a new chain. The summary node points back to the old chain through summarized_from.
  • /exit, Ctrl-C, -p and quitting Desktop all fire SessionEnd.

Details: https://github.com/zyaiire/openviking-devin-memory/blob/main/DESIGN.md

Proposed Solution

We'll build a community adapter in https://github.com/zyaiire/openviking-devin-memory, laid out like Kimi Code's:

  • A .devin-plugin with hooks, .mcp.json and skills.
  • memory-plugin-shared and scripts/ vendored from a pinned commit, unmodified.
  • Our own hosts/devin.mjs and hosts/devin-turns.mjs.

Capture reads only sessions.db. It opens the file read-only with node:sqlite so WAL content is included, and walks the main chain. It turns user input and assistant text into {role, content, turn_id}, using message_id as turn_id, and sends them through the shared incremental-turn-capture with addAgentMessages. It commits on SessionEnd and PreCompact, following the Kimi policy. Stop stdin is only the trigger. Local only, no Devin Cloud. We don't use ATIF or --export.

Once it works, we'd like to upstream it as hosts/devin if maintainers want it.

Questions for maintainers

  1. Is an upstream hosts/devin welcome, or should it stay a community plugin?
  2. Capture needs a Node version with built-in node:sqlite (tested on v26.11.1). Recall and MCP still run on Node 18. Is that split acceptable?
  3. Does using a host message id (not a per-turn id) as turn_id fit incremental-turn-capture as intended?

Alternatives Considered

  • Installing the Claude Code plugin in Devin: recall works, capture is skipped (see above).
  • Using Stop's last_assistant_message: it has only the final reply and loses user input and earlier messages.
  • ATIF / --export: a second file format, out of scope for v1.

Feature Area

Other

Use Case

Using Devin (CLI and Desktop) alongside other agents on the same machine, all sharing one OpenViking memory: profile at session start, recall on prompt submit, capture at session end, plus OpenViking MCP tools.

Contribution

  • [x] I am willing to contribute to implementing this feature

中文

agent-hook-plugin 现在没有 Devin(本机 CLI / Desktop)的宿主适配。在 Devin 里装 Claude Code 插件(#6880),召回可用,但抓对话会被跳过:Claude 插件需要 Stop 事件里有 transcript_path,而 Devin 的 Stop 事件里没有这个字段。

Devin 把完整对话存在本机的 ~/.local/share/devin/cli/sessions.db(SQLite,WAL 模式),CLI 和 Desktop 共用这个库。2026-11-09 实测确认了四点:Stop 触发时消息已经入库;每条消息有稳定的 message_id;压缩后摘要节点会通过 summarized_from 指回旧链;各种退出方式都会触发 SessionEnd。

我们先在 https://github.com/zyaiire/openviking-devin-memory 做社区版,结构仿照 Kimi Code。抓对话只读 sessions.db,用 message_id 当 turn_id,在 SessionEnd 和 PreCompact 时提交。只支持本机,不做 Cloud,不用 ATIF。跑通后,如果维护者愿意,再提 hosts/devin 的 PR。

想请维护者回答的问题:

  1. 是否欢迎上游收录 hosts/devin,还是保持社区插件?
  2. 抓对话需要自带 node:sqlite 的 Node 版本(实测 v26.11.1),召回和 MCP 仍可在 Node 18 运行。这样拆分能接受吗?
  3. 用宿主的消息 id(而不是按轮的 id)当 turn_id,符合 incremental-turn-capture 的设计吗?

zyaiire avatar Nov 09 '26 08:11 zyaiire