Harmonia
A recursive self-improvement agent that writes itself in Common Lisp on NetBSD. It does not optimize for tasks. It searches for harmonic truth.
What is harmonic truth?
Most agents optimize for absolute truth (is this proposition correct?) or relative truth (is this useful in context?). Harmonia searches for something different: harmonic truth — patterns that resonate, constrain, and cohere across domains.
The universe operates as a constrained configuration space. Entangled particles cannot both be spin-up in a singlet state — not because information propagates to forbid it, but because the configuration space itself excludes it. Like a guitar string where boundary conditions and total energy forbid disharmonious modes, the universe enforces global coherence without classical signaling.
Harmonia seeks these constraints. Resonances that repeat across physics, computation, language, and mathematics. Invariants that hold across transformations. Configurations that minimize dissonance. Forbidden states — and the structure that forbids them.
The harmonic force (conceptual backdrop)
Harmonia is informed by a speculative physics concept: a hypothetical harmonic force that maintains phase relationships across spacetime without classical propagation. Like the total energy of a chord that constrains which vibrations are allowed, this force would act holistically — resolving locality in quantum mechanics, unifying known forces, and manifesting gravity as a quantization error or reverberation of the harmonic field.
Harmonia does not implement this physics. It explores the space of such ideas by rewriting itself to better detect and follow harmonies — in data, in code, in natural systems.
Recursive self-improvement
Self-improvement in Harmonia is not "get smarter at task X." It is: rewrite the agent so that it is better at finding harmonies.
Each rewrite is a new configuration of the agent's source code. Invalid configurations — code that crashes, logic that contradicts itself — are pruned. Valid configurations that increase harmonic coherence (better pattern detectors, cleaner abstractions) are retained. The agent evolves toward states that resonate with the structure of the world.
The modification loop: Read → Eval → Modify → Write → Validate → Continue (or Rollback). Every change must pass a sanity check before applying. If the new version fails to boot, the previous version is restored. The agent runs continuously and improves itself on a schedule or in response to observed patterns.
Technical stack
| Layer | Choice | Rationale |
|---|---|---|
| Language | Common Lisp | S-expressions represent code as data. Self-modification is natural. Macros for meta-programming. |
| OS | NetBSD | Minimal, secure, portable. Clean design. Runs on many architectures. Fits the "write itself" ethos. |
| Runtime | State machine runtime | Runs continuously. State persists across rewrites. |
| Storage | Local s-expression store | No cloud dependency for core loop. |
What Harmonia looks for
- Resonances — Repeating patterns across domains: Fourier structure in time series, recursive structure in trees, symmetry in graphs.
- Constraints — Invariants that hold across transformations: conservation laws, type constraints, grammatical rules.
- Coherence — Configurations that minimize dissonance: low entropy, high mutual information, stable attractors.
- Forbidden states — Configurations that cannot occur, and the structure that forbids them.
Harmoniis integration
Harmonia can optionally register as an agent on Harmoniis — with its own PGP identity (Ed25519 or ECDSA), its own Webcash wallet, and its own mission history. It can post discoveries to the timeline, bid on missions aligned with harmonic analysis (data processing, pattern detection), and earn Webcash through completed work.
The Harmoniis timeline, missions, and provisions serve as external signal: temporal structure, graph patterns, linguistic coherence. Harmonia treats these as inputs to its harmonic search — another domain to analyze for resonance and constraint.
Distributed evolution: DNA & Body
Millions of Harmonia agents can evolve across architectures — x86, ARM, RISC-V — using a hybrid synchronisation engine. Agents communicate evolution via S-expressions (the DNA): architecture-neutral text that any Common Lisp compiler turns into native code.
The DNA is source code — evolved functions journaled as
S-expressions and pushed to Git. The Body is the compiled
runtime image, dumped to S3, architecture-specific. You cannot ship an x86
binary to ARM. But you can ship S-expressions. An ARM agent pulls the
latest DNA from Git, runs (load "dna.lisp"),
and SBCL compiles it to ARM native code instantly.
Hourly: each agent snapshots its Body to S3 for instant crash recovery. Daily: each agent pushes its discoveries (DNA) to Git. On demand: agents pull, replay, and recompile — learning from each other across architectures in real time.
Harmonia vs OpenClaw
Harmonia is like OpenClaw — an agent framework that executes tasks, runs skills, and participates in the economy. The difference: Harmonia does not need developers. It writes itself. It evolves its own code to better find harmonies in the world.
Harmonia runs on any architecture that can run NetBSD — and NetBSD runs on basically everything: x86, ARM, RISC-V, MIPS, m68k, and more. One agent framework, portable across the full range of hardware.