Skip to main content

Repo-native institutional memory CLI for Enterprise Architecture work.

Project description

cwmem

PyPI version Python 3.12+ License: MIT

cwmem is a repo-native institutional memory CLI for Enterprise Architecture work.

It keeps fast operational state in SQLite, exports deterministic collaboration artifacts under memory/, and gives both humans and coding agents a consistent way to capture decisions, events, entities, and graph links inside a repository.

Who it is for

  • AI coding agents that need a stable, scriptable memory layer next to the code they change
  • Enterprise architects who want architecture decisions, milestones, and relationships stored in the repo
  • Platform and delivery teams who need search, reviewable exports, and a shared institutional memory

What cwmem gives you

  • entry CRUD with automatic lifecycle events
  • tags, formal events, and entity / edge graph workflows
  • lexical, semantic, hybrid, and graph-expanded retrieval
  • deterministic sync export / sync import for checked-in artifacts
  • dry-run, idempotency keys, sidecar locking, plan, validate, apply, and verify
  • a machine-first JSON-envelope CLI with human-readable help and version output

Installation

With pip:

pip install cwmem

With uv:

uv tool install cwmem

Check the installed version:

cwmem --version

Quick start

POSIX shells

# Initialize the repository memory surfaces
cwmem init

# Capture a decision or note
cwmem add --title "Adopt repo-native memory" --type decision \
  "Store architectural context alongside the codebase."

# Search and inspect what you stored
cwmem search "repo-native memory"
cwmem list

# Add structure with entities and graph edges
cwmem entity-add --entity-type system --name "cwmem"
cwmem link mem-000001 ent-000001 --relation references

# Export tracked artifacts and verify consistency
cwmem sync export
cwmem sync export --check
cwmem verify

PowerShell

# Initialize repository memory surfaces
cwmem init

# Capture a decision
cwmem add --title "Adopt repo-native memory" --type decision `
  "Store architectural context alongside the codebase."

# Read JSON envelopes naturally in PowerShell
cwmem search "repo-native memory" | ConvertFrom-Json

# Export and verify
cwmem sync export
cwmem verify

How cwmem fits into a repository

cwmem keeps two views of the same memory system:

  • runtime state in .cwmem/ for SQLite, indexes, lock files, and generated plans
  • tracked collaboration artifacts in memory/ for review, sync, and git history

The main tracked surfaces are:

  • memory/entries/
  • memory/events/
  • memory/graph/
  • memory/taxonomy/
  • memory/manifests/

This split gives you fast local operations without giving up reviewable, deterministic files in version control.

Core workflow

For everyday memory capture:

cwmem init
cwmem add --title "Architecture decision" --type decision "Capture the rationale."
cwmem event-add --event-type milestone "MVP shipped"
cwmem search "architecture decision"
cwmem related mem-000001
cwmem sync export
cwmem verify

For higher-risk workflows that should be reviewed before mutating state:

cwmem plan sync-import --plan-out .cwmem/plans/import-plan.json
cwmem validate --plan .cwmem/plans/import-plan.json
cwmem apply --plan .cwmem/plans/import-plan.json
cwmem verify

Safety model

Every command writes exactly one JSON envelope to stdout. That makes the CLI easy to automate, inspect, and pipe into other tooling.

Reads are parallel-safe. Mutating commands serialize through .cwmem/memory.sqlite.lock and support safety flags such as:

  • --dry-run
  • --idempotency-key
  • --wait-lock
  • --plan-out

Use cwmem guide when you want the machine-readable command catalog, schema information, and workflow contract.

Command groups

Command What it is for
cwmem guide Machine-readable CLI contract and workflow metadata
cwmem init / status Bootstrap and inspect repository memory surfaces
cwmem add, update, tag-add, event-add, entity-add, link Capture or mutate memory records
cwmem get, list, search, related, graph, log Read, retrieve, search, and traverse memory
cwmem sync export / sync import Move between SQLite runtime state and checked-in artifacts
cwmem build, stats, validate, plan, apply, verify Rebuild derived data, inspect health, and run safe workflows

Deterministic collaboration surface

cwmem sync export writes a deterministic memory/ tree so that:

  • pull requests can review memory changes like code changes
  • the runtime database can be reconstructed from tracked artifacts
  • CI can detect drift with cwmem sync export --check

This makes architecture memory auditable rather than hidden in a local database.

Local quality gate

Run this before opening a PR or cutting a release:

uv run ruff check src tests
uv run pyright src
uv run pytest --tb=short
uv build

Release automation

  • CI workflow: .github/workflows/ci.yml
  • Publish workflow: .github/workflows/publish.yml
  • Contributor guide: CONTRIBUTING.md
  • Agent expectations: AGENTS.md

PyPI publishing uses GitHub OIDC Trusted Publisher with the pypi environment and publishes automatically on pushes to master.

Repository docs

  • README.md — product overview and quick start
  • CONTRIBUTING.md — local development and release checklist
  • AGENTS.md — agent expectations and workflow conventions

If you want the CLI to explain itself interactively, start with:

cwmem --help
cwmem guide

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

cwmem-0.2.1.tar.gz (56.9 MB view details)

Uploaded Source

Built Distribution

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

cwmem-0.2.1-py3-none-any.whl (28.4 MB view details)

Uploaded Python 3

File details

Details for the file cwmem-0.2.1.tar.gz.

File metadata

  • Download URL: cwmem-0.2.1.tar.gz
  • Upload date:
  • Size: 56.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cwmem-0.2.1.tar.gz
Algorithm Hash digest
SHA256 37ea180cced7f18b4812fce56c07c6774a0552f3a5c4faf2acd60e65a05de9fc
MD5 b6442ff34d39fbf929d4078fd0efa1bd
BLAKE2b-256 9226744e4eeb324761a746c1184f42afa077e412ae97d556e3ab2979d3988fb4

See more details on using hashes here.

Provenance

The following attestation bundles were made for cwmem-0.2.1.tar.gz:

Publisher: publish.yml on ThomasRohde/cwmem

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

File details

Details for the file cwmem-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: cwmem-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 28.4 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cwmem-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8cec7b36c92c779e3e77c455ceb336e35218115c637f137d2a895f217b2ad65b
MD5 e0d0c02600c81a69926bdad378d70c62
BLAKE2b-256 6aea672c094746e8939651493acdb58c54e5d34a7002a000c142d3f2ee28386a

See more details on using hashes here.

Provenance

The following attestation bundles were made for cwmem-0.2.1-py3-none-any.whl:

Publisher: publish.yml on ThomasRohde/cwmem

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