Skip to content

TOOL Loop -- Executable Capability

Chapter 7 of the CKP v3.6 Specification -- Normative

Purpose

The TOOL loop is the capability organ of the Material Entity. It is the executable artifact the kernel brings to the world -- independently versioned, independently deployable, and completely agnostic about what form it takes. A tool can be a shell script, a web service, a frontend project, or a Wasm binary. The only contract is that it lives under tool/ and has its own git history.

The TOOL loop exists because identity and capability are separate concerns. A kernel's identity (what it IS) should not change when its implementation (what it DOES) is upgraded. By isolating the tool in its own volume, CKP enables independent versioning: a tool can be updated from v1 to v2 without altering the kernel's identity or invalidating its accumulated data.

In Description Logic terms, the TOOL loop is the approximate RBox. It contains the operational procedures that determine how the kernel acts on the world. The mapping is approximate because the TOOL loop holds executable code, not formal role axioms.

Tool Forms

The tool/ directory is a separately-mounted volume on the distributed filesystem with its own git history. The tool can be updated, branched, and versioned completely independently of the CK's identity files.

Tool FormWhat Lives in tool/Execution Context
Shell scriptrun.sh -- self-contained, may reference system binariesDirect shell execution; system PATH applies
Web serviceApp entry point, requirements, routers, modelsRuntime; runs as long-lived service process
Frontend projectEntry point, package manifest, components, public assetsRuntime; built and served or SSR'd
Compiled / WasmSource, build manifest -- compiled to .wasm artifactWasm runtime via Polyglot Matrix
System pointerpointer.json -- { "binary": "/usr/local/bin/ffmpeg" }System binary invoked directly; no compilation

TIP

The tool form is not declared in conceptkernel.yaml -- the platform discovers it by inspecting the tool/ directory contents. This keeps identity and capability decoupled.

The Tool-to-Storage Contract

The tool's only obligation toward the DATA loop is to write a conforming instance into storage/ when it produces an output. The instance MUST conform to the kernel's rules.shacl before the write is accepted. Everything else -- proof generation, ledger entry, index update -- is handled by the platform after the tool writes data.json.

json
{
  "instance_id":   "<short-tx>",
  "kernel_class":  "Finance.Employee",
  "kernel_id":     "7f3e-a1b2-c3d4-e5f6",
  "tool_ref":      "refs/heads/stable",
  "ck_ref":        "refs/heads/stable",
  "created_at":    "2026-03-14T10:00:00Z",
  "data": {
    "name": "Jane Doe",
    "department": "Engineering"
  }
}

Platform Post-Write Steps

The platform MUST execute the following steps after the tool writes data.json:

StepActionGuarantee
1Validate data.json against rules.shaclSHACL gate -- rejection blocks write
2Generate proof.json in the instance directoryProof record with hashes
3Append a ledger entry to storage/ledger/audit.jsonlAppend-only audit trail
4Update index files in storage/index/Queryable instance registry
5Commit to the DATA loop git repositoryVersion history preserved
6Publish ck.{guid}.data.written to NATSJetStream at_least_once guarantee

SHACL Validation Pipeline

SHACL validates RDF graphs. CKP instances are JSON files. The bridge operates as follows:

  1. Each kernel's ontology.yaml SHOULD define a JSON-LD @context mapping instance fields to RDF predicates.
  2. The platform converts data.json to RDF using the context before SHACL validation.
  3. If no @context is defined in ontology.yaml, the SHACL gate accepts (permissive stub mode -- current default).
  4. When @context is present, SHACL rejection blocks the write and the platform MUST publish ck.{guid}.data.shacl-rejected on NATS.

Current State

The SHACL validation pipeline is currently in permissive stub mode -- all writes are accepted. This is the default when ontology.yaml does not define a JSON-LD @context. Full SHACL enforcement activates when the @context is provided.

TOOL Loop NATS Topics

Conformant implementations MUST publish the following NATS topics for TOOL loop events. All topics use the pattern ck.{guid}.tool.*.

TopicWhen Published
ck.{guid}.tool.commitTOOL repo -- new commit (tool updated)
ck.{guid}.tool.ref-updateTool branch pointer moved
ck.{guid}.tool.promoteTool version promoted to stable
ck.{guid}.tool.invokedTool execution started
ck.{guid}.tool.completedTool execution finished successfully
ck.{guid}.tool.failedTool execution failed

Volume Driver Enforcement

The TOOL loop volume MUST be mounted ReadOnly at runtime. This is enforced at the infrastructure level by the volume driver, not by application logic. A conformant platform MUST configure the TOOL volume with readOnly: true (or the platform equivalent). The kernel runtime process MUST NOT be able to modify its own code.

VolumeWho WritesWhenReadOnly at Runtime
ck-{guid}-ckOperator, developer, CI pipelineDesign timetrue (except serving.json)
ck-{guid}-toolTool developer, CI pipelineDevelopment / releasetrue
ck-{guid}-storageKernel runtime exclusivelyExecution timefalse

DANGER

Violation of volume-level ReadOnly enforcement is a fatal conformance failure. The three-loop separation axiom requires that no runtime process can alter its own identity (CK) or code (TOOL). This is not a convention -- it is enforced by infrastructure.

Part II Conformance Criteria (TOOL Loop)

IDRequirementLevel
L-6TOOL volume MUST be mounted ReadOnly at runtimeCore
L-7Platform MUST execute all six post-write steps after tool writes data.jsonCore
L-8SHACL rejection MUST block writes and publish shacl-rejected eventCore

Released under the MIT License.