Skip to content

feat: /codex:init-policy generates a starting execution policy - #3

Merged
aksOps merged 1 commit into
mainfrom
feat/policy-init
Jul 27, 2026
Merged

feat: /codex:init-policy generates a starting execution policy#3
aksOps merged 1 commit into
mainfrom
feat/policy-init

Conversation

@aksOps

@aksOps aksOps commented Jul 27, 2026

Copy link
Copy Markdown
Owner

Summary

Answers "can the policy be generated automatically?" — yes, per repo, without weakening fail-closed.

  • New companion subcommand init-policy + /codex:init-policy command.
  • Detects layout (top-level source/test directories, root code files) and toolchain (npm/pnpm/yarn/bun test script, go.mod, Cargo.toml, pytest markers, Makefile test target).
  • Emits the standard five-agent policy: explore/verify read; implement/rescue writable over detected source globs; test agent scoped to test dirs + ecosystem test-file patterns.
  • Safety invariants: refuses overwrite without --force; round-trips its own output through the runtime's fail-closed loadPolicy and deletes it on failure; always allowAutoLand: false; committing the file stays the human opt-in.
  • Version 2.1.0, changelog entry, 7 new tests (202 total passing).

Verification

  • node --test tests/*.test.mjs → 202/202
  • npm run build, npm run check-version → clean

🤖 Generated with Claude Code

https://claude.ai/code/session_01JzU4DsG3egAWsF9NR7d3cm

/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.
@aksOps
aksOps marked this pull request as ready for review July 27, 2026 07:00
@aksOps
aksOps merged commit 30e9244 into main Jul 27, 2026
1 check passed
@aksOps
aksOps deleted the feat/policy-init branch July 27, 2026 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant