# Experiments & evidence

URL: https://docs.hanzo.ai/docs/science/experiments-evidence

> Pre-register evidence, run controlled experiments, record claims and studies on /v1/research. Curl examples per endpoint with placeholders.

**Pre-register first, then run, then post the verdict.** Hanzo separates evidence pre-registration (immutable, hash-addressed), experiment versioning (canonical + retained), claims (confirmatory with hypothesis ordering, exploratory without), and studies (the question runs answer) into explicit endpoints on `/v1/research`.

## Research lifecycle

```mermaid
flowchart LR
    E1["1. POST /v1/research/evidence<br/>(pre-register: uri, kind, content)"] --> E2["2. POST /v1/research/experiments<br/>(append experiment + attempts)"]
    E2 --> E3["3. POST /v1/research/runs<br/>(record executions, derived completion)"]
    E3 --> C1["4. POST /v1/research/claims<br/>(confirmatory: hypothesis_id + run_id<br/>exploratory: metric + effect_size)"]
    C1 --> R1["5. POST /v1/research/claims/{id}/replicate<br/>(independent run, HIP-1403 §3.1)"]
    R1 --> S1["6. POST /v1/research/studies<br/>(question + findings)"]
    S1 --> T1["7. GET /v1/research/totals<br/>(headline aggregate + per-kind)"]
```

## Quick start: pre-register → run → claim → study

### Pre-register evidence (POST /v1/research/evidence)

```bash
curl -s -X POST https://api.hanzo.ai/v1/research/evidence \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "uri": "techdata://sph/tsb/22",
    "kind": "document",
    "content": {"bulletin": "TSB-22", "endurance_h": 8.1},
    "source": {"system": "techdata", "revision": "A"}
  }' | jq '.'
```

Response (version with ordinal for the URI):

```json
{
  "uri": "techdata://sph/tsb/22",
  "ordinal": 1,
  "hash": "sha256:...",
  "content": {"bulletin": "TSB-22", "endurance_h": 8.1},
  "kind": "document",
  "source": {"system": "techdata", "revision": "A"}
}
```

> **Key point**: Evidence is immutable and hash-addressed. The same content returns the same version. Pre-registering before data collection creates an auditable trail.

### Append experiment versions (POST /v1/research/experiments)

```bash
curl -s -X POST https://api.hanzo.ai/v1/research/experiments \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "experiments": [{
      "id": "benchmark:zen-1:mmlu",
      "kind": "benchmark",
      "metric": "accuracy",
      "subject": "zen-1",
      "ts": 1750000000,
      "value": 0.81
    }],
    "attempts": []
  }' | jq '.'
```

Response includes both canonical (deduped) and retained (full history) counts:

```json
{
  "canonical": 1,
  "retained": 1,
  "experiments": [...]
}
```

Query canonical experiments:

```bash
curl -s "https://api.hanzo.ai/v1/research/experiments?kind=benchmark&tag=mmlu" \
  -H "Authorization: Bearer $HANZO_API_KEY" | jq '.'
```

Audit pre-registration ordering via versions:

```bash
curl -s "https://api.hanzo.ai/v1/research/experiments/versions?id=benchmark:zen-1:mmlu" \
  -H "Authorization: Bearer $HANZO_API_KEY" | jq '.'
```

### Record executions (POST /v1/research/runs)

```bash
curl -s -X POST https://api.hanzo.ai/v1/research/runs \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "runs": [{
      "id": "locomo-all-context-k20-enso-flash",
      "benchmark": "locomo",
      "split": "all",
      "system": "enso-flash",
      "questions": 282,
      "answered": 282,
      "ended": "2026-09-10T21:24:01Z"
    }]
  }' | jq '.'
```

Completion is **derived** from `questions`, `answered`, and `ended` — never taken from the body. A record omitting a count leaves completion `unknown`.

Query runs with filters:

```bash
# By benchmark
curl -s "https://api.hanzo.ai/v1/research/runs?benchmark=locomo&completion=complete" \
  -H "Authorization: Bearer $HANZO_API_KEY" | jq '.'

# By key (deduplication — a complete run under this key is already paid for)
curl -s "https://api.hanzo.ai/v1/research/runs?key=sha256:...&completion=complete" \
  -H "Authorization: Bearer $HANZO_API_KEY" | jq '.'
```

