Repository navigation
Releases
v0.3.0 — iMessage attachments
v0.3.0 — iMessage attachments
An additive release: the iMessage channel now delivers what arrived, and a kian started under a git
hook stops pointing nested git at the caller's repository. No event kind, wire shape, replay rule or
database migration changes; a text-only payload keeps its exact bytes, and a config without media:
keeps its tool set byte-identical.
Attachments reach the model
-
Metadata first. The adapter models the bridge's
attachmentswhitelist and mapsfilename,
mime_type,total_bytesandis_stickerinto the channel payload, so a photo, voice note or file
arrives as[image]/[attachment]marker text plus what arrived instead of a bare marker. A
text-only payload keeps its exact bytes (the key is absent without attachments), and
watch.attachments(default on) documents the knob. One checked-in ABI row is asserted by both the
bridge's emitter and the adapter's parser, so a renamed field fails a test rather than vanishing
from the model's view. -
Bytes are opt-in.
attachments: bytes(defaultmetadata, refused without amedia:section)
fetches each image/audio item with the page'sgenerationthrough the bridge's new authenticated
GET /v1/attachmentroute, writes the bytes into the artifact store and hands the ADR-062 envelope
to the media edge — the model reads an OCR/ASR transcript instead of a bare[image]marker. A
generation mismatch is409,watch.max_attachment_bytes(default 16 MiB) bounds one file, a failed
fetch keeps the metadata and admits the row, and base64 never persists. Vision of pixels stays out
(ADR-063).
Contract: CHANNEL-IMESSAGE §2.5, §3.2, §4,
ADR-064.
Cron worktrees
A kian started under a hook (or any wrapper exporting GIT_DIR/GIT_WORK_TREE) no longer points
worktree inspection, creation or cleanup at that checkout instead of the configured repository: every
nested git spawn goes through cron_worktree::git_command, which scrubs the repository environment and
the object/store overrides.
Upgrading
- No database migration, no event-kind change and no KiandProto bump (still v3): a
kiandbuilt from
0.2.0 talks to a 0.3.0kianand vice versa. - The
kianserver must be upgraded for attachment metadata to reach the model: an older server
ignores the additive field, so a mixed pair stays safe but the model sees a bare marker. - The bridge must be upgraded for
attachments: bytes(the new route); metadata mode works with the
previous bridge. - Enabling bytes is three config pieces, and the binaries go first:
attachments: byteson the
channel,media:+artifacts:at the top level, and the media API key in the environment. An
unknownattachmentsvalue refuses boot on the previous binary.
Install
Prebuilt archives (with .sha256) for x86_64/aarch64 Linux and macOS,
ghcr.io/flyer103/kian:0.3.0, and crates.io:
cargo install kian-cli --version 0.3.0
cargo install kiand --version 0.3.0From source:
cargo build --release --locked -p kian-cli -p kiandThe macOS bridge is built from source (cargo build --release -p kian-imessage-bridge); it is not part
of the archives.
Boundaries, stated up front
- The WeChat channel does not emit the
mediaenvelope yet. attachments: metadata(the default) never fetches bytes; the model sees the name, type and size.- The bridge route serves image and audio only; pixels do not reach the model as vision parts through
this path (ADR-063).
Licensed under Apache-2.0.
v0.2.0 — vision, media, compaction, budgets
v0.2.0 — vision, media, compaction, budgets
The first feature release since the public snapshot. Everything here is additive: no event kind,
wire shape or replay rule breaks, and a config that does not opt in keeps its request bytes
byte-identical.
Context and cost
- Long sessions compact themselves.
kian-orchestrator::compactionfolds old turns under
measured pressure — only when the worst-case next request would consume 90% of a declared
model_profiles.*.context_window, or when the provider reports an overflow. The fold is an
ordinary persisted maintenance turn (step/requestwithpurpose: compact, then acompact
event on success), uses the session's bound slot with one request and no fallback, and is capped
at two folds per drain episode. Ordinary turns reserve 10% of the token allowance for it. - A session-lifetime token budget that refuses before the call.
agents.<name>.budgets.tokens
projectsbase + Σbudget/raised − Σturn/end.usage, admits the request plan's worst case and
refuses the turn beforestep/requestis persisted; the session parksawaiting_budgetand
resumes.kian raise-budget/raise_budgetadmits one durable, idempotent control row. - A price book turns usage into money.
pricing:declares per-million-token cache-hit,
cache-miss and output prices, peak windows and holidays, normalized once to integer micro-USD;
kian costattributes eachturn/endusage to the last request target and reports priced /
unpriced / unknown usage and the peak split. Nothing is written to the event stream. - Request plans. Every provider attempt is built by a pure planner returning the body, its
dialect, profile digest, body digest and a token band; sender, persistence, cache check and the
budget gate consume that one value.model_profiles:now also carriesvision: true. kian usage-stats,/metricsandsession inspectreport cache-miss input tokens and a hit
rate. A rejected DeepSeek request (HTTP 422 / in-band 400/422) is classifiedInvalidResponse
and no longer retried on a fallback.
Media and artifacts
- Tool results ride the event stream by reference. With
artifacts:configured, a successful
tool/resultaboveinline_max_bytes(16 KiB) is rewritten to a content-addressed
{artifact, preview, truncated}before the event is appended; the store is sha256-addressed,
atomic, path-traversal-proof and collected by retention (kian artifacts gc, 10 GiB / 30 days).
artifact_readserves the payload back in bounded windows. - Media tools and file ingest.
media:mountsimage_ocr,audio_transcribeand
speech_synthesizeas audited tools over DeepSeek's media APIs;kian artifacts put <path>
turns a local file into an artifact. - Vision inputs. A vision-profile target sees artifact-backed images as OpenAI
image_url
content parts; V1 and every image-free V2 body stay byte-identical, and a reclaimed blob degrades
the picture rather than the turn. - Channel-edge media. Voice notes and photos from an adapter carrying the
mediaenvelope are
written to the artifact store, transcribed, and admitted as text plus an artifact reference — no
base64 ever re-enters the payload. Shipped adapters emit the envelope in their phase-2 contract.
Tools and operations
web_searchandweb_fetchon the operator's own DeepSeek key (web:), as ordinary
audited tool calls; large pages spill by reference instead of being truncated.- Artifact retention runs inside
kian servebeside the snapshot and view tickers, and
kian session export --with-artifactspins every referenced blob into a sibling directory so an
audit package stays payload-complete. - Off-peak deferral. JSON-RPC
submit/queuewithdefer: "off_peak"and a cron resident
schedule withdefer: off_peakpersist the ordinary inbox row with a computedeligible_at,
bounded bydefer.max_wait_ms. No second scheduler, no timer per row, no new event kind.
Install
Prebuilt archives (with .sha256) for x86_64/aarch64 Linux and macOS are attached below, and
ghcr.io/flyer103/kian:0.2.0 carries the same kian + kiand pair. From source:
cargo build --release --locked -p kian-cli -p kiandcrates.io still carries 0.1.1; the registry publish is a separate step.
Boundaries, stated up front
- No shipped channel adapter emits the
mediaenvelope yet — WeChat and iMessage record it as
their phase-2 contract. - Search/Fetch per-request fees are not yet in the token cost projection.
- Wall-clock budget raises are projected but not enforced while a drain is idle.
- Compaction never runs for cost: only measured context pressure or a provider overflow triggers it.
Licensed under Apache-2.0.
v0.1.1
Kian Runtime 0.1.1: registry metadata, crates.io install path
v0.1.0 — first public release
v0.1.0 — first public release
First public snapshot of Kian — the durable execution runtime for agents.
A Session is the one first-class durable entity, the append-only event stream is the only truth, and
a drain is a disposable execution interval. Three promises follow from that shape.
Durable execution
A crash, a deploy or a machine move costs a restart, not the work. Session state is a projection of
the stream, a new drain replays it and continues, and the exact model request bytes are persisted
before the call flies (step/request) — so replay is byte-identical and the provider's prefix cache
survives a takeover. Safety comes from epoch fencing, not from the lease: a partitioned-but-alive old
holder is fenced out.
The recording above is a real run: the turn is in flight, kill -9, a new drain takes over at
epoch 2, and the replay derives 2 of 2 request bodies byte-identically.
BYOM execution
A single-binary kiand daemon runs the session's commands on the machine you choose, over a durable
at-least-once queue with a heartbeat watchdog, bound 1:1 to its worker session for that session's
whole life. Offline work parks and resumes; membership is liveness only, and binding is frozen for
the session's lifetime.
The same demo, recorded:
the brain stays, the hands move.
Harness integration
The built-in ReAct loop, or dsh / Claude Code / Codex behind the same LoopDriver seam and the same
23 event kinds, selected per worker agent. A harness-owned loop is a projection-only session,
and the capability matrix states exactly what each one supports instead of implying equivalence.
In this release
- 19 crates — core, store (sqlite default, postgres for replicas), orchestrator and its bounded
three-layer recovery, OpenAI-compatible provider with session-immutable model slots, the loop seam,
memory, cron, hook plugins, endpoint/exec (KiandProto), the super-agent bundle, three harness
bridges, the wire-only SDK, the CLI and the macOS iMessage bridge. - Contracts — a 23-kind event model, a JSON-RPC + SSE API,
session inspect/replay/export, a
Prometheus/metricssurface, and a resumable read model. - Channels — Lark IM, GitHub (webhook + poll), WeChat iLink (QR login, best-effort) and iMessage
through a macOS bridge, with two-level admission filtering and untrusted-input marking. - Operational surface — durable confirmation (
permissions: ask), scheduled turns on a durable
slot cursor, hook plugins over a stdio ABI, agent memory (notes + dreaming), and multi-replica
safety. - An example — examples/issue-watch:
a resident Router triaging one repository's issues, in one editable config.
Getting started
Container, prebuilt archive, or source — the README has
one command for each. Then:
kian serve --config kian.yamlkian.yaml and the RPC calls that run a session end to end are in the
quickstart; every other capability has one runnable
snippet in docs/advanced.md.
Boundaries, stated up front
- A projection-only harness session persists no
step/request: durable control and audit, but no
byte-level model-request replay. - The BYOM command queue is at-least-once, not exactly-once; duplicate results dedupe on command id.
- No cross-worker failover: a binding is immutable, so moving to another machine means a new session.
- The WeChat channel is best-effort: iLink publishes no stable contract, and cross-downtime backfill
is unmeasured.
Licensed under Apache-2.0. Security reports:
SECURITY.md.
