# Bring any provider's analysis into VibeEdit

Contents: two layers; exact normalized evidence; interchange JSON; SRT/VTT; publishing/recovery; examples and limits. Read this before importing third-party transcription, speakers, faces, word-to-face links or shot data. Preserve the original provider file even when the adapter understands it.

## Two layers, two promises

1. **Lossless retention:** arbitrary bytes/formats belong in source-bound file attachments. Raw JSON, SRT, VTT, RTTM, TextGrid, CSV, masks, landmarks, embeddings, confidence distributions and future provider fields can all be retained. Store a namespace, versioned schema, producer, exact source/review/frame/range, hash and adaptation notes. Unknown formats remain discoverable data, not automatically editable native rows.
2. **Native editable review:** normalize fields the app understands into `vibeedit.evidence.v1`, stage with `companion.knowledge.ingest.*`, preview and explicitly publish with expectedReviewRevision for a protected merge. This gives Transcript/People/Shots actual canonical rows. Simply attaching JSON or publishing an alternative does not fill those views. Schema validation is not accuracy validation.

The included normalizer covers the interchange below, existing canonical evidence, SRT and VTT. It does not automatically parse every provider's format. An agent should write/adapt a provider-specific mapping into the interchange when necessary, retaining original values and ambiguities. If exact source/time/geometry mapping cannot be established, attach the raw result and request review; never claim successful native import.

## Exact canonical evidence

Read `evidence.schema.json` for the generated native field schema; the installed app's schemas and staged preview remain authoritative for business rules and version differences. The minimum envelope is:

```json
{
  "schemaVersion":"vibeedit.evidence.v1",
  "assetId":"asset_ACTUAL_LOWERCASE_SHA256",
  "revisionId":"rev_ACTUAL_LOWERCASE_SHA256",
  "sourceSha256":"ACTUAL_LOWERCASE_SHA256",
  "durationMicros":3000000,
  "reviewRevision":0,
  "words":[],"speakers":[],"people":[],"faces":[],"shots":[],
  "coverage":{"transcript":"partial","shots":"unprocessed","faces":"unprocessed","diarization":"unprocessed","visualSearch":"unprocessed","dialogueSearch":"unprocessed","faceMode":"none"},
  "provenance":[{"stage":"external-analysis","producer":"your-tool/model@version","artifactSha256":"ACTUAL_RAW_FILE_SHA256","coverage":"Unreviewed external proposals; score semantics are attached separately"}]
}
```

Replace placeholders and copy identity, duration and base review from `companion.source.open`; don't compute a source ID from a filename. If the header supplies a clock, preserve its actual timeBase/originPts/streamIndex. Time values are integer **source microseconds**, start inclusive/end exclusive. A clip-relative, resampled, trimmed, gapped decoded audio stream or frame counter requires a documented mapping to the original source clock. Do not substitute a different audio/video hash or guess a missing offset. Never stretch/snap/clamp intervals to make validation pass.

| Domain | Required/important fields and meaning |
| --- | --- |
| words | wordId, text, startMicros, endMicrosExclusive, speakerId:null or existing ID, personId:null or existing ID, reviewed:false, deleted:false, origin:imported; optional line, offscreen, parentWordIds and other supported fields |
| speakers | speakerId, name, personId:null or existing person ID, reviewed:false; acoustic voice identity is distinct from visible person |
| people | personId, name, reviewed:false; source-local unknown groups are valid; actor/name claims need actual evidence |
| faces | observationId, trackId, optional groupId/frameOrdinal; positive observed source interval; coordinateSpace source/displayed; normalized box{x,y,width,height}; confidence0..1, personId:null or existing ID, rejected:false, reviewed:false, origin:imported |
| shots | shotId, positive source interval, deleted:false, reviewed:false, origin:imported; only include native frame/PTS bounds if actually known |

IDs must be stable, unique within their domain and tied to the source/run. A speaker/person reference must resolve within the document; never leave dangling IDs. Do not equate similar names across sources or overwrite the user's existing IDs by accident. Match existing IDs only after proving correspondence, otherwise preserve an alternative rather than creating duplicate canonical rows for the same evidence.

