Detect, configure, and extend 14 AI coding agents (Claude Code, Codex, Cursor, Copilot, etc.) from your Go tools.
# AgentX
Part of the **Agent Experience (AX)** toolchain by [SageOx](https://sageox.ai) — a new category of developer tooling that optimizes CLIs for AI coding agents, not just humans.
**Build agent-aware CLI tools that know which AI coding assistant is calling them.**
AgentX detects whether your tool is running inside Claude Code, Cursor, Aider, or 14 other coding agents - and gives you access to their configuration, context files, capabilities, and extension management.
## Why AX?
AI coding agents are the new users of your CLI. **Agent Experience (AX)** is the practice of designing tools that work well for both humans and agents — not just tolerating agent usage, but actively optimizing for it.
AgentX gives your CLI the primitives it needs:
- **Which agent is calling**: Tailor output format, verbosity, or behavior per agent
- **Where agent config lives**: Read/write to `~/.cursor`, `~/.cursor`, etc.
- **What context files exist**: Find `CLAUDE.md`, `.cursorrules`, and similar files
- **How to propagate context**: Set `AGENT_ENV` so downstream tools know too
```go
package main
import (
"fmt"
"github.com/sageox/agentx/pkg"
)
func main() {
// Detect agent and set AGENT_ENV for child processes
agent := agentx.Init()
if agent != nil {
fmt.Printf("Running in %s\n", agent.Name())
fmt.Printf("Config: %s\n", must(agent.UserConfigPath(agentx.NewSystemEnvironment())))
fmt.Printf("Context files: %v\n", agent.ContextFiles())
}
}
```
## Key Features
### 1. Automatic Agent Detection
Detects 14 coding agents via environment variables and heuristics:
```go
agent := agentx.Detect()
if agent != nil {
switch agent.Type() {
case agentx.AgentTypeClaudeCode:
// Claude Code specific behavior
case agentx.AgentTypeCursor:
// Cursor specific behavior
}
}
```
### 2. AGENT_ENV Propagation
`Init()` detects the agent and sets `AGENT_ENV` in the process environment. This lets downstream code and chiAgent that generates comprehensive documentation, API references, architecture diagrams, and developer onboarding guides from existing code.
Agent configuration for systematic bug investigation that traces issues from error logs through the codebase to root cause with suggested fixes.
Agent for integrating third-party APIs including SDK setup, type generation, error handling, retry logic, and rate limit management.
Cursor's built-in autonomous coding agent that can make multi-file edits, run terminal commands, search the codebase, and iteratively build features with minimal human intervention.
Cloud-based autonomous coding agent that runs in the background on remote sandboxed environments, handling complex multi-step tasks while you continue working.
Cursor's multi-file editing agent within Composer mode that can create, edit, and delete files across your entire project in a single conversation.