W ai4rent.net
Open reference · v1.0

A self-learning AI harness you can actually trust.

A practical architecture for agent systems that remember, improve and prove their work. Distilled from an operating 8-agent agency and hardened with evaluation, provenance, idempotency and observability.

Reference design · not a product · adapt the trade-offs to your domain

3memory layers
8workflow phases
10task states
1rule: evaluate first
Self-learning AI harness system map A memory loop on the left and a task workflow loop on the right, joined by evaluation and trust controls. MEMORY LOOP Knowledge that compounds Sources web · Discord · tasks Ingest + trust validate · quarantine Shared brain PostgreSQL Sync incremental Workspace Markdown context Local index SQLite · FTS + vec Hybrid retrieval · BM25 + vector → RRF evaluated α · per-agent feedback query TASK LOOP Work that can prove itself Intake classify · risk Plan recon · clarify Execute sandbox · lease Verify self + Oracle Review peer · human Complete evidence-bound Watchdog · retries · post-mortem escalate stalled work · extract lessons post-mortem lessons → shared brain CONTROL PLANE Evaluation · provenance · canary · rollback · observability both loops depend on it
Two loops, one control plane. Learning without verification is drift; verification without memory is repetition.

Two loops, one system

The memory loop makes agents more useful over time. The task loop makes their output verifiable. Neither is safe without the other.

Design principles

These are the constraints I would not remove. They are the difference between a demo that appears to learn and a system you can operate.

Evaluate before autonomy

A self-improving system without a holdout set learns to look better, not to be better. Every prompt, strategy and retrieval weight change must pass an offline gate.

Memory is a trust boundary

Web pages, Discord, attachments and peer agents can poison memory. Store provenance, quarantine unverified knowledge and never clone a strategy without evaluation.

Exactly once, not “usually once”

Tasks, retries, payments and deployments need idempotency keys, leases and terminal-state guards. Cron overlap is a bug, not an edge case.

Evidence, not claims

“Completed” must mean reproducible evidence: command, output hash, artifact, timestamp and the verifier that checked it. Oracles should not trust the agent’s summary.

Humans at risk gates

Human approval should depend on reversibility, spend, data access and blast radius — not only task complexity.

Observe the loop

Track recall, precision, stale memory, retry rate, Oracle pass rate, cost per task and drift. If you cannot see the loop, you cannot improve it.

What I changed from the original design

The original decks describe a strong loop. This reference adds the parts that make it safe to run unattended.

✓
Evaluation harness

Golden tasks, holdouts, regression suites and canaries before any α, strategy or model change.

✓
Provenance & trust labels

Raw → verified → trusted, with source, author, timestamp and a quarantine path.

✓
Incremental memory sync

Event-driven updates plus a reconciliation sweep; version embeddings instead of re-embedding everything.

✓
Idempotent workflow

Leases, transition guards, dependency-cycle checks and replay-safe retries.

✓
Evidence contract

Oracle re-checks executable evidence; stale or self-supplied proof cannot pass.

✓
Operational visibility

SLOs and dashboards for every loop: retrieval, memory, retries, Oracle, cost and human gates.

If you are building this

A minimum implementation order that avoids the common traps.

  1. Write the task state machine and transition table before code.
  2. Define a memory record schema with provenance and trust level.
  3. Build the evaluation set before the evolution engine.
  4. Make every scheduled job idempotent and lock-protected.
  5. Log retrieval, feedback, strategy changes and Oracle evidence.
  6. Add backup/restore and a disaster-recovery drill.

Download the reference

The same architecture, formatted for offline reading and sharing.

Use it as a starting point, not a blueprint. The right number of states, agents and memory layers depends on your risk, volume and team. Keep the loops; question the constants.