Skip to main content
Version: MVP

Local store

4 min readReferenceUpdated 2026-05-19

What you'll find here

The SQLite-backed local persistence layer — paths, stored records, migrations, secret-handling, receipt queries, and backup/cleanup practice.

Local SQLite is single-node state.

Useful for local and degraded operation. It is not Stigmem-equivalent shared memory — no federation, shared team truth, source attestation, or cross-node conflict resolution.

Paths

Variable
Default
Database path
Default
no override
~/.craik/state/craik.sqlite3
CRAIK_HOME
override
$CRAIK_HOME/state/craik.sqlite3

Stored records

The first migration stores supported v0.1.0 contracts as validated JSON payloads.

KindContract
adjudication_outcomescraik.adjudication_outcome
adapter_packagescraik.adapter_package
projectscraik.project_profile
run_outputscraik.run_output
taskscraik.task_request
task_runscraik.task_run
receiptscraik.capability_receipt
case_filescraik.case_file
contradictionscraik.contradiction_report
context_debt_recordscraik.context_debt_record
context_requestscraik.context_request
distilled_instruction_proposalscraik.distilled_instruction_proposal
handoffscraik.handoff
human_delegationscraik.human_delegation_point
instruction_promotion_reviewscraik.instruction_promotion_review
instruction_provenancecraik.instruction_provenance
instruction_sourcescraik.instruction_source
instruction_source_registriescraik.instruction_source_registry
instruction_source_snapshotscraik.instruction_source_snapshot
intent_lockscraik.intent_lock
knowledge_freshness_probescraik.knowledge_freshness_probe
known_trapscraik.known_trap
plugin_capability_grantscraik.plugin_capability_grant
plugin_descriptorscraik.plugin_descriptor
plugin_probationscraik.plugin_probation
plugin_receiptscraik.plugin_receipt
proposalscraik.memory_proposal
negative_knowledgecraik.negative_knowledge
promoted_instruction_constraintscraik.promoted_instruction_constraint
reference_integrationscraik.reference_integration
red_team_findingscraik.red_team_finding
recovery_sessionscraik.recovery_session
memory_diffscraik.memory_diff
memory_previewscraik.memory_impact_preview
assumptionscraik.assumption
evidencecraik.evidence_reference
evidence_coverage_scorescraik.evidence_coverage_score
exit_discipline_checkscraik.exit_discipline_check
gateway_configscraik.gateway_config
gateway_runtime_statescraik.gateway_runtime_state
graph_exportscraik.work_graph_export
graph_eventscraik.work_graph_event
handoff_quality_scorescraik.handoff_quality_score
worker_resultscraik.worker_result
review_requestscraik.review_request
review_resultscraik.review_result
run_deltascraik.run_delta
runtime_critic_findingscraik.runtime_critic_finding
scratchpad_recordscraik.scratchpad_record
tool_result_attestationscraik.tool_result_attestation
unknown_recordscraik.unknown_record
scope_change_requestscraik.scope_change_request
scope_change_resultscraik.scope_change_result
skill_invocation_contextscraik.skill_invocation_context
skill_packagescraik.skill_package
skill_registriescraik.skill_registry

Every stored payload is validated through the Pydantic contract registry before persistence and again when loaded.

Migrations

Craik tracks migration state through SQLite PRAGMA user_version and the migrations table. Migrations run through a registered, forward-only migration runner. Migration 2 adds local_store_metadata so diagnostics can distinguish the store schema version from the package version. Migration 3 records that the store was upgraded through the registered migration framework.

Deterministic

Migrations must be deterministic.

New kinds require tests + docs

Newer DB versions fail clearly

Corrupt DBs raise an error

Never silently recreated.

See Local store migrations for fixture compatibility and recovery guidance.

Secrets

No unredacted secrets persist.

Payloads are checked with the central redaction utility before persistence and rejected if they still appear to contain secret material.

Receipt queries

The receipt store builds on local SQLite persistence for craik.capability_receipt records.

All receipts

One receipt by id

Receipts by task id

Receipts linked to a policy envelope id

Receipts linked to a handoff id

Policy envelope, handoff, and runner links are read from receipt result metadata keys policy_envelope_id, handoff_ids, and runner_metadata.

Backup and cleanup

Back up the SQLite database while Craik is not running, or use SQLite backup tooling once long-running gateway mode exists.

For local cleanup, remove only rebuildable files under cache/. Do not delete state/craik.sqlite3, receipts/, handoffs/, or case-files/ unless you intentionally want to discard local continuity.

What's next