clm:
abstract_spec:
context: >
Type Definition — Process Contract. This document defines the standardized interface that every CLM's concrete_impl.process section must conform to for language-agnostic execution.
goal: >
Establish a formal contract so that porting the kernel to a new language requires implementing exactly ONE function (the runtime adapter) rather than rewriting the entire dispatch infrastructure.
success_criteria:
- "Every CLM's process section declares type and entry_point."
- "The contract is language-neutral — same interface for shell, python, node."
- "New language support requires only adding an _adapter_<lang> function."
concrete_impl:
runtime: system
operation: process_contract_type
universe_level: 1
process:
type: shell
script: |
process_contract_type() {
cat <<'CONTRACT'
================================================================
PROCESS CONTRACT — Language-Agnostic CLM Execution Interface
================================================================
Every CLM's concrete_impl.process section MUST declare:
process:
type: <runtime> # REQUIRED: shell | python | node | llm | go | rust | compose | meta_evaluate | polyglot | open_interpreter
entry_point: <name> # OPTIONAL: defaults to concrete_impl.operation
max_turns: <turns> # OPTIONAL for llm: maximum reasoning turns (default: 5)
script: | # REQUIRED for shell; OPTIONAL for python/node/llm/go/rust
...
implementations: <map> # OPTIONAL: per-runtime implementations map (structural preview only in 97.1)
-- RUNTIME TYPES ----------------------------------------------
shell → _adapter_shell (eval + subshell)
python → _adapter_python (delegates to pyCubed.py / inline python)
node → _adapter_node (delegates to jsCubed / inline node)
javascript → _adapter_node (alias)
llm → _adapter_llm (local Ollama agent runner)
open_interpreter → evaluate_open_interpreter (Open Interpreter sandbox adapter)
go → _adapter_go (on-the-fly Go compilation + sandbox)
rust → _adapter_rust (on-the-fly Rust compilation + sandbox)
compose → compose_functions (PCard composition)
meta_evaluate → main (recursive self-invocation)
-- ADAPTER CONTRACT -------------------------------------------
Each adapter receives three arguments:
_adapter_<lang> <clm_file> <entry_point> <payload>
clm_file — path to the CLM YAML (for introspection)
entry_point — function/callable name to invoke
payload — optional argument (file path, data, etc.)
The adapter MUST:
1. Load/compile the script from the CLM YAML
2. Invoke the entry_point with the payload
3. Return the exit code (0 = success)
4. Write to stdout (data) and stderr (diagnostics)
-- ENVIRONMENT VARIABLES --------------------------------------
Available to ALL adapters regardless of language:
CLM_ROOT — absolute path to clm/ directory
PROJECT_ROOT — absolute path to MCard_TDD/ directory
TARGET_FILE — the payload file (legacy compat)
CLM_PAYLOAD — the payload argument
CLM_ENTRY_POINT — the entry_point name (for python/node)
-- PORTING GUIDE ----------------------------------------------
To add support for a new language (e.g., Rust):
1. Create a runtime adapter script:
scripts/rsCubed (reads CLM YAML, invokes entry_point)
2. Add the adapter function to process_dispatch.yaml:
_adapter_rust() {
local clm_file="$1" entry_point="$2" payload="${3:-}"
export CLM_ENTRY_POINT="$entry_point"
"$PROJECT_ROOT/scripts/rsCubed" "$clm_file" "$payload"
}
export -f _adapter_rust
3. Add the case to invoke_process() in process_dispatch.yaml:
rust)
_adapter_rust "$clm_file" "$entry_point" "$payload"
;;
4. Write your CLM with process.type: rust:
process:
type: rust
entry_point: my_function
script: |
fn my_function(payload: &str) { ... }
================================================================
CONTRACT
}
precondition:
vcard_pre: gate:payload_nonempty
postcondition:
vcard_post: gate:result_sealed
balanced_exp:
expectation: "This type definition documents the Process Contract for all runtimes."
_meta:
clm_root_hash: sha256:ca16c8fefbfb5027c77188d9bfc43601bf9b608836d76933bd79476b8eb5fc81
a_hash: sha256:1689d19a435ff1944d9c43ce09b05113aab25d55cc4d5610463bcb8d3b9db593
c_hash: sha256:379f0b0a4d30d02ccd05f44a5132e50e0b0205de00f2229f0a0d61a685e523ef
b_hash: sha256:9130cefd2045722596a481c658e33c5ec26920984493c38c19fb3a91ba31461d
clm_name: process_contract_type
computed_at: "2026-07-13T02:41:54Z"
depends_on: []