machine init · machine ship · one repo · any model
# Schema version 2. The runtime is OpenCode.runtime: opencode project: name: Northwind # Secret NAMES only. The values are encrypted in the# platform and injected when the machine boots.env: required: [STRIPE_API_KEY] optional: [LINEAR_API_KEY] # The machine a session boots on.sandbox: default: python templates: - slug: python image: python:3.12-slim cpu: 2 memory: 4 # Reach into the outside world. The definition is in# git. The credentials never are.connectors: - slug: gmail-read provider: pipedream app: gmail authorization_strategy: user # Governance: what each agent may touch, never what# it says. A grant you leave out resolves to none.agents: invoice-clerk: sandbox: python connectors: [gmail-read] secrets: [STRIPE_API_KEY] skills: [reconcile-invoices]The Machine layer. One file, at the root of the repo.
{ // Docs: https://opencode.ai/docs/ "$schema": "https://opencode.ai/config.json", "theme": "system", // The session is already an isolated machine on a // throwaway branch, so the agent starts wide open. // Tighten per tool here when you want a stricter // policy. "permission": "allow"}The runtime: models, tools, permissions. It sits in the runtime folder.
---description: Reconciles invoices against payments.mode: primarypermission: bash: ask--- You are the invoice clerk for Northwind. Match every payment to an invoice by number, neverby amount. When you cannot, open a change requestand say exactly what you could not reconcile.The agent. A stock OpenCode agent file, and the place its instructions live.
# what does the company believe about pricing?$ grep -rhi "annual" --include=MEMORY.md .never quote annual before the security review # who is allowed to touch the Stripe key?$ grep -rhn "STRIPE_API_KEY" --include="*.yaml" .10: required: [STRIPE_API_KEY]36: secrets: [STRIPE_API_KEY] # who changed the invoice clerk, and when?$ git log --oneline -- '*agents/invoice-clerk.md'8f2a1c4 invoice-clerk: stop guessing at refunds1d90b73 invoice-clerk: first draft of the persona## Matching a payment to an invoice 1. Pull the invoice by number, never by amount.2. If the amounts differ, flag it for a human.2. If the difference matches a refund already on file, close it as a partial refund and note the refund id on the invoice.3. If they differ for any other reason, flag it for a human and say what you checked. Never issue a refund yourself.triggers: - slug: memory-reflector name: Memory reflector type: cron agent: memory-reflector enabled: false cron: "0 0 3 * * *" timezone: UTC prompt: | Reflect on the last 24 hours of project activity. Review git history, merged change requests and session digests. Update the memory folder and open one change request titled `memory: ...`. Exit without one when there is no durable knowledge.A trigger sits in the same file as everything else. Starter projects ship theirs switched off.
# turn any directory into a Machine$ machine init # check it compiles, ask for the missing secrets,# push it up, and bring the whole thing live$ machine ship # from here it is just a repo$ git clone git@github.com:northwind/northwind.git$ git revert 8f2a1c4$ machine cr