Documentation · Sync and indexing

Keeping it true, on a schedule.

Building the graph is the easy part. This is the part that decides whether the answer you get in six weeks is still the right one: what a sync pass does, how macOS runs it while you are not looking, and what indexing actually costs.

Re-syncing never duplicates a record — the reason why is in the first section. What a sync feeds is described in the seven steps.

Syncing and scheduling

Each source says how often it should be checked. brain sync runs the ones that are due — tracked in connectors/state/<name>.json — and rebuilds the graph only if one of them actually ran. So running it often is cheap.

$ brain sync ~/clients/acme             # just what's due
$ brain sync ~/clients/acme --dry-run   # what would run, touching nothing
$ brain sync ~/clients/acme --full      # re-read and re-index everything

Two rebuild passes, and picking the wrong one silently does nothing

brain sync picks for you. This table matters when you script around it instead.

PassIndexesNeeds a modelWhen brain uses it
graphify extractdocuments and codeyes, for documentsfirst build, and every --full
graphify updatecode only (local AST)noevery later manual run

Letting macOS do it

$ brain schedule ~/clients/acme --interval-minutes 15 --load

Writes a LaunchAgent at ~/Library/LaunchAgents/com.graphify.sync.<slug>.plist. Without --load it only writes the plist and prints the launchctl bootstrap command. It refuses to run if the project has no registered connectors — scheduling a sync loop with nothing to sync is a silent no-op that is confusing to debug later.

Indexing, models and cost

Indexing code is a local AST pass with no model involved. Indexing documents — the proposals, the notes, the CRM records — needs one. That does not mean it needs a new bill.

brain sync chooses a backend in this order:

  1. 1--backend <name>, if you pass one.
  2. 2Whichever API key is in the environment — ANTHROPIC_API_KEY, GEMINI_API_KEY, OPENAI_API_KEY, and so on.
  3. 3Your Claude Code subscription, when neither is set and the claude CLI is installed. graphify shells out to claude -p, so indexing is billed to your Pro or Max plan instead of pay-as-you-go API credit.
$ brain sync ~/clients/acme --full --backend claude-cli   # force the subscription
$ export GRAPHIFY_CLAUDE_CLI_MODEL=haiku                  # faster and lighter than the Opus default

The subscription backend runs one chunk at a time, so a large first sync is slower than an API key would be. A local model works too: --backend ollama.