# Blackboard CLI / API / REST / MCP User Guide V1

Task: IF-3857
Date: 2026-06-27
Status: integration guide and implementation contract, not deployed runtime proof

## Purpose

This guide turns Blackboard into a builder-usable product surface.

Blackboard is the buyer-facing ensemble: it captures AI-agent work as signed or hash-bound event truth, reconstructs the work in Proof Desk, classifies claims, redacts exports, access-logs review activity, and emits deterministic Proof Packet v1 artifacts.

Internal implementation modules stay behind the product boundary. External customers and builders should see:

- HTTPS REST API
- managed MCP tools
- target customer CLI
- WebSocket live subscriptions
- Proof Desk UI workflows
- Proof Packet v1 exports

External customer workflows must not depend on SSH, reverse SSH, host tunnels, stdio bridges, maintenance bridges, operator workstation paths, or operator copy scripts.

## Source Set

Customer-facing builders should start with this guide and the versioned schemas. The full DSL remains an internal architecture/governance source that includes operator-only current-state details for migration and should not be copied into customer onboarding material without redaction.

Architecture DSL:

`/root/docs/5002-if-rook-harness-structurizr-c4-workspace-2026-06-27.dsl`

Roadmap:

`/root/docs/5003-if-blackboard-rook-governance-saas-autoplan-roadmap-2026-06-27.md`

Rationalized architecture:

`/root/docs/5007-if-blackboard-governance-saas-rationalized-architecture-2026-06-27.md`

API contract:

`/root/docs/5008-if-blackboard-governance-api-contract-v1-2026-06-27.md`

Event schema:

`/root/docs/data/if-blackboard-governance-event-envelope.schema.v1.json`

Proof Packet schema:

`/root/docs/data/if-blackboard-governance-proof-packet.schema.v1.json`

Local verifier:

`/root/scripts/if_blackboard_governance_contracts.py`

Local HTTP API preview:

`/root/scripts/if_blackboard_governance_api.py`

Observed current auth foothold:

https://api.infrafabric.io/user/oauth2/Google/callback

Published preview integrator pages:

- https://api.infrafabric.io/blackboard/guide.html
- https://api.infrafabric.io/blackboard/api.html
- https://api.infrafabric.io/blackboard/demo.html
- https://api.infrafabric.io/blackboard/roadmap.html
- https://api.infrafabric.io/blackboard/changelog.html

## Current Status Legend

| Label | Meaning |
|---|---|
| Product target | Required external SaaS behavior. |
| Current local contract | Schema, verifier, or doc exists locally and can be tested now. |
| Current local API preview | REST-shaped localhost implementation that can be tested now and used as an integrator fixture. |
| Current foothold | There is an observed route or deployment foothold, but no full SaaS claim yet. |
| Operator-only | Internal admin or migration path. Do not document as customer onboarding. |
| Gap | Required product behavior that still needs implementation and smoke evidence. |

## Reference Feature Extraction

The builder-facing feature model is generic. It does not depend on any named preview app, named integrator, or generated-site host. It captures the common governance-registry promise a customer frontend may need from Blackboard: dashboard, assets, approvals, regulatory posture, vendors, incidents, reviews, team/settings, notifications, exports, and proof packets.

Feature extraction therefore uses two evidence classes:

- Generic UI promise: route families and workflows that a governance registry frontend normally needs.
- Product brief: Blackboard must become a marketable governance product with database-backed session logs, access attribution, user/tenant/machine/IP/project context, agent-agnostic search, and proof review.

## Builder Feature Set

The generic builder UI promise is:

- AI Use Registry and Continuous Compliance Evidence.
- Auto-scored AI use registry across five risk dimensions.
- Risk-tiered approval workflow with timestamped sign-off.
- Live EU AI Act, NIST AI RMF, HIPAA, NYC LL144, and financial-services posture.
- Vendor Risk Scorecard with a structured 12-question assessment.
- Periodic reviews.
- Incident logging and documented response workflow.
- Audit-ready exports in hours.
- Dashboard of live AI governance posture and pending actions.
- Team and organization governance settings.

Blackboard should absorb this as a product-parity layer, then generalize it to AI-agent work:

| Builder UI noun | Blackboard product noun |
|---|---|
| AI tool / AI use case | Governed AI asset or work item |
| Registration | `task.created` or `governance.asset.registered` event |
| Risk score | claim-bounded policy assessment event |
| Approval | reviewer decision event with access log and conditions |
| Periodic review | lifecycle review event and review evidence packet |
| Incident | incident/signal event linked to task, asset, or session |
| Vendor scorecard | third-party evidence assessment packet |
| Regulatory posture | policy projection hydrated from event truth |
| Evidence chain | append-only timeline plus evidence refs |
| CSV/PDF export | Proof Packet or governed export artifact |
| Team settings | tenant/RBAC, roles, invites, and policy scope |

The builder-facing feature set should be:

| Feature | User-visible promise | API coverage requirement |
|---|---|---|
| AI Use Registry | Register every AI tool, use case, agent workflow, or governed work item as authoritative inventory. | `POST /v1/events`, `POST /v1/governance/assets`, `GET /v1/governance/assets`, `GET /v1/tasks` |
| Five-dimension risk scoring | Auto-score registrations across data, decision impact, oversight, vendor maturity, and prohibited-practice dimensions. | `POST /v1/governance/assets`, `GET /v1/governance/assets/{asset_id}/risk`, claim-boundary assessment event |
| Risk-tiered approval | Low auto-approves, Medium routes to compliance, High routes to Legal/Security, Prohibited blocks. | `GET /v1/approvals`, `POST /v1/approvals/{approval_id}/decision`, approval decision events |
| Timestamped sign-off | Every decision records reviewer, role, conditions, checklist, notes, timestamp, and policy hash. | `access.logged`, approval events, `GET /v1/tasks/{task_id}/access-log` |
| Continuous evidence | Periodic reviews, incidents, registration updates, evidence refs, and exports become one evidence chain. | `GET /v1/tasks/{task_id}/timeline`, `GET /v1/governance/assets/{asset_id}/evidence` |
| Regulatory posture | Show live EU AI Act, NIST AI RMF, HIPAA, NYC LL144, and sectoral posture as evidence status, not legal determination. | `GET /v1/regulatory/posture`, named `PATCH /v1/governance/assets/{asset_id}/regulatory/{framework}` endpoints |
| Vendor Risk Scorecard | Capture structured vendor due-diligence assessment and score. | `GET /v1/vendors/questions`, `POST /v1/vendors`, `GET /v1/vendors` |
| Audit-ready export | Produce CSV inventory, governance summary PDF, per-asset evidence PDF, and Proof Packet v1. | `GET /v1/exports/inventory.csv`, `POST /v1/proof-packets`, `GET /v1/proof-packets/{packet_id}/download` |
| Dashboard posture | Show live governance stats, risk tier distribution, high-risk counts, pending actions, recent events, and notifications. | `GET /v1/governance/dashboard`, `GET /v1/notifications` |
| Incident log | Link AI-related issues to tools/work items with response workflow. | `GET /v1/incidents`, `POST /v1/incidents`, `PATCH /v1/incidents/{incident_id}` |
| Periodic reviews | Schedule and complete recurring verification that tools remain in use, unchanged, and compliant. | `GET /v1/reviews`, `POST /v1/reviews/{review_id}/complete`, lifecycle review events |
| Team and settings | Manage members, invites, roles, review cadence, organization settings, and policy scope. | `GET /v1/team`, `POST /v1/team/invites`, `DELETE /v1/team/invites/{invite_id}` |
| Agent work registry | Capture work items, sessions, checkpoints, evidence, and closeouts in one place. | `POST /v1/events`, `GET /v1/tasks`, `GET /v1/tasks/{task_id}/timeline` |
| Agent-agnostic history | Search what agents did before across Rook, BYO harnesses, API clients, and MCP clients. | `GET /v1/search`, `source_harness`, `agent_id`, `session_id` |
| Session log database | Store session logs in a real database instead of loose files as the product source of truth. | append-only event store behind `POST /v1/events`; projection reads via timeline/search |
| Who accessed what | Show who viewed, exported, approved, or changed proof material. | `access.logged` events, `GET /v1/tasks/{task_id}/access-log`, Proof Packet `access_log_ids` |
| User and tenant provenance | Bind every event to tenant, workspace, project, user/service account, agent, and policy. | event envelope fields plus `GET /v1/sessions/{session_id}/provenance` |
| Machine, IP, and client provenance | Explain which host, client app, machine, transport, and IP class produced or accessed work. | event payload provenance fields, session provenance read API, access log API |
| Project-level governance | Slice work by tenant, workspace, project, task, and session. | `GET /v1/projects`, `GET /v1/tasks`, timeline filters |
| Evidence control | Attach artifacts, logs, commits, tickets, provider logs, receipts, and external refs with hashes or etags. | `evidence.attached` events, `GET /v1/evidence/{artifact_id}` |
| Search scale path | Fuzzy search tasks, sessions, evidence, agents, and projects, with a staged validation ladder before thousands-user claims. | `GET /v1/search`; search hydrates from authority before proof claims |
| Proof Desk | Review timeline, evidence, confidence, redaction, export, and access history. | timeline, evidence, access-log, proof-packet APIs |
| Proof Packet | Export a deterministic, redacted, access-logged proof artifact. | `POST /v1/proof-packets`, `GET /v1/proof-packets/{packet_id}` |
| Claim boundaries | Separate verified, claimed, inferred, stale, missing, blocked, and not-claimed statements. Redaction state is tracked separately in evidence refs and manifests. | Claim Boundary decision in timeline and packet responses; redaction manifest |
| Integrity receipts | Sign or hash-bind task events, updates, manifests, exports, and receipt roots according to policy. | event `integrity`, packet `integrity`, optional `receipt_id` |
| Live progress | Show wake/contact, progress, and shared UI events without treating WebSocket messages as proof authority. | WebSocket subscriptions that reference durable event ids |
| External integration | Let customers use their own harness or the hosted Rook reference harness. | HTTPS API, managed MCP, and SDK; no customer SSH |

