Docs Guides

Build a business module

Build a t10 business module end to end: the service, tokens, access, contract routes, agent tools, events and screens, in order.

A business module is a service that owns one kind of tenant data and the access rules for it, such as tasks, documents or property records. This guide is the order of work, from an empty repo to a module people and agents use. The rules themselves are in the module contract, and each step links to the reference it relies on.

Three modules show the shapes a new one can take:

Module Copy it for
t10-knowledge The smallest complete module: manifest, policy, /mcp, screens compiled into Workbench
t10-collab Notifications, attention counts, settings, departures, and events for t10-automations
t10-property, in its own project made from t10-template since Nov 28, 2026 A module with its own web app, its own assistant, and business roles

Before you start: decide two things#

Where the work lives. A domain's own work stays in its module: a property work order is tracked and closed in Property. A request between people about a record, such as "please review this", is a work item in t10-collab that links to your record. If your module's work is mostly requests between people, declare a typed item in collab instead of building offers, inboxes and history yourself. See "Where work lives" in the contract.

Whether it gets its own app. A capability module, such as knowledge, compiles its screens into Workbench and is set up in Workbench's Administration. A business application that people work in all day, such as property, gets its own web app, linked from Workbench's menu and the landing page. See proposals/business-module-apps.md.

1. Create the service#

Make a repo t10-<id> with its own Postgres database. It must build and test with nothing from the workspace.

  • Data. Put tenant_id in every composite key. Embed the migrations and run them under a Postgres advisory lock, so replicas can start together.
  • Shared code. Take people, ids and page from t10-modkit, and websession and frame if you have a web app. Add the repo to scripts/sync-modkit.sh and scripts/check-modkit.sh, then run the sync, which puts a snapshot in third_party/t10-modkit.
  • Docs for coding agents. Serve /docs/mcp with t10-modkit/docsmcp, as the docs contract describes, and add the image to its suite.
  • Health. GET /healthz answers 200 while the process runs, and GET /readyz 200 while the database answers.
  • The manifest. GET /v1/module takes a person's token and answers {"id", "api_version", "action_prefix", "enabled", "features"}. A client shows the module only while this answers. See "The manifest" in the contract for app, nav, attention and events.
  • The spec. Keep docs/openapi.yaml and docs/api.md, and add a test that fails when the spec and the registered routes differ, like t10-collab/internal/server/openapi_test.go.
  • A port. Take the next free one from the workspace README.md. 8084 is the mobile web service.

2. Accept tokens#

Every caller brings an auth-server token, and the module takes the tenant only from it, never from a request.

  1. Register the service: add it to auth-server/deploy/setup.sh and the Compose secrets, and label its pods t10.dev/auth-client. See Register a service.
  2. Copy auth-server/verifier into the repo as verifier/, and add the repo to the verifier copies in scripts/check-contracts.sh, so make check catches drift.
  3. Verify each request with it, as Verifying a token shows. Never read sub yourself.
Token Comes from What the module does
A person's, aud=t10 Workbench, your web app, the mobile app Checks the person's own access
A delegated one listing your service An agent's run, at /mcp only Needs the action on the token and on every grant, then the person's own access
A service's own t10-notify, t10-automations Only for the routes made for it, such as attention counts

Refuse delegated tokens on every /v1 route. Agents reach the module only through /mcp.

3. Decide who sees what#

Put every rule in one policy package, used by both routes and agent tools, like t10-knowledge/internal/policy.

  • Apply it in SQL, before paging. A record the caller can't see answers 404, the same as a missing one.
  • Read org facts fresh for authorization. people.Member reads one member. CachedReports is up to 60 seconds old and only for visibility. Fail closed when auth-server can't answer.
  • Actions. Name them <prefix>:read, write, delete and export, plus your own.
  • Business roles, optional. If people other than tenant admins need to manage the module, declare permissions in a catalog entry at deploy/k8s/catalog/<id>/, like deploy/k8s/catalog/collab/, and list it in each overlay. Check them with the entitlement read on every protected request, never cached. See Business roles. If the module has its own runtime in clients.yaml, mark it optional, so taking the module out of an overlay leaves its permissions unavailable without deleting any tenant's roles.

