Skip to main content

Git-native, human-readable session memory for AI agents. Every decision is a commit, every state is Markdown.

Project description

cervellaswarm-session-memory

Git-native, human-readable session memory for AI agents.

Every decision is a commit. Every state is Markdown. Every audit trail is a git log away.

Session 1          Session 2          Session 3
   |                  |                  |
   v                  v                  v
+-----------+    +-----------+    +-----------+
| State.md  |--->| State.md  |--->| State.md  |
| (v1)      |    | (v2)      |    | (v3)      |
+-----------+    +-----------+    +-----------+
   |                  |                  |
   v                  v                  v
  git commit        git commit        git commit

No vector databases. No cloud services. No embedding models.

Why This Exists

AI agent frameworks lose context between sessions. Your agent forgets decisions, repeats mistakes, and can't explain what happened yesterday.

Current solutions store memory in opaque binary formats (LanceDB, ChromaDB, Qdrant) that you can't read, can't version-control, and can't audit.

cervellaswarm-session-memory takes a different approach: plain Markdown files tracked in git.

Installation

pip install cervellaswarm-session-memory

Requires Python 3.10+. Single dependency: pyyaml.

Quick Start

Initialize a project

cervella-session init my-project

This creates:

.session-memory/
  my-project/
    SESSION_STATE_my-project.md    # Your session state
    archive/                        # Old states go here
PROJECT_COMPASS.md                  # Project direction

Check quality

cervella-session check my-project

Scores your session state on 4 criteria (0-10 scale):

  • Actionability (30%): Are there clear TODOs and next steps?
  • Specificity (30%): Dates and numbers, or vague "soon" and "maybe"?
  • Freshness (20%): Updated this week, or gathering dust?
  • Conciseness (20%): Within line limits, or a novel?

Audit for secrets

cervella-session audit .session-memory/

Detects accidentally committed API keys, tokens, passwords, and private keys. Supports custom patterns via config.

Verify sync status

cervella-session sync my-project

Checks freshness, file size limits, git tracking, and uncommitted changes.

List projects

cervella-session list

Python API

from cervellaswarm_session_memory import (
    init_project,
    check_quality,
    audit_directory,
    verify_project,
    discover_projects,
)

# Initialize
project = init_project("my-project", project_root=Path("/path/to/repo"))

# Quality check
result = check_quality(project.state_file, project.name)
print(f"Score: {result.total}/10 [{result.status}]")

# Secret audit
audit = audit_directory(Path(".session-memory"))
assert audit.clean, f"Found {audit.critical_count} critical secrets!"

# Sync verification
sync = verify_project("my-project")
print(f"Overall: {sync.overall.value}")

# Discovery
projects = discover_projects()
for p in projects:
    print(f"  {p.name}: {p.state_file}")

Configuration

Create .cervella/session-memory.yaml in your project root:

# Where session memory files live
memory_dir: ".session-memory"

# File size limits
max_lines: 300
warning_lines: 200

# Quality scoring weights (must sum to 1.0)
quality:
  weights:
    actionability: 0.30
    specificity: 0.30
    freshness: 0.20
    conciseness: 0.20
  target_score: 8.0

# Secret scanning
secrets:
  extra_patterns:
    - pattern: "CUSTOM_KEY_[a-zA-Z0-9]+"
      name: "Custom API Key"

# Multi-project registry
projects:
  my-app:
    path: ~/Developer/MyApp
  my-api:
    path: ~/Developer/MyAPI

Config priority: CERVELLASWARM_SESSION_MEMORY_CONFIG env var > project .cervella/session-memory.yaml > user ~/.claude/session-memory.yaml > defaults.

How It Compares

Feature CervellaSwarm CrewAI Memory AutoGen Memory Letta
Storage format Markdown files LanceDB (binary) ChromaDB (binary) PostgreSQL
Version control git native manual none developing
Human readable 100% no no partial
Cloud required never optional optional optional
Setup time < 5 min 10-30 min varies varies
Audit trail git log none none developing
EU AI Act ready yes no no developing
Dependencies 1 (pyyaml) LanceDB + embeddings ChromaDB + embeddings PostgreSQL + more
Multi-project native no no no

Honest note: CrewAI and AutoGen offer semantic search over memory using vector embeddings, which we deliberately don't include. If you need similarity-based retrieval, pair this package with cervellaswarm-code-intelligence or use a vector store alongside it. Our bet is that explicit, human-curated session state is more reliable than automated extraction for critical decisions.

Template System

Session state files are created from templates with {{ placeholder }} substitution. The built-in templates provide a battle-tested structure for tracking:

  • Session progress: What was done, what's next
  • Decisions: What was decided, why, and when
  • Project status: Progress bars and phase tracking
  • Archive: Historical session summaries

JSON Output

All CLI commands support --json for integration with CI/CD and automation:

cervella-session check --json | jq '.[] | select(.total < 8)'

License

Apache-2.0. See LICENSE for details.

Part of CervellaSwarm

This package is part of the CervellaSwarm multi-agent framework. Other packages:

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_session_memory-0.1.0.tar.gz (38.5 kB view details)

Uploaded Source

Built Distribution

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

cervellaswarm_session_memory-0.1.0-py3-none-any.whl (27.0 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for cervellaswarm_session_memory-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b4706747e162dec71772fac5faa2afbac701817d6771a4afa03198f1c4a5f490
MD5 070ca40ed5093306c216b00cfaeb7acd
BLAKE2b-256 1d02ee2e836b5d3f3a34aaea041cc30d3edf02c854b230aa14d51c6777efbffc

See more details on using hashes here.

Provenance

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

Publisher: publish-session-memory.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_session_memory-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cervellaswarm_session_memory-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 078ca9f7f6bfc2fd3c864a8228e3335bc74a994e578fc026373181616c12c0c9
MD5 f2d3ba081d509d514263679d20a55b97
BLAKE2b-256 0cc3fb0717f447a165b86155b2454b769cda2613ed3b96224c6ce08ba6456aa8

See more details on using hashes here.

Provenance

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

Publisher: publish-session-memory.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