Skip to content

feat: integrate Computer History and Computer Use - #371

Merged
ZongYue99 merged 2 commits into
MemTensor:computer_usefrom
memory-lee:codex/computer-use-integration
Sep 8, 2026
Merged

ZongYue99 merged 2 commits into
MemTensor:computer_usefrom
memory-lee:codex/computer-use-integration

Conversation

@memory-lee

@memory-lee memory-lee commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

当前实现

本 PR 将 Computer History 和 Computer Use 集成到现有 Memmy 分支中,当前实现基于用户显式启动和停止的 macOS 操作录制。

已实现功能

  • Computer History 录制的是操作事件流(event stream),不是屏幕录制,也不录音。

    • 使用 macOS CGEventTap 和 Accessibility API。
    • 记录应用切换、鼠标点击、键盘输入、滚动操作、Accessibility 语义信息和浏览器页面上下文。
    • Electron 录制路径默认使用 --no-screenshots,没有音频采集逻辑。
    • 浏览器 URL 会移除 query、fragment 和 credentials。
    • 搜索框和地址栏文本可以显式保留,其他正文文本默认脱敏。
  • 每次录制会将原始事件写入 events.jsonl。

    • 同一次录制对应一个持续更新的 History Markdown。
    • History 由本地确定性脚本 summarize-history.mjs 生成。
    • 当前没有定期创建 Model 对话,也没有调用专用的 Memory Summary Model。
  • History 和 Workflow 分层保存。

    • 原始事件流会进一步生成语义化的 Workflow Candidate。
    • Workflow Candidate 和正式 Workflow 不包含录制时的坐标和精确滚动距离。
    • 被脱敏的输入必须由当前用户请求或显式变量提供,不能从历史内容中猜测。
  • 新增 computer_history Agent Tool,支持:

    • 搜索可复用的 Computer History。
    • 用户明确要求复现、重复或继续某个操作时,生成正式的 gated Workflow。
    • 要求 captured History 在完成录制后,才能生成可复现的 Workflow。
  • 正式 Workflow 是语义状态机,不是坐标宏。

    • 每一步操作前都要读取当前的 Accessibility/UI 状态。
    • 每一步操作后都要验证实际 UI 结果。
    • 必须按照有序 Gate 执行,不能跳过前置步骤。
    • 不会自动授权登录、结账、支付、输入 credentials 或执行其他未授权的 consequential action。
  • Computer Use 执行路径:

    • Chat replay:Agent 优先使用 Open Computer Use MCP,即 mcp_open_computer_use_*;内置 computer_* 仅作为 fallback。
    • Open Computer Use 的优先级目前由 Agent description 和 Workflow execution contract 约束,并不是代码层强制路由。
  • 原始录制数据设置 48 小时保留策略。

    • 主要针对 ~/.memmy/computer-history/recordings/ 下的 raw recording。
    • History Markdown 和 Workflow Markdown 不参与该清理。
    • Codex/Skysight Markdown 可以作为 read-only source 显示在 Memmy Timeline 中,Memmy 不修改这些源文件。

当前局限性

  • 当前不是长期运行的 background service。

    • 没有 system login 自动启动、崩溃自动恢复或持续后台监控。
  • 当前一次录制只生成一个持续更新的 History。

    • 尚未实现按 10 分钟、小时或其他时间窗口自动切分多个 History。
  • 查询主要基于 Markdown。

    • 搜索会匹配 History 的 title 和 Markdown 内容。
    • Workflow Candidate 会提前从 events.jsonl 生成。
    • 用户查询时不会再按需回查原始事件流。
  • 录制中的 History 不能直接生成 captured replay Workflow。

    • 录制过程中状态是 incomplete。
    • 必须停止并完成录制,使状态变为 completed 后才能稳定生成 Workflow。
  • 48 小时清理目前是顺带清理。

    • 只会在读取 snapshot 或启动新的 capture 时触发。
    • 目前删除的是过期的 recording directory,而不是独立定时器只删除 events.jsonl。

Synthetic checkpoint for safe three-way migration onto upstream computer_use; source worktree remains untouched.
Include recording, summarization, workflow extraction, replay scripts, schema, and demo fixtures.
@ZongYue99
ZongYue99 merged commit 927cf07 into MemTensor:computer_use Sep 8, 2026
4 checks passed
ZongYue99 pushed a commit that referenced this pull request Sep 11, 2026
…null

Narration resolved its model with `llmRuntime(modelPreset ?? null)`. That turns
"no preset was asked for" into "resolve the preset called null", which the
gateway's resolver cannot do — it answered model_selection_unavailable, and
every summary silently kept its mechanical title.

Reproduced against the real config: llmRuntime() resolves gpt-5.6-terra,
llmRuntime("computer-use-fast") resolves it too, and only llmRuntime(null)
throws. Pass nothing when there is nothing to pass.

End to end on a real segment, 424 events compact to 56 activity arcs and come
back as "Computer History Integration Review" with an account naming DingTalk,
Arc, PR #371 and the architecture docs — instead of "用户在「Computer History
2026-09-08T08-20-00Z」中完成了一组电脑操作".

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Memtensor-AI pushed a commit that referenced this pull request Sep 15, 2026
…null

Narration resolved its model with `llmRuntime(modelPreset ?? null)`. That turns
"no preset was asked for" into "resolve the preset called null", which the
gateway's resolver cannot do — it answered model_selection_unavailable, and
every summary silently kept its mechanical title.

Reproduced against the real config: llmRuntime() resolves gpt-5.6-terra,
llmRuntime("computer-use-fast") resolves it too, and only llmRuntime(null)
throws. Pass nothing when there is nothing to pass.

End to end on a real segment, 424 events compact to 56 activity arcs and come
back as "Computer History Integration Review" with an account naming DingTalk,
Arc, PR #371 and the architecture docs — instead of "用户在「Computer History
2026-09-08T08-20-00Z」中完成了一组电脑操作".

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants