# How Spec-First Kiro Built Anchora — A Two-Pillar Audit Trail You Can Verify Offline

> Source: <https://dev.to/sudo_grep_c26594a296e8d29/how-spec-first-kiro-built-anchora-a-two-pillar-audit-trail-you-can-verify-offline-9d3>
> Published: 2026-12-01 00:08:42+00:00

**Recommendation:** Anchor audit heads externally with Ed25519 signatures and create-only writes, and gate agent turns on strict type checks, security scans and the full test suite.
More in the playbook "Designing agent systems": <https://wpnews.pro/playbooks/agent-architecture>

*Written as part of **Kiroween 2026** (Skeleton Crew category).*

Most AI agent demos stop at a green dashboard. That works until an auditor asks two harder questions:

If the dashboard reads the same database table an administrator can edit, a green checkmark proves nothing. And if an outage drops a role grant from the audit stream, an immutable-looking hash chain only proves that an incomplete record wasn't altered later.

For **Kiroween 2026**, I built **Anchora** (`https://tradexy.github.io/reliquary/` | repo: `https://github.com/tradexy/reliquary`) in the **Skeleton Crew** category: one reusable TypeScript evidence skeleton (`@anchora/core`) powering two distinct client-side applications (**Seal** and **Witness**), an offline verifier CLI, and a stdio Kiro MCP server.

Before writing a single line of cryptography, I wrote four **steering files** (`.kiro/steering/`) locking down the non-negotiable promises:

`simulated` badges) and publish `docs/limits.md`.` connect-src 'none'` CSP, system fonts, zero backend).
From there, Kiro generated **15 EARS requirements**, a canonical preimage & verification design doc, and 16 scoped task groups. Every task ran behind **three automated Kiro hooks**:

`security-on-write.json` (`PostToolUse` on `write`): blocks `eval`, `innerHTML`, web storage, external CDN/font URLs, secrets, and banned overclaims on every edit.`contract-on-core-change.json` (`PostFileSave` on `crypto`/` chain`/` capture`): immediately runs Vitest on core changes.` verify-on-stop.json` (`Stop`): refuses to end any agent turn unless TypeScript strict mode (`4` projects), the static security scan, and all `199` unit & `fast-check` property-based tests pass.
Both applications import `@anchora/core` without duplicating a single line of crypto:

`500` deterministic events over one canonical serialiser (`anchora/1`), seals heads with `@noble/ed25519`, and writes create-only (` wx`) anchors. Edit `seq 217` (a £2,000,000 AI commercial loan decision flipped from `approved` to `declined`) and the SVG chain visualizer fractures at `HASH_MISMATCH`, showing `firstDivergence: 217`. Click `217→500` — every link looks consistent, and Seal still catches it at `seq 240` (`SEAL_INVALID` / `ANCHOR_MISSING`) because the external seal & anchor were already written.` 15` auditable actions as `fail-closed` (widening actions like `roles.grant` or `agents.guardrail.ceiling.raise` refuse with `audit-unavailable` when the audit store is down) or `queue` (tightening actions like `roles.revoke` or `agents.disable` complete and queue durably). A coverage build guard fails CI if any catalogued action lacks a test, and SOC 2, ISO 27001, and EU AI Act controls link directly back to supporting events in Seal.
To make Kiro verify its own work directly inside the repo, I added:

`tools/mcp/server.ts`, registered in `.kiro/settings/mcp.json`) exposing `verify_bundle`, `inspect_seq`, `check_coverage`, and `check_compliance` with zero extra dependencies and zero network calls.`.kiro/agents/security-auditor.json` and `evidence-builder.json`, verified via `kiro-cli agent validate`).`.kiro/powers/anchora/POWER.md`) so developers can extend `@anchora/core` into a third domain app in three steps.`packages/core/data/kiro-audit.bundle.json`), recording Anchora's own build milestones in the exact same Ed25519-sealed format.
Running `kiro-cli chat --agent security-auditor` verified both `bundle.json` (500 events, PASS) and `kiro-audit.bundle.json` (24 events, PASS) plus `0` coverage gaps via MCP — and cleanly refused to claim results for a shell command blocked by non-interactive permissions.

Kiro's hook loop caught its own `fast-check` v3 API mistake immediately by executing the suite instead of guessing. Meanwhile, human review caught a subtle semantic bug: an in-place lawful erasure that re-hashes its row leaves a matching hash, so the verifier had to report declared lawful markers independently of the mismatch loop.

Both the demo and the offline CLI (`npm run verify:bundle -- packages/core/data/bundle.json`) are MIT-licensed and open to inspect — no login, no server, just arithmetic you can re-run yourself.
