This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
mindX is an autonomous multi-agent orchestration system implementing a Belief-Desire-Intention (BDI) cognitive architecture. It's a "Godel-machine" - a self-improving AI system with Ethereum-compatible wallet authentication and LLM integration (Mistral, Gemini, Groq, Ollama, OpenAI, Anthropic, Together AI).
Documentation: docs/NAV.md is the master navigation hub — 40+ sections covering all agents, tools, governance, inference, memory, deployment. docs/SCHEMA.md is the instruction layer — how to maintain, cross-reference, and evolve the docs. Start with NAV.
VPS Deployment: agents/hostinger_vps_agent.py manages mindx.pythai.net via three MCP channels: SSH, Hostinger API, and mindX Backend HTTPS. See agents/hostinger.vps.agent for full parameters.
cp .env.sample .env # Add API keys (MISTRAL_API_KEY, GEMINI_API_KEY, etc.)
pip install -r requirements.txt
# Recommended: Full web interface (frontend + backend)
./mindX.sh --frontend
Custom ports
./mindX.sh --frontend --frontend-port 3001 --backend-port 8001
Interactive setup with API key configuration
./mindX.sh --frontend --interactive
Direct backend only
uvicorn mindx_backend_service.main_service:app --reload --port 8000
API interactions: When the backend is running, http://localhost:8000/docs (FastAPI Swagger UI) shows all API endpoints and lets you try requests and inspect schemas—very useful for auditing and integrating with the API.
# Run all tests
python -m pytest tests/
Run specific test file
python -m pytest tests/test_mistral_chat_completion_api.py -v
With coverage
python -m pytest tests/ --cov=mindx --cov-report=term-missing
ruff format . # Format code
ruff check . --fix # Lint
mypy mindx/ # Type checking
CEO Agent (board-level strategic planning)
↓
MastermindAgent (singleton, strategic orchestration center)
↓
CoordinatorAgent (infrastructure management, autonomous improvement)
↓
Specialized Agents (BDI-based cognitive agents)
orchestration/ - MastermindAgent, CoordinatorAgent, CEOAgentcore/ - BDI reasoning engine (bdi_agent.py), AGInt cognitive engine (agint.py), identity management (id_manager_agent.py)agents/ - Specialized agents (guardian, memory, automindx, simple_coder, persona, avatar)api/ - Multi-provider LLM API layer (llm_routes.py, provider-specific APIs)learning/ - Self-improvement (strategic_evolution_agent.py, self_improve_agent.py)llm/ - LLM factory pattern with provider-specific handlerstools/ - 29+ tools extending BaseTool (see docs/TOOLS_INDEX.md for full list)mindx_backend_service/ - FastAPI backend (main_service.py is ~95KB)mindx_frontend_ui/ - Express.js frontend with xterm.js terminal and window managerDAIO/contracts/ - Solidity smart contracts (Foundry-based)Singleton with async factory (used by most agents):
@classmethod
async def get_instance(cls, config_override=None, **kwargs):
async with cls._lock:
if cls._instance is None:
cls._instance = cls(...)
return cls._instance
All operations are async - the system uses async/await throughout.
Tool pattern - All tools extend BaseTool with execute() and get_schema() methods.
llm/llm_factory.pymistral_handler.py, gemini_handler.py, groq_handler.py, ollama_handler.pydata/config/provider_registry.json (Gemini, OpenAI, Anthropic, Mistral, Together, Ollama)models/.yamlrate_limiter.pyIDManagerAgentBackend runs on port 8000, frontend on 3000.
Key routes:
POST /agents/create, GET /agents/list - Agent managementPOST /llm/chat, POST /llm/completion - LLM operationsPOST /users/authenticate - Wallet authenticationPOST /directive/execute - Execute directives/mindterm/sessions/{id}/ws - WebSocket terminal accessGET /health, GET /metrics - System statusAPI docs at http://localhost:8000/docs
Live at: https://mindx.pythai.net (Hostinger VPS 168.231.126.58)
mindx.service, User=mindx, /home/mindx/mindX/docs/DEPLOYMENT_MINDX_PYTHAI_NET.md for full guideAPI keys are NOT stored in .env — they live encrypted in mindx_backend_service/vault_bankon/:
python manage_credentials.py store gemini_api_key "KEY" # Store
python manage_credentials.py list # List IDs
python manage_credentials.py providers # Show all provider IDs
Per-provider config templates: config/providers/.env (13 providers)
Vault routes: /vault/credentials/status, /vault/credentials/list, /vault/credentials/providers
Priority: Environment variables (MINDX_ prefix) > BANKON Vault > JSON configs (data/config/) > YAML model files (models/) > .env file
Key environment variables (set via vault or .env):
GEMINI_API_KEY, GROQ_API_KEY, MISTRAL_API_KEY - LLM providersOPENAI_API_KEY, ANTHROPIC_API_KEY, TOGETHER_API_KEY - Additional LLM providersDEEPSEEK_API_KEY, COHERE_API_KEY, PERPLEXITY_API_KEY - Extended providersREPLICATE_API_TOKEN, STABILITY_API_KEY, FIREWORKS_API_KEY - Media/inferenceMINDX_LOGGING_LEVEL - DEBUG/INFO/WARNING/ERRORMINDX_COORDINATOR_AUTONOMOUS_IMPROVEMENT_ENABLED - Enable autonomous loopsLocated in data/memory/:
stm/ - Short-term memory (per-session)ltm/ - Long-term knowledge baseworkspaces/ - Agent working areasManaged by agents/memory_agent.py with belief system integration.
tools/a2a_tool.py - Standardized agent-to-agent communicationtools/mcp_tool.py - Structured context provision for agent actionsagents/persona_agent.py)agents/avatar_agent.py)tools/prompt_tool.py)