Skip to main content

Semantic memory system for Claude Code sessions

Project description

CodeContext

Semantic memory system for Claude Code sessions. Captures learnings, stores them with vector embeddings, and provides retrieval via semantic similarity search.

Features

  • Automatic Memory Capture: Hooks capture learnings from coding sessions
  • Semantic Search: Find relevant past experiences using natural language
  • Project Summaries: AI-generated summaries injected into new sessions
  • Conflict Detection: Identifies contradictory or outdated memories
  • Memory Consolidation: Merges related memories to reduce redundancy

Quick Start

Installation

# Install the package
pip install codecontext

# Initialize for all projects (global)
codecontext init --global

# Or initialize for current project only
codecontext init --project

Interactive Setup

codecontext init

This will prompt you to choose between:

  1. Global - Active for ALL projects (~/.claude/)
  2. Project - Active only for THIS project (./.claude/)

Basic Usage

# Search your memories
codecontext query "authentication flow"

# Add a new memory
codecontext add --type bugfix --title "Fixed timezone" --fact "Use make_naive=True"

# Quick note (auto-classifies)
codecontext note "Always use utcnow() for storage"

# View project summary
codecontext summary

# List known gotchas
codecontext gotchas

# Check server health
codecontext health

Installation Modes

Mode Hooks Location Data Location Use Case
Global ~/.claude/hooks/codecontext/ ~/.codecontext/ Single user, all projects
Project ./.claude/hooks/codecontext/ ./.codecontext/ Per-project isolation

Commands

Command Description
init Set up hooks and skills
uninstall Remove hooks (preserves data by default)
server Start the CodeContext server
query <text> Semantic search
add Add a memory with type, title, fact
note <text> Quick capture with auto-classification
resolve <desc> Mark a priority as completed
files <path> Find memories by file
summary View project summary
summary-generate Generate/regenerate summary
recent Show recent memories
gotchas List known pitfalls
stats Project statistics
projects List all projects
health Server health check

Memory Types

Type Description
bugfix Bug fixes and solutions
feature New functionality
discovery How things work
decision Architecture choices
refactor Code restructuring
optimization Performance improvements
gotcha Pitfalls to avoid
resolution Completed priorities

Server

The CodeContext server runs locally and provides:

  • REST API for memory operations
  • Web UI for browsing memories
  • Background tasks for consolidation
# Start server manually
codecontext server

# With custom port
codecontext server --port 9000

# Development mode with auto-reload
codecontext server --reload

The server starts automatically when hooks fire or CLI commands run.

Architecture

~/.codecontext/
├── projects/
│   └── {encoded-project-path}/
│       ├── vector_db/       # LanceDB storage
│       ├── summary.json     # Current summary
│       └── sessions/        # Session logs
├── config.json              # Server config
└── .codecontext_mode        # Installation marker

Uninstalling

# Remove hooks, keep your data
codecontext uninstall --global

# Remove everything including memories
codecontext uninstall --global --remove-data

Migration from agentic-coder

If you were using the development version from agentic-coder:

  1. Install the pip package: pip install codecontext
  2. Run init: codecontext init --global
  3. Your existing data in ~/.codecontext/ is automatically preserved

Development

# Install in development mode
pip install -e ".[dev]"

# Run tests
pytest

# With GPU support
pip install -e ".[full]"

Requirements

  • Python 3.10+
  • Claude Code CLI (for hooks)
  • ~200MB disk space (FastEmbed model)

License

MIT License - 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

claude_codecontext-0.1.6.tar.gz (167.1 kB view details)

Uploaded Source

Built Distribution

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

claude_codecontext-0.1.6-py3-none-any.whl (212.5 kB view details)

Uploaded Python 3

File details

Details for the file claude_codecontext-0.1.6.tar.gz.

File metadata

  • Download URL: claude_codecontext-0.1.6.tar.gz
  • Upload date:
  • Size: 167.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for claude_codecontext-0.1.6.tar.gz
Algorithm Hash digest
SHA256 752518fe387c518e9c84ef940572eae32e4240a865dcb4e1c70687e1a1325e09
MD5 f3b29a3ac11b80a5b1377ee19cfa52e6
BLAKE2b-256 8193ac6a381286762f16f08d1714e5876a18391d94bbaded2aa95a68e55d92e8

See more details on using hashes here.

File details

Details for the file claude_codecontext-0.1.6-py3-none-any.whl.

File metadata

File hashes

Hashes for claude_codecontext-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 9f567bc913d91670f6f81d5b1d93b8a118be2dde4f0f7ab0de1cc66b2d42fcf8
MD5 83e9dc787eba7b6b4d5554cba8600f1e
BLAKE2b-256 63e8885a9801d3d7d38f7d81562fd951d797ce4eca4fde1279e40b457e0d8d36

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