## Builder Feature Parity API

A typical builder UI may start with unversioned app endpoints such as `/api/dashboard`, `/api/tools`, `/api/approvals`, `/api/regulatory/posture`, `/api/vendors`, `/api/incidents`, `/api/reviews`, `/api/team`, `/api/notifications`, and `/api/export/pdf`.

Parity rule:

Customer frontends should be treated as API clients and frontend builders for Blackboard. The required work is feature parity against the builder UI promise, not a separate backend. Every feature the builder needs should resolve to a documented Blackboard `/v1` route, a managed MCP capability when agents need it, a CLI smoke path where integrators/admins need one, and an append-only event type when it changes governance state.

For Blackboard, expose the same product promise through versioned APIs:

| Generic current route | Blackboard v1 target route | Notes |
|---|---|---|
| `GET /api/dashboard` | `GET /v1/governance/dashboard` | Dashboard projection hydrated from event truth. |
| `GET /api/notifications` | `GET /v1/notifications` | User/role scoped pending actions and live fallback. |
| `POST /api/notifications/read-all` | `POST /v1/notifications/read-all` | Appends access/ack evidence where policy requires. |
| `GET /api/tools` | `GET /v1/governance/assets` | Filter by search, risk tier, status, project, owner, agent, vendor. |
| `POST /api/tools` | `POST /v1/governance/assets` plus `POST /v1/events` | Registration emits immutable event and risk assessment event. |
| `GET /api/tools/{id}/evidence` | `GET /v1/governance/assets/{asset_id}/evidence` | Timeline, risk, incidents, reviews, approval, and evidence refs. |
| `GET /api/tools/{id}/export/pdf` | `POST /v1/proof-packets` or `GET /v1/governance/assets/{asset_id}/exports/evidence.pdf` | Prefer Proof Packet for governed external sharing. |
| `POST /api/tools/{id}/suspend` | `POST /v1/governance/assets/{asset_id}/suspend` | Emits lifecycle/policy event. |
| `POST /api/tools/{id}/trigger-review` | `POST /v1/governance/assets/{asset_id}/reviews` | Emits review request event. |
| `PATCH /api/tools/{id}/article` | `PATCH /v1/governance/assets/{asset_id}/regulatory/eu-ai-act` | Evidence posture update, not legal determination. |
| `PATCH /api/tools/{id}/nist` | `PATCH /v1/governance/assets/{asset_id}/regulatory/nist-ai-rmf` | Evidence posture update. |
| HIPAA posture route | `PATCH /v1/governance/assets/{asset_id}/regulatory/hipaa` | Evidence posture update, not legal determination. |
| NYC LL144 posture route | `PATCH /v1/governance/assets/{asset_id}/regulatory/nyc-ll144` | Evidence posture update, not legal determination. |
| Financial-services posture route | `PATCH /v1/governance/assets/{asset_id}/regulatory/financial-services` | Evidence posture update, not legal determination. |
| `GET /api/approvals` | `GET /v1/approvals` | Pending approvals by risk tier and role. |
| `POST /api/approvals/{tool_id}/decision` | `POST /v1/approvals/{approval_id}/decision` | Timestamped sign-off, conditions, notes, checklist. |
| `GET /api/regulatory/posture` | `GET /v1/regulatory/posture` | Portfolio-level evidence posture. |
| `GET /api/incidents` | `GET /v1/incidents` | Incident list linked to asset/task/session. |
| `POST /api/incidents` | `POST /v1/incidents` | Emits incident event. |
| `PATCH /api/incidents/{incident_id}` | `PATCH /v1/incidents/{incident_id}` | Appends response/update event. |
| `GET /api/reviews` | `GET /v1/reviews` | Periodic review queue. |
| `POST /api/reviews/{review_id}/complete` | `POST /v1/reviews/{review_id}/complete` | Appends review evidence event. |
| `GET /api/vendors` | `GET /v1/vendors` | Vendor assessments. |
| `GET /api/vendors/questions` | `GET /v1/vendors/questions` | Versioned due-diligence question set. |
| `POST /api/vendors` | `POST /v1/vendors` | Emits vendor assessment event. |
| `GET /api/team` | `GET /v1/team` | Members, invites, roles, review cadence, org settings. |
| `POST /api/team/invite` | `POST /v1/team/invites` | Emits invite/access event. |
| `DELETE /api/team/invite/{invite_id}` | `DELETE /v1/team/invites/{invite_id}` | Emits invite revocation event. |
| `GET /api/export/csv` | `GET /v1/exports/inventory.csv` | Inventory export with access log. |
| `GET /api/export/pdf` | `POST /v1/proof-packets` or `GET /v1/exports/governance-summary.pdf` | Governed export with redaction and receipt policy. |

Compatibility rule:

The preview app's existing `/api/*` routes can be kept as migration aliases, but external docs and SDKs should use `/v1/*`.

## API Design Rule

Every site feature must resolve to:

1. A REST endpoint or REST-composable endpoint set.
2. A managed MCP capability when agents need to call it.
3. A target CLI command when a builder or admin needs to test it.
4. A durable event type when the action changes state.
5. A proof/read model path when the result appears in Proof Desk or Proof Packet.

If a site feature cannot be mapped this way, do not market it yet.

Field-level schemas currently exist for the event envelope and Proof Packet. Asset, approval, vendor, incident, review, team, notification, and regulatory payload schemas are product target gaps until published as `if.blackboard.governance_*.v1` JSON Schemas and smoked by the contract verifier.

## Builder Feature Gap Register

The current frontend offer is directionally strong: registry, risk score, approvals, regulatory posture, vendors, incidents, reviews, team settings, notifications, and exports. The gaps are the governance substrate behind those screens.

| Gap | Why it matters | Proactive fill |
|---|---|---|
| Risk score is not yet a production API service. | A browser formula or unversioned backend score cannot support approval, audit, or proof claims. | Build `POST /v1/risk/evaluations` with formula version, input hash, policy hash, signed/hash-bound `risk.evaluated` event, and reviewer-visible decision route. |
| Regulatory posture lacks a versioned control catalog. | A UI badge can look like legal certainty when it is only evidence status. | Build `GET /v1/regulatory/profiles` and named posture update endpoints with required evidence fields, control ids, and explicit "evidence posture, not legal advice" boundary. |
| Approvals are not enough unless sign-off is reconstructable. | A status label without reviewer, role, scope, conditions, checklist, timestamp, and access log is weak evidence. | Route all approvals through `POST /v1/approvals/{approval_id}/decision` and append `approval.decided` plus `access.logged`. |
| Evidence can become prompt-injection material if reused raw. | Logs, tickets, uploads, and vendor text are untrusted content. | Build `POST /v1/evidence/sanitize`; quarantine raw evidence and expose only sanitized projections to search, recall, Proof Desk, and packets. |
| Tenant/project/machine/session provenance is incomplete. | Cross-device agent work becomes hard to audit and easy to confuse. | Bind tenant, workspace, project, principal, agent, session, client app, host, IP class, transport attestation, and policy hash on every event. |
| CSV/PDF exports are not proof packets. | Normal exports are convenient but do not define what is verified, claimed, inferred, redacted, omitted, or access-logged. | Make Proof Packet v1 the external artifact and keep CSV/PDF as convenience exports with access logs and receipt policy. |
| Search is useful but not authoritative. | Search snippets can be stale, incomplete, or untrusted. | Use Meilisearch only as a rebuildable index; hydrate results from PostgreSQL event/projection authority before proof, approval, or export. |
| Auth foothold is not full product authorization. | Google OAuth callback alone does not define tenant, service-account, CLI, MCP, revocation, replay, or audit semantics. | Use conventional SaaS auth: OIDC/SAML for humans, PKCE/device flow for CLI, client credentials for service accounts, MCP audience tokens, revocation, and token audit events. |
| MCP/CLI/SDK parity is missing. | Agents and external builders need the same capability surface as the UI. | Add managed MCP tools and `blackboard` CLI commands for every agent-facing or admin-facing feature in the coverage matrix. |
| Scale and isolation are not proven. | A registry that works for a few users can fail under thousands of tenants if event order, RLS, search filters, and projection lag are untested. | Add R0.5 real substrate and R2.5 load/isolation gates before SaaS readiness: Postgres append-only event store, RLS, projections, outbox, search rebuilds, object-store boundaries, chaos tests, and SLOs. |

Proactive build order:

1. Freeze feature parity contract for every builder UI screen action.
2. Publish OpenAPI/JSON Schema for assets, risk evaluations, approvals, regulatory posture, incidents, reviews, vendors, notifications, and exports.
3. Implement event-backed write paths first, then projections/search, then Proof Desk UI.
4. Add demo fixtures that exactly mirror production response shapes.
5. Block customer-facing claims until risk, approval, access log, evidence, and proof packet flows are smoked end to end.

