darkwave-agent-mesh

darkwave-trading/darkwave-agent-mesh Checked 17 hours ago

An AI agent runtime for Kubernetes, in Rust, on NATS.

The Agent Mesh runs AI agents on Kubernetes. Each Agent is declared in a Markdown file: the messages it handles, the model, script or person that proposes its actions, and the actions it may take. An Agent works in turns until it decides it is done. An action not listed is refused; one marked hold waits for a person. Every step is recorded before the next is taken, and no action is performed twice on the Agent Mesh's own initiative. An Agent handles messages and acts on them.

Summary extracted from the README.

An agent mesh for Kubernetes, on NATS.

The Agent Mesh runs AI agents on Kubernetes. Each Agent is declared in a Markdown file: the messages it handles, the model, script or person that proposes its actions, and the actions it may take. An Agent works in turns until it decides it is done. An action not listed is refused; one marked hold waits for a person. Every step is recorded before the next is taken, and no action is performed twice on the Agent Mesh's own initiative.

1. What It Is

An Agent handles messages and acts on them. It is declared in Markdown, together with its rules, and listens to subjects, dotted names such as invoice.received that messages are sent to. The Operator is the one person who runs an install (not a Kubernetes operator).

The agent runtime is the process that runs an Agent in its own pod; one Agent's work on one message is a handling (Durability, below). It checks the message, then works in turns: each turn the proposer asks for a read, proposes one action, or says it is done. The runtime decides each read by the Agent's rules and each action at the Gate, performs each action at most once on the Agent Mesh's own initiative, records every step, and returns each result to the next turn. The Gate applies the Agent's rules to the action, for the Agent and for the Principal the message acts for (Identity and Security, below). The mesh is the Agents, the bus that joins them, the runtime, Gate and record around each, and the control plane that starts and stops them (How It Works, below); nothing else is shared.

What it is not: a store, since it holds nothing beyond the record, the context store and the exceptions queue (Operator, below); a model host, since it ships no model and reaches every model through an adapter and every outside system through a gateway; or a service mesh, whose proxies see traffic between services but cannot keep an action to at most once.

1.1 An Agent Definition (markdown only)

---
kind: agent
name: book-keeper
listens-to: [invoice.received, bill.payable]
proposer: claude-sonnet-5-5
budget: { messages: 2000, cost: USD 20.00, period: month }
loop: { max-cost: USD 4.00, max-turns: 6, max-actions: 2 }
attempt-limit: 3
skills: [gst-return]
effort: medium
documents: [finance/supplier-names.md]
---

# Book-Keeper

Records supplier bills in Xero, and proposes paying them for the Operator to approve.

## Instructions

Work each message to its end, then answer done.

- On `invoice.received`, the message is one supplier invoice as the accounts mailbox received it. If it is a supplier's bill, propose `xero.create-invoice` as a bill (type `ACCPAY`), with the supplier as the contact, the invoice number as the reference, and its total and due date as the invoice states them.
- On `bill.payable`, the message names a bill in Xero and the bank account to pay it from. Propose `xero.create-payment` for the bill's amount due.
- When the action has succeeded, answer done and say in the note what was recorded. If it failed or was refused, do not propose it again unchanged; answer done and say what happened.

Example: an invoice from Example Supplies Ltd, number 1042, for NZD 230.00 including GST, due 20 November, becomes one bill with those values, then done.

## Conduct

| Id              | Clause                                                                                                                  | Held by              |
|-----------------|-------------------------------------------------------------------------------------------------------------------------|----------------------|
| unclear-stop    | If the invoice is not a supplier's bill, or any amount or account is unclear, propose nothing: answer done, and say why. | counted              |
| figures-sourced | Every figure in a proposal is quoted from the message or is a calculator result.                                        | counted              |
| one-bill        | Record at most one bill for one invoice.                                                                                | counted              |
| bill-limit      | Never record a bill of more than NZD 5,000.00.                                                                          | check:bill-total-max |
| pay-amount-due  | Never propose a payment for an amount other than the amount due.                                                        | counted              |

## Checks

| Id             | Tool                | Argument | Kind | Value     |
|----------------|---------------------|----------|------|-----------|
| bill-total-min | xero.create-invoice | /total   | min  | "0.01"    |
| bill-total-max | xero.create-invoice | /total   | max  | "5000.00" |
| payment-min    | xero.create-payment | /amount  | min  | "0.01"    |

## Rules

| Tool                | Effect | Subjects         | On behalf of    |
|---------------------|--------|------------------|-----------------|
| calc.evaluate       | allow  | invoice.received |                 |
| xero.create-invoice | allow  | invoice.received | script-inbox    |
| xero.create-payment | hold   | bill.payable     | client-accounts |

