### Project Setup: Custom Instructions Source: https://github.com/xxyoudeadpunkxx/canon-boundary-guard-for-gpt-project/blob/main/README.md Copy the contents of this file to be pasted into the Project instructions in ChatGPT. ```text PROJECT_CUSTOM_INSTRUCTIONS.txt ``` -------------------------------- ### Project Setup: Zip Folder Source: https://github.com/xxyoudeadpunkxx/canon-boundary-guard-for-gpt-project/blob/main/README.md Create a zip archive of the project directory to be used as a source bundle for ChatGPT Projects. ```text canon-boundary-guard-gpt/ ``` -------------------------------- ### Example Labels for Simulated Gate Source: https://github.com/xxyoudeadpunkxx/canon-boundary-guard-for-gpt-project/blob/main/README.md These labels are deterministically generated by the simulated gate to indicate the status of content regarding saving and approval. ```text [SAFE TO SAVE] [DO NOT SAVE - L1/L3 PRESENT] [STATE DELTA - SAVE/PASTE ONLY AS RECOVERY MATERIAL] [DRAFT - REQUIRES OPERATOR APPROVAL] ``` -------------------------------- ### State and Recovery Sources Source: https://github.com/xxyoudeadpunkxx/canon-boundary-guard-for-gpt-project/blob/main/README.md Lists the potential sources for recovering the working state when valid state is unavailable. These include uploaded JSON files, pasted deltas, and explicit operator reconstruction. ```text 1. uploaded `SESSION_STATE.json` 2. pasted `CANON_STATE_DELTA` with valid `current_state` 3. explicit operator reconstruction marked as `L1A` ``` -------------------------------- ### Script: Extract Proof Source: https://github.com/xxyoudeadpunkxx/canon-boundary-guard-for-gpt-project/blob/main/README.md Python script for extracting proof from artifacts. ```python extract_proof.py ``` -------------------------------- ### Package Structure: Bundle Contents Source: https://github.com/xxyoudeadpunkxx/canon-boundary-guard-for-gpt-project/blob/main/README.md Lists the files and directories contained within the Canon Boundary Guard zip bundle. ```text canon-boundary-guard-gpt/ |-- SKILL.md |-- references/ | |-- gpt-project-adapter.md | |-- proof-of-read.md | |-- protocol.md | |-- scratch-canon.md | `-- state-and-recovery.md |-- schemas/ | |-- CANON_STATE_DELTA.schema.json | `-- SESSION_STATE.schema.json `-- scripts/ |-- artifact_fingerprint.py |-- extract_proof.py `-- validate_state.py ``` -------------------------------- ### Working State Path Source: https://github.com/xxyoudeadpunkxx/canon-boundary-guard-for-gpt-project/blob/main/README.md Specifies the file path for the working session state. This file is not durable on its own and requires specific conditions for creation and use. ```text /mnt/data/_SESSION_STATE.json ``` -------------------------------- ### Proof Extraction Script Source: https://github.com/xxyoudeadpunkxx/canon-boundary-guard-for-gpt-project/blob/main/README.md Describes the `extract_proof.py` script, which is responsible for extracting mechanical proof-of-read from text or Markdown files. It also reads files using `utf-8-sig` encoding. ```python import re def extract_proof_from_text(text): # Example: Extracting lines that look like proof statements proof_lines = re.findall(r'^Proof:.*', text, re.MULTILINE) return proof_lines def extract_proof_from_file(file_path): try: with open(file_path, 'r', encoding='utf-8-sig') as f: content = f.read() return extract_proof_from_text(content) except FileNotFoundError: print(f"Error: File not found at {file_path}") return [] except Exception as e: print(f"An unexpected error occurred: {e}") return [] # Example usage: # proof = extract_proof_from_file('document.md') # print(proof) ``` -------------------------------- ### Artifact Fingerprint Script Source: https://github.com/xxyoudeadpunkxx/canon-boundary-guard-for-gpt-project/blob/main/README.md Explains the `artifact_fingerprint.py` script, which generates a fingerprint for files by emitting their size, modification time, and SHA-256 hash. ```python import os import hashlib import datetime def get_artifact_fingerprint(file_path): try: file_stat = os.stat(file_path) file_size = file_stat.st_size modified_time = datetime.datetime.fromtimestamp(file_stat.st_mtime).isoformat() sha256_hash = hashlib.sha256() with open(file_path, 'rb') as f: while chunk := f.read(4096): sha256_hash.update(chunk) file_hash = sha256_hash.hexdigest() return { "file_size": file_size, "modified_time": modified_time, "sha256_hash": file_hash } except FileNotFoundError: print(f"Error: File not found at {file_path}") return None except Exception as e: print(f"An unexpected error occurred: {e}") return None # Example usage: # fingerprint = get_artifact_fingerprint('my_artifact.zip') # print(fingerprint) ``` -------------------------------- ### Script: Artifact Fingerprint Source: https://github.com/xxyoudeadpunkxx/canon-boundary-guard-for-gpt-project/blob/main/README.md Python script for generating an artifact fingerprint. ```python artifact_fingerprint.py ``` -------------------------------- ### SESSION_STATE Schema Source: https://github.com/xxyoudeadpunkxx/canon-boundary-guard-for-gpt-project/blob/main/canon-boundary-guard-gpt/references/state-and-recovery.md Defines the minimal schema for the working state file, SESSION_STATE.json. This schema is used for validation. ```json { "protocol": "canon-boundary-guard:gpt-project-adapter", "protocol_version": "1.1", "state_seq": 0, "updated_at": "ISO-8601", "active_l0_sources": [], "authorized_deltas": [], "open_conflicts": [], "pending_decisions": [], "last_persistent_artifacts": [], "last_state_hash": "sha256:optional" } ``` -------------------------------- ### Script: Validate State Source: https://github.com/xxyoudeadpunkxx/canon-boundary-guard-for-gpt-project/blob/main/README.md Python script for validating session state. ```python validate_state.py ``` -------------------------------- ### State Validation Script Source: https://github.com/xxyoudeadpunkxx/canon-boundary-guard-for-gpt-project/blob/main/README.md Details the functionality of the `validate_state.py` script, which is used to validate session state and canon state delta files. It utilizes `jsonschema` if available and falls back to manual validation. ```python import json import jsonschema def validate_state(state_file_path): try: with open(state_file_path, 'r', encoding='utf-8-sig') as f: state_data = json.load(f) # Load schema (assuming schema is available) # schema = ... # jsonschema.validate(instance=state_data, schema=schema) print(f"State file {state_file_path} is valid.") except FileNotFoundError: print(f"Error: State file not found at {state_file_path}") except json.JSONDecodeError: print(f"Error: Could not decode JSON from {state_file_path}") except jsonschema.ValidationError as e: print(f"Schema validation failed for {state_file_path}: {e}") except Exception as e: print(f"An unexpected error occurred during validation: {e}") # Example usage: # validate_state('/mnt/data/SESSION_STATE.json') ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.