CinvanaAI
← All projects

Library · Games & interaction

Persistent Interaction State

Save a multi-step conversation, resume it later and refuse stale updates.

Repository: CinvanaAI/persistent-discord-state-machine

Recorded synthetic example. Source with a complete offline example.

See the idea in action.

The example closes and reopens storage, resumes the saved step and updates its payload without Discord.

Example input
A three-step synthetic interaction saved under a guild/user session key.
Captured result
started WorkflowSession(guild_id=42, user_id=1001, state='choose_name', payload={'campaign': 'Synthetic'}, revision=1, updated_at='2026-09-20T10:28:26Z')
resumed WorkflowSession(guild_id=42, user_id=1001, state='choose_name', payload={'campaign': 'Synthetic'}, revision=1, updated_at='2026-09-20T10:28:26Z')
transitioned WorkflowSession(guild_id=42, user_id=1001, state='confirm', payload={'campaign': 'Synthetic', 'name': 'Example Hero'}, revision=2, updated_at='2026-09-20T10:28:26Z')
stale confirmation rejected; preserved payload {"campaign": "Synthetic", "name": "Revised Hero"}
complete None

Try the example.

From the repository root, follow the dependency requirements in the README. This example uses supplied synthetic material.

python -m pip install -e .
python examples/resume_demo.py

The example closes and reopens storage, resumes the saved step and updates its payload without Discord.

Complete setup and instructions ↗

The interesting part.

The durable continuation point is a reusable piece independent of Discord networking.

Focused extraction

Where it came from.

Durable direct-message session mechanism from Persistent Discord RPG.

Hardens the mechanism with revisions, stale-state checks, guarded completion and typed results.

A platform-neutral persistent interaction mechanism; no bot client or campaign database is included.

Source ↗

Follow the family: Persistent Discord RPG and its reusable mechanisms

  • Extracted fromPersistent Discord RPG

    See the integrated setting from which this independently useful mechanism was separated. The extract contains new neutral interfaces and hardening; the original integrated application remains represented.

    Source ↗