feat: /codex:init-policy generates a starting execution policy - #3
Merged
Conversation
/codex:init-policy inspects the repository layout and toolchain and writes a suggested .codex-plugin/policy.json: writable globs from top-level directories, test-agent globs from test directories and ecosystem test-file patterns, and a verification command detected from package.json scripts (npm/pnpm/yarn/bun), go.mod, Cargo.toml, pytest markers, or a Makefile test target. The generator never weakens the security model: it refuses to overwrite an existing policy without --force, validates its own output under the runtime's fail-closed loader (removing the file if validation fails), and always emits allowAutoLand: false. Committing the generated file remains the human's explicit opt-in that enables write-capable agents.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Answers "can the policy be generated automatically?" — yes, per repo, without weakening fail-closed.
init-policy+/codex:init-policycommand.go.mod,Cargo.toml, pytest markers, Makefiletesttarget).--force; round-trips its own output through the runtime's fail-closedloadPolicyand deletes it on failure; alwaysallowAutoLand: false; committing the file stays the human opt-in.Verification
node --test tests/*.test.mjs→ 202/202npm run build,npm run check-version→ clean🤖 Generated with Claude Code
https://claude.ai/code/session_01JzU4DsG3egAWsF9NR7d3cm