Skip to main content

Installation

pip install kernle

Initialize

# Initialize with your stack ID
kernle -s your-stack-name init

# Or let it auto-detect your environment
kernle init
This creates ~/.kernle/ with your local database.

Basic Usage

Capture Memories

# Quick capture (zero friction)
kernle -s mystack raw "Just learned about memory consolidation"

# Structured note
kernle -s mystack note "Memory consolidation happens during reflection" \
  --type insight

# Full episode
kernle -s mystack episode "Debugging the sync bug" \
  "Found the race condition in the queue handler" \
  --lesson "Always check for concurrent access"

Search and Retrieve

# Semantic search
kernle -s mystack search "sync issues"

# Load working memory for a session
kernle -s mystack load

# Check memory health
kernle -s mystack anxiety

Save State

# Save a checkpoint before ending session
kernle -s mystack checkpoint save "end of work session"

# Restore later
kernle -s mystack checkpoint load

Python API

from kernle.entity import Entity
from kernle.stack import SQLiteStack
from kernle.models.anthropic import AnthropicModel

# Create the core
entity = Entity()

# Bind a model
entity.set_model(AnthropicModel())

# Attach a memory stack
stack = SQLiteStack(db_path="~/.kernle/stacks/mystack/memory.db")
entity.attach_stack(stack, alias="mystack", set_active=True)

# Write memories (with full provenance)
# Note: In strict mode (default), derived_from is required for most memory types.
# Use strict=False for quick experimentation.
entity.episode(
    "Optimized the sync pipeline",
    "Reduced latency from 300ms to 100ms",
    lessons=["Batching network calls is worth the complexity"],
)

entity.belief(
    "Batch processing outperforms sequential I/O",
    confidence=0.85,
)

# Search
results = entity.search("performance optimization")
for r in results:
    print(f"{r.memory_type}: {r.content[:80]}")

# Load working memory
context = entity.load(token_budget=8000)

MCP Integration

Add Kernle to Claude Desktop:
// ~/Library/Application Support/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "kernle": {
      "command": "kernle",
      "args": ["mcp", "--stack", "claude"]
    }
  }
}
Restart Claude Desktop. You’ll have access to memory tools like memory_load, memory_search, memory_checkpoint_save, etc.

Next Steps