Nodal Hindsight
Compile logged AI suggestions, human decisions, and subsequent outcomes into evidence-backed evaluation cases. Run a decision function, score saved outputs, and compare a candidate against a baseline.
This repository implements the first-release workflow in spec.md. The examples are synthetic; they do not establish production accuracy or approved Health Tech policies.
Quick start
Python 3.11+ and uv are required.
uv sync --locked --extra dev
uv run python scripts/demo.py
The demo creates artifacts/demo/. It validates and compiles the Health Tech fixtures, runs two candidate functions, evaluates their outputs, compares them, exports training cases, creates a correction report, and exercises judge calibration. It also compiles an earlier dataset snapshot to show evidence maturity changing a case revision.
The candidate deliberately closes an unresolved case. The comparison must fail. The demo handles that expected exit code and finishes successfully. The two-row calibration fixture must return insufficient evidence; it is not approved for gates.
To rerun into the same destination:
uv run python scripts/demo.py --overwrite
Inspect:
artifacts/demo/dataset/quality-report.md: counts, tiers, censoring, exclusions, and bias diagnostics.
artifacts/demo/comparison/report.md: regression details and component-score changes.
artifacts/demo/logged-train-eval/report.md: original suggestions scored against eligible references, plus experimental judge responses.
artifacts/demo/review/corrections.jsonl: training-only human corrections and draft diffs.
artifacts/demo/calibration/report.md: calibration confusion counts and uncertainty.
Onboarding: discover
Before any history is compiled, the workflow-discover skill checks whether a workflow's stored history is usable. It runs in Claude Code and needs no hindsight install, no setup step and no Git repo.
Install the plugin:
/plugin install nodal-hindsight --marketplace nodal-data/nodal-hindsight
Then ask Claude to assess a workflow, for example "check whether our prior-auth review history can be used with Hindsight". The skill:
- Asks which workflow it is and for the repository that runs it (a local path or a URL to clone), then reads the code to find where the suggestion, the human action and the outcome are written.
- Explains why a reviewer's approval is weak evidence and agrees with the user what the later outcome is (a customer's later response, a status in another system, an audit), where it is stored and how long it takes to arrive.
- Measures the stored history in a warehouse (Snowflake, BigQuery), CSV/JSONL exports or a SQLite database, with the connection the session already has and aggregates by default. It does not select or print message bodies or other free text unless the user confirms the agent is approved to read row content; then it may view a few truncated sample rows in the session. No row content is written to the report either way, and every query is read-only. Other stores are recorded as not yet supported.
- Asks choice-based questions only where the evidence is ambiguous.
- Writes
hindsight-discovery/<workflow>/readiness.md and readiness.json in the current directory.
The report covers ten checks (suggestion stored separately, not overwritten, exposure, timestamps, reviewer ID, policy identity, frozen context, outcome join, volume and accept rate, request-type signal), a status for each record type (Decision, HumanAction, Outcome), and one verdict: mine-history, partial, log-forward-only, or not-measured when the stores could not be profiled. It also says what to do next: what to measure, and what to start logging, most valuable first, with the specific code changes the skill found. Accept rates in the report are descriptive; they are not evidence that suggestions were correct.
Commands
| Command | Purpose |
|---|
hindsight validate | Validate canonical records, task schemas, event joins, and chronology |
hindsight compile | Produce immutable cases, splits, definitions, input-only views, and a manifest |
hindsight run | Invoke a trusted module:function on input-only cases in timed subprocesses |
hindsight evaluate | Score one run, external prediction file, or original logged suggestions |
hindsight compare | Compare compatible evaluations on identical cases and apply gates |
hindsight calibrate | Measure a rubric/judge against independently reviewed calibration labels |
hindsight review | Generate training-only correction reports and review templates |
hindsight export | Write canonical cases and definitions, or input-only records |
hindsight schemas | Generate public JSON Schema contracts |