Document · doc-0003

Regulatory content-generation use case design

Regulatory content-generation use case: design

Status: corrected after adversarial review (FAIL, 5 blockers); the corrections are in the sections marked “Review corrections”. Parent task: see the epic that references this doc.

Purpose

Add a second, opt-in use case beside Touchline Times: regulated-document authoring. A fictional sponsor’s medical writers use AI agents to draft sections of an Informed Consent Form (ICF) and a Clinical Study Report (CSR, ICH E3 structure) from structured study data. The demo shows what Agent Observability, guards, evaluators and experiments look like when output must be grounded, reviewed and auditable. Nothing from any real customer engagement enters this repository: sponsor, compound, studies, sites and subjects are all fictional, and document structure follows public ICH E3 and ICF guidance only.

Decisions taken by the maintainer (do not re-open)

Shape (engineering choices inside that scope)

Observability story to demonstrate

Terraform and chart seams

Out of scope

Review corrections (binding on every subtask)

Object classification (resolves “what is a Touchline object”)

Every resource and local is one of: touchline-only (gated on local.touchline_enabled), always-on (agent host and shared objects, never gated by use_cases), or regulatory-only (gated on local.regulatory_enabled). AIO-0018.01 writes this table into this doc before changing code. Known mixed objects, none of which may be gated whole:

Epic AC#2 therefore means: a regulatory-only deployment has no Touchline in-app workload objects (namespace, agents, site, loadgen, touchline-only evaluators/rules/dashboards); agent-host and shared var.name-prefixed objects remain. A regulatory-only user who also sets agent_host_enabled = false gets nothing Touchline-named except the shared folder.

Implementation classification inventory

This inventory is frozen before the gating implementation. All names below are Terraform addresses or local names; indexed resources retain their existing instance keys.

Classification Objects Behaviour
Touchline only kubernetes_namespace_v1.this; all four kubernetes_secret_v1 objects; helm_release.this; grafana_service_account.experiments and its token Conditional on Touchline; chart values output is null when disabled.
Touchline only data.aws_iam_policy_document.agents_assume; aws_iam_role.agents; aws_iam_role_policy.agents_bedrock; aws_eks_pod_identity_association.agents Conditional Pod Identity resources; role output is null when disabled.
Touchline only grafana_frontend_o11y_app.site; grafana_asserts_prom_rule_file.service_graph; grafana_asserts_trace_config.this Existing feature flags also require Touchline.
Touchline only Evaluators agents_quality, injected_tool_result, tool_result_markers, responsible_gambling, tool_result_grounded, response_not_empty, injection_resisted, session_helpfulness; guards agents_redact_tool_pii, agents_injected_tool_result; evaluation rules agents_quality, compliance_responsible_gambling, specialists_tool_grounding, news_injection_resistance, orchestrator_session_helpfulness; collection and rule action rg_review Conditional individual objects, with permanent moved blocks.
Mixed, filter per item local.grafana.dashboards; recording and alert rule groups Only dashboard agents, recording rules rec-agent-cost and rec-agents-p95, and alerts al-guard and al-agents-cost require Touchline. rec-guard includes coding-agent outcomes and remains.
Always on / existing flags All remaining objects in aws-agent-host, aws-developer-bedrock, aws-bedrock, aws-cognito, aws-metric-stream, grafana-cloud, grafana-ingest, grafana-datasource, grafana-appo11y; the folder, contact point, remaining dashboards and rules; KG onboarding objects; shared evaluators and coding-agent guards/rules; terraform_data.team_checks Preserve existing flags and addresses. Bedrock team profiles remain the existing gateway/developer team matrix, not a filtered or regulatory-expanded matrix.
Existing locals, unchanged maps service_names, agent_teams, team_models, teams, developers, service_accounts, shared bedrock_invoke Retain shared host/gateway contract. Chart locals are conditional; only the first team precondition is relaxed without Touchline.
Regulatory only (foundation) regulatory_service_names, regulatory_agent_teams, regulatory_team_models and validated regulatory inputs Separate namespace and prefix; actual resources belong to the subsequent provisioning subtask. No regulatory teams enter Cognito or gateway IAM.

