x agent
Integrate x-cmd into Claude, Codex, Cursor, Opencode, Kimi and other AI tools, manage ~/AGENTS.md and configs
TIP
Besides using x agent setup, you can also manually add the following prompt to your AGENT file.
Load x-cmd with . ~/.x-cmd.root/X (required before using x), then x -h for help. Docs: https://x-cmd.com/llms.txt Harness: AI tool interface (kimi-cli, claude, codex, cursor, gemini-cli, opencode)
Agent 000/001: Two independent AI Agent configuration identities
Examples
Example: Configure AI tools to use x-cmd
x agent setupExample: Merge config files from AI tools
x agent unifyExample: Interactively select AI tools
x agent initExample: Set temporarily (current session only)
x agent --cur set zero_harness=kimi-cliExample: Send a single-turn AI request (explain this code) and get instant reply
x agent request "Explain this code"Example: Run long task asynchronously in background, save result to file
x agent requestasync --stdout-file result.md "Long running task"Example: Create a new task (add unit tests and set up CI), AI clarifies requirements via chat and generates TODO.md
x agent job init "Add unit tests with Jest and set up GitHub Actions CI"Sub Commands
| Name | Description |
|---|---|
| x agent request | Non-interactive single-shot AI Agent invocation - send prompt and get response |
| x agent job | Manage long-term interactive tasks (create, iterate, adjust requirements) |
| x agent setup | Enable mainstream AI tools to use x-cmd prompts and skills |
| x agent unify | Merge AI tool config files into ~/AGENTS.md and create symlinks |
| x agent --cfg | Persistent configuration (saved to config file, cross-session) |
| x agent --cur | Temporary configuration (current shell session only) |
| x agent init | Interactive initialization (select and set zero_harness, one_harness) |
x agent setup
Enable mainstream AI tools to use x-cmd prompts and skills
INFO
- Create ~/AGENTS.md (if not exists)
- Install x-cmd skills to ~/.agents, ~/.claude, ~/.codex, ~/.gemini, ~/.config/opencode
- Usage:
x agent setupx agent unify
Merge AI tool config files into ~/AGENTS.md and create symlinks
INFO
Processes config files:
Merge ~/CLAUDE.md, ~/.gemini/GEMINI.md, ~/.codex/AGENTS.md,
~/.config/opencode/AGENTS.md into ~/AGENTS.md
Delete originals, create symlinks to ~/AGENTS.md
Identical content files are replaced directly without merging
- Usage:
x agent unifyx agent request
Non-interactive single-shot AI Agent invocation - send prompt and get response
- Examples:
Example: Send a single-turn AI request (explain this code) and get instant reply
x agent request "Explain this code"Example: Choose a specific AI harness and attach a file before sending
x agent request --harness claude --file main.py "Review this code"Example: Attach multiple files and ask AI to compare them
x agent request -f file1.py -f file2.py "Compare these files"Example: Send a request and save the AI reply to a file
x agent request --output result.md "Generate documentation"Example: Get a structured JSON response
x agent request --json "List all functions"- Usage:
x agent request [OPTIONS] [FLAGS] <#n>- Arguments:
| Argument | Description |
|---|---|
#n | Prompt content |
- Options:
| Name, Shorthand | Default | Description |
|---|---|---|
--harness | Specify AI tool interface | |
-f, --file | File to attach to prompt | |
-o, --output | Output file path | |
--session | Specify session ID to resume previous conversation (UUID format) | |
--workspace | Specify working directory to enable memory files and state management |
- Flags:
| Name, Shorthand | Description |
|---|---|
--overwrite | Force overwrite existing file without backup (use with --output) |
--json | Output in JSON format |
--pipe | Read content from stdin to append to prompt |
x agent --cfg
Persistent configuration (saved to config file, cross-session)
INFO
zero_harness: Default AI tool for Agent 000
one_harness: Default AI tool for Agent 001
Available: kimi-cli, claude, codex, cursor, gemini-cli, opencode
- Examples:
Example: Set default harness for both Agents
x agent --cfg zero_harness=kimi-cli one_harness=claudeExample: View current saved configuration
x agent --cfg catExample: Clear all configuration to defaults
x agent --cfg clear- Usage:
x agent --cfg [SUB_COMMAND] <#n>- Arguments:
| Argument | Description |
|---|---|
#n | zero_harness= | one_harness= |
- Sub Commands:
| Name | Description |
|---|---|
| x agent --cfg clear | Clear all saved configuration (restore defaults) |
| x agent --cfg cat | Display current configuration values |
x agent --cfg clear
Clear all saved configuration (restore defaults)
- Usage:
x agent --cfg clearx agent --cfg cat
Display current configuration values
- Usage:
x agent --cfg catx agent --cur
Temporary configuration (current shell session only)
INFO
zero_harness: Temporary AI tool for Agent 000
one_harness: Temporary AI tool for Agent 001
Overrides --cfg for current session only
- Sub Commands:
| Name | Description |
|---|---|
| x agent --cur set | Set temporary configuration values |
x agent --cur set
Set temporary configuration values
- Usage:
x agent --cur set [SUB_COMMAND] <#n>- Arguments:
| Argument | Description |
|---|---|
#n | zero_harness= | one_harness= |
- Sub Commands:
| Name | Description |
|---|---|
| x agent --cur set zero_harness= | Temporary harness for Agent 000 |
| x agent --cur set one_harness= | Temporary harness for Agent 001 |
x agent --cur set zero_harness=
Temporary harness for Agent 000
- Usage:
x agent --cur set zero_harness=x agent --cur set one_harness=
Temporary harness for Agent 001
- Usage:
x agent --cur set one_harness=x agent init
Interactive initialization (select and set zero_harness, one_harness)
- Usage:
x agent initx agent job
Manage long-term interactive tasks (create, iterate, adjust requirements)
- Examples:
Example: Create a new task (add unit tests and set up CI), AI clarifies requirements via chat and generates TODO.md
x agent job init "Add unit tests with Jest and set up GitHub Actions CI"Example: Resume the most recent task, AI auto-iterates through TODO
x agent job iterExample: Adjust the most recent task requirements (add more test cases), AI updates TODO.md
x agent job adjust "Add more test cases"Example: List all tasks
x agent job ls- Sub Commands:
| Name | Description |
|---|---|
| x agent job init | Create a new long-term task, AI clarifies requirements via interactive chat and generates TODO.md |
| x agent job iter | Iterate task execution, AI auto-loops through TODO until complete or max iterations reached |
| x agent job adjust | Adjust task requirements, AI updates TODO.md via interactive chat |
| x agent job ls | List all tasks |
x agent job init
Create a new long-term task, AI clarifies requirements via interactive chat and generates TODO.md
- Examples:
Example: Create a new task (add unit tests and set up CI), AI clarifies requirements via chat and generates TODO.md
x agent job init "Add unit tests with Jest and set up GitHub Actions CI"Example: Create a complex feature development (implement OAuth2 multi-provider login), broken into multiple sub-tasks
x agent job init "Implement OAuth2 login with Google and GitHub providers, including token refresh"Example: Create a task in a specific parent directory (fix memory leak)
x agent job init --dir ~/tasks "Fix memory leak"Example: Create a design task with a specific AI harness (design a Docker CLI tool with autocomplete)
x agent job init --harness claude "Design a CLI tool for managing Docker containers with autocomplete support"- Usage:
x agent job init [OPTIONS] <#1>- Arguments:
| Argument | Description |
|---|---|
#1 | Task description |
- Options:
| Name, Shorthand | Default | Description |
|---|---|---|
--harness | Specify AI tool interface | |
--dir | Specify parent directory for jobs (job will be created under this directory) |
x agent job iter
Iterate task execution, AI auto-loops through TODO until complete or max iterations reached
- Examples:
Example: Resume the most recent task, AI auto-iterates through TODO
x agent job iterExample: Resume the most recent task in a specific directory
x agent job iter --dir ~/tasks/myjobExample: Resume task with specific ID
x agent job iter --id 260413_112030Example: Resume specific task in specific directory
x agent job iter --dir ~/tasks/myjob --id 260413_112030Example: Resume task with limited max iterations and no-change threshold
x agent job iter --max-iterations 50 --inrow 3Example: Enable continuous session mode, all iterations share the same session ID with preserved context
x agent job iter --continuous- Usage:
x agent job iter [OPTIONS] [FLAGS]- Options:
| Name, Shorthand | Default | Description |
|---|---|---|
--harness | Specify AI tool interface | |
--dir | Specify parent directory for jobs | |
-i, --id | Specify job ID (use with --dir, or standalone) | |
--max-iterations | Maximum iterations (default 100) | |
--inrow | Consecutive no-change threshold for completion (default 2) |
- Flags:
| Name, Shorthand | Description |
|---|---|
--continuous | Continuous session mode, all iterations share the same session ID, preserving historical context |
x agent job adjust
Adjust task requirements, AI updates TODO.md via interactive chat
- Examples:
Example: Adjust the most recent task requirements (add error handling to the auth module), AI updates TODO.md
x agent job adjust "Add error handling to the auth module"Example: Adjust requirements for a specific job ID
x agent job adjust --id 260413_112030 "Add error handling to the auth module"Example: Adjust requirements for specific task in specific directory
x agent job adjust --dir ~/tasks/myjob --id 260413_112030 "Change the API endpoint"- Usage:
x agent job adjust [OPTIONS] <#1>- Arguments:
| Argument | Description |
|---|---|
#1 | New requirement description or adjustment details |
- Options:
| Name, Shorthand | Default | Description |
|---|---|---|
--harness | Specify AI tool interface | |
--dir | Specify parent directory for jobs | |
-i, --id | Specify job ID (use with --dir, or standalone) |
x agent job ls
List all tasks
- Examples:
Example: List all tasks (interactive app in terminal, TSV otherwise)
x agent job lsExample: Show only active tasks (with TODO.md)
x agent job ls --activeExample: Show only completed tasks (with DONE.md)
x agent job ls --completedExample: Output in CSV format
x agent job ls --csvExample: Show active tasks in TSV format
x agent job ls --active --tsvExample: Force interactive app mode to select, preview, iterate, adjust, or delete tasks
x agent job ls --app- Usage:
x agent job ls [OPTIONS] [FLAGS]- Options:
| Name, Shorthand | Default | Description |
|---|---|---|
--dir | Specify parent directory for jobs |
- Flags:
| Name, Shorthand | Description |
|---|---|
--active | Show only active tasks (with TODO.md) |
--completed | Show only completed tasks (with DONE.md) |
--csv | Output in CSV format |
--tsv | Output in TSV format (default when stdout is not a terminal) |
--app | Launch interactive app to select, preview, iterate, adjust, or delete tasks |
TIP
In interactive terminal ( zsh, bash ... ), Can use Tab to get completion information
Run CMD SUBCOMMAND --help for more information on a command
This article author
Please indicate the source and link of this article when reprinting.
Help us make these docs great!
All X-CMD docs are generated from command help and multiple data sources. See something that's wrong or unclear? Feel free to let us know through any of these ways~