CLI Command Reference
Relevant source files
The following files were used as context for generating this wiki page:
The Autohand CLI Command Reference provides a comprehensive guide to the interactive and non-interactive commands used to manage the AI coding agent. The system is built on a modular architecture where commands are categorized into three distinct layers: slash commands for system control, at-file references for context injection, and shell commands for direct environment interaction.
Sources: prd/command-ux-spec.md:5-10, src/commands/README.md:1-5
Command Architecture and Processing
The CLI utilizes a centralized commandCompletion orchestrator to track the active input mode based on user prefixes. When a user enters a prefix, the corresponding processor handles the execution logic.
Input Processing Flow
The following diagram illustrates how the system determines which processor should handle a specific input string.
The input capture phase delegates context to specific hooks like useAtCompletion for path suggestions or slashCommandProcessor for system actions.
Sources: prd/command-ux-spec.md:46-55, src/core/agent.ts:474-485
Core Components
| Component | Responsibility | Source |
|---|---|---|
slashCommandProcessor | Loads built-in command descriptors and metadata. | prd/command-ux-spec.md:14-23 |
atCommandProcessor | Resolves relative paths, respects .gitignore, and injects file snippets. | prd/command-ux-spec.md:25-31 |
shellCommandProcessor | Executes commands using runCommand and streams output to Ink UI. | prd/command-ux-spec.md:33-38 |
SlashCommandHandler | Manages stateful command execution (e.g., model selection, memory). | src/core/agent.ts:187-205 |
Slash Command Reference
Slash commands are system-level instructions used to configure the agent, manage sessions, and control skills. These commands are defined in src/core/slashCommands.ts and implemented as individual modules.
Sources: src/core/slashCommands.ts:7-41, src/commands/README.md:11-23
General System Commands
| Command | Alias | Description | Implementation File |
|---|---|---|---|
/help | /? | Describes available commands and provides usage tips. | src/commands/help.ts |
/model | - | Opens the configuration menu for LLM providers and models. | src/commands/model.js |
/quit | /exit | Saves the session and terminates the CLI application. | src/commands/quit.js |
/status | - | Displays the current workspace status and token usage. | src/commands/status.js |
/undo | - | Reverts the last file mutation performed by the agent. | src/commands/undo.js |
Sources: src/commands/help.ts:13-25, src/core/slashCommands.ts:32-70, src/core/agent.ts:466-470
Skill and Agent Management
Commands for extending agent capabilities and managing sub-agents.
- /skills: Lists and manages installed skills.
- /skills new: Interactive wizard to create a new skill from a description. It generates a
SKILL.mdfile with YAML frontmatter. - /agents: Lists available specialized sub-agents.
- /automode: Controls autonomous development loops, allowing commands like
status,pause, andresume.
Sources: src/commands/skills-new.ts:21-26, src/commands/automode.ts:16-20, src/core/slashCommands.ts:65-68
Session and Memory Commands
- /sessions: Lists all past saved sessions.
- /resume : Reloads a previous conversation state by its unique session ID.
- /memory: View or manage facts and preferences stored in project/user-level memory.
- /export: Exports the current session history to Markdown, JSON, or HTML.
Sources: src/commands/README.md:19-21, src/core/agent.ts:413-417, src/core/slashCommands.ts:55-63
Advanced Command Features
Autonomous Loops (Auto-Mode)
Auto-mode enables iterative improvement cycles where the agent works autonomously toward a defined prompt.
The /automode command supports subcommands like pause to halt the loop and status to view files modified and current iteration counts.
Sources: src/commands/automode.ts:40-75, src/commands/automode.ts:137-145
Skill Generation Process
The /skills new command initiates an LLM-driven flow to create reusable instruction packages.
- Input: User provides a name and a natural language description.
- Selection: User chooses storage level (
projectoruser). - Validation: System checks for name validity and similarity to existing skills.
- Generation: LLM generates a
SKILL.mdwith structured YAML frontmatter. - Confirmation: User previews the content before saving to the
.autohand/skillsdirectory.
Sources: src/commands/skills-new.ts:39-65, src/commands/skills-new.ts:121-135
Summary
The CLI command system provides a robust interface for both manual control and autonomous operation. By partitioning functionality into slash commands, at-references, and shell execution, it allows developers to maintain flow while providing the agent with precise context and instructions. The integration of session resumption and skill management ensures that project-specific knowledge persists across multiple interactions.
Sources: src/core/agent.ts:601-615, prd/command-ux-spec.md:57-60