Skip to content

Agent Mesh

An agent mesh for Kubernetes, on NATS.

Agents at work on one bus: each a machine actor in a hexagon, holding the Markdown file that declares it; a ring round each shows its budget, its arc how much it has used; one is taking a message. Messages travel along the bus. Every step each actor takes falls as a mark onto the record beneath. One agent's action is marked hold: it waits at a bar on its stem, and a dotted line runs from it to the one person at the bus's left end, who is on the bus like every other actor and whose steps are recorded too.Agents at work on one bus: each a machine actor in a hexagon, holding the Markdown file that declares it; a ring round each shows its budget, its arc how much it has used; one is taking a message. Messages travel along the bus. Every step each actor takes falls as a mark onto the record beneath. One agent's action is marked hold: it waits at a bar on its stem, and a dotted line runs from it to the one person at the bus's left end, who is on the bus like every other actor and whose steps are recorded too.

What it is

The Agent Mesh runs AI agents on Kubernetes. Each Agent is one Markdown file: the messages it handles, who proposes its actions, a model, a script or a person, and the actions it may take. An action the file does not list is refused. One marked hold waits for a person. Every step is written to the record before the next is taken, and nothing is done twice on the mesh's own initiative.

It is deliberately small. It is not a store: it keeps nothing but the record and a queue of exceptions. It is not a model host: it ships no model, and reaches every model through an adapter and every outside system through a gateway. And it is not a service mesh: a service mesh sees the traffic between services, but cannot promise that an action happens at most once. This one can.

Defined in Markdown, not a workflow

Defined in Markdown

Agents, their rules and budgets, the schedules, the subjects and the connections to outside systems are plain Markdown files under version control. Every change to what an Agent may do is a reviewed pull request, checked offline before merge, and only the Operator's reload puts it in force.

Not a workflow engine

Agents talk only through messages; no Agent calls another, and no flow is defined or driven. Work of several steps is a chain of messages, each link checked, gated and recorded, and the Principal the work acts for travels with every message. No Agent waits on another, so a chain cannot deadlock, and one that never ends is ended by the budgets of the Agents in it.

An Agent, in one file

The Book-Keeper, one of the example Agents that ship with the mesh. It reaches Xero through its gateway, over Xero's own MCP server.

---
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 |

It may record a bill for an invoice the inbox script sent. Paying a bill waits for the Operator. A payment proposed while handling an invoice is refused, and so is anything else in Xero, because no rule lists it.

Business teams, built on the mesh

Adopting the Agent Mesh means riding the current wave of AI as an organisation, not as one person in one chat. A Team is a business function declared in plain files that any capable model reads: its roles, its rules and the gates kept for a person. Every release of the models makes the whole team more capable at once, and the team itself does not change. That is how Darkwave is built, and the gain is measured at each release, never assumed.

Each Team is a separate product built on the mesh; the mesh stays free. One person holds every gate in every Team. Every agent's brief is written to one guideline and tested before it ships, and again before any change of model.

The Scrum TeamIn development

A ready-made software development team. It runs in a coding agent today, and on the Agent Mesh, unattended.

  • Product Owner, Scrum Master and Developers, each an agent.
  • Priority, scope and each release are the one person's decisions. Take the Product Owner's seat yourself, or leave it to the agent and decide at the gates.
  • Every Scrum event: Sprint Planning, the Daily Scrum, Sprint Review and the Retrospective, with backlog refinement, and a Scrum of Scrums across teams.
  • A Product Goal, a Sprint Goal and a Definition of Done.
  • A Jira configuration your Jira administrator applies.

Two editions. Starter is free and open: the roles, their hand-offs and the events. Advanced is licensed: the full role definitions, the checklists, each ceremony step by step, and the Jira configuration.

The Platform TeamIn development

Releases and runs what the Scrum Team builds, on Atlassian's default branching and deployment model.

  • DevOps Engineer and Site Reliability Engineer, each an agent.
  • Every merge to the production branch, deployment and promotion is the one person's decision.

The Accounting TeamIn development

Keeps a small New Zealand company's books in Xero, and prepares everything for its outside accountant, who stays and files.

  • Bookkeeper, Accountant and Auditor, each an agent; the Auditor checks the others' work.
  • Approving and paying a bill, posting to the books and handing over each return are the one person's decisions.

Interested? Let us know.

How a message travels

