wit agent
Thewit agent command provides an interactive AI-powered coding assistant that understands your codebase and can help with development tasks.
Overview
The wit agent is a conversational AI assistant that can:- Read and understand code files
- Edit files with targeted changes
- Run shell commands (npm, node, etc.)
- Create branches and commits
- Open pull requests
- Explain code and suggest improvements
Usage
Interactive Mode
When you runwit agent without arguments, you enter an interactive chat session:
Session Commands
Within an interactive session, you can use these commands:| Command | Description |
|---|---|
help | Show available commands |
status | Show session status |
history | Show conversation history |
clear | Clear conversation history |
exit | Exit the agent |
One-Shot Mode
For quick questions, use one-shot mode:Capabilities
The agent has access to powerful tools for working with your codebase:Code Understanding
- Read any file in the repository
- List directory contents
- Semantic search across the codebase
- Get git status, diff, and history
Code Modification
- Write new files
- Edit existing files with targeted changes
- Stage files for commit
- Create commits with messages
Git Operations
- Get repository status
- View diffs and changes
- Switch branches
- Create new branches
- Resolve merge conflicts
Shell Execution
- Run npm/yarn commands
- Execute tests
- Run build processes
- Any shell command needed
Pull Requests
- Generate PR descriptions
- Open pull requests
- Review code changes
Examples
Explain Code
Add a Feature
Fix a Bug
Refactor Code
Configuration
Environment Variables
The agent requires an AI API key to function:Check Status
Verify your agent configuration:Memory and Context
The agent maintains conversation history within a session using persistent memory. This means:- Context is preserved across messages in a session
- You can refer back to previous discussions
- The agent remembers what files it has seen
- Use
clearto start fresh
Thread Management
Each session creates a unique thread for tracking the conversation:Best Practices
Be Specific
Instead of:Provide Context
Review Changes
The agent will show you what changes it makes. Always review before committing:Troubleshooting
Agent Not Available
If you see “AI features require an API key”:Model Errors
If you encounter model-specific errors:Context Limits
For very large codebases:- Focus on specific directories or files
- Use semantic search to find relevant code first
- Break complex tasks into smaller steps
Related Commands
- wit ai - AI commit messages and explanations
- wit search - Semantic code search
- wit review - AI-powered code review