write-context-rules
write-context-rules
RULES.md is loaded with every message to the nao agent — keep it lean. Two purposes only:
- Orchestrator — point the agent to the right context fast (which metric → which table, which topic → which file, which question type → which skill).
- Broad rules — how to query and how to answer.
Anything else (per-table schema, full metric semantics, domain-specific rules) belongs in a referenced file: databases/<table>.md, semantics/<metric>.yaml, or a domain .md. Reference: docs.getnao.io/nao-agent/context-builder/rules-context.
Standard sections (see templates/RULES.md)
## Business overview— Product + Business model.## Data architecture— Warehouse, data stack, layers, sources.## Core data models—### Most Used Tables(one-line pointers) +### Tables detail(Purpose / Granularity / Key Columns ≤10 / Use For).## Key Metrics Reference— grouped by category;**metric** → table, column, formula.## Date filtering— three example formulas (last X weeks / last X days / current month). Don't enumerate every period.## Analysis Process— 5 subsections: Understand → Select Table → Write Query → Validate → Context.
Flow
More from getnao/nao
setup-context
Bootstrap a nao agent for a project — gather warehouse + scope + extra-context info in one round, look up the warehouse-specific config from nao docs, write nao_config.yaml, run nao init + nao sync, set up the LLM key, and generate the first RULES.md. Use when the user has just decided to use nao on a new project. Only for first-time setup; for editing rules, generating tests, or reviewing an existing context, use write-context-rules / create-context-tests / audit-context.
34audit-context
Diagnose the health of a nao context at any stage of its lifecycle. Use when the user wants a structured review of what's been synced, how RULES.md compares to the target structure, whether every table is documented, whether the data model is MECE, whether tests exist and what their failures reveal, and whether context files are bloated. Outputs a structured audit report with ranked recommendations. Do not use for first-time setup (setup-context) or routine rule writing (write-context-rules).
34create-context-tests
Generate a test suite of natural-language → SQL pairs that becomes the quality benchmark for a nao agent, then run it via `nao test`. Use when the user wants to start measuring agent reliability, extend an existing test suite, or add tests for new metrics. Tests are the only honest answer to "is the context working?". Do not use for writing rules (write-context-rules) or diagnosing failures (audit-context).
34add-semantic-layer
Wire a semantic layer into a nao agent so that metric queries are routed through a single source of truth. Supports dbt MetricFlow (dbt Cloud with Semantic Layer), Snowflake (views or semantic views via MCP), an in-house nao YAML semantic layer, or other tools (via MCP discovery). Installs the right MCP server, updates RULES.md to route metric queries through the semantic layer, and (for the nao YAML option) generates starter metric files. Use after a first round of tests has shown the agent struggling with metric reliability. Do not use for raw rule writing (write-context-rules) or first-time setup (setup-context).
32