Menu
ContextBridge
How it works Works with Pricing FAQ
EnglishTiếng Việt简体中文日本語
Open the app

Guides

How codebase maps are built: symbols, layers, token budgets

How static analysis turns a folder of source into a map an AI can use — tree-sitter parsing, layer detection, dependency edges — and an honest list of what a map cannot know.

Parsing, not guessing

A map is only as good as its parser. ContextBridge compiles your code with tree-sitter — the same incremental parser family that code editors use — running as WebAssembly inside your browser tab, across 15 languages. Every symbol comes from a real parse tree, which is why the line ranges are exact rather than estimated.

The precision has deliberate limits. Files above 512 KB are truncated, binaries are skipped, and dependency trees, build output and lockfiles are pruned before parsing. The hard cap is 4,000 files — chosen so an analysis finishes in seconds on a laptop, not minutes.

Layers, hubs, entry points

On top of the symbol table the analyser classifies. Files cluster into layers — API, service, data, UI, infrastructure — inferred from paths, imports and naming. The most-imported files surface as hubs; bootstraps, mains and route tables surface as entry points. This is the layer table of a real (small) sample project, verbatim from the generated map:

Real map output for the 21-file sample project: 271 lines, 14 functions, 25 import edges.
| Layer         | Files | Lines | Notable                               |
|---------------|-------|-------|---------------------------------------|
| Core          | 4     | 60    | order-repo.ts, server.ts              |
| API Layer     | 3     | 53    | orders.ts, customers.ts, routes.ts    |
| Service Layer | 2     | 50    | order-service.ts, customer-service.ts |
| UI Layer      | 2     | 23    | order-list.tsx, format.ts             |
| Data Layer    | 1     | 13    | 001_init.sql                          |
| Test Layer    | 1     | 8     | order-service.test.ts                 |

The token budget decides what survives

Every artefact is generated against a token budget you choose, from a quick sketch to a no-limit dump. The ranker scores files by relevance to your stated question — with cross-language term expansion, so a question in Vietnamese or Chinese still matches English code — and by structural importance: hubs, entry points, and the files on the import paths of the matched symbols.

What does not fit is not silently dropped: the artefact lists what it omitted and states its own limits at the top. A budgeted map that admits its edges is worth more to you — and to the model — than an unbounded dump that hides them.

What static analysis cannot know

Honesty matters more than impressiveness here. A static map never sees runtime behaviour: dependency-injected implementations, reflection, dynamic dispatch, feature flags and environment-specific wiring are all invisible to it. Layer labels are heuristics, and heuristics can be wrong in a codebase that enjoys breaking conventions.

So treat a map as what it is: orientation, not ground truth. The generated artefacts are built around the same idea — they instruct the model to answer from the structure it was given, to name the files it does not have, and to never invent implementations. A map that is allowed to say "I don't know" is a map you can trust to tell you where to look next.

Related guides

  • How to give an AI chat your codebase as context
  • Local-only code analysis: how it works and what leaves your machine
Analyse a folder Try the demo project

ContextBridge

ContextBridge reads your project with tree-sitter — a real source-code parser, not regex, not guesswork — and turns it into a token-budgeted Markdown map: every symbol, signature, line range and dependency edge. Then you drop that one file into any AI chat and it finally understands your architecture.

No trackers. No cookies. No analytics.

Legal

  • Terms of service
  • Privacy policy
  • Cookie policy
  • Disclaimer
  • Acceptable use
  • Data processing

Resources

  • Works with
  • FAQ
  • AI codebase context
  • Codebase maps
  • Local analysis & privacy
  • Security
  • Report abuse
  • Contact

Language

EnglishTiếng Việt简体中文日本語
Weblium Website BuilderAffiliate Build a professional website using customizable templates, AI-assisted tools, and built-in online store features. QIDI Tech 3D PrintersAffiliate Explore FDM 3D printers for hobby projects, functional prototypes, and larger-scale printing.

© 2026 ContextBridge (sole proprietorship, Vietnam). All rights reserved.