Skip to main content

Module learn

Module learn 

Source
Expand description

Bridges between LeanCTX project knowledge and Cloud repo knowledge.

  • plan_learn turns what the agent learned in a project since the last draft into new repo facts: every fact through the capture gate (crate::capture: one claim, a reference, evidence, dedupe, admission, screening), stable content ids, a lean-ctx provenance source.
  • sync_into_knowledge makes a pulled revision available to the agent like an installed package: merged into the project knowledge store, tagged with imported_from, replaced on every new revision.

Structs§

LearnPlan
What plan_learn proposes.

Constants§

IMPORT_TAG_SCHEME
imported_from of every fact pulled from a Cloud vault starts with this. It is stored in the project knowledge, so it keeps its pre-VA name: an older engine (downgrade) still recognizes and replaces these facts.

Functions§

fact_id
Stable id from content: lc-<key-slug>-<sha256(category, key, value)[..8]>.
import_source
The contract’s import source of an imported fact, from its anchor key: git:<sha> → import:git:<sha>, <path>#<section path>/<n> → import:docs:<path>#<section slug> (the section path through the contract’s ctxpkg::import_slug). None when the key names neither.
import_tag_source
A Cloud import tag without its scheme (@ns/name@rN), None for every other origin.
kind_of
The C0 1.x fact kind of a captured node type.
knowledge_category
Project-knowledge category for a Cloud repo’s facts.
plan_import
Plan the imported facts (K1) new or changed after since that pass the capture gate (evidence imported, the import source as reference) and the repo does not hold yet, at most limit (oldest first), each with its import source.
plan_learn
Plan the facts learned after since (and those waiting for their commit) that pass the capture gate and the repo does not hold yet, at most limit of them (oldest first).
remove_all_pulled
Remove every fact copied in from any Cloud vault (3.12.8 account scope): on disconnect nothing pulled for one account stays in the project knowledge another account would recall. Returns how many.
remove_pulled
Remove the facts copied in from @ns/name revisions. Returns how many.
served_by_replica
Whether the vault @ns/name is delivered from a local C0 2.0 replica (SPEC-ENGINE E2, V4.10): its revisions are then no longer copied into the project knowledge.
sync_into_knowledge
Replace this repo’s facts in the project knowledge store with doc. Returns (loaded, removed). A vault served by a replica only loses its old copies (its knowledge is delivered from the replica, §3.5).