Skip to main content

Module cml_context

Module cml_context 

Source
Expand description

CML context loop — chat logs carry Context Markup that binds topic-related semantics into the person’s inforg (their private hypermedia library), which is then reused, permissively, to improve the context given to the local agent.

CML (Timothy C. Holborn’s Context Markup Language — a working draft) treats a concept as a context hash: q_hash(concept) addresses the concept’s sub-graph. Here a person marks context inline in a message — #project:tax-2026 #task:file-return #topic:deductions [[capital gains]] — and each tag becomes a cml:Proposed concept stored alongside the turn in the inforg. A later turn that shares those concepts pulls the earlier context back in. Multi-part by construction: one message may carry a general concept, a project, a topic, and a task at once.

v1 substrate: the concept identity is the hypermedia store’s fnv60(label) edge object (so a search for the label matches). The fuller cml.n3 IRI-hash concept graph compiled into .q42 for the graph retrieval path is the next increment; this loop already works end-to-end over the inforg. Reuse is permission-gated: guardian-flagged (sensitive) entries are never auto-injected.

Structs§

ContextTag
One context tag parsed from a message: a cml:Proposed concept at a tier.

Enums§

ConceptTier
The CML concept tiers a chat message may carry (multi-part).

Functions§

ingest_turn
Store a chat turn’s CML context into the inforg — only when the message carries explicit tags (deliberate, permissive). The turn’s text + its concept facets become a searchable library entry. Returns the concepts stored (empty if the message had no tags).
parse_cml_tags
Parse inline CML from a message. Recognises #project:label, #task:label, #topic:label, #pursuit:label, #general:label, bare #hashtag (→ topic), and [[general concept]] (may contain spaces). Underscores in a #key:value label become spaces. Duplicates (same tier + label) removed.
retrieve_context
Retrieve inforg context relevant to prompt and format it as a prompt block (empty if nothing). Matches the prompt’s explicit tags first (reliable), then a few salient terms (best-effort), over the person’s library. Permission-gated (flagged entries excluded).