Execution template
Copy templates/execution-bot/ into the implementation repo. Fill in decide(). Run the fixtures.
Files
templates/execution-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<OrderIntent, ExecutionPlan>. The contract is the canonical bot interface.
The only function you write
async decide(input: OrderIntent, ctx: BotContext): Promise<ExecutionPlan> {
const book = ctx.signal<OrderBookSnapshot>("order_book") || throwStale();
const steps = this.shape(input, book, this.config);
const fees = this.estimateFees(steps);
const slip = this.estimateSlippage(steps, book);
return {
schemaVersion: "1.0.0",
planId: ctx.correlationId + ":plan",
intentId: input.intentId,
steps,
estimatedFeesPusd: fees,
estimatedSlippageBps: slip,
expiresAt: input.expiresAt,
};
}
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.