crayon-agent
v0.2.0
Published
Core AI agent package for Crayon Terminal AI assistant.
Downloads
1,566
Readme
⚡ Features
- 🧠 Autonomous ReAct Loop: Crayon thinks, plans, and executes. If a test fails or a build breaks, it intercepts the error and fixes it autonomously.
- 🛡️ Secure by Design: Fine-grained permission modes (
Ask,Auto-Edit,Auto (God Mode)). Built-in safety guards against path traversal, oversized file reads, and destructive bash commands (e.g.,rm -rf /). - ✨ Beautiful CLI Interface: Built with React for the Terminal (
ink). Features predictive autocomplete for slash commands, interactive setup wizards, and dynamic native markdown rendering. - 🚀 Advanced Local Indexer: Rapid semantic codebase search and dependency graph resolution via a blazing-fast local SQLite and Tree-sitter backbone.
- 🔌 Multi-Provider Support: First-class support for Anthropic (Claude 3.7 Sonnet), OpenAI, Google (Gemini), and OpenRouter models.
- 🧩 Extensible Architecture: Integrates universally via Model Context Protocol (MCP) servers and exposes a highly modular TypeScript SDK.
📦 Quick Start
1. Installation
Install Crayon globally to use it across all your projects:
# Using npm
npm install -g crayon-cli@latest
# Using pnpm
pnpm add -g crayon-cli@latest(Alternatively, try it instantly without installing: npx crayon-cli@latest chat)
2. Launch the Agent
Navigate to any local codebase and start a session:
cd your-project
crayon chatFirst Boot Experience: Crayon will launch a beautiful interactive setup wizard to securely configure your API key, preferred models, and permission boundaries. All secrets are stored safely in ~/.crayon/config.json.
🛠️ CLI Commands & Usage
| Command | Description |
|---------|-------------|
| crayon init | Initialize the local .crayon/ config and force-index the repository |
| crayon index | Force a fresh semantic re-index of the current workspace |
| crayon chat | Launch a continuous, interactive agent session |
| crayon run "<task>" | Execute a one-shot autonomous background task |
In-Chat Slash Commands
Once inside the interactive chat interface, use the / prefix to access predictive commands (navigate with arrow keys & <Tab> to autocomplete):
/mode- Hot-swap permission levels (ask,auto-edit,plan,auto,bypass)/cost- View real-time token burn and session cost/files- View files modified during the current session/clear- Purge the conversation history buffer/compact- Compress the context window to save tokens
🏗️ Architecture
Crayon is designed as a highly scalable, modular monorepo managed via pnpm:
packages/
├── 🤖 agent/ # Core LLM ReAct loop, planner, memory arrays, and native tool definitions
├── 🔍 indexer/ # AST extraction (Tree-sitter), dependency graphs, and SQLite semantic search
├── 💻 cli/ # The beautiful Ink-based Terminal UI, session state, and onboarding wizard
└── 🔌 vscode/ # First-class VS Code IDE Extension integrating the core agent engine🗺️ Roadmap
- [x] Core ReAct Agent Loop
- [x] Local AST Codebase Indexer
- [x] Multi-provider Model Support
- [x] Advanced CLI UI (Ink)
- [x] VS Code Extension (Alpha)
- [ ] Model Context Protocol (MCP) Integration Layer
- [ ] Browser Automation Tools (Playwright/Puppeteer)
- [ ] Multi-agent Swarm Architecture
🤝 Contributing
We welcome contributions to make Crayon the absolute best open-source AI agent!
- Fork the repository
- Clone it locally (
git clone https://github.com/mithun0524/crayon.git) - Install Dependencies (
pnpm install) - Create a branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'feat: add amazing feature') - Push and open a PR
Note: Please ensure you run
pnpm run buildandpnpm run typecheckbefore submitting pull requests.
🔐 Configuration & Security
Configurations are strictly stored in ~/.crayon/config.json preventing accidental commits of API keys.
You can dynamically override keys via standard environment variables:
ANTHROPIC_API_KEY, OPENAI_API_KEY, GEMINI_API_KEY, OPENROUTER_API_KEY.
