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

不是日记本,是认知引擎。 Not a notebook. A cognition engine.

Claude Code's native memory is a notebook — it writes down what you did. cc-star is an engine — it learns why it worked and turns that into reusable strategy.

Stop storing. Start growing.

pip install cc-star && cc-star init
# 30 seconds → your Claude Code starts learning from every conversation

Built on a L1→L2→L3 cognitive pipeline: raw conversations → rewarded patterns → crystallized skills. No other memory system for Claude Code does this.

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.3.tar.gz (54.7 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.3-py3-none-any.whl (72.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cc_star-0.2.3.tar.gz
  • Upload date:
  • Size: 54.7 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.3.tar.gz
Algorithm Hash digest
SHA256 3169a5a5a1079c2c88367211026104b54a44edaf11391b24306e0df2052c4aa0
MD5 5bf2805b57bea303b13bf889b33a029e
BLAKE2b-256 bd6f4d8617aa468bed0264239c762c37e7faeb63610037a92ca5639f3d4975da

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cc_star-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 72.3 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 224968f50bf63964729a3ae4de453f5a43fee641bb7c0ac240cc8d33ab62a00c
MD5 1cfb695f41cb13f6488d760bead5136f
BLAKE2b-256 3aba541c689b4c223f61178236dea945c1181458770b2bc9cac1e2ac590ac0f1

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