Labsco
kraklabs logo

CIE - Code Intelligence Engine

β˜… 17

from kraklabs

Local code analysis MCP server with 25+ tools: semantic search, call graph tracing, dependency analysis, and symbol navigation. Built with Tree-sitter and CozoDB. Supports Go, Python, JS, TS.

πŸ”₯πŸ”₯πŸ”₯πŸ”₯βœ“ VerifiedAccount requiredNeeds API keys
<div align="center"> <h1>CIE - Code Intelligence Engine</h1> <p><strong>20+ MCP tools that give AI agents semantic code search, call graph analysis, and endpoint discovery β€” 100% local, indexes 100k LOC in seconds.</strong></p> <img src="docs/cie-demo.gif" alt="CIE Demo" width="800"> <blockquote> <p><em>In practice: Tracing a call graph through MIE's codebase, Claude Code needed 34 tool calls without CIE. With CIE, it needed 3. Results vary by query, but structured code intelligence consistently reduces agent round-trips.</em></p> </blockquote>

Release codecov Go Report Card Go Version License

<p> <a href="#quick-start">Quick Start</a> β€’ <a href="#features">Features</a> β€’ <a href="#documentation">Documentation</a> β€’ <a href="#support">Support</a> </p> </div>

CIE indexes your codebase and provides semantic search, call graph analysis, and AI-powered code understanding through the Model Context Protocol (MCP).

Why CIE?

  • Semantic Search - Find code by meaning, not just text matching
  • Call Graph Analysis - Trace execution paths including interface dispatch resolution
  • MCP Native - Works seamlessly with Claude Code, Cursor, and any MCP client
  • Fast - Indexes 100k LOC in seconds, queries in milliseconds
  • Private - All data stays local, your code never leaves your machine
  • Accurate - Keyword boosting ensures relevant results for function searches

Features

Semantic Code Search

Find code by meaning, not keywords:

# Ask: "Where is authentication middleware?"
# Use cie_semantic_search tool via MCP

Example output:

[95%] AuthMiddleware (internal/http/auth.go:42)
[76%] ValidateToken (internal/auth/jwt.go:103)

Call Graph Analysis

Trace how execution reaches any function:

# Question: "How does main() reach database.Connect()?"
# Use cie_trace_path tool

Example output:

main β†’ InitApp β†’ SetupDatabase β†’ database.Connect
  β”œβ”€ File: cmd/server/main.go:25
  β”œβ”€ File: internal/app/init.go:42
  └─ File: internal/database/setup.go:18

HTTP Endpoint Discovery

List all API endpoints automatically:

# Use cie_list_endpoints tool

Example output:

[GET]    /api/v1/users          β†’ HandleGetUsers
[POST]   /api/v1/users          β†’ HandleCreateUser
[DELETE] /api/v1/users/:id      β†’ HandleDeleteUser

Multi-Language Support

Supports Go, Python, JavaScript, TypeScript, and more through Tree-sitter parsers.

MCP Tools

When running as an MCP server, CIE provides 20+ tools organized by category:

Navigation & Search

ToolDescription
cie_grepFast literal text search (no regex)
cie_semantic_searchMeaning-based search using embeddings
cie_find_functionFind functions by name (handles receiver syntax)
cie_find_typeFind types/interfaces/structs
cie_find_similar_functionsFind functions with similar names
cie_list_filesList indexed files with filters
cie_list_functions_in_fileList all functions in a file

Call Graph Analysis

ToolDescription
cie_find_callersFind what calls a function
cie_find_calleesFind what a function calls
cie_trace_pathTrace call paths from entry points to target
cie_get_call_graphGet complete call graph for a function

Code Understanding

ToolDescription
cie_analyzeArchitectural analysis (LLM narrative optional)
cie_get_function_codeGet function source code
cie_directory_summaryGet directory overview with main functions
cie_find_implementationsFind types that implement an interface
cie_get_file_summaryGet summary of all entities in a file

HTTP/API Discovery

ToolDescription
cie_list_endpointsList HTTP/REST endpoints from common Go frameworks
cie_list_servicesList gRPC services and RPC methods from .proto files

Security & Verification

ToolDescription
cie_verify_absenceVerify patterns don't exist (security audits)

System

ToolDescription
cie_index_statusCheck indexing health and statistics
cie_search_textRegex-based text search in function code
cie_raw_queryExecute raw CozoScript queries

For detailed documentation of each tool with examples, see Tools Reference

Data Storage

CIE stores indexed data locally in <local_data_dir>/<project_id>/ (default: ~/.cie/data/<project_id>/) using embedded CozoDB with RocksDB backend. This ensures:

  • Your code never leaves your machine
  • Fast local queries
  • Persistent index across sessions

Embedding Providers

CIE supports multiple embedding providers:

ProviderConfiguration
OllamaOLLAMA_HOST, OLLAMA_EMBED_MODEL
OpenAIOPENAI_API_KEY, OPENAI_EMBED_MODEL
NomicNOMIC_API_KEY

Documentation