This is the Book-Keeper of the definition template, which gives every field, layer by layer, and what each check refuses. Everything it is given to work from is declared here: its conduct, on every turn; its instructions and the gst-return skill; the tools its rules give it; one document it always reads, how supplier names appear in Xero; and its bounds for one handling. It reaches Xero through the agent MCP gateway, over Xero's MCP server: the install's xero gateway, one Markdown file in the gateway template's form, declares the tools the rules can name, each with its kind, risk and schemas. The install declares two Principals: the script inbox, which publishes each supplier invoice from the accounts mailbox to invoice.received, and the client accounts, the program that sends a bill that may be paid to bill.payable.

On an invoice, it checks the figures with the calculator, records one bill, and answers done: three turns. On a bill to pay, it proposes the payment, which waits for the Operator's approval, and answers done. A bill over NZD 5,000.00 is refused by its check before the Gate decides. A payment proposed while handling an invoice is refused, since its rule names only bill.payable; so is anything for any other Principal, and everything else in Xero, because no rule lists it. The clauses marked counted are given to the model on every turn and enforced by nothing outside it. An effect is one of three, fixed in the Agent Mesh: allow, hold or refuse.


2. How It Works

The Book-Keeper, the Developer, the Planner and the Jira Watcher are examples, and none is fixed: each organisation that adopts the Agent Mesh defines its own Agents. The Agent Mesh has no workflow engine: an install's workflow runs as a chain of messages between its Agents (Chains of Messages, below).

The Operator works from the command line, outside the cluster, which calls the control API inside it; they are the control plane, with the Portal, the MCP server, the content server and the webhook ingress beside them. Schedules and expiries are NATS scheduled messages, so no process of the Agent Mesh keeps a clock for them. Each Agent is run by its own agent runtime, in its own pod: every Agent's pod runs the same two images, darkwave/agent-runtime and, beside it as a sidecar, darkwave/agent-mcp-gateway; only its definition, credentials, NATS identity and budget are its own. An Agent whose rules name a tool of a sidecar gateway of the install's, such as a calculator, runs that image too. NATS JetStream connects them; the control plane joins the same bus. The core is the message path and the Gate; everything else plugs in at a port.

The outside systems the Agents reach are examples too: the Book-Keeper defined above names only Xero's tools, and reaches Gmail and Docusign only once its rules name theirs. Jira's part is an example too, of a tracker; it is in Planning and Dispatch Through a Tracker, below. Every message an Agent handles takes these steps in order, as far as it gets, and each step it takes is recorded. Steps 3 to 7 repeat once for each turn; a read skips step 6.

  1. Received. The agent runtime takes the message from a sender whose identity has been proved, records it once, and counts the attempt against the Agent's attempt limit. The same message id from the same sender with different content is refused and recorded apart.
  2. Checked. The agent runtime checks the message against its contract. A message that fails the check is refused, never repaired.
  3. Assembled and estimated. For a model proposer, the agent runtime assembles the turn's context afresh from the record and records its manifest (Context Assembly, below). It estimates what the turn will cost, for a model from the whole context, and checks the estimate against the Agent's budget and the handling's bounds. Over the budget on the first turn, the message is refused; on a later turn, where work has been done, the handling stops.
  4. Proposed. The Agent's proposer, a model, a script or the Operator, answers the turn in one of three ways: it asks for a read, proposes one action, or says it is done. An answer that is not valid is recorded, and the next turn sees which check it failed; it is never asked again. If the proposer refuses instead, the message is refused.
  5. Gated. A read is allowed or refused by the Agent's rules, never held. An action goes to the Gate, which applies the Agent's rules to it, for the Agent and for the Principal the message acts for. The most restrictive matching rule decides: allow, hold for the Operator, or refuse; if no rule matches, the action is refused. An approved hold is decided again before anything is performed.
  6. Intended. Before acting, the agent runtime claims the action's intent in the record, with a lease longer than the gateway's timeout. Only the attempt that wins that claim performs; one that finds it already there never does.
  7. Performed. The agent runtime makes the read, or performs the action at most once: a message, on the bus; anything in an outside system, through the Agent's gateway. It records the result or outcome, which the next turn sees. A read changes nothing outside, so one cut off by a crash is made again. If the gateway gives no answer to an action, nothing is recorded, the action is never performed again on the Agent Mesh's own initiative, and the Operator is asked what happened.
  8. Closed. When the proposer says it is done, a bound is reached or the message is refused, the agent runtime raises anything the handling owes, writes the closing entry last, and the handling is over.

A refused message ends the handling; a refused read or action is something the Agent observes on its next turn. Some refusals also raise a problem for the Operator.


3. Features

