Codex-native operating layer for agent-ready repositories, with an optional Claude Code adapter.
Agent Spine gives a repository one canonical AGENTS.md, a native .codex/ control plane, reusable .agents/skills/, and optional adapters for tools like Claude Code that do not own the core contract.
Maintained by @netskydevel.
AGENTS.mdas the repo-wide instruction contract- a documented target surface for
.codex/and.agents/skills/ - project-scoped Codex defaults in
.codex/config.toml, native subagent definitions in.codex/agents/, and deterministic lifecycle hooks in.codex/hooks.json - a cognitive operating system for R&D and production agent workflows
- quality metrics for evaluating whether agent work is inspectable, verified, and safe
- shared-brain docs for architecture, rollout, migrations, and release gates
- Claude Code compatibility through optional
.claude/settings, hooks, auth helpers, and agent examples behind a clear adapter boundary - example adaptation notes for Python, Node.js/TypeScript, monorepos, and fullstack products
Read these files in order when working on the template itself:
AGENTS.mdROADMAP.mdARCHITECTURE.mddocs/GETTING_STARTED.mddocs/TEMPLATE_CONTRACT.mddocs/COGNITIVE_OPERATING_SYSTEM.mddocs/QUALITY_MODEL.md
These files define the contract. Other docs should defer to them.
The intended long-term surface of the template is:
AGENTS.md Canonical operational rules
ARCHITECTURE.md Target system layout and boundaries
ROADMAP.md Rollout phases and migration sequencing
.codex/ Native Codex config, hooks, and subagents
.agents/skills/ Reusable skills and shared-brain workflows
docs/COGNITIVE_OPERATING_SYSTEM.md
R&D and production operating model
docs/QUALITY_MODEL.md Agent quality metrics
.claude/ Optional Claude adapter
CLAUDE.md Optional Claude shim
- Copy this template into a new repository.
- Run
./scripts/bootstrap-template.sh <project-name> <python|node-typescript|monorepo|fullstack-product> [keep-claude|drop-claude]. - Edit
AGENTS.mdso the rules match your real engineering workflow. - Review
ROADMAP.mdandARCHITECTURE.md, then remove template-only phases you do not need. - Run
./scripts/verify-template.sh --fast. - Run
./scripts/verify-template.sh --fullbefore publishing template changes.
This repository now reflects the post-migration Codex-native contract:
AGENTS.md,ROADMAP.md,ARCHITECTURE.md, anddocs/TEMPLATE_CONTRACT.mddefine the true contract.codex/config.toml,.codex/agents/, and.codex/hooks.jsonare the committed Codex-native config surface that Codex loads after the repository is trusted.claude/remains an optional adapter example.codex/hooks/contains repo-local safety, audit, and prompt-context scripts wired throughhooks.json.codex/agents/contains the native reviewer, coordinator, test-writer, and security-auditor role configs that replaced the earlier legacy role briefs.agents/skills/contains reusable task-kickoff, handoff, review-request, research-brief, decision-record, production-change, and incident-analysis workflowsdocs/COGNITIVE_OPERATING_SYSTEM.md,docs/QUALITY_MODEL.md, anddocs/DEMO.mdexplain how the template should behave in real R&D and production sessions
Use the roadmap and shared-brain docs rather than historical directory names to understand where the template is going.
Use .agents/skills/ for reusable workflows and promptable operating patterns that any agent may invoke on demand.
Use .codex/agents/ for bounded execution roles with their own model, sandbox, and responsibility defaults.
In this template:
- task kickoff, handoff, review-request, research-brief, decision-record, production-change, and incident-analysis patterns are skills because they are workflow scaffolds, not long-lived agents
- reviewer, coordinator, test-writer, and security-auditor stay in
.codex/agents/because they define execution posture for delegated work
Use R&D mode when the answer is uncertain and the useful output is evidence, confidence, and the next experiment.
Use production mode when durable behavior changes and the useful output is a narrow diff, verification, rollout clarity, rollback clarity, and residual risk.
The operating model is documented in docs/COGNITIVE_OPERATING_SYSTEM.md. The measurement model is documented in docs/QUALITY_MODEL.md.
Compatibility boundaries are documented in docs/COMPATIBILITY_MATRIX.md.
A good agent session should leave more than a diff:
- clear task framing
- evidence from inspected repository files
- narrow implementation scope
- focused verification
- review or risk notes when needed
- a handoff or durable artifact for the next worker
Agent Spine makes those outputs part of the repository contract instead of relying on memory or chat history.
The native .codex/ layer is intentionally explicit and reviewable:
.codex/config.tomlsets a project-scopeduntrustedapproval posture,workspace-writesandboxing, enables Codex hooks, and registers native subagent roles.codex/agents/stores the role-specific TOML config layers for the reviewer, coordinator, test writer, and security auditor subagents- Codex only applies repo-local
.codex/overrides after the repository is trusted, so the committed files are visible and reviewable without depending on hidden local state .codex/hooks.jsonwires repo-local scripts from the git root so hooks still resolve when Codex starts in a subdirectory.codex/hooks/pre_tool_use_policy.pyblocks dangerous shell commands and access to.env, credential files, private keys, andsecrets/.codex/hooks/post_tool_use_audit.pyand.codex/hooks/stop_audit.pyappend JSONL audit records under ignored.codex/logs/.codex/hooks/user_prompt_submit_context.pyinjects the same minimal project context that the Claude adapter previously added
This is the security-sensitive native automation surface for the template. If a repo-wide safety rule matters across agents, document it in the shared brain and enforce it from .codex/ first.
Agent Spine includes an optional Claude Code adapter for teams that use both Codex and Claude Code.
The .claude/ directory is intentionally optional and downstream of the canonical contract.
CLAUDE.mdshould stay short and defer toAGENTS.md.claude/settings.jsonshould hold Claude-specific policy and hook wiring only- existing auth remains valid for the adapter, including a normal
claudelogin orANTHROPIC_API_KEY .claude/settings.local.jsonshould remain uncommitted, machine-specific, and only add optional local overrides such asapiKeyHelperapiKeyHelperis supported through the local example and wrapper scripts, but it is not mandatory for Claude usage in this repo- Claude agents and hooks should mirror the canonical contract instead of redefining it
- deleting
.claude/andCLAUDE.mdmust leave the Codex-native core intact
Run:
./scripts/verify-template.sh
./scripts/smoke-test-bootstrap.shThe verification layer currently checks:
- required template files exist
.codex/config.tomland.codex/hooks.jsonparse and contain the expected Codex-native keys- the configured Codex hooks are regression-tested, including pre-tool secret blocking, user-prompt context injection, and audit-only post-tool and stop flows
- the native
.agents/skills/files exist, include validnameanddescriptionfrontmatter, and keep directory names aligned with discoverable skill names - the required R&D and production operating docs are present
- optional Claude adapter files and local-auth helper scripts are complete if present, while machine-login auth remains valid without helper-only configuration
- committed docs do not contain repo-local absolute paths
- shell scripts are executable
- representative bootstrap scenarios still pass verification
CI runs the same checks through .github/workflows/verify-template.yml.
- use
CHANGELOG.mdfor notable template changes - use
docs/MIGRATIONS.mdwhen downstream repos need manual updates - use
docs/ADOPTION_CHECKLIST.mdanddocs/MIGRATION_PLAYBOOK.mdfor downstream rollout - use
docs/TEMPLATE_CONTRACT.mdwhen the canonical surface or adapter boundary changes - use
SECURITY.mdfor security handling expectations
If you evolve the template itself, follow CONTRIBUTING.md and keep structural changes aligned with scripts/verify-template.sh. Update ROADMAP.md, ARCHITECTURE.md, and the contract doc when the shared brain changes.