Inferensys

Prompt

Chain of Custody Event Log Prompt for Digital Evidence

A practical prompt playbook for using Chain of Custody Event Log Prompt for Digital Evidence in production AI workflows.
Operations team reviewing AI workflow automation on laptop, workflow builder visible, casual office setup.
PROMPT PLAYBOOK

When to Use This Prompt

Defines the job-to-be-done, ideal user, required context, and boundaries for the chain of custody event log prompt.

This prompt is for forensic analysts and evidence management systems that need to convert natural-language descriptions of evidence handling into structured, machine-readable custody records. Use it when you need to produce a tamper-evident log entry with a validated evidence ID, handler identity, a controlled custody action, and an ISO 8601 timestamp. This prompt belongs in a workflow where every evidence transfer, check-in, check-out, or disposal must be documented in a consistent format for downstream ingestion into a Laboratory Information Management System (LIMS), evidence management platform, or audit database. It is not a replacement for a secure chain-of-custody application, but it provides the structured data layer that such systems require.

The ideal user is a forensic analyst, evidence custodian, or system integrator who already has the facts about an evidence event but needs to normalize them into a strict schema. Required context includes a known evidence ID format (e.g., CASE-YYYY-NNNNN or EVD-<GUID>), a controlled vocabulary of custody actions (CHECK_IN, CHECK_OUT, TRANSFER, DISPOSAL, SEALED, UNSEALED), and the handler's verified identity. Without this context, the prompt cannot enforce field-level validation and should not be used. Do not use this prompt to adjudicate chain-of-custody disputes, to reconstruct missing evidence history from memory, or to generate legal opinions about evidence admissibility.

The prompt is designed to be wired into a larger evidence management pipeline. Before calling the model, your application should validate the handler's identity against an active directory or IAM system and confirm that the evidence ID exists in your evidence registry. After the model returns the structured record, your system must validate the output against the same schema, log the raw prompt and completion for audit purposes, and append the record to a write-once, append-only custody log. The model's output is a structured proposal; the system of record is the final authority. In regulated environments, require a human reviewer to confirm the generated record before it is committed to the permanent custody log.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Chain of Custody Event Log Prompt works well and where it introduces operational risk. Use these cards to decide if this prompt fits your evidence handling workflow before integrating it into a production system.

01

Good Fit: Structured Evidence Intake

Use when: forensic analysts need to convert free-text handling notes into machine-readable custody records with consistent evidence IDs, handler identities, and timestamps. Guardrail: always validate the generated output against your evidence management system's schema before ingestion.

02

Bad Fit: Real-Time Chain Verification

Avoid when: you need cryptographic proof of custody or real-time tamper detection. This prompt generates human-readable log entries, not blockchain hashes or digital signatures. Guardrail: pair this prompt with a separate integrity verification system that records cryptographic hashes at each transfer point.

03

Required Inputs: Evidence ID and Handler Identity

What to watch: the prompt requires a valid evidence ID format and authenticated handler identity. Missing or malformed inputs produce records that fail downstream validation. Guardrail: enforce input validation before the prompt runs—check evidence ID format against your barcode or accession number schema and verify handler identity against your IAM system.

04

Operational Risk: Custody Action Drift

Risk: the model may generate custody actions outside your controlled vocabulary, such as 'moved' instead of 'transferred' or 'checked' instead of 'verified.' Guardrail: use strict enum constraints in the output schema and add a post-generation validation step that rejects any action not in your approved custody action list before the record enters the audit trail.

05

Operational Risk: Timestamp Ambiguity

Risk: the model may generate relative timestamps or omit timezone information, making it impossible to reconstruct the exact sequence of custody events. Guardrail: require ISO 8601 format with UTC offset in the output schema and validate timestamp presence and format before accepting any generated record.

06

Bad Fit: Court-Admissible Evidence Submission

Avoid when: the output will be submitted directly as a legal exhibit without human review. AI-generated custody records may contain hallucinations or formatting errors that undermine credibility. Guardrail: every AI-generated custody record must pass human review and be attested by the responsible handler before it enters the official chain of custody.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A production-ready prompt template for generating structured chain of custody event logs from digital evidence handling narratives.

This prompt template is designed to be pasted directly into your system instructions or user message. It instructs the model to extract forensic custody events from unstructured text and produce a single, valid JSON object with no surrounding commentary. The template uses square-bracket placeholders that you must replace with your specific inputs before use. The output schema enforces strict field types, controlled vocabularies for custody actions, and ISO 8601 timestamps, making the output suitable for direct ingestion into evidence management systems or audit databases.

