Skip to main content

Module ctxpkg

Module ctxpkg 

Source
Expand description

The ctxpkg object mapping (C0 1.9, section 7; plan O1).

Knowledge maps onto content-addressed objects like a git repository: a fact is a blob, a page and a revision’s whole document are trees, a revision is a commit, a proposal is a pull request, Hive is a remote and the engine a client. The open ctxpkg spec (O1) builds on these ids; every implementation reproduces ctxpkg.vectors.json.

Every id is sha256: + hex of canonical_json of a typed object:

  • blob: {"type":"fact","fact":<FactV1>} (credits included);
  • page tree: {"type":"page","id","title","items":[{"kind":"fact","blob":<id>}|{"kind":"prose","text"}]};
  • document tree: {"type":"tree","format","facts":[blob ids sorted], "relations":[…sorted by (from,to,type)],"open_gaps":[…sorted],"pages":[page tree ids sorted]};
  • commit: {"type":"commit","revision","tree","parent":<commit id>|null, "merged_proposals":[…ascending],"rolls_back":<n>|null}.

Order inside the document does not change the tree: two documents with the same facts, relations, gaps and pages share it.

Export: an engine renders AGENTS.md from the released document locally; nothing about it is on the wire. Import (origin: import, section 5 addendum) names its sources with import_slug headings.

Functions§

document_tree_id
fact_blob_id
import_slug
Slug of a Markdown heading for import sources and page ids: lowercase ASCII letters and digits kept, every other run of characters one -, no leading or trailing -, at most 64 characters (cut at a - when possible); section when nothing is left.
page_tree_id
revision_commit_id
The commit of revision; parent is the previous revision’s commit (none for revision 1).