continue-session

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Continue session

继续会话

Continue another session's work as a silent reader: read its transcript, then do the work in this session. Send the other session no text, keys, prompts or messages, and leave it unresumed: any input wakes it and re-sends its long, uncached history.
以静默读取者的方式继续另一个会话的工作:读取其会话记录,然后在本会话中完成工作。不要向另一个会话发送文本按键、提示或消息,并保持其未恢复状态:任何输入都会唤醒它并重新发送冗长且未缓存的历史记录。

Parameters

参数

  • <session-host>
    : where agent sessions run, e.g.
    herdr
    , Claude Code Desktop, Codex Desktop.
  • <session-host>
    :Agent 会话运行的位置,例如
    herdr
    、Claude Code Desktop、Codex Desktop。

1. Find the session

1. 查找会话

  • When the user gives a session id: use it.
  • When the user gives a place, such as "top pane" or "left tab": start from this session's own place, find the target with the session host's read-only commands, and read the session id of the agent there.
    • When the place is a scope, such as "another workspace": list the agent sessions in it, leave out this session and the shell panes, and pick by title, working directory and status. Ask the user only when more than one still fits.
    • When the host reports no session id: take the newest transcript of that pane's harness whose working directory matches the pane's.
The read-only commands per session host:
  • herdr
    :
    1. Find this pane:
      herdr pane current --current
      .
    2. Find the target pane:
      herdr pane neighbor --pane <this pane> --direction <up|down|left|right>
      for a neighbour, or
      herdr pane list
      and
      herdr tab list
      for one farther away.
    3. Read the target's session id: the
      agent_session
      field of
      herdr pane get <target pane>
      .
  • **当用户提供 session id 时:**直接使用该 id。
  • **当用户提供位置时,**例如“顶部窗格”或“左侧标签页”:从当前会话所在位置开始,使用 session host 的只读命令查找目标,并读取该位置中 Agent 的 session id。
    • **当该位置表示一个范围时,**例如“另一个工作区”:列出其中的 Agent 会话,排除当前会话和 shell 窗格,然后根据标题、工作目录和状态进行选择。仅当仍有多个候选匹配时询问用户。
    • **当 host 未报告 session id 时:**获取该窗格中工作目录与之匹配的 harness 的最新会话记录。
各 session host 的只读命令:
  • herdr
    :
    1. 查找当前窗格:
      herdr pane current --current
      。
    2. 查找目标窗格:相邻窗格使用
      herdr pane neighbor --pane <this pane> --direction <up|down|left|right>
      ;位置更远时使用
      herdr pane list
      和
      herdr tab list
      。
    3. 读取目标窗格的 session id:
      herdr pane get <target pane>
      返回结果中的
      agent_session
      字段。

2. Read the transcript

2. 读取会话记录

Find the transcript on disk, where the session's harness stores it:
  • Claude Code:
    ~/.claude/projects/<project>/<session-id>.jsonl
    , where
    <project>
    is the working directory with
    /
    and
    .
    turned into
    -
    .
  • Codex: under
    ~/.codex/sessions/
    .
Start with the last couple of messages, since they usually say where the session left off. Then search the rest rather than reading it whole: the user's requests, the latest tool results and any open decision. Then check the working directory's branch, uncommitted changes and pull requests.
Read on until you can state the goal, what is done, what was in progress when it stopped, and the next step.
在磁盘上查找会话记录,即 session 的 harness 存储记录的位置:
  • Claude Code:
    ~/.claude/projects/<project>/<session-id>.jsonl
    ,其中
    <project>
    是将工作目录中的
    /
    和
    .
    替换为
    -
    后得到的名称。
  • **Codex:**位于
    ~/.codex/sessions/
    下。
先阅读最后几条消息,因为它们通常会说明会话上次进行到哪里。然后搜索其余内容,而不是一次性通读:用户的请求、最新的工具调用结果以及尚未作出的决定。接着检查工作目录的分支、未提交的更改和 pull request。
持续阅读,直到能够说明目标、已完成的工作、停止时正在进行的工作以及下一步操作。

3. Continue

3. 继续工作

Give the user that recap in a few lines, then continue the work here, in the session's working directory.
  • When the other session is still working: tell the user and wait for their word, since two sessions editing one worktree overwrite each other.
用几行文字向用户简要回顾上述内容,然后在当前会话中、使用该会话的工作目录继续工作。
  • **当另一个会话仍在工作时:**告知用户并等待用户指示,因为两个会话同时编辑同一个 worktree 会互相覆盖。