Skip to main content
Nia Sync is a standalone CLI daemon that continuously synchronizes your local data sources with Nia, enabling AI agents to search your personal knowledge base.
Privacy First: Local folders are private to your account. They’re searched separately from public repositories and documentation.

Quick Install

curl -fsSL https://app.trynia.ai/install-sync | bash
Or install via pip:
pip install nia-sync

Getting Started

1

Login

Authenticate with your Nia account:
nia login
This opens your browser for secure OAuth authentication.
2

Add a Source

Add a local folder or database to sync:
nia add ~/Documents/notes
The CLI auto-detects known database paths (iMessage, browser history, etc.).
3

Start Syncing

Start the sync daemon:
nia
The daemon watches for file changes and syncs incrementally in real-time.
4

Check Status

View all synced sources:
nia status

CLI Commands

Core Commands

CommandDescription
niaStart sync daemon (watch mode by default)
nia loginBrowser-based OAuth authentication
nia logoutClear stored credentials
nia statusShow all configured sources with sync status
nia status --jsonOutput status as JSON for scripting
nia onceRun one-time sync then exit
nia add <path>Add new source for sync
nia link <ID> <path>Link cloud source to local path
nia remove <ID>Remove source from sync
nia upgradeCheck and install updates

Search & Query

Search your indexed sources directly from the terminal:
# Basic search with streaming AI response
nia search "meeting notes from last week"

# Search specific folders
nia search "project updates" --local-folder my-notes --local-folder work-docs

# Show source snippets alongside the answer
nia search "authentication code" --sources

# Raw text output (no markdown rendering)
nia search "api endpoints" --no-markdown

# JSON output for scripting
nia search "config values" --json --no-stream
FlagDescription
-l, --local-folderLimit search to specific folder(s). Accepts ID prefix or display name
--sourcesShow source snippets used to generate the answer
--markdown/--no-markdownToggle rich Markdown rendering (default: on)
--stream/--no-streamToggle streaming response (default: on)
-j, --jsonOutput raw JSON for programmatic use
-n, --limitMax source snippets to display

Monitoring & Debugging

CommandDescription
nia info <ID>Show detailed info for a source (chunk count, last sync, errors)
nia logsShow sync logs for all sources
nia logs <ID>Show sync logs for a specific source
nia logs --tailContinuously tail new logs
nia logs --errorsOnly show error logs
nia diffDry-run: show what would sync without uploading
nia diff <ID>Dry-run for a specific source
nia doctorRun diagnostics for common issues (auth, API, disk access)
nia whoamiShow current authenticated user
nia versionShow CLI version
nia version --checkCheck for available updates

Sync Control

CommandDescription
nia pause <ID>Pause continuous sync for a source
nia resume <ID>Resume continuous sync for a source
nia resync <ID>Force full resync by resetting cursor
nia resync --allForce full resync for all sources

Web Integration

Open Nia web app pages directly from the CLI:
nia open dashboard      # Open main dashboard
nia open activity       # Open activity feed
nia open local-sync     # Open local sync settings
nia open api-keys       # Open API keys page
nia open billing        # Open billing page
nia open docs           # Open documentation
nia open <source-id>    # Open specific source detail page

Configuration Management

Config Commands

Manage CLI settings directly from the terminal:
# View all config
nia config list

# Get a specific value
nia config get api_url

# Set a value
nia config set api_url "https://api.trynia.ai"

Ignore Patterns

Customize which files are excluded from sync:
# List current ignore patterns
nia ignore list

# Ignore a directory name
nia ignore add --dir node_modules

# Ignore a file name
nia ignore add --file .DS_Store

# Ignore a file extension
nia ignore add --ext .log

# Ignore a path substring
nia ignore add --path /build/

# Remove an ignore pattern
nia ignore remove --ext .log

Watch Directories

Configure which directories are scanned for auto-linking sources:
# List watched directories
nia watch list

