Interactive Mode
Forge’s interactive mode provides a conversational terminal interface where you can collaborate with AI in real-time. When you runforge without arguments, you enter an interactive session where the AI becomes your coding partner.
Starting Interactive Mode
To start an interactive session, simply run:How It Works
In interactive mode, Forge:- Analyzes your context - Understands your current directory and project structure
- Maintains conversation state - Remembers your previous messages and decisions
- Executes tools - Can read files, run commands, and modify code on your behalf
- Provides real-time feedback - Shows you what it’s doing as it works
Direct Prompt Mode
If you need to execute a single task without entering an interactive session, you can use the-p flag:
Direct prompt mode is ideal for CI/CD pipelines, git hooks, or quick one-off tasks.
Command File Execution
You can also provide a file containing commands to execute:Interactive Commands
While in interactive mode, you have access to several built-in commands:/help- Display available commands/model- Switch the AI model/exit- Exit the interactive session/clear- Clear the conversation history
Session Management
Forge automatically saves your conversation history, allowing you to:- Resume previous conversations
- Review past interactions
- Export conversations for documentation
--conversation flag:
Custom Commands
You can define custom commands in yourforge.yaml to create shortcuts for repetitive prompts:
/refactor or /review in the interactive session.
Custom commands help standardize common tasks across your team and ensure consistent code quality.
Restricted Mode
For enhanced security, you can enable restricted shell mode:Verbose Output
Enable verbose mode to see detailed information about what Forge is doing:Best Practices
Be Specific
The more specific your request, the better the results:- Good: “Add error handling to the login function in src/auth.ts”
- Better: “Add try-catch blocks with proper error messages to the login function in src/auth.ts, and log errors to our logging service”
Provide Context
Mention relevant files, functions, or patterns in your codebase:Iterate and Refine
Don’t expect perfect results on the first try. Forge works best when you iterate:- Make an initial request
- Review the output
- Provide feedback and refinements
- Continue until you’re satisfied
Use Version Control
Always commit your work before major changes:FAQ
FAQ