agentsclimarketplace

Sqlite session persistence

Skill kjuhwa/skills-hub/skills/session-management/sqlite-session-persistence

Self-correcting knowledge corpus for Claude Code — 9 stable shape clusters, bias-correction pipeline baked into contribution flow. 47 papers, 45 techniques, 1.1k skills.

Install
npx -y skills add kjuhwa/skills-hub --skill sqlite-session-persistence

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Persist agent conversation history to SQLite for durable multi-turn sessions across process restarts.

SKILL.md

2.2 KB, 366 tokens by cl100k_base, as published. Nobody here has run it

sqlite-session-persistence

Use SQLiteSession(session_id, db_path="...") to persist conversation history to a local SQLite database. History survives process restarts and can be shared across multiple processes reading the same file.

When to apply

Single-server deployments, CLI tools, or development environments where you need persistent multi-turn conversation without a separate database service.

Core snippet

import asyncio
from agents import Agent, Runner, SQLiteSession

agent = Agent(name="Assistant", instructions="Reply very concisely.")

async def main():
    session_id = "user_123_conversation"
    session = SQLiteSession(session_id, db_path="conversations.db")

    # Turn 1 — new conversation
    result = await Runner.run(
        agent,
        "What city is the Golden Gate Bridge in?",
        session=session,
    )
    print(f"Turn 1: {result.final_output}")

    # Turn 2 — history loaded from SQLite
    result = await Runner.run(agent, "What state is it in?", session=session)
    print(f"Turn 2: {result.final_output}")

asyncio.run(main())
# After process restart, run again with the same session_id — history is preserved

Key notes

  • Default db_path is ~/.agents_sessions.db if not specified
  • Session ID is the lookup key; use a stable per-user or per-conversation ID
  • SQLite is single-writer; for multi-process writes, use RedisSession instead
  • Install: pip install openai-agents (SQLite included); Redis: pip install 'openai-agents[redis]'
  • History compaction can be enabled via RunConfig(session_settings=SessionSettings(compaction=...))

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Gives 0 of the 12 instructions most databases sql skills give in 366 tokens

Counted across 589 of the 662 authors here whose files we hold, read 2026-08-07

  • Use parameterized queriesin 37 of 589, across 34 files
  • Use timestamptz for timestampsin 30 of 589, across 14 files
  • Index foreign keysin 29 of 589, across 18 files
  • Create indexes concurrentlyin 29 of 589, across 24 files
  • Use numeric type for moneyin 25 of 589, across 8 files
  • Use cursor pagination instead of offsetin 24 of 589, across 17 files
  • Select only required columnsin 24 of 589, across 20 files
  • Add indexes manually on foreign key columnsin 22 of 589, across 12 files
  • Normalize to third normal formin 19 of 589, across 10 files
  • Configure connection poolingin 19 of 589, across 17 files
  • Put equality columns before range columns in indexesin 18 of 589, across 10 files
  • Read individual rule files for detailed explanationsin 18 of 589, across 4 files

Said here and by no other author read

  • use SQLiteSession to persist conversation history
  • specify a session_id as the lookup key
  • use a stable per-user or per-conversation session id
  • specify a db_path or use the default
  • pass the session to Runner.run
  • install the openai-agers package

Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.

Keep looking

Skills are one crate of 327,069. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.