Open Source · Code Intelligence Layer

Stop Wasting Tokens
Reading Files Blind

CIL indexes your codebase once using tree-sitter AST parsing, then lets agents query symbols, trace calls, and detect anomalies — saving ~65% tokens on large file reads.

The Problem

The problem isn't the agent.
It's the primitive.

Here's what happens when an agent needs context on server.py — a 500-line Express route handler with middleware, error handling, and database calls:

It calls read_file. Gets back 500 lines of raw code. Burns roughly 4,000 tokens. Now the model has to read through all of it internally just to figure out which function handles POST requests, who calls it, and whether any errors are swallowed.

1 file~4,000 tokens
10 files~40,000 tokens

Most of those tokens contain information the agent never uses again after the first pass. They're sitting in the KV cache, expensive and invisible, while the model tries to reason about something specific — "who calls this function?" or "does anyone handle this exception?"

The Alternative

What if agents could query instead?

Instead of handing an agent a file and saying "figure it out," you give it a question and let it find the answer. Not through regex and string matching — through structured understanding of the code itself.

That's CIL (Code Intelligence Layer). It sits between the agent and read_file, giving them a queryable index built from tree-sitter AST parsing, stored in SQLite, exposed as MCP tools so agents know exactly what to read before they read it.

The difference between blind reading and indexed reading is the difference between clearing every room on foot versus scanning the building with thermal—seeing exactly who's where, or deciding you don't need to enter at all. Or dropping a UAV before pushing door-to-door: mapping the whole zone from above so you know which doors even matter.
cil_file_summary
cil_file_summary("server.py")
→ ~500 tokens for the structural map
- Functions, classes, imports, exports
- Decorators, parameters, return types
- Line ranges for every symbol
Then cil_get_body for just the lines you need
read_file
(read_file("server.py"))
→ ~4,000 tokens of raw code
- including everything you don't need
~70%

Token reduction for large files (>200 lines) when using indexed lookups before targeted reads.

Every 4,000 tokens freed from the KV cache is VRAM you can use for actual reasoning. Not just cost — capability. For small files, CIL overhead can exceed the file itself — use it where it matters.

Architecture

How it works

CIL parses your project once, not every time an agent opens a file. Three stages, zero overhead.

01

Parse

Tree-sitter builds a concrete syntax tree across Python, TypeScript, JavaScript, Go, Rust, Java, and C. Deterministic grammar-based parsing — not regex or LLM guessing.

02

Extract

Symbols, signatures, line ranges, decorators, type annotations, call graphs, mutation tracking — all pulled from the AST structure itself.

03

Store

Everything into a SQLite database next to your project. No daemon process. No network calls. Each project gets its own .cil.db file.

The result is 9 MCP tools any AI coding agent can call:

File summarystructured overview of any file
Symbol searchfind functions, classes, or variables by name across the whole project
Call graph tracingwho calls this function? what does this function call? full upstream and downstream chains
Mutation trackingevery location that writes to a specific variable or global state
Anomaly detectionpre-computed flags on thread safety issues, missing error handling, and other static analysis findings
Raw body retrievalwhen you actually need the raw lines, get just the section you need instead of the whole file

Anomaly Detection — No LLM Required

12

Python

10

JavaScript

9

TypeScript

8

C/C++

Total across all languages57 checks
typical session
# With CIL guiding what to read:
cil_find_symbol("updateStatus")      # where is it?
cil_trace_calls("updateStatus")       # who calls it?
cil_get_body("server.py", 120, 135)   # just those 15 lines

→ ~800 tokens total vs. ~12,000 from three full file reads
CIL doesn't avoid reading — it tells you exactly which lines matter.
Capabilities

What you get

Beyond the obvious token reduction, CIL gives agents something they don't have right now: cross-file reasoning without cross-file reading.

"Who calls updateStatus?"

Call graph tracing returns the complete chain, not just in one file but across modules and packages. No opening each caller's file to verify.

"Where is _VISION_READY assigned?"

Mutation tracking surfaces every write, augmentation, and deletion. Thread safety audits become queries instead of manual scans.

"Are there any bare excepts in this project?"

Anomaly detection has already flagged them. 57 checks cover patterns across languages: bare excepts in Python, unwrap calls in Rust, unchecked errors in Go, empty catch blocks in JavaScript, dangerous functions like gets or strcpy. Not best-effort LLM opinions — deterministic static analysis.

"What does do_swap do?"

Symbol search returns the signature, line range, decorators, type annotations, and optional LLM-generated purpose description if you've enabled enrichment. You get understanding before you ever see the implementation.

Philosophy

Why open source

In AI tooling, credibility comes from inspectable code, not marketing copy. We build software for clients as Creative Ferry, based in Nigeria since 2018. Our reputation depends on shipping working systems, not promises about them.

When we started building internal tooling to make our own agents more effective at reading client codebases, we kept running into the same bottleneck: file-reading primitives were wasting tokens and limiting reasoning depth. So we built something better for ourselves first.

It worked well enough internally that we decided to open-source it. Not because we needed users — we had use cases. Because anyone who writes read_file in their agent prompt right now is solving the problem we already solved, and they shouldn't have to solve it again.

Getting Started

Start querying instead of reading

bash
$ pip install git+https://github.com/iamefe/cil.git
Installing collected packages: cil
Successfully installed cil-0.1.0

$ cil index /path/to/your/project
Indexing project at /path/to/your/project...
✓ 47 files parsed in 2.3s
✓ .cil.db created

$ # Re-index only changed files
cil index /path/to/your/project --incremental

That creates a SQLite database at .cil/projects/<your-project-name>/ inside your project directory. Any MCP-enabled agent — OpenCode, Claude Code, Cursor — can then use CIL's tools instead of raw file reads.

No daemon. No authentication. No cloud dependency. A SQLite file next to your code, updated when you change it.

If you're tired of watching agents burn context on code they never use, try querying instead of reading.

Get CIL
Oserefemhen Ativie

Built by Oserefemhen Ativie