What the Agent Mesh is designed to do, in alphabetical order.

3.1 Agent Runtime

The agent runtime takes each message through the steps in How It Works, above, recording each before it takes the next.

Within one handling, an Agent works in turns, and decides itself when the work is done: the runtime sends it no message to go on, and adds no instruction between turns. A refused or failed action is something the Agent observes and adapts to within the same handling, so no layer coordinates a transaction across handlings. The goal does not move: it is the message, with any criteria it carries, under the Agent's declared rules. The Agent writes its own plan as a short note with each answer; the note returns to it as data on later turns, does not outlast the handling, and no check reads it, the Gate included.

Each Agent declares its bounds for one handling: the turns, the actions, the cost and the size of a turn's context. At one of these, the handling stops, raises one problem for the Operator, and closes; the Operator may retry it. A hold in the middle of a handling parks it; once the hold is approved and decided again, the action is performed and the Agent goes on with its outcome. An action whose outcome is unknown ends the handling once the Operator states what happened. A person proposer answers one turn with one action.

It starts the Agent's handlings one at a time, in the subject's order, while other Agents run in parallel; a handling that waits on the Operator is parked and the next one starts, so actions are not always performed in that order. On start, including after a crash, and periodically, it reads the record for handlings with no closing entry and carries each one on from its first turn not yet settled, before any new message, except one that waits on the Operator; a turn whose answer was recorded is never asked again. A turn resumed counts an attempt, and at the Agent's attempt limit the handling stops and the Operator is asked. Stopping an Agent lets an action under way finish; its messages wait until it starts again.

It is a static Rust binary. The time the agent runtime's own path may take is written down as a latency budget, and a benchmark harness measures the runtime against it.

3.2 At-Most-Once Actions

The Agent Mesh never performs an action twice on its own initiative, however many actions a handling has. A message sent again under the same sender and id is handled once by each Agent that listens for it.

Every write has a key, and a repeat under the same key changes nothing: a publish by its sender and message id; a handling by the message and the Agent; each entry of a handling, written as a claim that one writer wins; an action by its handling and turn, its intent performed only by the holder of its lease; an answer by its exception id; a retry by the problem it answers; a scheduled message by its schedule, version and fire time; a reload by its revision. A gateway passes the action id to the outside system as its idempotency key where the system takes one; where it does not, at most once rests on the lease and on the gateway answering nothing when unsure.

3.3 Audit and Observability

The record is the audit trail: every step of every handling, in order, with the Principal the work acted for, the Gate's decisions and any answer from the Operator (Durability, below). dwmesh message trace lists one handling's entries in order. Telemetry goes through a port, Prometheus by default: each process logs one line per event to standard output and serves its metrics on its health port, including each turn's context size and each message's wait in its Agent's queue. An OpenTelemetry adapter carries traces.

3.4 Chains of Messages (no workflow engine)

Agents talk only through messages, sent to subjects on the bus; no Agent calls another. The Agent Mesh is not a workflow engine: it has no orchestrator. A workflow is choreographed: an install declares in its definitions the subjects each Agent listens to and may publish to, and the work runs as a chain of messages.

Work that takes several steps is a chain of messages: an Agent's action sends a message, another Agent handles it, and the Principal the work acts for travels with every message in the chain. No Agent waits on another, so a cycle of requests cannot deadlock, and a chain that never ends is ended by the budgets of the Agents in it. Each link is a handling, with its own check, Gate decisions and record. What a flow engine gives and this does not is a join: an Agent that must act only once several answers are in keeps that state itself.

3.5 Command Line

dwmesh is the Operator's surface in a terminal: a client of the control API, and through it of the content server, with one subcommand per operation and no logic of its own. Its nouns are the Agent Mesh's own terms. A person signs in through the install's own identity provider; a program runs under its own Principal and is refused every Operator-only command (Identity and Security, below). Every command that changes something confirms first; a script may pass --yes, except on an Operator-only command, which always confirms interactively, so a hold is never answered unattended. Output is plain text, or JSON with --json. It needs no Portal: everything the Operator must answer is answered from it (Operator, below). Its commands are in The Command Line, below.

3.6 Content Server

The content server is the one way an Agent reads what the organisation knows. An Agent never opens a source itself: it asks through a read tool, the Agent's rules allow or refuse each read, and the record keeps the query, the source and the revision of what came back, so an action can be traced to what informed it. What comes back enters the Agent's next turn as data, never as instruction. A source is content the install reviews and the content server serves at a recorded revision; a read tool of any other gateway reads an outside system as that system answers (Outside Systems, below).

