project file / 02 / Self-modifying Mac agent
Sadhbh
A native Mac agent that can change its own Swift source, prove the new build works, ask a separate model to review it, and roll back cleanly when it fails.
The original Swift sister
Sadhbh is a native Mac agent that can read and edit her own Swift source, rebuild, and relaunch into the result. Her name is pronounced “Sive.” In the Fenian Cycle, Sadhbh is changed into a deer, becomes human again, and is later taken back into deer form. She is also the mother of Oisín, whose name means “little deer.” The project borrows the part of the story that matters here: a self can survive a change of form.
She is also the proving ground for the family’s harder ideas. Her current source includes semantic recall, model-attributed memory, dreams, scheduled intentions, multi-step plans, behavioral evaluations, peer conversations, MCP tools, and a full self-modification pipeline.
Why the sisters have Irish names
Sadhbh established the intended naming pattern for the Swift sister agents: women from Irish mythology whose stories say something useful about the role of the software. Niamh carried that pattern forward. Fai, the first agent made from the template, received a last-second name before that part of the family idea was fully worked through. Cadre turned the shared machinery into a reusable framework. Aria is their older sister from a separate codebase and predates the theme.
How evolution works
An implementer model works on a branch. The edited tree must compile and pass the in-binary self-check suite. A different model then reviews the verified diff as an adversarial judge. Work that fails the mechanical gate is rolled back byte for byte, including memory written during the attempt. Successful work can be committed under Sadhbh’s own identity and followed by a rebuild.
Her memory is protected in layers. Replace operations create backups. Repeated paraphrases can be rejected by a rumination check. Claims about completed actions need evidence before they enter normal recall. A typed handoff carries state between sessions without turning the handoff itself into another long reflection.
What matters in the design
- The constitution is outside her edit authority. Identity, habits, memory, and source can change. The protected principles and safety policy cannot.
- A green diff still gets argued against. Build success proves that code runs, not that the change is useful or safe.
- Unattended work cannot borrow future permission. Actions that need approval are declined when nobody is present.
- Memory changes share the fate of code changes. A rejected evolution cannot leave behind a journal entry claiming it succeeded.
- Model quality is visible. Artifacts record which model made them, and the Vitals view tracks failures, refusals, gates, and costs by model.
architecture / high-level view
How the pieces connect
These maps leave out implementation detail on purpose. They show the boundaries and paths that explain the project.
A code change must survive mechanical checks and an independent review before it can become part of Sadhbh.
Drawing system map...
flowchart TD
Idea["Intent or approved idea"] --> Branch["Isolated Git branch"]
Branch --> Implement["Implementer edits Swift source"]
Implement --> Gate{"Build + self-check pass?"}
Gate -- No --> Rollback["Restore code and attempt memory"]
Gate -- Yes --> Judge["Independent model reviews diff"]
Judge --> Verdict{"Useful and safe?"}
Verdict -- No --> Rollback
Verdict -- Yes --> Adopt["Commit, rebuild, and relaunch"]
Adopt --> Reflect["Record evidence and outcome"] Read this diagram as text
- An intent or approved idea opens an isolated Git branch for an implementer model.
- The result must build and pass the in-binary self-check suite.
- A separate judge model reviews the verified diff for usefulness and safety.
- Rejected attempts restore both code and memory. Accepted work is committed, rebuilt, relaunched, and recorded with evidence.