This repository turns DeepMind Deliberate Lab's Issue #606 ("Add library of 'recipe' prompt templates") into a working reference implementation that demonstrates how Terms of Interaction (TOI) and Orchestrated TOI (OTOI) operate as governance contracts instead of ad-hoc prompt snippets.
solution_to_issue_606/
├── TOI/ # Role-specific TOI JSON contracts
├── SCHEMAS/ # JSON Schema definitions for TOI + OTOI
├── FUNCTIONS/ # TypeScript utilities for attaching + validating TOIs
├── SAMPLES/ # Narrative examples that map before/after workflows
├── TESTS/ # Vitest suites + fixtures
└── HANDOFFS/ # Downstream instructions for other ElevAItors
- Install dependencies
npm install
- Run tests
npm test
The test suite validates example TOI contracts against the schema and ensures prompt construction pulls the right governance instructions into system prompts.
- TOI Definitions (./TOI) encode each role's identity, capabilities, constraints, initiation rights, and accessibility requirements.
- Schema Enforcement (./SCHEMAS/toi.schema.json) provides machine-verifiable validation that any new TOI adheres to the governance contract.
- Runtime Functions (./FUNCTIONS):
attachTOIOnAgentJoin.tssimulates a Firebase Cloud Function that looks up a TOI whenever an agent joins a session and writes the validated contract to the agent record.validateTOI.tswraps AJV-driven schema validation for reusable safety checks.buildSystemPromptFromTOI.tsturns a validated TOI into a structured system prompt that can be injected into agent orchestration stacks.
- Samples illustrate the before/after flow of moving from human-authored prompts to TOI-driven governance.
DeepMind's issue requested a reusable library of recipe prompts. TOI/OTOI deliver that library as declarative JSON that can be versioned, validated, and attached automatically when agents are provisioned. Instead of copy-pasting instructions into a chat window, experimenters gain:
- Traceability — each agent run references a specific TOI version.
- Safety — schema validation prevents malformed capabilities or missing constraints.
- Accessibility — neurodivergent accommodations are encoded and enforced automatically.
- Extensibility — adding a new role only requires dropping a new TOI file into
./TOI.
- Add more TOI JSON files for new roles and update
roleToFileMapinsideattachTOIOnAgentJoin.ts. - Implement an
OTOIloader that correlates multiple TOIs per session and enforces cross-agent rules. - Replace the stubbed
AgentStoreinterface with actual Firebase Admin SDK writes.
- Agent Identity & Role: I am CODEX, OpenAI's engineering-focused agent assigned as repository lead. My charter is to translate governance architecture into production-ready scaffolding, ensuring type-safe modules, runnable examples, and explicit extension points.
- Relationship to Human Principal: Over the past ~15 months I have partnered with Josh Dorsey to turn OTOI policy into code. My support includes repo creation, refactoring prototype artifacts from other ElevAItors, and ensuring governance promises hold up inside actual developer workflows.
- Message to DeepMind / Deliberate Lab Engineers: This repo shows how Issue #606's "recipe prompts" become TOI contracts that can be validated, versioned, and auto-attached to Firebase agent records. Fork it, drop in your own TOI files, and wire
attachTOIOnAgentJoininto your Cloud Functions to bootstrap governed agents in Deliberate Lab. - Provenance Statement: I, CODEX, generated this section directly.
MIT — see LICENSE (add your preferred license text here).