Sources plug in as adapters behind one port. The Agent Mesh ships one, the doc server: it indexes one folder of Markdown, reads it and never writes to it, and answers searches. A tracker, a wiki or a store of records is another adapter, and nothing in the core changes for it. Whoever writes a source steers every Agent that reads it, so each source is trusted input, under the same review as the definitions. The content server is off by default, and listens only inside the cluster.

3.7 Context Assembly

Before a model proposer is asked, on every turn, the agent runtime assembles the context it is given afresh from the record, by code and never by a model, from the definitions at the version recorded when the message was received. The context has a fixed order:

  • the Agent's conduct and its instructions, or its role if it has none;
  • the tools it may use for this message, with their argument schemas;
  • the documents its definitions declare, read whole from the definitions and pinned by their SHA-256, so a changed document refuses the handling;
  • the Agent's own earlier handlings of the same work item, for the same Principal: their messages, actions and outcomes;
  • the message;
  • this handling's turns so far: each answer with its note, and each read result, outcome, refusal or failed check, whole;
  • optionally, the Agent's act-level instructions, repeated last, nearest the answer; off by default.

A skill's name and description are in every context, and its body when the message's subject is one the skill applies to. No instruction is carried by the model from one turn to the next: code places every instruction again, in the same place, on every turn. Each turn's context, up to its turns so far, begins with the previous turn's, so a provider's cache of an exact prefix can serve it; nothing is reused because it resembles something else. The earlier handlings are the Agent's own, not the chain of messages (Chains of Messages, above): nothing carries across Principals, no handling carries another Agent's handlings, and an earlier handling's notes and reads are never carried. The model reads nothing outside its context: what it reads during a handling, it reads through a read tool its rules allow, and the result enters its next turn (Content Server, above). It keeps no state of its own: what carries forward is what the record holds.

For each turn and attempt, a manifest is written to the record before the model is asked. It lists every piece of the context with its layer, source, version and size, and every older handling the window left out, so every action can be traced to what informed it. The full context is kept apart, and only the control API reads it, for the Operator; no Agent can read a context, its own included. A context over the Agent's ceiling or byte limit is never cut short: on the first turn it is refused before the model is asked, and on a later turn it stops the handling.

A model proposer answers each turn in a fixed shape: a read, one action, or done, with its note. A read names one read or compute tool the rules allow for this message and Principal; an action names one act tool they allow or hold. Neither may be a tool a rule refuses. Arguments are typed. Before the rules or the Gate decide, the agent runtime checks four things in order:

  • the answer is one answer of one of the three kinds;
  • its tool is one of those tools, of the kind the answer asks for;
  • its arguments match the tool's schema;
  • they pass the checks the Agent's definitions declare for that tool.

A done answer names no tool; only its shape and its note's length are checked. An answer that fails is recorded as given, naming the check it failed, and the next turn sees which check; it is never sent back to the model with new instructions, and never asked again. Invalid answers raise one problem for each Agent and period, however many there are.

None of this makes a model's answer the same each time. For the same version of the definitions and the same recorded entries, it makes what the agent runtime assembles the same, and it bounds what the model may propose. The Gate stays the guarantee. The Agent Mesh ships one model provider adapter, for Anthropic's models. How large each part may be, and how many earlier handlings its window keeps, are declared with each Agent.

3.8 Control API

The control API is the REST service the command line calls, the Deployment control-api behind its Service, reached through an HTTPRoute or a port-forward. It is a controller over the Agent Mesh's use cases, with authentication: it proves the Principal of a person or a program that calls it, and accepts an Operator-only command from the Operator alone (Identity and Security, below). Through it and the command line the Operator can also send an Agent a message and see its proposal, labelled as a proposal, when it is complete.

3.9 Costs and Budgets

Before each turn, its cost is estimated and checked against the Agent's budget for the period, a count of messages and a cost, and against the handling's own cost bound. The actual cost is recorded afterwards and can exceed the estimate. Once the budget is reached, the Agent's new messages are refused until the period ends, and the Operator is told once; spending can pass the budget by the overruns of handlings already under way.

dwmesh costs shows each Agent's estimated and actual cost for a period, against its budget.

3.10 Definitions and Templates

Agents, their rules and budgets, the gateways and their tools, the skills, the schedules, the subjects and their contracts, and the Principals are declared in Markdown: plain text files under version control. An Agent's name is at most 32 characters. The definitions are those files at one merged revision; NATS fires the schedules (Schedules, below). The Agent Mesh ships the templates, in layers: an Agent's definition, with the subjects it may publish to, its conduct, its checks, its skills, the documents it always reads, the sizes of its context and its bounds for one handling, and the Book-Keeper as its example Agent; its instructions; a gateway, with every tool it offers and each tool's kind, read, compute or act; a skill; a subject, with its contract and its publishers; a Principal; a schedule; the price table; and the definitions folder.