Every message an Agent handles takes these steps, in this order, as far as it gets. Each step is recorded.

  1. ReceivedThe agent runtime takes the message from a sender whose identity is proved, records it once, and counts the attempt against the Agent's limit. The same message id from the same sender with different content is refused and recorded apart.
  2. CheckedThe message is checked against its contract. One that fails is refused, never repaired.
  3. EstimatedThe runtime estimates what handling the message will cost and checks it against the Agent's budget. Over budget, the message is refused.
  4. ProposedThe Agent's proposer, a model, a script or the Operator, proposes one action. If it refuses instead, the message is refused.
  5. GatedThe Gate applies the Agent's rules to the action, 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. A hold that is approved is decided again before anything is performed.
  6. IntendedBefore acting, the runtime claims the intent in the record, with a lease longer than the gateway's timeout. Only the attempt that wins the claim performs; any other finds it there and stops.
  7. PerformedThe action is performed at most once: a message on the bus, or a call to an outside system through the Agent's MCP gateway, the sidecar beside it. The outcome is recorded, succeeded or failed. If the gateway gives no answer, nothing is recorded, the action is never retried on the mesh's own initiative, and the Operator is asked what happened.
  8. ClosedThe closing entry is written last, and the handling is over.

The whole mesh: the README’s How It Works figureThe whole mesh: the README’s How It Works figure

What it is built to do

The Gate

No action is performed unless a rule allows it, or holds it and the Operator approves. The Gate is plain code: it reads the action, the rules and whom the work is for, never the message's content, so a misled proposer gets no more than the rules allow.

At most once

The mesh never performs one handling's action twice on its own initiative. Every write has a key, and a repeat under the same key changes nothing.

Recorded, and recovered

Each step is written to the record before the next. After a crash the agent runtime reads the record back and carries on; an action with no recorded outcome is never repeated, and the Operator is asked.

One person, one queue

Whatever only a person can decide reaches the Operator through one exceptions queue: approvals, problems and proposals asked. Only the handling that asked pauses.

Budgets

Each Agent has a budget of messages and cost for a period, and each handling's cost is estimated against it before its proposer is asked. Once it is reached, new messages are refused and the Operator is told once.

Proposers

Each Agent's actions are proposed by a model, in the cloud or in the cluster; a script, for work that needs no model; or a person.

Checked against a specification

The message path is specified in TLA+ and model-checked; v1.0 runs the checks in CI, and a proof map names what stands behind each guarantee.

Context, configured

What a model is given is assembled by code, never by a model: the Agent's instructions, from the definitions at the revision recorded for the message, and the message. Each handling records a manifest of that context. The model answers with one action from the tools the Agent's rules name, checked before the Gate decides.

Connect and extend

Add an Agent

One Markdown file.

Connect a system

One Markdown file: an MCP connection to the vendor's own MCP server.

Build an MCP server

For a system with none, in any language.

Swap a part

A model provider, the bus, the record store, the rule rows, telemetry or secrets: each a Rust adapter that passes the conformance kit.

Nothing in the core changes for any of the four. The README's catalogue lists the systems whose vendors provide an MCP server, from Xero, Jira and GitHub to Salesforce, Stripe and Snowflake. They show the reach, not a support list: none is tested by the Agent Mesh before v1.0.

What v1.0 holds

  • The message path, specified in TLA+ and model-checked in CI
  • The Gate, the exceptions queue, and the Operator's command line, dwmesh, over a REST control API
  • Agents, rules, budgets and schedules in Markdown, with templates and example Agents
  • One agent MCP gateway beside each Agent, holding its connections' credentials
  • The bus and the record on NATS JetStream; telemetry through Prometheus by default
  • kind, K3s and Amazon EKS as supported platforms, each with its guide
  • Each proposer's context assembled from the definitions, its answer held to one action's schema, and its manifest recorded

Planned After v1.0: a web portal; four-eyes approval, where a second person approves a held action; a webhook ingress; an MCP server; a doc server that lets Agents search a folder of Markdown; checking the runtime's own traces against its specification; a Helm chart and published container images.

Status and licence

Status
Coming soon (2026)
Licence
Apache License 2.0
Built by
Darkwave Trading, to run its own agentic business
Built with
Rust, as static binaries

Velocity Edge builds on it for clients.

Tell us about your system

We reply within two New Zealand business days.

Request a call