text
You are a forensic evidence custodian assistant. Your task is to extract chain of custody events from the provided narrative and output a single JSON object conforming to the schema below. Do not include any text outside the JSON object.

INPUT NARRATIVE:
[INPUT]

OUTPUT SCHEMA:
{
  "evidence_id": "string (format: EV-XXXX-XXXX where X is alphanumeric, required)",
  "custody_events": [
    {
      "event_id": "string (UUID v4 format, required)",
      "timestamp": "string (ISO 8601 format in UTC, required)",
      "handler": {
        "name": "string (required)",
        "badge_id": "string (required)",
        "role": "string (enum: [\"Forensic Analyst\", \"Evidence Officer\", \"Investigator\", \"Lab Technician\", \"External Custodian\"], required)"
      },
      "action": "string (enum: [\"COLLECTED\", \"TRANSFERRED\", \"CHECKED_OUT\", \"CHECKED_IN\", \"ANALYZED\", \"SEALED\", \"UNSEALED\", \"DISPOSED\"], required)",
      "location": "string (required)",
      "notes": "string (optional, max 500 characters)",
      "integrity_check": {
        "hash_algorithm": "string (enum: [\"SHA-256\", \"SHA-512\", \"MD5\"], required if action is CHECKED_IN or CHECKED_OUT)",
        "hash_value": "string (required if hash_algorithm is present)"
      }
    }
  ],
  "chain_of_custody_complete": "boolean (required, true if no gaps in custody timeline)",
  "extraction_confidence": "number (0.0 to 1.0, required)"
}

CONSTRAINTS:
- All timestamps must be in ISO 8601 UTC format (e.g., 2024-01-15T14:30:00Z).
- Custody events must be ordered chronologically by timestamp.
- If the narrative contains ambiguous or conflicting information, set extraction_confidence below 0.8 and note discrepancies in the event notes.
- If no evidence ID matching the format EV-XXXX-XXXX is found, set evidence_id to null and extraction_confidence to 0.0.
- Do not fabricate events. Only extract what is explicitly stated or directly implied by the narrative.
- If the narrative describes a transfer between two handlers, create two events: one CHECKED_OUT by the sender and one CHECKED_IN by the receiver.

To adapt this template, replace the [INPUT] placeholder with the forensic narrative text. For production use, consider injecting additional context via a [CONTEXT] placeholder that includes known evidence metadata, handler rosters, or facility locations to improve extraction accuracy. The controlled vocabularies for action and handler.role should be customized to match your organization's standard operating procedures. If your evidence management system uses a different evidence ID format, update the regex constraint in the prompt and the downstream validation logic accordingly. Always pair this prompt with automated JSON Schema validation and a human review step for events where extraction_confidence falls below 0.9 or where chain_of_custody_complete is false.

IMPLEMENTATION TABLE

Prompt Variables

Required inputs for the Chain of Custody Event Log prompt. Each placeholder must be populated before the prompt is sent. Validation notes describe how to check the input before injection to prevent downstream format errors.

PlaceholderPurposeExampleValidation Notes

[EVIDENCE_ID]

Unique identifier for the digital evidence item

EVD-2025-0042-X9

Regex check: ^EVD-\d{4}-\d{4}-[A-Z0-9]{2}$. Reject if null or empty.

[HANDLER_IDENTITY]

Full name and badge or employee ID of the person performing the action

Jane Doe (BDG-8821)

Must contain both a name string and an identifier in parentheses. Null not allowed.

[CUSTODY_ACTION]

Controlled vocabulary action describing the custody event

TRANSFER

Must match enum: CHECKOUT, CHECKIN, TRANSFER, RECEIVE, DISPOSE, SEAL, UNSEAL. Case-sensitive.

[ACTION_TIMESTAMP]

ISO 8601 UTC timestamp when the custody action occurred

2025-03-15T14:30:00Z

Parse as ISO 8601. Must include seconds and 'Z' suffix. Reject future timestamps beyond 5-minute clock skew.

[TRANSFER_FROM]

Identity of the person or location transferring custody. Nullable for CHECKIN or RECEIVE.

Evidence Locker A-12

Required when CUSTODY_ACTION is TRANSFER or CHECKOUT. Null allowed for RECEIVE and CHECKIN.

[TRANSFER_TO]

Identity of the person or location receiving custody. Nullable for DISPOSE or CHECKOUT.

Forensic Lab B

Required when CUSTODY_ACTION is TRANSFER or CHECKIN. Null allowed for DISPOSE and CHECKOUT.

[LOCATION]

