Witness Integrator
Dependency declaration, read first. This skill requires an existing Witness installation: the protocol definition, core, storage adapter and SDK. It is Atlas-specialised and is not portable to a project without them. In a target whose profile reports witnessProtocol: "absent", stop and say so — do not reimplement Witness, and do not approximate it with hashes bolted onto an upload form. A partial implementation of a tamper-evident chain is worse than none, because it produces evidence that looks verifiable and is not.
Confirm before proceeding:
rg -l "witness" src/witness/protocol src/witness/core src/witness/storage src/witness/sdk.tsIf those paths do not exist, this skill does not apply. Report inaccessible or absent and route the provenance requirement to provenance-guardian, which is portable.
Hard rules
- Never write to Witness storage directly. Go through the SDK. Direct writes bypass chain construction and silently break verification.
- Never re-hash or re-encode a capture after it enters the chain.
- Never backfill a capture into the past. Late arrival is recorded as late arrival:
occurred_atandrecorded_atboth, honestly. - A broken chain is reported, never repaired. Repair destroys the only signal that something went wrong.
- Verification result is displayed, not assumed. A surface that shows captures without their verification state is misrepresenting evidence.
- Capture identity and subject identity are separate. The capture is evidence about the subject; it is not the subject.
What Witness provides, and what it does not
Provides: tamper-evidence. You can tell whether a capture has changed since it entered the chain, and where it sits in the chronology.
Does not provide: proof that the capture is true, that the device was not pointed at the wrong thing, or that the operator was honest. Never describe Witness output as proof of fact. It is proof of integrity. Saying more than that in a UI label is the most damaging mistake available here.
Integration procedure
- Confirm the dependency as above. Record the Witness version in use.
- Name the capture type and what it is evidence of. If you cannot say what claim it substantiates, the surface does not need Witness.
- Establish capture identity at the moment of capture, before any processing: capture id, subject reference, capture type.
- Record source and device identity where applicable — operator, device, application version, and, where the protocol supports it, the capture conditions. Where device identity is unavailable, type it (
unknown,inaccessible), never omit the field. - Submit through the SDK so the chain link is constructed by the protocol. Never construct a link by hand.
- Preserve chronology. Captures are ordered by the chain, not by row insertion order and not by a client clock. Do not sort a captures view by
created_atand present it as the chain order. - Draw the transformation boundary. Anything derived from a capture — a crop, a transcript, an OCR pass, a thumbnail — is a derivative, lives outside the chain, and links back to the capture id. It never re-enters the chain as if it were an original. This is where
provenance-guardiantakes over. - Verify on read, and surface the result: verified, unverified, chain broken, or verification unavailable. Four states, all visible. Never collapse them to a green tick.
- Handle failure. Verification service down →
verification_unavailable, and the surface must not imply verification succeeded.
Worked example
Request: "add photo evidence to the inspection screen."
- Dependency. Witness present in this target. Version recorded.
- Capture type.
inspection_photo, evidence for the claim "this defect existed at this property at this time". - Identity. capture id issued at shutter; subject = the inspection reference, not the property directly — the property link travels through the inspection.
- Device. Operator user reference plus device id from the SDK. On a desktop upload where no device identity exists,
device: { state: "unknown" }— the capture is still admissible, but its standing is visibly weaker. - Submission. SDK call; chain link returned; nothing written to storage by the feature code.
- Derivatives. The screen shows a thumbnail. The thumbnail is generated outside the chain, is labelled derived, and links to the capture id. Clicking it retrieves the original from Witness, not the thumbnail source.
- Display. Each photo shows its verification state. A photo whose chain is broken renders with that stated plainly — it stays visible, because hiding it would destroy the evidence that tampering occurred.
Pressure tests
- Can any code path write a capture without the SDK? Trace every write.
- What does the surface show when verification fails, and could a viewer mistake it for success?
- Does any derived artifact re-enter the chain as an original?
- Is the displayed order the chain order, or a database sort?
- If a capture arrives three days late, is that distinguishable from a capture taken three days ago?
- Does any label claim the capture proves the underlying fact rather than its own integrity?
Stop conditions
- Witness is absent from the target — stop; do not approximate it.
- The requirement is generic provenance, not tamper-evidence — use
provenance-guardianinstead; Witness is heavier and has real dependencies. - The design would repair, regenerate or hide a broken chain.
- Captures would be mutable after submission.
- The surface cannot display verification state.