Source Code:
src/gaia/agents/base/project_map.pyWhat it contains
The token budget
600 tokens. That is 1.8% of the NPU profile’s 32,768-token window (NPU_CTX_SIZE) and 0.9% of the GPU profile’s 65,536. It is sized against the
smaller window on purpose — a budget that only holds on 64K is not a budget.
Measured with GAIA’s shared estimator (count_tokens — cl100k, or a character
ratio when tiktoken is absent), so it bounds the map to within that estimator’s
error of the model’s own count rather than to the exact token.
render_project_map() enforces it on every render. Sections are emitted in
priority order and the directory listing carries its own sub-cap, so on a
2,000-directory monorepo the platform quirks and the command list still survive
while the tree is what gets trimmed.
Which directories count as a code repository
The predicate is testable, not a judgement call.is_code_repository(path) is
true when a version-control directory or a recognised manifest sits at the
root — non-recursive, so a home directory full of repositories is not itself
one.
Version-control directories
Version-control directories
.git, .hg, .svnRecognised manifests
Recognised manifests
pyproject.toml, setup.py, setup.cfg, requirements.txt,
package.json, Cargo.toml, go.mod, pom.xml, build.gradle,
build.gradle.kts, CMakeLists.txt, Makefile, Gemfile,
composer.jsonPlatform quirks
Three, and only three — the differences that change the text of a command the model emits. A contributor can check the list off:- Path separator —
\on Windows,/elsewhere. - Path quoting for spaces — double quotes on Windows, single quotes on POSIX.
- Shell dialect —
cmd.exeor PowerShell on Windows;$SHELL’s basename otherwise.
Automatic code indexing
When the root is a code repository and no code index exists, the map callsindex_codebase in a background thread and says so in the
prompt, so the model knows to grep until it lands. It fires at most once per
session.
Turn it off on a monorepo where a full embedding pass is not worth it:
Choosing the root
Resolution order:project_rootonGaiaAgentConfig- the
GAIA_PROJECT_ROOTenvironment variable - the working directory, or the nearest repository up to four levels above it
~ would spend tokens describing
nothing.
GAIA_PROJECT_ROOT that does not exist raises at startup rather than being
quietly ignored.
Caching
The map is built once per root and reused. It is rebuilt when a fingerprint over four things changes: the top-level directory listing, every manifest’s size and mtime, the VCS head, andPATH. Between changes, repeated queries reuse one
walk.
Related
Code Index
The semantic index the map triggers.
Memory
Day-0 system facts, from the same binary probe.