save-task-list

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Save Task List for Reuse

保存任务列表以便重复使用

Save the current session's task list so it can be restored in future sessions.
保存当前会话的任务列表,以便在未来会话中恢复使用。

Session Context

会话上下文

  • Session ID: ${CLAUDE_SESSION_ID}
  • Active task directories: !
    ls -1t ~/.claude/tasks/ 2>/dev/null | head -5 || echo "none found"
  • Current tasks in session: !
    ls -1t ~/.claude/tasks/ 2>/dev/null | head -1 | xargs -I{} ls ~/.claude/tasks/{} 2>/dev/null | head -10 || echo "no tasks"

  • 会话ID: ${CLAUDE_SESSION_ID}
  • 活跃任务目录: !
    ls -1t ~/.claude/tasks/ 2>/dev/null | head -5 || echo "none found"
  • 会话中的当前任务: !
    ls -1t ~/.claude/tasks/ 2>/dev/null | head -1 | xargs -I{} ls ~/.claude/tasks/{} 2>/dev/null | head -10 || echo "no tasks"

Instructions

操作步骤

  1. Find the current task list ID by checking
    ~/.claude/tasks/
    for the most recently modified directory. List the directories sorted by modification time.
  2. Verify the match — read the task files inside the directory and compare them to any tasks you know about from this session. Confirm you have the correct task list.
  3. Log the session mapping — write the mapping to
    .claude/archon/sessions/
    :
    bash
    mkdir -p .claude/archon/sessions
    echo '{"session": "${CLAUDE_SESSION_ID}", "task_list": "<TASK_LIST_ID>", "saved_at": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"}' \
      >> .claude/archon/sessions/task-lists.jsonl
  4. Verify the SessionStart hook is installed — the project-level
    .claude/settings.json
    already includes a SessionStart hook that runs
    verify-task-list.sh
    on every session start. Confirm it's present by reading the file. If it's missing for some reason, add it back:
    json
    {
      "hooks": {
        "SessionStart": [
          {
            "hooks": [
              {
                "type": "command",
                "command": ".claude/skills/save-task-list/hooks/verify-task-list.sh",
                "statusMessage": "Checking for restored task list..."
              }
            ]
          }
        ]
      }
    }
    Important: Merge — don't overwrite existing settings. If
    hooks
    or
    SessionStart
    already exists, append to the array. If the hook is already installed, skip this step.
  5. Output the startup command for the user:
    To continue with this task list in a new session:
    
    CLAUDE_CODE_TASK_LIST_ID=<task_list_id> claude
    Explain: On startup, the SessionStart hook will verify the task list exists and show a confirmation message.
  6. Show the current task summary so the user knows what's preserved (task subjects, statuses, and any dependencies).
  1. 查找当前任务列表ID:检查
    ~/.claude/tasks/
    目录下最近修改的目录,按修改时间排序列出这些目录。
  2. 验证匹配:读取目录内的任务文件,并与您在本次会话中已知的任务进行对比,确认您找到的是正确的任务列表。
  3. 记录会话映射:将映射关系写入
    .claude/archon/sessions/
    目录:
    bash
    mkdir -p .claude/archon/sessions
    echo '{"session": "${CLAUDE_SESSION_ID}", "task_list": "<TASK_LIST_ID>", "saved_at": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"}' \
      >> .claude/archon/sessions/task-lists.jsonl
  4. 验证SessionStart钩子已安装:项目级别的
    .claude/settings.json
    文件已包含一个SessionStart钩子,会在每次会话启动时运行
    verify-task-list.sh
    。通过读取该文件确认钩子是否存在。如果因某些原因缺失,请重新添加:
    json
    {
      "hooks": {
        "SessionStart": [
          {
            "hooks": [
              {
                "type": "command",
                "command": ".claude/skills/save-task-list/hooks/verify-task-list.sh",
                "statusMessage": "Checking for restored task list..."
              }
            ]
          }
        ]
      }
    }
    重要提示:合并而非覆盖现有设置。如果
    hooks
    SessionStart
    已存在,请追加到数组中。如果钩子已安装,请跳过此步骤。
  5. 输出启动命令给用户:
    To continue with this task list in a new session:
    
    CLAUDE_CODE_TASK_LIST_ID=<task_list_id> claude
    说明:启动时,SessionStart钩子会验证任务列表是否存在,并显示确认消息。
  6. 显示当前任务摘要,让用户了解保存的内容(任务主题、状态以及任何依赖关系)。