# Governed Terminal Capture Workflow

`video terminal-capture` executes approved argv commands in a run-local DEMO HOME and composites their real output into an operator-owned Playwright recording. The kit validates identity, safety, evidence, truth boundary, and quality; it does not install a browser or media encoder.

This workflow replaces implicit recorder selection. It is intended for evidence-class marketing video where stale media, private terminal state, or an unsupported Chromium sandbox can invalidate the film.

## Operator Delegates

```bash
export SDTK_MARKETING_VIDEO_CAPTURE_CMD_PLAYWRIGHT_TERMINAL='node /absolute/path/record-terminal-evidence.js --plan {plan} --run-root {run_root} --out {out}'
export SDTK_MARKETING_VIDEO_PROBE_CMD='/absolute/path/reference-probe.sh {file}'
```

The capture delegate must:

- execute each approved command directly as argv without a shell;
- launch Chromium in the declared container sandbox mode;
- use only the run-local demo HOME and redact that absolute path from the visual layer;
- normalize a real screen recording to the requested output;
- print no credentials or private runtime data.

## Plan

The plan itself must be a regular file inside the canonical run root.

```json
{
  "schema_version": "sdtk.marketing-terminal-capture.v1",
  "project_id": "ep2-usage",
  "run_id": "run_demo_1234",
  "data_classification": "demo_only",
  "capture_method": "playwright_terminal",
  "run_root": "/absolute/canonical/run",
  "fixture_home": "fixtures/usage-demo",
  "truth_boundary": "composited_from_real_command_output",
  "evidence_manifest": {
    "path": "artifacts/product_capture/manifest.json",
    "sha256": "<reviewed manifest sha256>"
  },
  "browser": {
    "engine": "chromium",
    "sandbox_mode": "no_sandbox",
    "network_access": "loopback_only"
  },
  "commands": [
    { "argv": ["sdtk", "usage"], "hold_seconds": 14 },
    { "argv": ["sdtk", "usage", "--json"], "hold_seconds": 14 }
  ],
  "capture_quality": {
    "min_width": 1600,
    "min_height": 900,
    "min_duration_s": 36,
    "min_edge_density": 3.5,
    "calibrated_against": "real-command terminal composite reference",
    "luma_range": [40, 235]
  },
  "render_contract": {
    "target_duration_s": 78,
    "duration_tolerance_s": 1,
    "min_product_coverage_ratio": 0.45
  }
}
```

The current command profile deliberately permits only `sdtk usage` and `sdtk usage --json`. Add another profile in code with tests; do not widen a plan ad hoc.

## Run
Terminal composites contain large flat-color surfaces, so calibrate their content floor against accepted terminal material; do not inherit a denser product-UI threshold or weaken the final-film motion/content gate.


```bash
sdtk-marketing video terminal-capture validate --plan "$RUN/terminal-capture-plan.json" --run-root "$RUN" --json
sdtk-marketing video terminal-capture run --plan "$RUN/terminal-capture-plan.json" --run-root "$RUN" --out "$RUN/artifacts/episode_render/usage-terminal-capture.mp4" --json
```

On success, the kit writes `<output>.receipt.json` with the exact output SHA-256, probe result, manifest binding, and final render contract. Dry-run expands the delegate without creating media. Failed validation or probing writes no receipt.

## Final Composition Profile

Use `terminal-evidence-explainer` for the narrated HyperFrames composition. Its profile permits readable terminal holds but prevents a terminal slideshow: `low_motion_ratio <= 0.90`, `low_motion_run_s <= 6`, `edge_density >= 5.5`, and `luma` in `[45,235]`. The reference probe reports the motion fields as `low_motion_ratio` and `low_motion_run_s`. Final audit evidence must also report `max_composition_hold_s <= 12`, at least 5 meaningful `visual_state_changes`, product proof by 7 seconds, and `narration_visual_action_ratio >= 0.80`.

This distinction is deliberate. Applying the brand-film `0.40/0.55` gate to a readable narrated terminal explainer incentivizes camera shake or constant zoom. Applying no story gate permits a slideshow. The probe permits short reading holds; the final audit additionally proves that the composition changes, product proof appears early, and narration has matching visual action.

The receipt proves capture provenance. It does not approve the final composition, publish media, or replace owner picture lock.