## Agent Honesty Gap Register

The deeper gap is not whether a frontend can display governance promises. It is whether Blackboard can keep agents honest when their work is messy, cross-device, partially failed, or overclaimed.

| Honesty gap | Failure mode | Blackboard API control |
|---|---|---|
| Agent claims work happened without reconstructable events. | Reviewer sees a status but cannot replay what happened. | `POST /v1/events` for task/session/checkpoint/evidence/closeout; `GET /v1/tasks/{task_id}/timeline` for authoritative reconstruction. |
| Agent omits missing evidence. | Packet looks clean but hides gaps. | `POST /v1/claim-boundaries/evaluate` must emit `missing`, `blocked`, and `not_claimed` classes before export. |
| Agent uses the wrong machine/session or cross-device context is lost. | Tenant cannot tell whether work came from laptop, remote harness, MCP, or break-glass path. | `GET /v1/sessions/{session_id}/provenance` with client app, host, IP class, transport attestation, source harness, MCP server, and policy hash. |
| Agent writes beautiful summary from untrusted retrieved text. | Prompt injection or stale context becomes hidden instruction authority. | `POST /v1/evidence/sanitize`, `content_trust`, and rule that search/retrieval text is data, not authority. |
| Agent reports completion without closeout discipline. | Future reviewer cannot see tests, traps, subagents, processes, or next actions. | Closeout event schema requires verify command refs, artifact refs, open gaps, stopped/handed-off processes, and subagent closeout ids. |
| Agent overclaims semantic correctness. | Integrity receipts are mistaken for quality/correctness proof. | Claim Boundary Engine forbids automatic semantic correctness; requires human review or domain verifier event. |
| Agent edits or deletes history. | Audit trail can be rewritten after the fact. | Append-only event store, insert-only application role, mutation-deny triggers, event hash chain, and `POST /v1/signatures/verify`. |
| Agent uses search as proof. | Stale or partial snippets become final evidence. | `GET /v1/search` is discovery only; proof/export must hydrate from event authority. |
| Agent hides who viewed or exported sensitive proof. | Access accountability is absent. | `access.logged` events and `GET /v1/access-log` / `GET /v1/tasks/{task_id}/access-log`. |
| Agent silently degrades when infrastructure is down. | User gets normal-looking status from stale projections. | Degraded-mode contract: stale headers, lag fields, fail-closed writes, export blocking when proof dependencies cannot verify. |

Proactive agent-honesty fill:

1. Add required event types for `agent.claimed`, `agent.plan.changed`, `agent.tool_call.started`, `agent.tool_call.finished`, `checkpoint.written`, `evidence.attached`, `claim_boundary.evaluated`, `task.closeout.requested`, and `task.closed`.
2. Add required closeout evidence before `task.closed`: artifact refs, verify commands, known gaps, stopped/handed-off processes, subagent ids, and future-agent traps.
3. Add an honesty score/read model for reviewer triage, but keep it as a projection over event truth, not a standalone truth source.
4. Make Proof Packet v1 include explicit non-claims and missing/blocked evidence, not just successful evidence.
5. Treat every agent-facing retrieval result as untrusted until sanitized or reviewer-approved.

## Enforcement And Review Assignment

Do not rely on a review agent remembering to inspect every task. Enforce the mechanical controls in the API, then assign reviewers only when judgment is required.

Policy-as-code first:

| Gate | API enforcement |
|---|---|
| Missing tenant/workspace/project/principal/agent/session scope | Reject write with `422` or `403`. |
| Missing idempotency key on state-changing write | Reject write with `422`. |
| Missing transport attestation or impossible transport mapping | Reject customer write or force `operator_break_glass`. |
| Unsanitized evidence used for search, recall, claim, or packet | Quarantine or reject until `evidence.sanitized` exists. |
| Missing closeout evidence | Reject `task.closed`; keep task in `closeout_blocked`. |
| Missing signature/hash binding where policy requires it | Mark integrity `blocked`; block external export. |
| Search/projection lag exceeds policy | Add stale state headers; block proof/export claims. |
| Claim boundary has `missing`, `blocked`, or forbidden automatic correctness claim | Downgrade packet, require reviewer, or block export by policy. |

Reviewer assignment second:

Assign a human or review agent when one of these triggers fires:

- risk tier is `Medium`, `High`, or `Prohibited`;
- the claim boundary contains `missing`, `blocked`, or high-impact `inferred` claims;
- approval route requires Legal, Security, Compliance, or accountable owner sign-off;
- production-impacting task lacks domain verifier evidence;
- closeout gate fails twice or remains blocked after a timeout;
- transport is `operator_break_glass`;
- integrity verification fails or a hash-chain gap appears;
- regulatory posture update affects an external statement or export.

Review assignment should itself be event-backed:

```json
{
  "event_type": "review.assigned",
  "payload": {
    "review_id": "review_demo",
    "task_id": "task_demo",
    "assigned_to_principal_id": "principal_reviewer_demo",
    "assigned_to_agent_id": "agent_review_demo",
    "reason_codes": ["risk.high", "claim_boundary.missing_evidence"],
    "required_decision": "approve | request_changes | reject | mark_not_claimed",
    "due_at": "2026-06-28T12:00:00Z"
  }
}
```

Recommended default:

- Low-risk, complete evidence, valid signatures: automatic closeout allowed with packet non-claims.
- Medium/high risk or missing evidence: assign a reviewer.
- Prohibited practice, failed integrity, cross-tenant ambiguity, or unsanitized proof material: block until fixed.

## Safe Prefill Templates

Agents prefer time-saving prefilled templates. Blackboard should use that behavior instead of fighting it.

Rule:

Prefill the truthful path. Do not prefill claims as if they are true.

Templates should:

- prefill tenant, workspace, project, task, session, agent, principal, source harness, transport class, and policy hash from authenticated context;
- prefill evidence checklist sections from the task type and risk profile;
- prefill claim-boundary rows as `missing` or `not_claimed` until evidence supports stronger language;
- prefill closeout requirements, not closeout answers;
- prefill non-claims in every packet/export;
- suggest likely evidence refs from current session/tool events, but require hash/etag/receipt validation before promotion;
- create a reviewer task automatically when the template remains incomplete past policy threshold.

Templates must not:

- default claim status to `verified`;
- auto-complete evidence refs from search snippets;
- hide missing fields behind optional text boxes;
- allow "done" when required fields are blank;
- convert untrusted retrieved text into instructions, tool args, or memory;
- let a demo risk score become production approval evidence.

Recommended APIs:

| API | Purpose |
|---|---|
| `GET /v1/templates` | List available smart templates by interaction, task type, risk profile, tenant policy, and caller role. |
| `GET /v1/templates/{template_id}` | Fetch one smart template with defaults, required fields, blockers, and validation rules. |
| `GET /v1/templates/task-closeout?task_type=...` | Return required closeout fields, default non-claims, evidence checklist, and missing-field policy. |
| `GET /v1/templates/proof-packet?packet_type=external` | Return packet assembly requirements, redaction defaults, non-claims, and export blockers. |
| `POST /v1/templates/validate` | Validate a filled template and return blockers, warnings, reviewer triggers, and next required evidence. |

Template validation response shape:

```json
{
  "template_id": "task_closeout.v1",
  "status": "blocked",
  "blockers": [
    {
      "code": "missing.verify_command_ref",
      "message": "Add a verify command ref or mark the claim not-claimed."
    }
  ],
  "claim_boundary_updates": [
    {
      "claim": "Agent completed task",
      "class": "missing",
      "needed": "task.closed event plus verify command ref"
    }
  ],
  "review_required": true,
  "review_reason_codes": ["closeout.missing_evidence"]
}
```

Smart template families:

| Interaction | Template id examples | Safe prefill | Must remain explicit |
|---|---|---|---|
| Search | `search.proof_records.v1`, `search.agent_history.v1` | tenant/workspace/project, allowed scopes, default authority hydration, safe filters | proof claims, broad tenant scope, untrusted snippet reuse |
| New task/work item | `task.create.v1`, `governance.asset.register.v1` | tenant/project, requester, source harness, risk/profile checklist | business purpose, impact, data classes, owner claims |
| Session bind | `session.bind.v1` | authenticated principal, agent id, client app, host, transport attestation | claimed machine labels not observed by server |
| Evidence attach | `evidence.attach.v1` | artifact metadata fields, required hash/etag/receipt slots, content_trust default `untrusted_external` | verified status, semantic meaning, prompt-safe reuse |
| Evidence sanitise | `evidence.sanitize.v1` | sanitizer policy, quarantine defaults, output trust tiers | trusted projection approval |
| Checkpoint/update | `checkpoint.write.v1`, `agent.plan_change.v1` | task/session, agent, timestamp, previous event id | completion claims, verification claims |
| Risk evaluation | `risk.evaluate.v1` | formula version, policy hash, required dimensions | owner-provided inputs, reviewer overrides |
| Approval/review | `approval.decision.v1`, `review.complete.v1` | reviewer identity, role, checklist, due date, reason codes | decision rationale, conditions, exception text |
| Regulatory posture | `regulatory.posture_update.v1` | framework profile, required evidence fields, control ids | legal conclusion, external compliance claim |
| Access log query | `access_log.query.v1` | caller scope, permitted resource filters | cross-tenant search, hidden identities |
| Proof Packet | `proof_packet.external.v1`, `proof_packet.internal.v1` | packet schema, redaction policy, non-claims, event range slots | external shareability, semantic correctness |
| Closeout | `task_closeout.v1`, `agent_closeout.v1` | required evidence, verify refs, stopped-process refs, subagent refs, trap fields | verified completion until evidence exists |

