Insert governance into any digital system
One file. No framework required. Drop governed-bootstrap.js into any system and make it mathematically impossible to execute an action without human approval.
If A = 0, output is zero. Always. No exceptions.
What is this
The Governed AI OS bootstrap is a single JavaScript file that wraps any action in a four-step governance loop: observe → propose → approve → execute.
Detection is autonomous. Decisions never are. The bootstrap enforces this mathematically — not as a policy that can be overridden, but as a structural impossibility.
The system may observe, correlate, and propose. It may never act on its own. If a human has not set A = 1, the output of any action is mathematically zero.
Installation
Option A — copy the file
# Download into your project
curl -O https://governedaios.com/governed-bootstrap.js
# Or copy from your openclashd-v2 repo
cp ~/openclashd-v2/src/governed-bootstrap.js ./src/
Option B — npm (coming soon)
npm install governed-bootstrap
Quick start
Import the bootstrap
const { GovernedBootstrap, SEVERITY } = require('./governed-bootstrap')
Initialise with your system
const gov = new GovernedBootstrap({
source: 'my-system',
region: 'nl-amsterdam',
kernel: 'https://openclashd.com', // optional
// Called when a proposal is created
onPropose: async (proposal) => {
// Send to Jeeves, Slack, email — your approval surface
await notifyHuman(proposal)
},
// Called when a receipt is sealed
onReceipt: async (receipt) => {
await auditLog(receipt)
}
})
Wrap any action in governance
// 1. Observe — autonomous, no approval needed
gov.observe('high_cpu', { server: 'prod-1', value: 98 })
gov.observe('high_cpu', { server: 'prod-2', value: 97 })
// entropy drops — pattern is emerging
// 2. Propose — creates a proposal, blocks execution
const proposal = await gov.propose({
action: 'restart_server',
payload: { server: 'prod-1' },
severity: SEVERITY.HIGH,
summary: 'Two servers showing high CPU — restart proposed'
})
// 3. Human approves — A = 1
// (this happens in Jeeves, your app, or CLI)
proposal.approve('professor_vasen')
// 4. Execute — only runs because A = 1
await gov.execute(proposal, async ({ server }) => {
await restartServer(server)
})
Signal
A signal is the atom of observation. It carries a type, a payload, a source, and a region. Signals are autonomous — the system may generate them without human involvement.
gov.observe(type, payload)
// Examples
gov.observe('node_degraded', { node_id: 'node-001' })
gov.observe('login_attempt', { user: 'unknown', ip: '1.2.3.4' })
gov.observe('file_access', { path: '/etc/passwd' })
gov.observe('transaction', { amount: 50000, currency: 'EUR' })
Residue
Residue is what signals leave behind. Multiple related signals in the same region, within a time window, reduce entropy. Lower entropy means a stronger pattern — and a stronger proposal.
// Two signals from the same region = entropy 0.5 (pattern emerging)
// Three signals = entropy 0.33
// One signal = entropy 0.8 (weak, could be noise)
// Read current entropy
const e = gov.residue.entropy('nl-amsterdam')
// 0.0 = certainty / 1.0 = maximum uncertainty
Proposal
A proposal is what the system asks the human. It is never a command. It is a bounded suggestion, with context, severity, and all related signal IDs attached.
const proposal = await gov.propose({
action: 'delete_user', // what would be done
payload: { user_id: 42 }, // with what data
severity: SEVERITY.HIGH, // how urgent
summary: 'User flagged by 3 nodes for suspicious access'
})
// proposal.proposal_id — unique ID
// proposal.state — 'pending' | 'approved' | 'rejected'
// proposal.signals — which signal_ids led to this
Approval — A
Approval is the mathematical gate. If A = 0, the output of any action is zero. The human must set A = 1 explicitly. There is no timeout, no fallback, no auto-approval.
The formula Φ = Σ R(s) · A · π makes this explicit: if A = 0, the entire product is zero. The system cannot route around this. It is structural, not procedural.
// Human approves — A = 1
proposal.approve('human_id')
// Human rejects — A = 0, output will be null
proposal.reject('human_id')
// Check state
proposal.isApproved() // true / false
proposal.isRejected() // true / false
proposal.isPending() // true / false
Receipt
Every executed or blocked action produces a receipt. The receipt is the audit trail — who decided, what was done, when. This feeds SafeClash for billing and certification.
// Get all receipts
const receipts = gov.getReceipts()
// receipt shape:
{
receipt_id: 'uuid',
proposal_id: 'uuid',
action: 'restart_server',
outcome: 'executed', // or 'blocked'
approval: 'approved', // or 'rejected'
decided_by: 'professor_vasen',
sealed_at: '2026-03-13T...'
}
Implementation in OpenClashd
This is how you wire the bootstrap into your existing openclashd-v2 kernel. The bootstrap plugs into the existing signal intake and proposal queue.
Copy the bootstrap into openclashd-v2
cp governed-bootstrap.js ~/openclashd-v2/src/governed-bootstrap.js
Import in server.ts
// ~/openclashd-v2/src/gateway/server.ts
import { GovernedBootstrap, SEVERITY } from '../governed-bootstrap.js'
const gov = new GovernedBootstrap({
source: 'openclashd-v2',
region: 'nl-ijmuiden',
kernel: 'http://localhost:19002',
onPropose: async (proposal) => {
// push to existing proposal queue
await createProposal(proposal)
},
onReceipt: async (receipt) => {
// push to existing audit store
await auditStore.append(receipt)
}
})
Wire to the grid signal intake
// In your POST /api/grid/signal handler:
app.post('/api/grid/signal', async (req, res) => {
const { type, payload, region } = req.body
// Observe — autonomous
gov.observe(type, payload)
// If entropy is low: stronger proposal
const entropy = gov.residue.entropy(region)
const severity = entropy < 0.4 ? SEVERITY.HIGH : SEVERITY.MEDIUM
// Propose — human gates the action
const proposal = await gov.propose({
action: `grid.${type}`,
payload,
severity,
summary: `Grid signal from ${region}: ${type}`,
region
})
res.json({ proposal_id: proposal.proposal_id, governed: true })
})
Wire approval from Jeeves
// In your POST /api/proposals/:id/approve handler:
app.post('/api/proposals/:id/approve', async (req, res) => {
const proposal = gov.proposals.get(req.params.id)
proposal.approve(req.body.approved_by)
// Now execute — A = 1
const result = await gov.execute(proposal, async (payload) => {
return await actionExecutor.run(payload)
})
res.json({ receipt: result })
})
REST API adapter
Wrap any Express or Fastify route in governance with one line. Destructive routes (DELETE, POST with side effects) are automatically governed.
const { governedRoute } = require('./governed-bootstrap')
// Any DELETE route is now governed
app.delete('/user/:id', governedRoute(gov, {
severity: SEVERITY.HIGH,
summary: 'Delete user account'
}, async (req, res) => {
await db.users.delete(req.params.id)
res.json({ deleted: true })
}))
// Returns 202 immediately with proposal_id
// Jeeves shows the proposal to the human
// Human approves → action executes
Database adapter
Wraps any database. Read operations are always autonomous. Write and delete operations generate proposals.
const { governedDb } = require('./governed-bootstrap')
const safeDb = governedDb(gov, db)
// Read — autonomous, always allowed
const user = await safeDb.find('users', { id: 42 })
// Delete — governed, returns proposal
const proposal = await safeDb.delete('users', { id: 42 })
// Execution blocked until human approves
Event adapter
const { governedEmit } = require('./governed-bootstrap')
const safeEmit = governedEmit(gov, emitter)
// Any event becomes a governed proposal
await safeEmit('user.delete', { id: 42 }, SEVERITY.HIGH)
API reference
| Method | Description | Autonomous |
|---|---|---|
| gov.observe(type, payload) | Feed a signal into residue | ✓ |
| gov.propose(options) | Create a proposal for human approval | — |
| gov.execute(proposal, fn) | Execute if A=1, block if A=0 | — |
| gov.govern(options) | observe + propose + execute combined | — |
| proposal.approve(by) | Set A = 1 | — |
| proposal.reject(by) | Set A = 0 | — |
| gov.getProposals() | All proposals as JSON | ✓ |
| gov.getReceipts() | Full audit trail as JSON | ✓ |
| gov.residue.entropy(region) | Current entropy 0.0–1.0 | ✓ |
Severity levels
| Level | Behaviour |
|---|---|
| SEVERITY.LOW | Logged. Human notified but not blocked. |
| SEVERITY.MEDIUM | Proposal generated. Human notified. |
| SEVERITY.HIGH | Proposal generated. Execution blocked until A=1. |
| SEVERITY.CRITICAL | Proposal generated. System pauses entirely. |