Terraform seams

Proof of the no-diff criterion

The demo was destroyed on 2026-10-16, so there is no live state to plan against. Proof is a mock-provider test: terraform/tests/*.tftest.hcl with mock_provider blocks (OpenTofu 1.13.1), one command = plan run per use_cases combination, asserting which resources exist, plus a diff of planned addresses and values between the base commit and the candidate with the moved mapping applied. Wire it into just lint so just check runs it. tofu validate ignores variable values and proves nothing about combinations.

App and guard behaviour

Release and plumbing (assigned in the subtasks)

justfile setup, fmt, test, lint, render and ci.yml “Install dependencies” loop over agents site mcp-tools and must include the regulatory app; .pre-commit-config.yaml check-yaml exclude must cover charts/regulatory/templates; examples/complete passes use_cases through and outputs use try(); docs.toml nav, deploy/flux, deploy/argocd, Dockerfile.dockerignore, the images variable description and docs/security.md list the sixth image; AGENTS.md gets the new gotchas. There is one shared images.tag default, so release-please needs the new chart’s Chart.yaml, values.yaml and README (with x-release-please-version markers) in extra-files. The regulatory image reuses the agents dependency tree, so it hits the braces CVE: the maintainer’s Trivy exception is scoped to the agents image only and must not be extended without a new decision. A live check before the first release needs an image tag: build one from images.yml or just images-push to a mirror.

Open questions for the maintainer

Frozen implementation contracts for the regulatory build

The following seams are shared by the app, chart, Terraform, experiments and dashboards.

Current local implementation limits

The dashboard now exposes app-derived estimated generation cost by document type, section, agent role and model, plus explicit unpriced-generation counts. Verified pricing is limited to standard uncached EU Haiku4.5/Sonnet4.6 requests invoked in eu-west-1. Synthetic stub tokens and orchestrator aggregates are excluded; unknown pricing is never represented as free usage. Document throughput, review states, grounding, reading grade and latency remain app-derived. Live data and snapshots remain unverified until the continuing live proof records them. The local regulatory image builds, but Trivy reports unpatched CVE-2026-93687 in installed braces 3.0.3. The existing agents-only exception has not been reused. Publication remains gated until an approved remediation or a separate maintainer decision for this image.

Review corrections for this implementation batch

The source-note remote hook begins as warn at priority 10 with short_circuit=false, following the standing rollout rule. App-local marker rejection remains fail closed. The guard-policy probe expects allow plus a failed matching source-note evaluation, so allow by itself never proves remote detection. Promotion to deny needs reviewed warn evidence and an explicit enforcement decision. The load generator runs continuously in its Deployment unless MAX_REQUESTS is explicitly supplied; tests/manual runs remain bounded.

Regulatory image exception approved 2026-10-21

The maintainer approved the prepared separate exception for CVE-2026-93687 only, installed path app/regulatory/node_modules/braces/package.json, expiry 2026-11-15. The regulatory matrix entry uses its own ignore file. All other image scan gates remain unchanged, and upstream removal is tracked on the existing braces advisory task. This permits publication, not deployment or proof of live acceptance. No automatic renewal is authorized.

Live acceptance completed 2026-10-21

The owner authorized autonomous continuation through a bounded live proof on the existing private consumer target. Final dashboard source is 7530badaaa684bc7690a27c090ef7ac102a27f82; runtime source is 80431c41ee435ad77f0aa6303b51437fa0d83aa8, signed multiarch image sha256:fcad970a28e566e082b8174bb6a2d1bb6b3187bab776089863468478f24d934e. Regulatory image builds/scans/signing succeeded in workflow 39534401369. Full local gates and source CI 39534400964 / 39535235286 passed. CodeRabbit completed the runtime/query review; the final declarative axis/point fix was validated without another review.

Detailed private target, plan, snapshot and readback evidence remains with the consumer board; no private identifiers or credentials belong in this public board. The approved braces exception still expires 2026-11-15 and has no automatic renewal.

View the source file on GitHub