Selûne
Selûne lets several coding agents change one MoonBit repository at the same time. Each agent works in its own sandboxed Git worktree cell, and agentic commit lands a change only after moon check, moon test and the integrity gate that protects the tests have each recorded a passing verdict for the exact tree that lands.
Documentation ·
Quickstart ·
Fork & Adapters ·
Why MoonBit ·
Lineage ·
Stack Deep Dive ·
SIM ·
Verification ·
MARS Proof Orrery (3D) ·
SelûneCraft demo ·
Play the demo ·
Contributing
Selûne is a set of MoonBit 1.0 RC1 command-line tools. An agent works in a cell, a locked, detached Git worktree with a private object store. The agent's commands there run inside Bubblewrap (bwrap), the Linux sandbox. Agents change code through typed edit operations such as Rename and ReplaceBody, and ./bin/selune agentic checks each change before it lands on the target branch. Git holds the authoritative source. Selûne builds compiler facts from each Git revision into a SQLite fact store, which also holds the evidence of every validation run. The install scripts in adapters/ give each supported agent CLI its configuration and the held-out test guard.
Say two agents start from the same commit and work in one package. Agent 1 renames a helper function. Agent 2 rewrites the body of a function that calls the helper by its old name. Each agent writes a plan with its operations and its read set: the definitions it looked at and the digest it saw for each. Selûne publishes the digests as facts for a revision. An interface digest hashes a definition's signature, which moon info supplies for exported definitions and Selûne reads from source for the rest. A body digest hashes the source.
agentic propose builds a candidate tree from the base commit and applies the operations. agentic validate then runs three checks. The integrity gate compares the candidate with its base. It rejects any change to held_out_tests/ and any hand edit to a verdict in an obligations.mars ledger. A deleted test or a weakened assertion passes only with a token from a spec-only reviewer, a reviewer who approved the change without seeing the implementation diff. moon check and moon test then run inside bwrap, and each check that runs writes an evidence record.
Agent 1 commits first, and the branch moves. The rename changed the helper's interface digest, so Agent 2's read set no longer matches the head. That mismatch triggers typed replay: agentic commit applies Agent 2's ReplaceBody again on the new head. It rewrites the call to the helper's new name, taken from the operation log of landed changes. Selûne then validates the replayed tree, rechecking the definitions that depend on the changed interface and rerunning only the tests whose dependencies changed.
agentic commit moves the branch with a compare-and-swap update, which fails if the branch moved again. It reports the status replayed_and_committed. When the edit does not apply or a check fails, the status is conflict or rejected and the branch stays where it was. ./bin/selune agentic self-test runs this sequence as its E2E 07 case, and the deep dive follows it through the code.