From htmlgraph
> **DEPRECATED:** This skill is replaced by the `codex-operator` agent.
npx claudepluginhub shakestzd/htmlgraphThis skill uses the workspace's default tool permissions.
> **DEPRECATED:** This skill is replaced by the `codex-operator` agent.
Provides Ktor server patterns for routing DSL, plugins (auth, CORS, serialization), Koin DI, WebSockets, services, and testApplication testing.
Conducts multi-source web research with firecrawl and exa MCPs: searches, scrapes pages, synthesizes cited reports. For deep dives, competitive analysis, tech evaluations, or due diligence.
Provides demand forecasting, safety stock optimization, replenishment planning, and promotional lift estimation for multi-location retailers managing 300-800 SKUs.
DEPRECATED: This skill is replaced by the
codex-operatoragent. UseAgent(subagent_type="htmlgraph:codex-operator", prompt="...")instead. The codex-operator agent tries Codex CLI first with structured JSON output and hook-based compliance.
name: codex description: CodexSpawner with full event tracking for code generation and implementation when_to_use:
⚠️ IMPORTANT: This skill teaches TWO EXECUTION PATTERNS
Choose based on your needs. See "EXECUTION PATTERNS" below.
| Pattern | Use Case | Tracking | Complexity |
|---|---|---|---|
| Task(general-purpose) | Code generation, implementation, debugging | ✅ Yes (via Task) | Low (1-2 lines) |
| CodexSpawner | Need precise Codex control + full subprocess tracking | ✅ Yes (full parent context) | Medium (setup required) |
CodexSpawner is the HtmlGraph-integrated way to invoke OpenAI Codex CLI with full parent event context and subprocess tracking.
Key distinction: CodexSpawner is invoked directly via Python SDK - NOT wrapped in Task(). Task() is only for Claude subagents (Haiku, Sonnet, Opus).
CodexSpawner:
Use Task(general-purpose) (simple, recommended):
# Delegate to Claude for code generation
Task(subagent_type="general-purpose",
prompt="Implement JWT authentication middleware with tests")
# Task() delegates to Claude - handles everything automatically
Use CodexSpawner (direct Python invocation - advanced):
# Direct Codex CLI invocation with full tracking
spawner = CodexSpawner()
result = spawner.spawn(
prompt="Generate auth middleware",
sandbox="workspace-write",
output_json=True,
track_in_htmlgraph=True,
tracker=tracker,
parent_event_id=parent_event_id
)
# NOT Task(CodexSpawner) - invoke directly!
Use the htmlgraph:codex-operator agent — it tries Codex CLI first, then falls back to direct Claude code generation:
# PRIMARY: Delegate to codex-operator agent
Task(
subagent_type="htmlgraph:codex-operator",
prompt="Generate Python code example for using CopilotSpawner",
)
| Parameter | Type | Required | Description |
|---|---|---|---|
prompt | str | ✅ | Code generation task for Codex |
sandbox | str | ❌ | Sandbox mode: "workspace-write", "workspace-read", etc. |
output_json | bool | ❌ | Return structured JSON output (default: False) |
full_auto | bool | ❌ | Enable full-auto headless mode (default: False) |
track_in_htmlgraph | bool | ❌ | Enable SDK activity tracking (default: True) |
tracker | SpawnerEventTracker | ❌ | Tracker instance for subprocess events |
parent_event_id | str | ❌ | Parent event ID for event hierarchy |
timeout | int | ❌ | Max seconds to wait (default: 120) |
Task(
subagent_type="htmlgraph:codex-operator",
prompt="""Generate a Python code example showing how to:
1. Create a CopilotSpawner instance
2. Set up parent event context in database
3. Invoke it with parent event linking
4. Track the execution with SpawnerEventTracker
5. Handle the AIResult
Use real example from HtmlGraph project and show best practices."""
)
The htmlgraph:codex-operator agent handles the fallback automatically:
No manual fallback code needed — just delegate to the agent.
Why fallback to Task()?
Pattern Summary:
Use OpenAI Codex (GPT-4 Turbo) for code generation and implementation in sandboxed environments.
CRITICAL DISTINCTION:
| What | Description |
|---|---|
| This Skill | Documentation teaching HOW to use CodexSpawner |
| CodexSpawner | Direct Codex CLI invocation with full tracking (advanced) |
| Task() Tool | Delegation to Claude subagents ONLY (Haiku, Sonnet, Opus) |
| Bash Tool | Direct CLI invocation without HtmlGraph tracking |
Workflow:
Task(subagent_type="general-purpose") (recommended)⚠️ To actually generate code, use these approaches:
# Use Claude for code generation (native approach)
Task(
subagent_type="general-purpose",
prompt="Generate API endpoint for user authentication with JWT tokens and full tests"
)
# For complex implementations
Task(
subagent_type="general-purpose",
model="sonnet", # or "opus" for complex work
prompt="Refactor authentication system to support multi-tenancy across 15+ files"
)
# If you have codex CLI installed on your system
codex generate "Create FastAPI endpoint with authentication"
The codex CLI must be installed:
# Install Codex CLI
npm install -g @openai/codex-cli
# Or via pip
pip install openai-codex-cli
# Verify installation
codex --version
PRIMARY: Use Skill() to invoke (tries external CLI first):
# Recommended approach - uses external codex CLI via agent spawner
Skill(skill=".claude-plugin:codex", args="Generate API endpoint for user authentication with full tests")
What happens internally:
codex CLI is installed on your systemcodex generate "API endpoint with tests"Task(subagent_type="general-purpose", prompt="Generate API endpoint")FALLBACK: Direct Task() invocation (when Skill unavailable):
# Manual fallback - uses Claude's general-purpose agent
Task(
subagent_type="general-purpose",
prompt="Generate API endpoint for user authentication with full tests",
model="haiku" # Optional: specify model
)
Note: Direct Codex spawning requires the CLI. If unavailable, Claude can implement the code directly.
Codex provides three security levels:
# Analysis without modifications
Task(
subagent_type="general-purpose",
prompt="Analyze code structure without making changes"
)
# Generate and write code to workspace
Task(
subagent_type="general-purpose",
prompt="Generate new feature implementation with tests"
)
# System-wide operations (dangerous)
Task(
subagent_type="general-purpose",
prompt="System configuration changes (requires full access)"
)
Task(
subagent_type="general-purpose",
prompt="""
Generate FastAPI endpoint for user authentication:
- POST /auth/login
- JWT token generation
- Input validation with Pydantic
- Error handling
- Unit tests with pytest
"""
)
# Generate JSON matching a schema
Task(
subagent_type="general-purpose",
prompt="""
Extract all functions and classes from src/:
Output format:
{
"functions": [{"name": "...", "file": "...", "line": ...}],
"classes": [{"name": "...", "file": "...", "methods": [...]}]
}
"""
)
# Analyze multiple files
Task(
subagent_type="general-purpose",
prompt="Review all Python files in src/ for code quality issues and security vulnerabilities"
)
# Generate comprehensive tests
Task(
subagent_type="general-purpose",
prompt="""
Generate pytest tests for UserService class:
- Test all public methods
- Include edge cases
- Mock external dependencies
- Aim for 90%+ coverage
"""
)
Use Codex when:
Use Claude when:
If you see this error:
ERROR: codex CLI not found
Install from: npm install -g @openai/codex-cli
Options:
Timeout Errors:
Error: Timed out after 120 seconds
Solution: Split into smaller tasks or increase timeout
Approval Failures:
Error: Command requires approval
Solution: Adjust approval settings or sandbox mode
Sandbox Restrictions:
Error: Operation not allowed in sandbox
Solution: Upgrade sandbox level or redesign approach
# Auto-execute generated code
Task(
subagent_type="general-purpose",
prompt="Fix linting errors and run tests automatically"
)
# Include images for context
Task(
subagent_type="general-purpose",
prompt="Convert this UI mockup to React code (see attached image)"
)
Track code generation in features:
# Create feature for implementation
htmlgraph feature create "User Authentication API"
htmlgraph feature start <feat-id>
# Note: Generated via Codex — API endpoints, input validation, JWT tokens, unit tests
Avoid Codex for:
The skill implements a multi-level fallback strategy:
Skill(skill=".claude-plugin:codex", args="Generate authentication API")
# Attempts to use external codex CLI via agent spawner SDK
# If codex CLI not found, automatically falls back to:
Task(subagent_type="general-purpose", prompt="Generate authentication API")
# Uses Claude for code generation
# If Task() fails:
# - Returns error message to orchestrator
# - Orchestrator can retry with different approach
# - Or escalate to user for guidance
Error Handling:
/gemini - For exploration before implementation/copilot - For GitHub integration after generation/code-quality - For validating generated code/debugging-workflow - For fixing issues in generated code