Skip to main content

Upgrade Claude Code native memory to a self-evolving digital brain — SQLite+FTS5 hot storage, L1→L2→L3 cognitive pipeline (policy induction, skill crystallization, world model), optional OpenViking cold sync, and built-in viewer

Project description

cc-star

Claude Code memory upgrade kit.

Upgrade Claude Code's native MEMORY.md (a plain text file that gets constantly truncated) into a digital-life memory system — local SQLite hot storage + FTS5 retrieval + cognitive pipeline + optional OpenViking cold sync.

pip install cc-star
cc-star init
# 30 seconds → permanent, searchable, self-evolving memory

Features

  • Persistent storage — every conversation turn saved to local SQLite database
  • Full-text search — FTS5-powered memory retrieval across all past conversations
  • Context injection — automatically injects relevant past memories before each prompt
  • Cognitive pipeline — turns raw conversation history into structured knowledge:
    • L1 Capture — auto-collect every turn with metadata (tags, agent name, timestamps)
    • Reward Engine — apply outcome signals (success/failure/correction), backpropagate temporal discounts
    • L2 Policy Induction — extract reusable patterns from successful outcomes, build candidate pool with confidence scoring
    • L3 Skill Crystallization — promote high-frequency patterns into callable skills with test cases and trigger conditions
    • World Model — cluster concepts from memory, extract entity-relation triples for associative retrieval
  • Compression protection — preserves critical context (MEMORY.md, STATUS.md) across Claude Code compaction events
  • Optional OpenViking sync — cold storage with semantic search
  • Built-in viewer — embedded SPA web UI to browse traces, policies, skills, concepts
  • Zero Claude Code configcc-star init handles all hook registration

Why cc-star stands out: Most Claude Code memory systems stop at "store + search." cc-star goes further — it thinks about what it stores. The cognitive pipeline automatically distills raw conversations into policies, skills, and conceptual knowledge, turning your AI's experience into an ever-improving knowledge base. No other open-source memory system for Claude Code offers this capability.

Quick Start

# Install
pip install cc-star

# Initialize (30 seconds)
cc-star init

# Start a new Claude Code session — memories will be automatically
# stored, searched, and injected

# Search your memory
cc-star search "how did we fix the auth bug?"

# Check status
cc-star status

Commands

Command Description
cc-star init Initialize the memory system
cc-star status Show memory system status
cc-star search <query> Search local memory
cc-star config View all configuration
cc-star config <key> <value> Update configuration
cc-star uninstall Remove hooks from Claude Code settings

Configuration

Config file: ~/.cc-star/config.yaml

agent:
  name: assistant
  tags: ["claude-code"]
storage:
  path: ~/.cc-star/data
memory:
  max_inject: 5
ov:
  enabled: false
  url: ""
  sync_batch: 50
hooks:
  timeout_inject: 10
  timeout_store: 15
  timeout_summary: 30
  timeout_session_start: 10
  timeout_compact_save: 5
  timeout_compact_restore: 10

Architecture

┌─────────────────────────────────────────────────────┐
│                    cc-star                            │
│  ┌──────────┐  ┌─────────────────────────────────┐   │
│  │  CLI      │  │  5 Hook Scripts (auto-run)       │   │
│  │  init     │  │  ├─ SessionStart  → last session │   │
│  │  status   │  │  ├─ Inject        → FTS5+OV检索   │   │
│  │  search   │  │  ├─ Store         → 存储本轮对话   │   │
│  │  config   │  │  ├─ Summary       → 摘要+批量同步   │   │
│  │  viewer   │  │  └─ Compact       → 压缩保护       │   │
│  └──────────┘  └────────┬───────────┬───────────┘   │
│                          │           │                 │
│              ┌───────────▼───────────▼────┐            │
│              │    Cognitive Pipeline       │            │
│              │  L1 Capture → Reward → L2   │            │
│              │  Policy Induction → L3 Skill │            │
│              │  Crystallization → World     │            │
│              │  Model (concepts + triples)  │            │
│              └───────────┬─────────────────┘            │
│                          │                              │
│              ┌───────────▼──────────────────┐            │
│              │     Storage Layer              │            │
│              │  ┌─────────┐  ┌────────────┐   │            │
│              │  │ SQLite  │  │ OpenViking  │   │            │
│              │  │ + FTS5  │  │ (optional)  │   │            │
│              │  │ 热存     │  │ 冷存·语义检索 │   │            │
│              │  └─────────┘  └────────────┘   │            │
│              └─────────────────────────────────┘            │
└─────────────────────────────────────────────────────────────┘

Hook Flow

  • SessionStart — checks OV health, shows last session summary
  • UserPromptSubmit (inject) — FTS5 + optional OV semantic search, RRF merge, injects as additionalContext
  • Stop (store) — reads transcript, extracts last turn, writes to cache.db + L1 Capture
  • SessionEnd (summary) — extracts session summary, batch syncs to OV
  • PreCompact/PostCompact (compact) — preserves MEMORY.md / STATUS.md / OV snapshot across compression

Cognitive Pipeline Flow

Raw Turn → L1 Capture → Reward Signal → L2 Policy Induction → L3 Skill Crystallization
                                         ↓
                                    World Model
                              (concept clustering +
                               entity-relation triples)
  • L1 Capture — every turn is captured with turn index, session context, tags, and agent identity
  • Reward — outcome signals (success/failure/correction) are applied with temporal discount backpropagation
  • L2 Policy — successful patterns are clustered into policy candidates with confidence scores that update over time
  • L3 Skill — high-confidence patterns are crystallized into executable skills with trigger conditions and test cases
  • World Model — concepts are extracted and clustered; entity-relation triples enable associative retrieval

Dependencies

  • httpx (>=0.28) — HTTP client for OpenViking sync
  • pyyaml (>=6.0) — YAML config parsing
  • numpy (>=1.24) — vector operations for cognitive pipeline
  • openviking (optional) — OpenViking cold storage client

License

AGPL-3.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

cc_star-0.2.2.tar.gz (54.6 kB view details)

Uploaded Source

Built Distribution

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

cc_star-0.2.2-py3-none-any.whl (72.2 kB view details)

Uploaded Python 3

File details

Details for the file cc_star-0.2.2.tar.gz.

File metadata

  • Download URL: cc_star-0.2.2.tar.gz
  • Upload date:
  • Size: 54.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cc_star-0.2.2.tar.gz
Algorithm Hash digest
SHA256 cfc7036c7663e6123d929a1d276172e8c9335cbb8b6c43c93bcfb9d751be081b
MD5 3979250db91e7ce3cadef67ac4a2642a
BLAKE2b-256 8ad39ed7fd32bcb5695c48c08f0c0f012b7a1158759447638afa64b3c3446ab8

See more details on using hashes here.

File details

Details for the file cc_star-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: cc_star-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 72.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cc_star-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 587c849b4e1d002bccec9826a4996082e8c5f63b2f38520e69b41e641923dcfb
MD5 8f6c4d7f8e715e81755b944f20710337
BLAKE2b-256 622d5098150f5b3869fb9b11373df0987595496cff61e4ae4dae735c890d7620

See more details on using hashes here.

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