Session Closeout
Non-destructive end-of-session checklist. Catches loose ends before context resets.
Quick Start
Run the closeout script from the workspace root:
CODEBLOCK0
Or with overrides (pipe-delimited):
CODEBLOCK1
What It Checks
- 1. Repo hygiene — Scans for dirty git repos (uncommitted changes). Reports but never auto-commits.
- Task hygiene — Refreshes
MASTER_TODO.md from project backlogs if scripts/build-master-todo.py exists. Skipped gracefully if not. - Memory hygiene — Appends a timestamped closeout block to
memory/YYYY-MM-DD.md with outcomes, blockers, and next-start items. - Automation hygiene — Flags that cron/automation health should be manually verified.
Configuration
The script auto-detects the workspace root (defaults to $OPENCLAW_WORKSPACE or the current working directory). Key paths:
| Item | Default | Override |
|---|
| Workspace root | INLINECODE4 or cwd | Set env var |
| Daily memory dir |
$ROOT/memory/ | — |
| Master TODO |
$ROOT/MASTER_TODO.md | — |
| TODO builder |
$ROOT/scripts/build-master-todo.py | Skip if missing |
Output
The script prints structured key=value pairs. Report a concise summary to the user:
- - CLOSEOUTSTATUS —
ok, warning, or INLINECODE10 - DIRTYREPOCOUNT — number of repos with uncommitted changes
- MASTERTODOREFRESH — whether the task list was refreshed
- EXCEPTIONCOUNT — total issues found
If dirty repos are found, list them but do not auto-commit or discard. Let the user decide.
Customization
- - To add project-specific checks (e.g., pushing status to a dashboard), extend the script or add a
scripts/closeout-hooks.sh that the main script sources if present. - Override closeout bullets via environment variables:
CLOSEOUT_OUTCOMES, CLOSEOUT_BLOCKERS, CLOSEOUT_NEXT (pipe-delimited).
会话收尾
非破坏性的会话结束检查清单。在上下文重置前捕捉遗漏事项。
快速开始
从工作区根目录运行收尾脚本:
bash
bash $(dirname $0)/../scripts/session-closeout.sh
或使用覆盖参数(竖线分隔):
bash
CLOSEOUT_OUTCOMES=已发布功能X|已修复Bug Y \
CLOSEOUT_BLOCKERS=等待API密钥 \
bash scripts/session-closeout.sh
检查内容
- 1. 仓库卫生 — 扫描脏git仓库(未提交的更改)。仅报告,从不自动提交。
- 任务卫生 — 如果存在scripts/build-master-todo.py,则从项目待办事项刷新MASTER_TODO.md。若不存在则优雅跳过。
- 记忆卫生 — 将带时间戳的收尾块追加到memory/YYYY-MM-DD.md,包含成果、阻碍项和下次启动事项。
- 自动化卫生 — 标记需要手动验证定时任务/自动化运行状况。
配置
脚本自动检测工作区根目录(默认为$OPENCLAW_WORKSPACE或当前工作目录)。关键路径:
| 项目 | 默认值 | 覆盖方式 |
|---|
| 工作区根目录 | $OPENCLAW_WORKSPACE或当前目录 | 设置环境变量 |
| 每日记忆目录 |
$ROOT/memory/ | — |
| 主待办事项 | $ROOT/MASTER_TODO.md | — |
| 待办构建器 | $ROOT/scripts/build-master-todo.py | 缺失则跳过 |
输出
脚本打印结构化的键值对。向用户报告简洁摘要:
- - CLOSEOUTSTATUS — ok、warning或error
- DIRTYREPOCOUNT — 存在未提交更改的仓库数量
- MASTERTODOREFRESH — 任务列表是否已刷新
- EXCEPTIONCOUNT — 发现的问题总数
如果发现脏仓库,列出它们但不要自动提交或丢弃。让用户自行决定。
自定义
- - 要添加项目特定检查(例如向仪表板推送状态),可扩展脚本或添加scripts/closeout-hooks.sh,主脚本若检测到该文件则会引用它。
- 通过环境变量覆盖收尾要点:CLOSEOUTOUTCOMES、CLOSEOUTBLOCKERS、CLOSEOUT_NEXT(竖线分隔)。