DocsGet started
Quickstart
Audit a simulated collection program on your own machine in about twenty minutes, then run the same footage through a local Truehands Cloud server the way a CI job would.
The demo program is simulated: 99 submissions from 18 contributors, cut from openly licensed first-person footage, with 24 attacks seeded in. It shows how Truehands works; it does not measure how well. For that, see the benchmark.
Before you start#
You need checkouts of truehands-engine and truehands-backend side by side (the parent repository, git clone --recurse-submodules https://github.com/wkkkis/truehands, has both), and:
- Python 3.12 or later and uv
ffmpegandffprobeon yourPATH- about 3 GB of disk for footage and model files
- no GPU: everything runs on CPU
Steps 1–4 run from truehands-engine; step 5 runs from truehands-backend.
1. Install#
uv sync --locked # every package pinned by hash in uv.lock
scripts/fetch_weights.sh # CLIP weights and the face model, refused unless their hashes matchfetch_weights.sh downloads two files into models/: the OpenCLIP ViT-B/32 weights (LAION-2B) and the YuNet face detector used to blur faces in evidence frames. The engine loads them only from models/ and only when their SHA-256 matches the value pinned in the code; it never downloads anything at run time.
2. Build the demo program#
bash scripts/download_data.sh # open footage -> data/raw/
uv run python scripts/make_program.py # simulated program -> data/program/make_program.py writes a program folder, the format every audit reads:
| Path | What it is |
|---|---|
data/program/program.json | The program: name, task list, pay rate, capture app tag, collection window |
data/program/manifest.csv | One row per submission: clip, contributor, device, claimed task, time, files |
data/program/clips/ | The 99 submitted clips (15-second segments) |
data/program/imu/ | Motion-sensor logs for the clips that have one |
data/program_truth.json | What was seeded where. The audit never reads it |
The footage comes from four openly licensed datasets; CREDITS.md lists them with their licenses. Contributor ids, device ids, times and pay are synthetic.
3. Run your first audit#
uv run python -m truehands.audit --program data/program --reference data/raw/buildai --out out--reference points at a folder of public-dataset videos to match against; here, a few clips of a public factory dataset. The audit prints one line per clip while it works, then a summary:
{
"clips": 99,
"flagged_share": …,
"status_counts": {"accept": …, "partial": …, "review": …, "reject": …},
"reason_counts": {"cross_contributor_duplicate": …, "idle_time": …, …}
}The first run takes about a quarter of an hour on four CPU cores. Features are cached in out/cache/ by the hash of each clip's video stream, so running again after changing a threshold takes about a minute. If program.json or manifest.csv cannot be read, the audit prints a run_failed event and exits 2; a problem with a single clip never fails the run.
4. Look at the results#
uv run python scripts/evaluate.py # scores out/audit.json against data/program_truth.json -> out/eval.json
uv run python -m truehands.report # out/report/index.html and out/report/index_standalone.htmlOpen out/report/index_standalone.html in a browser: every flagged clip with its evidence (matched frame pairs with timecodes, the motion trace, the gyro-against-video chart), the contributor graph and the money at stake. Faces in evidence frames are blurred.
The raw verdicts are in out/audit.json. To list the flagged clips:
python3 -c 'import json; a = json.load(open("out/audit.json"))
for c in a["clips"]:
if c["status"] != "accept":
print(c["clip_id"], c["status"], c["payable_s"], "of", c["duration_s"], [r["code"] for r in c["reasons"]])'Concepts explains every field; Reason codes lists every code.
5. Run the hosted flow#
Truehands Cloud works like a test cloud: a script uploads files and gets back dl:// ids, starts a run that names them, and follows the run from the terminal, CI or the web console. You can run the same server on your machine.
Start a server#
cd ../truehands-backend
uv sync --locked # the server, and the engine from ../truehands-engine
uv run python -m truehands.server create-user --data var --org "Example Lab" --username demo
uv run python -m truehands.server serve --data var --reference ../truehands-engine/data/raw/buildai # http://127.0.0.1:8080create-user creates an organisation and its owner, and prints two things once: a key pair (TH-Key and TH-Secret-Key) that scripts use, and a one-time link (valid 72 hours) to set a password for the web console. Keep the TH-Secret-Key in a secret store. Usernames are 3-32 lowercase letters, digits or underscores, starting with a letter.
The console comes from truehands-app: build it there with npm ci && npm run build and start the server with TRUEHANDS_CONSOLE_DIR=../truehands-app/dist.
Point the CLI at it#
The CLI is the truehands command (Python standard library only). Install it from the server and sign in with the pair create-user printed:
curl -fsSL http://127.0.0.1:8080/install.sh | sh
truehands login --api-url http://127.0.0.1:8080 # or: export TRUEHANDS_KEY=thk_... TRUEHANDS_SECRET_KEY=ths_...
truehands whoamiwhoami shows the user, role and organisation behind the pair, and what it may do, never the secret. The CLI talks to http://127.0.0.1:8080 unless you set TRUEHANDS_API_URL or --api-url.
Create the program#
A run names a program by its slug. Create one from the demo's program.json:
python3 -c 'import json; p = json.load(open("../truehands-engine/data/program/program.json")); print(json.dumps({"slug": "home-tasks", "name": p["name"], "tasks": p["tasks"], "pay_rate_usd_per_hour": p["pay_rate_usd_per_hour"], "capture_app": p["capture_app"]}))' \
| curl -fsS -u "$TRUEHANDS_KEY:$TRUEHANDS_SECRET_KEY" -H 'Content-Type: application/json' \
--data-binary @- http://127.0.0.1:8080/v1/programsCreating programs needs the programs.manage permission, which owners and admins hold; an operator or reviewer can then start runs of it. See who may do what.
Audit the batch and gate on the result#
truehands run --program home-tasks --manifest ../truehands-engine/data/program/manifest.csv --wait --fail-on reject
echo $?truehands run uploads every file the manifest names (skipping files the server already has, matched by SHA-256), starts the run, and with --wait follows it live: progress, verdicts as they land, a summary table and the gate result. With --fail-on reject it exits 1 if any clip was rejected, which the demo's seeded copies make certain; 0 means every clip passed the gate, and 2 means the run failed or was cancelled. The run is also on the console at http://127.0.0.1:8080/runs/<run id>.
To upload a single file by hand:
curl -u "$TRUEHANDS_KEY:$TRUEHANDS_SECRET_KEY" -X POST http://127.0.0.1:8080/v1/uploads -F "file=@../truehands-engine/data/program/clips/s0001.mp4"The answer carries "upload_url": "dl://…", the id a run refers to. Uploads are checked on arrival with the engine's strict reader, so a file that is not MP4/MOV with one H.264 or HEVC stream is refused there with a reason code.
See cross-run memory work#
Every finished run is compared with everything your organisation audited before. With a fresh --data folder and a running server, this script audits the demo program as two weekly runs:
sh examples/cross-run/demo.shIt creates the home-tasks program if it is missing, runs "Week 40" and "Week 41", and prints the clips of week 41 that re-use footage from week 40. Expected: the Week 41 run page reads "7 clips seen in earlier runs".
Next steps#
- Put the audit in CI: CI, webhooks and exports, or
truehands ci init github|gitlab|jenkins|script. - Decide what each finding costs a clip: Policies and gates.
- Run your own footage: the manifest and program formats are in Concepts.
- Keep footage inside your own AWS account: Deployment.