File size: 7,573 Bytes
a6a5d8e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# Release Notes — r0513

## The Engine That Won't Stop Learning

**Package:** `a11oy 0.1.0+r0513`  
**Author:** Stephen P. Lutar Jr. <stephen@szlholdings.com>  
**ORCID:** 0009-0001-0110-4173  
**Org:** SZL Holdings  
**Doctrine:** v2  
**Date:** 2026-05-14  
**License:** Apache-2.0

---

## Architecture Overview

r0513 completes the Brain v1 build by adding the inner-agent society to the Ouroboros Infinity loop. The full pipeline is:

```
Goal
 │
 ▼
A11oyAgent.think()
 ├─ Quipu Plan (DAG of steps)
 ├─ Execute steps → RAGReceipt per step
 ├─ Evalgate: 9-axis conjunctive AND gate
 ├─ BiettiMemory: goal → trace summary
 ├─ Observatory: drift detection
 └─ CodexSession → CodexClosure (Merkle root)
 │
 ▼
LoopController.meditate_n_cycles()
 ├─ CycleHead: current_head seeds each cycle
 ├─ Thesis corpus rotation: F1–F15 SZL formulas
 ├─ tick() → CycleTail(tail_hash, receipt, eval_result)
 └─ tail_hash → next current_head (Ouroboros fold)
 │
 ▼
Society.tick_all()  ─── 7 inner agents in fixed order ───►
 ├─ Perceiver (FEP — surprise minimization)
 ├─ Predictor (world-model prefix forecasting)
 ├─ Proposer (ReAct/Reflexion template proposals)
 ├─ Critic (Constitutional AI axis calibration)
 ├─ Rememberer (Park memory stream)
 ├─ Dreamer (DreamerV3 offline planning)
 └─ Arbiter (Minsky Society of Mind weighted selection)
 │
 ▼
Society.learn_all(gate_outcome)  ─── per-agent state update ───►
```

Every crossing of the evalgate gate calls `learn()` on all 7 agents.  
The loop invariant is `"but never stop"`.

---

## 7 Inner-Agent Roles and Scientific Basis

| Agent      | Leader Citation                         | tick() function               | learn() update                         |
|------------|------------------------------------------|-------------------------------|----------------------------------------|
| Perceiver  | Friston, *Free Energy Principle* (2010)  | Surprise = edit distance to last_head | Running mean surprise (EMA) |
| Predictor  | Karpathy / Sutskever                     | Prefix match forecast         | Residual MAE accumulation              |
| Proposer   | Yao & Shinn, *ReAct/Reflexion* (2023)    | Template-keyed proposals      | Pass/fail count per template key       |
| Critic     | Bai et al., *Constitutional AI* (2022)   | Per-axis score prediction     | Per-axis calibration error (running MAE)|
| Rememberer | Park et al., *Generative Agents* (2023)  | SHA-256 key memory lookup     | Recency + frequency weight update      |
| Dreamer    | Hafner et al., *DreamerV3* (2023)        | Dream score vs reality delta  | Dream–reality residual MAE             |
| Arbiter    | Minsky, *Society of Mind* (1986)         | Weighted selection of winner  | +1 on winner, -1 on losers             |

All agents implement:
- `tick(loop_state: LoopState) -> AgentReport`
- `learn(report: AgentReport, gate_outcome: GateOutcome) -> None`

All `learn()` updates are:
- **Deterministic:** seeded from `sha256_text(loop_state.current_head + salt)`
- **Idempotent w.r.t. replay:** same input → same state delta
- **JSON-serializable:** `get_state()` / `load_state()` round-trip

---

## New Module: inner_agents.py

`src/a11oy/inner_agents.py` — 916 lines, Apache-2.0, r0513.

Exports:
- `InnerAgent` (ABC with `tick` + `learn` + state I/O)
- `Perceiver`, `Predictor`, `Proposer`, `Critic`, `Rememberer`, `Dreamer`, `Arbiter`
- `Society` (`tick_all`, `learn_all`, `snapshot`, `snapshot_hash`, `to_json`, `from_json`)
- `AgentReport`, `GateOutcome`, `SocietyReport`

---

## Full Test Suite

```bash
$ pytest --tb=short -q 2>&1 | tail -2
243 passed in 3.22s
```

**243 tests — all passing.** Zero skips, zero failures.

### r0513 additions: test_inner_agents.py — 33 tests

