Skip to content

sebthom/codecontext

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

37 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿค– CodeContext - AI-Powered Development Context Maps

Intelligent context maps for seamless AI development workflows with Claude

Release License Go

๐ŸŽฏ What is CodeContext?

CodeContext automatically generates intelligent, token-optimized context maps of your codebase specifically designed for AI development workflows. Instead of manually copying files or explaining your project structure to Claude, CodeContext creates comprehensive context that enables AI to understand your entire codebase instantly.

โšก Quick Example

# Generate context for your project
codecontext generate

# Copy the generated CLAUDE.md and paste into Claude
# Claude now understands your entire codebase structure!

Result: Claude can now help with architecture decisions, debug complex issues, suggest refactoring, and implement features with full understanding of your project.

๐Ÿš€ Key Features

๐Ÿ” Real Tree-sitter Analysis

  • JavaScript/TypeScript: Full AST parsing with symbol extraction
  • Go Language: Complete language support
  • Multi-language: JSON, YAML, and extensible architecture
  • Symbol Recognition: Functions, classes, interfaces, imports, variables

๐Ÿง  AI-Optimized Context

  • Token Efficient: Optimized output format for AI consumption
  • Relationship Mapping: File dependencies and import relationships
  • Smart Filtering: Focus on relevant code, exclude noise
  • Incremental Updates: Only regenerate what's changed

โšก Enhanced Diff Algorithms (v2.0)

  • Semantic vs Structural Diffs: Understand code changes beyond text
  • Symbol Rename Detection: 6 similarity algorithms + 5 heuristic patterns
  • Import Dependency Tracking: Comprehensive change impact analysis
  • Confidence Scoring: Evidence-based change classification

๐Ÿ› ๏ธ Developer Experience

  • Watch Mode: Real-time context updates during development
  • Compaction: Reduce context size for large projects
  • CLI Tools: Professional command-line interface
  • Cross-Platform: macOS, Linux, Windows support

๐Ÿ“ฆ Installation

Download Binary (Recommended)

# macOS (Apple Silicon)
curl -L https://github.com/nmakod/codecontext/releases/download/v2.1.0/codecontext-2.1.0-darwin-arm64.tar.gz | tar xz
sudo mv codecontext-darwin-arm64 /usr/local/bin/codecontext

# Other platforms available at: https://github.com/nmakod/codecontext/releases

Homebrew (macOS - Alternative)

# Create local tap and install
brew tap-new nmakod/codecontext
mkdir -p $(brew --repository)/taps/nmakod/homebrew-codecontext/Formula
curl -o $(brew --repository)/taps/nmakod/homebrew-codecontext/Formula/codecontext.rb \
  https://raw.githubusercontent.com/nmakod/codecontext/main/Formula/codecontext.rb
brew install nmakod/codecontext/codecontext

Build from Source

git clone https://github.com/nmakod/codecontext.git
cd codecontext
make build
sudo make install

๐Ÿš€ Quick Start with Claude

1. Initialize Your Project

cd your-project
codecontext init

2. Generate Context Map

codecontext generate

3. Use with Claude

Copy the generated CLAUDE.md content and start your Claude conversation:

I'm working on a [project description]. Here's my codebase context:

[Paste CLAUDE.md content]

I need help with [specific task].

4. Iterative Development

# Make changes to your code
# Update context
codecontext update

# Share updated context with Claude for continued assistance

๐Ÿ“Š Example Output

# CodeContext Map

**Generated:** 2025-07-12T17:45:38+05:30  
**Analysis Time:** 35ms  
**Status:** Real Tree-sitter Analysis

## ๐Ÿ“Š Overview
- **Files Analyzed**: 15 files
- **Symbols Extracted**: 142 symbols  
- **Languages Detected**: 3 (TypeScript, JavaScript, JSON)
- **Import Relationships**: 28 dependencies

## ๐Ÿ“ File Analysis
| File | Language | Symbols | Type |
|------|----------|---------|------|
| `src/components/UserCard.tsx` | typescript | 8 | component |
| `src/services/userService.ts` | typescript | 12 | service |
| `src/utils/validation.ts` | typescript | 6 | utility |

## ๐Ÿ” Symbol Analysis  
| Symbol | Type | File | Line | Signature |
|--------|------|------|------|----------|
| `UserCard` | class | `src/components/UserCard.tsx` | 12 | `class UserCard` |
| `validateEmail` | function | `src/utils/validation.ts` | 25 | `validateEmail(email: string)` |

## ๐Ÿ”— Import Relationships
- `src/components/UserCard.tsx` โ†’ [`services/userService`, `utils/validation`]
- `src/services/userService.ts` โ†’ [`utils/api`, `types/user`]

๐Ÿค– MCP Server - Real-time AI Integration

CodeContext includes a built-in Model Context Protocol (MCP) server that provides real-time codebase context to AI assistants like Claude Desktop, VSCode extensions, and custom AI applications.

Quick MCP Setup

# Start MCP server for current directory  
codecontext mcp

# With custom settings
codecontext mcp --target ./src --watch --verbose

AI Assistant Integration

Claude Desktop - Add to your MCP configuration:

{
  "mcpServers": {
    "codecontext": {
      "command": "codecontext", 
      "args": ["mcp", "--target", "/path/to/your/project"]
    }
  }
}

Available MCP Tools

  • get_codebase_overview - Complete repository analysis
  • get_file_analysis - Detailed file breakdown with symbols
  • get_symbol_info - Symbol definitions and usage
  • search_symbols - Search symbols across codebase
  • get_dependencies - Import/dependency analysis
  • watch_changes - Real-time change notifications

Benefits:

  • โœ… Real-time context updates as you code
  • โœ… No manual copy/paste of context
  • โœ… Standardized protocol for all AI tools
  • โœ… Live symbol search and dependency analysis

๐Ÿ“– Complete MCP Documentation โ†’

๐Ÿ› ๏ธ Advanced Usage

Watch Mode for Active Development

# Auto-update context as you code
codecontext watch

# Claude conversations stay in sync with your changes!

Compaction for Large Projects

# Reduce context size while preserving key information
codecontext compact --level balanced

# Perfect for large codebases that exceed token limits

Focused Analysis

# Generate context for specific directories
codecontext generate src/components/ src/services/

# Include/exclude patterns in config
codecontext generate --exclude "**/*.test.*"

Configuration

# .codecontext/config.yaml
project:
  name: "my-awesome-app"
  
analysis:
  include_patterns:
    - "src/**"
    - "components/**"
  exclude_patterns:
    - "**/*.test.*"
    - "node_modules/**"
    - "dist/**"

output:
  format: "markdown"
  include_stats: true
  max_file_size: 1048576  # 1MB

๐ŸŽฏ Use Cases with Claude

๐Ÿ—๏ธ Architecture Planning

Based on this codebase structure: [context]
What's the best way to implement user authentication?

๐Ÿ› Debugging Complex Issues

I'm getting this error: [error details]
Here's my codebase context: [context]
Can you help identify the root cause?

๐Ÿ”„ Refactoring Guidance

I want to refactor the UserService class: [context]
How can I improve this while maintaining compatibility?

โœจ Feature Implementation

I need to add real-time notifications: [context]
What's the best approach given my current architecture?

๐Ÿ“‹ Code Reviews

Here's my updated codebase after implementing the new feature: [context]
Can you review for best practices and potential issues?

๐Ÿ“š Documentation

๐ŸŽฏ Roadmap

โœ… Phase 1: Foundation (Completed)

  • CLI framework and configuration
  • Basic file analysis and output generation
  • Tree-sitter integration

โœ… Phase 2.1: Enhanced Diff Algorithms (v2.0.0)

  • Semantic vs structural diff analysis
  • Symbol rename detection with confidence scoring
  • Import dependency change tracking
  • Language-specific AST diffing

๐Ÿ”„ Phase 2.2: Multi-Level Caching (Coming Soon)

  • LRU cache for parsed ASTs
  • Diff result caching with TTL
  • Persistent cache across CLI invocations
  • Cache invalidation strategies

๐Ÿ”„ Phase 2.3: Watch Mode Optimization (Coming Soon)

  • Debounced file changes (300ms default)
  • Batch processing of multiple changes
  • Priority queuing for critical files
  • Resource throttling for large repositories

๐Ÿ”ฎ Phase 3: Advanced Features (Future)

  • IDE integrations (VS Code, IntelliJ)
  • Git integration for change tracking
  • Team collaboration features
  • Custom output formats

๐Ÿค Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Setup

git clone https://github.com/nmakod/codecontext.git
cd codecontext
go mod download
make build

Running Tests

make test

๐Ÿ“„ License

MIT License - see LICENSE file for details.

๐ŸŒŸ Why CodeContext?

Before CodeContext

You: "I have a React app with TypeScript, Express backend, and I'm trying to implement user authentication..."
Claude: "I'd be happy to help! Can you show me your current file structure and the relevant code?"
You: [Copies multiple files manually, explains project structure]
Claude: [Provides help based on limited context]

With CodeContext

codecontext generate
You: "I need to implement user authentication. Here's my project context: [paste CLAUDE.md]"
Claude: "I can see your full architecture! Based on your current structure with UserService in src/services/ and your existing TypeScript types, here's the best approach..."

Result: Faster development, better code quality, more accurate suggestions, and seamless AI collaboration.

๐Ÿ“ˆ Performance

  • Analysis Speed: 35ms for 15 files, 142 symbols
  • Memory Efficient: <50MB for large projects
  • Token Optimized: Compressed context maintains quality while reducing size
  • Incremental Updates: Only regenerate changed files

๐Ÿ”ง Technical Details

Supported Languages

  • TypeScript/JavaScript: Full Tree-sitter AST parsing
  • Go: Complete language support with Tree-sitter
  • JSON/YAML: Basic parsing and structure analysis
  • Extensible: Plugin architecture for additional languages

Architecture

  • Virtual Graph Engine: Incremental analysis with shadow/actual graph pattern
  • Multi-threaded: Parallel file processing for performance
  • Caching Layer: Smart caching for faster subsequent runs
  • Cross-platform: Go-based with CGO for Tree-sitter integration

Start building better software with AI assistance today! ๐Ÿš€

Download CodeContext v2.1.0

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 99.2%
  • Other 0.8%