This is about your organization’s context repository - the repo holding
nao_config.yaml, RULES.md, and your synced schemas. It is not about contributing to the nao open-source project itself.How nao works
The agent knows nothing about your business on its own. Everything it understands - what a customer is, which table holds revenue, why last July looks strange - comes from your context: a set of Markdown and YAML files describing your data and your rules. When someone asks a question, the agent goes through roughly the same motions an analyst would:1
It reads the context
It looks for the files that describe the concepts in the question - definitions, table documentation, business rules.
2
It writes SQL
Based on what it found, not on guesses about your schema.
3
It runs the query and answers
Then it explains the result, showing the SQL it used.
How a nao context is structured
Manual files are written by you and your teammates. Auto files are produced by
nao sync, which pulls them from your warehouse and your repositories - and rewrites them on every run. More on what that means for your edits below.
How the agent finds context
Writing a good file is only half the job. If the agent never opens it, it may as well not exist.What the agent always sees
On every single message, before it does anything:- The system prompt - nao’s built-in prompt, plus any override in
agent/prompts/, plus the SQL dialect rules for your warehouses, injected automatically. RULES.md- in full, every time.
What the agent has to go find
To reach anything else, the agent uses its file tools:
So a contribution is discoverable when at least one of these is true:
RULES.mdpoints at it. This is the reliable one. The## Context mapsection exists to route the agent: “CRM funnel statuses ->docs/crm.md, read before any sales question.”- Its name says what it holds.
semantics/finance.mdgets found by a glob search for a finance question.misc.mddoes not. - It contains the vocabulary of the question. If your team says “churn” but your file only ever says “attrition”,
grepwill miss it. Write both. - It sits where the agent is already looking. A note filed next to
table=orders/gets read when the agent inspects that table, with no pointer needed.
Generated vs manual files
Some of your context is written by hand. The rest is produced bynao sync, which connects to your warehouse and your repositories and regenerates files from them.
This is the single most common way a contribution gets lost: an edit to a generated file disappears on the next sync.
You never have to guess which is which. Every file written by nao sync carries a frontmatter header declaring who owns it.
Generated - overwritten on the next sync. Your edit will disappear.
Where does my contribution belong?
Rules for writing context
Size
The File Explorer shows an estimated token count per file, and Recommendations flags files that are
truncated_on_read, frequent_and_expensive, or rare_but_outlier. If your file is flagged, split it.
Content
- Open with a scope line. One sentence saying what the file covers and when to read it, in the words a user would use. It is what tells the agent whether this is the file it needs.
- One canonical definition per concept. Two definitions of “active customer” in two files is worse than none - the agent will pick one at random and be inconsistent. If it is already defined somewhere, link to it instead of restating it.
- Never duplicate what
nao syncgenerates. Column lists and row counts are already indatabases/. Restating them means they go stale the day the schema changes. - Be explicit, not elegant. Name the exact table, the exact column, the exact filter.
WHERE status = 'won'beats “filter on won opportunities”. - Show the SQL. A formula the agent can copy is worth three paragraphs describing it.
- Write the failure modes. “Do not use
raw_orders, it includes test orders; usefct_orders” prevents a whole class of wrong answers. - Use your users’ words. Include synonyms and internal jargon so
grepfinds the file. - Date and timezone conventions matter. Week start, fiscal calendar, timezone of
created_at. These cause silent, plausible-looking errors. - No secrets, no PII, no credentials. Context files are read by the agent and visible to reviewers.
When to contribute
Contribute whenever you catch the agent being wrong, vague, or slow in a way you know how to fix:How to contribute
Both paths end the same way: a pull request that someone reviews. Context is a shared source of truth, so it goes through review like code.
From the browser
Open Settings -> File Explorer. Search covers file contents as well as names, so you can find the file by the term the agent got wrong.1
Find the file
Markdown opens as a rendered page. Click Source to edit with a live preview. Each file shows an estimated token count, so you can see what it costs the agent before you make it longer.
2
Edit and save
Cmd+S saves to your own private copy of the repository. Neither the live agent nor your teammates see the change yet.3
Commit
Saved edits collect in the Git panel under the file tree. Pick what to commit. Commits are authored as you, with nao as co-author. Committing from the main branch creates a branch automatically.
4
Open the pull request
The first push on a branch opens a pull request. Later pushes update that same one.
From your machine
Clone the context repo, edit, and open a PR as you would for any other repository.nao sync (to regenerate schema files) or nao test (to check your change against the test suite).
What reviewers look for
If you review context pull requests, check these:- Does this contradict a definition that already exists elsewhere?
- Is it in the right file, or was
RULES.mdused as a dumping ground? - Will it survive the next
nao sync? - Is it findable - named well, pointed to, using the vocabulary of real questions?
- Is it explicit enough that two different people would read it the same way?
- Does it carry a test?
Next steps
Principles
The MECE and token-cost rules behind these guidelines
Rules
The full reference for RULES.md and sub-rules files
Evaluation
Write tests that protect your contribution
Recommendations
Let nao tell you what to contribute next