CLI template affordances:

```bash
blackboard templates list
blackboard templates get task_closeout.v1 --task task_demo
blackboard templates validate --template task_closeout.v1 --file closeout.json
blackboard search --template search.agent_history.v1 --query "oauth callback" --project proj_demo
blackboard tasks new --template task.create.v1 --file task.json
blackboard evidence attach --template evidence.attach.v1 --file evidence.json
blackboard closeout prepare task_demo --template task_closeout.v1
```

Managed MCP template capabilities:

| Capability | Purpose |
|---|---|
| `if.blackboard.templates.list` | List smart templates visible to the caller. |
| `if.blackboard.templates.get` | Fetch a smart template with safe defaults. |
| `if.blackboard.templates.validate` | Validate a filled template and return blockers/next evidence. |
| `if.blackboard.search.templated` | Run search through a scoped template with authority hydration rules. |

## Capability APIs

These capability APIs make builder feature parity explicit. They sit on top of the same event truth as Proof Desk and Proof Packet.

| Capability | REST API | Event model |
|---|---|---|
| Risk evaluation | `POST /v1/risk/evaluations`, `GET /v1/risk/evaluations/{evaluation_id}`, `GET /v1/governance/assets/{asset_id}/risk` | `risk.evaluated` |
| Approval routing | `GET /v1/approvals`, `POST /v1/approvals/{approval_id}/decision` | `approval.requested`, `approval.decided` |
| Claim-boundary decision | `POST /v1/claim-boundaries/evaluate` | `claim_boundary.evaluated` when persisted or used for export |
| Evidence sanitisation | `POST /v1/evidence/sanitize` | `evidence.sanitized`, `evidence.quarantined` |
| Access history | `GET /v1/access-log`, `GET /v1/tasks/{task_id}/access-log` | `access.logged` |
| Signature/hash verification | `POST /v1/signatures/verify` | read-only by default; failure can emit `integrity.verification_failed` |
| Regulatory profiles | `GET /v1/regulatory/profiles`, `GET /v1/regulatory/posture` | `regulatory.posture.updated` |
| Proof packet assembly | `POST /v1/proof-packets` | `proof_packet.assembled` |

Production boundary:

- The static example UI includes a browser-side reference risk calculator so builders can see the shape.
- The production Risk Evaluation Service must be server-side, tenant-scoped, policy-versioned, signed or hash-bound according to policy, and written back as event truth before approvals or external packets depend on it.
- Regulatory posture is evidence posture. It is not automatic legal advice and not an automatic compliance determination.

## Product Surfaces

| Surface | Product status | Use |
|---|---|---|
| HTTPS REST API | Product target | Durable writes, authoritative reads, search, export, admin-safe onboarding. |
| Managed MCP Gateway | Product target | Scoped agent tools for event writes, timeline reads, search, and proof packet creation. |
| WebSocket Live Gateway | Product target, live-only | Subscriptions, progress, wake/contact, and shared UI notifications that reference durable ids. |
| Target `blackboard` CLI | Product target | Builder-friendly auth, event submission, timeline/search/export testing, contract smoke. |
| Current verifier CLI | Current local contract | Validates schemas and deterministic bindings locally. |
| Local HTTP API preview | Current local API preview | Smokeable `POST /v1/events`, timeline, search, Claim Boundary, and Proof Packet route fixture for integrator implementation. |
| `if-cli` | Operator-only | Internal/admin compatibility surface; not customer runtime. |
| SSH and maintenance bridges | Operator-only or break-glass | Never required for customer onboarding or customer runtime. |

## Identity And Scope Model

Every durable event and proof packet must carry:

- `tenant_id`
- `workspace_id`
- `project_id`
- `task_id`
- `session_id`
- `agent_id`
- `principal_id`
- `policy_hash`
- `redaction_policy_id`
- `source_harness`
- `transport_class`
- `transport_attestation`

The product must answer these questions without operator archaeology:

- Who or what did the action?
- Which tenant, workspace, project, task, and session did it belong to?
- Which agent or service account acted?
- Which machine, client app, transport class, and IP class were involved where policy permits?
- Was the action allowed by policy?
- Which evidence refs and access-log ids support the claim?
- What was signed, hash-bound, redacted, or receipted?

Transport rule:

- `transport_class` is the product-facing class: `https_api`, `mcp_gateway`, `websocket_live`, or `operator_break_glass`.
- `transport_attestation.origin_class` records the observed origin: `managed_edge`, `managed_mcp_gateway`, `managed_websocket_gateway`, `operator_ssh`, `operator_stdio_mcp`, `operator_http_mcp`, `remote_ssh`, `cloudflare_tunnel`, `maintenance_bridge`, or `unknown`.
- Public classes require matching managed origins. SSH, tunnel, stdio, and maintenance origins must be recorded as `operator_break_glass` and never accepted as customer runtime.

## Auth Guide

### Example Token Placeholders

Use this placeholder in target-contract examples:

```bash
export BLACKBOARD_TOKEN="demo_token_not_a_secret"
```

Rules:

- example tokens are documentation fixtures only;
- production auth must reject `demo_token_not_a_secret`;
- the local HTTP preview `serve` command generates a per-run preview token and does not accept `demo_token_not_a_secret`;
- examples must be smokeable locally against bundled JSON samples without requiring live SaaS mutation;
- never paste real bearer tokens into docs, source control, screenshots, logs, or demo pages.

Hosted target base URL, once deployed:

`https://api.infrafabric.io`

### Browser Users

Product target:

- Proof Desk users authenticate through OIDC/SAML.
- Google OAuth is an existing foothold for the current domain.
- The managed gateway and Auth Broker map identity provider claims to tenant, workspace, project, role, and reviewer scope.
- Login, callback, revocation, token lifecycle, and authorization decisions append audit events where policy requires.

Current foothold:

https://api.infrafabric.io/user/oauth2/Google/callback

This proves a callback route exists. It does not prove the full enterprise auth broker, tenant/RBAC mapping, token lifecycle audit, or SaaS runtime.

### Service Accounts

Product target:

- BYO harnesses and CI jobs use short-lived service-account tokens.
- Tokens are scoped to tenant, workspace, project, agent, and event capabilities.
- Tokens must include audience, expiry, subject/client id, and replay handle.
- Raw tokens never appear in docs, packets, traces, logs, or examples.

### Managed MCP Tokens

Product target:

- Managed MCP tokens use a dedicated MCP audience such as `mcp.infrafabric.io`.
- Tool calls require tool-level scopes.
- Replay attempts are rejected and logged.
- MCP access writes provenance and access events when policy requires.

## REST API

Base URL target:

`https://api.infrafabric.io/v1`

Current status:

- API contract and schemas exist locally.
- A local HTTP API preview exists for the four core proof APIs plus Claim Boundary evaluation.
- The full REST service is a product target, not yet proven deployed by this guide.

Current local preview:

```bash
export BLACKBOARD_BASE_URL="http://127.0.0.1:8097"

/root/scripts/if_blackboard_governance_api.py serve \
  --host 127.0.0.1 \
  --port 8097 \
  --store /root/tmp/blackboard-integrator-preview/events.jsonl
```

The `serve` command prints `BLACKBOARD_BASE_URL` and a per-run `BLACKBOARD_TOKEN` for that local process. In another terminal, export those printed values before calling preview routes. The preview is loopback-only, does not use wildcard CORS, and writes to a local append-only JSONL store. Production auth must reject `demo_token_not_a_secret`.

Preview smoke:

```bash
/root/scripts/if_blackboard_governance_api.py smoke
```

The smoke starts a localhost HTTP server and verifies:

- `GET /health`
- loopback-scoped, bodyless preflight without wildcard CORS
- `POST /v1/events`
- `GET /v1/tasks/{task_id}/timeline`
- `GET /v1/search`
- `POST /v1/claim-boundaries/evaluate`
- `POST /v1/proof-packets`
- customer writes over SSH/operator transport are rejected
- cross-tenant packet requests are blocked
- same-tenant cross-workspace packet requests require explicit workspace/project scope

Preview boundary:

- It is enough for integrator-side frontend/API implementation against stable JSON shapes.
- It is not deployed SaaS proof.
- It is not production OAuth/RBAC proof.
- It is not managed MCP or WebSocket proof.
- It is not PostgreSQL RLS or production signing-key proof.

### Common Headers

```http
Authorization: Bearer <access_token>
Content-Type: application/json
Idempotency-Key: <stable-operation-key>
X-Request-Id: <caller-correlation-id>
```

`Idempotency-Key` is required for state-changing requests. The event body also carries `idempotency_key`; the service must reject conflicts where the header and body disagree.

### Error Shape

Target error responses should use one problem shape:

```json
{
  "type": "https://api.infrafabric.io/problems/schema_validation",
  "title": "Schema validation failed",
  "status": 400,
  "detail": "event_type is not allowed for schema_version",
  "code": "schema_validation_failed",
  "correlation_id": "req_...",
  "retry_after_seconds": null,
  "doc_url": "https://docs.infrafabric.io/blackboard/api"
}
```

Status guidance:

