Ani Code is an AI-powered coding assistant CLI that provides automatic persistent context through AGENT.md support. It's designed as a lightweight, customizable foundation for developers to build their own AI coding tools.
- Typecheck:
npm run build - Start development:
npm run dev - Run tests:
npm test - Start CLI:
npm startorani(after global install) - Install globally:
npm install -g . - Check formatting:
npm run test
- Development server:
http://localhost:3000(when UI is active) - Debug mode:
ani --debugor setANI_DEBUG=true - Watch mode:
npm run dev(auto-rebuild on changes)
- TypeScript with strict mode enabled
- Functional programming patterns preferred
- Use descriptive variable and function names
- Follow existing patterns in the codebase
- NEVER use
@ts-expect-erroror@ts-ignore - File naming: kebab-case for files, PascalCase for components
- Import order: external deps, then internal by path depth
- Prefer named exports over default exports
- Use type imports:
import type { Type } from './types'
- Test framework: Ava
- Linting: XO with React extensions
- Formatting: Prettier
- Run all checks:
npm test - Component tests go in same directory as components
- Use descriptive test names without "should"
- Agent Core (
src/core/agent.ts): Main AI agent logic, handles API calls, tool execution - CLI Entry (
src/core/cli.ts): Command-line interface setup and initialization - Tools System (
src/tools/): Extensible tool framework for file operations, context management - UI Components (
src/ui/): React/Ink-based terminal UI components - Commands (
src/commands/): Slash command implementations
- Tool Registry: All AI capabilities are implemented as tools with schemas
- Context Management: Supports both AGENT.md (universal) and /context folders
- Message Streaming: Real-time streaming responses with token tracking
- Stable Context Prefix: KV-cache optimization for repeated context
- User input → CLI → Agent
- Agent loads context (AGENT.md or /context)
- Agent processes with LLM API
- Tool execution if needed
- Response streaming to UI
- Context updates as needed
This project pioneered AGENT.md support as the universal standard for AI assistants:
- AGENT.md: Single configuration file that works with all AI tools
- Auto-detection: Loads AGENT.md, PROJECT_OUTLINE.md, or /context folder
- Smart Migration: Can convert legacy configs (.cursorrules, CLAUDE.md, etc.)
- Persistent Memory: Updates AGENT_MEMORY.md with learnings
- Universal Compatibility: Works with Cursor, Claude, Windsurf, and more
- API keys stored in ~/.ani-cli-config.json
- Never commit secrets or API keys
- Validate all user inputs before tool execution
- Use environment variables for sensitive data
- Tool approval system for dangerous operations
- Sandboxed command execution
- Run tests before committing:
npm test - Use descriptive commit messages
- Create feature branches for new work
- Keep pull requests focused and small
- Main branch:
main - Version tags follow semver
To add new tools:
- Define schema in
src/tools/tool-schemas.ts - Implement function in
src/tools/tools.ts - Add to TOOL_REGISTRY and executeTool
- Add to appropriate tool category (SAFE_TOOLS, etc.)
- OpenRouter (default): 100+ models via unified API
- Anthropic: Direct Claude API access
- OpenAI: GPT models support
- Extensible: Easy to add new providers
- Context caching with stable prefixes
- Streaming responses for better UX
- Lazy loading of context files
- Efficient file operations with batching
- Token usage tracking and optimization
- Enable debug logs:
ani --debugorexport ANI_DEBUG=true - Debug file:
debug-agent.login current directory - Verbose API logging available
- Tool execution tracing
- Context not loading: Check file permissions and paths
- API errors: Verify API keys in ~/.ani-cli-config.json
- Tool failures: Check debug logs for detailed errors
- Symlink issues: Use full paths, not relative
- Web UI dashboard
- Plugin system for custom tools
- Multi-agent collaboration
- Vector embeddings for semantic search
- Local model support
This file follows the AGENT.md standard for AI coding assistants. Learn more at https://agent.md
@CONTEXT_ENGINEERING_BEST_PRACTICES.md @README.md