Session Management

Learn how Kodezi CLI preserves conversation history, summaries, costs, and session lifecycles.

Kodezi CLI supports persistent sessions, allowing you to pause and resume work seamlessly.
Every conversation, message, summary, and cost detail is stored safely so your workflow stays uninterrupted.

Key Features

  • SQLite Storage: All session data is stored in a local SQLite database, ensuring that your history is durable, consistent, and always accessible.
  • Automatic Session Titles: Kodezi automatically creates a meaningful session title based on the very first message you send. This makes it easy to identify past work at a glance.
  • Intelligent Summarization: As conversations become long, Kodezi automatically generates summaries to keep the session efficient. Summaries preserve all essential information while reducing the token footprint.
  • Token & Cost Tracking: Each session logs important usage metrics, including:
    • Input tokens
    • Output tokens
    • Cache read/write operations
    • Total estimated cost in USD

This helps you understand your usage patterns and optimize your workflow.

  • Complete History Access: All past conversations remain accessible. You can return to old sessions anytime to review instructions, code changes, or previous tasks.

Session Lifecycle

Below is the lifecycle of every Kodezi CLI session from start to finish:

1️. Session Creation: A new session begins automatically when you send your first message or initiate any command.

2️. Title Generation: Kodezi generates an AI based session title that reflects your topic or goal. This happens instantly and requires no manual input.

3️. Conversation Phase: All messages exchanged in the session are preserved, enabling multi step tasks, refinements, and long workflows.

4️. Summarization Phase: If the conversation becomes too long or exceeds optimal size, Kodezi compresses earlier messages into a summary. The summary retains important details while reducing context size.

5️. Persistence & Storage: All messages, summaries, and metadata are saved in SQLite.
You can exit and return later without losing any progress.

Summarization

You can request a session summary at any time by simply typing:

"Summarize this conversation"

Benefits of Summarization

  • Reduces token usage: Summaries keep your session lightweight, so you use fewer tokens overall.

  • Keeps the context clean: Only the important parts of the conversation are kept, making responses more accurate.

  • Preserves key information: No important details are lost, summaries keep the essential context.

  • Supports long conversations: Even very long sessions stay fast and responsive because older messages are condensed.

Cost Tracking Details

Kodezi automatically tracks your usage in every session. You can see exactly how much you are spending and how many tokens you are using.

The session records:

  • Input tokens: The tokens used for everything you send to Kodezi.
  • Output tokens: The tokens Kodezi generates in its responses.
  • Cache reads/writes: Shows how often cached results were used or updated.
  • Estimated cost in USD: Gives a clear idea of the total cost of the session.

These details help you monitor and manage your usage with full transparency.

Sessions Are Always Safe

Even if you close the terminal, crash the system, or restart your machine, all session data remains preserved.