A minimal CLI coding agent powered by Groq that automates development tasks with local tools and built-in safety guardrails.
Red is a lightweight coding agent that runs in your terminal. It can:
- Read files and explore directories
- Edit files with find-and-replace
- Run shell commands
- Make autonomous decisions about which tools to use
- Ask for approval before any destructive actions
-
Get a Groq API key from console.groq.com
-
Set your API key:
export GROQ_API_KEY=your_api_key_hereOr create a .env file in your project:
GROQ_API_KEY=your_api_key_here
GROQ_MODEL=openai/gpt-oss-120b # Optional: default model- Run Red:
red$ red
Red Agent v1.0.0
Type your request and press Enter. Ctrl+C to exit.
You: Fix the bug in auth.js where users can't log in with email
[Agent thinks...]
[Agent requests to read auth.js]
[Agent identifies the issue]
[Agent asks approval to edit auth.js]
Approve this edit? (y/n): y
[Agent applies fix]
[Agent runs tests to verify]
Task completed!Refactor code:
You: Refactor all the functions in utils.js to use async/await instead of callbacksAdd features:
You: Add input validation to the user registration endpointDebug issues:
You: Find out why the server is crashing on startup and fix itIf you want to contribute or modify Red:
git clone https://github.com/iamAmer/red.git
cd red
npm installnpm run buildThis compiles TypeScript from src/ to dist/.
npm startOr link it globally for testing:
npm link
redRed is built on three core components:
Red has access to four essential tools:
readFileContent(path)- Read file contentslistDirectory(path)- List files and directorieseditFile(path, find, replace)- Replace text in filesrunCommand(command, cwd?)- Execute shell commands
The agent runs in a loop:
- Think - Analyze the current state
- Act - Choose and execute tools
- Observe - Process tool outputs
- Repeat - Continue until task is complete
Before any destructive action (edits, commands), Red:
- Shows you exactly what it wants to do
- Waits for your approval (
y/n) - Only proceeds if you confirm
red/
├── src/
│ ├── agent.ts # CLI entrypoint
│ ├── agent/
│ │ ├── approvals.ts # User approval prompts for destructive actions
│ │ ├── groq.ts # Groq client configuration
│ │ ├── loop.ts # Main agent loop with tool execution
│ │ ├── state.ts # Conversation state management
│ │ └── tools.schema.ts # Tool schemas for the model
│ └── tools/
│ ├── editFile.ts # Find and replace in files
│ ├── index.ts # Tool exports
│ ├── listDirectory.ts # Directory listing
│ ├── readFileContent.ts # File reading
│ └── runCommand.ts # Shell command execution
├── dist/ # Compiled JavaScript (generated)
│ └── agent.js # ← Must have shebang for CLI
├── node_modules/
├── .npmignore # Exclude src/ from npm package
├── package.json # Package metadata and configuration
├── tsconfig.json # TypeScript configuration
├── README.md # This file
├── LICENSE # ISC License
├── CHANGELOG.md # Version history
└── .env # API keys (gitignored)
| Variable | Required | Default | Description |
|---|---|---|---|
GROQ_API_KEY |
Yes | - | Your Groq API key |
GROQ_MODEL |
No | openai/gpt-oss-120b |
Groq model to use |
Red works with any Groq model that supports function calling:
openai/gpt-oss-120b(default, fast and capable)llama-3.3-70b-versatilemixtral-8x7b-32768gemma2-9b-it
Red will always ask before:
- Editing any file
- Running any shell command
- Making changes to your filesystem
Red is designed to be safe by default. It will refuse to:
- Run destructive commands without approval
- Edit files without showing you the exact changes
- Continue if you deny an approval request
Solution: Export the environment variable or create a .env file:
export GROQ_API_KEY=your_key_hereOr if developing locally:
npm linkSolution: Press Ctrl+C to stop. Red has a max iteration limit, but you can always interrupt manually.
Solution: Check that:
- File paths are correct (absolute or relative to current directory)
- You have read/write permissions
- Commands are valid for your OS
Red uses Groq's API, which is fast and cost-effective. To optimize:
- Be specific in your requests
- Break large tasks into smaller chunks
- Review and approve actions promptly
For large codebases:
- Start Red in the specific directory you want to work in
- Give focused, specific instructions
- Use Red for one task at a time
Contributions are welcome! Here's how you can help:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow the existing code style
- Add comments for complex logic
- Test your changes locally before submitting
- Update documentation if you change functionality
- Bugs: GitHub Issues
- Discussions: GitHub Discussions
- Email: muhammedamer7810@gmail.com
ISC © Muhammed Amer