Save Thread

nowledge-co/community/nowledge-mem-openhands-plugin/skills/save-thread

作者 nowledge-co1f4d7eb61466dbfc93ce8d7a0a806c4d4a196dd0无许可证收录于 2026年10月9日更新于 2026年10月9日

Synchronize and persist the active OpenHands conversation session or multi-agent canvas run into Nowledge Mem.

AI 生成的概览

将进行中的 OpenHands 对话会话或多智能体画布运行保存并同步到 Nowledge Mem。

功能
该技能说明如何捕获进行中的 OpenHands 对话会话或多智能体画布运行,并将其持久化到 Nowledge Mem。它涵盖自动停止钩子:在磁盘上定位会话事件,提取并去重提示与操作,再通过 REST 导入接口同步,并提供 CLI 回退与离线队列。它还涵盖手动会话同步命令以及多智能体画布运行的来源标记设置。
适用场景
适用于用户明确要求保存或记录对话线程、需要在智能体完成时由自动停止钩子捕获会话,或在长时间后台任务前设置检查点的情况。
运行要求
需要 OpenHands 及其磁盘上的对话事件、Nowledge Mem OpenHands 插件,以及对 Nowledge Mem REST API 或 nmem CLI 的访问权限。可选环境变量用于控制智能体标识、空间和自动捕获。该技能不附带脚本,仅为说明文档。

Save Thread

Synchronize the active OpenHands conversation session or multi-agent canvas run into Nowledge Mem.

When to Use

  • Explicit user request: "save this conversation", "record this thread in nowledge mem".
  • Automated Stop hook: runs automatically upon agent completion if NMEM_DISABLE_AUTO_CAPTURE is not set.
  • Checkpoint before long-running background tasks.

How Thread Capture Works in OpenHands

OpenHands persists conversation events to disk (events/event-*.json). The Nowledge Mem OpenHands plugin integrates via a Tier-2 native transcript importer:

  1. Automated Stop Hook: When a conversation ends or agent pauses, hooks/nmem-stop.py runs automatically:

    • Locates the active OpenHands session events on disk.
    • Extracts and deduplicates user prompts and assistant actions/observations.
    • Synchronizes directly to Nowledge Mem via high-speed REST API POST /threads/import (with CLI nmem t import fallback and offline queue resilience).
  2. Explicit Session Sync: To manually checkpoint the current session from terminal or canvas:

    bash
    python3 <plugin-dir>/hooks/nmem-stop.py <<<'{"session_id": "<conversation-id>"}'

    Or using the nmem CLI import:

    bash
    nmem t import --id "openhands-<conversation-id>" --title "<title>" --messages '<json>' --source openhands
  3. Multi-Agent Canvas Provenance: When running multiple agents on a canvas, configure NMEM_AGENT_ID and NMEM_SPACE so thread captures preserve individual node provenance across the shared graph.

  4. Multi-Agent Orchestrator Capture Control: When orchestrating multi-agent workflows or child processes, you can control thread capture boundaries. If child tasks or workers capture their own threads, set NMEM_DISABLE_AUTO_CAPTURE=1 in OpenHands to prevent duplicate session captures while keeping MCP memory tools active.

来源与署名

来源:nowledge-co/community位于nowledge-mem-openhands-plugin/skills/save-thread提交1f4d7eb

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架