Skip to main content

Crate jishuken

Crate jishuken 

Source
Expand description

Jishuken: memory for agents with scheduled verification.

The store holds fact files and an append-only operation log. See the README for usage, design, and security boundaries.

Re-exports§

pub use error::Error;
pub use error::Result;

Modules§

calibration
Self-calibration. Every Confirmed/Refuted outcome logs a (prior, grounded_outcome) pair; the verification engine thereby produces the training signal to grade its own LLM triage. If the priors run hot, fit a 1-D Platt recalibration map and apply it to future ingests.
centrality
Sybil-resistant, trust-weighted centrality. Katz centrality where each node’s voting contribution is scaled by its own groundedness, so an ungrounded, freshly-ingested fact contributes nothing to importance until it clears its own verification. The control plane becomes robust to data-plane injection by construction.
config
ken.toml parsing. Lives in the store root.
decay
Staleness as covariance and the Kalman update.
duration
Positive durations with ISO 8601 and human-readable input.
engine
The control-plane engine: read a fact’s grounds, judge each with its pure predicate, and apply the resulting GroundCheck ops. Reading (File/Command/Generator) lives in ground::resolve; judging is a pure Predicate. This is the only caller of verify::authority in normal operation; the data plane (MCP) never reaches it.
error
ground
Ground sources: the typed reference (source + locator) a fact is checked against, and the resolver that reduces it to a hashed span. The verifier judges that span; the locator addresses it.
predicate
The judge: a pure, deterministic, capability-free predicate over a resolved span. A predicate cannot rot (same span -> same verdict), so a refute is unambiguous: the span moved. All non-determinism lives in the source layer (reading), never here.
scheduler
The proactive, value-of-information scheduler. Rank facts by the expected value of checking them, spend a fixed budget per tick on the top-k, and keep a small exploration floor so a confidently-wrong belief cannot sit undisturbed forever.
schema
Fact schema. Normalized join keys, denormalized payload.
sketch
A compact, mergeable t-digest (the DataSketches / Circllhist idea). Used to turn a generator’s static cost_estimate into a measured quantile of its observed run times. Mergeability is the point: a digest pools across every fact that shares a generator, the same way a sketch merges across shards.
store
Fact files and operation history. A fact is a file at facts/<entity>/<relation>.json, so the store greps and diffs like code. Every WriteOp lands as one tagged record in an append-only op log (ops.jsonl) that ken owns: the log is the audit, the fact files are the working state, and undo replays a record’s saved bytes in reverse. Writes serialize behind a store lock; single-writer is the supported posture.
verify
The control-plane write authority. Holds the authority token: the only place privileged WriteOps can be minted. Judging is now a pure predicate (crate::predicate) and reading lives in crate::ground, so this module is just the compile-time boundary.
write
Write authority. Every mutation is one WriteOp and becomes one op-log record, tagged in the description so the invariant is auditable.