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_idin every composite key. Embed the migrations and run them under a Postgres advisory lock, so replicas can start together. - Shared code. Take
people,idsandpagefromt10-modkit, andwebsessionandframeif you have a web app. Add the repo toscripts/sync-modkit.shandscripts/check-modkit.sh, then run the sync, which puts a snapshot inthird_party/t10-modkit. - Docs for coding agents. Serve
/docs/mcpwitht10-modkit/docsmcp, as the docs contract describes, and add the image to its suite. - Health.
GET /healthzanswers200while the process runs, andGET /readyz200while the database answers. - The manifest.
GET /v1/moduletakes 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 forapp,nav,attentionandevents. - The spec. Keep
docs/openapi.yamlanddocs/api.md, and add a test that fails when the spec and the registered routes differ, liket10-collab/internal/server/openapi_test.go. - A port. Take the next free one from the workspace
README.md.8084is 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.
- Register the service: add it to
auth-server/deploy/setup.shand the Compose secrets, and label its podst10.dev/auth-client. See Register a service. - Copy
auth-server/verifierinto the repo asverifier/, and add the repo to the verifier copies inscripts/check-contracts.sh, somake checkcatches drift. - Verify each request with it, as Verifying a token shows. Never read
subyourself.
| 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.Memberreads one member.CachedReportsis up to 60 seconds old and only for visibility. Fail closed whenauth-servercan't answer. - Actions. Name them
<prefix>:read,write,deleteandexport, 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>/, likedeploy/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 inclients.yaml, mark itoptional, 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.
- Add an
agentblock to the catalog entry:{"server": "<id>", "audience": "t10-<id>", "actions": [...]}. - On
ai-gateway-tools, add<id>=t10-<id>@<url>toTOOL_SERVERSand<id>toTOOL_MODULE_SERVERS, inai-gateway/deploy/k8s/ai-gateway.yaml. Harnesses list/mcp/modulesas one server, so they pick up the tools when they restart. - Add the actions and audience to each runtime under
runtimesinauth-server/clients.yaml:agent-pi,agent-ti,t10-livekit-agentandt10-automations. Without the voice worker's entry, the tools disappear on calls. - Add them to
GRANT_ACTIONSandGRANT_AUDIENCESinagent-pi/deploy/k8s/agent-pi.yamland int10-agents/agents/ti/agent.json, and toAUTOMATION_ACTIONSandAUTOMATION_AUDIENCESint10-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 checkin 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.