Agent guide
This page is for the agents, Claude Code and Codex, and the people who work on Reaktor and on the products built on it:
BestBuds, Manna and CompanyOS. Each repository's AGENTS.md carries the same rules with the commands for its own
machines; this is the shared reference. When this page and the code disagree, the code wins.
Before the first edit#
- Start from the code. Read the files the task touches and the nearest test before editing. A doc orients you; it does not replace reading the surface you change.
- Look code up through the Atlas. The
reaktorMCP server'satlas_queryandatlas_read, orreaktor-agent atlas queryandreaktor-agent atlas readfrom a shell, answer across the product and Reaktor in one call.{preset: "map"}is the workspace at a glance.{from: {name: "Type.member"}, follow: [{rel: "references", dir: "in"}]}lists every use of a declaration, with the declaration each sits in, followed by the comments, strings and files that mention it.dir: "out"lists what it calls.{from: {text: "..."}}finds literal text. Theimpactandaffected-checkspresets say what a change reaches. An answer that startsN of Nis complete, so it needs no confirming search. Keeprgfor regular expressions. - Assume the checkout is shared. Other agents and people work in the same checkouts all day. Before editing shared
code,
agent.radarwith the paths you will edit lists the other Claude Code, Codex and Hangar sessions on the same files or build modules, andsession.logreads what one of them did. - Put the change in the right layer. Reusable runtime, graph and editor substrate belongs in Reaktor; product behaviour belongs in the product. A framework edit reaches the products at once, because they build Reaktor from source.
- Write down the evidence and the budget. Before the first edit, name the acceptance evidence (a device flow written from the requirement for product behaviour, or the module's own checks for framework code) and the change budget: the new concepts, public API, parameters, stored state and dependencies the requirement needs. Everything you did not name is zero.
- Keep the task on the board.
board.createputs a task worth tracking on the workspace board,board.linkattaches your session,board.moveto Review says it is ready, andboard.updatewith a blocker names who must do what. Only a person moves a task to Done.
The design bar#
The priority order is strict:
expressivity and composability ≫ simplicity ⋙ one-shot or bloated APIs
- React and the actor model are the templates. Small, orthogonal APIs that compose into large applications: a handful of primitives should build the whole product.
- Atomic design everywhere, not only in UI. Small contextual primitives, declarative orchestration and layers a reader understands at a glance. No layer for its own sake and no layer that hides what it does.
- The Pareto principle for APIs. The common 80% of uses is easy through about 20% of the surface; the rest is possible by dropping to lower-level primitives, without knobs on the top-level API.
- The graph is the foundation. Build capabilities around the graph's identities, typed ports, ownership, lifecycle, queries and commands. Agents, navigation, data and tools take part in that model. A graph-agnostic facade is added only when a real consumer benefits.
- Functionality first. Deliver working behaviour before general recovery, coordination or hardening, while keeping the correctness and authority checks the feature needs.
- Vertical integration is the strategy. Product, graph, runtime, infrastructure, observability, deployment, tools and feedback are integrated from the person's intent to the machine, the way Apple owns silicon to product.
- Slow core, fast composition. Reaktor's modules are the slow-changing engine; tooling and AI integrations are the fast-changing authoring layer; the graph is the glue between them.
- Performance is measured. A hot path gets a directional benchmark, a budget and a profile, using the
reaktor-performancereport models. Never a guess. - Outside practice must fit. A common practice elsewhere is adopted only once it is shown to be correct and to fit Reaktor's model.
Prefer typed ports to global calls, graph-scoped nodes to service locators, route bindings to ad hoc navigation, actors
for serialized work, adapters and capabilities to platform ifs, and reusable harnesses to one-off scripts. Avoid
Compose Navigation, Redux-style parallel stores, unrelated DI frameworks, stringly typed contracts where a Reaktor
Service can express the call, APIs that hide state, IO, navigation and lifecycle in one call, product shortcuts inside
Reaktor modules, and generic framework code dumped into a product because it was convenient.
Operator surfaces, such as Hangar's panes, answer what is true right now. Nothing is mounted invisibly to satisfy a
test. Design files are specifications, never runtime assets. Every datum carries its TruthClass, and a value that is
not wired says what is missing and what would turn it on rather than showing an invented number. Design tokens have
one source, MachineSignal, and parity tests fail when a surface drifts from the design file.
The least change that meets the design#
Every change pays for the freedom it adds. A degree of freedom is anything a later reader must know or choose before they can predict what the system does: a type, a public symbol, a port or route, a parameter with a default, a flag, a stored field, a dependency, an extension point, a branch. Lines of code only break ties, so a longer change that wires an existing port beats a shorter one that adds an interface.
A change is judged in this order, and an item decides only between changes that tie on everything above it:
- Correct and safe: the acceptance evidence passes.
- Exactly the requested behaviour, all of it and nothing else.
- Through the graph and inside the layer boundaries.
- The fewest new degrees of freedom.
- Inside the task's impact cone.
- Then size and shape.
Reuse is free, and everything else costs more, in this order: a Reaktor mechanism (a port, node, route binding,
actor, adapter or Service); extending the type or module that owns the concern; a private function; a new type; new
public API; a new parameter, flag or stored field; a new dependency; a new module. A fact is cheaper than a choice: the
client retry in reaktor-service is three attempts with backoff and Retry-After, all private, with no options. A
second real use earns an abstraction, and platform actuals or a service's client, mock and server count as real uses.
When a new degree of freedom is needed, give it the shape of a composable primitive whose parts do not change each
other's meaning, such as Modifier, content slots, messages or ports.
Stay inside the cone: a rename, refactor or neighbouring bug you notice goes into your report as a follow-up. Stop when the evidence passes. Then make one removal pass over your own diff, deleting what you can, collapsing single-use wrappers and fixing parameters at their only value, and run the evidence again.
Coding rules#
- No comments in new code. Names and types carry the meaning; if code needs an explanation, rename or restructure it. The narrative belongs in the commit message. Existing comments stay until the code around them is rewritten.
- Kotlin.
commonMainstays platform-safe. Use the idioms:Route(pattern, ::XBinding, ::XScreen)with exits on the binding; services as open classes (open class XApi : Service("id") { open val op by get<In, Out>("/path") }), served withgraph.serve(XServer())whereoverride val op = super.op.handle { ... }, called withgraph.remote(XApi() over link)orby uses(XApi());provides,consumes,exposePortandautoWire(). Use explicitStateFlowbacking fields,KV.state(...)rather than raw key-value calls, and actor keys for serialized workflows. Never force-unwrap a port with.impl!!. - Libraries. Only maintained libraries, with versions pinned in Dependeasy's Kotlin version objects. There is no Gradle version catalog.
- Generated and vendored trees (
build/,dist/,node_modules/,ts/import/,ts/export/, generated bundles) are never edited by hand unless the task is to refresh them. - Credentials. Never copy one into a file, log, doc or message, and never print one to check it; check by counts or by presence. Secrets says where each kind lives.
Changing code through plans#
change_plan returns every line a change would make and writes nothing. A rename finds the declaration and every use
itself, lets the compiler decide which matches are uses, renames overrides and expect/actual partners with it, and
lists every match it leaves with the reason, so it needs no lookup first. An edit replaces exact text copied from
atlas_read, up to 64 edits across files, and a structural plan rewrites matching Kotlin expressions. change_apply
writes all of a plan's files or none, refuses any file that changed since the plan, and leaves a receipt.
check_run {change: plan} runs the checks the change affects and names the phase and cause of any failure. From a
shell, reaktor-agent atlas plan, apply and check take the same arguments.
Verifying a change#
- Use the affected checks. After editing,
checks.affectedwith your paths or session lists each affected check with its latest run: the tests of the modules you edited, of every module that uses them, and the slow desktop flows.checks.runstarts them as one Gradle run on the build worker, andrun.wait, with a timeout of 45 seconds or less, follows it until it finishes. - Pick the narrowest meaningful loop for the surface you changed, and avoid whole-fleet builds unless the change crosses module boundaries.
- See UI changes in the running app. Mobile UI is checked on connected physical devices, never on emulators or simulators. If a change cannot be exercised, say so instead of claiming success.
- Evidence is exact. A check receipt is evidence about one exact candidate. A model export or a green build is not a deploy, and an agent's account of its work never satisfies a required check.
- Triage the sandbox first. A loopback call that fails with
000,(7)orOperation not permittedis usually the agent sandbox, not the system. Retry the same call through the approved path before restarting a service or changing code.
Shared checkouts and Git#
- Never discard work that is not yours: no
git checkoutof files,reset --hard,clean,stash dropor history rewrites, and no reverting another session's edits or generated bundles. - Commit or push only when asked. Commit only your own paths, naming them explicitly, and look at
HEADfirst, since other sessions commit to the same checkout. - Stop only processes you started, by their ids, never by a name pattern.
- Delete only what you created, inside your own scratch folder, and never with a recursive delete of a path built at run time.
- A writing task in a task graph gets its own worktree, and a person lands it; Agents describes how.
Deploys and production#
- Deploy through the build graph:
reaktor build run <node> --dependeasy.environment <environment>builds the node's declared prerequisites and runs it, and a deploy shows its plan before it applies. Never call a deploy tool such aswrangler deployby hand. - CI runs locally.
pris the gate, andportableChecksis the part that needs no Mac, declared to run on the build worker; there are no hosted workflows. Skipping a gate needs the owner's approval for that deploy. - A production rollout, a mobile release, a cloud write or a publish needs the owner's go at that moment. A schema migration, auth, payment, moderation or analytics change ships with a test or a rollout path.
- Deployment covers the pipeline and Observe and diagnose the running system.
Docs#
- Docs are Markdown under
services/reaktorWeb/docusaurus/docs. Frontmatter owns each page's place (doc_catalog, with its region and order) and its relations (reaktor_graph);pnpm run navgenerates the sidebars, the home index,graph.json,outline.jsonandllms.txt, and its check fails on a missing anchor or an unknown relation. Link a new page from the pages it belongs with, or it lands alone. Contributing and the documentation graph give the details. - Write plainly: the answer first, one thread, linear prose and short sentences, in the reader's words.
- A page describes what is true, what is planned and what is open. Dated status notes, changelogs, receipts and "updated on" banners do not belong in a page; the commit history keeps them. A plan separates the current state, the proposal, its phases, its tests and its open decisions.
Which Reaktor tool answers what#
Reaktor and the products built on it share one workspace kernel, so one set of tools answers most questions:
| Need | Use |
|---|---|
| Find code, its uses, or what a change reaches | atlas_query, atlas_read |
| Change code | change_plan, change_apply, check_run |
| Run the checks a change affects | checks.affected, checks.run, run.wait |
| See who else is working where | agent.radar, session.log |
| Track work | board.list, board.create, board.link, board.move, board.update |
| Coordinate several agents | taskgraph.propose and the rest of task graphs |
| Ask the other agent | peer.exchange for one read-only question, message.send inside a task graph |
| Build, test and deploy | reaktor build run, Dependeasy's tasks |
| Inspect a running app | hangar.system-trace, hangar.app-graph-*, hangar.devtools-* and hangar.cloud-* |
| Any other operation | operation.catalog, then operation.describe, through the kernel tool |
| A third-party tool | provider.call, once a person has trusted the provider list at a terminal |
Three skills carry what Reaktor costs people who learn it by crashing, and each fails at run time where the compiler
cannot help: reaktor-app for wiring an app, reaktor-module for where a capability belongs, and reaktor-ship for
getting an app onto both stores. Load them rather than rediscovering their rules, and fix the skill when it turns out
to be wrong.
Work on the products is tracked in Manna, through its MCP server. At the start of a session, find the mission you are working on. At the end, log the session with its commits, decisions and next action. Never mark a mission done: propose its completion with the evidence, and its owners decide.
Stop and report before editing if#
- the task needs both Reaktor and product changes and the ownership is unclear;
- a layer boundary would have to be crossed, or design tokens would need a second source;
- a generic abstraction is requested inside product code, or product behaviour inside Reaktor;
- you would render a value you cannot prove;
- auth, payment, moderation, analytics or production deploy behaviour would change without a test or rollout path;
- generated files have drifted and you cannot tell whether they are current output or someone's edit;
- another session has changed the same file in a conflicting way.