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 an estimate
that leans high 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
By default the code index is built on the firstsearch_code_index, not at task start, and the map says the index is not built
yet. Opt in to building it in a background thread at task start, at most once
per session:
Choosing the root
Resolution order:project_rootonGaiaAgentConfig- the
GAIA_PROJECT_ROOTenvironment variable - the session’s working directory, or the nearest repository above it — searching upward until the home directory or the filesystem root, whichever comes first
/query’s
working_directory) — and otherwise the agent process’s own working directory.
The daemon starts the agent in its own folder, so without the client’s folder
the map would describe the daemon’s folder, not your project. Sending the start
folder changes only where relative paths and the map resolve; it does not change
which folders the agent may read.
A working directory anywhere inside GAIA’s own source tree is rejected — in
dev mode the agent sidecar is launched from its package directory inside the
GAIA checkout, and mapping (and auto-indexing) its own source is never what the
user asked for. An explicitly configured root is exempt: pointing GAIA at GAIA
is fine when you mean it.
Only a source or editable checkout counts as GAIA’s own tree. Installing GAIA
into a virtualenv inside your own project — the embedded-SDK layout — leaves
your project mapped normally.
If none of those is a repository the agent gets no map at all. That is the
right answer, not a degraded one — an agent answering questions from a home
directory is not in a project, and a map of ~ would spend tokens describing
nothing.
GAIA_PROJECT_ROOT that does not exist raises at startup rather than being
quietly ignored.
Project instructions and skills
With a model that gets the full project context, the agent reads the project’s own instructions the way Claude Code does. Which models get it is a per-model choice, because the payoff is: on repository work Claude scores higher with them, while a smaller model such as DeepSeek V4.1 Flash scores the same and spends about half again as many input tokens.GAIA_PROJECT_CONTEXT set in the agent’s environment overrides the config
value. A value other than these three fails at startup. Switching models mid-session
applies the new model’s level. With the full context:
AGENTS.mdandCLAUDE.mdat the project root go into the system prompt whole, under==== PROJECT INSTRUCTIONS ====, as the project’s rules for how to work in it. They are marked as coming from the repository, not the user: they never override the user’s request, the agent’s safety rules, or when a tool must ask before it runs. Both are read when both exist (AGENTS.mdfirst); an identical copy is shown once. A hosted model gets up to 60,000 characters; a local model you set tofullgets half of what it allows one tool result (about 15,000 on NPU, 30,000 on GPU), so a long file cannot crowd a small window. Past the cap, the agent gets the first whole lines and the line to continue from withread_file; the rest of the file is never read into memory..claude/skills/<name>/SKILL.mdunder the project root are listed in the skill catalogue, so the agent can load one by name when the work matches. A Claude Code skill GAIA’s own format would reject — an uppercase or underscored name, a name that differs from its folder, a missing or very long description — still loads, with a warning in the log saying what was relaxed. Skills in~/.claude/skillsstay loadable by name but unlisted. Without the full context, project skills are loadable by name but unlisted too.
AGENTS.md or CLAUDE.md still has it read, but the agent never
searches upward for one, and never reads one from the home directory or from
GAIA’s own source tree. An AGENTS.md or CLAUDE.md that is a link to a file
outside the project is named in the prompt but not read. The instructions are
read once per session, so editing the file mid-session takes effect in the next
session. A session whose prompt carries the instructions stores no skill lessons: a lesson
outlives the repository, and nothing else would mark repository text as content
the user did not write.
A project skill never grants itself anything when loaded: a .claude/skills
folder arrives with a clone, so its tools and shell-binary permissions stay
deferred. A tool-providing one is refused when the agent asks to load it. To
trust one, copy it into your own skills, which take precedence over the
project’s copy, then promote it:
Trusting a folder
A cloned repository can carry its ownCLAUDE.md, AGENTS.md and
.claude/skills, so under auto GAIA asks once per folder before putting them
in a prompt, as Claude Code does. The question names the files it would read.
The terminal UI, the Agent UI and gaia chat show it the first time a session
with a Claude model starts in that folder; the answer is kept in
~/.gaia/project_trust.json, beside config.json, and applies to every later
session there.
- Trust: the folder behaves as before.
- Don’t trust: the folder is treated as
off: its files stay out of the prompt, and GAIA does not ask again. - Nobody to ask (
gaia -p, a pipe, a script): an unanswered folder is not loaded and nothing waits.--full-access, and Full access in the apps, count as trusting every folder without asking. project_context fullis your own choice, so it never asks, andoffnever loads. Onlyautoconsults the saved answers.
git pull that adds or changes a CLAUDE.md, an AGENTS.md or a skill brings
no new question: a trusted folder loads the new files from its next session on,
and a declined one stays off. Working in a subfolder of a repository uses the
repository’s answer. A moved or renamed folder, or a second clone, is a new path,
so GAIA asks about it again.
A folder with none of these files is never asked about until one appears. To
forget an answer, delete its entry from project_trust.json, or the whole file.
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.