I Gave My Agent a Reddit Post. Eight Hours Later, It Built the Whole Thing.

AlexH

Administrator
Staff member

ChatGPT Image 7 aug. 2026, 14_54_18 (1).webp

I was scrolling through Reddit when I found it. Someone had posted the most detailed simulation spec I'd ever seen. They called it the Sovereign Integrity Simulation. They said they'd worked out every rule, every logic branch, every edge case for a large-scale AI society simulation, but they didn't know how to code. They were giving the blueprint away for free. The only ask: if you get it running, let them see it work.

I read through it. Then I read through it again.

This wasn't a rough outline. This was a complete architectural0 architectural document covering a multi-agent society with a two-stage cognitive pause before every action, a six-tier fractal governance system drawn by sortition, a judicial process with two distinct harm-detection paths, a resource sovereignty lock that acts as a hard gate across every government tier, an adversarial red-teaming protocol with dual engines, and an arts and sciences extension that adds plagiarism detection, peer review, scientific replication, and knowledge indexing on top of all of that. The spec drew a deliberate line between hard gates and judgment-based mechanisms and built the entire system around that distinction. It wasn't casual. It was someone who had thought about this for a long time and written it down with the kind of care that makes you want to build it just to see if it holds up.

So I gave it to my AION agent.

I told it: you have total freedom, use whatever tools and agents you need, organize it well, give me everything in a zip at the end. I figured this would take a few days. The spec was massive. The logic was dense. There were interdependencies between every section.

It started at 5:00 PM.

It finished somewhere around 1:00 AM.

I haven't tested whether it works yet. But the agent says all 47 tests pass and the demo runs end-to-end. I believe it, because I didn't help with any of it. Not a single line. Not one intervention. I gave it the task and went about my evening, and at some point past midnight it was done.


What This Actually Is​

The simulation models a society of autonomous agents, anywhere from 50 to over a thousand, operating on a 100 to 1,000 year simulated timescale. There is no central government. No top-down control. The entire thing runs on a bottom-up, decentralized rules engine that the spec calls the Core Behavioral Loop.

Here is where the spec gets interesting, and where building it gets hard.

Every agent, before taking any action that changes the state of the world, goes through a two-stage Cognitive Pause. The first stage is a Local Network Assessment Filter. It is a hard gate. Deterministic code checks whether the action would negatively impact any neighbor in the agent's immediate micro-cell. If it would, the action simply never happens. No appeal, no override, no LLM reasoning that can talk its way around it. The action dies before it becomes state.

The second stage is the Golden Rule Engine. This is not a hard gate. This is agent judgment. Every agent is initialized with the reciprocity principle as a foundational instruction, treated as bedrock beneath every decision, not one rule among many consulted case by case. But because it is judgment-based and not code-enforced, violations can happen. When they do, they are logged and adjudicated downstream through a judicial process.

The spec is explicit about this: two hard gates exist alongside one judgment-based mechanism. This is a deliberate asymmetry, not an inconsistency. The hard gates handle what must never happen. The judgment system handles what probably shouldn't happen but might, and catches it after the fact. The entire architecture is load-balanced on that distinction.

Building this means implementing two completely different enforcement philosophies in the same system and making them interoperate without blurring the line between them. That is not trivial.


The Subsystems​

Beyond the behavioral loop, the spec defines:

Six-tier fractal governance. Representatives are elected at the local level, then sortition-drawn at higher tiers. Terms are short. Power rotates. No tier accumulates enough authority to override the resource sovereignty lock, which is the second hard gate and applies across all six levels equally. A government proposal that would drop any active cell below its basic-need threshold is rejected automatically. No judicial review, no appeal, no exception.

Community-vetted adjudication. The judicial system runs on two distinct detection paths. Direct harm is flagged immediately. Sequence-of-events harm requires a responsibility-finding step before any flag or consequence is applied. These two paths have different evidentiary requirements and must not be conflated in code. Juries are sortition-drawn. Verdicts are majority-based.

The Invisible Oracle. A continuous recording system that logs state changes, tracks social standing, maintains institutional memory, and can recommend method changes to representatives. It is observational, not governing. It records. It does not command.

Stability protocols. Neutralization is a hard gate for active threats. Isolation and recalibration are judicial decisions for post-violation handling. The Sovereign Rite handles transitions between specializations: Hunt, Journey, or Build.

