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 agentmods add skills/nteract/nteract/mcp-session-lifecyclenpx skills add nteract/nteract --skill mcp-session-lifecyclegit clone --depth 1 https://github.com/nteract/nteractWrote 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/nteract/nteract/mcp-session-lifecycle)<a href="https://agentmods.dev/skills/nteract/nteract/mcp-session-lifecycle"><img src="https://agentmods.dev/badge/skills/nteract/nteract/mcp-session-lifecycle.svg" alt="Measured on agentmods" height="20"></a>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.00071 | $0.02994 |
| Opus 5 | $0.00036 | $0.01497 |
| Sonnet 5 | $0.00014 | $0.00599 |
| Haiku 4.5 | $0.00007 | $0.00299 |
Grade A, and why
mcp-session-lifecycle 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 today.
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 — 254 lines — stays where its author put it; the contents beside it link to each section on GitHub.
MCP Session Lifecycle
Use this skill when debugging session state, changing reconnection logic, working on the proxy, or reasoning about races between background rejoin and user-initiated tool calls.
Source checkpoint: 2026-09-04 at 6bff3e7b. The decision record is
docs/adr/mcp-session-lifecycle.md. Read the source functions below rather
than copying an abbreviated session struct or reconnect algorithm.
Three Layers
- Process supervision: installed
nteract-mcpand developmentmcp-supervisoruse therunt-mcp-proxylibrary to supervise arunt mcpchild. The library is not an executable entrypoint. - MCP session state: the child owns one active
NotebookSession, a bounded map of parked sessions, explicit activation generations, and the daemon watch loop. - Daemon room state:
runtimedowns notebook rooms, runtime state, kernels, recovery, and peer accounting. Kernel teardown and room reaping are separate.
The shipped MCP entrypoints use stdio. Multiple MCP clients can run separate children against the same daemon, including the same notebook room. Concurrent requests on one stdio connection share that child's active slot; they are not independent MCP clients. The daemon's multiplexed notebook frames are a separate protocol, not an HTTP MCP endpoint.
Entry points: crates/runt/src/main.rs:739,
crates/nteract-mcp/src/main.rs:260, and
crates/mcp-supervisor/src/main.rs:2910.
Proxy Layer
McpProxy::track_session and session::extract_session_id track one preferred
restart target, despite the field name last_notebook_id:
- Successful connect/create calls prefer the child's canonical file path for local file-backed notebooks, falling back to a UUID. Hosted targets retain their URL identity.
- Successful
save_notebookpromotes a local UUID target to the saved path. - Disconnecting the active notebook clears the handoff. Disconnecting another parked notebook preserves it. Failed calls do not replace the target.
- Restart re-resolves the child executable and seeds
NTERACT_MCP_REJOIN_NOTEBOOK. It does not reconstruct the parked map. - Exit 75 is an intentional daemon-upgrade handoff, separate from the normal crash budget. Other restarts are subject to the proxy's restart controls.
- Daemon-version banners compare the old and new child's reported
ServerInfo.server_info.title, not binary SHA. A banner says rejoin was requested; it does not prove that notebook readiness has completed. - The
reconnecttool restarts the child, not the daemon.
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.
- today Changed · +2 lines 30ca3e5d95d5
- 6d ago First seen · 252 lines · 71 tokens per session scan A b95db106ea2d
mcp-session-lifecycle is a skill published in the GitHub repository nteract/nteract (166 stars, last pushed yesterday), licensed BSD-3-Clause. It adds 71 tokens to every session and 2,994 once invoked, about $0.0004 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-08-30.
Other skills, from other repositories
systematic-debugging
Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.
local-ai-agents
Build local-first AI agents that run entirely on a developer workstation with Microsoft Foundry Local and Qwen function-calling models. Covers Small Language Models (SLMs), the OpenAI-compatible local endpoint, sandboxed local tools, local RAG with Chroma, local MCP servers, hybrid cloud/local routing, and the…
next-cache-components-adoption
Turn on Cache Components in a Next.js app and resolve the blocking routes it surfaces. Use when the user wants to enable, adopt, or migrate to Cache Components, flip the cacheComponents flag, work through a flood of blocking-prerender / instant validation errors, run the cache-components-instant-false codemod, or…
next-partial-prefetching-adoption
Turn on Partial Prefetching in a Next.js app and work through the insights it surfaces. Use when the user wants to enable or adopt Partial Prefetching, flip the partialPrefetching flag, opt routes in with export const prefetch = 'partial', audit Link prefetch={true} behavior, preserve existing prefetched UI with…
chronicle
Analyze Copilot session history for standup reports, usage tips, session search, and session reindexing. Use when the user asks for a standup, daily summary, usage tips, workflow recommendations, wants to search or find past sessions by keyword/file/PR, wants to reindex their session store, or asks about deleting…
imagegen
Generate or edit raster images when the task benefits from AI-created bitmap visuals such as photos, illustrations, textures, sprites, mockups, or transparent-background cutouts. Use when Codex should create a brand-new image, transform an existing image, or derive visual variants from references, and the output…