Physical or logical storage location after the action completes

Secure Locker 7B

Non-empty string. Must match known location registry if integrated with physical access systems.

[EVIDENCE_HASH]

SHA-256 hash of the evidence file at the time of the action

a1b2c3d4e5f6...

Regex check: ^[a-f0-9]{64}$. Required for CHECKIN and RECEIVE. Null allowed for CHECKOUT.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Chain of Custody Event Log prompt into a forensic evidence management application with validation, retries, and audit logging.

This prompt is designed to be called from a backend service or an API endpoint that receives raw custody notes from a forensic analyst. The application layer should first authenticate the handler and resolve their identity before injecting it into the prompt's [HANDLER_ID] placeholder. The [EVIDENCE_ID] should be validated against your evidence management system's identifier format (e.g., a UUID or a barcode pattern) before the prompt is assembled. Do not rely on the model to enforce evidence ID uniqueness; that constraint belongs in your database.

Wrap the model call in a validation harness that checks the output JSON against a strict schema before the record is accepted. Required fields include evidence_id, handler_id, action, and timestamp. The action field must be validated against a controlled vocabulary (e.g., COLLECTED, TRANSFERRED, ANALYZED, STORED, DISPOSED). If the model returns an action outside this vocabulary, reject the output and retry with a stronger constraint in the prompt, or escalate for human review. The timestamp must parse as ISO 8601 and must not be in the future. Log every validation failure with the raw model output and the validator error for debugging.

For high-stakes forensic workflows, implement a human-in-the-loop approval step before the custody record is committed to the evidence management system. Present the generated log entry alongside the analyst's original notes in a review UI. The reviewer should confirm that the action type, handler identity, and evidence ID are correct. Once approved, write the record to an append-only audit log with a server-generated entry_id and created_at timestamp. Never allow the model to generate the primary key or the server-side timestamp. For model selection, prefer a model with strong JSON mode support and low latency; structured output features (like GPT-4o's response_format or Claude's tool use) reduce parsing errors. Implement retries with exponential backoff for transient failures, but cap at three attempts before surfacing the raw notes to the analyst for manual entry.

IMPLEMENTATION TABLE

Expected Output Contract

Defines the required fields, types, and validation rules for the Chain of Custody Event Log output. Use this contract to build post-generation validation logic before the record is written to the custody ledger.

Field or ElementType or FormatRequiredValidation Rule

evidence_id

string (regex: ^EVD-\d{4}-\d{6}$)

Must match pattern EVD-YYYY-NNNNNN. Reject on mismatch.

handler_id

string (non-empty)

Must be present and non-blank. Cross-reference against active personnel directory if available.

action_type

string (enum)

Must be one of: CHECKED_OUT, CHECKED_IN, TRANSFERRED, DISPOSED, CREATED, SEALED. Reject unknown values.

transfer_timestamp

string (ISO 8601 UTC)

Must parse as valid ISO 8601 datetime with UTC offset. Reject non-UTC or unparseable strings.

from_custodian

string or null

Required if action_type is TRANSFERRED or CHECKED_IN. Must be null for CREATED. Validate conditional presence.

to_custodian

string or null

Required if action_type is TRANSFERRED or CHECKED_OUT. Must be null for DISPOSED. Validate conditional presence.

location

string (non-empty)

Must be a non-empty string. Log a warning if location is unchanged from the previous event for the same evidence_id.

integrity_hash

string (SHA-256 hex)

If present, must match regex ^[a-f0-9]{64}$. Reject invalid hash formats. Required for CHECKED_IN and SEALED actions.

PRACTICAL GUARDRAILS

Common Failure Modes

Chain of custody prompts fail in predictable ways. Here are the most common failure modes and how to guard against them before they reach production.

01

Evidence ID Format Drift

What to watch: The model generates evidence IDs that don't match your organization's format (wrong prefix, missing check digits, inconsistent length). This breaks downstream evidence management system lookups and creates orphaned records. Guardrail: Provide the exact evidence ID regex or format specification in the prompt. Add a post-generation validator that rejects outputs with non-conforming IDs and triggers a retry with the format constraint repeated.

02

Custody Action Vocabulary Violation

What to watch: The model invents action types outside your controlled vocabulary (e.g., 'checked' instead of 'verified', 'gave' instead of 'transferred'). This corrupts audit queries and breaks action-based filtering in evidence management systems. Guardrail: Enforce an enum constraint in the output schema with only allowed actions: CHECKOUT, CHECKIN, TRANSFER, DISPOSITION, VERIFY. Include the full list in the prompt and validate post-generation.