### Record a confirmatory claim (POST /v1/research/claims)

```bash
curl -s -X POST https://api.hanzo.ai/v1/research/claims \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "mode": "confirmatory",
    "hypothesis_id": "sha256:...",
    "run_id": "swe-verified-cand-1",
    "metric": "pass@1",
    "effect_size": 0.042
  }' | jq '.'
```

A confirmatory claim **must** reference an existing `HypothesisRecord` whose sequence number strictly precedes the supporting Run's sequence number. It begins in `unreplicated` state.

Query claims:

```bash
curl -s "https://api.hanzo.ai/v1/research/claims?status=unreplicated" \
  -H "Authorization: Bearer $HANZO_API_KEY" | jq '.'
```

### Replicate a claim (`POST /v1/research/claims/{id}/replicate`)

```bash
curl -s -X POST "https://api.hanzo.ai/v1/research/claims/sha256:.../replicate" \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "run_id": "independent-replication-run-1"
  }' | jq '.'
```

Self-replication by the proposer or any listed contributor is refused 403. Exploratory claims cannot be replicated into confirmatory truth.

### Record a study (POST /v1/research/studies)

```bash
curl -s -X POST https://api.hanzo.ai/v1/research/studies \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "studies": [{
      "id": "memory-retrieval-2026",
      "question": "does graph-shaped retrieval beat dense-only on long conversations",
      "findings": "graph retrieval +12% pass@1 on long-context, p<0.01"
    }]
  }' | jq '.'
```

A study is what keeps a run from being read as a standalone score.

Query studies:

```bash
curl -s "https://api.hanzo.ai/v1/research/studies?id=memory-retrieval-2026" \
  -H "Authorization: Bearer $HANZO_API_KEY" | jq '.'
```

### Get totals (GET /v1/research/totals)

```bash
curl -s "https://api.hanzo.ai/v1/research/totals" \
  -H "Authorization: Bearer $HANZO_API_KEY" | jq '.'
```

Response includes headline aggregate plus per-kind breakdown (canonical + retained):

```json
{
  "total": {"canonical": 1542, "retained": 2891},
  "byKind": {
    "benchmark": {"canonical": 892, "retained": 1834},
    "training": {"canonical": 311, "retained": 567},
    "ablation": {"canonical": 214, "retained": 342},
    "policy-eval": {"canonical": 125, "retained": 148}
  }
}
```

## Run on all four surfaces

**CLI**

```bash
# Evidence
hanzo research evidence post --uri "techdata://sph/tsb/22" --kind document --content '{"endurance_h":8.1}'

# Experiments
hanzo research experiments post --data '{"experiments":[{"id":"benchmark:zen-1:mmlu","kind":"benchmark","metric":"accuracy","subject":"zen-1","ts":1750000000,"value":0.81}]}'

# Runs
hanzo research runs post --data '{"runs":[{"id":"locomo-all-context-k20-enso-flash","benchmark":"locomo","split":"all","system":"enso-flash","questions":282,"answered":282,"ended":"2026-09-10T21:24:01Z"}]}'

# Claims
hanzo research claims post --mode confirmatory --hypothesis_id sha256:... --run_id swe-verified-cand-1 --metric pass@1 --effect_size 0.042

# Studies
hanzo research studies post --data '{"studies":[{"id":"memory-retrieval-2026","question":"does graph-shaped retrieval beat dense-only on long conversations"}]}'

# Totals
hanzo research totals
```

**SDK**

**Python**

```python
import os
from hanzo_research import HanzoResearch

client = HanzoResearch(api_key=os.environ["HANZO_API_KEY"])

# Evidence
evidence = client.evidence.post(
    uri="techdata://sph/tsb/22",
    kind="document",
    content={"endurance_h": 8.1},
    source={"system": "techdata", "revision": "A"}
)

# Experiments
experiments = client.experiments.post(
    experiments=[{"id": "benchmark:zen-1:mmlu", "kind": "benchmark", "metric": "accuracy", "subject": "zen-1", "ts": 1750000000, "value": 0.81}]
)

# Runs
runs = client.runs.post(
    runs=[{"id": "locomo-all-context-k20-enso-flash", "benchmark": "locomo", "split": "all", "system": "enso-flash", "questions": 282, "answered": 282, "ended": "2026-09-10T21:24:01Z"}]
)

# Claims
claim = client.claims.post(
    mode="confirmatory",
    hypothesis_id="sha256:...",
    run_id="swe-verified-cand-1",
    metric="pass@1",
    effect_size=0.042
)

# Studies
studies = client.studies.post(
    studies=[{"id": "memory-retrieval-2026", "question": "does graph-shaped retrieval beat dense-only on long conversations"}]
)

# Totals
totals = client.totals.get()
```