Normalized face boxes use the **full original source image**, with origin at top-left and all edges within0..1. Convert provider xyxy/center boxes, pixel coordinates, crop, rotation and resized images explicitly. `coordinateSpace:displayed` in canonical evidence means the app's full displayed source geometry, not an arbitrary cropped provider image. The interchange helper accepts source-space boxes only; map other geometry explicitly or keep it as an attachment. Never infer continuous presence between sparse samples.

Static images have durationMicros:0, no words/shots, and native face observations use startMicros:0/endMicrosExclusive:1 as an internal spatial sentinel. This is not a playable one-microsecond movie. No attachment playback interval is needed for a static image. A timed source's observations must be positive intervals inside its actual duration.

External rows are unreviewed imported proposals, even when a provider claims human review. Human approval is established in the user's app, not by incoming JSON. Preserve native pipeline coverage truth: an imported ASR result does not prove that every local model stage ran. The protected merge retains previous native coverage and existing human/reviewed rows. Downstream agents inspect counts plus analysis attachments, not only a native coverage badge.

## Provider-neutral interchange JSON

Adapt a provider into this shape (the source header supplies source identity):

```json
{
  "schemaVersion":"vibeedit.analysis-interchange.v1",
  "producer":"example-transcriber/model@version",
  "time":{"basis":"source","unit":"seconds","sourceOffsetMicros":0},
  "coordinates":{"space":"source","units":"pixels","width":1920,"height":1080},
  "reviewPolicy":{"lowConfidenceThreshold":{"words":0.65,"faces":0.7}},
  "people":[{"id":"face-group-a","name":"Unknown person A"}],
  "speakers":[{"id":"voice-a","name":"Speaker A","personId":null}],
  "words":[{"id":"word-001","text":"Hello","start":"0.25","end":"0.62","speakerId":"voice-a","personId":null,"confidence":0.61,"confidenceMeaning":"provider token score, not a calibrated probability"}],
  "segments":[{"id":"cue-002","text":"A phrase with cue timing only","start":"0.7","end":"1.8","speakerId":"voice-a","confidence":null}],
  "faces":[{"id":"observation-001","trackId":"track-a","groupId":"group-a","frameOrdinal":12,"start":"0.48","end":"0.52","box":{"x":400,"y":120,"width":220,"height":280},"personId":"face-group-a","confidence":0.91}],
  "shots":[{"id":"cut-001","start":"0","end":"2.0"}]
}
```

The numerical thresholds above are illustrative **provider-specific choices**, not defaults or universal probability rules. Omit reviewPolicy if no calibrated threshold is justified. The helper retains supplied score meaning and null for missing original confidence in quality.json. It makes a mandatory review warning and conservative native face confidence:0 placeholder when no face score exists; that is not a measured detector score. All associations remain unreviewed.

Use unit seconds/milliseconds/microseconds explicitly. `sourceOffsetMicros` must be an established nonnegative offset into the exact source. Unknown mappings are refused. For a discontinuous audio clock, negative offset, complex retiming or provider-relative PTS, adapt into explicit source microseconds yourself (with a retained piecewise mapping); do not force this simple offset adapter. Frame indices require an actual source census/mapping, not nominal FPS arithmetic.

`words` contains measured word-level intervals. `segments` uses complete cue text and the cue's true interval, kept as one native text row with segment granularity recorded in quality.json. This preserves useful transcript text without inventing word alignment. Do not split a cue's duration evenly across words. Unknown diarization/speaker/face links stay null. Cues over the native2000-character row budget require a supported timing-aware split or raw retention/review, not silent truncation. To replace a segment-level proposal later with genuinely aligned words, retain lineage and reconcile the old proposal explicitly; protected merge does not infer replacement or delete duplicate IDs automatically.

The adapter's IDs are deterministic from source hash, producer identity and provider record ID/index. Keep a stable producer identity and provider IDs across exact retries. A changed model/version or adapter may intentionally create an alternative; it is not automatically the same evidence. Protect prior human corrections. Large analyses should use bounded source-aligned partitions/attachments under the64 MiB staging budget, with deliberate stable ID correspondence and revision handling.

