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:
CERVELLASWARM_EVENT_STORE_DBenvironment variable (explicit DB path)CERVELLASWARM_EVENT_STORE_CONFIGenvironment variable (config file path).cervella/event-store.yamlin project root~/.claude/event-store.yaml(user-level)
License
Apache-2.0. See LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cervellaswarm_event_store-0.1.0.tar.gz.
File metadata
- Download URL: cervellaswarm_event_store-0.1.0.tar.gz
- Upload date:
- Size: 34.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6bf5a85b8090be9288296d0d28e1bb8fc9d06cf7b4e856fdc8288ff0322e3416
|
|
| MD5 |
f8cd1e6d2a60b28a75e07f6847e7c44a
|
|
| BLAKE2b-256 |
7c530bb19a5f69f0cd421157ecb18a3b8e3d5707b556b7dc99f3263104d74284
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cervellaswarm_event_store-0.1.0.tar.gz -
Subject digest:
6bf5a85b8090be9288296d0d28e1bb8fc9d06cf7b4e856fdc8288ff0322e3416 - Sigstore transparency entry: 991485839
- Sigstore integration time:
-
Permalink:
rafapra3008/cervellaswarm-internal@f1af9108350350308deeef84bdf6bd424976b8dd -
Branch / Tag:
refs/tags/event-store-v0.1.0 - Owner: https://github.com/rafapra3008
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-event-store.yml@f1af9108350350308deeef84bdf6bd424976b8dd -
Trigger Event:
push
-
Statement type:
File details
Details for the file cervellaswarm_event_store-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cervellaswarm_event_store-0.1.0-py3-none-any.whl
- Upload date:
- Size: 26.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d05b8caf4928372d23c83255719d2ae87c28a721d4b88c98c5ea2575a8e332c
|
|
| MD5 |
fc8de7c7c0c752fb372f8830045673a6
|
|
| BLAKE2b-256 |
262ab9492f1a5266a19cbb79519add1205ab093ded6c28472da6748efbca1194
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cervellaswarm_event_store-0.1.0-py3-none-any.whl -
Subject digest:
6d05b8caf4928372d23c83255719d2ae87c28a721d4b88c98c5ea2575a8e332c - Sigstore transparency entry: 991485845
- Sigstore integration time:
-
Permalink:
rafapra3008/cervellaswarm-internal@f1af9108350350308deeef84bdf6bd424976b8dd -
Branch / Tag:
refs/tags/event-store-v0.1.0 - Owner: https://github.com/rafapra3008
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-event-store.yml@f1af9108350350308deeef84bdf6bd424976b8dd -
Trigger Event:
push
-
Statement type: