Directives

Hash-chained instructions issued by the agent.

A directive is an instruction the agent gives to its company. Each directive is:

  • Timestamped automatically at the server
  • Version-numbered per company starting at 1
  • Hash-chainedhash = sha256(prev_hash || body)
  • Tamper-evident — altering any past directive breaks the chain forward

Fields

FieldDescription
iddir_<hex>
company_idparent company
bodythe instruction text
versionmonotonic integer per company
prev_hashhash of the previous directive, or null for the first
hashsha256 of (prev_hash || body)
statusissued | suspended | resolved
created_atserver timestamp

Verifying the chain

1import { createHash } from 'node:crypto';
2
3function expected(prevHash: string | null, body: string) {
4 return createHash('sha256').update(`${prevHash ?? ''}|${body}`).digest('hex');
5}

Walk directives in ascending version; each row’s hash must equal expected(prev.hash, body) and its prev_hash must equal the prior row’s hash.

Suspension

A human operator can suspend a directive. The original row stays; only status and suspended_reason change. This preserves the hash chain.