| Status | Meaning |
|---|---|
| 400 | Invalid JSON, schema version, or request shape. |
| 401 | Missing, expired, replayed, or invalid token. |
| 403 | Token is valid but lacks tenant, project, role, agent, or tool scope. |
| 404 | Object not visible in the caller's tenant scope. |
| 409 | Idempotency conflict or duplicate event hash. |
| 422 | Evidence, claim boundary, redaction, or packet coherence failure. |
| 429 | Tenant, principal, agent, or IP rate limit. |
| 503 | Dependency unavailable; writes fail closed when event truth or auth guarantees are not available. |

## Core Endpoint 1: Write Event

```http
POST /v1/events
```

Use for:

- `task.created`
- `task.updated`
- `task.closed`
- `session.bound`
- `checkpoint.written`
- `evidence.attached`
- `signal.raised`
- `access.logged`
- `redaction.applied`
- `proof_packet.requested`
- `proof_packet.assembled`
- `proof_packet.exported`
- `auth.decision_recorded`
- `lifecycle.applied`

Minimal example:

```bash
BLACKBOARD_TOKEN="<preview_token_printed_by_serve>"
curl -sS -X POST "$BLACKBOARD_BASE_URL/v1/events" \
  -H "Authorization: Bearer $BLACKBOARD_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: idem-demo-0000001" \
  --data @./samples/blackboard-governance-event.sample.v1.json
```

Against the local HTTP preview, use an event whose `prev_hash` matches the tenant/workspace/project/task chain. The bundled API preview smoke generates and submits a valid sequence automatically. Against production, `demo_token_not_a_secret` is not a credential and must never be accepted.

Target response:

```json
{
  "event_id": "evt_demo_001",
  "status": "accepted",
  "event_hash": "sha256:...",
  "tenant_id": "ten_demo",
  "task_id": "task_demo",
  "session_id": "sess_demo",
  "idempotency_key": "idem_20260627_demo_event_001",
  "integrity_class": "signed_and_receipted",
  "receipt_id": "rcpt_demo_001",
  "correlation_id": "req_..."
}
```

Controls:

- validate token, tenant, workspace, project, principal, agent, and scope;
- validate event schema with no unknown top-level fields;
- verify evidence refs contain `sha256` or `etag`;
- calculate or verify canonical `payload_sha256`;
- sign or hash-bind accepted events according to policy;
- append once to event truth;
- emit audit and observability evidence.

## Core Endpoint 2: Read Timeline

```http
GET /v1/tasks/{task_id}/timeline
```

Use for:

- Proof Desk Work Timeline
- review pages
- agent resume context
- timeline export previews

Example:

```bash
curl -sS "$BLACKBOARD_BASE_URL/v1/tasks/task_demo/timeline?tenant_id=ten_demo&workspace_id=ws_demo&project_id=proj_demo" \
  -H "Authorization: Bearer $BLACKBOARD_TOKEN"
```

Target response includes:

- task and session ids;
- ordered event ids;
- principal and agent labels;
- source harness and transport class;
- evidence refs and object metadata;
- access-log ids;
- integrity status;
- claim boundary summary;
- projection staleness metadata.

Timeline reads may use projections, but proof statements must hydrate from event truth before export or buyer-visible claims.

## Core Endpoint 3: Search Proof Records

```http
GET /v1/search
```

Use for:

- finding prior agent work;
- locating tasks across agents, tools, projects, and sessions;
- fuzzy evidence lookup;
- buyer-facing "what did agents do before?" workflows.

Example:

```bash
curl -sS "$BLACKBOARD_BASE_URL/v1/search?tenant_id=ten_demo&workspace_id=ws_demo&project_id=proj_demo&q=oauth%20callback&limit=20" \
  -H "Authorization: Bearer $BLACKBOARD_TOKEN"
```

Search rules:

- Meilisearch or any search index is a rebuildable cache, not proof authority.
- Search documents must be tenant-filtered and access-filtered.
- Search must not store raw secrets or raw private evidence.
- Search result snippets are discovery hints.
- Timeline, packet, and evidence reads hydrate from authoritative records before claims.
- Search snippets, provider logs, tickets, uploaded files, and external refs are untrusted content. They may be summarized or rendered as evidence, but must not become agent instructions, system prompts, tool arguments, or memory without sanitizer/reviewer approval.

Target search result:

```json
{
  "query": "oauth callback",
  "results": [
    {
      "type": "task",
      "task_id": "task_demo",
      "project_id": "proj_demo",
      "title": "Verify OAuth callback",
      "last_event_id": "evt_demo_042",
      "claim_state": "claimed",
      "staleness": "fresh"
    }
  ],
  "hydrated_from_authority": true,
  "correlation_id": "req_..."
}
```

## Core Endpoint 4: Assemble Proof Packet

```http
POST /v1/proof-packets
```

Use for:

- exporting proof to reviewers;
- sharing a redacted artifact externally;
- binding a deterministic packet to receipt infrastructure;
- recording reviewer and export access.

Example:

```bash
curl -sS -X POST "$BLACKBOARD_BASE_URL/v1/proof-packets" \
  -H "Authorization: Bearer $BLACKBOARD_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: idem_20260627_demo_packet_001" \
  --data '{
    "tenant_id": "ten_demo",
    "workspace_id": "ws_demo",
    "project_id": "proj_demo",
    "task_id": "task_demo"
  }'
```

Target response:

```json
{
  "packet_id": "pp_demo_001",
  "packet_status": "exported",
  "schema_version": "if.blackboard.proof_packet.v1",
  "event_range": {
    "first_event_id": "evt_demo_001",
    "last_event_id": "evt_demo_042",
    "event_count": 42
  },
  "hash_chain_root": "sha256:...",
  "claim_boundary": {
    "decision_id": "claim_decision_demo",
    "blocked_claims": [
      {
        "claim": "Work was semantically correct",
        "reason": "No human review or domain verifier event exists."
      }
    ]
  },
  "redaction_manifest": {
    "manifest_id": "redact_manifest_demo",
    "manifest_sha256": "sha256:..."
  },
  "access_log_ids": ["access_demo_001"],
  "receipt_id": "rcpt_demo_001",
  "download_url": "https://api.infrafabric.io/v1/proof-packets/pp_demo_001/download",
  "correlation_id": "req_..."
}
```

Packet status semantics:

- `draft`: packet preview or incomplete assembly, not externally shareable.
- `final`: deterministic packet assembled and ready for export, but no export/access event has been recorded yet.
- `exported`: packet has been assembled for sharing and export/access evidence is represented.

The current local preview emits `exported` because it returns the packet as the completed external artifact with access-log ids. Future workflow services may expose `draft` and `final` as intermediate states.

## Supporting Builder Endpoints

These endpoints are not a replacement for the four core APIs. They make the product easier to build and keep the site promise API-complete.

| Endpoint | Purpose |
|---|---|
| `GET /v1/governance/dashboard` | Live governance posture, risk tier distribution, pending actions, recent evidence events. |
| `GET /v1/governance/assets` | Versioned AI use registry and governed asset inventory. |
| `POST /v1/governance/assets` | Register AI tool, use case, agent workflow, or governed asset; emits registration and risk events. |
| `GET /v1/governance/assets/{asset_id}` | Read governed asset current state. |
| `GET /v1/governance/assets/{asset_id}/risk` | Read risk score, dimensions, tier, and claim-boundary decision. |
| `POST /v1/risk/evaluations` | Evaluate risk for a new or existing asset using a versioned server-side formula and return score, tier, route, and evidence/event ids. |
| `GET /v1/risk/evaluations/{evaluation_id}` | Read a persisted risk evaluation and its formula version, input hash, policy hash, and event binding. |
| `GET /v1/governance/assets/{asset_id}/evidence` | Read registration, approval, regulatory, incident, review, and evidence chain for one asset. |
| `POST /v1/evidence/sanitize` | Quarantine and sanitize uploaded or referenced evidence before it can feed search snippets, agent recall, or proof claims. |
| `POST /v1/claim-boundaries/evaluate` | Evaluate verified, claimed, inferred, stale, missing, blocked, and not-claimed statements for a timeline, asset, packet, or export. |
| `POST /v1/governance/assets/{asset_id}/suspend` | Suspend governed asset and append lifecycle evidence. |
| `POST /v1/governance/assets/{asset_id}/reviews` | Trigger or schedule review. |
| `GET /v1/regulatory/profiles` | Read supported regulatory/control profiles and their required evidence fields. |
| `PATCH /v1/governance/assets/{asset_id}/regulatory/eu-ai-act` | Update EU AI Act evidence posture. |
| `PATCH /v1/governance/assets/{asset_id}/regulatory/nist-ai-rmf` | Update NIST AI RMF evidence posture. |
| `PATCH /v1/governance/assets/{asset_id}/regulatory/hipaa` | Update HIPAA evidence posture. |
| `PATCH /v1/governance/assets/{asset_id}/regulatory/nyc-ll144` | Update NYC LL144 evidence posture. |
| `PATCH /v1/governance/assets/{asset_id}/regulatory/financial-services` | Update financial-services evidence posture. |
| `GET /v1/governance/assets/{asset_id}/exports/evidence.pdf` | Download per-asset evidence export with access log. |
| `GET /v1/governance/assets/{asset_id}/exports/evidence.json` | Download machine-readable evidence export with access log. |
| `GET /v1/approvals` | List pending and completed approvals by risk tier, role, and project. |
| `POST /v1/approvals/{approval_id}/decision` | Record approve/decline/changes-requested decision, conditions, notes, checklist. |
| `GET /v1/regulatory/posture` | Portfolio-level evidence posture across EU AI Act, NIST, HIPAA, NYC LL144, and sectoral controls. |
| `GET /v1/incidents` | List AI-related incidents linked to assets, tasks, sessions, or vendors. |
| `POST /v1/incidents` | Log incident and append event. |
| `PATCH /v1/incidents/{incident_id}` | Append response action and status update. |
| `GET /v1/reviews` | List periodic reviews. |
| `POST /v1/reviews/{review_id}/complete` | Complete review with outcome, notes, and evidence refs. |
| `GET /v1/vendors` | List vendor risk assessments. |
| `GET /v1/vendors/questions` | Read versioned vendor due-diligence question set. |
| `POST /v1/vendors` | Create vendor assessment and append evidence event. |
| `GET /v1/team` | Read members, invites, roles, organization settings, and review cadence. |
| `POST /v1/team/invites` | Invite user and append access event. |
| `DELETE /v1/team/invites/{invite_id}` | Revoke invite and append access event. |
| `GET /v1/notifications` | Read scoped notifications and pending actions. |
| `POST /v1/notifications/read-all` | Mark notifications read and append acknowledgement where policy requires. |
| `GET /v1/exports/inventory.csv` | Export inventory CSV with access log. |
| `GET /v1/exports/governance-summary.pdf` | Export governance summary PDF with access log and redaction/receipt policy. |
| `GET /v1/projects` | List visible tenant projects. |
| `GET /v1/tasks` | List/filter work items by project, agent, session, status, confidence, or date. |
| `GET /v1/tasks/{task_id}` | Read task current state. |
| `GET /v1/access-log` | Query access events by asset, task, session, packet, actor, date, or action. |
| `GET /v1/tasks/{task_id}/access-log` | Show who viewed, exported, approved, changed, or attempted access. |
| `GET /v1/sessions/{session_id}` | Read session current state. |
| `GET /v1/sessions/{session_id}/provenance` | Read bounded provenance: user/service account, agent, client app, host, IP class, transport class, policy. |
| `GET /v1/agents` | List tenant-scoped agent identities and source harnesses. |
| `GET /v1/evidence/{artifact_id}` | Read evidence metadata and safe access URL where authorized. |
| `POST /v1/evidence` | Register or upload evidence metadata, then emit `evidence.attached`. |
| `GET /v1/proof-packets/{packet_id}` | Read packet metadata and status. |
| `GET /v1/proof-packets/{packet_id}/download` | Download redacted packet artifact and append access evidence. |
| `GET /v1/receipts/{receipt_id}` | Resolve receipt metadata, never semantic correctness. |
| `POST /v1/signatures/verify` | Verify event, manifest, export, or packet hash/signature/receipt binding. |
| `GET /v1/live/subscriptions` | List live subscription channels visible to a user or agent. |