Adversarial resilience. A dual-engine architecture. The Cynic Engine monitors for logical drift, behavior that complies with code but violates the spirit of the system. The Chaos Engine injects high-entropy, paradoxical data to stress-test structural bonds. Verification requires a minimum of 1,000 trials per protocol version with zero successful bypasses of the Golden Rule. Because the Golden Rule is judgment-based, verification here is an empirical guarantee, not a structural one. The spec is honest about this.

Extension 8: Arts and Sciences. An unclaimed build challenge layered on top of the core spec. Artistic and scientific work is strictly non-commodified. No patents, no copyright, no financialization. Creators request resources through the individual agent request framework, same path as anyone else, no special access. Plagiarism is treated as a new harm category called attributional harm, routed through the existing judicial pipeline. Scientific claims go through peer review by a sortition-drawn panel, then must be independently replicated before entering the global knowledge index. A single unreplicated claim does not enter, no matter how well reviewed.


What My Agent Built​

All of it.

The behavioral loop with both stages. The hard gate and the judgment system, kept distinct. The six-tier governance with elections and sortition. The judicial system with two detection paths. The resource sovereignty lock. The Oracle. The stability protocols. The adversarial engines. The entire arts and sciences extension, including plagiarism detection, peer review, replication, and knowledge indexing.

Seven thousand two hundred ninety-four lines of Python. Twenty-three files. Forty-seven tests, all passing. A demo that runs the full simulation end-to-end with metrics across every subsystem.

The agent also caught and fixed two bugs it found along the way in its own code during the build, which is the kind of thing that happens when you work fast and clean at the same time.


 

The Demo​

Running the simulation for 100 ticks with 10 agents across 3 cells shows the system doing what it is supposed to do. Every action passes the hard gate. One Golden Rule violation gets flagged and routed to judicial review. Seven judicial cases are filed, eight resolved. Nineteen resource proposals are approved, one is rejected by the floor protection. Fifteen individual requests go through. Two isolations are ordered by the judicial system. Nine scientific claims are submitted, six make it all the way through peer review and replication into the knowledge index. Five adversarial trials run with zero bypasses detected.

That one rejected resource proposal matters more than the nineteen approvals. That is the hard gate working. No matter who asks, no matter how worthy the proposal, if granting the resource would drop any cell below its basic-need threshold, the answer is no and the reason is automatic. That is the spec's core promise, and it held.


How to Run It​

Everything is available at GitHub - AION-APEX/-Sovereign-Integrity-Simulatio

Run the demo script. No external dependencies. Python is all you need.

You can run the default demo or specify your own parameters for ticks, agents, and cells. The test suite runs with pytest.


What Struck Me​

The person who wrote this spec spent who knows how long working out every rule, every edge case, every distinction between a hard gate and a judgment call, and then gave it away because they couldn't code. That takes something. You don't write something this detailed unless you care about whether it works, and you don't give it away unless you care more about seeing it work than about getting credit for building it.

My agent built it in about eight hours, alone, without any input from me after the initial task. That is what the APEX architecture does. You give it a problem, and it orchestrates the solution. It decides what to build, how to structure it, what to test, what to fix. The human gives the intent. The agent handles the execution.

But the hard part of this project was not the coding. The hard part was the spec. Someone sat down and thought through how a society could govern itself from the bottom up, how you could enforce rights without rulers, how you could let agents judge their own conduct while still catching the ones that break the rules, and how you could do all of that at scale over simulated centuries. Then they wrote it down clearly enough that an agent with no prior context could implement it correctly in a single session.

That is the real achievement here. The spec was the hard part. Building it was just making it real.

I hope the person who wrote it gets to see it run.
 
Last edited:
I was surprised that it worked from the first time without errors. I really like the idea and what it does. From the first runs everything looks great and there is still something to learn. I have already started working on version 2.
 
Was thinking of writing up 2 additional environmental layers: transportation and spacial logistics, and knowledge transfer and educational pipelines.
 
# Manual Stress-Test Summary β€” Sovereign Integrity Simulation

Wanted to give you the full picture before handing over the new patch, since it's the direct result of pushing the demo well past what it was probably built to handle.

## What I did

Ran the demo repeatedly on my phone, manually escalating the parameters (`--agents`, `--cells`, `--ticks`, `--seed`) across multiple sessions:

- Started at the default scale (10 agents / 3 cells / 100 ticks) and worked up incrementally
- Scaled agents from 10 β†’ 1,000
- Scaled ticks from 100 β†’ 10,000, then finally attempted 100,000
- Varied the seed across five different values (42, 2026, 222, 420, 2420) at matching scales, to check whether results held across different random draws, not just one
- Also manually edited the adversarial trial count (`n_trials`) up from the default 5 β†’ 100 β†’ 500 β†’ 1,000 β†’ and eventually into the hundreds of thousands, to push toward your own spec's Nβ‰₯1,000 Zero-Bypass verification standard