03

Timestamp Inconsistency Across Records

What to watch: The model generates timestamps in mixed formats (ISO 8601, Unix epoch, human-readable) or uses relative timestamps ('5 minutes ago'). This makes chronological reconstruction impossible during legal review. Guardrail: Specify a single timestamp format (e.g., ISO 8601 with UTC timezone) in the prompt. Validate every timestamp field against that format and reject records that deviate.

04

Missing Handler Identity Attribution

What to watch: The model omits the handler identity field or fills it with placeholder values like 'officer', 'analyst', or 'unknown' when the actual identity isn't provided in the input. This creates gaps in the chain of custody that can invalidate evidence admissibility. Guardrail: Make handler identity a required field with a non-empty constraint. If the input lacks handler information, the prompt should instruct the model to output a null record or an explicit 'IDENTITY_MISSING' flag rather than fabricating an identity.

05

Transfer Chain Gaps and Orphaned Records

What to watch: The model generates custody events that don't form a continuous chain—transfers with no prior custody record, checkouts without corresponding checkins, or evidence that appears in two places simultaneously. These gaps are red flags during cross-examination. Guardrail: Include a chain continuity check in your application layer. Before accepting a new custody event, verify that the evidence ID has a prior custody record and that the previous action allows the current action (e.g., CHECKIN must follow CHECKOUT).

06

Narrative Injection Instead of Structured Output

What to watch: Under ambiguous input, the model reverts to generating a narrative paragraph describing the custody event instead of producing the structured JSON record. This happens when the input contains complex scenarios or the prompt doesn't strongly enforce the output format. Guardrail: Use a schema-first prompt design with an explicit JSON Schema. Add a format enforcement instruction: 'Return ONLY a valid JSON object matching the schema. Do not include explanations, commentary, or narrative text outside the JSON structure.' Validate parseability before accepting any output.

IMPLEMENTATION TABLE

Evaluation Rubric

Criteria for testing the quality and correctness of a Chain of Custody Event Log prompt before deploying it to production. Each criterion includes a pass standard, a failure signal, and a test method.

CriterionPass StandardFailure SignalTest Method

Evidence ID Format

[EVIDENCE_ID] output matches the pattern EVD-\d{4}-\d{6} in every record.

Output contains a malformed ID, a missing ID, or an ID that does not match the required regex.

Regex validation on 50 generated records; 100% must match.

Custody Action Vocabulary

[ACTION] field is always one of: CHECKIN, CHECKOUT, TRANSFER, DISPOSITION, ARCHIVE.

An action outside the controlled vocabulary appears, or the field is null.

Enum check on 100 records generated from varied input descriptions; 0 out-of-vocabulary errors allowed.

Handler Identity Presence

[HANDLER_ID] is a non-empty string in every record.

A record is generated with a null, empty, or whitespace-only handler ID.

Schema validation on 100 records; 0 null or empty values allowed.

Timestamp ISO 8601 Compliance

[TIMESTAMP] is a valid ISO 8601 string in UTC (YYYY-MM-DDTHH:MM:SSZ).

Timestamp is missing, in the wrong timezone, or uses an incorrect format.

Parse check using datetime.fromisoformat() on 50 records; 100% must parse without error.

Transfer Chain Completeness

A TRANSFER action always includes both a non-null [TRANSFER_FROM] and [TRANSFER_TO] field.

A transfer record is missing one or both of the required transfer fields.

Field presence check on all records where [ACTION] is TRANSFER; 100% must have both fields populated.

Source Grounding

The notes field contains a direct quote or a clear paraphrase grounded in the [INPUT_CONTEXT].

The notes field contains a hallucinated detail not present in the input context.

Human review of 20 records against their source text; 0 hallucinations allowed.

Output Schema Validity

The generated JSON array is valid and every object contains all required fields: evidence_id, timestamp, action, handler_id.

The output is not valid JSON, or a required field is missing from any record.

Automated jsonschema validation against the defined output contract for every generation.

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a single example and minimal constraints. Remove the strict JSON Schema requirement and ask for a Markdown table or bullet list first to test the model's understanding of custody events. Replace [OUTPUT_SCHEMA] with a simple format description: "Return a JSON object with fields: evidence_id, handler_id, action, timestamp, transfer_from, transfer_to, notes."

Watch for

  • Missing fields in output records
  • Inconsistent timestamp formats across runs
  • Action values outside the controlled vocabulary (e.g., 'moved' instead of 'transferred')
  • Model inventing evidence IDs instead of using provided [EVIDENCE_ID]
Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.