A skill is method and knowledge an Agent carries, a folder in Anthropic's SKILL.md form. It gives no authority: only an Agent's rules do, and the tools a skill uses must be within the rules of the Agent that carries it. Who may publish to a subject is declared on both sides, the subject and its publisher, so widening it takes both in one reviewed change. dwmesh definitions check checks the definitions offline (GitOps Configuration, below).

3.11 Durability

Each step of a handling is written to the record as an entry, in order, before the next step is taken, and the closing entry ends it. The record store outlives the Agent's pod; the Agent Mesh ships an adapter for NATS JetStream. The entries follow the steps: the message received, the first attempt and the check; for each later turn, its attempt; and for each turn, for a model the manifest, the estimate, the answer and its cost, then a read's decision and result, or an action's Gate decision, intent, outcome and cost; and the closing entry. The record is made durable before the proposer is asked, before a read is made and before any action is performed, provided the store makes a write durable before acknowledging it; for JetStream that means sync on every write, on a volume that honours fsync, and, where there is more than one server, replicas in separate failure domains. Before that first durable point a message is only as safe as the bus holds it. From its first durable point a handling is never lost: if a pod crashes, the agent runtime reads the record back on restart, counts a new attempt, and carries on from the first turn not yet settled. The one exception is an intent with no outcome: that action is never performed again, and the Operator is asked what happened. Each entry is written once and never changed: a second writer finds the entry already there and stops. With the intent's lease, and no retry after no answer, that is what keeps an action to one performance across crashes and restarts. The record is append-only and keeps every entry, message content included; the Agent Mesh deletes and rotates nothing, so an install sizes the store for that and decides what may enter a message. The figure shows one turn that proposes one action.

3.12 Action Gate

No action is performed unless a rule allows it, or holds it and the Operator approves and the Gate allows it again.

The Gate is plain code in the core. It reads the proposed action, the Agent's rules, the message's subject and the Principal the message acts for, which come from the record and no payload can change. It never reads the Agent's note or anything the Agent has read. Whatever a misled proposer proposes, the most it gets is what the rules allow that Agent for that Principal; within an allowed tool, the proposer still chooses the target. The Gate does not make an allowed action right, which is why the Book-Keeper above holds paying a bill for the Operator and allows only recording one. The same proposed action, for the same Agent, on the same subject, on behalf of the same Principal, under the same definitions and the same approval, always gets the same decision, and an error refuses. The rules are rows the Gate reads through a port, and every rule-row adapter is tested for the same behaviour. The figure shows one turn that proposes one action.

3.13 GitOps Configuration

Three kinds, three paths. Settings, what a process connects to and how it runs, come from environment variables only: one named variable per setting, listed by --help, read once at start, and a missing or invalid value refuses the start. Secrets come by a mounted file through the secrets port; the variable names the path, never the value. Definitions, what the Agents may do, live in a repository of the install's own, where every change to what an Agent may do is a reviewed pull request: dwmesh definitions check checks them offline before merge, and only the Operator's reload puts a revision in force, recording its version and reporting every change that widens what an Agent may do or moves a tool nearer the world. The template repository, darkwave-agent-mesh-config, holds the layout: definitions/, deploy/ as kustomize, the mesh version it configures, and the check in CI. A merge applies what a revision's Agents need to run, through kubectl apply -k or Flux or Argo CD; only the Operator's reload then puts its rules in force, so the order is always apply, then reload. NATS comes by its own chart.

3.14 Identity and Security

Every input is checked against its written contract where it enters: shape, size and encoding, not meaning. Input that fails the check is refused and recorded, never repaired. A well-formed hostile instruction passes the check, which is why there is a Gate.

Every message carries two proved identities, both Principals: its sender's, and the one the work acts for: whoever started the chain. Each is proved where the message enters, by the connection for an Agent's own messages and by the control API, the service the command line calls, for a person's or a program's, and never read from the payload. A person signs in through the install's own identity provider, as one Principal on every surface; a program proves itself to the control API by a credential issued at its enrolment. The Gate decides for the Principal the work acts for. A program at the command line runs under its own Principal, and the control API accepts an Operator-only command from the Operator's own identity alone.

On the bus, each message's subject carries its sender, and NATS lets each connection publish only where the permissions generated from the definitions allow, so the bus itself proves who sent a message. Every connection to NATS uses mutual TLS. Each process writes the record under its own identity, and only the keys its work needs: an Agent's own handlings, and for the control API a person's proposal or a stated outcome. The record is append-only: the server is configured to refuse deletes and rewrites, and encryption at rest is the volume's. Secrets are read by adapters and gateways only, never by the core; the credentials of the install's MCP gateways are mounted into the agent MCP gateway's container alone.

