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.

Canon Boundary Guard tracks session context in a JSON state file. This guide explains the state model, how to keep state durable across ChatGPT sessions, and how to recover when the state is unavailable. Understanding the state lifecycle is essential for any session longer than a single conversation.

The working state file

Canon Boundary Guard maintains a working copy of the session state at /mnt/data/_SESSION_STATE.json. This file is written and updated during the session but is not durable by itself — when the chat ends or the file runtime resets, it is gone. The schema-minimal shape of a SESSION_STATE object is:
{
  "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"
}
This is the schema-minimal shape only — it is not a valid first-install template. After bootstrap, active_l0_sources must contain entries for every inspected bootstrap surface. A state file with an empty active_l0_sources array is not a completed first-install state.
The full schema is defined in canon-boundary-guard-gpt/schemas/SESSION_STATE.schema.json. Use scripts/validate_state.py to validate a state file against this schema.

First-install state creation

The first-install rule controls when a new working state may be initialised. ChatGPT may create a new state at /mnt/data/_SESSION_STATE.json only when:
  • The operator explicitly declares a fresh install, or
  • The current task is the initial bundle installation and there is no prior-state claim.
Before creating the working state, all of the following sources must be inspected:
  • canon-boundary-guard-gpt/SKILL.md
  • canon-boundary-guard-gpt/references/protocol.md
  • canon-boundary-guard-gpt/references/gpt-project-adapter.md
  • canon-boundary-guard-gpt/references/state-and-recovery.md
  • canon-boundary-guard-gpt/schemas/SESSION_STATE.schema.json
After inspection, active_l0_sources must be populated with an entry for each inspected bootstrap surface. Each entry records only the surface that was actually inspected in this session — not the whole bundle. If scripts/validate_state.py is available, the created state must be validated before it is treated as available. The initialized state at /mnt/data/_SESSION_STATE.json is working state only. It becomes durable only after explicit export and re-upload, or after a Project Source save through the simulated gate.

Making state durable

At the end of a session, ask ChatGPT to make the current SESSION_STATE.json available as a download:
Please make /mnt/data/_SESSION_STATE.json available for download.
Save the file locally. At the start of the next session, upload it as a file attachment before your first message. ChatGPT will detect it during Status Check and use it to restore context.This is the simplest option and works even without Projects access.

CANON_STATE_DELTA

A CANON_STATE_DELTA is a self-contained snapshot delta emitted after every Mode B or Mode C state-changing decision. It is the primary unit of portable state. A valid CANON_STATE_DELTA must include all of the following fields:
FieldDescription
typeAlways CANON_STATE_DELTA.
seqMonotonically increasing sequence number relative to the session.
timestampISO-8601 timestamp of the delta.
basisReference to the SESSION_STATE state_seq this delta was computed from.
decisionHuman-readable description of the state-changing decision.
current_stateFull SESSION_STATE object at the time of the delta, validating against SESSION_STATE.schema.json.
operator_action_requiredBoolean — whether operator approval is still pending.
Differential-only deltas are not valid recovery material. A delta that lists only changed fields, without a complete current_state object, cannot be used to restore session context. ChatGPT will reject it as a recovery source and treat it as L1 text only. Validate deltas against canon-boundary-guard-gpt/schemas/CANON_STATE_DELTA.schema.json using scripts/validate_state.py.

Recovery mode

If this is not a fresh install and no valid SESSION_STATE is available, ChatGPT enters read-only recovery mode. This applies when the state file is missing, cannot be validated, or when a supplied CANON_STATE_DELTA is invalid.
  • Inspect Project Sources
  • Inspect uploaded files
  • List which state is missing and why
  • Explain recovery options to the operator
  • Prepare a recovery plan

Accepted recovery sources

ChatGPT accepts exactly three sources for exiting recovery mode:
  1. Uploaded SESSION_STATE.json — a previously exported state file uploaded as a file attachment. ChatGPT validates it against the schema before restoring.
  2. Pasted CANON_STATE_DELTA with valid current_state — the full delta block pasted in chat. The current_state object must be complete and schema-valid.
  3. Explicit operator reconstruction marked as L1A — the operator explicitly authorises a reconstruction from available evidence, and the result is recorded as an L1A delta in the current turn.
Reconstructing state from chat memory alone is not an accepted recovery source. ChatGPT must not infer prior approved decisions, L0 source lists, or authorized deltas from conversation context without explicit operator authorisation. Doing so would introduce unverified L3 material into the state, defeating the purpose of provenance control.

Invalid delta behavior

When a supplied CANON_STATE_DELTA is found to be invalid — missing required fields, failing schema validation, or containing only differential data without a full current_state — ChatGPT will:
  • Reject the delta as a recovery source.
  • Treat the pasted block as L1 recovery text only — available for reference but not admitted as state.
  • Not reconstruct state from the invalid delta unless the operator explicitly authorises an L1A reconstruction.
ChatGPT will report why the delta was rejected and list what valid recovery sources are accepted.

SESSION_STATE Schema

Full JSON Schema reference for the SESSION_STATE object, including all required fields and enum values.

CANON_STATE_DELTA Schema

Full JSON Schema reference for CANON_STATE_DELTA, including delta metadata and current_state requirements.

Build docs developers (and LLMs) love