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.
npx skills add echoVic/blade-code --skill active-turn-interactions-and-recoverygit clone --depth 1 https://github.com/echoVic/blade-codeWrote 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.
[](https://agentmods.dev/skills/echovic/blade-code/active-turn-interactions-and-recovery)<a href="https://agentmods.dev/skills/echovic/blade-code/active-turn-interactions-and-recovery"><img src="https://agentmods.dev/badge/skills/echovic/blade-code/active-turn-interactions-and-recovery.svg" alt="Measured on agentmods" height="20"></a>- NVIDIA SkillSpector pass
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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00161 | $0.02789 |
| Opus 5 | $0.00081 | $0.01394 |
| Sonnet 5 | $0.00032 | $0.00558 |
| Haiku 4.5 | $0.00016 | $0.00279 |
Grade A, and why
knowledge-session-state-and-context-active-turn-interactions-and-recovery scanned grade A with 0 findings 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 4d 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.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 75 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Module Structure
该节点管理“当前 Session 此刻能做什么”以及进程退出后如何继续。内存 mailbox 负责原子状态转换,sidecar 保存未确认输入,JSONL 保存 turn/tool/interaction receipt,SessionRuntime 在持有 lease 后协调恢复。
Directory Layout
packages/cli/src/agent/runtime/ActiveTurnMailbox.ts:单活动 turn、claim/seal/ack 与输入容量packages/cli/src/agent/runtime/DurableSteeringInbox.ts:crash-safe pending input sidecarpackages/cli/src/agent/runtime/SessionLease.ts:跨进程 Session owner 锁packages/cli/src/agent/runtime/ActiveOperationGate.ts:关闭时停止接纳、取消并排空活动操作packages/cli/src/agent/runtime/UserPromptArtifactStore.ts:大型用户请求的私有内容寻址存储packages/cli/src/agent/runtime/SessionRuntime.ts:初始化、turn 终态、恢复和辅助交互编排packages/cli/src/context/interactions.ts:interaction request/response/recovery projectorpackages/cli/src/services/SessionInteractionService.ts:durable 交互协议packages/cli/src/services/SideConversationService.ts:不改变主历史的一次性旁路问答packages/cli/src/services/UserShellCommandService.ts:Session-owned 用户命令执行与有界输出
Key Entry Points
SessionRuntime.initialize()inpackages/cli/src/agent/runtime/SessionRuntime.ts:获取 lease 并修复 orphan 状态ActiveTurnMailbox.prepareInputTurn()/enqueue()inpackages/cli/src/agent/runtime/ActiveTurnMailbox.ts:原子接纳首轮输入或 steeringPersistentStore.recoverInterruptedTurn()inpackages/cli/src/context/storage/PersistentStore.ts:关闭 orphan tool call 与未终止 turnSessionInteractionService.resolvePendingWithHandler()inpackages/cli/src/services/SessionInteractionService.ts:重放未回答交互SessionRuntime.executeUserShellCommand()inpackages/cli/src/agent/runtime/SessionRuntime.ts:执行、持久化并安全注入用户命令结果
Gotchas
isActive()在 turn sealed 后返回 false,但hasTurnOwner()仍为 true;切模型、reload inbox、fork/rewind 等互斥判断必须选择正确谓词,不能把“不能再接当前 turn steering”误当作“没有 owner” (packages/cli/src/agent/runtime/ActiveTurnMailbox.ts,packages/cli/src/agent/runtime/SessionRuntime.ts)drainOrSeal()在同一个 mutex 临界区内“发现新消息或封口”,封口后到达的输入必须标记next_turn;拆开检查与 seal 会丢失边界竞态 (packages/cli/src/agent/runtime/ActiveTurnMailbox.ts)claimed只代表当前 turn 已取走,并不代表 durable 完成;正常终态先原子提交 inbox acknowledgement 与turn_completed,成功后才从 sidecar 删除 (packages/cli/src/agent/runtime/SessionRuntime.ts,packages/cli/src/context/storage/PersistentStore.ts)- abort 默认不确认输入,使进程故障、取消和暂态失败可在冷启动重放;只有显式
acknowledgeInput或 terminal queue-full 等确定性边界才能消费对应 ID (packages/cli/src/agent/runtime/SessionRuntime.ts,packages/cli/src/context/storage/PersistentStore.ts) prepareInputTurn()总是先把输入持久到 inbox 再建立 owner;若已有旧 pending input,新 prompt 排在其后且返回mode: pending,不能越过恢复输入直接执行 (packages/cli/src/agent/runtime/ActiveTurnMailbox.ts)- user steering 上限为 20 条且受内容/schema/metadata 合并预算约束;background completion 独立使用 100 条与约 7 MiB 预算,但所有来源最终还共享 8 MiB inbox 文件硬上限 (
packages/cli/src/agent/runtime/ActiveTurnMailbox.ts,packages/cli/src/agent/runtime/DurableSteeringInbox.ts) - 指定相同 message ID 的重复 enqueue 被视为幂等成功;调用方必须复用 durable identity,不能在 retry 时生成新 ID 导致重复 follow-up (
packages/cli/src/agent/runtime/ActiveTurnMailbox.ts) - inbox 打开时会用 JSONL acknowledgement 和已应用的 abort receipt 过滤消息,并把剩余项标记 recovered;损坏或超 8 MiB 的 sidecar 直接 fail closed (
packages/cli/src/agent/runtime/DurableSteeringInbox.ts) - Session lease 只有在 PID 存活且进程启动身份仍匹配时才阻止新 owner;PID 被复用会回收旧锁,release 也会核对
ownerId以免删除后来 owner 的锁 (packages/cli/src/agent/runtime/SessionLease.ts) - Runtime 必须先取得 Session lease,再依次修复 foreground/background 进程、patch、subagent、mailbox、orphan tool/turn 和 Goal receipt;初始化中途失败会调用 dispose 释放部分资源 (
packages/cli/src/agent/runtime/SessionRuntime.ts,git:8cd32a8a) - 通用 interrupted-turn recovery 不处理仍有 pending durable interaction 的 tool call,该调用必须留给专用 interaction recovery,避免先写 uncertain result 再重放问题 (
packages/cli/src/context/storage/PersistentStore.ts,docs/reference/durable-pending-interactions.md) - interaction request 只有在所属 tool call 已 durable commit 后才能展示,且 request/response 各自不得超过 128 KiB;否则 UI 不应看到不可恢复的问题 (
packages/cli/src/services/SessionInteractionService.ts) - interaction 恢复不会重放原工具:它先用原
toolCallId写带 provenance 的关闭结果,再把用户决定写入 inbox,最后提交interaction_recovered(packages/cli/src/services/SessionInteractionService.ts) - MCP elicitation 的 durable response 只保留 action、reason 与是否打开 URL,不保存表单 content;重启后若仍需要敏感字段必须重新请求 (
packages/cli/src/services/SessionInteractionService.ts,docs/reference/durable-pending-interactions.md) - 大 prompt 超过内联阈值后,JSONL/inbox 仅保存有界头尾、图片布局和 SHA-256 引用;artifact 缺失、被篡改、权限不为私有或 layout 不一致时必须在 Provider 前失败 (
packages/cli/src/agent/runtime/UserPromptArtifactStore.ts) - 旁路问答复制当前 messages 并使用独立 provider session ID,返回中的任何 tool call 都被拒绝;问题和答案都不进入主 transcript,也不能驱动主任务 (
packages/cli/src/services/SideConversationService.ts,git:761e85e9) - 用户 Shell 在活动 turn 中必须“先保存 JSONL,再以 persisted auxiliary steering 入队”;若 turn 已封口则进入下一 turn,不能发布完成事件后再补持久化 (
packages/cli/src/agent/runtime/SessionRuntime.ts,docs/reference/session-user-shell-command.md) - user shell 的 live stream 与最终 capture 是独立预算;binary 检测后只保留字节摘要,
completed事件还必须等待异步 output callback 全部 drain (packages/cli/src/services/UserShellCommandService.ts)
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.
- 4d ago First seen · 75 lines · 161 tokens per session scan A 21ec31e691d9
knowledge-session-state-and-context-active-turn-interactions-and-recovery is a skill published in the GitHub repository echoVic/blade-code (178 stars, last pushed yesterday), licensed MIT. It adds 161 tokens to every session and 2,789 once invoked, about $0.0008 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.
Other skills, from other repositories
algorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright…
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external agents through well-designed tools. Use when building MCP servers to integrate external APIs or agents, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
slack-gif-creator
Toolkit for creating animated GIFs optimized for Slack, with validators for size constraints and composable animation primitives. This skill applies when users request animated GIFs or emoji animations for Slack from descriptions like "make me a GIF for Slack of X doing Y".
canvas-design
Create beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.
self-improvement
A process for recording useful lessons from unexpected failures, user corrections, missing abilities, and reusable project patterns.
travel-planner
Creates comprehensive travel itineraries with destination analysis, budget planning, transportation, accommodation, and local insights. Use when planning trips, organizing travel schedules, or seeking destination recommendations.