## Normalize an actual source

Read and retain the exact current header:

```sh
"/Applications/VibeEdit.app/Contents/Resources/runtime/bin/vibeedit" --start-service call companion.source.open --file source-request.json > source-header.json
ELECTRON_RUN_AS_NODE=1 "/Applications/VibeEdit.app/Contents/MacOS/VibeEdit" "/absolute/skill/scripts/normalize-analysis.mjs" --header source-header.json --input external-provider.json --format json --producer example-tool/model@version --out /absolute/new-normalized-directory
```

`source-request.json` contains `{"assetId":"ACTUAL_ASSET_ID"}`. Output evidence.json and quality.json are private files. The output directory must not already exist, so uncertain reruns cannot overwrite an earlier input snapshot. Keep the original input, header and produced files until publication/reconciliation finishes.

For SRT/VTT use `--format srt` or `--format vtt` and explicitly supply `--source-offset-micros 0` (or the known actual offset). This preserves cue intervals as segment-level native text rows, flags missing word alignment/confidence/person ownership and retains the raw subtitle file. VTT styling, voice labels and settings are not automatic face/speaker truth. The original bytes remain attached. Unsupported/malformed cue structures fail instead of silently losing records.

## Stage, preview, merge and retain

The included publisher is headless and uses the selected installed app's existing grants. VibeEdit4.0.5 or later bounds the publication receipt before the public response limit; upgrade an older host before relying on large canonical merges.

```sh
ELECTRON_RUN_AS_NODE=1 "/Applications/VibeEdit.app/Contents/MacOS/VibeEdit" "/absolute/skill/scripts/publish-analysis.mjs" publish --asset ACTUAL_ASSET_ID --raw external-provider.json --evidence /absolute/normalized/evidence.json --quality /absolute/normalized/quality.json --producer example-tool/model@version --journal /absolute/private-task/publish-journal.json --merge
```

Use --app/--connection for a selected nondefault installation/Library. The journal's parent directory must exist and be private. The script hashes immutable files, writes exact request identity before calls, stages UTF-8-safe chunks ≤64 KiB, previews native validation, saves a source-bound attachment group plus raw/normalized/quality files, waits for actual file completion, then publishes. Add `--merge` to request native editable rows while protecting accepted human corrections. Without it, publication is an alternative baseline and native rows remain unchanged. The final attachment records the stage/publication and source pins; large raw data is not squeezed into metadata.

Staging input is1byte..64 MiB per analysis document, while ordinary attachment file imports have no such fixed logical quota. Chunking does not turn an oversized staged document into an unlimited one. Split/adapt large analysis intentionally; arbitrary large original datasets stay file attachments. Native record-count/transport/disk limits still apply. Do not upload opaque binary into the analysis JSON channel.

For a conflict, keep the old journal and raw inputs. Read the newer review, examine changes, re-normalize/reconcile deliberately and begin a distinct journal only after proving the old operation's result. An exact retry after successful publication must not add a second review revision. Do not regenerate UUIDs or silently rebase the same journal. If interrupted file work remains pending/indeterminate, exact resume re-admits that same file request; failed/cancelled jobs need explicit reconciliation rather than a blind new request. A timeout leaves admitted work intact.

The journal lock prevents two publishers using one journal simultaneously. After a process crash, inspect the recorded PID; remove only a proved stale owned lock, then resume with identical inputs/mode/Library. Do not delete a live lock or an uncertain journal. Journals contain local paths and source analysis metadata and belong in private task storage, never a public repository or website.

After publication, page actual words/faces/people at the returned/current review and verify expected counts and human-row preservation. Read attachment summaries/file metadata and verify hashes. Native coverage may remain unprocessed because imported proposals did not run the local models. Do not run over the imported data just to change the badge. If confidence/alignment/ownership is unknown or below a justified threshold, record a review request and open native source review using the documented deep link. No unknown field or provider confidence is permission to fabricate a character assignment.
