Skip to main content

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.

Metadata

Release files for cervellaswarm-event-store 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cervellaswarm-event-store 0.1.0
File Size Uploaded Provenance Actions
cervellaswarm_event_store-0.1.0.tar.gz 34.6 kB With provenance Details for cervellaswarm_event_store-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cervellaswarm-event-store 0.1.0
File Interpreter ABI Platform Actions
cervellaswarm_event_store-0.1.0-py3-none-any.whl Python 3 none any Details for cervellaswarm_event_store-0.1.0-py3-none-any.whl

Total release size: 61.2 kB

Release files / cervellaswarm_event_store-0.1.0.tar.gz

Download URL cervellaswarm_event_store-0.1.0.tar.gz
Size 34.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6bf5a85b8090be9288296d0d28e1bb8fc9d06cf7b4e856fdc8288ff0322e3416
BLAKE2b-256 checksum
How to use checksums
7c530bb19a5f69f0cd421157ecb18a3b8e3d5707b556b7dc99f3263104d74284
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 25, 2026.

Transparency log

Release files / cervellaswarm_event_store-0.1.0-py3-none-any.whl

Download URL cervellaswarm_event_store-0.1.0-py3-none-any.whl
Size 26.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6d05b8caf4928372d23c83255719d2ae87c28a721d4b88c98c5ea2575a8e332c
BLAKE2b-256 checksum
How to use checksums
262ab9492f1a5266a19cbb79519add1205ab093ded6c28472da6748efbca1194
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 25, 2026.

Transparency log

Security for cervellaswarm-event-store 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for cervellaswarm_event_store-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page