My Account Log in

1 option

Agentic Coding with OpenAI Codex CLI : Build Intelligent Agent Workflows Using Agentic Engineering, MCP, Hooks, and Delivery Automation.

O'Reilly Online Learning: Academic/Public Library Edition Available online

View online
Format:
Book
Author/Creator:
Vaughan, Daniel.
Language:
English
Subjects (All):
Artificial intelligence.
Software engineering.
Physical Description:
1 online resource (670 pages)
Edition:
1st ed.
Place of Publication:
Birmingham : Packt Publishing, Limited, 2026.
Summary:
Comprehensive guide to Codex CLI: prompting, AGENTS.md, MCP, hooks, skills, sub-agents, orchestration, CI/CD, security, and enterprise deployment, with exercises Key Features Move from first principles to production workflows and team-scale agentic practice.
Contents:
Cover
Title Page
Copyright
Contributors
Table of Contents
Preface
Part 1: Grounding
Chapter 1: What Is Codex CLI?
Learning Objectives
Before Codex: A Brief History
The Codex model (2021)
GitHub Copilot and the autocomplete paradigm (June 2021)
The ChatGPT shift (November 2022)
The Problem with Autocomplete
The Agentic Landscape
Category 1: IDE-integrated agents
Category 2: Terminal agents
Category 3: Cloud and hosted agents
Where they all stand
Defining Codex CLI
Terminal-first
Headless and scriptable
Sandboxed at the kernel layer
AGENTS.md-aware
Open source under Apache 2.0
Why the Terminal Matters
Composability with Unix tools
CI/CD integration without ceremony
No GUI required
The Core Proposition
Reads the whole repository
Runs your tests
Makes commits
Follows AGENTS.md
Summary
Exercises
Chapter 2: Getting Started with Codex CLI
What a First Session Looks Like
The Bigger Picture: Four Surfaces, One Agent
Prerequisites
Installation
npm (recommended)
Homebrew (macOS and Linux)
Direct binary download
Verifying the installation
Shell completions
Authentication
Path 1: ChatGPT subscription (device-code flow)
Path 2: API key
Path 3: Enterprise configuration
Your First Session
Three Week-One Mistakes
codex vs. codex exec
Where Configuration Lives
AGENTS.md in one minute
Where this leaves you
Chapter 3: Prompting Codex CLI Effectively
Why Codex CLI Prompting Is Different
The cost of a vague run
The Anatomy of an Effective Prompt
Reasoning Effort
Plan mode
PLANS.md for multi-hour tasks
The checkpoint pattern
Iterative Prompting and Mid-Session Corrections
Prompt Patterns for Common Tasks.
Bug fixes
Refactoring
Parallelisable work
Documentation Generation
Code documentation
Architecture Decision Records
README and onboarding documentation
Documentation freshness as a CI task
Moving Durable Context Out of Prompts
AGENTS.md
Custom instructions via profiles
Output Control: Shaping How the Agent Communicates
Verbosity
Reasoning Summaries
Token Budget Awareness
Configuration Profiles for Common Workflows
Metaprompting: Using the Agent to Improve Its Own Instructions
Official Workflow Recipes: Eight Canonical Patterns
Chapter 4: AGENTS.md: Patterns and Pitfalls
What AGENTS.md Is and How Codex CLI Reads It
The discovery chain
What the file looks like
Thinking in tiers: constitution, specialist, skill
Essential Sections: Commits, Testing, Style
Commands
Commit conventions
Constraints and off-limits areas
AGENTS.md for Monorepos and Multi-Service Repos
Recommended structure
The AGENTS.md length limit
Override files for CI/CD pipelines
Common Mistakes
Diagnostics: when rules don't apply
How files grow without bound
A pruning checklist
Inclusion tests: four checks before adding anything
The File Map Pattern
Production Patterns: The openai/codex Case Study
Beyond AGENTS.md: Extending the Pattern
Part 2: Guardrails
Chapter 5: Approval Modes and Trust Boundaries
The Trust Model: What Codex CLI Can Touch
The Three Approval Modes
Untrusted: maximum caution
On-request: the practical default
Never: fully automated pipelines
When never makes sense, and when it does not
The industry pressure to skip review
Sandboxing: Filesystem and Network Restrictions
Configuring the sandbox in config.toml.
Network access and web search
The composite shortcut flag
Kernel-Level Sandboxing
macOS: Seatbelt
Linux: bubblewrap and seccomp
Windows: restricted tokens and ACLs
Named Profiles
The TUI permission picker
Built-in profiles
Profile inheritance
Granular approval categories
The Permission Ladder
Each command is approved on its own
Chapter 6: Model Selection and Reasoning Effort
Model Roles, Not Model Names
Capability and cost are not perfectly correlated
Quick reasoning controls
The Model Routing Decision Framework
The cost of wrong routing
Multi-Model Workflows
The orchestrator-worker pattern
Session-phase routing
Cloud and Local Model Providers
Cloud providers
Local model providers
Multi-Provider Resilience
Built-in retry and backoff
Profile-based provider switching
AI gateway proxies
Monitoring Model Deprecations
Chapter 7: Context Window Management
The Quadratic Growth Problem
Thread Resume and Fork: Preserving Context Without Restarting
What Consumes Context (and What Doesn't)
Customising the system prompt
The /compact Command and Automatic Summarisation
L1-Bullet Lifecycle Hooks: Automated Context Preservation
Background prefix compaction
Sub-Agent Delegation as Context Management
Strategies for Large Codebases
Monitoring Context Usage
How L1-Bulletion Actually Works
Plan Mode and Fresh-Context Implementation
Prompt Caching: Economics of Long Sessions
Structured Prompting for Maximum Cache Hits
Persistent Context: The Two-Phase Memory Pipeline
MCP Memory Servers: Persistent Cross-Session Context.
Team Memory: The Gap Beyond Individual Recall
Context Failure Modes: A Taxonomy
1. Context Poisoning
2. Context Distraction
3. Context Confusion
4. Context Clash
The tool paradox as a context management finding
Finding Past Sessions
Chapter 8: MCP: Consuming and Serving
MCP in 60 Seconds
What MCP Is (and What It Is Not)
The Architecture: Hosts, Clients and Servers
Tool Annotations: Risk Vocabulary
Connecting to Common Servers
GitHub
Documentation lookup with Context7
Browser automation with Playwright
Database access
The Context Cost of MCP
Enterprise MCP: Authentication, Scoping and Restrictions
Building a Simple MCP Server
Testing MCP servers
Codex CLI on Both Sides of MCP
Running MCP in Production
Write-back safety
Resilience to failure
Remote and containerised servers
Debugging when things break
Chapter 9: Hooks: Intercepting the Agent Lifecycle
The Hook System: Overview and Events
Inline configuration in config.toml
MCP and apply_patch observation
Lifecycle Events
SessionStart: Configuring the Environment
UserPromptSubmit: Shaping Input Before the Agent Acts
PreToolUse: Intercepting Shell Commands
PermissionRequest: Programmable Approval
PostToolUse: Observing Without Blocking
PreL1-Bullet and PostL1-Bullet: Context L1-Bulletion Hooks
SubagentStart and SubagentStop: Subagent Boundary Hooks
Stop: Teardown and Cleanup
Writing Robust Hooks
Patterns: Enforcement, Audit, and Notification
Style checks on every prompt
Secret scanner on every file write
MITM detection on network operations
Audit log
Slack notification on session end.
Enterprise lifecycle governance with PreToolUse and PostToolUse
Self-evolving agent retraining loop
Tooling
The /hooks browser
OpenTelemetry metrics for hook runs
Plugin-bundled hooks
Delegated patch approval rendering
Part 3: Scaling Up
Chapter 10: The Skills Ecosystem: Using and Writing Skills
The Consumer's View: Using and Browsing the Ecosystem
What skills are and how they work
The agentskills.io standard
Catalogues and installation
Installing, managing, and versioning skills
Choosing the right primitive
The Producer's View: Writing Your Own Skills
The SKILL.md format
The three-tier loading model
Writing the description field
The agents/openai.yaml file: policy and MCP dependencies
Building and publishing a skill
Sizing the skill: the five-tier spectrum
Authoring workflow: build manually, then encode
Evaluating skills
Plugins: Packaging and Distribution
Plugin architecture
Marketplace discovery and distribution
Installation policies and enterprise governance
Install and remove lifecycle via app-server RPC
Reusable workflow patterns: composing skills and plugins
Extension-first architecture
Case studies
Nx monorepo agent skills
codex-pr-body: the first official OpenAI team-authored project skill
aigorahub/elves: a meta-skill that orchestrates workflows
Google Agent Skills: platform-maintained knowledge packages
Chapter 11: Sub-Agents and Parallel Execution
The Sub-Agent Model
Built-in agents
Switching between threads
Custom agent definitions
Picking a model for a sub-agent
Session-wide limits
Task Decomposition
What to parallelise
When not to parallelise
CSV Fan-Out
spawn_agents_on_csv.
Reporting results.
Notes:
Description based on publisher supplied metadata and other sources.
Part of the metadata in this record was created by AI, based on the text of the resource.
Other Format:
Print version: Vaughan, Daniel Agentic Coding with OpenAI Codex CLI
ISBN:
9781808348884
OCLC:
1609713027

The Penn Libraries is committed to describing library materials using current, accurate, and responsible language. If you discover outdated or inaccurate language, please fill out this feedback form to report it and suggest alternative language.

Find

Home Release notes

My Account

Shelf Request an item Bookmarks Fines and fees Settings

Guides

Using the Find catalog Using Articles+ Using your account