# Add a directory to watch
nia watch add ~/Projects

# Remove a watch directory
nia watch remove ~/Projects
When you create a folder in a watched directory that matches an unlinked source’s name, Nia automatically discovers and links it.

Source ID Shortcuts

You don’t need to type full UUIDs. Nia accepts:
  • ID prefixes: nia info a3f2 matches a3f2b1c8-...
  • Display names: nia pause "My Notes" matches by folder name
If a prefix is ambiguous (matches multiple sources), you’ll be prompted with the matches.

Daemon Mode

Running nia without arguments starts the sync daemon with real-time file watching:
NIA Nia Sync Engine

● real-time file watching
● 3 source(s) active
● Auto-refresh every 30s

Ctrl+C to stop
The daemon:
  • Watches for file changes using native filesystem events
  • Syncs changes within seconds of detection
  • Periodically refreshes the source list from the web UI
  • Auto-discovers new folders matching unlinked sources
  • Sends heartbeats to mark daemon as online

Daemon Flags

FlagDefaultDescription
--watch/--poll--watchReal-time watching vs interval polling
-f, --fallback600Fallback sync interval in seconds (catches missed events)
-r, --refresh30How often to check for new sources from web UI

Supported Data Sources

Nia Sync automatically extracts and indexes content from various data sources:

Chat & Messages

  • iMessage (~/Library/Messages/chat.db)
  • Telegram (JSON exports, ZIP files)

Browser History

  • Safari (~/Library/Safari/History.db)
  • Chrome / Brave / Edge
  • Firefox

Databases

  • Generic SQLite databases
  • Auto-extracts tables into searchable text

Folders

  • Regular folders with text files
  • Code, notes, documentation

Virtual File Format

Database content is extracted into virtual text files for semantic search:
SourceVirtual Path Format
iMessagemessages/{contact}/{date}_{row_id}_{direction}.txt
Safari/Chrome/Firefoxhistory/{domain}/{date}_{id}.txt
Telegramtelegram/{chat_name}/{date}_{msg_id}.txt

Web UI

You can also manage synced sources from the Nia web app:
  1. Go to app.trynia.ai
  2. Navigate to Settings → Local Sync
  3. View sync status, add/remove sources, and configure sync intervals

Sync Intervals

Configure how often sources are synced:
IntervalDescription
5mEvery 5 minutes
hourlyEvery hour
6hEvery 6 hours
dailyOnce per day

Searching Local Folders

Once synced, your local folders are searchable via MCP tools:
# Search across local folders
search(query="meeting notes from last week", local_folders=["folder-id-here"])

# Read files from a local folder
nia_read(source_type="local_folder", local_folder_id="folder-id-here", path="/notes/meeting.txt")

# Grep in local folders
nia_grep(source_type="local_folder", local_folder_id="folder-id-here", pattern="TODO")

# Explore folder structure
nia_explore(source_type="local_folder", local_folder_id="folder-id-here", action="tree")
Local folders are private and searched separately from public repositories. Use local_folders parameter in search() to include them.

Configuration

Environment Variables

VariableDefaultDescription
NIA_API_URLhttps://api.trynia.aiOverride API base URL

Config File

Credentials are stored in ~/.nia-sync/config.json with secure permissions (mode 0600).

Limits

LimitValue
Max files per folder5,000
Max total upload size100 MB per folder
Max individual file size5 MB
Max database size1 GB
Max rows per table100,000

Security

350+ exclusion patterns automatically protect sensitive files from being synced.
The following are never synced:
  • Credentials: .env, .pem, .key, SSH keys, *credentials*, *secrets*, *token*
  • Version control: .git, .svn
  • Dependencies: node_modules, venv, __pycache__
  • Build outputs: dist/, build/, .next/
API keys are stored locally with user-only read/write permissions and are never logged or transmitted in plaintext.
Need Help? Join our Discord community or reach out through app.trynia.ai for support.