Canon Boundary Guard is a Codex plugin that packages a provenance-boundary skill and an optional hook bundle.
It helps Codex keep project evidence, chat context, operator instructions, working hypotheses, and model assumptions in separate cognitive layers during a session.
The older standalone skill layout is preserved in the
standalone-skill-v1 branch.
Codex often works with several kinds of information at the same time:
- files already in the project
- messages from the current conversation
- instructions that tell Codex how to behave
- runtime context shown at the start of a session
- assumptions that come from the model itself
Canon Boundary Guard gives Codex a compact classification frame for those sources.
The goal is not only to protect file edits. The frame is meant to stay useful while Codex reads, reasons, decides, restructures, and eventually writes persistent project content.
When Codex works on a repository, it reads more than files.
It may also use conversation history, runtime context, tool output, instructions, compressed summaries, and model assumptions.
Those sources do not have the same authority.
A project file is not the same thing as a temporary chat message. An instruction for Codex is not the same thing as content that belongs in the repository. A model assumption is not the same thing as verified evidence.
Canon Boundary Guard exists to keep those boundaries visible while Codex reasons, decides, and eventually writes persistent project content.
In some Codex environments, such as editor-integrated sessions, AGENTS.md
instructions may appear at the start of the conversation as a visible user-role
message before the operator's real first request.
That display role is not enough to decide authority.
The block may refer to the current working directory, even when the actual
instruction source is global, such as an AGENTS.md stored in Codex home.
Canon Boundary Guard includes a countermeasure for this case: a leading block
starting with AGENTS.md instructions for <path> is treated as Codex runtime
instruction-chain material, not ordinary chat and not repository content.
When this distinction matters, verify the authority layer before using the block as project evidence or writing it into persistent files.
Canon Boundary Guard is installed as a Codex plugin.
It is not installed like an old standalone skill.
- Add this repository to Codex:
codex plugin marketplace add XxYouDeaDPunKxX/canon-boundary-guard-codex- Open Codex and open the plugin picker or plugin list. In Codex UIs that support slash commands, you can use:
/plugins-
Install or enable Canon Boundary Guard.
-
Start a new thread.
-
Ask Codex to use it:
Use Canon Boundary Guard for this session.For the hook to work, enable plugin hooks in your Codex config:
[features]
hooks = true
plugin_hooks = trueThen restart Codex. If your Codex UI exposes a hook review view such as
/hooks, use it to review and trust the bundled hook. In editor integrations
where /hooks is not available, open the plugin details or approve the hook
when Codex shows the trust prompt.
The hook is recommended, but the skill can still be used without it.
If you prefer the older manual setup, use the standalone-skill-v1 branch and
copy the canon-boundary-guard/ folder into your Codex skills directory.
Use the plugin when a session depends on keeping old context, current instructions, external information, working hypotheses, model assumptions, and project evidence separate.
Use Canon Boundary Guard for this session.You can also call the bundled skill directly:
Use $canon-boundary-guard for this session.This project was developed with AI assistance.
The project, documentation, and repository materials were shaped through human-directed work supported by AI tools during drafting, structuring, review, and refinement.
AI assistance does not make the project automatically correct, complete, or suitable for every use case. Read it, test it, and adapt it to your own context.
This project is licensed under CC BY-SA 4.0: Creative Commons Attribution-ShareAlike 4.0 International.
See LICENSE.
βοΈ Technical details
This section is for readers who want to inspect the actual operating model behind the plugin. It uses the skill's internal terms directly.
.agents/
`-- plugins/
`-- marketplace.json
plugins/
`-- canon-boundary-guard-codex/
|-- .codex-plugin/
| `-- plugin.json
|-- hooks/
| `-- hooks.json
`-- skills/
`-- canon-boundary-guard/
|-- SKILL.md
|-- agents/openai.yaml
|-- references/frame.md
`-- scripts/inject_frame.py.agents/plugins/marketplace.jsonexposes the plugin to Codex as a marketplace entry.plugins/canon-boundary-guard-codex/.codex-plugin/plugin.jsonidentifies the plugin and points Codex to bundled skills and hooks.plugins/canon-boundary-guard-codex/skills/canon-boundary-guard/SKILL.mddefines the full operating frame.plugins/canon-boundary-guard-codex/skills/canon-boundary-guard/references/frame.mdcontains the compact frame emitted by the hook script.plugins/canon-boundary-guard-codex/skills/canon-boundary-guard/scripts/inject_frame.pyreads the compact frame and emits a hook payload.plugins/canon-boundary-guard-codex/skills/canon-boundary-guard/agents/openai.yamlcontains Codex-facing skill metadata.plugins/canon-boundary-guard-codex/hooks/hooks.jsonwires the frame intoPreToolUsefor matched write tools when plugin hooks are enabled.
The skill is designed to keep source classes separate throughout the session, not only at write time.
The frame should affect reading, analysis, planning, conflict detection, and persistence decisions. The hook only re-surfaces the compact frame near matched write tools.
Canon Boundary Guard uses six source classes. They do not decide whether something is true by themselves. They describe where the material came from and whether it can safely become persistent project content.
L0 EVIDENCE: project files, git state, tests, schemas, lockfiles, diagnostics, command output, or verified tool output.L1 SHAPING: conversation material not approved for persistence.L1A AUTHORIZED DELTA: operator-approved material for the current turn, before it is written.L2 AGENT CONTROL: instructions that shape agent behavior, not project content.L2A CODEX INSTRUCTION CHAIN: AGENTS guidance and runtime instruction-chain material.L3 MODEL PRIOR: unverified model memory, assumed conventions, generic best practice, or unstated framework behavior.
Non-L0 material is tagged only when the output would change if the source changed.
The important boundary is persistence. L1, L2, L2A, and L3 can shape how Codex works, but they should not silently become repository content. L1A can be written only inside the scope approved by the operator. L2 and L2A require an explicit request for agent-facing instructions before they can be persisted.
A leading user-role block starting with:
AGENTS.md instructions for <path>is classified as L2A runtime instruction-chain material.
It is not operator chat, not project content, and not dependent on filesystem
confirmation. If it contains an <environment_context>...</environment_context>
block, that block is runtime metadata.
The first operator request starts after this prelude.
plugins/canon-boundary-guard-codex/skills/canon-boundary-guard/scripts/inject_frame.py
is intentionally small. It reads
plugins/canon-boundary-guard-codex/skills/canon-boundary-guard/references/frame.md,
strips surrounding whitespace, and emits JSON for a Codex PreToolUse hook:
{
"hookSpecificOutput": {
"hookEventName": "PreToolUse",
"additionalContext": "<contents of plugins/canon-boundary-guard-codex/skills/canon-boundary-guard/references/frame.md>"
},
"systemMessage": "<contents of plugins/canon-boundary-guard-codex/skills/canon-boundary-guard/references/frame.md>"
}The hook is highly recommended for sessions where repository content, project
rules, protocols, naming, workflows, or AGENTS.md authority may matter. It is
intended for matched write tools, for example apply_patch, Write, or
Edit.
The hook is not the core mechanism of the skill. It is a reinforcement point that re-surfaces the compact frame before matched write tools.
In current Codex runtimes, some edits may be applied through internal file-change paths that do not expose a visible hook event. Treat the hook as a best-effort reinforcement layer, not as complete enforcement.
The frame is injected as hookSpecificOutput.additionalContext, which is the
model-visible context path for PreToolUse. The same frame is also surfaced as a
systemMessage so the hook activity remains visible in the UI or event stream.
It does not block the tool call, rewrite the requested operation, or decide project policy. Its job is to put the classification frame back into the instruction stream at the moment a write may happen.
The plugin manifest points to:
plugins/canon-boundary-guard-codex/hooks/hooks.jsonThe default hook configuration is:
{
"hooks": {
"PreToolUse": [
{
"matcher": "apply_patch|Write|Edit",
"hooks": [
{
"type": "command",
"command": "python ${PLUGIN_ROOT}/skills/canon-boundary-guard/scripts/inject_frame.py",
"timeout": 5,
"statusMessage": "Provenance frame"
}
]
}
]
}
}Codex hooks use hooks as the canonical feature key. Plugin-bundled hooks are
off by default in this release. Enable both with:
[features]
hooks = true
plugin_hooks = trueAfter installation or hook changes, restart Codex. If your Codex UI exposes a
hook review view such as /hooks, use it to review and trust the bundled hook.
In editor integrations where /hooks is not available, open the plugin details
or approve the hook when Codex shows the trust prompt. Plugin hooks are
non-managed hooks and do not run until trusted.
If your system requires python3 instead of python, adjust the hook command
in your local plugin copy or configure an equivalent hook in your Codex
config.toml.
If
plugins/canon-boundary-guard-codex/skills/canon-boundary-guard/references/frame.md
is missing, the hook script still emits a systemMessage:
Canon Boundary Guard frame missing: provenance protection degraded.This keeps the failure visible without blocking execution.
That fallback is deliberate: the skill should not make normal work impossible because a local file is missing, but it should also not fail silently.
