Skip to main content
Version: 0.0.5

Core concepts

graft has one job: keep a single canonical agent definition equal to its copies across every provider. This page gives you the mental model and the vocabulary the rest of the docs use.

The canonical-first model

There is exactly one source of truth per agent: the canonical definition under .graft/agents/<name>/. Every provider holds a projection of that canonical agent in its own on-disk format. graft's job is to keep all projections equal to the canonical, in both directions:

  • Edit the canonical → graft writes every provider.
  • Edit a provider → graft pulls it back to canonical, then writes the rest.

Glossary

TermMeaning
CanonicalThe provider-neutral agent doc under .graft/agents/<name>/. The source of truth.
ProviderA target tool (claude-code, codex, …) with its own file layout and schema.
EntryGateThe single object the CLI talks to; holds the store, engine, and locks. The CLI never calls the engine, store, or providers directly.
WorkspaceThe identity tuple (root, remote, branch). One .graft/ tree per workspace row.
Sync runOne tracked execution, recorded with a run_id in sqlite.
DriftA provider's file no longer matches the stored/canonical hash.
git modetracked (uses your real git repo) or internal (graft keeps its own repo when none exists).
SkillA self-contained capability directory with a SKILL.md marker, stored canonically under .agents/skills/ and symlinked into each supporting provider.
providerOverridesA per-provider map in agent.yaml that stashes provider-specific fields with no canonical home, preserving them across round-trips.

The pieces

How the system is wired

The CLI calls only the EntryGate. The gate owns the store (sqlite), the sync engine, and concurrency locks. The engine uses a transform registry (canonical ⇄ provider), a git abstraction (GitX, with a go-git default and a shell fallback), and validation. Each provider is its own package behind one Provider interface.

This boundary is a hard rule: every command routes CLI → EntryGate → everything else.