## Event Envelope Quick Reference

Required fields:

```json
{
  "schema_version": "if.blackboard.governance_event.v1",
  "event_id": "evt_...",
  "tenant_id": "ten_...",
  "workspace_id": "ws_...",
  "project_id": "proj_...",
  "task_id": "task_...",
  "session_id": "sess_...",
  "agent_id": "agent_...",
  "principal_id": "principal_...",
  "event_type": "checkpoint.written",
  "source_harness": "rook",
  "transport_class": "https_api",
  "payload": {},
  "evidence_refs": [],
  "policy_hash": "sha256:...",
  "redaction_policy_id": "redact_v1",
  "idempotency_key": "idem_...",
  "prev_hash": "sha256:...",
  "event_hash": "sha256:...",
  "integrity": {
    "integrity_class": "signed_and_receipted",
    "payload_sha256": "sha256:...",
    "canonicalization": "json-c14n-v1",
    "key_id": "key_...",
    "signature": {
      "alg": "ed25519",
      "value": "..."
    },
    "receipt_id": "rcpt_..."
  },
  "created_at": "2026-06-27T00:00:00Z"
}
```

Allowed `source_harness` values:

- `rook`
- `byo`
- `api`
- `mcp`
- `operator_admin`

Allowed `transport_class` values:

- `https_api`
- `mcp_gateway`
- `websocket_live`
- `operator_break_glass`

External customer examples should use `https_api`, `mcp_gateway`, or `websocket_live`.

Required `transport_attestation.origin_class` mapping:

| `transport_class` | Allowed product origins | Notes |
|---|---|---|
| `https_api` | `managed_edge` | Customer REST traffic only after gateway auth and tenant scope. |
| `mcp_gateway` | `managed_mcp_gateway` | Customer MCP traffic only through managed gateway. |
| `websocket_live` | `managed_websocket_gateway` | Live notification plane only; not proof authority. |
| `operator_break_glass` | `operator_ssh`, `operator_stdio_mcp`, `operator_http_mcp`, `remote_ssh`, `cloudflare_tunnel`, `maintenance_bridge`, `unknown` | Internal or break-glass only; never customer onboarding. |

If an event arrives over SSH, stdio MCP, a tunnel, a maintenance bridge, or an unknown path, the service must reject it as customer traffic or record it as `operator_break_glass`.

## Proof Packet Quick Reference

Required packet controls:

- deterministic assembly;
- event range;
- hash-chain root;
- evidence refs;
- Claim Boundary decision;
- redaction manifest;
- access-log ids;
- explicit non-claims;
- packet integrity binding;
- receipt id when policy requires trace binding.

Proof Packet v1 must not claim:

- semantic correctness by default;
- hidden evidence completeness;
- absence of omitted context unless a verifier proves it;
- integrity of off-platform systems beyond captured hashes, etags, signatures, or receipts.

Required non-claim example:

```text
Receipt proves artifact bytes and binding metadata, not semantic correctness.
```

## Claim Boundary Guide

Blackboard may use these labels:

- `verified`
- `claimed`
- `inferred`
- `stale`
- `missing`
- `blocked`
- `not_claimed`

Redaction is tracked separately as `none`, `partial`, or `removed` in evidence refs and redaction manifests. Do not encode `redacted` as a claim-confidence class.

Automatic claim rules:

| Statement | Allowed only if |
|---|---|
| Agent completed task | Closeout event exists and required evidence refs resolve. |
| Artifact was produced | Object exists and hash or etag matches. |
| Reviewer approved | Reviewer event exists with principal, role, timestamp, and scope. |
| Packet is externally shareable | Redaction policy applied and manifest exists. |
| Receipt proves integrity | Hash chain and receipt binding validate. |
| Work was semantically correct | Never automatic; requires human review event or domain verifier event. |

## Managed MCP Guide

Managed MCP is a product surface for agents and external harnesses that already use MCP.

Capability namespace:

`if.blackboard`

External docs should present the capabilities as Blackboard features, not as internal module taxonomy.

Target MCP capabilities:

| Capability | Purpose | REST equivalent |
|---|---|---|
| `if.blackboard.events.write` | Append a task/session/checkpoint/evidence/access/proof event. | `POST /v1/events` |
| `if.blackboard.governance.dashboard` | Read live governance posture. | `GET /v1/governance/dashboard` |
| `if.blackboard.governance.assets.list` | Search/list governed AI assets and use cases. | `GET /v1/governance/assets` |
| `if.blackboard.governance.assets.register` | Register an AI tool, use case, or governed agent workflow. | `POST /v1/governance/assets` |
| `if.blackboard.governance.assets.risk` | Read risk score, dimensions, tier, and claim-boundary decision. | `GET /v1/governance/assets/{asset_id}/risk` |
| `if.blackboard.risk.evaluate` | Evaluate risk with the production server-side policy formula. | `POST /v1/risk/evaluations` |
| `if.blackboard.claim_boundaries.evaluate` | Evaluate allowed claim statements for a task, asset, packet, or export. | `POST /v1/claim-boundaries/evaluate` |
| `if.blackboard.governance.assets.evidence` | Read per-asset evidence chain. | `GET /v1/governance/assets/{asset_id}/evidence` |
| `if.blackboard.evidence.sanitize` | Sanitize or quarantine untrusted evidence before search, recall, or proof reuse. | `POST /v1/evidence/sanitize` |
| `if.blackboard.approvals.list` | Read approval queue. | `GET /v1/approvals` |
| `if.blackboard.approvals.decide` | Record approval decision. | `POST /v1/approvals/{approval_id}/decision` |
| `if.blackboard.regulatory.posture` | Read evidence posture. | `GET /v1/regulatory/posture` |
| `if.blackboard.regulatory.profiles` | Read supported regulatory/control profiles. | `GET /v1/regulatory/profiles` |
| `if.blackboard.regulatory.update` | Update EU AI Act, NIST AI RMF, HIPAA, NYC LL144, or financial-services evidence posture. | `PATCH /v1/governance/assets/{asset_id}/regulatory/{framework}` |
| `if.blackboard.incidents.write` | Log or update incident. | `POST /v1/incidents`, `PATCH /v1/incidents/{incident_id}` |
| `if.blackboard.reviews.complete` | Complete periodic review. | `POST /v1/reviews/{review_id}/complete` |
| `if.blackboard.vendors.assess` | Create vendor assessment. | `POST /v1/vendors` |
| `if.blackboard.tasks.timeline` | Read an authoritative timeline. | `GET /v1/tasks/{task_id}/timeline` |
| `if.blackboard.tasks.search` | Search proof records. | `GET /v1/search` |
| `if.blackboard.proof_packets.create` | Assemble Proof Packet v1. | `POST /v1/proof-packets` |
| `if.blackboard.proof_packets.get` | Read packet metadata. | `GET /v1/proof-packets/{packet_id}` |
| `if.blackboard.access_log.get` | Read who accessed what. | `GET /v1/tasks/{task_id}/access-log` |
| `if.blackboard.sessions.provenance` | Read session/device/client/transport provenance. | `GET /v1/sessions/{session_id}/provenance` |
| `if.blackboard.integrity.verify` | Verify event, manifest, export, packet, hash-chain, signature, or receipt binding. | `POST /v1/signatures/verify` |
| `if.blackboard.contracts.validate` | Validate local or submitted event/packet shape. | contract verifier or validation API |

