nemo-rl-session-memory

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Session Memory

会话内存

Keep a durable, human-readable record of the current working session so another agent can resume after a disconnect with minimal context loss.
保存当前工作会话的持久化、易读记录,以便其他Agent在断开连接后能够以最小的上下文损失恢复工作。

When To Use

使用场景

Use this skill when:
  • The user asks to preserve, recover, checkpoint, or manage agent memory.
  • Work is long-running, experimental, or likely to span disconnects.
  • You are about to make nontrivial edits, run long jobs, switch branches, or pause for user input.
  • You resume in a repo that already has
    ./session/
    directories.
在以下场景中使用此技能:
  • 用户要求保存、恢复、检查点记录或管理Agent内存。
  • 工作是长期运行、实验性的,或者可能跨越多次断开连接。
  • 即将进行重要代码编辑、运行长时间任务、切换分支或暂停等待用户输入。
  • 在已有
    ./session/
    目录的仓库中恢复工作。

Session Directory

会话目录

Create one directory per working session:
bash
mkdir -p session
date +%Y%m%d_%H%M%S
mkdir -p session/<session_date_time>
Use local time from the machine. Reuse the same session directory for all checkpoints in the same conversation unless the user explicitly starts a new session.
Expected files:
  • session_state.md
    - overall goal, current subtask, loaded skills, status, plan, assumptions, blockers, and next actions.
  • timeline.md
    - append-only log of major actions, commands, results, and decisions.
  • files.md
    - files inspected, files changed, and why they matter.
  • handoff.md
    - concise resume instructions for the next agent.
Add other files only when useful, such as
experiments.tsv
,
review_notes.md
, or copied command logs.
为每个工作会话创建一个目录:
bash
mkdir -p session
date +%Y%m%d_%H%M%S
mkdir -p session/<session_date_time>
使用机器的本地时间。除非用户明确启动新会话,否则在同一场对话的所有检查点中复用同一个会话目录。
预期文件:
  • session_state.md
    - 整体目标、当前子任务、已加载技能、状态、计划、假设、阻塞点和下一步操作。
  • timeline.md
    - 追加式记录主要操作、命令、结果和决策。
  • files.md
    - 已检查的文件、已修改的文件及其重要性说明。
  • handoff.md
    - 供下一个Agent使用的简洁恢复说明。
仅在有用时添加其他文件,例如
experiments.tsv
review_notes.md
或复制的命令日志。

Start Or Resume

启动或恢复会话

At the start of a session:
  1. Check for existing session directories:
bash
ls -dt session/* 2>/dev/null | head
  1. If the user is resuming work, read the latest relevant
    session_state.md
    ,
    timeline.md
    , and
    handoff.md
    .
  2. If no relevant session exists, create a new timestamped directory.
  3. Write an initial
    session_state.md
    with the user's overall goal, current subtask, loaded skills, repo path, branch, and known constraints.
Do not treat session notes as the only source of truth. Verify important claims against git state, files, and command output before acting.
在会话开始时:
  1. 检查是否存在现有会话目录:
bash
ls -dt session/* 2>/dev/null | head
  1. 如果用户正在恢复工作,读取最新相关的
    session_state.md
    timeline.md
    handoff.md
  2. 如果没有相关会话,创建一个带时间戳的新目录。
  3. 编写初始的
    session_state.md
    ,包含用户的整体目标、当前子任务、已加载技能、仓库路径、分支和已知约束。
不要将会话笔记视为唯一的事实来源。在执行操作前,务必对照git状态、文件和命令输出验证重要信息。

Checkpoint Rhythm

检查点节奏

Write a checkpoint:
  • After gathering enough context to form a plan.
  • Before and after meaningful code edits.
  • Before long-running commands, experiments, branch switches, or anything hard to reconstruct from chat.
  • When the user changes direction.
  • Before final response if the session has meaningful state worth resuming.
  • At least every 30 minutes during active long-running work.
Prefer updating the same files rather than creating many small checkpoint files. Keep the record compact and scannable.
在以下时机写入检查点:
  • 收集到足够上下文以形成计划后。
  • 进行重要代码编辑前后。
  • 运行长时间命令、实验、切换分支或任何难以从聊天记录重建的操作之前。
  • 用户改变工作方向时。
  • 如果会话有值得恢复的重要状态,在最终回复前。
  • 在活跃的长期工作中,至少每30分钟一次。
优先更新现有文件,而非创建大量小型检查点文件。保持记录简洁且易于浏览。

File Templates

文件模板

session_state.md

session_state.md

markdown
undefined
markdown
undefined

Session State

Session State

  • Session: <session_date_time>
  • Repo: <absolute repo path>
  • Branch: <branch name>
  • Started: <local timestamp>
  • Updated: <local timestamp>
  • Session: <session_date_time>
  • Repo: <absolute repo path>
  • Branch: <branch name>
  • Started: <local timestamp>
  • Updated: <local timestamp>

Goal

Goal

<Stable overall user goal in one or two sentences. Preserve this across follow-up steering unless the user explicitly changes it.>
<用一两句话描述稳定的用户整体目标。除非用户明确更改,否则在后续任务中保持此目标不变。>

Current Subtask

Current Subtask

<Immediate task or steering request currently being handled.>
<当前正在处理的即时任务或指导请求。>

Loaded Skills

Loaded Skills

  • <skill-name>
    - <why it was loaded and any important instructions to preserve.>
  • <skill-name>
    - <加载此技能的原因及需要保留的重要说明。>

Current Status

Current Status

<What is true now. Include completed work and verification status.>
<当前状态。包括已完成的工作和验证状态。>

Plan

Plan

  • <Next concrete step>
  • <Next concrete step>
  • <下一个具体步骤>
  • <下一个具体步骤>

Assumptions

Assumptions

  • <Assumption and how to verify it if needed.>
  • <假设及必要时的验证方式。>

Blockers

Blockers

  • <Blocker or "None known".>
undefined
  • <阻塞点或“无已知阻塞”。>
undefined

timeline.md

timeline.md

markdown
undefined
markdown
undefined

Timeline

Timeline

<local timestamp>

<local timestamp>

  • User asked: <brief request>
  • Context gathered: <files/commands and key result>
  • Decision: <important choice and rationale>
  • Result: <edits/tests/outcome>
undefined
  • User asked: <简要请求>
  • Context gathered: <文件/命令及关键结果>
  • Decision: <重要选择及理由>
  • Result: <编辑/测试/结果>
undefined

files.md

files.md

markdown
undefined
markdown
undefined

Files

Files

Inspected

Inspected

  • <path>
    - <why it mattered>
  • <path>
    - <其重要性说明>

Changed

Changed

  • <path>
    - <what changed and why>
  • <path>
    - <修改内容及原因>

Generated

Generated

  • <path>
    - <purpose>
undefined
  • <path>
    - <用途>
undefined

handoff.md

handoff.md

markdown
undefined
markdown
undefined

Handoff

Handoff

Resume From Here

Resume From Here

<One paragraph summary of the current state.>
<一段关于当前状态的总结。>

Next Actions

Next Actions

  • <Most important next action>
  • <Verification or cleanup still needed>
  • <最重要的下一步操作>
  • <仍需进行的验证或清理工作>

Watch Outs

Watch Outs

  • <Risks, user preferences, or repo constraints the next agent must preserve.>
undefined
  • <下一个Agent必须注意的风险、用户偏好或仓库约束。>
undefined

Recovery Workflow

恢复流程

When resuming after a disconnect:
  1. Find the likely latest session directory.
  2. Read
    handoff.md
    first, then
    session_state.md
    , then recent
    timeline.md
    .
  3. Run lightweight verification such as
    git status --short
    ,
    git branch --show-current
    , and targeted file reads.
  4. Continue from the latest verified next action.
  5. Append a timeline entry noting the recovery and any mismatches found.
断开连接后恢复工作时:
  1. 找到可能最新的会话目录。
  2. 先阅读
    handoff.md
    ,然后是
    session_state.md
    ,最后是最近的
    timeline.md
  3. 执行轻量验证,例如
    git status --short
    git branch --show-current
    和针对性的文件读取。
  4. 从最新的已验证下一步操作继续。
  5. 在时间线中追加一条记录,说明恢复操作及发现的任何不一致。

Quality Rules

质量规则

  • Keep notes factual and terse. Future agents need state, not a transcript.
  • Record command outcomes that matter, especially failed tests or skipped verification.
  • Mention uncommitted changes and whether they were made by the current agent or pre-existing.
  • Do not store secrets, tokens, private credentials, or large logs in session files.
  • If a session file becomes large, summarize old details and keep the latest next actions near the top of
    handoff.md
    .
  • 保持笔记真实简洁。未来的Agent需要的是状态,而非聊天记录。
  • 记录重要的命令结果,尤其是测试失败或跳过的验证操作。
  • 提及未提交的更改,以及这些更改是当前Agent做出的还是预先存在的。
  • 不要将会话文件用于存储密钥、令牌、私人凭据或大型日志。
  • 如果会话文件过大,总结旧细节并将最新的下一步操作放在
    handoff.md
    的顶部附近。