kronicle-lite

v0.10.2
io.github.rafe-walker/kronicle-lite Checked 7 hours ago Published 22 days ago

Hash-chained local document store with signed receipts and an orient protocol for stale agent memory

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

get_system_state Orient against the chain

Orient. Call at session start and before writes with your last cursor as since_cursor. Returns what changed since (delta), a drift banner, and retractions: things you relied on that changed, with old → new text. Reconcile retractions before acting. A bad or missing cursor never fails. focus: orientation (default) | recent_changes | retractions | pulse (head + banner only). Carry the returned cursor forward.

ParameterTypeDescription
actor_idstringYour agent id (default: server --actor). Cursors are bound to it.
all_projectsbooleanInclude other projects' documents and retractions.
budget_tokensinteger
focusstring
include_cosmeticbooleanDeprecated alias of include_format_only.
include_format_onlybooleanAlso list format-only edits (identical raw text up to whitespace and reflow) as retractions.
response_formatstring
since_cursorstringcursor or cursor_compact from your last call

audit_assumptions Grade beliefs against the chain

Grade facts before acting on them. claims: [{symbol, value}]; symbol is a block id (value: content or content_hash), a document slug (value: revision, markdown hash or markdown) or "head" (value: seq or hash). Verdict per claim: current | stale | contradicted | retracted | unknown | stale_source, with the current truth.

ParameterTypeDescription
claims *array

recall Search blocks with signed receipts

Full-text search over live blocks. Each hit carries a signed receipt (pass it to verify() before relying on it later) and authority: can_act | inspect_only | never_act with a reason; only can_act is safe to act on unchecked. absence says what was and was not searched: an empty result is not proof of absence unless verdict is absent_in_searched. Pass cursor: hits you already read this session rank lower.

ParameterTypeDescription
query *string
actor_idstringYour agent id (default: server --actor). Cursors are bound to it.
all_projectsbooleanSearch other projects' documents too.
cursorstringYour latest cursor (for the stale-write advisory).
include_receiptsboolean
include_tombstonedboolean
max_charsintegerContent budget; longer hits are cut with a pointer.
receiptsstringid: receipt_id per hit (verify takes it); inline: the signed receipt.
top_kinteger

verify Verify retrieval receipts

Re-check recall() receipts (receipt / receipt_id, or up to 100 as receipts / receipt_ids) against the store (signature, re-hashed block text, chain position, supersession): VERIFIED | SUPERSEDED (see current_block_id) | TOMBSTONED | STALE_SOURCE | UNVERIFIED, with a reason. Fail-closed: with a batch, the top-level result is the first one not VERIFIED and results[] has each in input order.

ParameterTypeDescription
receiptobjectThe receipt object from recall().
receipt_idstringOr the receipt_id from recall().
receipt_idsarrayBatch: receipt ids.
receiptsarrayBatch: receipt objects.

verify_chain Verify chain integrity

Recompute every event hash and link in [from_seq, to_seq] and check stored checkpoints. Over the whole chain (the default) it also re-derives and re-hashes every stored document and block (projection). ok:false means the database was edited outside kronicle-lite or is corrupt.

ParameterTypeDescription
from_seqinteger
to_seqinteger

checkpoint_chain Sign a Merkle checkpoint

Sign and store a Merkle root over event hashes in [from_seq, to_seq] (default: all). push:true also anchors it off-box (root, range, signature and public key leave the machine; the local checkpoint is kept either way).

ParameterTypeDescription
from_seqinteger
pushboolean
to_seqinteger

anchor_status Hosted anchor status

Last off-box anchor and whether the local chain still matches it: match | diverged (rewritten after anchoring) | beyond_head | gap | unverified (receipt not trusted). remote:true also asks the anchor service.

ParameterTypeDescription
remoteboolean

put_document Create or replace a document

Create or re-put a Markdown document by slug. Unchanged blocks keep their ids; changed blocks are superseded and removed ones tombstoned, which other agents see as retractions. bind_git with source_path ties the document to that file's git blob (verify reports STALE_SOURCE when the file changes). Refuses text holding a secret (API key, token, private key, connection string): the chain cannot forget it.

ParameterTypeDescription
markdown *string
slug *stringname or namespace/Path (finding/G-2); max 128
title *string
actor_idstringYour agent id (default: server --actor). Cursors are bound to it.
bind_gitboolean
cursorstringYour latest cursor (for the stale-write advisory).
derived_fromarrayBlocks (from recall) this text was derived from; when one changes, this note is marked stale. Inferred from your reads when omitted.
idempotency_keystring
redact_secretsbooleanStore a redacted copy instead of refusing a detected secret.
source_pathstringFile the markdown came from.

supersede_block Replace one block

Replace one live block's content, with a reason. Receipts for the old block then verify as SUPERSEDED.

ParameterTypeDescription
block_id *string
new_content *string
reason *string
actor_idstringYour agent id (default: server --actor). Cursors are bound to it.
cursorstringYour latest cursor (for the stale-write advisory).
derived_fromarrayBlocks (from recall) this text was derived from; when one changes, this note is marked stale. Inferred from your reads when omitted.
redact_secretsbooleanStore a redacted copy instead of refusing a detected secret.

tombstone_block Retire one block

Retire one live block with a reason (no successor). Receipts for it then verify as TOMBSTONED.

ParameterTypeDescription
block_id *string
reason *string
actor_idstringYour agent id (default: server --actor). Cursors are bound to it.
cursorstringYour latest cursor (for the stale-write advisory).

apply Apply a batch of writes transactionally

Up to 50 put / supersede / tombstone ops in ONE local transaction. mode all_or_nothing (default; any failure rolls back everything) | best_effort. dry_run: exact per-op diffs, nothing written, plus a single-use confirm_token bound to this plan, actor and the previewed versions; commit with it to reject a plan whose state changed. expect_version per op; idempotency_key replays the committed result.

ParameterTypeDescription
ops *array
actor_idstringYour agent id (default: server --actor). Cursors are bound to it.
confirm_tokenstring
dry_runboolean
idempotency_keystring
modestring
ttl_secondsintegerconfirm_token lifetime (default 300)

audit_record Record audit events

Append MCP-audit evidence to the chain, all or nothing (≤ 500 per call). kind: catalog_snapshot | call_measured | finding | gate_result | fix_applied | regression_result; payload per kind (kronicle://schemas/audit). Hashes and blob refs only: artifacts go to the blob store (CLI audit put-blob). event_key is the stable id: a retry is a no-op, a different payload under it is refused.

ParameterTypeDescription
audit_id *string
events *array
actor_idstringYour agent id (default: server --actor). Cursors are bound to it.

audit_query Query audit events and findings

Audit events by audit_id and/or catalog fingerprint (optional kind, finding_id, after_seq, limit), ascending seq; with audit_id, also the current state of each finding (discovered | refuted | reopened | accepted).

ParameterTypeDescription
after_seqinteger
audit_idstring
finding_idstring
fingerprintstring
kindstring
limitinteger