/ai-brain:brain-syncfrom ai-brain
Syncs current project context into an AI Brain by reading project files, comparing against existing knowledge via progressive disclosure, and capturing only new or changed information.
Ships in ai-brain. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Sync the current project's context into the AI Brain so future conversations have up-to-date knowledge about this project.
$ARGUMENTS — Optional:
--name <project-name> — Override the auto-derived project nameParse the name value from $ARGUMENTS if provided.
Read the following from the current working directory. Skip any that don't exist.
Project identity:
README.mdpackage.json, Cargo.toml, pyproject.toml, or go.mod (whichever exists)CLAUDE.mdGit state:
git branch --show-currentgit log --oneline -20gh pr list --limit 10 (skip if gh is unavailable)Project structure:
ls -la at the project rootStrategic context:
docs/ exists, list its contents and selectively read files that reveal project direction (specs, architecture docs, roadmaps). Do not read every file.GOALS.md, TODO.md, or similar planning files if they exist.If --name was provided, use that. Otherwise, derive the project name using this precedence:
name field from package.json / Cargo.toml / pyproject.tomlREADME.md3a. Triage via compact index.
Call mcp__ai-brain__search_thoughts with:
query: the project namelimit: 10includeHistorical: falseThis returns a compact index: each hit has {id, summary, snippet, type, topics, score}. Do NOT assume full content is present — there is none; snippet is ~240 chars.
3b. Identify hydration candidates.
From the index rows, select up to 5 candidates that look materially related (by summary + snippet + topics). Discard unrelated or obviously-stale rows based on snippet alone.
3c. Hydrate.
Call mcp__ai-brain__get_thoughts with ids: [<up to 5 ids>]. This returns full content for those specific thoughts. Only these hydrated results participate in the diff.
Compare the current project state (from Step 1) against the hydrated thoughts (from Step 3c):
For each unchanged fact, note the thought:<id> that already captures it — you'll reference these in the report.
Based on the diff from Step 4:
First sync (no hydrated thoughts, or all candidates were unrelated): Do not create a comprehensive bucket. Store up to three independently changeable units:
mcp__ai-brain__remember_fact for an explicit project name, one-line purpose, repository, or other precise scalar attribute. Use subject kind project, a stable project:<slug> key, sourceType: user_confirmed, and cite the project file in sourceRef.mcp__ai-brain__capture_thought for one coherent current project state or one decision/roadmap direction. Pass sourceType: user_confirmed and a project-file sourceRef.Collect each returned factId or thoughtId.
Subsequent syncs (hydrated thoughts found): Only capture thoughts for meaningful changes. Frame each as an update:
Update: <project-name> — <what changed> (<date>). <new status or direction>.
Skip unchanged information. If nothing meaningful has changed, capture no thoughts.
Pass sourceType: user_confirmed and the relevant file path as sourceRef for every capture. Route precise attribute changes through remember_fact; use changeKind: changed when the old value was formerly true and corrected only when it was inaccurate.
capture_thought performs the temporal reconciliation. When the prior state
is known, make the update standalone and include both what is true now and the
useful former context. The server will link the new current memory to any
superseded or retracted memories instead of overwriting them.
No changes: Tell the user the brain is already up to date and skip to Step 6.
Briefly tell the user:
thought:<id>thought:<new-id> and the prior thoughts they supersede as thought:<old-id> where applicablethought:<id> so the user can confirm coverageWhat SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
5 skills in this plugin
/brain-contextRestore the context of a specific moment — what was happening, what decisions were in flight, what was on your mind. Anchors on a date or event, pulls the timeline window, synthesizes a brief./brain-initBootstrap AI Brain with a small, reviewed set of atomic durable facts and narrative memories. Connector data produces candidates only; nothing is stored before user approval./brain-threadReconstruct the chronological evolution of thinking around a topic or anchor thought. Walks the timeline around a seed, hydrates the most substantive neighbors, and produces a citable narrative./weekly-reviewWeekly synthesis of your brain thoughts, workflow insights, and goals. Surfaces gaps, open loops, and recommendations. Every claim is cited back to its source.npx claudepluginhub flippyhead/ai-brain --plugin ai-brain