Cortex is an AI-powered coding assistant that helps you write, review, debug, and understand code. It operates through a command-line interface with both interactive and automated modes.
Cortex provides:
- Intelligent Code Assistance - Get help writing, reviewing, and debugging code
- Interactive Conversations - Continuous dialogue for complex tasks
- Automated Execution - Headless mode for CI/CD and scripting
- Plugin Extensibility - Extend functionality with WASM plugins
- Multi-Model Support - Use various AI models based on your needs
Security Note: Before running any installation script, you can review it first:
curl -fsSL https://software.cortex.foundation/install.sh | less
curl -fsSL https://software.cortex.foundation/install.sh | shirm https://software.cortex.foundation/install.ps1 | iexcortex --versionLaunch Cortex in interactive mode:
cortexExecute a one-off prompt:
cortex "explain this codebase"Run automated tasks:
cortex exec "fix the bug in main.rs"| Feature | Interactive Mode | Exec Mode |
|---|---|---|
| User Interaction | ✅ Continuous dialogue | ❌ One-shot execution |
| Approval Prompts | ✅ Interactive approval | ⚙️ Configurable via --auto |
| Session Persistence | ✅ Automatic | ⚙️ Optional via --session-id |
| Best For | Development, exploration | CI/CD, automation |
| Output Format | Rich TUI | Text, JSON, JSONL, Markdown |
| Timeout | None | Configurable (default: 600s) |
- Exploring a new codebase
- Iterative development and debugging
- Learning and experimentation
- Complex tasks requiring back-and-forth
- CI/CD pipelines
- Automated testing and review
- Shell scripts and batch processing
- Scheduled tasks
# Start in current directory
cortex
# Start in specific directory
cortex --cwd /path/to/project
# Start with a specific model
cortex -m claude-3-opusWithin an interactive session, you can use slash commands:
| Command | Description |
|---|---|
/help |
Show available commands |
/clear |
Clear the conversation |
/models <name> |
Switch AI model |
/export |
Export the session |
/quit or /exit |
Exit Cortex |
- Arrow keys - Navigate history
- Tab - Auto-complete
- Ctrl+C - Cancel current operation
- Ctrl+D - Exit session
Sessions preserve conversation history and context across interactions.
In interactive mode, sessions are automatically created and saved.
Resume a previous session:
cortex --session-id <session-id>Save session to a file:
cortex export --session-id <session-id> -o session.jsonLoad a saved session:
cortex import session.jsonView available sessions:
cortex sessions listCortex supports multiple AI models for different use cases.
cortex models list# Interactive mode
cortex -m claude-3-opus
# Exec mode
cortex exec -m gpt-4-turbo "your prompt"
# During session (slash command)
/models claude-3-sonnet| Use Case | Recommended Model |
|---|---|
| Complex reasoning | claude-3-opus, gpt-4 |
| Fast responses | claude-3-haiku, gpt-3.5-turbo |
| Code generation | claude-3-opus, gpt-4-turbo |
| Simple tasks | Any fast model |
# Interactive
cortex
> Review this code for bugs and security issues
# Exec mode
cortex exec --auto read-only "Review this PR for security vulnerabilities"# Generate docs for a file
cortex exec --auto low "Generate documentation for src/lib.rs"
# Generate README
cortex "Create a README for this project"# Interactive debugging session
cortex
> Help me debug this error: [paste error message]
# With context
cortex --include "src/main.rs" "Why is this function returning null?"# Plan refactoring
cortex "How should I refactor the auth module?"
# Execute refactoring
cortex exec --auto medium "Refactor the auth module to use dependency injection"# Generate tests
cortex exec --auto low "Write unit tests for src/utils.rs"
# Analyze test coverage
cortex "Analyze test coverage and suggest improvements"# Explain a file
cortex "Explain what src/main.rs does"
# Explain a function
cortex "Explain the authenticate() function in auth.rs"
# Explain architecture
cortex "Explain the overall architecture of this project"Add files to the conversation context:
# Specific files
cortex --include "src/main.rs" "Explain this code"
# Multiple files
cortex --include "src/*.rs" --exclude "*_test.rs" "Review these files"Include uncommitted changes:
cortex --git-diff "Review my changes"Fetch and include web content:
cortex --url "https://docs.example.com/api" "How do I use this API?"Attach images for analysis:
cortex -i screenshot.png "What's wrong with this UI?"~/.cortex/config.toml
# Default model
default_model = "claude-3-opus"
# Theme settings
theme = "dark"
# Session settings
auto_save_sessions = true
# Plugin settings
plugins_enabled = trueOverride settings with environment variables:
export CORTEX_MODEL="claude-3-opus"
export CORTEX_API_KEY="your-api-key"Configuration precedence (highest to lowest):
- CLI flags
- Environment variables
- Config file
- Defaults
cortex upgradecortex --versionCortex supports plugins to extend functionality.
cortex plugin listcortex plugin install <plugin-name>cortex plugin enable <plugin-name>
cortex plugin disable <plugin-name>For detailed plugin development information, see the Plugin Development Guide.
For comprehensive exec mode documentation, see the Exec Mode Guide.
# Basic execution
cortex exec "your prompt"
# From file
cortex exec -f prompt.txt
# With autonomy level
cortex exec --auto medium "implement feature"
# With JSON output
cortex exec -o json "analyze code" | jq '.response'
# With timeout
cortex exec --timeout 300 "quick task"# Good
cortex "Add error handling to the parse_config function in src/config.rs"
# Less Good
cortex "Fix the config file"# Include relevant files
cortex --include "src/auth/*.rs" "How does authentication work?"
# Mention constraints
cortex "Refactor this code, keeping backward compatibility"# Start safe
cortex exec --auto read-only "analyze code"
# Increase as needed
cortex exec --auto medium "implement changes"# Check changes
git diff
# Review with Cortex
cortex --git-diff "Review these changes before I commit"# Export important sessions
cortex export --session-id <id> -o project-analysis.json# General help
cortex --help
# Command-specific help
cortex exec --help
cortex plugin --helpIn interactive mode:
/help
Ensure your API key is configured:
# Check environment variable
echo $CORTEX_API_KEY
# Or configure in config file
# ~/.cortex/config.tomlCheck network connectivity:
cortex exec -v "test connection"Clear session cache if experiencing problems:
# Start fresh session
cortex --new-sessionDisable problematic plugins:
cortex plugin disable <plugin-name>Use a faster model for simple tasks:
cortex -m claude-3-haiku "quick question"| Shortcut | Action |
|---|---|
Ctrl+C |
Cancel current operation |
Ctrl+D |
Exit session |
Ctrl+L |
Clear screen |
Up/Down |
Navigate history |
Tab |
Auto-complete |
For additional help:
- Documentation: Check the docs folder
- Issues: Report bugs on the project repository
- Community: Join community discussions
Happy coding with Cortex!