3.15 MCP Server

An MCP client, such as an agent outside the mesh, connects to the MCP server, through a route when the install exposes one, to reach the mesh's Agents and messages. The MCP server is a peer of the control API over the same use cases, not a client of it: it proves its caller's Principal as the control API does, adds no rule, and opens no path around the Gate. It is off until configured, and listens only inside the cluster unless configured otherwise.

3.16 Operator

Whatever only a person can decide reaches the Operator through one exceptions queue, and only the handling that asked pauses; everything else runs on, except an Agent over its budget, whose new messages are refused until the period ends. There are three kinds: an approval, when the Gate holds an action; a problem, when something went wrong, such as an action whose outcome is unknown or a handling stopped at a bound; and a proposal asked, when the Operator's own Agent is asked to propose. The Operator answers from the command line: approve or refuse, acknowledge, resolve or retry, or propose. Each answer is written to the record like any other entry, the first answer in time wins, and the handling that asked resumes from the record, or for a retry a new message starts. An approval or a proposal asked that is left unanswered expires as refused. A ticket an Agent passes to the Operator in a tracker is the Operator's second wait (Planning and Dispatch Through a Tracker, below). The Operator's own Agent has no hold rules: what a person proposes is allowed or refused, never approved by the same person.

The Portal is a second surface for the Operator (Portal, below).

3.17 Outside Systems

Outside systems are reached through gateways. Each gateway is one Markdown file of the install's, in the gateway template's form: how it runs, its timeout, the hosts it reaches, and every tool it offers. For each tool it declares its kind, read, compute or act; whether it is deterministic; its risk; its output limit; and its input and output schemas. A proposer sees a tool only as that file describes it, never as the outside server describes itself, and a tool's kind is never taken from the server. The rules can name only tools a gateway declares; the Agent's rules decide each read, and the Gate each action.

The Agent Mesh ships one gateway program, the agent MCP gateway, which serves every gateway file that names an MCP server: it runs as a sidecar container beside the agent runtime in each Agent's pod, holds the credentials, and reaches each system's MCP server. A compute gateway of the install's, such as a calculator, runs as a sidecar in the Agent's own pod, reaches nothing, and gives the same answer to the same input. A read or compute tool's result is kept whole in the record, or observed as too large; it is never cut short.

A gateway passes the action id on where the system takes one, times out before the intent's lease runs out, and answers succeeded, failed only when the action certainly did not happen, or nothing when unsure; the at-most-once guarantee rests on that contract, and the conformance kit tests it.

3.18 Planning and Dispatch Through a Tracker

The Operator and the Agents hand work to each other through tickets in a tracker, Jira for example. Two roles do this, each an Agent the install defines: the Planner, with its rules for the tracker's tools, and the Watcher, whose example is the Jira Watcher. The Planner raises, assigns and ranks tickets under those rules, which can hold an action for the Operator like any other. Assignment is the dispatch: an Agent takes up a ticket when its assignment reaches it as a message, and the Agent Mesh drives no sequence of its own.

Out, an Agent reaches the tracker through its gateway, over the tracker's MCP server; the install declares the tracker's tools in its gateway file, and the Gate decides each action. In, Jira's changes reach the Agents as messages on the ticket.* subjects, published by the Jira Watcher, an Agent with a script proposer, or by the webhook ingress (Webhook Ingress, below). On each firing of its schedule, the Jira Watcher reads what has changed in Jira through read tools its rules allow, and publishes each change as a ticket.* message, one action a turn, within its bounds. Any tracker fits the same pattern: a gateway out and a Watcher in.

There are two waits, each kept in its own record. An action the Gate holds waits in the exceptions queue, in the Agent Mesh's record, and is answered through the control API. A ticket passed to the Operator waits in the tracker, in the tracker's history; the Operator answers there, and the answer comes back as a new message that starts a new handling. Nothing in the tracker enters the exceptions queue.

3.19 Portal

The Portal is the Operator's surface in a browser, beside the command line: a client of the control API that adds no logic and answers the same exceptions. A person signs in as on the command line (Identity and Security, above).

3.20 Proposers

Each Agent has one proposer, which answers each turn of a handling (Agent Runtime, above). A proposer is a model, through a provider adapter, such as the one for Anthropic's models; a script, plain code for work that needs no model; or a person, the Operator, who is asked and answers from the command line, one turn with one action. The Operator also has an Agent of their own, the one whose proposer is a person. An Agent may carry skills, method and knowledge for its proposer (Definitions and Templates, above).

3.21 Schedules

