Conversation engine persistent session state

From ychampion/cskill-agents · View interactive version

Conversation engine persistent session state is an AI agent skill from the GitHub repository ychampion/cskill-agents. Keep session-level signals (messages, read caches, memory loads) alive across turns while letting per-turn caches reset for correctness.

How to use this skill

Skill file

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

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)

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.