DEV Community

Francisco Pérez
Francisco Pérez

Posted on • Edited on

I Built a Code Intelligence Engine — Here's How CIE Works

The Problem

AI coding assistants are everywhere — Claude Code, Cursor, GitHub Copilot. But they all share the same limitation: they don't truly understand your codebase.

They see files in isolation. Ask "how does authentication work in this project?" and they'll grep for "auth" and hope for the best.

I wanted real code intelligence.

What I Built

CIE (Code Intelligence Engine) — 20+ tools that give AI assistants deep understanding of your entire codebase.

Free, open-source, runs 100% locally.

GitHub: github.com/kraklabs/cie

The Killer Features

1. Multi-Pattern Search

Search for multiple patterns in ONE call:

Query: ["TODO", "FIXME", "HACK", "BUG"]
Result: 47 matches, grouped by pattern with file locations
Enter fullscreen mode Exit fullscreen mode

This replaces running 4 separate grep commands. Game changer for batch searches and codebase audits.

2. Security Audit Automation

cie_verify_absence confirms dangerous patterns DON'T exist in your codebase:

Query: Verify no hardcoded API keys or passwords
Result: ✅ Verified — no matches found
Enter fullscreen mode Exit fullscreen mode

Critical for CI/CD security pipelines. Automate what used to be manual code review.

3. Complete Call Graph Analysis

See who calls a function AND what it calls — in one view:

Query: Analyze UserService.CreateUser

Result:
Callers (3): RegisterHandler, AdminController, ImportService
Callees (12): ValidateEmail, HashPassword, db.Insert, SendWelcomeEmail...
Enter fullscreen mode Exit fullscreen mode

Understand the full impact of changing any function.

4. Semantic Search That Actually Works

Find code by meaning, not just text:

Query: "validate user input before saving to database"
Result: SanitizeUserInput (87% match) — internal/validation/user.go:42
Enter fullscreen mode Exit fullscreen mode

It found the right function even though the name doesn't match your query. That's the power of embeddings.

5. Instant API Discovery

cie_list_endpoints finds all your HTTP endpoints automatically:

[GET]    /api/users           → GetUsers
[POST]   /api/users           → CreateUser
[GET]    /api/users/:id       → GetUserByID
[PUT]    /api/users/:id       → UpdateUser
[DELETE] /api/users/:id       → DeleteUser
Enter fullscreen mode Exit fullscreen mode

cie_list_services does the same for gRPC services.

6. Module Structure at a Glance

cie_directory_summary shows what's in each package:

internal/auth/
├── middleware.go    → AuthMiddleware, ValidateToken, RefreshToken
├── jwt.go           → GenerateJWT, ParseJWT, ValidateClaims
└── oauth.go         → OAuthCallback, ExchangeCode
Enter fullscreen mode Exit fullscreen mode

Perfect for onboarding or understanding unfamiliar code.

All 20+ Tools

Search & Discovery

  • cie_grep — Multi-pattern literal search
  • cie_search_text — Regex search
  • cie_semantic_search — Natural language code search
  • cie_find_function — Direct name lookup

Architecture Analysis

  • cie_analyze — Answer architectural questions
  • cie_list_endpoints — HTTP API discovery
  • cie_list_services — gRPC service listing
  • cie_directory_summary — Module structure overview

Dependency Analysis

  • cie_find_callers — Who calls this function?
  • cie_find_callees — What does this function call?
  • cie_get_call_graph — Combined view of both
  • cie_trace_path — Trace execution from A to B

Type System

  • cie_find_type — Find structs/interfaces
  • cie_find_implementations — Find interface implementations

Security

  • cie_verify_absence — Verify patterns don't exist

Advanced

  • cie_raw_query — Custom CozoScript queries

Recommended Workflows

Exploring a new codebase:

  1. cie_directory_summary → understand structure
  2. cie_list_endpoints → map API surface
  3. cie_semantic_search → find specific features

Debugging:

  1. cie_find_function → locate the function
  2. cie_get_call_graph → see all dependencies
  3. cie_trace_path → understand execution flow

Security review:

  1. cie_verify_absence → check for secrets, credentials
  2. cie_grep → batch search for security patterns

How It Compares

Feature Cursor GitHub Copilot CIE
Price $20-200/mo $10-39/mo Free
Multi-pattern search No No Yes
Security audit (verify_absence) No No Yes
Call graph analysis No No Yes
Self-hosted No No Yes
Privacy Cloud Cloud 100% Local

Tech Stack

  • Go — fast, single binary
  • Tree-sitter — AST parsing (Go, Python, JS, TS, more)
  • CozoDB + RocksDB — Datalog queries for graph traversal
  • Ollama — local embeddings
  • Docker Compose — simple infrastructure

Quick Start

brew tap kraklabs/cie && brew install cie

cd /path/to/your/repo
cie init -y
cie start
cie index
Enter fullscreen mode Exit fullscreen mode

Configure your MCP client (Claude Code, Cursor):

{
  "mcpServers": {
    "cie": {
      "command": "cie",
      "args": ["--mcp"]
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Try It

GitHub: github.com/kraklabs/cie

If you find it useful, a ⭐ helps a lot.

Questions? Drop them in the comments — happy to discuss architecture or use cases.

Top comments (0)