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/ychampion/cskill-agents/conversation-engine-persistent-session-statenpx skills add ychampion/cskill-agents --skill conversation-engine-persistent-session-stategit clone --depth 1 https://github.com/ychampion/cskill-agentsWrote 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/ychampion/cskill-agents/conversation-engine-persistent-session-state)<a href="https://agentmods.dev/skills/ychampion/cskill-agents/conversation-engine-persistent-session-state"><img src="https://agentmods.dev/badge/skills/ychampion/cskill-agents/conversation-engine-persistent-session-state.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 | $0.00032 | $0.00404 |
| Opus 5 | $0.00016 | $0.00202 |
| Sonnet 5 | $0.00006 | $0.00081 |
| Haiku 4.5 | $0.00003 | $0.00040 |
Grade A, and why
conversation-engine-persistent-session-state 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 5d 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.
What it actually says
SKILL: Conversation Engine Persistent Session State
Domain: session-state Trigger: Apply when architecting a conversation engine that must persist session context while allowing per-turn caches and abort controllers to restart cleanly. Source Pattern: Distilled from reviewed session memory, compaction, and context-budgeting implementations.
Core Method
Divide engine state into session scope and turn scope. Session scope keeps long-lived data such as conversation history, cumulative usage, permissions, and reusable read caches for the life of the engine. Turn scope recreates abort handles, transient discovery sets, scratch buffers, and other request-local intermediates every time a new submission starts. On retries, preserve the session data but rebuild the turn-local state from scratch so the engine stays consistent without leaking stale flags between turns.
Key Rules
- Keep session-wide structures alive for the lifetime of the engine and mutate them in place as new data arrives.
- Recreate and dispose of turn-local abort handles, discovery sets, and scratch buffers on every submission.
- Clear any turn-specific derived context before the next turn begins, but do not reset the retained session history.
- On soft retries, reuse the session state and throw away only the transient work for the failed attempt.
Example Application
When building a coding-cli-style engine, use this method to keep the conversation history, file caches, and usage counters across hundreds of turns while the abort controller, skill discovery set, and other per-turn caches are reinitialized each time.
Anti-Patterns (What NOT to do)
- Don’t reconstruct the entire session state every turn; that drops history and resets usage tracking.
- Don’t keep per-turn abort controllers or discovery sets alive past the turn—they can leak cancellations or stale skill data into future turns.
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.
- 5d ago First seen · 28 lines · 32 tokens per session scan A 005db300bbba
conversation-engine-persistent-session-state is a skill published in the GitHub repository ychampion/cskill-agents (36 stars, last pushed 5mo ago), licensed MIT. It adds 32 tokens to every session and 404 once invoked, about $0.0002 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
memory
Use Infinity Context MCP to search, propose, and manage durable project memory.
context-efficient-coding
Use ContextFlux to minimize coding-agent context and tool calls when exploring, planning, debugging, reviewing, or modifying an unfamiliar or multi-file repository. Trigger for codebase discovery, symbol search, architecture questions, cross-file changes, error tracing, review feedback, test discovery, or any request…
grape
Use Grape MCP for Codex context continuity in coding repositories. Use when a task needs repeated-turn context, omitted context restore, stale-context checks, invalidation checks, or safe continuity across branch and dirty-worktree changes.
handoff
Prepare a clean cross-session handoff so the next agent can pick up where you left off. Writes a focused continue.md in the active slice dir and ensures STATE.md + summary artifacts are current. Use when asked to "hand off", "prepare handoff", "pause work", "bookmark this", "I'll come back to this later", before…
rpce-test-quality
Select, design, review, consolidate, or remove RepoPrompt CE tests, diagnostic harnesses, and smoke checks by regression value and maintenance cost. Use when the task centers on test, diagnostic, or smoke coverage, including whether a single regression test is worth committing. Do not use for feature or bug-fix work…
user-general-facts
Capture and organize general facts about the user by topic.