What every local-read/1 knowledge document must agree on — knowledge list, knowledge graph|related and the freshness listings (stale,
verify, dedupe, outdated, conflicts): one fact id per fact, one
read-noise rule, one timestamp format. All of them use these, never
their own copies (the CLI re-exports them as cli::knowledge_shared).
Freshness of a project’s knowledge: which facts are not current truth
anymore, and the primitives a weekly clean-up runs (lean-ctx knowledge stale | verify | dedupe | outdated | conflicts --json, contract
local-read/1).
Default cap on how many items a single restore call rehydrates, across all
requested stores. Generous enough to undo a normal reclaim, bounded so a
restore with no query cannot resurrect an unbounded archive in one shot.
Record the capture fields (Hive capture gate: type, steps,
commands, refs, evidence) a remember named on the fact it stored.
Shapes are checked here; whether the fact may leave is the gate’s
decision at capture time.
Explicit CLI / MCP consolidate: import the whole session, run the fact
lifecycle and losslessly reclaim every store. Thin wrapper over the canonical
consolidate_project_knowledge_with.
Canonical consolidation engine (#995 Phase 4). Every driver — CLI/MCP, the
scheduled post-dispatch pass (crate::core::consolidation_engine::consolidate_latest),
and startup auto-consolidate — funnels through here, parameterised by
ConsolidateOptions, so session import, fact keys, lifecycle and the
lossless per-store capacity reclaim behave identically. Session loads are
project-scoped (cwd bug #2362), and opts.dry_run previews without mutating
knowledge, archives or the session.
Exports the project’s current knowledge as an Open Knowledge Format (OKF)
bundle — a directory of Markdown files, portable and vendor-neutral. Renders
from the shared lean_ctx::core::knowledge::KnowledgeSnapshot, so it never
disagrees with a ctxpkg export on what the knowledge is. out is the target
directory (defaults to the data dir’s exports/okf/<hash>).
Restore archived items into the live stores. Facts/history/patterns share one
locked knowledge write. Archives of the retired procedure store stay on disk
untouched and are never restored.