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 everythingTwo rebuild passes, and picking the wrong one silently does nothing
brain sync picks for you. This table matters when you script around it instead.
| Pass | Indexes | Needs a model | When brain uses it |
|---|---|---|---|
graphify extract | documents and code | yes, for documents | first build, and every --full |
graphify update | code only (local AST) | no | every later manual run |
Letting macOS do it
$ brain schedule ~/clients/acme --interval-minutes 15 --loadWrites 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
--backend <name>, if you pass one. - 2Whichever API key is in the environment —
ANTHROPIC_API_KEY,GEMINI_API_KEY,OPENAI_API_KEY, and so on. - 3Your Claude Code subscription, when neither is set and the
claudeCLI is installed. graphify shells out toclaude -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 defaultThe 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.