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
| Option | Default | Effect |
|---|---|---|
--repo <path> | current directory | Repository root. |
--output <path> | README.md | Target document inside the repository. |
--source <path> | automatic discovery | Explicit source file or directory; repeatable. |
--instruction <text> | standard complete-document goal | Additional writing goal. |
--model <selector> | KRONIKA_MODEL or any | Brama model selector. |
--max-input-bytes <n> | none | Total source budget; unset, every selected source is read. |
--max-file-bytes <n> | none | Per-file source limit; unset, no file is skipped for its size. |
--max-tokens <n> | none | Completion token budget; unset, the Brama alias's own limit applies. |
--apply | off | Atomically replaces the target document. |
--json | off | Emits 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 gatewayBRAMA_API_KEY_ROLE is required: ROLE#FIELD naming the role the item holding the Brama bearer plays, and its fieldOutput is outside the repository: <output>No safe UTF-8 source files were selectedBrama returned empty documentationBrama 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.