**Rust**

```rust
use hanzo_research::{HanzoResearch, Evidence, Experiment, Run, Claim, Study};

let client = HanzoResearch::new(std::env::var("HANZO_API_KEY")?);

// Evidence
let evidence = client.evidence().post(Evidence {
    uri: "techdata://sph/tsb/22".into(),
    kind: "document".into(),
    content: serde_json::json!({"endurance_h": 8.1}),
    source: Some(serde_json::json!({"system": "techdata", "revision": "A"})),
}).await?;

// Experiments
let experiments = client.experiments().post(vec![Experiment {
    id: "benchmark:zen-1:mmlu".into(),
    kind: "benchmark".into(),
    metric: "accuracy".into(),
    subject: "zen-1".into(),
    ts: 1750000000,
    value: 0.81,
}]).await?;

// Runs
let runs = client.runs().post(vec![Run {
    id: "locomo-all-context-k20-enso-flash".into(),
    benchmark: "locomo".into(),
    split: "all".into(),
    system: "enso-flash".into(),
    questions: 282,
    answered: 282,
    ended: "2026-09-10T21:24:01Z".parse()?,
}]).await?;

// Claims
let claim = client.claims().post(Claim {
    mode: "confirmatory".into(),
    hypothesis_id: Some("sha256:...".into()),
    run_id: "swe-verified-cand-1".into(),
    metric: "pass@1".into(),
    effect_size: 0.042,
}).await?;

// Studies
let studies = client.studies().post(vec![Study {
    id: "memory-retrieval-2026".into(),
    question: "does graph-shaped retrieval beat dense-only on long conversations".into(),
    findings: None,
}]).await?;

// Totals
let totals = client.totals().get().await?;
```

**HTTP**

```bash
# All examples above use HTTP directly with curl
# See each step above for the exact curl commands
```

**MCP**

```bash
# Evidence
curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/call",
    "params": {
      "name": "research",
      "arguments": {"op": "post_evidence", "input": {"uri": "techdata://sph/tsb/22", "kind": "document", "content": {"endurance_h": 8.1}}}
    }
  }'

# Experiments
curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/call",
    "params": {
      "name": "research",
      "arguments": {"op": "post_experiments", "input": {"experiments": [{"id": "benchmark:zen-1:mmlu", "kind": "benchmark", "metric": "accuracy", "subject": "zen-1", "ts": 1750000000, "value": 0.81}]}}
    }
  }'

# Claims
curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/call",
    "params": {
      "name": "research",
      "arguments": {"op": "post_claim", "input": {"mode": "confirmatory", "hypothesis_id": "sha256:...", "run_id": "swe-verified-cand-1", "metric": "pass@1", "effect_size": 0.042}}
    }
  }'
```

## Pre-registration: the rule

> **Always POST /v1/research/evidence BEFORE any data collection.**
>
> The server hashes content over canonical JSON and stores it in the hash-addressed blob store. A hash sent beside the content must agree. Evidence without content is refused. The version's ordinal for the URI creates an auditable sequence: a `planning` or `running` pre-registration precedes its `complete` measurement.

## Deprecation note

`/v1/experiment` (create, assign, analyze, decide) is deprecated. Use `/v1/research/experiments` for versioned experiment tracking and `/v1/research/evidence` for pre-registration.

## Related

- [Scientific Method](https://docs.hanzo.ai/docs/science/scientific-method) — hypothesis, baselines, paired observations
- [Research Autopilot](https://docs.hanzo.ai/docs/science/research-autopilot) — event-triggered automations
- [GPU Jobs](https://docs.hanzo.ai/docs/science/gpu-jobs) — fleet queue for GPU workloads
