Skip to content

Alexx-coder/Cortex

Repository files navigation

Cortex

Secure Multi-Agent AI Framework

Cortex: 0.2.1 License: MIT Python 3.8+ Encryption: Fernet AES

Ollama Gemini OpenAI OpenRouter


About Cortex

  • Cortex is a powerful CLI tool that splits AI tasks into specialized agents. Instead of using one model for everything, you assign specific roles: one agent for writing code, another for brainstorming ideas, and a third for general tasks.

  • Privacy First: Your chat history is securely encrypted locally using military-grade AES-128 (Fernet) cryptography. No one can read your data without your master password.

Features

  • 🤖 Multi-Agent System: Assign different providers (Ollama, Gemini, OpenAI, OpenRouter) to different tasks.

  • 🔒 Encrypted History: All chats are saved in an AES-256 encrypted database.

  • 🦙 Full Ollama Support: Run everything 100% locally using models like glm-4.7-flash.

  • ☁️ Cloud Providers: Seamlessly integrate Google Gemini, OpenAI, and OpenRouter (including free models).

  • ⚙️ JSON Configuration: Easy setup via a simple config.json file.

  • 🖥️ Clean CLI Interface: Beautiful terminal UI powered by art.

Screenshots

Cortex is working in terminal
  • Cortex is working in terminal

Install Cortex

  1. Clone the repository Cortex
git clone https://github.com/Alexx-coder/Cortex.git
cd Cortex
  1. Create a virtual environment
python -m venv .venv
source .venv/bin/activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Run Cortex:
python runner.py

Configuration

  • All settings are managed in ~/.cortex/config.json.
  1. Add your API keys (Gemini, OpenAI, OpenRouter). Leave blank if you want to use only local Ollama.

  2. Change the Ollama model name to match your downloaded model (e.g., glm-4.7-flash:latest).

  3. Assign providers to agents:

"agents": {
    "code": "ollama",
    "ideas": "openrouter",
    "other": "ollama"
}
  • Note: On the first launch, you will be asked to create a password. It will be saved as a secure local token, so you won't have to enter it every time.

  • Advanced Agent Settings: You can fully customize each agent's behavior directly in config.json:

"agents": {    "code": {      "provider": "ollama",      "temperature": 0.2,      "max_tokens": 8096,      "system_prompt": "You are a senior Rust developer. Only output code."    }}

Usage and Commands

  • When you start Cortex, you will be asked for a Master Password to decrypt your chat database.
Command Description
/new <name> Create a new encrypted chat session
/chats List all saved chats
/switch <id> Switch to another chat session
/message: <agent> <text> Send a prompt to a specific agent (code, ideas, other)
/export Save a chat to .md file
/load Load a file to context
/clear Forget the current context
/settings View current provider and agent configuration
/help Show all commands
/about Information about the project
/stop Exit Cortex
  • Example:
Cortex > /new Python Project
Cortex > /message: code write a fast fibonacci function
Cortex > /message: ideas how can I optimize this further?

Security

  • Cortex does not send your chat history to any third-party servers for storage. All history is encrypted using the cryptography library's Fernet implementation.

  • Fernet provides authenticated encryption using AES-128 in CBC mode with PKCS7 padding and HMAC using SHA256 for integrity. This ensures that your chats cannot be read or tampered with without your master password. The database is saved locally in ~/.cortex/chats.db.

  • Note: If you lose your master password, you lose access to your chat history, as the encryption is cryptographically secure.

Logging

  • When the program is started, Cortex will log information and errors in file ~/.cortex/cortex.log

  • If you want to watch logs Cortex, write in terminal:

  • If you have Windows (it's cmd):

cd %USERPROFILE%\.cortex
type cortex.log
  • If you have Linux, MacOS and etc:
cd ~/.cortex
cat cortex.log

Contributing

  • Contributions, issues, and feature requests are welcome! Feel free to check the issues page

License

  • This project is under the MIT License.

Made with by Alexx-coder

About

🔥 Secure Multi-Agent AI CLI for Terminal. Stream local LLMs via Ollama, use encrypted chats and manage code/ideas agents.

Topics

Resources

Contributing

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages