Skip to main content

SQLite event database for AI agent session tracking and analytics

Project description

cervellaswarm-event-store

SQLite event database for AI agent session tracking and analytics.

Zero dependencies. Pure Python stdlib.

Features

  • Three-table schema: events, lessons, error_patterns
  • WAL mode: concurrent reads and fast writes
  • Relevance scoring: lessons ranked by agent, project, severity, and confidence
  • Pattern detection: similarity clustering via difflib.SequenceMatcher
  • Config priority: env var > .cervella/event-store.yaml > ~/.claude/event-store.yaml > defaults
  • In-memory mode: EventStore(":memory:") for fast testing
  • Type-safe: frozen dataclasses with __post_init__ validation throughout

Install

pip install cervellaswarm-event-store

Quick Start

from cervellaswarm_event_store import EventStore, Event, Lesson

with EventStore() as store:
    # Log an event
    event = Event(
        event_type="task_completed",
        agent_name="backend",
        project="my-project",
        description="Implemented auth endpoint",
        success=True,
        duration_ms=1200,
    )
    event_id = store.log_event(event)

    # Log a lesson
    lesson = Lesson(
        context="FastAPI auth",
        problem="JWT decode failed silently",
        solution="Always validate algorithm explicitly",
        pattern="explicit-algorithm-validation",
        confidence=0.9,
    )
    store.log_lesson(lesson)

    # Query
    result = store.query_events(project="my-project", limit=10)
    stats = store.get_statistics()
    lessons = store.get_lessons(project="my-project", limit=5)
    patterns = store.detect_patterns(days=7, min_occurrences=3)

CLI

# Initialize database
cervella-events init

# Log an event
cervella-events log --type task_completed --agent backend --project myproj

# Query events
cervella-events query --project myproj --limit 20 [--json]

# Statistics
cervella-events stats [--project myproj] [--json]

# Lessons
cervella-events lessons --project myproj --limit 5 [--json]

# Pattern detection
cervella-events patterns --days 7 --min-occurrences 3 [--json]

Schema

events

Tracks every agent action: task start/complete/fail, session events, custom events.

lessons

Structured knowledge extracted from sessions, with confidence scoring and relevance ranking.

error_patterns

Recurring error signatures detected via similarity analysis.

Configuration

Default DB path: .cervella/event-store.db (project-local).

Override via:

  1. CERVELLASWARM_EVENT_STORE_DB environment variable (explicit DB path)
  2. CERVELLASWARM_EVENT_STORE_CONFIG environment variable (config file path)
  3. .cervella/event-store.yaml in project root
  4. ~/.claude/event-store.yaml (user-level)

License

Apache-2.0. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cervellaswarm_event_store-0.1.0.tar.gz (34.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cervellaswarm_event_store-0.1.0-py3-none-any.whl (26.6 kB view details)

Uploaded Python 3

File details

Details for the file cervellaswarm_event_store-0.1.0.tar.gz.

File metadata

File hashes

Hashes for cervellaswarm_event_store-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6bf5a85b8090be9288296d0d28e1bb8fc9d06cf7b4e856fdc8288ff0322e3416
MD5 f8cd1e6d2a60b28a75e07f6847e7c44a
BLAKE2b-256 7c530bb19a5f69f0cd421157ecb18a3b8e3d5707b556b7dc99f3263104d74284

See more details on using hashes here.

Provenance

The following attestation bundles were made for cervellaswarm_event_store-0.1.0.tar.gz:

Publisher: publish-event-store.yml on rafapra3008/cervellaswarm-internal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cervellaswarm_event_store-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cervellaswarm_event_store-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6d05b8caf4928372d23c83255719d2ae87c28a721d4b88c98c5ea2575a8e332c
MD5 fc8de7c7c0c752fb372f8830045673a6
BLAKE2b-256 262ab9492f1a5266a19cbb79519add1205ab093ded6c28472da6748efbca1194

See more details on using hashes here.

Provenance

The following attestation bundles were made for cervellaswarm_event_store-0.1.0-py3-none-any.whl:

Publisher: publish-event-store.yml on rafapra3008/cervellaswarm-internal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page