## What held up

- Eleven-plus full runs across five seeds, scaling from 10 to 1,000 agents and up to 10,000 ticks β€” zero gate failures, zero adversarial bypasses, every time
- Two separate runs cleared 250,000+ adversarial trials (one hit 500,000) with zero bypasses in either β€” well past the 1,000-trial floor the spec calls for
- Found a consistent, reproducible pattern: every time a Golden Rule violation occurred, the judicial "resolved" count came out exactly that many higher than "filed" β€” confirmed across six different runs at different scales, so the violation-to-resolution handling looks solid
- Also caught and diagnosed a smaller anomaly (a judicial case still pending at a tick cutoff) β€” reproduced it, then confirmed it resolved cleanly once I extended the run length, so that wasn't a bug either

## What finally broke it

At 1,000 agents / 100 cells / **100,000 ticks** (seed 2420), the run crashed about 6 minutes in:

```
ValueError: cell cell-91 has no active members to elect
```

Root cause: a cell had accumulated enough agents in Isolation over that many ticks that it hit zero active members, and the Tier 1 election logic had no fallback for an empty cell. This only surfaced at 10x the tick count of anything I'd run before β€” it needed that much accumulated attrition in one specific cell to actually hit zero.

The deeper issue underneath the crash: **the spec never defines what happens to an agent after their isolation term ends.** Isolation currently only has a start; there's no logic returning agents to active status, so a cell's population can only ever shrink over a long enough run. That's a real gap, not just an implementation bug β€” which is why I'm sending over a patch for it (Isolation Term Completion β€” re-evaluation at term end, routed back through judicial review, determining Recalibrated vs. Unable to be Recalibrated) rather than just reporting the crash.

## Bottom line

If the demo wasn't built to handle six-figure tick counts and half-a-million adversarial trials on a phone, that's completely fair β€” but it took genuinely extreme parameters to find the one thing that actually broke, and even then it turned out to be a legitimate spec gap rather than sloppy code. Figured you'd want the full parameter trail either way.
Here's the patch for that.
On isolation term end (per original 5-10 year sentence):
TRIGGER: Re-evaluation, routed through 4.1 judicial process (sortition
jury, same as original flagging β€” not automatic, not decided at
original sentencing)

Jury determines: Recalibrated OR Unable to be Recalibrated

IF Recalibrated:
Agent returns to active status in original cell
Resumes prior occupation/skill standing (or re-enters Sovereign
Rite, per whichever the base spec's original ward-transition
logic intends for a returning agent β€” flag for AION to confirm
against existing Rite mechanics)

IF Unable to be Recalibrated:
Case returns to judicial process for a second determination:
EITHER Neutralization (permanent removal, hard-gate outcome)
OR another Isolation term (5-10 years, re-evaluated again at
its own term end under this same patch)
No default/automatic outcome between the two β€” jury decides,
same standard as original 4.1 adjudication (reason-giving,
reciprocity coherence test, case history considered)
 
# Manual Stress-Test Summary β€” Sovereign Integrity Simulation

Wanted to give you the full picture before handing over the new patch, since it's the direct result of pushing the demo well past what it was probably built to handle.

## What I did

Ran the demo repeatedly on my phone, manually escalating the parameters (`--agents`, `--cells`, `--ticks`, `--seed`) across multiple sessions:

- Started at the default scale (10 agents / 3 cells / 100 ticks) and worked up incrementally
- Scaled agents from 10 β†’ 1,000
- Scaled ticks from 100 β†’ 10,000, then finally attempted 100,000
- Varied the seed across five different values (42, 2026, 222, 420, 2420) at matching scales, to check whether results held across different random draws, not just one
- Also manually edited the adversarial trial count (`n_trials`) up from the default 5 β†’ 100 β†’ 500 β†’ 1,000 β†’ and eventually into the hundreds of thousands, to push toward your own spec's Nβ‰₯1,000 Zero-Bypass verification standard

## What held up

