Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/xxyoudeadpunkxx/canon-boundary-guard-for-gpt-project/llms.txt

Use this file to discover all available pages before exploring further.

artifact_fingerprint.py creates mechanical fingerprints for files: path, existence, type, size in bytes, UTC modification time, and SHA-256 hash. Use it to anchor file identity when recording L0 sources in SESSION_STATE, or to verify that a file has not changed between sessions. The script always emits JSON — there is no human-readable output mode.
This script does not classify provenance. It only emits mechanical file identity data. Whether a fingerprint constitutes valid L0 evidence is an operator decision.

Usage

# Fingerprint a single file
python artifact_fingerprint.py path/to/file.json

# Fingerprint multiple files in one invocation
python artifact_fingerprint.py file1.json file2.md

# Fingerprint with custom JSON indentation
python artifact_fingerprint.py *.json --indent 4

Arguments

paths
string[]
required
One or more file paths to fingerprint. Accepts glob expansion from the shell. Each path is processed independently; a missing file produces a minimal entry rather than causing the entire invocation to fail.
--indent
integer
JSON indentation level for the output array. Defaults to 2. Pass 0 to produce compact single-line JSON.

Output

The script always prints a JSON array to stdout, one object per input path, in the same order as the arguments.
[
  {
    "path": "canon-boundary-guard-gpt/schemas/SESSION_STATE.schema.json",
    "exists": true,
    "is_file": true,
    "is_dir": false,
    "size_bytes": 2847,
    "mtime_utc": "2025-01-15T10:23:45+00:00",
    "sha256": "a3f2c91e4d7b08f5e6321abc90d1fedc3b2a5876f4109ce78d23b65091a4fc2e"
  }
]
FieldTypeDescription
pathstringThe path exactly as supplied on the command line
existsbooleantrue if the path exists on the filesystem
is_filebooleantrue if the path is a regular file
is_dirbooleantrue if the path is a directory
size_bytesintegerFile size in bytes as reported by stat
mtime_utcstringLast-modified time in ISO-8601 format with UTC offset (+00:00)
sha256stringFull lowercase hex SHA-256 digest of the file contents. Only present when is_file is true.
The sha256 field is computed by reading the file in 1 MiB chunks to support large files without loading the entire content into memory. It is omitted for directories (is_dir: true) even when the path exists.

Missing files

If a path does not exist, its entry contains only path and exists: false. All other fields are omitted:
[
  {
    "path": "missing-file.json",
    "exists": false
  }
]
This allows batch fingerprinting of expected file sets to detect which files are present without aborting on the first missing path.

Use in provenance anchoring

SESSION_STATE last_state_hash

The sha256 value from fingerprinting a _SESSION_STATE.json file can be recorded directly as the last_state_hash field of the next state:
{
  "last_state_hash": "sha256:a3f2c91e4d7b08f5e6321abc90d1fedc3b2a5876f4109ce78d23b65091a4fc2e"
}
When a subsequent CANON_STATE_DELTA references basis.previous_hash, it should use the same sha256: prefixed format. This allows validate_state.py and manual inspection to confirm that no intermediate state was lost.

Source-staged extraction identity anchoring

When registering a file as an L0 source in active_l0_sources, fingerprint the file before and after the session to detect any unintended mutations. Record the sha256 in the notes field of the source entry:
{
  "source_id": "canon-boundary-guard-gpt/schemas/SESSION_STATE.schema.json",
  "source_type": "project_file",
  "status": "inspected",
  "notes": "sha256:a3f2c91e4d7b08f5e6321abc90d1fedc3b2a5876f4109ce78d23b65091a4fc2e at inspection"
}
This creates a durable chain: the fingerprint anchors the exact byte content that was inspected, making it possible to confirm identity if the file is later re-uploaded or replaced.

Build docs developers (and LLMs) love