init_chain
Initialize a tamper-evident continuity chain to attest and log AI agent tool calls against sealed cryptographic references for policy enforcement.
Instructions
Initialize continuity chain (alias for aga_init_chain). (Claim 3a)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| specification_hash | No |
Implementation Reference
- src/tools/init-chain.ts:5-13 (handler)The `handleInitChain` function initializes the continuity chain by creating a genesis event, storing it in the context's storage, and updating the context state.
export async function handleInitChain(args: { specification_hash?: string }, ctx: ServerContext) { if (ctx.chainInitialized) return ctx.error('Chain already initialized'); const genesis = createGenesisEvent(ctx.chainKP, args.specification_hash ?? sha256Str('AGA Protocol Specification v2.0.0')); await ctx.storage.storeEvent(genesis); ctx.chainInitialized = true; ctx.portal.sequenceCounter = 0; ctx.portal.lastLeafHash = genesis.leaf_hash; return ctx.json({ success: true, genesis_event_id: genesis.event_id, genesis_leaf_hash: genesis.leaf_hash }); } - src/server.ts:88-92 (registration)Registration of the 'init_chain' tool in `src/server.ts`, which aliases 'aga_init_chain' and calls `handleInitChain`.
server.tool('init_chain', 'Initialize continuity chain (alias for aga_init_chain). (Claim 3a)', { specification_hash: z.string().optional() }, async (args) => handleInitChain(args, ctx), ); - src/server.ts:81-85 (registration)Registration of the 'aga_init_chain' tool in `src/server.ts`, which calls `handleInitChain`.
server.tool('aga_init_chain', 'Initialize continuity chain with genesis event. (Claim 3a)', { specification_hash: z.string().optional() }, async (args) => handleInitChain(args, ctx), );