Spaces:
Paused
Paused
Workflow: create-receipt
Generate a signed receipt for the last artifact or action.
Prerequisites
- An action was performed (build, verify, inspect, search, review, etc.)
- At least one artifact was produced (or failure was recorded)
Steps
Gather action context
- Agent name
- Action type
- Timestamp (ISO 8601)
- Commands run (list of strings)
- Result status: success | failure | partial
Identify artifact
- Primary artifact path (absolute)
- If artifact exists: compute SHA-256 hash
shasum -a 256 <artifact_path>→ parse hash
- If no artifact: set path and hash to null, result must be "failure"
Build receipt JSON
{ "receipt_id": "<uuid4>", "timestamp": "<ISO 8601>", "agent": "<agent_name>", "action": "<action_type>", "artifact_path": "<absolute_path_or_null>", "artifact_hash": "<sha256_or_null>", "commands_run": ["<cmd1>", "<cmd2>"], "result": "<success|failure|partial>", "details": {}, "previous_receipt": "<receipt_id_or_null>" }Link to previous receipt
- If this action is a continuation of a prior action, set
previous_receiptto the prior receipt's ID - Otherwise set to null
- If this action is a continuation of a prior action, set
Write receipt
- Filename:
receipts/{timestamp}_{agent}_{action}.json - Write JSON with
json.dump(indent=2) - Verify file exists after write
- Filename:
Log
logger.info(f"[Receipt] Written: {filepath} hash={hash[:16]}...")
Validation
- After writing, re-read the file and verify
artifact_hashmatches actual file hash - If mismatch → log
RECEIPT_INVALIDbut do not delete (audit trail)
Sacred Rule
No receipt = artifact doesn't exist.