session-retire

session-retire is a skill for Claude Code, Codex from FirenzeClaw/kimi-session-orchestrator. It costs 87 tokens per session (4,704 once invoked), scanned A, original, MIT.

A session handover workflow for retiring a long-running coding-agent task and starting a successor with its relevant context.

In plain words
What is it for?
Checking shared memory, collecting session details, archiving discoveries, transferring context, and starting the next session in the correct project directory.
Why use it?
It preserves project findings and decisions when a task needs a fresh session because the current one is too large, repetitive, or has reached a milestone.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions AGENTS.md.

Good fit Checking shared memory, collecting session details, archiving discoveries, transferring context, and starting the next session in the correct project directory.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/firenzeclaw/kimi-session-orchestrator/session-retire
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add FirenzeClaw/kimi-session-orchestrator --skill session-retire
Clone the repo
git clone --depth 1 https://github.com/FirenzeClaw/kimi-session-orchestrator

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for session-retire

README.md
[![agentmods](https://agentmods.dev/badge/skills/firenzeclaw/kimi-session-orchestrator/session-retire/github.svg)](https://agentmods.dev/skills/firenzeclaw/kimi-session-orchestrator/session-retire)
Your own site
<a href="https://agentmods.dev/skills/firenzeclaw/kimi-session-orchestrator/session-retire"><img src="https://agentmods.dev/badge/skills/firenzeclaw/kimi-session-orchestrator/session-retire/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for session-retire

Your own site · 80×15
<a href="https://agentmods.dev/skills/firenzeclaw/kimi-session-orchestrator/session-retire"><img src="https://agentmods.dev/badge/skills/firenzeclaw/kimi-session-orchestrator/session-retire.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 87 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,704 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00087 $0.04704
Opus 5 $0.00044 $0.02352
Sonnet 5 $0.00017 $0.00941
Haiku 4.5 $0.00009 $0.00470

Measured 9d ago against content hash e548d8955b3a, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

session-retire scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

curl -s -X POST -H "Authorization: Bearer $(cat ~/.kimi-code/server.token)" \
skills/session-retire/SKILL.md · 293 lines

How it starts

The opening of the file, as written. The whole thing — 293 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Session Retire & Successor — 退役与接班

Overview

将 coordinator-guide §1.5.4 的 7 步退役流程自动化:环境就绪检查 → 归档发现 → 提取上下文 → 写入共享记忆 → 创建接班 session → 注入完整上下文 → 新 session 自举。实现近乎无损的 session 接力。

When to Use

  • 任务 session 上下文达到 ~360K(注意力拐点),或出现 ≥2 个衰减信号
  • PM 完成一个阶段性里程碑,需要新 session 继续下一阶段
  • PM 明确说"退役"、"接班"、"换 session"、"新 session 继续"

不适用: 临时探索、一次性查询、< 3 轮的简短任务。

Pipeline

Phase 0 — 环境就绪检查(前置)

在进入 Phase 1 之前,先调用一次 memory_status 检查共享内存是否已初始化。若返回错误"知识库未初始化",则触发以下初始化流程:

⚠️ 共享内存未初始化。需创建 .kimi-tunnel/ 目录并 /reload。

是否初始化?
  → 是:mkdir -p <cwd>/.kimi-tunnel/ → 提示 PM 执行 /reload → 等待 reload 完成 → 重新进入 Phase 0
  → 否:继续 Phase 1,所有 memory_* 操作静默跳过。交接内容仅通过 7-block 模板传递,不做持久化归档。

关键:仅 mkdir 不足以初始化——MCP 服务进程需重启才能检测目录并自动创建 memory.db。创建目录后必须 /reload。memory_status 返回成功(含 entry_count 字段)即表示就绪。

Phase 1 — 提取退役 session 上下文

以下 4 步全部并行执行(互不依赖)。若 Phase 0 跳过了初始化,步骤④的 memory_get 调用可跳过(返回空,不影响后续流程)。

① get_session_info(session_id="<retiring_id>")
   → 拿到 title, wirePath, workdir。
   ⚠️ workdir 字段是 Kimi Code 内部标识符(如 cli-research/2ffc9873b6c1),
   不是绝对路径。不要用它作为 create_session 的 cwd。

   ── ★ cwd 确定规则(按顺序执行,不可跳过)──

   【步骤 1 — 强制】wirePath 解析(唯一可靠证据):
     wirePath 格式: .../sessions/wd_<末段目录名>_<hash>/session_<id>/agents/...
     从 wd_<name>_<hash> 提取 <name>,此即 cwd 的末尾目录名。
     例: .../sessions/wd_cli-research_2ffc9873b6c1/... → 末段 = cli-research
         → cwd 必须以 cli-research 结尾,如 D:/code/cli-research

   【步骤 2 — 强制】pwd 确认:
     当前 session(即退役 session 自身)直接执行 Bash(pwd),输出即 cwd。
     - 这就是退役 session 的实际工作目录,无需跨 session 通信
     - 拿到的路径必须与 wirePath 末段一致

   【步骤 3 — 交叉验证(防误判)】:
     检查 list_io_records 第一条 prompt 中的绝对路径。
     - 若 IO 路径末段 == wirePath 末段 → 一致,确认 cwd ✓
     - 若 IO 路径末段 ≠ wirePath 末段(如 IO 显示 .../mycli 但 wirePath 末段是 cli-research):
       → ⛔ IO 路径是 cwd 下的子目录,不是 cwd 本身!
       → cwd 以 wirePath 末段为准。本例: cwd = D:/code/cli-research,不是 D:/code/cli-research/mycli

   接班 cwd 规则:**直接复制退役 session 的 cwd,不推导、不"向上"、不替换。**
   - 若退役 session 在 D:/code/cli-research → 接班 cwd = D:/code/cli-research(不是 D:/code)
   - 若退役 session 在 D:/code/cli-research/mycli → 接班 cwd = D:/code/cli-research/mycli(不是 D:/code/cli-research)
   - ⛔ 禁止用 PM session cwd —— PM 在统筹项目,不在任务项目
   - ⛔ 禁止用 memory_status.projectRoot —— 那是顶层,不是任务目录
   - ⛔ 禁止用 get_session_info.workdir —— 那是 Kimi Code 内部标识符,非绝对路径
   - ⛔ 禁止仅凭 IO records 中的子目录路径推断 cwd —— IO 里频繁出现的路径可能是子目录
   - v2.13+ 双层记忆注入自动按 cwd 选正确的 memory.db

② list_io_records(session_id="<retiring_id>", limit=15, max_content_length=3000)
   → 最近 15 轮 prompt↔回复,用于提取已完成/待办/决策
   → 同时从中查找 pwd 命令的回显输出(Kimi CLI 默认 echo 执行的命令)
   → ⚠️ IO 中频繁出现的子目录路径(如 .../mycli/...)不能作为 cwd——仅用于步骤 3 交叉验证

③ read_session_log(session_id="<retiring_id>", limit=50)
   → 深度上下文:错误、工具调用链、阻塞点

④ memory_get(namespace="project/meta")      ← 若 Phase 0 跳过则直接跳过
   memory_get(namespace="project/decisions")
   memory_get(namespace="project/learnings")
   → 以上三步均不加 project 参数(默认取 PM session 项目基线)
   → 若退役 session 在子项目,额外调用带 project 参数的版本获取子项目基线:
   memory_get(namespace="project/meta", project="<退役 session 的 cwd>")
   memory_get(namespace="project/decisions", project="<退役 session 的 cwd>")
   → 新 session 通过 memory_level=full + from_session 自动获取两层记忆

Read the full file on GitHub · 293 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 293 lines · 87 tokens per session scan A e548d8955b3a

Subscribe to this mod's changes

session-retire is a skill published in the GitHub repository FirenzeClaw/kimi-session-orchestrator (0 stars, last pushed 13d ago), licensed MIT. It adds 87 tokens to every session and 4,704 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

workflow

Creates durable, resumable workflows using Vercel's Workflow SDK. Use when building workflows that need to survive restarts, pause for external events, retry on failure, or coordinate multi-step operations over time. Triggers on mentions of "workflow", "durable functions", "resumable", "workflow sdk", "queue"…

vercel/workflow · 84 tokens

migrating-workflow-v4-to-v5

Upgrades an app from Workflow SDK 4.x to 5.0. Use when bumping the workflow / @workflow/ dependencies to v5, or when hitting removed v4 APIs — runStep, stepEntrypoint, workflow/internal/private, @workflow/core/private, writeToStream / closeStream / readFromStream on a World, world.steps.get without a runId…

vercel/workflow · 161 tokens

migrating-world-v4-to-v5

Upgrades a custom Workflow SDK World implementation from the v4 spec to v5. Use when a package implements the World interface from @workflow/world and is moving to 5.x — event IDs that are ULIDs rather than slot positions, Event id is not slot-numbered at replay time, a specVersion the runtime refuses, writeToStream /…

vercel/workflow · 166 tokens

migrating-to-workflow-sdk

Migrates Temporal, Inngest, Trigger.dev, and AWS Step Functions workflows to the Workflow SDK. Use when porting Activities, Workers, Signals, step.run(), step.waitForEvent(), Trigger.dev tasks / wait.forToken / triggerAndWait, ASL JSON state machines, Task/Choice/Wait/Parallel states, task tokens, or child workflows.

vercel/workflow · 81 tokens

streamsql

A Chinese-language guide to StreamSQL, a SQL-based way to process continuously arriving data in RuleGo. It covers filtering, transformations, time windows, joins, change tracking, cumulative values, and event-pattern matching.

rulego/rulego · 90 tokens

workflow-init

Install and configure Vercel Workflow SDK before it exists in nodemodules. Use when the user asks to "install workflow", "set up workflow", "add durable workflows", "configure workflow sdk", or "init workflow" for Next.js, Express, Hono, Fastify, NestJS, Nitro, Nuxt, Astro, SvelteKit, or Vite.

vercel/workflow · 78 tokens