Skip to main content

Module codec

Module codec 

Source
Expand description

The orchestration codecs (docs/ONTOLOGY.md §2.5, §3): a home folder ⇄ [Orchestration].

folder is our own flavor and the Hermes flavor of the same file layout (a profile folder IS a Hermes home); hermes writes a Hermes home back; openclaw compiles and decompiles an OpenClaw state directory. The decoders in decode are strict for O-records (unknown key = error) and residue-keeping for H-records, exactly as docs/ORCHESTRATOR-IR.md §1 rule 1 states; canonical is the snapshot every “unchanged” decision compares; sqlite opens stores read-only and writes fresh files.

Modules§

canonical
The canonical JSON every snapshot and “unchanged” decision compares: keys sorted at every depth, two-space pretty print, trailing newline — ir.mjs::canonicalJson. Sorting is explicit because serde_json’s own object order depends on a cargo feature another crate may enable.
decode
Strict decoders and canonical encoders for every record’s FILE form (ir.mjs). O-records refuse an unknown key by file and key; H-records keep what they do not model in residue.
dotenv
.env in a profile folder is the vault’s store: KEY=value, quotes stripped on read, JSON-quoted on write, sorted by key.
folder
The folder codec: a home folder ⇄ Orchestration. The root is the default profile; profiles/<name>/ are the named ones; a profile folder is a complete home (Hermes’s rule). Two flavors of the same layout:
hermes
A Hermes home written from the orchestration (hermes.mjs::toHermes). Tiers per file: byte for cron/jobs.json, cron/executions.db, webhook_subscriptions.json (inline secrets re-inlined from the vault), config.yaml when unchanged, every unmodeled file, and state.db when bindings/obligations are UNCHANGED since import (copied). A FRESH destination gets a store born at the fixture’s schema (22) carrying the bindings as sessions rows and the obligations as delivery_obligations rows — Hermes migrates it on open; the transcripts live in the worker’s store and are not carried (semantic). A LIVE destination store is never written: that first write into a shared WAL single-writer store is UNI-18’s, refused by name. state.db with changed rows is REFUSED: the Hermes session-store write path is behind UNI-22. Semantic for SOUL.mdAGENTS.md and a re-rendered config.yaml (the O-blocks ride as top-level keys — ORC-1 F5).
openclaw
The OpenClaw codec (openclaw.mjs): an OpenClaw state directory ⇄ the orchestration. agents.* become profiles — the default agent IS the default profile, every other agent keeps its id — each rooted at its own agents/<id>/. Channels, bindings and hooks are install-wide and land on default; jobs, fires and obligations land on the profile their agent id or session key names. openclaw.json is JSON5 (comments and trailing commas survive the read; a re-emit is JSON, which OpenClaw’s parser loads); state/openclaw.sqlite is the pinned v2026.7.1-2 schema, its rows written back column for column when their record is unchanged.
sqlite
SQLite primitives (sqlite.mjs): readers open read-only — the contract every supercode reader keeps over a live store — and writers create fresh files. Rows are read as JSON objects so the codecs see the same shapes the Node package saw.

Structs§

HermesReport
What a Hermes decompile did.
LoadError
A load refusal naming the file and the key (ir.mjs::LoadError).
LoadedHome
A loaded home.
OpenclawLoaded
A loaded OpenClaw state directory.
OpenclawReport
What an OpenClaw decompile did.
ProfileIo
Per-profile bookkeeping: what a decompile needs to reuse bytes and to know what “unchanged” means. Never part of the orchestration.
Refusal
A write the codec would not guess at.

Enums§

Flavor
Which harness’s layout a folder was read as.

Functions§

canonical_json
Stable, secret-free JSON of a value.
carry_unmodeled
Copy the named unmodeled files from src into dest, byte for byte, answering the relative paths carried. A file the source no longer holds is skipped: the list is what was seen at load, the copy is what is there now.
from_hermes
Load a Hermes home into the orchestration.
from_openclaw
Compile an OpenClaw state directory into the orchestration.
load_home
Load a home folder.
save_home
Save OUR folder. Never deletes a file it does not own; never writes a secret outside .env.
sort_keys
Every object’s keys sorted, at every depth.
to_hermes
Write a Hermes home. Byte-tier files whose records are unchanged since a Hermes import are copied from the import source; everything else is emitted canonically.
to_openclaw
Write an OpenClaw state directory from the orchestration.