Investigation Review Hub
Workflow
Every investigation task follows the same sequence:
Read all task payloads — prompt.txt, every file under input/payloads/, especially the request-context JSON and answer_template.json. The template defines the exact output schema, enums, ordering rules, and numeric precision.
Discover hub resources — Call GET / and GET /api/schema at the base URL to confirm available endpoints and data shapes.
Gather evidence — Call the relevant GET endpoints (matters, subpoena-categories, productions, custodian-sources, documents/search, privilege-log, qc-findings, retention-events, remediation-actions). Use POST /api/query with SQL when cross-entity joins are needed.
Build the answer — Construct a single JSON object conforming exactly to the template. Return no prose outside the JSON.
API Access
The base URL is provided as TASK_ENV_BASE_URL in request-context payloads. Replace this placeholder with the actual URL before calling endpoints.
All GET endpoints return JSON arrays or objects. Call them with curl -s or equivalent.
SQL endpoint: POST /api/query accepts a JSON body {"query": "<SQL>"} and requires the X-API-Key header. Read the API key from task payloads (typically query_api_key or query_header fields) — do not hardcode it.
For the full endpoint catalog and field schemas, read references/hub_api_reference.md.
Answer Construction Rules
These rules apply to every answer regardless of review type.
Schema compliance
- Use every required top-level key from the template.
- Every object in a list must include every required key listed under
item_required_keys.
- Use exactly the enum values defined in the template. Never invent or abbreviate values.
- Read
item_field_types for every object to understand what each field means.
Stable record IDs
- Use IDs exactly as returned by the hub endpoints. Do not invent, transform, or abbreviate them.
- Every
_id field (finding_id, issue_id, risk_id, correction_id, action_id) must anchor to a specific hub record — a retention event ID, privilege log entry ID, QC finding ID, source ID, or document ID.
- When the template asks for
source_refs, record_refs, target_refs, blocking_refs, or issue_refs, list the hub IDs that support that entry. Sort them ascending.
Ordering rules
- Sort every list per the template's
ordering_rules. The common rule is "sort by X ascending" — apply it.
- Within category lists, sort category codes ascending.
Numeric precision
- All counts are whole integers. Never use floats, decimals, or strings for count fields.
- Use
0 for counts when the measure is not applicable to the current issue.
- For boolean fields, return
true or false (JSON boolean, not string).
Cross-entity linking
- When a QC finding references a privilege log entry, include both IDs in
source_refs/record_refs.
- When a retention event affects multiple categories, list all of them in
affected_categories.
- When a source is a remediation path for categories, list those categories in the limits-loss field.
- A single source, event, or finding can impact multiple categories; the same ID should appear in every relevant category's ref list.
Category codes
- Use category codes exactly as they appear in hub data or task payloads.
- Task payloads like
review_scope.json or matter_context.json provide code-to-description mappings.
- Never convert codes to descriptions in output fields that expect codes.
Action plans
- Assign the highest priority rank (1) to the most urgent action.
- P0 actions are disclosure/waiver items with legal exposure. P1 actions are immediate remediation. P2 actions are important but less time-sensitive. P3 are monitoring items.
- Use owner enums from the template — do not invent new owners.
- For
due_days fields, use short windows (3–7 days) for P0/P1 and longer windows (10+ days) for P2/P3.
SQL Query Patterns
Use POST /api/query when you need joins across hub entities. Common patterns:
- Join documents to QC findings to get document-level coding details.
- Join privilege-log entries to documents to get withheld/logged/unlogged counts per category.
- Join retention events to sources to verify archive availability.
- Use
SELECT … FROM … WHERE matter_id = '<id>' to scope to the current matter.
- When counting, use
COUNT(*) and cast results to integers.
Always include the X-API-Key header with the value from task payloads.
References
- Hub API Reference — Full endpoint catalog, field schemas, and query examples.
- Analysis Patterns — Patterns organized by review type with field-mapping guidance.
1---2name: investigation-review-hub-133description: Collect evidence from the Investigation Review Hub REST API, analyze structured answer templates, and produce strictly-typed JSON outputs for legal/regulatory review workflows. Use when the task provides an Investigation Review Hub base URL, a template JSON schema, and asks for a gap analysis, remediation dashboard, retention review, privilege review, or production-readiness deliverable. Trigger on prompts containing TASK_ENV_BASE_URL, Investigation Review Hub, answer_template.json, or structured investigation deliverables with enumerated JSON schemas.4license: MIT5compatibility: designed for deepagents-code6metadata:7 source: https://skillmd.com/skills/prism-shadow/investigation-review-hub-138---910# Investigation Review Hub1112## Workflow1314Every investigation task follows the same sequence:15161. **Read all task payloads** — `prompt.txt`, every file under `input/payloads/`, especially the request-context JSON and `answer_template.json`. The template defines the exact output schema, enums, ordering rules, and numeric precision.17182. **Discover hub resources** — Call `GET /` and `GET /api/schema` at the base URL to confirm available endpoints and data shapes.19203. **Gather evidence** — Call the relevant GET endpoints (matters, subpoena-categories, productions, custodian-sources, documents/search, privilege-log, qc-findings, retention-events, remediation-actions). Use `POST /api/query` with SQL when cross-entity joins are needed.21224. **Build the answer** — Construct a single JSON object conforming exactly to the template. Return no prose outside the JSON.2324## API Access2526The base URL is provided as `TASK_ENV_BASE_URL` in request-context payloads. Replace this placeholder with the actual URL before calling endpoints.2728All GET endpoints return JSON arrays or objects. Call them with `curl -s` or equivalent.2930**SQL endpoint**: `POST /api/query` accepts a JSON body `{"query": "<SQL>"}` and requires the `X-API-Key` header. Read the API key from task payloads (typically `query_api_key` or `query_header` fields) — do not hardcode it.3132For the full endpoint catalog and field schemas, read [references/hub_api_reference.md](references/hub_api_reference.md).3334## Answer Construction Rules3536These rules apply to every answer regardless of review type.3738### Schema compliance3940- Use every required top-level key from the template.41- Every object in a list must include every required key listed under `item_required_keys`.42- Use exactly the enum values defined in the template. Never invent or abbreviate values.43- Read `item_field_types` for every object to understand what each field means.4445### Stable record IDs4647- Use IDs exactly as returned by the hub endpoints. Do not invent, transform, or abbreviate them.48- Every `_id` field (finding_id, issue_id, risk_id, correction_id, action_id) must anchor to a specific hub record — a retention event ID, privilege log entry ID, QC finding ID, source ID, or document ID.49- When the template asks for `source_refs`, `record_refs`, `target_refs`, `blocking_refs`, or `issue_refs`, list the hub IDs that support that entry. Sort them ascending.5051### Ordering rules5253- Sort every list per the template's `ordering_rules`. The common rule is "sort by X ascending" — apply it.54- Within category lists, sort category codes ascending.5556### Numeric precision5758- All counts are whole integers. Never use floats, decimals, or strings for count fields.59- Use `0` for counts when the measure is not applicable to the current issue.60- For boolean fields, return `true` or `false` (JSON boolean, not string).6162### Cross-entity linking6364- When a QC finding references a privilege log entry, include both IDs in `source_refs`/`record_refs`.65- When a retention event affects multiple categories, list all of them in `affected_categories`.66- When a source is a remediation path for categories, list those categories in the limits-loss field.67- A single source, event, or finding can impact multiple categories; the same ID should appear in every relevant category's ref list.6869### Category codes7071- Use category codes exactly as they appear in hub data or task payloads.72- Task payloads like `review_scope.json` or `matter_context.json` provide code-to-description mappings.73- Never convert codes to descriptions in output fields that expect codes.7475### Action plans7677- Assign the highest priority rank (1) to the most urgent action.78- P0 actions are disclosure/waiver items with legal exposure. P1 actions are immediate remediation. P2 actions are important but less time-sensitive. P3 are monitoring items.79- Use owner enums from the template — do not invent new owners.80- For `due_days` fields, use short windows (3–7 days) for P0/P1 and longer windows (10+ days) for P2/P3.8182## SQL Query Patterns8384Use `POST /api/query` when you need joins across hub entities. Common patterns:8586- Join documents to QC findings to get document-level coding details.87- Join privilege-log entries to documents to get withheld/logged/unlogged counts per category.88- Join retention events to sources to verify archive availability.89- Use `SELECT … FROM … WHERE matter_id = '<id>'` to scope to the current matter.90- When counting, use `COUNT(*)` and cast results to integers.9192Always include the `X-API-Key` header with the value from task payloads.9394## References9596- [Hub API Reference](references/hub_api_reference.md) — Full endpoint catalog, field schemas, and query examples.97- [Analysis Patterns](references/analysis_patterns.md) — Patterns organized by review type with field-mapping guidance.