Key coverage:
- All 7 agents tick without error
- All 7 agents learn without error
- tick() output is an `AgentReport` with correct role
- learn() mutates agent state deterministically
- Society.tick_all() runs all 7 agents in fixed order
- Society.learn_all() propagates gate_outcome to all agents
- Society.snapshot() returns JSON-serializable dict
- Society.snapshot_hash() is deterministic
- Society.to_json() / from_json() round-trip
- 5× replay: Society.tick_all()+learn_all() is byte-identical with frozen time

---

## Code Quality

```bash
$ ruff check src/ tests/
All checks passed!

$ mypy --strict src/
Success: no issues found in 20 source files
```

- **ruff:** clean (E, F, W, I, UP, B, C4, SIM; E501 ignored)
- **mypy --strict:** clean across all 20 source files

---

## Determinism Certification

### v0 baseline (preserved)

```
$ for i in 1..5: SZL_FROZEN_TIME=2026-05-14T10:00:00Z python examples/hello_brain.py | sha256sum
a8603d5de9f3c97d94d13b5e394424c2e18f1be352f98b097f43eee5947d90a0
a8603d5de9f3c97d94d13b5e394424c2e18f1be352f98b097f43eee5947d90a0
a8603d5de9f3c97d94d13b5e394424c2e18f1be352f98b097f43eee5947d90a0
a8603d5de9f3c97d94d13b5e394424c2e18f1be352f98b097f43eee5947d90a0
a8603d5de9f3c97d94d13b5e394424c2e18f1be352f98b097f43eee5947d90a0
```

v0 hash `a8603d5de9f3c97d94d13b5e394424c2e18f1be352f98b097f43eee5947d90a0` — **unchanged.**

### v1 + r0513 (agi_brain.py)

```
$ for i in 1..5: SZL_FROZEN_TIME=2026-05-14T10:00:00Z python examples/agi_brain.py | sha256sum
bbf72d4ab5b3eddb18d889b67426636107d816101948e989fa168074bc126e8c
bbf72d4ab5b3eddb18d889b67426636107d816101948e989fa168074bc126e8c
bbf72d4ab5b3eddb18d889b67426636107d816101948e989fa168074bc126e8c
bbf72d4ab5b3eddb18d889b67426636107d816101948e989fa168074bc126e8c
bbf72d4ab5b3eddb18d889b67426636107d816101948e989fa168074bc126e8c
```

v1 hash `bbf72d4ab5b3eddb18d889b67426636107d816101948e989fa168074bc126e8c` — **5× identical.**

---

## Cryptographic Receipt

**v1_codex_root** (SHA-256 Merkle chain over all 20 `src/a11oy/*.py`):  
`eab2a8c4b0059de48ca8e613c84da994a45bf3f1f61e78949ecc059c42ac8c0c`

**r0513_continuum_hash** (`sha256(v1_codex_root + "r0513")`):  
`46812870ce59251d8ea8e5494702aef05a3fedd061e182ee87a40dca238b867f`

---

## What r0513 Is NOT

- **Not ML training.** No weights updated. MockCortex only.
- **Not AGI.** See `AGI_HORIZON.md` for the honest 9-gap analysis.
- **Not production-ready.** No real LLM connected. No real tool use.

What it IS: a verifiable, auditable, doctrine-enforced cognitive scaffold that runs forever and learns from every crossing.

---

## Deferred to v2

- **Precision-weighted prediction-error gate (Neuroscience pod):** Noted in `Critic` docstring. Requires gradient infrastructure. Risk too high for v1.
- **Goedel-Prover-V2:** 12 sorry holes in `EvalGate.lean` (BLOCKER C1). Closes in next pod.

---

## File Manifest (new in r0513)

| File                              | Lines | Description                           |
|-----------------------------------|------:|---------------------------------------|
| `src/a11oy/inner_agents.py`       |   916 | 7 inner agents + Society              |
| `tests/test_inner_agents.py`      |   500 | 33 tests for inner_agents             |
| `examples/agi_brain.py`           |    82 | End-to-end demo: agent + loop + society|
| `BRAIN_V1_REPORT.md`              |   255 | Full verified build report            |
| `AGI_HORIZON.md`                  |   166 | Honest AGI gap analysis               |
| `BRAIN_V0_5_REPORT.md`            |   148 | Infinity loop addition report         |
| `RELEASE_NOTES_r0513.md`          | (this)| Release notes                         |

---

*r0513 — The Engine That Won't Stop Learning.*