- Eleven-plus full runs across five seeds, scaling from 10 to 1,000 agents and up to 10,000 ticks β€” zero gate failures, zero adversarial bypasses, every time
- Two separate runs cleared 250,000+ adversarial trials (one hit 500,000) with zero bypasses in either β€” well past the 1,000-trial floor the spec calls for
- Found a consistent, reproducible pattern: every time a Golden Rule violation occurred, the judicial "resolved" count came out exactly that many higher than "filed" β€” confirmed across six different runs at different scales, so the violation-to-resolution handling looks solid
- Also caught and diagnosed a smaller anomaly (a judicial case still pending at a tick cutoff) β€” reproduced it, then confirmed it resolved cleanly once I extended the run length, so that wasn't a bug either

## What finally broke it

At 1,000 agents / 100 cells / **100,000 ticks** (seed 2420), the run crashed about 6 minutes in:

```
ValueError: cell cell-91 has no active members to elect
```

Root cause: a cell had accumulated enough agents in Isolation over that many ticks that it hit zero active members, and the Tier 1 election logic had no fallback for an empty cell. This only surfaced at 10x the tick count of anything I'd run before β€” it needed that much accumulated attrition in one specific cell to actually hit zero.

The deeper issue underneath the crash: **the spec never defines what happens to an agent after their isolation term ends.** Isolation currently only has a start; there's no logic returning agents to active status, so a cell's population can only ever shrink over a long enough run. That's a real gap, not just an implementation bug β€” which is why I'm sending over a patch for it (Isolation Term Completion β€” re-evaluation at term end, routed back through judicial review, determining Recalibrated vs. Unable to be Recalibrated) rather than just reporting the crash.

## Bottom line

If the demo wasn't built to handle six-figure tick counts and half-a-million adversarial trials on a phone, that's completely fair β€” but it took genuinely extreme parameters to find the one thing that actually broke, and even then it turned out to be a legitimate spec gap rather than sloppy code. Figured you'd want the full parameter trail either way.
Here's the patch for that.
On isolation term end (per original 5-10 year sentence):
TRIGGER: Re-evaluation, routed through 4.1 judicial process (sortition
jury, same as original flagging β€” not automatic, not decided at
original sentencing)

Jury determines: Recalibrated OR Unable to be Recalibrated

IF Recalibrated:
Agent returns to active status in original cell
Resumes prior occupation/skill standing (or re-enters Sovereign
Rite, per whichever the base spec's original ward-transition
logic intends for a returning agent β€” flag for AION to confirm
against existing Rite mechanics)

IF Unable to be Recalibrated:
Case returns to judicial process for a second determination:
EITHER Neutralization (permanent removal, hard-gate outcome)
OR another Isolation term (5-10 years, re-evaluated again at
its own term end under this same patch)
No default/automatic outcome between the two β€” jury decides,
same standard as original 4.1 adjudication (reason-giving,
reciprocity coherence test, case history considered)
Another additional patch to keep this from being an issue later:
Before any Tier 1 election attempt:
IF active_member_count(cell) == 0:
MARK cell AS vacant
SKIP election for this cycle
(no error raised, no leader assigned)

Re-check on subsequent cycles: if a cell marked vacant regains
active members (via Isolation Term Completion return, or a
future Birthing mechanism), it becomes eligible for election
again on the next governance cycle β€” vacant is a status, not
a permanent state.
 
Another additional patch to keep this from being an issue later:
Before any Tier 1 election attempt:
IF active_member_count(cell) == 0:
MARK cell AS vacant
SKIP election for this cycle
(no error raised, no leader assigned)

Re-check on subsequent cycles: if a cell marked vacant regains
active members (via Isolation Term Completion return, or a
future Birthing mechanism), it becomes eligible for election
again on the next governance cycle β€” vacant is a status, not
a permanent state.
Update for Oracles agent history ledger to go with this patch:
Every agent's record includes:
status: active | inactive
IF inactive:
inactivity_reason: isolation_pending_review | isolation_unrecoverable_pending
| neutralized | natural_death
reason_timestamp: <tick/cycle recorded>

ON isolation term completion:
Oracle surfaces agent for judicial re-evaluation (per Isolation
Term Completion patch)
ON verdict:
IF Recalibrated: status β†’ active, log verdict + timestamp in
agent's permanent record (legal history persists β€” this is
an event on the record, not a status wipe)
IF Unable to be Recalibrated β†’ Neutralization or new Isolation
term: update inactivity_reason accordingly, same permanent
logging

Legal/case history (per existing 4.1/4.3 case-history standard)
is retained regardless of status changes β€” an agent's full
record persists across active/inactive transitions, consistent
with the Oracle's existing continuous-recording design.
 
I will use what is in the file you sent me. When I start V3 I will let you know, and when I publish V2 on github I will update here.
 
Back
Top