Investigation Review Hub — Gap & Remediation Dashboard
What this skill does
Produces a structured JSON gap / remediation dashboard for a legal or regulatory
matter, drawn entirely from a running Investigation Review Hub HTTP service. The
deliverable is always a single JSON object that conforms to a task-supplied
answer_template.json (the schema contract). It is never a narrative memo.
The skill is matter-agnostic and template-agnostic. The same procedure handles every
deliverable archetype seen across the train tasks:
- Rolling production gap analysis —
critical_findings, category_statuses,
metrics, priority_actions
- Retention / litigation-hold gap review —
retention_events,
communication_gaps, available_archives, metrics, recommended_actions
- Cross-system remediation dashboard —
top_risks, category_coverage,
retained_or_available_sources, metrics, action_plan
- Production-readiness review —
readiness_statuses, issue_ledger,
privilege_corrections, metrics, priority_actions
Do not hardcode any of those shapes. Read the task's answer_template.json and conform
to that template's required keys, ordering rules, enums, field types, and numeric
precision.
Hard constraints (read first)
- Source of record is the running hub, reached only over the network. Read
environment_access.md (in the work directory) at run time to obtain the base URL,
the SQL API key, and the allow-list of endpoints. Do not copy the URL, key, or
port into the skill — read them fresh each run. Do not open local environment
source files, database files, seeds, generation manifests, setup scripts, or any
"hidden notes" file. The prompts explicitly forbid all of these.
- Use only the allowed endpoints. If an endpoint is not in
environment_access.md,
do not call it. The read-only SQL endpoint (POST /api/query) requires the
X-API-Key header named in environment_access.md.
- Return exactly one JSON object. No prose, no markdown fences, no trailing
commentary. The whole final answer is the JSON.
- Never copy task-specific answer values from train answers or anywhere else. Every
ID, count, status, and category code in the output must be derived from the live hub
for the matter under review. Train answers are illustrations of method, not a
lookup table.
- Stable IDs verbatim. Use matter, source, event, QC-finding, document,
privilege, action, and category identifiers exactly as they appear in the hub. Do
not invent, rename, or reformat them.
Inputs to read at the start of each run
For the current task directory:
input/prompt.txt — the matter, the deliverable intent, and any task-specific focus.
input/payloads/answer_template.json — the schema contract. Parse it for:
required_top_level_keys, ordering_rules, enums / enum_choices, fields /
schema (item_required_keys + field types), and numeric_precision.
- The remaining payload file (name varies:
request_context.json,
review_scope.json, matter_context.json) — gives matter_id, client, request type,
category-code family and labels, base URL confirmation, and source constraints.
Extract the matter_id from the payload/context file (and confirm it matches the
prompt). Every hub query is scoped to that matter_id.
Procedure
1. Discover the hub's data model
Call GET /api/schema to learn the tables, columns, and relationships. Then call
GET /api/subpoena-categories (filtered to the matter) to fix the authoritative set of
request category codes and their labels for this matter — these codes appear throughout
the answer (category_impacts, affected_categories, category_coverage, etc.).
2. Pull all evidence for the matter
Call each relevant list endpoint and retain only records whose matter matches the
target matter_id:
| Endpoint |
Evidence it provides |
GET /api/matters |
Matter metadata, hold date, review cutoff |
GET /api/productions |
What has been produced / withheld, per category |
GET /api/custodian-sources |
Custodian sources, status (collected / not_collected / partial / lost), source type |
GET /api/documents/search |
Review documents, coding (responsive/privileged/nonresponsive), produced status |
GET /api/privilege-log |
Withheld vs logged doc counts, log completeness, third-party recipients, waiver flags |
GET /api/qc-findings |
Miscoding findings (responsive miscodes, privilege miscodes), zero-claim contradictions |
GET /api/retention-events |
Retention losses, purge/auto-purge, post-hold destruction, policy section, hold_date |
GET /api/remediation-actions |
Candidate remediation actions, owners, priorities |
When a cross-table question is hard to answer from the list endpoints (e.g. "withheld
minus logged, grouped by category"), use POST /api/query with the SQL API key for a
single read-only query. Never write to the hub.
3. Identify the material gaps and defects
Classify each material hub record into an issue type. The enum names differ slightly per
template (issue_type, gap_type, retention status); map the record to the enum
value defined by this task's answer_template.json. The recurring defect families:
- Preservation loss — a source destroyed or lost, especially after the hold date
(post-hold loss is far more severe than pre-hold policy-compliant destruction).
- Collection gap — a required source never collected or only partially collected.
- Personal source gap — personal phone / personal email / personal messaging not
collected.
- Retention / communication loss — auto-purge, active system loss, deleted channel,
missing required record that should exist.
- Responsiveness miscode — a responsive document coded nonresponsive (or a
"zero-claim" contradiction where production claims completeness but a responsive doc
is missing).
- Privilege log gap — documents withheld but not fully logged (withheld > logged).
- Privilege miscoding — privileged docs coded nonprivileged (or vice versa).
- Third-party waiver / privilege exposure — privileged content shared with a
third party, risking waiver.
- Over-designation — business-only counsel copies withheld as privileged.
For full mapping rules (severity, status, production impact, owner, priority), see
references/answer_construction.md.
4. Build each required top-level section
Follow required_top_level_keys exactly — include every key, omit nothing extra.
- Findings / risks / issues / retention events — one object per material defect,
anchored on a single stable hub record ID used as the
finding_id / risk_id /
issue_id / event_id. Carry every supporting record ID in the refs list. Fill the
count fields from the hub (document_count, withheld_count, logged_count,
unlogged_count, volume_count + volume_unit). Use 0 when a count does not
apply; use null only where the template's field type explicitly allows it
(third_party, missing_component, dates, etc.). unlogged_count is
withheld_count − logged_count whenever both apply.
- Category statuses / coverage / readiness — one object per request category that
has a material non-complete status. Aggregate the issue records touching that
category into the refs/issue_refs list and pick the dominant
status /
production_impact / recommended_action. Include the open-issue count where the
template asks for it. Categories with no open gap are generally omitted (the templates
ask for "material non-complete" categories) unless the template says otherwise.
- Retained / available sources / archives — sources that remain a remediation path
(email archive, teams archive, offsite records, backup). State which categories each
limits loss for. If no retained source exists, return an empty list — do not invent one.
- Privilege corrections (when required) — one object per privilege record needing a
correction (supplement log, waiver assessment, recode, downgrade).
- Metrics — rollups computed from the evidence above. See
references/answer_construction.md for the
computation rules. Every metric key in the template must be present; counts are whole
integers; readiness booleans are false when any critical/high open gap exists.
- Priority actions / action plan / recommended actions — the remediation plan,
sorted by priority rank (1 = highest). Each action targets specific hub record IDs and
lists affected categories. Map
action_type → owner and priority per the
conventions in the reference file. Use a stable action_id / target_id.
5. Apply ordering, enum, and precision discipline
- Sort every list per
ordering_rules. The common rules: findings/issues by their ID
ascending; categories by category code ascending; actions by priority_rank ascending
(1 highest); category-code lists ascending within each object. Where a template
specifies a secondary sort key (e.g. "then target_id ascending"), apply it.
- Every enum field must take a value listed in the template's
enums /
enum_choices. If the evidence does not fit cleanly, pick the closest listed value
or other / not_applicable / unknown where those are offered — never invent a new
enum string.
- Use uppercase / exact casing exactly as the enum is written. Category codes use the
matter's own family (e.g.
R09, SEC-3, single letters) verbatim from the hub.
- Whole integers only. No floats, no ranges. Booleans are JSON
true/false.
6. Validate before returning
Self-check the final JSON against the template:
- Every
required_top_level_key present, no extras.
- Every item object has every
item_required_keys / item_required field.
- Every list sorted per
ordering_rules.
- Every enum field value is in the allowed set.
- All counts are integers (or
null/0 per field type); unlogged = withheld − logged.
matter_id matches the task's matter.
- Output is a single JSON object with no surrounding prose.
Emit the JSON object as the entire answer.
What not to do
- Do not read or rely on
train_answers/* values for the live matter — they belong to
other matters and will be wrong.
- Do not hardcode the hub URL, API key, matter ID, category codes, record IDs, or any
counts into the skill or the answer.
- Do not inspect environment source code, database files, seeds, manifests, or setup
scripts even if present.
- Do not produce narrative text, headings, or explanations alongside the JSON.
- Do not skip a required metrics key because it is
0 — include it as 0.
1---2name: fewshot-attempt-01-143description: Investigation Review Hub — Gap & Remediation Dashboard4---5# Investigation Review Hub — Gap & Remediation Dashboard67## What this skill does89Produces a **structured JSON gap / remediation dashboard** for a legal or regulatory10matter, drawn entirely from a running **Investigation Review Hub** HTTP service. The11deliverable is always a single JSON object that conforms to a task-supplied12`answer_template.json` (the schema contract). It is never a narrative memo.1314The skill is matter-agnostic and template-agnostic. The same procedure handles every15deliverable archetype seen across the train tasks:1617- **Rolling production gap analysis** — `critical_findings`, `category_statuses`,18 `metrics`, `priority_actions`19- **Retention / litigation-hold gap review** — `retention_events`,20 `communication_gaps`, `available_archives`, `metrics`, `recommended_actions`21- **Cross-system remediation dashboard** — `top_risks`, `category_coverage`,22 `retained_or_available_sources`, `metrics`, `action_plan`23- **Production-readiness review** — `readiness_statuses`, `issue_ledger`,24 `privilege_corrections`, `metrics`, `priority_actions`2526Do not hardcode any of those shapes. Read the task's `answer_template.json` and conform27to *that* template's required keys, ordering rules, enums, field types, and numeric28precision.2930## Hard constraints (read first)31321. **Source of record is the running hub, reached only over the network.** Read33 `environment_access.md` (in the work directory) at run time to obtain the base URL,34 the SQL API key, and the allow-list of endpoints. Do **not** copy the URL, key, or35 port into the skill — read them fresh each run. Do **not** open local environment36 source files, database files, seeds, generation manifests, setup scripts, or any37 "hidden notes" file. The prompts explicitly forbid all of these.382. **Use only the allowed endpoints.** If an endpoint is not in `environment_access.md`,39 do not call it. The read-only SQL endpoint (`POST /api/query`) requires the40 `X-API-Key` header named in `environment_access.md`.413. **Return exactly one JSON object.** No prose, no markdown fences, no trailing42 commentary. The whole final answer is the JSON.434. **Never copy task-specific answer values** from train answers or anywhere else. Every44 ID, count, status, and category code in the output must be derived from the live hub45 for the matter under review. Train answers are illustrations of *method*, not a46 lookup table.475. **Stable IDs verbatim.** Use matter, source, event, QC-finding, document,48 privilege, action, and category identifiers exactly as they appear in the hub. Do49 not invent, rename, or reformat them.5051## Inputs to read at the start of each run5253For the current task directory:5455- `input/prompt.txt` — the matter, the deliverable intent, and any task-specific focus.56- `input/payloads/answer_template.json` — **the schema contract.** Parse it for:57 `required_top_level_keys`, `ordering_rules`, `enums` / `enum_choices`, `fields` /58 `schema` (item_required_keys + field types), and `numeric_precision`.59- The remaining payload file (name varies: `request_context.json`,60 `review_scope.json`, `matter_context.json`) — gives `matter_id`, client, request type,61 category-code family and labels, base URL confirmation, and source constraints.6263Extract the **matter_id** from the payload/context file (and confirm it matches the64prompt). Every hub query is scoped to that matter_id.6566## Procedure6768### 1. Discover the hub's data model6970Call `GET /api/schema` to learn the tables, columns, and relationships. Then call71`GET /api/subpoena-categories` (filtered to the matter) to fix the authoritative set of72request category codes and their labels for this matter — these codes appear throughout73the answer (`category_impacts`, `affected_categories`, `category_coverage`, etc.).7475### 2. Pull all evidence for the matter7677Call each relevant list endpoint and retain only records whose matter matches the78target `matter_id`:7980| Endpoint | Evidence it provides |81|---|---|82| `GET /api/matters` | Matter metadata, hold date, review cutoff |83| `GET /api/productions` | What has been produced / withheld, per category |84| `GET /api/custodian-sources` | Custodian sources, status (collected / not_collected / partial / lost), source type |85| `GET /api/documents/search` | Review documents, coding (responsive/privileged/nonresponsive), produced status |86| `GET /api/privilege-log` | Withheld vs logged doc counts, log completeness, third-party recipients, waiver flags |87| `GET /api/qc-findings` | Miscoding findings (responsive miscodes, privilege miscodes), zero-claim contradictions |88| `GET /api/retention-events` | Retention losses, purge/auto-purge, post-hold destruction, policy section, hold_date |89| `GET /api/remediation-actions` | Candidate remediation actions, owners, priorities |9091When a cross-table question is hard to answer from the list endpoints (e.g. "withheld92minus logged, grouped by category"), use `POST /api/query` with the SQL API key for a93single read-only query. Never write to the hub.9495### 3. Identify the material gaps and defects9697Classify each material hub record into an issue type. The enum names differ slightly per98template (`issue_type`, `gap_type`, retention `status`); map the record to the **enum99value defined by this task's `answer_template.json`**. The recurring defect families:100101- **Preservation loss** — a source destroyed or lost, especially *after* the hold date102 (post-hold loss is far more severe than pre-hold policy-compliant destruction).103- **Collection gap** — a required source never collected or only partially collected.104- **Personal source gap** — personal phone / personal email / personal messaging not105 collected.106- **Retention / communication loss** — auto-purge, active system loss, deleted channel,107 missing required record that should exist.108- **Responsiveness miscode** — a responsive document coded nonresponsive (or a109 "zero-claim" contradiction where production claims completeness but a responsive doc110 is missing).111- **Privilege log gap** — documents withheld but not fully logged (withheld > logged).112- **Privilege miscoding** — privileged docs coded nonprivileged (or vice versa).113- **Third-party waiver / privilege exposure** — privileged content shared with a114 third party, risking waiver.115- **Over-designation** — business-only counsel copies withheld as privileged.116117For full mapping rules (severity, status, production impact, owner, priority), see118[`references/answer_construction.md`](references/answer_construction.md).119120### 4. Build each required top-level section121122Follow `required_top_level_keys` exactly — include every key, omit nothing extra.123124- **Findings / risks / issues / retention events** — one object per material defect,125 anchored on a single stable hub record ID used as the `finding_id` / `risk_id` /126 `issue_id` / `event_id`. Carry every supporting record ID in the refs list. Fill the127 count fields from the hub (`document_count`, `withheld_count`, `logged_count`,128 `unlogged_count`, `volume_count` + `volume_unit`). Use `0` when a count does not129 apply; use `null` only where the template's field type explicitly allows it130 (`third_party`, `missing_component`, dates, etc.). `unlogged_count` is131 `withheld_count − logged_count` whenever both apply.132- **Category statuses / coverage / readiness** — one object per request category that133 has a material non-complete status. Aggregate the issue records touching that134 category into the refs/issue_refs list and pick the dominant `status` /135 `production_impact` / `recommended_action`. Include the open-issue count where the136 template asks for it. Categories with no open gap are generally omitted (the templates137 ask for "material non-complete" categories) unless the template says otherwise.138- **Retained / available sources / archives** — sources that remain a remediation path139 (email archive, teams archive, offsite records, backup). State which categories each140 limits loss for. If no retained source exists, return an empty list — do not invent one.141- **Privilege corrections** (when required) — one object per privilege record needing a142 correction (supplement log, waiver assessment, recode, downgrade).143- **Metrics** — rollups computed from the evidence above. See144 [`references/answer_construction.md`](references/answer_construction.md) for the145 computation rules. Every metric key in the template must be present; counts are whole146 integers; readiness booleans are `false` when any critical/high open gap exists.147- **Priority actions / action plan / recommended actions** — the remediation plan,148 sorted by priority rank (1 = highest). Each action targets specific hub record IDs and149 lists affected categories. Map `action_type` → `owner` and `priority` per the150 conventions in the reference file. Use a stable `action_id` / `target_id`.151152### 5. Apply ordering, enum, and precision discipline153154- Sort every list per `ordering_rules`. The common rules: findings/issues by their ID155 ascending; categories by category code ascending; actions by priority_rank ascending156 (1 highest); category-code lists ascending within each object. Where a template157 specifies a secondary sort key (e.g. "then target_id ascending"), apply it.158- Every enum field must take a value listed in the template's `enums` /159 `enum_choices`. If the evidence does not fit cleanly, pick the closest listed value160 or `other` / `not_applicable` / `unknown` where those are offered — never invent a new161 enum string.162- Use uppercase / exact casing exactly as the enum is written. Category codes use the163 matter's own family (e.g. `R09`, `SEC-3`, single letters) verbatim from the hub.164- Whole integers only. No floats, no ranges. Booleans are JSON `true`/`false`.165166### 6. Validate before returning167168Self-check the final JSON against the template:169170- Every `required_top_level_key` present, no extras.171- Every item object has every `item_required_keys` / `item_required` field.172- Every list sorted per `ordering_rules`.173- Every enum field value is in the allowed set.174- All counts are integers (or `null`/`0` per field type); `unlogged = withheld − logged`.175- `matter_id` matches the task's matter.176- Output is a single JSON object with no surrounding prose.177178Emit the JSON object as the entire answer.179180## What not to do181182- Do not read or rely on `train_answers/*` values for the live matter — they belong to183 other matters and will be wrong.184- Do not hardcode the hub URL, API key, matter ID, category codes, record IDs, or any185 counts into the skill or the answer.186- Do not inspect environment source code, database files, seeds, manifests, or setup187 scripts even if present.188- Do not produce narrative text, headings, or explanations alongside the JSON.189- Do not skip a required metrics key because it is `0` — include it as `0`.