Kronika CLI command

kronika write

Generate one complete Markdown document through Brama from the selected repository sources and an optional writing instruction.

Invocation

kronika write [options]

No command option is required. Model access requires BRAMA_URL and BRAMA_API_KEY_ROLE in ROLE#FIELD form; the configured credential source resolves the secret. By default Kronika previews a generated README.md for the current directory.

Inputs and options

OptionDefaultEffect
--repo <path>current directoryRepository root.
--output <path>README.mdTarget document inside the repository.
--source <path>automatic discoveryExplicit source file or directory; repeatable.
--instruction <text>standard complete-document goalAdditional writing goal.
--model <selector>KRONIKA_MODEL or anyBrama model selector.
--max-input-bytes <n>noneTotal source budget; unset, every selected source is read.
--max-file-bytes <n>nonePer-file source limit; unset, no file is skipped for its size.
--max-tokens <n>noneCompletion token budget; unset, the Brama alias's own limit applies.
--applyoffAtomically replaces the target document.
--jsonoffEmits metadata and, for a preview, generated content as JSON.

Output and state

Without --apply, stdout is the normalized generated Markdown and no file changes. With --apply, Kronika writes a temporary file beside the target, preserves an existing target's mode (or uses 0644), and renames it into place atomically. Text confirmation is Wrote <path> from <n> source files via Brama.

--json emits outputPath, applied, model, sourceCount, and skipped; a preview also includes content. A surrounding Markdown fence is removed and accepted output ends with one newline. Success exits 0.

Exact refusals

  • BRAMA_URL is required: the address of the Brama gateway
  • BRAMA_API_KEY_ROLE is required: ROLE#FIELD naming the role the item holding the Brama bearer plays, and its field
  • Output is outside the repository: <output>
  • No safe UTF-8 source files were selected
  • Brama returned empty documentation
  • Brama returned invalid NUL content

Source containment, symlink, existence, UTF-8, and byte-budget rules are the same as kronika sources. Missing flag values, non-positive numeric values and unknown options print help and exit 2; Brama and file-system failures exit 1. Errors include kronika: <message> on stderr.