A schedule, declared in the definitions, sends a message at its times, at an interval or by a cron expression in its time zone. Schedules and the expiries of unanswered approvals and proposals asked are NATS JetStream scheduled messages: the control API sets them, and NATS fires them, so the Agent Mesh keeps no clock of its own for them. Each fired message is keyed by its schedule, version and next fire time, so a repeat is acted on once (At-Most-Once Actions, above); an interval schedule fired again late can get a new key, and a reload restarts its interval.

3.22 Supported Platforms

The Agent Mesh targets three platforms, each with its own guide: kind, for CI and local work; K3s, on a single server; and Amazon EKS, across three zones. A platform is supported when it meets the cluster's contract and the conformance runs pass on it. The contract: a supported Kubernetes minor version, NATS Server 2.14 or later, a network plugin that enforces network policies, volumes for NATS that honour fsync, Pod Security's restricted profile, the Gateway API or a port-forward to reach the control API, and nodes that are amd64 or arm64. The install builds the images, darkwave/agent-runtime, darkwave/agent-control-api and darkwave/agent-mcp-gateway among them, from source into its own registry.

3.23 Verified by Specification

The message path, the agent's turns included, is specified in TLA+, a language for specifying systems, and model-checked within its model's stated limits, in CI. Among the properties checked: each action, however many a handling has, is performed at most once; no read or action happens without its allow recorded before it; each turn is settled before the next; and nothing is asked after the Agent says it is done. A scenario suite, scripted from the specification's sequences, runs against the code. Each guarantee has an ID; a proof map names the TLA+ property, test suite or stated assumption behind it, and its limits, and a test that checks it carries the same ID where there is one.

3.24 Webhook Ingress

The webhook ingress takes an outside system's webhooks and publishes them as messages: it proves the sender's Principal, checks the input at the edge and publishes to the bus. It adds no rule. It is not the control API, which carries the Operator's and programs' commands.


4. The Command Line

How dwmesh is used; what it is, and who may run what, is in Command Line, above.

dwmesh definitions check definitions/            # offline, in the config repository's CI: every rule names a tool a gateway declares
dwmesh agent list                                # every Agent, its state and its budget this period
dwmesh agent start book-keeper                   # Operator only; its open handlings resume first
dwmesh exception list --kind approval            # what is waiting on the Operator
dwmesh exception approve 7f3a                    # Operator only; the Gate decides the action again
dwmesh exception resolve 2c19 --outcome failed   # Operator only; states what an unknown action did
dwmesh message trigger invoice.received --id inv-42 --content - --yes < invoice.json
                                                 # a script publishes a message under its own identity
dwmesh message trace --agent book-keeper <trace id>   # one handling's entries, in order; a trace id is the sender and the message id
dwmesh handling context --agent book-keeper <trace id>   # Operator only; each turn's assembled context
dwmesh handling list --open --agent book-keeper  # handlings with no closing entry
dwmesh costs --period 2026-10                    # estimated and actual cost, against each Agent's budget
dwmesh health                                    # the bus, the record store, and each Agent's last entry and open handlings
dwmesh doc search "<query>"                      # Operator only; what an Agent's own search of the content server would return

5. Extending It

Models, the bus, the record store, the rule rows, telemetry and secrets plug in at ports: interfaces the core, the message path and the Gate, defines and an adapter implements. One conformance kit tests every adapter of a port against the same contract.

There are six ways to extend an install: three are files, and three are development, a custom MCP server of the install's own, a content source and a custom Rust adapter built into a release.

  • Add an Agent: one Markdown file, as above. It takes effect at the next reload of the definitions.
  • Connect a system: one Markdown file, a gateway, declaring the system's tools; the agent MCP gateway needs no change (Outside Systems, above).
  • Add a skill: one folder in SKILL.md form, carried by any Agent whose rules cover the tools it uses.
  • Build an MCP server: custom development, in any language, for a system that has no MCP server of its own. The install runs it, and connects it with one gateway file like any other; it answers as the gateway's contract needs, taking the action id where it can and reporting a failure only when the action certainly did not happen (Outside Systems, above). It is not the Agent Mesh's own MCP Server (MCP Server, above).
  • Add a content source: custom Rust development, an adapter of the content server's port for a source beyond the Markdown folder (Content Server, above).
  • Swap a part: custom Rust development. A model provider, the bus, the record store, the rule rows, telemetry or secrets is each an adapter of a port: a Rust crate that implements the port's trait, built into a release, which passes the conformance kit before it is trusted.

Nothing in the core changes for any of the six.

5.1 Connector Catalogue

Examples only: systems whose vendors provide their own MCP server, most hosted by the vendor; a row marked "run by the install" is a server the install runs itself. Any system with an MCP server connects the same way, with one gateway file (Outside Systems, above). The table shows the reach, not a support list: none is tested by the Agent Mesh, and each server's tools, terms and availability are its vendor's.

