Evidence preservation

From jmagly/aiwg · View interactive version

Evidence preservation is an AI agent skill from the GitHub repository jmagly/aiwg. Chain of custody and evidence preservation procedures covering log collection, hash verification, custody documentation, and evidence packaging per RFC 3227

How to use this skill

Skill file

evidence-preservation

Implements evidence preservation procedures aligned with RFC 3227 (Guidelines for Evidence Collection and Archiving) and NIST SP 800-86. Guides examiners through volatile-first collection ordering, cryptographic verification of all evidence items, chain of custody documentation, and evidence packaging for storage or legal handoff.

Triggers

Alternate expressions and non-obvious activations (primary phrases are matched automatically from the skill description):

Purpose

Evidence that cannot be authenticated is evidence that cannot be used. Without documented chain of custody, opposing counsel can challenge whether evidence was tampered with between collection and presentation. This skill enforces RFC 3227 collection ordering, generates cryptographic hashes at collection time, and produces legally defensible custody documentation.

Behavior

For a pull-request investigation, ingest the exact-head receipt described in

docs/security/pr-evidence-receipts.md with its source blobs. Verify each

evidenceManifest SHA-256, record omissions and actionTrail in custody notes,

and keep scope triage separate from attack attribution. A partial PR receipt

is evidence of incomplete collection, not evidence of compromise.

When triggered, this skill:

  1. Initialize case record:
  1. Apply RFC 3227 collection ordering (most volatile first):

1. Registers, cache, and running process state (memory)

2. Routing table, ARP cache, process table, kernel statistics

3. Temporary file system contents

4. Disk data

5. Remote logging and monitoring data

6. Physical configuration and network topology

  1. Volatile data collection:
  1. Disk image acquisition guidance:

```bash

dc3dd if=/dev/sda hash=sha256 hof=evidence.dd log=acquisition.log

```

  1. Log file collection:

```bash

sha256sum /var/log/auth.log > /var/log/auth.log.sha256

```

  1. Cloud evidence collection (when cloud resources are in scope):
  1. Container evidence collection (when containers are in scope):

```bash

docker logs <container_id> > /evidence/containers/<container_id>-logs.txt

docker export <container_id> > /evidence/containers/<container_id>-filesystem.tar

docker inspect <container_id> > /evidence/containers/<container_id>-inspect.json

```

  1. Hash verification procedure:

```bash

find .aiwg/forensics/evidence/<package-id>/ -type f -not -name '*.sha256' | \

xargs sha256sum > .aiwg/forensics/evidence/<package-id>/manifest.sha256

```

  1. Chain of custody documentation:
  1. Evidence packaging:

```bash

tar czf - .aiwg/forensics/evidence/<package-id>/ | \

gpg --symmetric --cipher-algo AES256 -o <package-id>.tar.gz.gpg

```

  1. Write custody documentation:

Usage Examples

Example 1 — Begin evidence collection

preserve evidence

Initializes case record and guides through collection.

Example 2 — Document a custody transfer

chain of custody transfer --to "Jane Smith, Legal" --method "encrypted email"

Example 3 — Package collected evidence

package evidence <package-id>

Output Locations

Configuration

evidence_preservation:
  hash_algorithm: sha256
  collection_order: rfc3227
  encrypt_packages: true
  encryption_cipher: AES256
  timestamp_format: ISO8601
  volatile_collection_window_seconds: 60
  require_write_blocker_confirmation: true

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.