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

Windows Users

cc-star works on Windows. If you run into issues, see the Windows Installation Guide for known pitfalls and fixes.

Quick tips for Windows:

  • cc-star init (v0.2.4+) handles path formatting automatically
  • ⚠️ Put API keys in system environment variables, not settings.json env (Claude Code Windows bug)
  • ⚠️ If cc-star init was run on an older version, check hook paths in settings.json use forward slashes /
  • ⚠️ Subagent spawning: ensure claude.exe is in Windows native PATH for multi-agent / Workflow features (see guide)
  • claude doctor showing ✗ for Remote Control is normal in API Key mode

Run the quick diagnosis script if something feels off.

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.3.0.tar.gz (65.8 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.3.0-py3-none-any.whl (81.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cc_star-0.3.0.tar.gz
  • Upload date:
  • Size: 65.8 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.3.0.tar.gz
Algorithm Hash digest
SHA256 b70c87429c4a1acbafb63ca33278358bbd2a424f573605a8f97f497f54f23ca4
MD5 5db05b25b31f6c0368c6ab8d90d9aa4a
BLAKE2b-256 371ffd451ffe8b3249598dd3e07ee33a3144528ce6be1a1a52f92dc7a192fad9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cc_star-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 81.0 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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2a4e8cc9b9b8dc04f3762465a27c85c7320c00d15928efdb885df7a222739cb9
MD5 873f75f6a05a07ba462d4de8f98b2ee2
BLAKE2b-256 134a0e1c48b0b05429fc6f6aee14e8010a4a237cb7e5b90a28b80ea0c5d55308

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