4. Serve the contract's routes#

Each is a row of the module contract table. Collab meets them all.

Route For
GET /v1/notifications?after=, POST /v1/notifications/read The bell in every app
GET /internal/v1/attention?tenant=&user= Counts for Home and the digest. Service token only, and no titles or names
GET /v1/settings, PUT /v1/admin/settings Settings, and the tenant admin's changes. Check the admin role yourself
A departures job People leaving. auth-server sends no events, so act only on an explicit Departed()

Export telemetry to OTEL_EXPORTER_OTLP_ENDPOINT, continue an incoming traceparent, and mark spans with t10.session.id from X-Session-ID. Spans hold no record text.

5. Give agents tools#

Optional. Serve POST /mcp: one JSON-RPC message per request, with no session or stream. initialize, ping and tools/list need no token. tools/call needs a delegated token.

  • Name tools <prefix>_*, and run them through the same policy as the routes.
  • Mark text other people wrote as data, so the model doesn't read it as instructions: collab answers each result as JSON inside one <module_record> tag.
  • Let agents propose changes for a person to approve, rather than change records directly, as property does.

Then wire it up. A missing setting fails quietly: the tools just aren't there. scripts/check-module-agents.py, part of make check, names each one that's missing.

  1. Add an agent block to the catalog entry: {"server": "<id>", "audience": "t10-<id>", "actions": [...]}.
  2. On ai-gateway-tools, add <id>=t10-<id>@<url> to TOOL_SERVERS and <id> to TOOL_MODULE_SERVERS, in ai-gateway/deploy/k8s/ai-gateway.yaml. Harnesses list /mcp/modules as one server, so they pick up the tools when they restart.
  3. Add the actions and audience to each runtime under runtimes in auth-server/clients.yaml: agent-pi, agent-ti, t10-livekit-agent and t10-automations. Without the voice worker's entry, the tools disappear on calls.
  4. Add them to GRANT_ACTIONS and GRANT_AUDIENCES in agent-pi/deploy/k8s/agent-pi.yaml and in t10-agents/agents/ti/agent.json, and to AUTOMATION_ACTIONS and AUTOMATION_AUDIENCES in t10-automations/deploy/k8s/t10-automations.yaml.

ai-gateway/docs/api.md describes /mcp/modules, and t10-knowledge/docs/api.md is a small example of the tools' reference.

6. Post events#

Optional, for automations and agent teammates that react to your records. List the event kinds in the manifest as trigger_events, and post each event from an outbox to t10-automations's POST /v1/events with the module's service token, at least once. The fields are in the contract's "Events" row, and t10-automations/docs/api.md is the receiving end.

7. Show it to people#

Compiled into Workbench. Add web/src/modules/<id>/ exporting one WorkbenchModule (routes, nav, palette entries, Home rows, admin and notification labels), and list it in web/src/modules/index.tsx. Then add the module to the deployment's MODULE_URLS (<id>=http://…) or as a key in the workbench-modules ConfigMap. Workbench reaches it at /api/modules/<id>/… and adds the person's token. See module-visibility.md.

Its own web app. Add app and nav to the manifest and answer GET /v1/me/nav, so Workbench's menu and Home draw it with no code of their own. Build the app on the web kit in t10-modkit/web and websession, so it shares the frame, the sign-in and the one sign-out. Register it as a client and sign people in as Sign people in and call t10 describes. Add an app block to the catalog entry, and its address to AUTH_APP_URLS, so the landing page offers it. See one-system.md.

The mobile app reaches modules through the public modules ingress, deploy/k8s/modules-ingress.yaml, which isn't deployed yet.

8. Check it#

  • The module's own tests, including the spec test.
  • make check in the workspace: modkit and verifier copies, agent tool settings, and docs.
  • Deploy it to the local cluster and try it as a person in Workbench, and as an agent through /mcp/modules.

Steps 2, 5 and 7 are mostly configuration. A new module changes no code in auth-server, the harnesses or the voice worker, and none in Workbench outside its own folder.

Generated from t10’s own docs (bbc3cde). Spotted a problem? Tell us.