GuideDescription
Getting StartedStep-by-step tutorial from installation to first query
ConfigurationComplete configuration reference
Tools ReferenceAll 20+ MCP tools with examples
ArchitectureHow CIE works internally
MCP IntegrationSetting up with Claude Code, Cursor
Migration GuideMigrating from Docker to embedded mode
Testing GuideRunning tests and adding new tests
BenchmarksPerformance data and tuning
Exit CodesCLI exit codes for scripting
TroubleshootingCommon issues and solutions

Architecture

CIE uses an embedded architecture -- a single binary handles indexing, querying, and MCP serving with no external services required:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Host Machine                                                 β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚  CLI `cie`                                            β”‚    β”‚
β”‚  β”‚  - cie init   β†’ Creates .cie/project.yaml            β”‚    β”‚
β”‚  β”‚  - cie index  β†’ Parses code, writes to local CozoDB  β”‚    β”‚
β”‚  β”‚  - cie --mcp  β†’ Reads from local CozoDB              β”‚    β”‚
β”‚  β”‚                                                       β”‚    β”‚
β”‚  β”‚  Data: <local_data_dir>/<project>/ (RocksDB)         β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β”‚                                                               β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  (optional)                                β”‚
β”‚  β”‚   Ollama     β”‚  For semantic search embeddings            β”‚
β”‚  β”‚  :11434      β”‚  Install: brew install ollama              β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  Model: nomic-embed-text                   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Key Components:

  • CIE CLI: Single binary handles indexing, querying, and MCP serving
  • CozoDB + RocksDB: Embedded database stored locally at <local_data_dir>/<project> (default ~/.cie/data/<project>)
  • Ollama (optional): Local embedding generation for semantic search
  • Tree-sitter: Code parsing for Go, Python, JS, TS

Code Structure:

cie/
β”œβ”€β”€ cmd/cie/           # CLI tool with init, index, query, MCP commands
β”œβ”€β”€ pkg/
β”‚   β”œβ”€β”€ ingestion/     # Tree-sitter parsers and indexing pipeline
β”‚   β”œβ”€β”€ tools/         # 20+ MCP tool implementations
β”‚   β”œβ”€β”€ llm/           # LLM provider abstractions (OpenAI, Ollama)
β”‚   β”œβ”€β”€ cozodb/        # CozoDB wrapper for Datalog queries
β”‚   └── storage/       # Storage backend interface
└── docs/              # Documentation

For in-depth architecture details, see Architecture Guide.

Development

Testing

# Run all tests
go test ./...

# Run with short flag
go test -short ./...

# Run integration tests with CozoDB
go test -tags=cozodb ./...

For detailed testing documentation, see docs/testing.md.

Writing Tests

Use the CIE testing helpers for easy test setup:

import cietest "github.com/kraklabs/cie/internal/testing"

func TestMyFeature(t *testing.T) {
    backend := cietest.SetupTestBackend(t)
    cietest.InsertTestFunction(t, backend, "func1", "MyFunc", "file.go", 10, 20)

    result := cietest.QueryFunctions(t, backend)
    require.Len(t, result.Rows, 1)
}

Building

# Build all commands
make build-all

# Format code
make fmt

# Run linter
make lint

Support

Need help or want to contribute?

Before opening an issue:

  1. Check the troubleshooting guide
  2. Search existing issues
  3. Include CIE version: cie --version
  4. Provide minimal reproduction steps

CIE Enterprise

Scale code intelligence across your entire organization.

CIE Enterprise brings the power of semantic code search and call graph analysis to teams of any size. Built for organizations that demand reliability, security, and collaboration.

Why Enterprise?

FeatureOpen SourceEnterprise
Semantic Searchβœ…βœ…
Call Graph Analysisβœ…βœ…
Local Embeddings (768 dim)βœ…βœ…
Distributed Architectureβ€”βœ…
Team Collaborationβ€”βœ…
CI/CD Integrationβ€”βœ…
High-Fidelity Embeddings (1536 dim)β€”βœ…
Integrated LLMsβ€”βœ…
Priority Supportβ€”βœ…

Enterprise Features

Distributed Architecture Deploy CIE across your infrastructure with a Primary Hub and Edge Caches. All team members connect to the same indexed codebase with millisecond-latency queries worldwide.

Team Collaboration Share code intelligence across your entire engineering organization. One index, one source of truthβ€”no more siloed knowledge.

CI/CD Integration Automatically keep your code index up-to-date with every commit. Native integration with GitHub Actions, GitLab CI, Jenkins, and more.

High-Fidelity Embeddings OpenAI-powered 1536-dimension embeddings for superior semantic search accuracy. Find exactly what you're looking for, even in massive codebases.

Integrated LLMs Connect your preferred LLM provider for enhanced code analysis, architectural insights, and natural language queries about your codebase.

Priority Support Direct access to our engineering team. SLAs, dedicated support channels, and implementation assistance.

Get Started

Contact us: enterprise@kraklabs.com

Schedule a demo to see how CIE Enterprise can transform your team's development workflow.


Related Projects

  • CozoDB - The embedded database powering CIE
  • Tree-sitter - Parser generator for code analysis
  • MCP - Model Context Protocol specification