conversation-engine-persistent-session-state

conversation-engine-persistent-session-state is a skill for Claude Code, Codex from ychampion/cskill-agents. It costs 32 tokens per session (404 once invoked), scanned A, original, MIT.

A conversation-engine design for keeping long-lived session information separate from temporary per-turn data. A session can retain messages, permissions, usage, and read caches while each new turn rebuilds its short-lived working state.

In plain words
What is it for?
Use it when implementing retries, abort handling, conversation history, reusable read caches, and other state that must survive across user messages.
Why use it?
It prevents stale request data from leaking into later turns while preserving the context needed for an ongoing conversation.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/ychampion/cskill-agents/conversation-engine-persistent-session-state
Any agent
npx skills add ychampion/cskill-agents --skill conversation-engine-persistent-session-state
Clone the repo
git clone --depth 1 https://github.com/ychampion/cskill-agents

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 conversation-engine-persistent-session-state

README.md
[![agentmods](https://agentmods.dev/badge/skills/ychampion/cskill-agents/conversation-engine-persistent-session-state.svg)](https://agentmods.dev/skills/ychampion/cskill-agents/conversation-engine-persistent-session-state)
Your own site
<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>
Per session 32 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 404 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00032 $0.00404
Opus 5 $0.00016 $0.00202
Sonnet 5 $0.00006 $0.00081
Haiku 4.5 $0.00003 $0.00040

Measured 5d ago against content hash 005db300bbba, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

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.

agents/claude-code/skills/conversation-engine-persistent-session-state/SKILL.md · 28 lines

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.
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. 5d ago First seen · 28 lines · 32 tokens per session scan A 005db300bbba

Subscribe to this mod's changes

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.

Related

Other skills, from other repositories

memory

Use Infinity Context MCP to search, propose, and manage durable project memory.

777genius/infinity-context · 17 tokens

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…

divyanshu-iitian/ContextFlux · 72 tokens

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.

gael55x/Grape · 48 tokens

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…

open-gsd/gsd-pi · 91 tokens

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…

repoprompt/repoprompt-ce · 83 tokens

user-general-facts

Capture and organize general facts about the user by topic.

memodb-io/Acontext · 15 tokens