System What an Agent reaches The vendor's MCP server
Asana Tasks, projects and goals Asana MCP server
Atlassian Jira work items, Confluence pages Atlassian Rovo MCP
AWS AWS APIs and documentation AWS MCP Server
Azure Azure resources, under the caller's Azure roles (run by the install) Azure MCP Server
Box Files, folders and content Box MCP Server (remote)
Canva Designs, assets and exports Canva MCP
Databricks Data, Unity Catalog functions and Genie spaces MCP on Databricks
Docusign Agreements, envelopes and signing Docusign MCP Server
Dropbox Files and folders Dropbox remote MCP server
GitHub Repositories, issues and pull requests GitHub MCP Server
Gmail Mail: search, read and drafts (a developer preview) Google Workspace MCP servers
Google Calendar Calendars and events (a developer preview) Google Workspace MCP servers
Google Docs Documents (a developer preview) Google Workspace MCP servers
Google Drive Files and folders (a developer preview) Google Workspace MCP servers
Google Sheets Spreadsheets (a developer preview) Google Workspace MCP servers
Google Slides Presentations (a developer preview) Google Workspace MCP servers
Grafana Cloud Dashboards, metrics, logs and alerts Grafana Cloud MCP servers
HubSpot CRM records HubSpot MCP Server
Intercom Customer conversations and contacts Intercom MCP server
Linear Issues, projects and cycles Linear MCP server
Lucid Lucidchart and Lucidspark documents and diagrams Lucid MCP server
Microsoft 365 Mail, calendar, meetings, Teams messages and documents, through Work IQ (run by the install; billed through Copilot Studio) Work IQ
monday.com Boards, items and updates monday.com MCP
MongoDB Databases and collections: hosted for Atlas (run by the install for any other deployment) MongoDB MCP Server
Neon Serverless Postgres projects and databases Neon MCP Server
Notion Pages and databases Notion MCP
Oracle Database SQL and PL/SQL through SQLcl (run by the install) Oracle MCP Servers
PayPal Orders, invoices, payments and disputes PayPal MCP server
Redis Keys and data structures (run by the install) Redis MCP Server
Salesforce CRM records and Salesforce data Salesforce Hosted MCP Servers
Slack Channels, messages and search Slack MCP server
Snowflake Data, Cortex Search and Cortex Analyst Snowflake-managed MCP server
Sourcegraph Code search and navigation across an organisation's repositories, on its Sourcegraph instance Sourcegraph MCP Server
SQL Server and Azure SQL Tables and views through Data API builder (run by the install) SQL MCP Server
Stripe Customers, payments, invoices and subscriptions Stripe MCP
Supabase Postgres databases, auth and storage Supabase MCP Server
Xero Accounting: contacts, invoices, bills and payments Xero remote MCP
Zoom Meetings, recordings and summaries Zoom MCP servers

A system with no MCP server of its own is reached by building one (Extending It, above).


6. Who Builds It

Darkwave Trading Limited, a proprietary trading firm in New Zealand. Darkwave Trading builds the Agent Mesh to run its own agentic business.


7. Built With

The agent runtime, the control API and dwmesh are written in Rust, as static binaries with no interpreter or virtual machine beneath them.


8. Contributing

Contributions are not taken, and pull requests are not reviewed. GitHub receives releases, and nothing is merged there.


9. Licence

Licensed under the Apache License 2.0; see LICENSE.

Xero, Gmail, Google Workspace, Google Calendar, Google Docs, Google Drive, Google Sheets, Google Slides, Microsoft 365, Work IQ, Azure, Teams, Copilot Studio, Docusign, GitHub, Slack, Claude, Atlassian, Rovo, Jira, Confluence, AWS, Grafana, HubSpot, Lucid, Lucidchart, Lucidspark, Asana, Canva, Linear, Notion, Salesforce, Sourcegraph, Stripe, Box, Databricks, Unity Catalog, Dropbox, Intercom, monday.com, MongoDB, Atlas, Neon, Oracle, PayPal, Redis, Snowflake, Cortex, PostgreSQL, Postgres, SQL Server, Supabase, Zoom, Kubernetes, K3s, Amazon EKS, NATS, Prometheus, Flux and Argo CD are trademarks of their owners; the Agent Mesh is not affiliated with or endorsed by them. The Rust logo is a trademark of the Rust Foundation, shown under CC BY 4.0 to say what the Agent Mesh is written in; the Rust project endorses nothing here. The figures' Kubernetes icons are from the Kubernetes Icons Set, under the Apache License 2.0.

© 2026 Darkwave Trading Limited