Expand description
CodexSurface — klasp_core::AgentSurface impl for Codex.
Mirrors the install flow of [klasp_agents_claude::ClaudeCodeSurface]:
compute paths → render the managed-block bodies → idempotent
merge / replace into the on-disk files → atomic write → report what
changed. The two surfaces differ in their target files (Claude writes
one bash shim and one JSON settings file; Codex writes AGENTS.md and
a pair of git hooks) and in their conflict-handling story: Codex has
to coexist with husky / lefthook / pre-commit framework, so the hook
writer skips-with-warning rather than failing the install.
§v0.2 W2 scope
installwrites the AGENTS.md managed block (W1 behaviour) and the.git/hooks/pre-commit+.git/hooks/pre-pushhook files.- When a foreign hook manager is detected via
git_hooks::detect_conflict, the hook write is skipped and aHookWarningrides alongside theInstallReport(returned via the typedCodexSurface::install_detailedentry-point — the plainAgentSurface::installtrait method, which W3 will wire into the CLI, discards warnings to keep the cross-crate contractklasp-coredefines unchanged). uninstallstrips the managed block from each managed file and removes any file klasp owned end-to-end (round-trip from the missing-file install). Sibling content — both other tools’ hooks and any prose in AGENTS.md — is preserved byte-for-byte.
§Windows notes
AGENTS.md is plain text. .git/hooks/pre-commit and pre-push are
shell scripts that git itself executes through sh.exe (Git for
Windows) or whatever the user’s git is configured to use; they need
a shebang for portability but no executable bit on NTFS. Behaviour
parity with klasp_agents_claude — apply_mode is a no-op there too.
Structs§
- Codex
Install Report - Result of a
CodexSurface::install_detailedcall. Bundles the standardInstallReportwith the per-hook warnings collected during install. - Codex
Surface - Codex agent surface. Stateless; the registry stores it as
Box<dyn AgentSurface>.