Governance template
Copy templates/governance-bot/ into the implementation repo. Fill in decide(). Run the fixtures.
Files
templates/governance-bot/
README.md
bot.ts
config.schema.json
default.config.json
input.fixture.json
expected.output.json
tests.spec.ts
Bot interface bound
This template implements Bot<ReconcileTick, ReportEnvelope>. The contract is the canonical bot interface.
The only function you write
async decide(input: ReconcileTick, ctx: BotContext): Promise<ReportEnvelope> {
const onchain = await this.fetchOnchain(input.scope);
const internal = this.store.snapshot(input.scope);
const diff = compare(onchain, internal);
if (diff.matches) {
return envelope(ctx, "GOV_RECONCILE_OK", "info", { scope: input.scope });
}
return envelope(ctx, "GOV_RECONCILE_MISMATCH", "critical", { scope: input.scope, diff });
}
What's already wired for you
init(),validateInput(),explain(),emit(),health(),setMode().- ReportEnvelope construction with correlation IDs, builderCode, killSwitchState.
- The full test harness — unit, integration, property, failure-injection.
- Config schema validation; the bot crashes on init if its config violates a hard threshold.
Promotion checklist
- Implement
decide(). - Run
npm test— all four test classes must pass. - Open a PR with the bot's spec page linked in the description.
- Promote through the modes ladder:
stub → shadow → advisory → enforced.