codex - 💡(How to fix) Fix Codex CLI capability request: persistent governed repo mode for long-running local workflows [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#18273Fetched 2026-04-18 05:56:42
View on GitHub
Comments
1
Participants
2
Timeline
11
Reactions
0
Timeline (top)
labeled ×6unlabeled ×4commented ×1

Root Cause

Actual behavior: Startup can be hardened locally with wrappers and readiness gates, but ongoing adherence still depends too much on repeated manual re-anchoring because there is no first-class governed mode or documented persistent enforcement surface.

RAW_BUFFERClick to expand / collapse

What variant of Codex are you using?

CLI

What feature would you like to see?

A first-class governed repository mode for Codex CLI, or an official hook/event surface that allows persistent repo-local governance enforcement across the full interactive session.

This is a Codex CLI feature request for long-running governed local-repo workflows, not a general model-quality complaint.

In this repo, we already have:

  • session-start / session-stop lifecycle
  • persisted PRE/POA/SOP governance artifacts
  • MCP-first routing
  • preflight/compliance validation
  • repo-root launch wrapper
  • fail-closed startup hardening

That work improves startup anchoring, but Codex CLI still has no documented or official way to stay persistently bound to repo-local governance across the full session.

What is needed:

  • persistent session anchoring to repo-local governance/state
  • official pre-prompt / pre-tool / pre-response / post-response hooks or equivalent events
  • repo-local compliance validation with retry/block behavior
  • fail-closed handling when required governance surfaces are missing, stale, or contradictory

Why this matters:

  • long sessions can drift from repo protocol
  • compression/recovery increases continuity loss
  • users have to repeatedly re-anchor the CLI manually
  • this causes token waste and more inference than protocol-grounded execution

Expected behavior: After startup establishes repo governance state, Codex CLI should be able to remain anchored to that state unless it is explicitly refreshed, changed, or invalidated.

Actual behavior: Startup can be hardened locally with wrappers and readiness gates, but ongoing adherence still depends too much on repeated manual re-anchoring because there is no first-class governed mode or documented persistent enforcement surface.

Additional information

Environment:

  • Codex CLI version: codex-cli 0.121.0
  • Auth mode: ChatGPT sign-in
  • OS / shell: Windows 11 / PowerShell

Concrete example: After long multi-step sessions or after compression/recovery, the repo has to manually re-point Codex to active governance artifacts such as config/active_session_governance.json; otherwise responses can drift toward generic synthesis instead of staying anchored to the active PRE/ POA/SOP session frame.

This repo already includes custom startup and governance hardening to reduce drift, but the missing capability is native persistent CLI adherence, not better prompting.

I also prepared a short writeup with code snippets and can attach it if helpful.

Before submitting, do one quick search in that repo for:

  • governed mode
  • hooks
  • session persistence
  • CLI feature request

extent analysis

TL;DR

Implement a custom solution using existing Codex CLI features and scripting to achieve persistent session anchoring to repo-local governance.

Guidance

  • Investigate using the repo-root launch wrapper and preflight/compliance validation to create a custom hook-like mechanism for enforcing governance across the session.
  • Explore scripting options in PowerShell to automate the process of re-anchoring the CLI to the active governance artifacts, such as config/active_session_governance.json.
  • Consider using the session-start and session-stop lifecycle events to trigger custom scripts that enforce governance and persistence.
  • Review the custom startup and governance hardening already implemented in the repo to identify potential areas for extension or modification to achieve persistent CLI adherence.

Example

No code snippet is provided due to the lack of specific implementation details, but a potential approach could involve using PowerShell scripting to automate the re-anchoring process, such as:

# Pseudo-code example, not intended for direct use
# Assume $governanceFile is the path to config/active_session_governance.json
$governanceFile = "config/active_session_governance.json"
# Re-anchor the CLI to the active governance artifacts
codex-cli --governance-file $governanceFile

Notes

The provided information suggests that a native governed mode or official hook/event surface is not currently available in the Codex CLI. Therefore, a custom solution using existing features and scripting may be necessary to achieve the desired behavior.

Recommendation

Apply a custom workaround using scripting and existing Codex CLI features, as a native governed mode is not currently available. This approach allows for flexibility and adaptability to the specific requirements of the repo, while also providing a potential foundation for future integration with official Codex CLI features.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING