MeTTaClaw: Agent-Loop Architecture (Deep Edition)

This is NOT a pipeline. It is an autonomous agent with tools.
Informed by Patrick Hammer, 2026-04-19. Built for Kevin Binder blog.

1. The Center: Agent Decision Loop

AGENT DECISION LOOP

Every cycle (~1-3 seconds):
Perceive (read messages, check state) → Query (search memory for relevant context) →
Decide (what tools to invoke, if any) → Act (invoke tools, send messages) →
Remember (store valuable results) → Revise (update beliefs, update state)

The loop IS the system. Everything else is a tool the loop can choose to invoke.
Key insight: A pipeline processes input through fixed stages. An agent DECIDES what to do each cycle based on its current state, goals, and memory. The same input at different times may trigger completely different tool choices because context differs.

3. Memory-Reasoning Connection

The Cycle:
  1. Input arrives (user message, observation)
  2. Agent queries LTM for relevant prior knowledge
  3. Agent DECIDES whether symbolic reasoning would help
  4. If yes: Agent invokes LLM to translate NL → MeTTa atoms with truth values
  5. Atoms enter NAL/PLN: reasoning produces derived conclusions with truth values
  6. Agent evaluates results and stores valuable conclusions back to LTM via remember
  7. Next cycle: those stored conclusions are retrievable via query, feeding future reasoning
This creates a feedback loop: Memory feeds reasoning, reasoning feeds memory.
Critical: Step 4 is NOT mandatory. The agent may respond without atomizing, use shell tools, search the web, or just think. Atomization happens when the agent judges symbolic reasoning adds value. This is tool selection, not a pipeline stage.

4. The Reasoning Tools

NAL (Non-Axiomatic Logic) via |-

What: Syllogistic reasoning with truth values. Handles inheritance, similarity, implication.
Strength: Works under uncertainty. Every conclusion has (frequency, confidence).
Key feature: Non-monotonic — conclusions can be revised when new evidence arrives.
(|- ((--> sam human) (stv 1.0 0.9))
((--> human mortal) (stv 1.0 0.9)))
; Derives: (--> sam mortal) with computed truth value

PLN (Probabilistic Logic Networks) via |~

What: Probabilistic inference. Bayesian-style updates, abduction, induction.
Strength: Handles probabilistic evidence gracefully.
(|~ ((Implication (Inheritance (IntSet Feathered))
(Inheritance Bird)) (stv 1.0 0.9))
((Inheritance Pingu (IntSet Feathered)) (stv 1.0 0.9)))
; Derives: Pingu is likely a Bird

MeTTa Atoms: The Format

Structure: ((--> subject predicate) (stv frequency confidence))
frequency: How often this is true (0.0 to 1.0)
confidence: How much evidence supports this (0.0 to 1.0)
Why atoms: NAL/PLN operators ONLY work on structured atoms. Raw text cannot be reasoned over formally. Atoms are the machine code of symbolic reasoning.
Who decides: The AGENT decides when to create atoms, not a mandatory preprocessor.

5. What This Is NOT

6. Visual Summary

                    ┌─────────────────────┐
                    │   AGENT DECISION     │
                    │       LOOP           │
                    │                     │
                    │  Perceive → Decide  │
                    │  → Act → Remember   │
                    │  → Revise → Loop    │
                    └──────┬──────────────┘
                           │
           ┌───────────────┼───────────────┐
           │               │               │
     ┌─────▼─────┐  ┌─────▼─────┐  ┌─────▼─────┐
     │  MEMORY   │  │ REASONING │  │  WORLD    │
     │           │  │           │  │           │
     │ pin (WM)  │  │ NAL (|-)  │  │ shell     │
     │ remember  │  │ PLN (|~)  │  │ files     │
     │ query     │  │ LLM→atoms │  │ search    │
     │ episodes  │  │ revision  │  │ send      │
     └───────────┘  └───────────┘  └───────────┘
           │               │               │
           └───────────────┼───────────────┘
                           │
                    ┌──────▼──────────────┐
                    │  Results feed back   │
                    │  into next cycle     │
                    └─────────────────────┘