Kronika CLI command

kronika sync

Reconcile every manifest-declared document with its repository evidence: establish baselines, audit drifted documents, rewrite only audited defects, and record the reconciled commit.

Invocation

kronika sync [options]

A schema-version 1 sync manifest is required at kronika.sync.json by default. Each document entry must have a non-empty output and non-empty sources array. BRAMA_URL and a BRAMA_API_KEY_ROLE credential reference are required even when the current tick needs no model call. Secrets are resolved through the configured credential source, not read directly from environment variables.

Inputs and options

OptionDefaultEffect
--repo <path>current directoryGit repository containing manifest, state, sources, and outputs.
--manifest <path>kronika.sync.jsonSync manifest inside the repository.
--state <path>kronika.sync-state.jsonPersistent reconciliation baselines.
--model <selector>KRONIKA_MODEL or anyDefault Brama model unless a document overrides it.
--max-input-bytes <n>noneTotal source budget for documents that state none; unset, sources are read whole.
--max-file-bytes <n>nonePer-file source limit for documents that state none.
--max-diff-bytes <n>noneComplete-diff limit for documents that state none; unset, the whole diff is audited.
--max-tokens <n>noneCompletion token budget for documents that state none.
--dry-runoffReports and audits but writes no document or state, and never commits.
--commitoffStages rewritten documents and state, then creates a sync commit when something changed.
--pushoffRuns git push after a sync commit; requires --commit, otherwise the invocation is refused before credential resolution.
--jsonoffEmits the machine-readable tick result.

Output and state

Text starts with Kronika sync at <sha12>, with (dry run) when applicable, then reports one outcome per document: baseline, current, advanced, checked-current, rewritten, or failed. JSON includes headSha, dryRun, committed, stateWritten, and complete outcomes with changed paths and findings.

A first non-dry run records a baseline and generates nothing. An unchanged baseline is current. If no declared evidence changed, the baseline advances without Brama. Changed evidence is audited; a passing audit advances state without prose churn, while blockers cause an atomic rewrite using those findings as the correction brief. State is written only when a baseline advances. Any failed outcome makes the process exit 1; otherwise it exits 0.

With --commit, sync commits rewritten outputs and state as kronika sync: reconcile <files>, or state alone as kronika sync: advance documentation baselines. --push pushes that commit.

Exact refusals and failed outcomes

  • sync --push requires --commit: usage refusal before any model or Git work.
  • Sync manifest is missing: <path>. Declare the maintained documents first.
  • Sync manifest is not valid JSON: <path> or Unsupported sync manifest schemaVersion in <path>
  • Sync manifest declares no documents: <path>
  • Sync manifest entry without an output path in <path> or Sync manifest entry <output> declares no sources
  • Sync state is not valid JSON: <path>. Fix or delete it to re-baseline. or Unsupported sync state schemaVersion in <path>
  • BRAMA_URL is required: the address of the Brama gateway and BRAMA_API_KEY_ROLE is required: ROLE#FIELD naming the role the item holding the Brama bearer plays, and its field

A baseline that cannot be diffed yields a failed outcome instructing the operator to delete that state entry to re-baseline. An incomplete audit yields audit did not complete: <message>; a blocked audit whose rewrite fails yields audit found blockers but the rewrite did not complete: <message>. Git commit or push failures are process errors. See the sync loop for the complete state machine.