Skip to main content

kapi context sync

kapi sync

Share this project's context through the place kapi.yaml names: first read what others shared and merge it here, then share what was recorded on this machine. Everything travels with its history: every suggestion, decision, term and approved wording, and the rules you applied to every project, which hold on every machine that syncs the project. Withheld originals stay on this machine. Running it twice changes nothing.

The place is declared in kapi.yaml, where every checkout reads it:

context: backend: git # local, file, git or s3

With --merged it also reads the change a range of commits made on the default branch and counts it as a person's signal: a suggestion whose preferred wording the change added, or whose avoided wording it removed, becomes a rule when nothing contradicts it. Run it in CI after a merge. The same range records the same evidence, so a second run changes nothing. A project that shares its context nowhere settles the merge on this machine.

--no-push reads what others shared and shares nothing back, for a check or a fresh checkout that only needs the context to answer from.

--status says where the context is shared and how far this machine and the shared copy were apart at the last sync, without contacting it.

Once the context is merged, sync rewrites the project's rules files: the section kapi keeps in AGENTS.md and CLAUDE.md at the project root, and in each folder whose rules differ from the root's. --files-only writes those files from the context this machine holds and does nothing else, which also writes them for a project that has none yet.

It exits with status 5 when the shared copy cannot be reached, and nothing changes here.

Commandcontext sync
Groupcontext-person
Try it

Runs in your browser against a small sample file. Edit the command before running, or press Run to execute it as shown.

kapi context sync
Flags
FlagTypeDefaultDescription
--files-onlyboolfalsewrite the project's rules files (AGENTS.md, CLAUDE.md) from this machine's context and do nothing else
--mergedstringa range of commits that reached the default branch, counted as a person's signal
--mergerstringwho merged it (the last commit's committer when unset)
--no-pushboolfalseread what others shared and share nothing back
--print0the pull request that merged the range (read from the commit subject when unset)
--project, -pstringpath to a kapi.yaml project recipe or its directory (auto-discovered from cwd if omitted)
--statusboolfalsesay where the context is shared and how far apart this machine is, without syncing
More examples
kapi context sync --status
kapi context sync --no-push
kapi context sync --files-only
kapi context sync --merged HEAD~1..HEAD
kapi context sync --merged "$BEFORE..$AFTER" --pr 412 --merger asgeir

← Back to the Command Reference