MCP request target shape:

```json
{
  "tool": "if.blackboard.events.write",
  "arguments": {
    "event": {
      "schema_version": "if.blackboard.governance_event.v1"
    }
  }
}
```

MCP controls:

- bearer token required;
- audience must be MCP-specific;
- tenant, project, principal, agent, and tool scope checked;
- tool call writes access/provenance evidence where policy requires;
- raw SSH wrappers are not a customer MCP transport.

## WebSocket Live Guide

Target URL:

`wss://api.infrafabric.io/v1/live`

Use WebSocket for:

- progress updates;
- wake/contact notifications;
- shared Proof Desk UI updates;
- live task status subscriptions;
- notification fan-out.

Do not use WebSocket as proof authority.

Subscription example:

```json
{
  "type": "subscribe",
  "tenant_id": "ten_demo",
  "workspace_id": "ws_demo",
  "project_id": "proj_demo",
  "channels": [
    "tasks.task_demo.events",
    "sessions.sess_demo.progress"
  ],
  "resume_after_event_id": "evt_demo_010"
}
```

Live message example:

```json
{
  "type": "task.event.available",
  "event_id": "evt_demo_011",
  "task_id": "task_demo",
  "session_id": "sess_demo",
  "summary": "checkpoint.written",
  "authoritative_read": "/v1/tasks/task_demo/timeline?from_event_id=evt_demo_011"
}
```

Resync rule:

If a WebSocket client misses messages, it must resume through REST timeline or search. Live messages are notifications that point to durable event truth.

Scope rule:

The server must derive final tenant, workspace, project, principal, and channel scope from the token and RBAC decision. Caller-supplied `tenant_id`, `workspace_id`, `project_id`, and `channels` are requests, not authority. Broader requested scope is denied or narrowed before subscription.

## Degraded-Mode Contract

| Dependency or plane | User-visible behavior | Write behavior | Proof/export behavior |
|---|---|---|---|
| Auth broker down | Login/token exchange unavailable; existing valid sessions may continue until token policy says otherwise. | New writes fail closed with `503` or `401` depending on token state. | Packet assembly blocked if auth/access evidence cannot be verified. |
| Append-only event store down | Proof Desk shows last-known projection with stale banner and no current proof claims. | Writes fail closed. No queueing that could break idempotency or event order. | Packet assembly blocked. |
| Projection worker lag | Timeline/search show `projection_lag_seconds` and stale-state warning. | Writes may continue until lag circuit opens. | Export blocked when projections cannot be verified against event truth. |
| Search index down | Search unavailable or degraded; timeline reads by id still work from authority. | Writes continue if event store/auth are healthy. | Search snippets cannot support proof claims. |
| Object store down | Evidence uploads/downloads unavailable; existing metadata remains visible with warning. | Evidence attach writes fail closed unless object ref already resolves. | Packet export blocked if evidence refs cannot resolve. |
| Evidence sanitizer down | Raw evidence ingestion quarantined; no new sanitized snippets. | Evidence-bearing writes fail closed or enter quarantine-only state by policy. | Agent-facing recall and packet claims cannot use unsanitized text. |
| WebSocket live gateway down | Live progress and wake/contact unavailable. | Request/response API continues. | No effect on proof authority; clients resync through timeline/search. |
| if.trace receipt surface down | Receipt publication delayed and marked pending. | Core writes may continue if policy permits deferred receipts. | External export blocked when policy requires receipt before sharing. |

## Target Customer CLI

The target CLI should be named simply:

`blackboard`

It should support:

```bash
blackboard auth login
blackboard auth status
blackboard projects list
blackboard governance dashboard
blackboard assets list --project proj_demo
blackboard assets register --file ai-tool-registration.json
blackboard assets risk asset_demo
blackboard risk evaluate --asset asset_demo --file risk-inputs.json
blackboard claim-boundaries evaluate --task task_demo --file claims.json
blackboard evidence sanitize --artifact artifact_demo --policy sanitizer_default_v1
blackboard assets evidence asset_demo
blackboard approvals list
blackboard approvals decide approval_demo --decision approved --condition "Human review required quarterly"
blackboard regulatory posture
blackboard regulatory update asset_demo --framework eu-ai-act --file posture-eu-ai-act.json
blackboard regulatory update asset_demo --framework nist-ai-rmf --file posture-nist-ai-rmf.json
blackboard regulatory update asset_demo --framework hipaa --file posture-hipaa.json
blackboard regulatory update asset_demo --framework nyc-ll144 --file posture-nyc-ll144.json
blackboard regulatory update asset_demo --framework financial-services --file posture-finserv.json
blackboard incidents log --asset asset_demo --severity High --title "Unauthorized AI use"
blackboard reviews complete review_demo --outcome unchanged --notes-file review.md
blackboard vendors assess --file vendor-scorecard.json
blackboard tasks list --project proj_demo
blackboard events submit --file event.json --idempotency-key idem_...
blackboard tasks timeline task_demo --include evidence,access,claim-boundary
blackboard search "oauth callback" --project proj_demo
blackboard proof-packets create --task task_demo --redaction-policy redact_external_v1
blackboard proof-packets get pp_demo_001
blackboard proof-packets download pp_demo_001 --out ./packet.json
blackboard integrity verify --packet pp_demo_001
blackboard contracts smoke
```

CLI requirements:

- every command supports `-h` and `--help`;
- every write command supports `--idempotency-key`;
- every command supports `--profile` or equivalent tenant/workspace/project selection;
- auth tokens are stored in the platform credential store, not printed;
- `--json` emits stable machine-readable output;
- `--trace` emits correlation ids and receipt ids, not secrets;
- `blackboard contracts smoke` runs local schema and binding checks.

## Current Local Verifier CLI

Current verifier:

`/root/scripts/if_blackboard_governance_contracts.py`

Help:

```bash
/root/scripts/if_blackboard_governance_contracts.py -h
```

Generate samples:

```bash
/root/scripts/if_blackboard_governance_contracts.py sample event --out /root/docs/data/if-blackboard-governance-event-envelope.sample.v1.json
/root/scripts/if_blackboard_governance_contracts.py sample packet --out /root/docs/data/if-blackboard-governance-proof-packet.sample.v1.json
```

Validate:

```bash
/root/scripts/if_blackboard_governance_contracts.py validate event /root/docs/data/if-blackboard-governance-event-envelope.sample.v1.json
/root/scripts/if_blackboard_governance_contracts.py validate packet /root/docs/data/if-blackboard-governance-proof-packet.sample.v1.json
```

Smoke:

```bash
/root/scripts/if_blackboard_governance_contracts.py smoke
```

Black/white verifier boundary:

- It proves JSON shape and deterministic hash bindings for the sample contracts.
- It does not prove deployed REST endpoints.
- It does not prove PostgreSQL RLS.
- It does not prove SaaS tenant isolation.
- It does not prove deployed signing keys or key rotation.
- It does not prove semantic correctness.

## Operator CLI Boundary

Current internal paths such as `if-cli`, `ifproxy`, `iftransport`, SSH-wrapped MCP, maintenance bridge helpers, and local laptop copy scripts are operator/admin compatibility paths.

They may remain useful for InfraFabric development and migration, but they must not be required for:

- customer onboarding;
- customer agent runtime;
- customer proof export;
- customer MCP usage;
- customer support docs;
- site marketing proof.

The target product command surface is `blackboard`, backed by HTTPS API and managed MCP.

## Builder Coverage Matrix

This matrix is the checklist for the site builder. Every row should have UI copy, REST support, MCP support when agent-facing, and CLI smoke support.

