nao sync
Thenao sync command populates your context folder with content from configured sources.
--provider (or -p).
databases(aliases:db,dbs,database)repositories(aliases:repo,repos,repository)notion
provider:connection-name:
--select
By default, if you narrow a database sync to a subset of tables, nao sync removes any previously-synced table or schema that was not part of the run. Use --select (or -s) to refresh only a selection without deleting the rest of your synced context.
- A pattern with no dot (
analytics) selects every table in that schema (analytics.*). - A pattern with a dot (
analytics.orders) selects a specific table; glob wildcards are supported (staging.dim_*). - Selection is applied on top of the existing
include/excludeconfig innao_config.yaml: it narrows further, never widens. - When
--selectis passed, stale-path cleanup is skipped, so tables and schemas outside the selection are preserved. - Tables and Snowflake semantic views both respect the selection.
nao sync uses a single worker thread. Speed up large syncs with -t / --threads:
threads value in nao_config.yaml (which itself defaults to 1). The value must be 1 or greater.
What Gets Synced
When you run nao sync, the following happens:
1. Database Schemas
For each database in your nao_config.yaml:
- Connect to the database
- Extract schema information (tables, columns, data types)
- Generate context files in
databases/folder - Create structured files for each table:
columns.md- Column definitions and types, table description, row count, and partitioningpreview.md- Sample data previewprofiling.md- Data profiling informationannotations.md- Your own notes for the agent, created once and never overwritten
type: generated- written by the agent on every sync. Edits are lost on the next run.type: manual- written once and left alone afterwards. Safe to edit.
annotations.md is the manual file: nao sync creates it per table folder with only the header, and skips it on later runs if it already exists. Everything else under databases/ is regenerated. See Databases for details.
2. Repositories
For each repository in your configuration:
- Clone or pull the latest code
- Extract relevant files from specified paths
- Index content for the agent
- Store in
docs/folder
- Content is indexed for fast semantic search
- Embeddings are created for relevant context retrieval
- Agent can access all synced information
Scheduling
GitHub Actions
Set up automated syncing with GitHub Actions to keep your context up to date. 1. Create Workflow File This workflow will regularly runnao sync on GitHubβs servers, commit any changes to your context files (like updated database schemas or docs), and push them back to your repository so your context stays in sync without manual commands.
Create .github/workflows/nao-sync.yml in your repository:
- Go to Settings β Secrets and variables β Actions
- Click βNew repository secretβ
- Add secrets for all environment variables used in your
nao_config.yaml:ANTHROPIC_API_KEY- Required fornao syncto run the agentGCP_SERVICE_ACCOUNT_KEY_JSON- Full JSON content of your BigQuery service accountNOTION_API_KEY- If using Notion integration- Any other credentials referenced in your config
- Go to Actions tab in your repository
- Select βNao Syncβ workflow
- Click βRun workflowβ
- Check the Actions tab to see sync history
- Review logs if sync fails
- Verify changes are committed to your repository
The workflow automatically commits and pushes any changes from
nao sync back to your repository, keeping your context files up to date.Context Providers
Learn about configuring databases and repos
Context Engineering Playbook
Learn how to measure, iterate, and optimize your context
Start Chatting
Use your synced context with the agent
Context Principles
Understand core principles for effective context engineering