> ## Documentation Index
> Fetch the complete documentation index at: https://www.testmuai.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Sharing the Context Graph with Your Team

> Share a .context store with your team through a GitHub repository, an S3-compatible bucket or a shared folder: kane-cli context push, pull, sync, clone, and the decisions when two people change the same thing.

`kane-cli context sync` shares your `.context/` store with your team through a **location**: a GitHub repository, an S3-compatible bucket, or a folder on a shared drive. Each person keeps their own store on their own machine, and the location holds the history the team shares.

* `kane-cli context push` publishes your new records to the location.
* `kane-cli context pull` takes your teammates' new records from it.
* `kane-cli context clone` creates a new store from the location.

Nothing on a location is ever overwritten or deleted, so you cannot un-publish a record by mistake.

> [!NOTE]
>
> Requires Kane CLI 0.8.14 or later.

You share a store you already have. If you do not have one yet, `kane-cli context ingest <file> --mode ci` creates one from a first document; see [Building the context graph](https://www.testmuai.com/docs/kane-cli-assurance-context.md). Then run:

```bash theme={null}
kane-cli context sync setup     # guided: share this store, or join your team's
kane-cli context sync origin    # every day after that: take the team's new records, publish your own
```

> [!WARNING]
>
> Two rules stand behind every command here: **never merge `.context/` with git**, and never edit it by hand. Sharing goes through a location, and only through the commands on this page.

## Three kinds of location

| Kind | Address you type | How you sign in | Who can read it |
| - | - | - | - |
| **GitHub** (recommended) | `https://github.com/<owner>/<repo>.git` or `git@github.com:<owner>/<repo>.git`; add `#<branch>` for a branch other than `main`, `?prefix=<path>` to share one repository between stores | the Git sign-in you already have (SSH key, or HTTPS through a credential helper); CI uses `KANE_SYNC_GIT_TOKEN` or a deploy key | whoever the repository's visibility and permissions allow, everyone if the repository is public |
| **S3-compatible** (AWS S3, MinIO, R2 and similar) | `s3://<bucket>/<prefix>?region=<region>&endpoint=<https://host>`, where `prefix`, `region` (default `us-east-1`) and `endpoint` (only for a non-AWS service) are optional | an access key pair, passed with `--credential-env` or `--credential-file` | everyone granted the bucket in the storage console |
| **Folder** | a path: `/Volumes/team/context` or `../shared/team-context` | none, the file system's own permissions | everyone who can open the folder |

### GitHub

* **Use a dedicated repository**, not your code repository, and make it private if your requirements are private.
* **Git 2.31 or newer** must be installed on the machine.
* **Connection check.** Setup and `kane-cli context sync add` test the repository by writing a few small, permanent connection-check files and commits. They never publish your context. The check also pushes to a scratch reference under `refs/kane/probe/`. If the check cannot finish (`SYNC_PROBE_INCONCLUSIVE`), the usual cause is a repository rule that blocks that reference: ask the repository owner to allow it, then run the command again.
* **How pushes land.** Each push is one ordinary commit on the branch. Nothing is force-pushed, merged, or rebased on the server.
* **Size limit.** GitHub does not accept a single object larger than 100 MB. If a source document is larger than that, use an S3-compatible bucket instead.
* **Signing in over HTTPS.** If you have no stored login, the GitHub CLI sets one up in two commands: `gh auth login --hostname github.com --git-protocol https --web`, then `gh auth setup-git --hostname github.com`.

Other Git servers work the same way, using that server's sign-in.

### S3-compatible storage

Ask your storage administrator for an existing bucket and a key pair. Kane CLI does not create either one.

* **Passing the keys.** `--credential-env TEAM_S3` reads `TEAM_S3_ID` and `TEAM_S3_SECRET`. `--credential-file keys.json` reads `{"accessKeyId": "…", "secretAccessKey": "…"}`.
* **Where the keys are saved.** Either way, the pair is saved in `~/.testmuai/kaneai/context-sync/<name>.json`, readable only by you (mode `0600`). `kane-cli context sync remove <name>` deletes it.
* **Keys belong to the location's name.** The file is tied to the location's *name*, not to one store. Every store on this machine whose location is called `origin` reads the same `origin.json`, so binding a second bucket as `origin` from another store replaces the keys the first store uses. If one machine works with more than one bucket, give each its own name (`team-s3`, `archive`).
* **Keys from the environment (CI).** When `KANE_SYNC_S3_ACCESS_KEY_ID` and `KANE_SYNC_S3_SECRET_ACCESS_KEY` are both set, they take priority over the file and are never written to disk. Use this form in CI.
* **A refused key pair never replaces a working one.**

```bash theme={null}
kane-cli context sync add origin "s3://team-context/assurance?region=eu-west-1" --credential-env TEAM_S3
kane-cli context sync add origin "s3://team-context/assurance?endpoint=https://minio.example.internal:9000" --credential-file ./keys.json
```

### Folder

A mounted shared drive works for a team. A path on your own disk works only for you, because sharing the path does not share its contents. If the folder does not exist yet, `kane-cli context sync add` creates it, as long as its parent folder exists.

## Guided setup

```bash theme={null}
kane-cli context sync setup
```

Setup needs a terminal. When run headless it refuses with `TTY_REQUIRED` and points you to `kane-cli context sync add` and `kane-cli context clone` instead. Setup never publishes your context; publishing is always a separate `kane-cli context push`.

The first screen asks **What do you want to do?** with two choices: **Share my context with my team** or **Join my team's context**.

### Share

Setup asks where the shared context should live: **GitHub — Recommended**, **S3-compatible storage**, or **Folder**. It then asks for the details of that kind:

* **GitHub**: the address of an existing repository. Or choose the row that opens GitHub in your browser, create a dedicated repository there, and come back with its address. If Git or the GitHub CLI is missing, you see an installation link and a row to retry.
* **S3**: the bucket name; the region (prefilled with `us-east-1`); an optional folder inside the bucket; the service (Amazon S3, or another S3-compatible service, which then asks for its endpoint); and how to connect. You can use credentials already configured on this computer, or type in the access keys from your storage administrator. The secret access key is masked as you type, and the keys are saved in your local Kane CLI credential store, never in the shared context.
* **Folder**: the path. The screen reminds you that everyone needs the same mounted drive.

The location is bound under the name `origin`. If this store already has a location called `origin`, setup asks for another name and suggests `team`.

The last screen shows the address and tells you that the connection check adds small, permanent files to the location (and, for a repository, commits). It then waits for you to choose **Connect location**. After connecting, setup tells you whether you can publish:

* With write access, it shows the `kane-cli context push <name>` line to run when you are ready.
* Without write access, it asks you to get write access and check the connection again.

Setup then prints `Share this location with teammates:` followed by the complete address (for a Git location, the repository address with the branch and prefix you chose), and one closing line saying who can read it.

If the location refuses the connection, **Use a different address** takes you back through the same prompts with what you typed kept, and **Choose a different storage** returns you to the storage picker. Press Esc or Ctrl+C to leave setup with exit `3`: *Setup left. Your context has not been published. Any completed connection checks remain in the location.*

### Join

1. Setup asks you to **Paste the location your teammate shared**.
2. Under **Download into a new folder**, it asks for a folder (prefilled with `team-context`). A folder that already exists is refused, so none of your files is replaced.
3. Choose **Connect and download**. Setup downloads the verified team context into that folder and closes with `Next: open that folder and run kane-cli context sync status.`

Joining never creates a location. If the address holds no records yet, it is refused until the teammate who shared it has pushed.

`kane-cli context clone <address> <dir>`, run by hand, is less strict about the folder. It accepts a folder that already exists as long as `<dir>/.context` is not there yet, which is how the CI recipe clones into `.`.

## The commands

Two terms appear in the output of these commands:

* **Witness**: the last record this machine saw on a location. Kane CLI keeps it to detect a location that has been rolled back.
* **Tier**: what the connection checks proved about a location. Tier 1 can publish; tiers 2 and 3 can only be downloaded from. The tier table [below](#tiers) explains each one.

| Command | When to use it | What it prints |
| - | - | - |
| `kane-cli context sync setup` | the first time, on a terminal | the screens above |
| `kane-cli context sync add <name> <address> [--credential-env <VAR> \| --credential-file <path>]` | bind a location by hand (scripts, CI, a second location). Re-running with the same name replaces its address, and its S3 keys when you pass new ones, which is how you re-key | `added origin: dir tier 1 (all probes passed)`, ending with what the checks found (see the tier table below). A changed address also prints `dropped the witness at position 4: the location changed from … to …`, and the new address starts without a witness |
| `kane-cli context sync list [--json]` | which locations this store knows | one line per location: `origin  dir  tier 1  …/shared/team-context`, meaning name, kind, what the checks found, address |
| `kane-cli context sync remove <name>` | forget a location; for an S3-compatible location its saved keys are deleted too | `removed origin`, then `kept its witness at position 4: re-adding the same storage keeps its rollback protection` if the location had a witness |
| `kane-cli context sync status [name] [--show <n>] [--json]` | where this store stands against the location; never writes | one line: `up to date with origin: position 4 on both sides`, `behind origin: this store is at position 1, origin at 2 — run kane-cli context pull origin`, `ahead of origin: … — run kane-cli context push origin`, `origin is empty: nothing has been pushed there yet — run …`, `this store is empty; origin is at position 2 — run …`, or `you and origin both added work after position 2 — run …`, then any open decisions. `--show <n>` prints saved record `n` in full |
| `kane-cli context sync doctor [--abort] [--export <dir> [--from <rebase-id>]] [--json]` | what the store looks like after an interruption; close an open rebase; rebuild the pre-rebase store beside | the chain state and every rebase with its id |
| `kane-cli context push [name]` | publish your new records | `pushed 2 records (3..4), 1 blobs, 0 proposals`; with nothing new to publish, `up to date` |
| `kane-cli context pull [name]` | take your teammates' new records | `pulled 1 records (3..3), 0 blobs, 0 proposals` |
| `kane-cli context pull <name> --rebase [--yes]` | you and the location both added work | the walk below |
| `kane-cli context sync [name] [--answer <id>=<choice>]` | the everyday verb: finish an open rebase, pull, then push | the pull and push lines |
| `kane-cli context clone <address> [dir] [--credential-env <VAR> \| --credential-file <path>]` | join: make a new store from a location, bound as `origin`. `dir` defaults to the location's last path segment (`team-context` for `../shared/team-context`), and the two flags pass an S3 key pair the same way `kane-cli context sync add` takes it | `cloned into …/bob: 2 records (1..2), 2 blobs, 0 proposals` |

If you leave out `[name]`, the command uses the only location. If there are several, it uses the one called `origin`. Otherwise it asks you to name one. Every command takes `--mode agent` for an NDJSON stream; see [Agents and CI](https://www.testmuai.com/docs/kane-cli-assurance-automation.md#the-sync-verbs-on-the-stream).

### What the tier means

Before binding a location, `kane-cli context sync add` and `kane-cli context clone` check two things: that the location can be read, and whether a small test write lands there and reads back. The result is reported as a tier:

* `kane-cli context sync add` prints `added <name>: <kind> tier <n> (<what the checks found>)`.
* `kane-cli context clone` prints `bound origin: …` in the same format.
* Each line of `kane-cli context sync list` repeats the kind and tier.

| The line says | It means |
| - | - |
| `dir tier 1 (all probes passed)`; for a bucket, `s3 tier 1 (all probes passed)`; for a repository, `git tier 1 (Can download and publish; independent reads and concurrent writes verified.)` | **can publish**: the location could be read, and the test write landed and read back, so publishing, taking and cloning all work |
| `dir tier 3 (P1 exclusive create: …/ro-location cannot be written: this account has no write access)`; for a repository, `git tier 3 (This location can be downloaded, but publication was refused.)` | **download only**: the location could be read, but the test write was refused (no permission, a read-only mount, a read-only key pair), so clone and pull work and push refuses. `kane-cli context sync add` follows with `read-only: this location can be cloned and pulled, never pushed`, and `kane-cli context clone` with `pull-only: this location can be cloned and pulled, never pushed` |
| `tier 2` | **download only** as well: the checks did not prove everything safe publishing needs, and the detail in the line names the check that failed. `kane-cli context sync add` follows with `pull-only: this storage did not prove atomic create`, and `kane-cli context clone` with the same `pull-only:` line as tier 3 |

### Joining an S3-compatible location

To clone an S3-compatible location with keys from the environment:

```bash theme={null}
kane-cli context clone "s3://team-context/assurance?region=eu-west-1" team-context --credential-env TEAM_S3
```

## The everyday loop

In this example, Alice shares a store she already built and Bob joins it. Then each of them works, pulls, and pushes. Normally Alice and Bob would be on two machines; here they are two folders side by side, with the location as a third:

```
team/
├── alice/                 alice's store (.context/ inside)
├── bob-home/              bob's machine; his store lands in bob/ after the clone
└── shared/team-context    the location
```

Alice runs her commands in `alice/`, Bob in `bob-home/`, and, once the clone exists, inside `bob/`.

```
[alice] $ kane-cli context sync add origin ../shared/team-context
checking origin: read access and safe publishing…
added origin: dir tier 1 (all probes passed)

[alice] $ kane-cli context push origin
wrote kane-context/v1/meta.json on origin
pushed 1 records (1..1), 1 blobs, 0 proposals

[bob] $ kane-cli context clone ../shared/team-context bob
checking origin: read access and safe publishing…
bound origin: dir tier 1 (all probes passed)
cloned into …/bob: 1 records (1..1), 1 blobs, 0 proposals

[bob] $ cd bob
```

In the push and clone lines, *blobs* are the source-document snapshots the records cite, and *proposals* are the extraction files behind those records. Both travel with the records; see [What travels](#travels). A proposal travels when its file exists, and a missing one never holds up a push or a pull.

Next, Bob ingests a second document and publishes it. Alice, who has not pulled yet, tries to push. In the output, `position 2` is the second record of the shared history, which this page calls record 2:

```
[bob] $ kane-cli context ingest brief.md --mode ci
created  brief  source sha256:f2e4…  blob sha256:60af…
landed 1 source(s) — run kane-cli context extract to extract them

[bob] $ kane-cli context push origin
pushed 1 records (2..2), 1 blobs, 0 proposals

[alice] $ kane-cli context sync status origin
behind origin: this store is at position 1, origin at 2 — run kane-cli context pull origin

[alice] $ kane-cli context push origin
error: origin holds 2 records, this store 1: it has records this store has not seen
next: kane-cli context pull origin

[alice] $ kane-cli context pull origin
pulled 1 records (2..2), 1 blobs, 0 proposals

[alice] $ kane-cli context sync origin
up to date
```

One habit avoids almost every refusal: **pull before you start, and push when you finish**. Or run `kane-cli context sync origin` at both ends.

If a teammate has pushed since you last pulled, any command that writes to the store first prints one advisory line and then continues:

* `origin has moved past this machine — run kane-cli context pull origin` when only the location moved.
* `this store and origin have diverged — run kane-cli context pull origin --rebase` when both sides moved.

This line is a best-effort reminder, not a check you can rely on. It never refuses anything, and it gives up silently after 1.5 seconds or when the location cannot be reached. It is not printed under `--mode agent`; there, `kane-cli context extract`, `kane-cli design tests` and `kane-cli maintain reconcile` emit a `sync_behind` event instead. `kane-cli context review` prints it unless you pass `--json` or `--mode agent`, and a test run writes it to its session log. Set `KANE_SYNC_GUARD=0` to turn it off.

Ingest, extract, review, and design all work as usual. The location only changes where the records go afterwards. What a push sends, and what stays on your machine, is listed in [What travels](#travels).

## What travels and what never travels

| Travels to the location | Never travels |
| - | - |
| every record of the graph (sources, use-cases, criteria, scenarios, tests, reviews, names, retirements, run results) | `.context/derived/`, the read caches, since every store rebuilds them from the records |
| the source documents those records cite (the snapshot bytes) | paused sessions, locks and per-run logs, which are one machine's state |
| the extraction proposals behind the records, when their files exist, and a missing one never blocks a push | your `_test.md` files, which are working files in your project, and the records already carry what a test is. A teammate who wants to run them takes them from the project's code checkout, and a rebase writes again the ones its reapplied records created |
| | your keys, the location list's local bindings, and the store's own identity ids |
| | everything under `.context/sync/`, meaning rebase backups, saved decisions and receipts, and the test results waiting on this machine to be recorded. A location never holds an unfinished rebase: finish or close it here |

The sync commands never call the agent, so **publishing, taking, cloning, and rebasing cost no credits.** A store that pulls a use-case gets the same records the extraction committed, including the cited lines.

## When a command refuses

Every sync refusal prints a plain-language reason, and nearly all add a `next:` line with the command to run. On the agent stream, the same refusal is a `sync_error` event with a stable code, the reason, and the fix. The most common refusals are:

| You see | Code | It means | Next |
| - | - | - | - |
| `origin holds 2 records, this store 1: it has records this store has not seen` | `SYNC_BEHIND` | you are behind | `kane-cli context pull origin`, then push again |
| `you and origin both added work after position 2` | `SYNC_DIVERGED` | you and a teammate both worked from the same record | `kane-cli context pull origin --rebase` (add `--yes` without a terminal) |
| a push says a teammate's record took the place it was writing to, and names the last record that landed | `SYNC_POSITION_TAKEN` | a teammate's push landed while your push was running, and what landed stays | `kane-cli context pull origin --rebase`, then push again |
| a push at the very first record says a teammate's record took the place it was writing to | `SYNC_POSITION_TAKEN` | the location was empty when you started and a teammate filled it first, so there is no shared history between you | `kane-cli context clone <address> <new-folder>`, then ingest your documents there again |
| a pull says this store changed while it ran | `SYNC_LOCAL_MOVED` | something appended to the store while the pull was being prepared or landing. When part of the pull had landed, the message names the range that did, a valid prefix, kept | run the pull again |
| `nothing answered at /no/such/parent/team-context: that folder does not exist and cannot be created`, or `no repository answered at that address, or your account cannot see it; a private repository looks missing until access is granted` | `SYNC_LOCATION_UNREACHABLE` | the address is wrong, the host is down, or a private repository is not shared with you | check the address, then run the command again |
| `the bucket … did not accept origin's access keys, even for reading`; over SSH, `github.com did not accept your SSH key` or `this computer has not accepted github.com's SSH host key yet`; over HTTPS, `sign in is needed, or your account has no access to this repository on github.com` | `SYNC_LOCATION_DENIED` | the location answered and refused you | follow the message: for a bucket, ask the owner for access or bind again with the right keys (`kane-cli context sync add origin <address> --credential-env <VAR>`); for an SSH key, load it with `ssh-add`; for a host key, run `ssh -T git@github.com` once and answer yes; over HTTPS, sign in through Git |
| `--credential-env TEAM_S3: TEAM_S3_ID is not set` | `CREDENTIALS_MISSING` | half a key pair | set `TEAM_S3_ID` and `TEAM_S3_SECRET`, then run the command again |
| `nothing to clone at …: it holds no records` | `SYNC_LOCATION_EMPTY` | the location is empty and nobody has pushed yet | ask the teammate who shared the address to run `kane-cli context push origin` first, then clone again |
| `archive is a tier 3 location: it can be cloned and pulled, never pushed` | `SYNC_READ_ONLY` | the location can be downloaded from only (no write permission, a read-only mount, a read-only key pair). `kane-cli context sync` meets this too, after its pull has already landed | take records from it with `kane-cli context pull`, and publish to a location that can publish |
| `a rebase (…) is open with 2 decisions unresolved` | `SYNC_REBASE_PENDING` | the store is fenced until the rebase is finished or closed | `kane-cli context sync` to answer, or `kane-cli context sync doctor --abort` to close it |
| `This location needs Git 2.31 or newer.` | `SYNC_GIT_REQUIRED` | Git is missing or too old for a GitHub location | install or update Git, then run the command again |
| `The server did not complete the concurrent connection check. Its scratch-ref policy may differ from the storage branch.` | `SYNC_PROBE_INCONCLUSIVE` | the concurrent connection check did not finish, and repository rules that block the scratch reference it pushes under `refs/kane/probe/` are the usual cause. Nothing was bound | ask the repository owner to check that the reference is allowed, then run the command again |
| `origin refused publication`, `A context object is too large for this Git location.` or `Git attributes transform context bytes (…)` | `SYNC_LOCATION_REFUSED_WRITE` | the location took the reads but refused the write: no write permission or a branch rule, a document above 100 MB, or a repository whose `.gitattributes` converts files | fix what the message names, whether write access or the rule, an S3-compatible bucket for the large document, or a dedicated repository with no conversions, then push again |
| `session … is live (pid …)`, `lock … is held by …` or `a reset is already in progress` | `SYNC_STORE_BUSY` | a live session, a held lock, a reset in progress, or a store that changed while the rebase was being prepared stopped the rebase from starting | follow the message: finish or pause the live session; wait for the command holding the lock; `kane-cli context sync doctor` for a reset in progress; when the store changed during preparation, run `kane-cli context pull origin --rebase` again |
| a message saying a record on the location is stamped with a newer version than this Kane CLI reads (on clone: `the storage was written with canonicalizer …`) | `SYNC_CLIENT_TOO_OLD` | a teammate published from a newer Kane CLI than yours | update Kane CLI, then run the command again |
| a rebase says this store is not the one origin was bound from | `SYNC_COPIED_STORE_UNRESOLVED` | you copied or moved the project folder since binding the location | `kane-cli context sync add origin <address>` in this folder, then run the command again |
| `origin holds a different history (its first record is not this store's)` | `SYNC_FOREIGN_LINEAGE` | that location was started from another store, and there is no merge | to work on it, clone it; to share this store, add an empty location |
| a push to a repository says publication could not be confirmed | `SYNC_PUBLICATION_UNKNOWN` | the network dropped mid-push, and the batch may have landed | check connectivity and run the same command again, which reconciles what landed and never duplicates it |
| `the storage kept growing while its tail was being found` | `SYNC_REMOTE_HOLE` | teammates were publishing while your command read the location, and nothing was changed on your side | run the command again in a moment |
| a message naming a hole at the location, a record or blob that should be there is missing | `SYNC_REMOTE_HOLE` | something outside Kane CLI deleted files at the location | nothing was changed on your side. Restore the location from a copy that holds the missing records, then run the command again |
| `the storage was rolled back: position … was seen there with …` | `SYNC_REMOTE_ROLLED_BACK` | the location was restored from an older snapshot, or rebuilt | nothing was changed on your side. Restore the location from a copy that holds the records this machine saw, or, once a person has confirmed it was rebuilt on purpose, `kane-cli context sync remove origin` then `kane-cli context sync add origin <address>` |
| `the tail at position … changed while this pull ran` | `SYNC_REMOTE_CHAIN_BROKEN` | the last record on the location read back with different contents during this pull, and nothing was changed on your side | run the pull again |
| a message saying a record on the location is sealed onto a hash its predecessor does not have | `SYNC_REMOTE_CHAIN_BROKEN` | the location's history was edited outside Kane CLI | nothing was changed on your side, and a person has to look at the location |
| a message saying an object *on the location* does not hash to its name | `SYNC_OBJECT_CORRUPT` | a file at the location is damaged | nothing was changed on your side, and a person has to look at the location before anything more is pushed to it |
| a message saying a *local* record or blob does not hash to its file name | `SYNC_LOCAL_RECORD_CORRUPT` or `SYNC_LOCAL_BLOB_CORRUPT` | a file in your own store is damaged, which says nothing about the location's copy | run `kane-cli context fsck`, then restore that record or blob from a backup or a clone of your store |

Exit codes:

* `3`: a person has to decide something.
* `2`: a precondition is not met.
* `1`: a record cannot be used.

A refusal tells you what stopped; it does not mean nothing happened. `kane-cli context sync` finishes its pull before its push can be refused, and a push can land before its confirmation is lost. A refusal not listed in this table still tells you what stopped and what to run next. How an agent handles these codes is in [Agents and CI](https://www.testmuai.com/docs/kane-cli-assurance-automation.md#the-sync-verbs-on-the-stream), and the entries a person meets most are in [Troubleshooting](https://www.testmuai.com/docs/kane-cli-troubleshooting.md#context-sync-a-location-cannot-be-reached-or-refuses-you).

## When two people changed the same thing

Here is an example. Alice and Bob both worked after the same shared record (record 2):

* Bob named the source `brief` "spec", ingested a new version of `prd`, then pushed.
* Alice, without pulling, named `prd` "spec" and retired `prd`.

Now `kane-cli context sync status origin` says `you and origin both added work after position 2` and names the command to run. `kane-cli context push origin` refuses with the same words (exit `3`), and so does a plain pull.

`kane-cli context pull origin --rebase` resolves this in three steps:

1. It **saves** Alice's records that come after the shared record in a backup.
2. It **takes** origin's records.
3. It **reapplies** the saved records on top, one by one.

Nothing on origin is rewritten. On a terminal, the rebase asks first, showing a panel with the facts and two rows:

```
rebase from origin
  local          2 records from position 3 saved to .context/sync/backups/2026-09-14T10-45-07-658Z-reset
  origin         records 3..4 taken into this store
  then           the local records reapplied on top; a disagreement becomes a decision you answer
  never          history on origin rewritten

? continue

❯ 1. continue  — save, take, reapply
  2. not now  — nothing changes

  ↑↓ select · ⏎ confirm · esc not now
```

Without a terminal, the same command refuses and tells you what to run: `kane-cli context pull origin --rebase --yes`. `--yes` confirms only the rebase itself; it never answers a decision. Choosing **Not now** prints `no rebase started — run kane-cli context pull origin --rebase when you are ready` and exits `3`, with nothing saved or taken.

Most saved records reapply without a question, with one line each. A record the other side did not touch is reapplied, and a record the other side already made the same way is skipped as already there. A **real disagreement about one thing** comes to you as a **decision card**, one at a time. The two sides are always called **local** and the location's name:

```
decision 1 of 2  ·  slug on your names from record 3
  local          named prd "spec" at 2026-09-14T10:44:20.253Z
  origin         "spec" names brief on origin (by bob at 2026-09-14T10:44:15.529Z)

? what should happen to the local names from record 3

❯ 1. keep origin's version  — the local change stays in the backup
  2. apply the local version  — the name moves to the local node; the node that holds it on origin is reached by its id again
  3. decide later  — leaves the rebase open; kane-cli context sync or kane-cli context pull asks again

  ↑↓ select · ⏎ confirm · 1–9 jump · v full record · a decide everything later · ctrl+c pause
```

The name after `by` is the author id recorded with that change: a person's user name as their machine reported it, or an agent. `someone` means the record has no author, as with a re-ingested source.

The answers on a card:

* **Keep origin's version** is always offered and is always the default. It writes nothing, and the local change stays in the backup.
* **Apply the local version** writes the local change as a new record on top of origin's. The row tells you the consequence.
* **Add the local version as new** replaces **apply the local version** when the item is newly created and origin has since retired its match. It creates *a new node beside origin's (duplicate check first)*.
* **Decide later** leaves the card open, and `kane-cli context sync` or `kane-cli context pull` asks again.

Press `v` to show the full record under the facts, `a` to leave every remaining card for later, or Ctrl+C to pause. None of these is an error. Each answered card leaves one line in the scrollback (`decision h3: kept origin's version`), and the run ends with a summary that counts what was reapplied, already there, not reapplied, and undecided.

Some saved records cannot be reapplied at all, and their card offers only **keep origin's version**. This happens with a record this version of Kane CLI cannot read or replay, a record that refers to an item origin no longer has, or a record the store's own checks refuse. The change stays in the backup, and you need to redo that piece of work after the rebase is finished. Keeping origin's version can also bring back a later card, because any saved record built on the one you set aside is checked again.

**Without a terminal** (a pipe, CI, or `--mode agent`), no card is shown. Each open decision is one line with its id, the kind of record, the local change in words, and the answers it accepts. `kane-cli context sync status` repeats them. If the location cannot be reached, the human-readable output still lists them before the refusal, and `--show <n>` works without the location:

```
[alice] $ kane-cli context sync status origin
up to date with origin: position 4 on both sides
rebase 2026-09-14T10-45-07-658Z-reset open: 2 decisions waiting
  h3  names   named prd "spec" at 2026-09-14T10:44:20.253Z  ·  keep-theirs | apply-mine
  h4  retire  retired prd at sha256:fb3e3e5a6cfa (2026-09-14T10:44:21.854Z)  ·  keep-theirs | apply-mine
next: kane-cli context sync  ·  kane-cli context sync status --show 3 (one record in full)
```

`kane-cli context sync status --show <n>` prints saved record `n` in full: what it did, what origin holds instead, the answers it accepts, and the raw detail behind the card.

```
[alice] $ kane-cli context sync status --show 3
record 3: names spec
origin sha256:1a52…
outcome: decision h3 (slug)
local:  named prd "spec" at 2026-09-14T10:44:20.253Z
origin: "spec" names brief on origin (by bob at 2026-09-14T10:44:15.529Z)
choose: keep-theirs, apply-mine
{
  "slug": "spec",
  "mine": "sha256:fb3e…",
  "theirs": "sha256:f2e4…"
}
```

The second line, `origin sha256:…`, is the saved record's own hash: the word there means the original record, not the location, and the location's side is the `origin:` row below it.

To answer by id, pass `--answer <id>=<choice>` to `kane-cli context sync` or `kane-cli context pull`:

* `keep-theirs` keeps origin's version.
* `apply-mine` applies the local version.
* `apply-mine-as-new` adds the local version as new.

Each run applies the answers you gave it. If cards are still open, it stops again and tells you (`not synced: 1 decision waiting — run kane-cli context sync origin to answer it, or kane-cli context sync origin --answer h4=<choice>`). The last answer finishes the rebase. After that, `kane-cli context sync` pulls and pushes as usual, while `kane-cli context pull` only pulls. In this example, `--answer h3=keep-theirs` was given in the previous run:

```
[alice] $ kane-cli context sync origin --answer h4=apply-mine
finishing rebase 2026-09-14T10-45-07-658Z-reset first: 1 decision waiting
reapplied your retire from record 4

rebase summary — complete
  rebase         2026-09-14T10-45-07-658Z-reset
  reapplied      1
  already there  0
  not reapplied  1
  test files     0 restored
pushed 1 records (5..5), 0 blobs, 0 proposals
```

To see what an answer did, show the saved record again after the rebase is closed. `kane-cli context sync status --show <n>` names the record it became:

```
[alice] $ kane-cli context sync status --show 4
record 4: retire prd
origin sha256:f972…
outcome: reapplied → record 5
```

> [!WARNING]
>
> **While a rebase is open, the store takes no other change**, exactly like git mid-rebase. `kane-cli context extract`, `kane-cli design tests`, `kane-cli maintain reconcile`, `kane-cli context ingest`, `kane-cli context review`, `kane-cli context name`, `kane-cli context retire` and `kane-cli context revert` refuse until the rebase is finished or closed, all with the same code (`SYNC_REBASE_PENDING`) and the same two ways out.

```
[alice] $ kane-cli context name prd other
error: a rebase (2026-09-14T10-45-07-658Z-reset) is open with 2 decisions unresolved; this store takes no other change until it is finished — run kane-cli context sync or kane-cli context pull to continue, or kane-cli context sync doctor --abort to close it
next: run kane-cli context sync or kane-cli context pull to continue, or kane-cli context sync doctor --abort to close it
```

`kane-cli context push` refuses with the same code and the same `next:` line. Its reason names the rebase, counts the unresolved decisions, and says nothing was pushed. A test run does not refuse: the results it records are set aside and land on the first run after the rebase is finished.

`kane-cli context sync doctor` shows the store's state and every rebase with its id, open or closed. Three terms in its output come from how a rebase works internally:

* A rebase id ends in `-reset`.
* The first line, `no reset in progress`, refers to the import step of a rebase. It reads `reset in progress` only when an import was interrupted before it finished.
* `sentinel: absent` is the healthy state. The sentinel is the marker a running import leaves in the store.

With the two decisions above still open:

```
[alice] $ kane-cli context sync doctor
no reset in progress
sentinel: absent
chain: ok, tail at position 4
rebase 2026-09-14T10-45-07-658Z-reset (2026-09-14 10:45:07Z): open, 0 reapplied, 0 already present, 0 not reapplied, 2 decisions open
next: kane-cli context sync (or kane-cli context pull) to finish rebase 2026-09-14T10-45-07-658Z-reset; kane-cli context sync doctor --abort to close it instead
```

`kane-cli context sync doctor --abort` closes the open rebase. It keeps what was already reapplied and leaves the unanswered decisions in the backup (exit `3` when decisions were left). From another run, with one decision open:

```
[alice] $ kane-cli context sync doctor --abort
closed rebase 2026-09-14T10-45-52-997Z-reset: 0 reapplied stay, 1 unresolved decision left in the backup (receipt: sync/replay/2026-09-14T10-45-52-997Z-reset.receipt.json)
```

If a rebase was interrupted before origin's records were imported, the same `kane-cli context sync doctor --abort` undoes it: your records are put back and the store returns to how it was. Once the import has landed, the rebase can only be finished (`SYNC_RESET_IMPORTED`). `kane-cli context sync` or `kane-cli context pull` finishes it before doing anything else, and you can then close it with `kane-cli context sync doctor --abort` if you still want to.

**Getting back the store as it was.** The live store holds records your teammates published, so it is never rewound in place. Instead, `kane-cli context sync doctor --export <dir>` rebuilds your store *as it was before the rebase* in a separate folder, as its own store. Use it to inspect the old state or as a fresh start:

```
[alice] $ kane-cli context sync doctor --export ../alice-before-rebase
exported rebase 2026-09-14T10-45-52-997Z-reset: 3 records (0 test files, 0 session files) into …/alice-before-rebase/.context; it is its own store
```

Give the export a new folder outside the live store and its backups; a folder that already holds a store is refused. The exported folder is a store like any other: open it and run `kane-cli context list` or `kane-cli context explain`. It has no location bound, so run `kane-cli context sync add` there first if you want to share from it.

Without `--from <rebase-id>`, the export uses the open rebase, or the only one. If there are several closed rebases, name one. Everything a rebase saves stays under `.context/sync/backups/<rebase id>/` and `.context/sync/replay/`, where a receipt lists every reapplied, skipped, and undecided record.

A `_test.md` file created by a reapplied record is **restored**, and the summary's `test files … restored` line counts these files. If someone else's file is now at that path, Kane CLI leaves it alone and `kane-cli context sync status` lists it. Rename or move that file, then run `kane-cli context sync` again.

## What happens when

`origin` is the location, and `local` means the records saved from your store.

| local… | origin, meanwhile… | Result of `kane-cli context pull origin --rebase` |
| - | - | - |
| ingested a new document, or extracted a new use-case | did something unrelated | reapplied, no question asked; a short id that origin has since used (`uc-5`) is renumbered (`uc-6`) and the alias is in the receipt |
| extracted a use-case | extracted the same use-case | kept once, origin's, and your review verdicts and evidence attach to it |
| edited a use-case | edited it the same way | not reapplied: already done |
| edited a use-case | edited it differently | a decision, and both versions are kept until you answer |
| reviewed an item (approve, reject) | reviewed the same item differently | a decision |
| named a node "spec" | named a *different* node "spec" | a decision: keep origin's name, or move the name to your node (origin's node is still reachable by its id) |
| archived an item | built new scenarios or tests on it | a decision that offers only **keep origin's version**: the archive stays in the backup, so reconsider it after the rebase is finished |
| retired a source | re-ingested a new version of that source | a decision: keep origin's new version, or retire the source as it is now, new version included |
| ran tests and recorded results | ran the same tests | both results apply, each to the exact version that ran |
| designed tests for a use-case | designed tests for the same use-case | a decision: keep origin's and run `kane-cli design tests` again afterwards if you want both |

## For agents and CI

Every sync command in the table above takes `--mode agent` and emits NDJSON events: `sync_status`, `sync_pull_done`, `sync_push_done`, the `sync_rebase_*` events, `sync_error{code, detail, remedy}`, and `done` last. A rebase that stops on decisions ends with `done` carrying `paused`, and exit `3`. [Agents and CI](https://www.testmuai.com/docs/kane-cli-assurance-automation.md#the-sync-verbs-on-the-stream) describes the events in full, and [CI/CD](https://www.testmuai.com/docs/kane-cli-cicd.md#a-shared-context-store-in-ci) has the CI setup with a GitHub token or deploy key.

## FAQ

**Can I merge two stores that were never connected?** No. A location holds one history, and a store started separately is `a different history`. Instead, clone one of them and ingest the other's documents into it again.

## Next Steps

* [Building the context graph](https://www.testmuai.com/docs/kane-cli-assurance-context.md) for ingest, extract and review
* [Agents and CI](https://www.testmuai.com/docs/kane-cli-assurance-automation.md) for the headless contract, including the sync verbs
* [Configuration](https://www.testmuai.com/docs/kane-cli-configuration.md#context-sync-environment-variables) for the sync environment variables and on-disk paths
* [Troubleshooting](https://www.testmuai.com/docs/kane-cli-troubleshooting.md) for the sync entries

## Terminal First Testing With Kane CLI

Natural language browser & mobile app tests right from terminal.

Book a Demo

![Kane CLI terminal](https://assets.testmu.ai/resources/images/Terminal-KaneCLI.png)

×

Schedule Your Personal Demo

<form>
  Select Product

  Schedule Demo
</form>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.