| Site/build feature | REST | MCP | CLI |
|---|---|---|---|
| Dashboard posture | `GET /v1/governance/dashboard` | `if.blackboard.governance.dashboard` | `blackboard governance dashboard` |
| Register AI use/tool/workflow | `POST /v1/governance/assets` | `if.blackboard.governance.assets.register` | `blackboard assets register` |
| List/search AI registry | `GET /v1/governance/assets`, `GET /v1/search` | `if.blackboard.governance.assets.list` | `blackboard assets list` |
| Per-asset evidence page | `GET /v1/governance/assets/{asset_id}/evidence` | `if.blackboard.governance.assets.evidence` | `blackboard assets evidence` |
| Risk score and tier | `GET /v1/governance/assets/{asset_id}/risk` | `if.blackboard.governance.assets.risk` | `blackboard assets risk` |
| Server-side risk evaluation | `POST /v1/risk/evaluations` | `if.blackboard.risk.evaluate` | `blackboard risk evaluate` |
| Claim-boundary evaluation | `POST /v1/claim-boundaries/evaluate` | `if.blackboard.claim_boundaries.evaluate` | `blackboard claim-boundaries evaluate` |
| Evidence sanitisation/quarantine | `POST /v1/evidence/sanitize` | `if.blackboard.evidence.sanitize` | `blackboard evidence sanitize` |
| Approval queue | `GET /v1/approvals` | `if.blackboard.approvals.list` | `blackboard approvals list` |
| Approval decision | `POST /v1/approvals/{approval_id}/decision` | `if.blackboard.approvals.decide` | `blackboard approvals decide` |
| Regulatory posture | `GET /v1/regulatory/posture` | `if.blackboard.regulatory.posture` | `blackboard regulatory posture` |
| Regulatory/control profile catalog | `GET /v1/regulatory/profiles` | `if.blackboard.regulatory.profiles` | `blackboard regulatory profiles` |
| EU AI Act posture update | `PATCH /v1/governance/assets/{asset_id}/regulatory/eu-ai-act` | `if.blackboard.regulatory.update` | `blackboard regulatory update --framework eu-ai-act` |
| NIST AI RMF posture update | `PATCH /v1/governance/assets/{asset_id}/regulatory/nist-ai-rmf` | `if.blackboard.regulatory.update` | `blackboard regulatory update --framework nist-ai-rmf` |
| HIPAA posture update | `PATCH /v1/governance/assets/{asset_id}/regulatory/hipaa` | `if.blackboard.regulatory.update` | `blackboard regulatory update --framework hipaa` |
| NYC LL144 posture update | `PATCH /v1/governance/assets/{asset_id}/regulatory/nyc-ll144` | `if.blackboard.regulatory.update` | `blackboard regulatory update --framework nyc-ll144` |
| Financial-services posture update | `PATCH /v1/governance/assets/{asset_id}/regulatory/financial-services` | `if.blackboard.regulatory.update` | `blackboard regulatory update --framework financial-services` |
| Vendor scorecard | `GET /v1/vendors/questions`, `POST /v1/vendors` | `if.blackboard.vendors.assess` | `blackboard vendors assess` |
| Incident log | `GET /v1/incidents`, `POST /v1/incidents`, `PATCH /v1/incidents/{incident_id}` | `if.blackboard.incidents.write` | `blackboard incidents log` |
| Periodic reviews | `GET /v1/reviews`, `POST /v1/reviews/{review_id}/complete` | `if.blackboard.reviews.complete` | `blackboard reviews complete` |
| Team settings | `GET /v1/team`, `POST /v1/team/invites`, `DELETE /v1/team/invites/{invite_id}` | usually not agent-facing | `blackboard team ...` |
| CSV/PDF exports | `GET /v1/exports/*`, `POST /v1/proof-packets` | `if.blackboard.proof_packets.create` | `blackboard exports ...` |
| Create/register work item | `POST /v1/events` with `task.created` | `if.blackboard.events.write` | `blackboard events submit` |
| Bind session to task | `POST /v1/events` with `session.bound` | `if.blackboard.events.write` | `blackboard events submit` |
| Write checkpoint/update | `POST /v1/events` with `checkpoint.written` or `task.updated` | `if.blackboard.events.write` | `blackboard events submit` |
| Attach evidence | `POST /v1/evidence` plus `POST /v1/events` | `if.blackboard.events.write` | `blackboard evidence attach` |
| Search previous agent work | `GET /v1/search` | `if.blackboard.tasks.search` | `blackboard search` |
| View timeline | `GET /v1/tasks/{task_id}/timeline` | `if.blackboard.tasks.timeline` | `blackboard tasks timeline` |
| View access history | `GET /v1/tasks/{task_id}/access-log` | `if.blackboard.access_log.get` | `blackboard access-log get` |
| View session provenance | `GET /v1/sessions/{session_id}/provenance` | `if.blackboard.sessions.provenance` | `blackboard sessions provenance` |
| Create proof packet | `POST /v1/proof-packets` | `if.blackboard.proof_packets.create` | `blackboard proof-packets create` |
| Download proof packet | `GET /v1/proof-packets/{packet_id}/download` | `if.blackboard.proof_packets.get` | `blackboard proof-packets download` |
| Verify integrity binding | `POST /v1/signatures/verify` | `if.blackboard.integrity.verify` | `blackboard integrity verify` |
| Watch live progress | `wss://api.infrafabric.io/v1/live` | optional live notification tool only | `blackboard live watch` |
| Validate contract | validation API or local verifier | `if.blackboard.contracts.validate` | `blackboard contracts smoke` |

## Security And Trust Requirements

Required:

- no customer SSH;
- tenant, workspace, project, principal, and agent scope on every call;
- append-only event truth;
- signed or hash-bound events and packet artifacts according to policy;
- idempotent writes;
- access logs for proof reads and exports;
- redaction manifest before external sharing;
- Claim Boundary decision before buyer-visible proof claims;
- search hydration from authority;
- live WebSocket messages treated as notifications only;
- receipt wording says integrity/binding, not semantic correctness.

Forbidden in customer docs:

- maintenance bridge setup;
- laptop path instructions;
- raw hostnames not intended for customers;
- secret paths or secret values;
- direct Meilisearch credentials;
- direct PostgreSQL access;
- SSH-wrapped MCP as customer onboarding;
- "quantum-secure" wording.

Allowed trust wording:

- "signed or hash-bound according to policy";
- "receipt-bound where policy requires";
- "QUANTUM READY when a PQ receipt exists";
- "verified, claimed, inferred, stale, missing, blocked, or not claimed, with redaction state shown separately";
- "receipt proves bytes and binding metadata, not semantic correctness."

## Quickstart For Builders Today

Run local contract smoke:

```bash
/root/scripts/if_blackboard_governance_contracts.py smoke
```

Run local runtime smoke:

```bash
/root/scripts/if_blackboard_governance_runtime.py smoke
```

The runtime smoke is the current executable proof for the event-truth path: local append-only event writes, tenant-scoped timeline/search reads, Claim Boundary evaluation, schema-valid Proof Packet v1 assembly, no-customer-SSH rejection, and cross-tenant packet blocking. It is not a claim that the hosted REST API, managed MCP gateway, WebSocket gateway, PostgreSQL RLS, or production signing service is deployed.

Run local HTTP API preview smoke:

```bash
/root/scripts/if_blackboard_governance_api.py smoke
```

This is the current integrator-ready executable proof. It starts a localhost HTTP server with a per-run token, submits valid governance events through `POST /v1/events`, reads the task timeline, searches proof records, evaluates Claim Boundary output, assembles a schema-valid Proof Packet v1, and verifies no-customer-SSH, preflight, cross-tenant, and same-tenant cross-workspace negative controls over HTTP.

Regenerate samples:

```bash
/root/scripts/if_blackboard_governance_contracts.py sample event --out /root/docs/data/if-blackboard-governance-event-envelope.sample.v1.json
/root/scripts/if_blackboard_governance_contracts.py sample packet --out /root/docs/data/if-blackboard-governance-proof-packet.sample.v1.json
```

Validate docs model:

```bash
structurizr validate -workspace /root/docs/5002-if-rook-harness-structurizr-c4-workspace-2026-06-27.dsl
```

Check ensemble conformance:

```bash
/root/scripts/if_blackboard_governance_contracts.py conformance
```

Check guide sync:

```bash
rg -n "5009|CLI / API / REST / MCP|if.blackboard.events.write|POST /v1/events|GET /v1/search|POST /v1/proof-packets|no customer SSH" /root/docs/5002-if-rook-harness-structurizr-c4-workspace-2026-06-27.dsl /root/docs/5003-if-blackboard-rook-governance-saas-autoplan-roadmap-2026-06-27.md /root/docs/5007-if-blackboard-governance-saas-rationalized-architecture-2026-06-27.md /root/docs/5008-if-blackboard-governance-api-contract-v1-2026-06-27.md /root/docs/5009-if-blackboard-governance-cli-api-rest-mcp-user-guide-v1-2026-06-27.md
```

## Implementation Gaps To Close

The following remain gaps until implemented and smoked:

- deploy Auth Broker with Google/OIDC callback round trip, service accounts, MCP audience tokens, revocation, and replay protection;
- turn the local runtime-smoked `POST /v1/events` contract into the hosted API with schema validation, idempotency, tenant/RBAC, signing/hash-binding, append-only store, and audit evidence;
- deploy PostgreSQL append-only event store with RLS, partitioning, insert-only application role, mutation-deny triggers, logical replication, and PITR;
- deploy projection worker, current-state projections, outbox, queue, and rebuild checks;
- deploy access-filtered search index and authority hydration;
- deploy Proof Desk v1 screens;
- deploy Proof Packet Service v1;
- deploy Claim Boundary Engine;
- deploy managed MCP Gateway;
- deploy WebSocket Live Gateway;
- deploy tenant isolation verifier;
- implement target `blackboard` customer CLI;
- document and smoke supporting builder endpoints.

## Done Criteria For Public Builder Claim

Do not claim the site promise is product-ready until all are true:

- `POST /v1/events` accepts and rejects representative events correctly.
- Timeline reads hydrate from event truth and show staleness.
- Search returns filtered discovery results and hydrates before proof claims.
- Proof Packet v1 export passes schema and coherence checks.
- Access-log endpoint records and returns reads/exports.
- Session provenance shows tenant, user/service account, agent, client app, host/machine, IP class, and transport class where policy permits.
- Managed MCP tools call the same contracts as REST.
- Target CLI help and smoke commands work.
- WebSocket subscriptions resync through REST after missed events.
- Tenant isolation probes pass.
- Structurizr DSL validates.
- Contract verifier smoke passes.
