skills/first-tree-sync/SKILL.md
Audit and repair drift between merged code and the Context Tree in both directions — tree→code (does code still support tree facts?) and code→tree (does the tree register everything code now contains?). Use when the tree may be stale, wrong, outdated, or missing coverage for recent code changes; after a large merge; before release; on a freshly onboarded tree; or when a GitHub notification was routed `route=sync`. Sync owns broad drift discovery, structural skeleton repair, and substantive write hand-off across one tree. Use `first-tree-write` instead when the user already gave you a specific PR / doc / note to write into the tree.
npx skillsauth add agent-team-foundation/first-tree first-tree-syncInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Read these first:
../first-tree/SKILL.md../first-tree/references/functions.md../first-tree/references/maintenance.mdCompare a Context Tree against the source repo(s) it describes in both directions:
tree-stale, tree-wrong, tree-outdated, cross-domain-broken,
ownership-stale)code-not-synced)Classify every gap, then route each finding to auto-fix, hand-off-to-write, needs-human, or skip.
Two phases, in order:
drifts[] list. Read-only, human-paced. Combines
a tree→code pass (Phase 1–3) with a code→tree sweep (Phase 4).Each phase has a dedicated reference; follow them in order.
| Use this skill | Use a different skill |
| ---------------------------------------------------- | ------------------------------------------------------------------------------------ |
| User asks "is the tree up to date?" | User has a specific PR / doc to reflect into the tree → first-tree-write |
| Audit drift since a release | Repo is unbound → first-tree-onboarding first |
| GitHub Scan agent routed a notification route=sync | Notification needs a label / comment only → first-tree-github-scan keeps ownership |
tree-stale — tree node was true; code moved
tree-wrong — tree node never matched code
tree-outdated — superseded by a newer decision
code-not-synced/structural — code structure exists; tree skeleton does not register it
code-not-synced/substantive — code decision/constraint exists; tree does not record it
cross-domain-broken — soft_links target gone or wrong
ownership-stale — owners list no longer matches reality
code-not-synced has two subtypes because the fix shape is different:
structural gaps need registration (sync handles), substantive gaps need
authorship (write handles). See references/drift-taxonomy.md.
Definitions, signals, and worked examples in references/drift-taxonomy.md.
| Phase | Reference | | ----------------------------- | ------------------------------------------------------------ | | Find drift | references/audit-workflow.md | | Repair drift | references/fix-workflow.md | | Decide between sync and write | references/boundary.md |
The CLI surface this skill uses today:
first-tree tree inspect --json — confirm the bindingfirst-tree tree verify — surface broken soft_links and structure issuesgit log <ref>..HEAD -- <path> — recent-change sweepgh pr create — open the auto-fix tree PRThere is no first-tree tree audit command yet. The audit phase reads code
and tree manually; the fix phase opens PRs via gh.
Code is the ground truth for tree-stale, tree-wrong,
tree-outdated, cross-domain-broken. Override only when the node has
decisionLocksCode: true in frontmatter, in which case the drift is
always needs-human.
One drift = one PR (when auto-fixed). Do not bundle unrelated findings.
Ownership changes are always needs-human. Never auto-fix
owners: lists.
Audit produces a list; fix takes actions. Do not write tree updates inside the audit phase.
Sync may add structural skeletons; substantive content goes through
write. code-not-synced splits into two subtypes (see
references/drift-taxonomy.md):
first-tree-write, which applies the "default to
not writing" filter.Sync never composes decision prose from code. "The tree could say more"
about an existing topic is not drift — that is first-tree-write's job.
drifts[]tools
Canonical whitepaper and routing skill for First Tree. Explains what belongs in a Context Tree, how source or workspace roots, tree repos, and bindings relate, and how the current `first-tree tree` and `first-tree github scan` surfaces fit together. Use when you need shared First Tree concepts, need to choose between onboarding, sync, write, or GitHub notification workflows, or need the high-level CLI map before acting.
tools
One-shot onboarding command for First Tree. Drives a repo or workspace from "no first-tree" all the way to "tree bound, real content drafted, daemon running, agent templates confirmed" — end to end, in one skill invocation. Trigger this skill when the user invokes `/first-tree-onboarding`, says "onboard this repo to first-tree", "set up first-tree here", "complete first-tree onboarding", or runs first-tree against an unbound repo or workspace. Also trigger when re-running on an already-bound repo to refresh skills, draft missing content, or reverify the daemon. Use this skill instead of running `first-tree tree init` from raw memory; it owns role-by-role branching, the initial-content drafting phase the CLI does NOT do, and the final doctor checks.
tools
Operate the `first-tree github scan` CLI — the GitHub notification daemon and inbox runtime. Use whenever you need to run, start, stop, inspect, poll, or debug github-scan; view or respond to GitHub-triggered work from the terminal; or wire up the github-scan statusline hook.
development
Write Context Tree updates from explicit source material — code PRs, design docs, meeting notes, raw text. Use when the user gives you a concrete source and wants the right durable tree change drafted, linked, and reviewed. This skill is source-driven and targeted; use `first-tree-sync` instead for broad drift audits with no specific source.