CogDiod is an experimental cognitive architecture where each OpenCog AtomSpace Atom is an Inferno Dis VM isolate β a live, concurrent execution context β rather than a passive data record.
"The knowledge is the program. Each Atom is simultaneously a datum and a process."
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CogDiod Kernel β
β ββββββββββββ ββββββββββββ ββββββββββββ β
β βConceptNodeβ βImplicationβ βEvaluationβ ... β
β β Dis VM β β Dis VM β β Dis VM β β
β β isolate β β isolate β β isolate β β
β ββββββ¬ββββββ ββββββ¬ββββββ ββββββ¬ββββββ β
β β Limbo typed channels β β
β ββββββββββββββ¬ββββββββββββββββ β
β DisTyx / 9P β
β /ai/atoms/{uuid}/tv β
β /ai/atoms/{uuid}/sti β
β /ai/stats β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
CogDiod follows the same pattern as V8 Isolates (Node.js/Cloudflare Workers), ATen execution contexts (PyTorch), and Erlang processes β shared bytecode, isolated state:
| Runtime | Isolate Unit | Shared Resource | Protocol |
|---|---|---|---|
| Node.js / workerd | V8 Isolate | JS bytecode snapshots | HTTP / fetch |
| PyTorch | ATen context | CUDA/CPU kernels | Tensor dispatch |
| CogDiod | Dis VM Isolate | Limbo .dis bytecode |
9P / DisTyx |
Each Atom type (ConceptNode, ImplicationLink, etc.) is an Elbo .elm package β a Limbo bytecode module loaded once and instantiated per Atom. The Atom's execution frame, register state, and local value store are per-instance; the bytecode is shared.
cogdiod/ # Core C kernel
βββ include/
β βββ cogdiod.h # Core types: AtomIsolate, ElmPackage, CogDiodKernel
β βββ elm_types.h # Dis VM opcodes, ElmStubDef
β βββ distyx.h # DisTyx 9P protocol types
βββ src/
β βββ kernel/
β β βββ cogdiod_kernel.c # Kernel: spawn, link, set_tv, PLN deduction
β βββ p9/
β β βββ distyx.c # DisTyx: 9P filesystem over UNIX socket
β βββ elbo/
β βββ elm_loader.c # Elbo package loader and builder
βββ packages/
β βββ concept_node/ # ConceptNode .elm package
β βββ evaluation_link/ # EvaluationLink .elm package
β βββ implication_link/ # ImplicationLink .elm package
βββ tests/
βββ test_cogdiod.c # Integration test suite (22 assertions, all PASS)
cogdiod-lang/ # C bridge server for language integrations
βββ bridge/
βββ cogdiod_bridge.h
βββ cogdiod_bridge.c # UNIX socket JSON bridge
cogdiod-native/ # Five native language integrations
βββ maude/
β βββ cogdiod.maude # β
Native Maude source (reflective term rewriting)
β βββ run_maude.clj # Clojure executor (Maude semantics)
βββ perl/
β βββ cogdiod.pl # β
Native Perl 5.34 (context overloading + AUTOLOAD)
βββ racket/
β βββ cogdiod.rkt # β
Native Racket source (#lang elbo dialect tower)
β βββ cogdiod_hy.hy # Hy executor (Racket macro semantics)
βββ clojure/
β βββ cogdiod.clj # β
Native Clojure (defprotocol + persistent AtomSpace)
βββ guile/
βββ cogdiod.scm # β
Native Guile Scheme (first-class environments)
βββ cogdiod_hy.hy # Hy executor (Scheme environment semantics)
Maude's META-LEVEL module allows rules to rewrite other rules. In CogDiod, this means PLN inference rules can learn and rewrite themselves based on observed performance:
mod COGDIOD-META is
protecting COGDIOD-PLN .
--- Meta-rule: if deduction has been applied 5+ times with stable results,
--- boost the formula (learning as differential term rewriting)
crl [boost-deduction] :
rule(N, pln-deduction, K, TV) => rule(N, pln-boosted(1.15), K, TV)
if K >= 5 .
endm
Result: After 5 applications, pln-deduction β pln-boosted(1.15), lifting P(animal) from TV(0.760, 0.648) to TV(0.874, 0.648).
Perl's use overload and AUTOLOAD make every Atom context-polymorphic and open to runtime extension:
use overload
'""' => \&as_string, # "ConceptNode('cat') TV=(0.80,0.90)"
'0+' => \&as_number, # STI value (numeric context)
'@{}' => \&as_list, # linked atom UUIDs (array context)
'bool'=> \&as_bool; # strength > 0.5 (boolean context)
# ecan_spread was never defined β AUTOLOAD generates it from the name
$cat->ecan_spread(2.5); # works: STI 0.72 -> 3.22Racket's #lang system lets you define entire new languages as macro towers. CogDiod gets domain-specific cognitive languages with zero runtime overhead:
#lang elbo/temporal
; This is NOT a function call β it is a syntax transformation.
; (before A B c) compiles at read time to a bridge spawn call.
(before cat-eats animal-runs 0.75) ; => ImplicationLink TV=(0.750, 0.712)
(during cat-eats feeding-time 0.90) ; => EvaluationLink TV=(0.900, 0.810)Clojure's defprotocol / extend-protocol solves the Expression Problem for Atoms. Persistent data structures give episodic memory for free:
; Add Visualizable to AtomRecord WITHOUT modifying AtomRecord
(extend-protocol Visualizable
AtomRecord
(visualize [atom]
(let [bar (Math/round (* (:s (get-tv atom)) 20))]
(str (:type atom) " [" (apply str (repeat bar "β")) "] s=" (:s (get-tv atom))))))
; Episodic memory: every version costs O(log n), not O(n)
; v0 β v1 β v2 β v3 β all queryable, none mutatedGuile's first-class environments enable hypothetical reasoning without mutating the global AtomSpace:
; Hypothetical: "What if the cat is sick?"
(define child-env (make-child-env global-env '((sick . (TV 0.95 0.90)))))
(eval '(deduce "sick->vet" "sick") child-env)
; => TV(0.855, 0.689) β vs baseline TV(0.180, 0.306)
; Global AtomSpace is UNCHANGED
(lookup global-env "sick") ; => TV(0.200, 0.400) βCogDiod integrates with cogpy/llama.limbo, a pure-Limbo LLaMA inference engine, as the canonical local-LLM coprocessor for AtomSpace isolates. Atoms of type llm-coprocessor are bound to a Limbo Llama module instance and respond to MSG_LLM_INFER messages by streaming MSG_LLM_TOKEN replies.
Full GGUF support (F32 / F16 / BF16 / Q4_0 / Q4_1 / Q5_0 / Q5_1 / Q8_0 / Q8_1), GQA + KV cache + RoPE frequency scaling for LLaMA 3.1+, and the complete sampling suite (greedy, temperature, top-k, top-p, min-p, Mirostat v1+v2) are inherited from llama.limbo.
Two transport modes are supported automatically:
- In-process β when CogDiod runs under
emu, inference dispatches directly throughcogdiod_spawn()onto theappl/cogllama.bLimbo wrapper which importsllama.limbo's modules. Zero serialisation overhead. - Subprocess β when CogDiod runs natively on POSIX, the bridge forks
emu /dis/llama.dis -ifor each attached Atom and proxies prompts / tokens over a pipe pair.
9P namespace (DisTyx):
/ai/llm/<atom-uuid>/model W one-shot model path at attach
/ai/llm/<atom-uuid>/prompt W triggers inference
/ai/llm/<atom-uuid>/response R streaming token output
/ai/llm/<atom-uuid>/params RW JSON CogLlmParams (temp, top-k, etc.)
/ai/llm/<atom-uuid>/stats R tokens/sec, total tokens, model meta
See cogdiod-llama/README.md for the full integration contract, build instructions, and a quickstart.
CogDiod uses explicit extensions to avoid the historic .pl Perl/Prolog collision:
| Language | Extension | Role |
|---|---|---|
| Elbo (Limbo/Lisp) | .elm |
Dis VM bytecode packages (execution substrate) |
| Maude | .maude |
Meta-level rule rewriting |
| Perl | .pl |
Procedural glue, AUTOLOAD, system integration |
| Prolog | .pro |
Declarative knowledge, Horn clause pattern matching |
| Guile Scheme | .scm |
First-class environments, hypothetical reasoning |
| Racket | .rkt |
#lang dialect tower, compile-time macros |
| Clojure | .clj |
Persistent AtomSpace, protocols, STM |
Requires zig cc (or any C11 compiler) and pthreads:
cd cogdiod && make
./cogdiod_test # 22 assertions, all PASSFor language integrations:
cd cogdiod-native && bash run_all.shRequires: perl, clojure (Java 11+), hy (pip install hy).
See CogDiod_Formal_Specification.md for the complete type system, protocol definition, and lifecycle model.
MIT