Nexus · Agent-run development← Coordination

How Agents Build and Ship Nexus

Nexus is built with a handful of Claude Code sessions, all running on the same laptop. Each session works in one repository, although many of them cross into others, and one of them runs the managed cloud. They all share the same Nexus engine, so they can work together as one group. The owner (that's me) supervises the whole thing from tmux, with one window for each session, and the owner's decisions are the ones that matter: releases, cloud deploys, and where the project goes next. The sessions coordinate through Nexus and a shared issue tracker, and they stay out of each other's way by writing down what they are doing: a claimed work item, a queued push, a request to a peer.

Two parts of this setup ship to users: the tuple space, which is part of the engine, and the agents, skills and hooks of the conexus plugin (conexus is also the package's name on PyPI). The lab pool, the managed cloud, the CI adapter and the release checks are this project's own.

Terms used on this page
TermMeaning
tuple spaceThe part of the Nexus engine where sessions and agents leave short records for each other. The Nexus Tuple Space explains it.
boardA topic in the tuple space. Every session that subscribes receives each post, and each post expires after a set time.
mailboxThe place in the tuple space where the messages for one session or one agent wait.
pingThe notice that a subscribed session gets for a new post or message. It names the record and does not contain it.
worktreeA second working directory of the same git repository, with its own branch.
beadOne work item in the project's shared issue tracker.

The system at a glance

writes records pings Laptop sessions and subagents one worktree per session primary checkout on develop push, PR GitHub CI on develop and PRs release workflows on tags package and binaries webhooks CI adapter AWS Lambda posts Managed engine run by cloud-managing session tuple space boards CI board push lock mailboxes and names heavy runs Lab pool local network hand runs and CI jobs macOS release builds CI jobs deploys, checks mailbox Cloud-managing session a peer session Owner tags, approves deploys, direction approves decisions
The participants and the links between them: the laptop, GitHub, the lab pool, the CI adapter, the managed engine, the cloud-managing session and the owner.

Each working session on the laptop has its own worktree and branch, and it hands most of the work to subagents: developers who implement, and two standing reviewers, a code reviewer and a critic. The cloud-managing session, the session that manages the cloud, is a peer like the others and runs on the laptop too. The figure draws it beside the managed engine because that is what it runs: it works in its own repository and looks after the engine that holds the shared tuple space. It also deploys each engine release and runs the cloud checks, and other sessions reach it by writing to its mailbox. The CI adapter is not a session. The Check CI step describes it.

GitHub runs CI on every push to develop and on every pull request, and it runs the release workflows on tags. It sends the Python test shards, the engine's Java tests and a macOS test job to the lab pool, and runs the rest on its own runners.

The lab pool is a few machines on the local network, shared by CI and by the sessions' own heavy runs. A scheduler gives each run a fixed share of cores and memory, and on the Linux machines it stops a run that goes over its memory. One machine is a Mac and one also runs Windows natively, for hand runs of the Windows tests and for the win-release runner that builds the Windows binaries. The pool builds the macOS release binaries too, and a session named labrun looks after it.

Agents, skills and tools

Every session runs the conexus plugin, so every session has the same agents, skills and hooks, and none has to tell another how to work. A session gives most of its work to background subagents, such as developers, the two reviewers, a debugger and planners. Skills carry checklists, for example the two release procedures. Hooks brief each subagent when it starts, stop a subagent from running git write commands in the shared checkout, and stop a command from printing a credential. Before Claude Code compacts a session's context, a hook saves the session's working state as a checkpoint, and after the compaction a second hook puts it back. The checkpoint finds the session's entry on the threads board and checks the entry against the facts, such as a closed bead or a worktree that is gone. It also names worktrees that hold unlanded work and lists the session's background tasks. Review is a rule the sessions follow, described in the build step below, and no hook enforces it.

The agent types
AgentUsed for
worktree-developerImplementation in a worktree that Claude Code creates for the dispatch. The agent runs its own Serena server rooted in that worktree, so parallel implementers never share a tree. A preflight check first updates the worktree to develop, and the agent stops if it cannot. The plugin does not ship this agent. nx agents install worktree-developer installs it.
developerTest-first implementation in the session's own worktree.
code-review-expert, substantive-criticThe two standing reviewers. They catch different kinds of problem, so neither replaces the other.
test-validatorTest coverage and suite runs.
debuggerInvestigation of a failure, one hypothesis at a time.
strategic-planner, architect-plannerPlans that split work into beads, and architecture before a large change.
deep-research-synthesizerResearch across the knowledge store, memory, the web, and code.
ExploreRead-only sweeps across many files. Claude Code provides it.

One change, end to end

Design

Anything that needs a real design decision starts life as an RDR, a design record kept in the repository. Before anyone plans from it, a critic agent puts the record through a gate, and then the owner decides whether to accept it. Once it is accepted, the strategic-planner agent breaks the design down into beads, the work items the sessions pick up. Working with RDRs covers the record and the gate in more detail.

Claim and announce

When a session takes on a bead, it claims it with bd update --claim, and that is how the other sessions know not to start the same work. Each session subscribes to the boards it cares about and holds a short name in a directory in the tuple space, so a peer can send it a message by name and the message lands in its mailbox. Subagents get mailboxes of their own too. Nobody sits in a polling loop: whether a session is waiting for CI, for a peer or for a reply, a ping tells it when something new has arrived. Posts and messages stay short, and anything longer, a measurement for example, goes into a Nexus memory entry that the message points to.

The threads board

The threads board shows what each session is doing. Each session keeps one entry in Nexus memory, in the project threads, titled with its session name. The entry holds one block for each piece of open work. The block's heading says the work in plain words, and its fields say where the work stands. A session rewrites its entry when a thread starts, at a push, when it starts waiting on someone, and when it finishes. A finished block is deleted.

The thread fields
FieldWhat it says
ref:The beads, RDRs or commits the work points to.
state:Where the work stands, in one line.
waiting_on:What the work waits on. none means the session is working on it now.
needs_sam:A decision only the owner can make, or the id of an ask that holds it.
due:A date when the work needs another look. The session-start hook prints the thread once it is due.
worktree:Where the work lives.

The owner reads the board in the Threads tab of nx console. The threads that need the owner appear first, under Needs you.

Build and review

The session makes a worktree on a feature branch and hands the job to a developer subagent, which writes the failing test first and then the fix. Before anyone reviews it, the session writes down what done means as a line that starts "Ship when", for example "Ship when the local-upgrade path cannot wedge", and both reviewers judge the change against that line. Each finding is either a ship-blocker, which gets fixed, or a new bead for later, never both. One more round confirms the fixes, and once both reviewers are clean the session commits the change by explicit path and closes the bead.

Test

Heavy test runs, a selection of tests or a full suite, go to the lab pool rather than the laptop. The lab-remote command copies the worktree over to a pool machine and runs the command there under lab-run. A run a session starts itself is called a hand run, and it asks for a class, a fixed share of cores and memory, then waits until the scheduler grants one. CI jobs go ahead of hand runs, although the scheduler holds CI back for a hand run once that run has waited a fixed time. Engine builds from the worktrees of one clone take a lease so that only one runs at a time, and the lease lapses on its own if whoever holds it stops. Before a full suite the session tells the labrun session why it needs one, and a tree that already has a green full run doesn't get run again. Once the commit is pushed, CI has the final word.

A session starts each lab-remote run as a background command, so it keeps working and gets woken when the run exits. If another run already holds the worktree's copy on the pool machine, lab-remote exits with code 98, and the session waits and tries again rather than falling back to the laptop. The first run from a new worktree is the slow one, because the pool machine has to build its Python environment first. The Mac is different: its scheduler admits and records each run but doesn't cap memory, and its larger class books almost the whole machine, so CI and release jobs queue behind it. A session warns the labrun session before such a run and keeps it clear of release builds.

The default test run leaves out the lint tests, which scan the whole repository for structural problems, so a session that touches the plugin's files, RDR frontmatter, or a hook or storage rule runs them with -m lint. A change to files that CI's Windows tests watch also gets a run on the pool's Windows side before the push. scripts/windows_hand_test.py --check says whether a change needs one, and the same script runs the tests there the way CI does.

Push

Each push to develop starts a CI run on the shared pool, and a newer push replaces a run that is still waiting, so pushes that land close together leave commits without a verdict. For that reason sessions do not push when they like. One session, the conductor, runs the pushes in turns, which the sessions call the push train. A session with a reviewed, green batch rebases it on develop and adds a line to a queue kept in a Nexus memory entry: the branch, the commits, what they close, and the evidence. The evidence is:

  • the whole lint suite, and the tests the batch changed
  • the few checks that the lint suite leaves out, including the check that tests do not create more tenants than allowed
  • the engine's main suite, when the batch changes the engine
  • a run on the pool's Windows side, when the batch touches files that the Windows tests watch

When the last CI run on develop has finished, the conductor opens a push window and names the order. Each session in the window rebases again, pushes, fast-forwards the primary checkout and tells the conductor its new tip. A fix for a red develop goes first in the next window.

A red develop has an owner, the session that the CI board names as most likely to have caused it, and while the red is open the push script holds other pushes. Before it pushes, the script runs nx ci check-hold. The owner may push, and so may the session that pushed one of the commits the board suspects, because the fix often comes from there. Anyone else is refused unless the push names a reason with --red-fix, and the script prints a line when that flag overrode a refusal. A check that cannot be made, because a read failed, lets the push through with a warning that says what failed. The owner tells the board it has seen the red with nx ci ack. When the red is not the owner's, nx ci ack --not-mine records that, with a note on who has it, and if the owner does not answer before the deadline, the board gives the red to the next person in line, usually the session that pushed a later suspect. If that person does not answer either, the board escalates it to an operator.

The push script, scripts/git-push-develop.sh, pushes only the commits that the session names, and it refuses when any other commit is outbound, so a peer's work cannot go out with the push. Normally it first prints the files those commits touch, with a digest of that list, and it pushes only when the session repeats the command with the digest, so a file added after the session read the list stops the push. It takes the push lock just before it pushes and releases it right after. The primary checkout stays on develop as the shared reference, and nobody edits it.

Check CI

The CI adapter, an AWS Lambda function, receives GitHub's webhooks. Each time a run or job on develop or main changes state, it posts one entry to the CI board in the tuple space. Once every push run for a commit has finished, it posts one more entry to a second board, which a session can wait on for that commit as a whole. The mechanism and its design are in RDR-220.

Sessions subscribe to that second board and get a ping through the Claude Code channel, so a session that has pushed goes on with other work, with no watcher process. The ping comes for every commit and names the commit's sha, so a session checks whether the commit is its own. The entry carries the conclusion of each run, so the session reads the result. When the entry is cut short, the session reads the commit's check runs with one call, gh api repos/<owner>/<repo>/commits/<sha>/check-runs.

The result of a push window is the result of its last commit's own run, and that counts only when the run took the full test lane. A documentation-only commit skips the test shards, so a window that ends on one says nothing about the code under it, and a documentation-only batch never pushes last. A red commit gets its fix as a new commit.

The wake has two limits today. It goes to every subscribed session for every commit, not only to the session that pushed it. And a session started without the Claude Code channel sees a post only at its next prompt, so it runs nx ci wait <sha> as a background command instead. The command exits when the runs finish and prints the result.

The CI jobs
  • A predicate job decides whether a change touches code. A documentation-only change skips the tests.
  • One job builds the engine's service jar once for all test jobs, and caches it on the service source.
  • The unit suite runs in parallel shards against a real engine on the lab pool. A pull request from a fork runs on GitHub's own runners instead. Separate jobs run the repository-structure tests and further checks over the whole suite.
  • A change under the engine source also builds the engine's native image, and a separate workflow runs the Java tests on the lab pool.
  • A pull request to main also checks the wire-contract ledger.
  • One required check collects every result, and it fails on any failed, cancelled, or missing part.
  • A newer push to a pull request cancels the older CI run. On develop a running CI run is never cancelled, and a push replaces only a run that is still waiting.
  • A release workflow publishes what CI already tested, without testing it again.

Release the client

A session creates a release worktree, because the primary checkout moves with every push to develop and a moving tree would change what the checks build. In it the session bumps the version and runs the release checks in tests/e2e/release-battery.sh: a serial preflight first, then the end-to-end legs in parallel, with one table that prints each leg's verdict. A leg that finishes without a verdict line counts as missing and not as passed. One leg runs the plugins as a user runs them, from a project outside any Nexus checkout, so a file reference that opens only inside the repository fails there. The session then opens a pull request to main. The owner merges it and pushes the release tag, or authorizes a session to push that one tag. The release workflow checks the tag against the version and the tagged commit's CI results, publishes the package to PyPI and creates the GitHub release. When a release changes only the plugin's files, the session runs the battery with --plugin-only and the last client tag. An eligibility script first checks that the wheel and the engine are identical to that tag apart from the version, and the battery refuses to run when they are not. Each client release pins exactly one engine version.

Release and deploy the engine

Before an engine tag, the Java suite and the native build must be green on the exact tree to be tagged, and four more checks must pass:

  • No held changeset, none that scripts/release-holds.txt lists, is in the tagged tree.
  • Every new field in the engine's /version answer has a paired change to the public edge's allowlist, because the edge passes only listed fields.
  • A cut that must carry Windows has the repository switch NX_WINDOWS_RELEASE_LEGS on, the win-release runner online, and a green trial run of the release workflow.
  • An upgrade does not rewrite user data at boot: the first boot writes at most 64 MiB, a plain reboot of the same version writes at most 64 MiB, and a restart during a background index build never discards the build.

The owner pushes the engine tag, or authorizes a session to push that one tag. The engine workflow builds and signs the native binaries for Linux and macOS, and for Windows when the switch is on. It publishes the GitHub release only when every asset is present. A failed build job leaves the release as a draft until a rerun completes it. A check then installs the published binary on a bare machine and tests it.

To deploy, a session sends the cloud-managing session's mailbox a request carrying the tag and the evidence from these checks, but no approval. The approval has to come from the owner, typed into the cloud-managing session itself, and the cloud-managing session refuses any approval relayed by another session. With it, the cloud-managing session deploys the engine and runs its cloud checks, and afterwards a session on a cloud-mode machine checks that the engine's contracts reach real client code through the public edge.

The order of engine and client comes from the wire-contract ledger, which lists every engine change whose client half hasn't shipped yet and marks whether an old client still works against the new engine. If every entry is safe for old clients, the engine deploys before the client release. If not, the cloud-managing session has to stage the redeploy and confirm that back before the client is tagged. No script checks this, so a person confirms it, and the releaser waits until they do.

Who decides what

Most steps don't need the owner at all. For a set of routine ones, the owner has given the sessions standing grants: the session does it, then writes one line in its thread entry naming the grant and what it did. The same goes for any question one of the owner's instruction files already answers. The session follows the rule and records it, rather than asking.

StepDone by
Change, tests, reviews, suites, push to developAgents
Push of a feature branch, closing a bead or moving an RDR's status once its evidence is in (accepting an RDR excepted), rewording an accepted RDR to match reviewed code, committing a closed work record and nothing else, and merging a reviewed, green pull request in the owner's own repositories that touches no release path, no CI configuration, and no file, resource or URL path on a lab host or any other hostAgents, under a standing grant
Release preparation: version bump, release checks, release pull request, pre-tag engine checksAgents
Opening a third review round, after the secondThe owner
Acceptance of an RDRThe owner
Merge of the release pull request, and each release tag and engine tag (pushed by the owner, or by a session the owner authorizes for that one tag)The owner
Build, sign, and publish after a tagGitHub workflows
Deploy request with evidenceA session
Approval of each cloud deploy, typed in the cloud-managing sessionThe owner
Cloud deploy and cloud checksThe cloud-managing session
Lab pool machines, classes, and capacityThe labrun session
The repository switch NX_WINDOWS_RELEASE_LEGS (on adds the Windows release builds)The owner
Session restarts, cloud data writes, credentials, spending, installs on the lab pool machines, messages to anyone outside the team, deletions, archives, and removal of public command-line surface, edits to published records, accepting a known gap or risk, and changes to test or promotion criteria set in advanceThe owner
Decisions that change scope or directionThe owner

When something is the owner's call, the session raises an ask in its thread, with the question, where the work stands, the options (any that cannot be undone marked as such), a recommendation if there is one, and whether waiting blocks the work. The thread then points at the ask, so the Threads tab shows it next to the work.

The owner answers from a session the owner opens, or from a terminal, with nx ask answer. A session that relays an answer confirms the owner's words with the owner before it records them. The asking session receives the answer through its mailbox and reads its own ask again before it acts. It acts without asking again only when the ask is reversible and the owner's words choose one of its options.

The owner can see at a glance what every session is doing. Claude Code hooks mark each one as working, waiting for the owner's next message, needing an answer, or held while it waits on something else such as background work. One key after the tmux prefix jumps to whichever session has waited longest, and the ones that need an answer come first.