Open-source agentic harness — CLI, API, web UI, and marketplace.
CortexPrism is a runtime for building, deploying, and managing AI agents. It provides a unified interface to 12+ LLM providers, a 5-tier memory system with hybrid retrieval, sandboxed code execution, defense-in-depth security, and a plugin marketplace — all running locally on your machine.
- Agent Loop — Multi-turn reasoning with tool orchestration, memory injection, and reflection
- Multi-Provider — Anthropic, OpenAI, Google, Groq, Mistral, DeepSeek, Ollama, and more
- Memory — 5 tiers from ephemeral to procedural with FTS5 + vector hybrid retrieval
- Security — Parallax 3-stage validation gate, encrypted vault, audit logging
- Plugins — Extend via ESM modules, MCP servers, or WebAssembly
- Marketplace — Discover and publish plugins and agent configs
- Web UI — Dashboard, chat interface, memory browser, audit lens
- REST API — Full HTTP API with OpenAPI 3.1 specification and Swagger UI
git clone https://github.com/CortexPrism/cortex.git
cd cortex
deno task setup
cortex setup
cortex chatVisit cortexprism.io to explore the marketplace and full documentation.
Chat with 12+ LLM providers through a unified interface. Switch providers mid-session, configure fallback chains, stream responses.
cortex chat --model claude-sonnet-4-20250514
Agents use tools (code execution, file I/O, web search) through configurable approval gates. Audit every call.
cortex chat --tools all
Ephemeral → Working → Semantic → Archival → Procedural. Hybrid FTS5 keyword search + cosine vector similarity with exponential time decay.
cortex memory search --query "deployment config" --tier semantic
3-stage validation: tool name → shell command → domain rules. AES-256-GCM encrypted vault. Full audit trail via Cortex Lens.
cortex policy add --allow code.execute.python
Run Python, JavaScript, Wasm, and shell commands in isolated Docker sandboxes (subprocess fallback). Resource limits enforced.
cortex run --sandbox python --script analyze.py
Automatic model selection by task complexity with cost optimization and graceful failover across providers.
cortex chat --router cost-optimized
Three plugin architectures: ESM modules (JS/TS), MCP servers (stdin/stdio or HTTP/SSE), WebAssembly (Rust, Go, C). Plugin marketplace for discovery.
cortex plugin install marketplace:cortexprism.io/plugins/python-executor
Persistent background daemon with validator, executor, and scheduler processes. CRON job scheduling with auto-restart.
cortex daemon start && cortex jobs add --schedule "0 9 * * 1" --task weekly-report
Dark-theme web dashboard with chat, Lens, Memory, and Jobs tabs. REST API + WebSocket for real-time streaming.
cortex serve --port 8080
Multiple agent profiles with custom souls, system prompts, tool assignments, and provider configurations. Agent-to-agent collaboration.
cortex agent create --name code-reviewer --model claude-sonnet-4-20250514
┌─────────────────────────────────────────────────────────────────┐
│ CortexPrism │
│ │
│ CLI (cortex chat / run / serve / ...) │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────┐ │
│ │ agent/loop.ts │ │
│ │ userMessage → [memory inject] → LLM call │ │
│ │ → [tool parse] → [validator] → [execute] │ │
│ │ → [re-prompt loop] → response │ │
│ │ → [episodic write] → [reflection] │ │
│ └─────────────────────────────────────────────┘ │
│ │ │
│ ┌──────┼──────────────────────────────────────┐ │
│ │ │ Subsystems │ │
│ │ memory/ tools/ sandbox/ security/ │ │
│ │ llm/ server/ scheduler/ │ │
│ └──────────────────────────────────────────────┘ │
│ │
│ SQLite databases (WAL mode) │
│ cortex.db · memory.db · lens.db · vault.db · sess_*.db │
└─────────────────────────────────────────────────────────────────┘
| Component | Description |
|---|---|
| Agent Loop | Core reasoning + tool loop — LLM calls, tool execution, memory, reflection |
| Memory System | 5-tier memory with hybrid FTS5 + vector embedding retrieval |
| LLM Layer | 12+ providers with unified interface and CascadeRouter |
| Tool System | Extensible registry for file I/O, shell, web, code execution |
| Security (Parallax) | 3-stage policy gate, encrypted vault, audit logging |
| Sandbox | Docker containers with resource limits and auto-fix loop |
| Daemon Supervisor | Background process manager with auto-restart |
| HTTP Server | REST API + WebSocket + web UI dashboard |
| Scheduler | SQLite-persisted CRON job scheduler with retry |
This repository hosts cortexprism.io — the official CortexPrism website. It includes:
| Section | Path | Pages | Description |
|---|---|---|---|
| Getting Started | /getting-started | 4 | Quickstart, installation, first run, configuration |
| CLI Reference | /docs/cli | 12 | Every cortex command documented |
| Architecture | /docs/architecture | 8 | Agent loop, memory, security, router, daemon, plugins, databases |
| Developer Guide | /docs/developer-guide | 10 | Plugin types, ESM/MCP/WASM dev, API, agents, publishing, standards |
| Knowledge Base | /docs/knowledge-base | 9 | FAQ, troubleshooting, best practices, provider guide, security, performance |
| Design Docs | /docs/design-docs | 1 | Links to design specifications in the main repository |
Discover, publish, and manage plugins and agent configurations.
| Path | Description |
|---|---|
| /marketplace | Browse approved plugins and agents |
| /marketplace/plugins | Plugin listing with search, category filters, pagination |
| /marketplace/plugins/:id | Plugin detail with screenshots, reviews, install instructions |
| /marketplace/agents | Agent configuration listing |
| /marketplace/agents/:id | Agent detail with reviews and download |
| /marketplace/publish/plugin | Submit a plugin to the marketplace |
| /marketplace/publish/agent | Submit an agent configuration |
| Path | Description |
|---|---|
| / | Landing page with GitHub stats, marketplace counts, features |
| /features | Detailed feature breakdown with CLI examples |
| /about | About CortexPrism |
| /security | Security overview and disclosure |
| /use-cases | Use case examples |
| /install | Installation instructions |
| /login | User login |
| /register | User registration |
| /dashboard | User dashboard (submissions, profile) |
| /admin | Admin panel (approve/reject submissions) |
| /changelog | Release history |
| /contribute | Contributing guide |
| /docs | Documentation hub |
| /getting-started | Getting started guide |
| /openapi | Swagger UI for the REST API |
| /profile/:username | Public user profile |
| Layer | Choice |
|---|---|
| Framework | Next.js 14 (App Router) |
| Language | TypeScript |
| Styling | Tailwind CSS 3 |
| UI Components | Radix UI (Dialog, Dropdown, Select, Tabs), Lucide icons |
| Database | SQLite via Prisma 5 |
| Auth | JWT + bcryptjs |
| Content | MDX with react-markdown + remark-gfm |
| Search | Fuse.js (client-side) |
| Charts | Recharts |
| API Docs | swagger-ui-react + OpenAPI 3.1 |
| Data Fetching | SWR |
| Validation | Zod |
| Deployment | Docker / systemd + nginx |
The marketplace exposes a REST API consumed by the web UI and external Cortex instances. Full documentation is available via Swagger UI at /openapi or the raw spec at /api/docs/openapi.json.
| Method | Path | Description |
|---|---|---|
GET |
/api/marketplace/plugins |
List approved plugins (search, filter, paginate) |
GET |
/api/marketplace/plugins/:id |
Plugin detail |
GET |
/api/marketplace/plugins/:id/download |
Download manifest (increments counter) |
POST |
/api/marketplace/plugins |
Submit a plugin (requires auth) |
GET |
/api/marketplace/agents |
List approved agent configs |
GET |
/api/marketplace/agents/:id |
Agent detail |
GET |
/api/marketplace/agents/:id/download |
Download agent config |
POST |
/api/marketplace/agents |
Submit an agent (requires auth) |
GET |
/api/marketplace/categories |
List categories |
GET |
/api/marketplace/stats |
Marketplace statistics |
GET |
/api/docs/openapi.json |
OpenAPI 3.1 spec |
| Method | Path | Description |
|---|---|---|
POST |
/api/auth/register |
Create account (email, username, password) |
POST |
/api/auth/login |
Login, returns JWT token |
GET |
/api/auth/me |
Get current user (requires Bearer token) |
| Method | Path | Description |
|---|---|---|
GET |
/api/user/submissions |
User's plugins and agents with status |
| Method | Path | Description |
|---|---|---|
GET |
/api/admin/submissions/plugins?status=pending |
List pending plugins |
PUT |
/api/admin/submissions/plugins |
Approve or reject a plugin |
GET |
/api/admin/submissions/agents?status=pending |
List pending agents |
PUT |
/api/admin/submissions/agents |
Approve or reject an agent |
content/ # MDX documentation files (42 pages across 6 sections)
prisma/ # Schema + seed data + SQLite database
public/ # Static assets (images, favicon)
src/
app/
api/ # REST API routes (auth, marketplace, admin, user)
admin/ # Admin panel (submission review)
changelog/ # Release history
contribute/ # Contributing guide
dashboard/ # User dashboard
docs/ # Documentation pages (MDX-rendered)
features/ # Features page
getting-started/ # Getting started guides (MDX-rendered)
login/ # Login page
marketplace/ # Marketplace (plugins, agents, publish forms)
openapi/ # Swagger UI
register/ # Register page
components/ # React components (29 components)
layout/ # Navbar, Footer, Sidebar
landing/ # Hero, FeatureGrid, StatsBar, CTA
docs/ # MdxContent, TableOfContents, DocSearch, CodeBlock
marketplace/ # Cards, details, forms, search, reviews
shared/ # Badge, Button, Card, Pagination, StarRating
lib/ # Utilities (prisma, auth, openapi, github, markdown)
middleware.ts # CORS middleware
- Node.js 20+
- npm
npm install
npm run db:generate
npm run db:push
npm run db:seednpm run devThe dev server runs on http://localhost:3001.
npm run db:generate # Generate Prisma client
npm run db:push # Push schema to SQLite
npm run db:seed # Seed with default admin user and categories
npm run db:studio # Open Prisma Studionpm run lintnpm run buildThe build script produces a standalone .next directory with static assets and the SQLite database bundled.
systemctl restart cortexprism-web.serviceThe Discord bot is a standalone service in discord-bot/:
cd discord-bot
npm install # also runs db:generate (generates Prisma client and copies it locally)
# Register slash commands (run once)
npx tsx src/deploy-commands.ts
# Start bot
npx tsx src/index.tsdocker compose up --build -dThe Dockerfile uses multi-stage build with Next.js standalone output. The docker-compose.yml includes nginx reverse proxy on port 443.
| Variable | Default | Description |
|---|---|---|
DATABASE_URL |
file:./prisma/marketplace.db |
SQLite database path |
JWT_SECRET |
(auto-generated) | Secret for JWT token signing |
NEXT_PUBLIC_SITE_URL |
https://cortexprism.io |
Canonical site URL |
NEXT_PUBLIC_GITHUB_REPO |
CortexPrism/cortex |
GitHub repo for stats |
NEXT_PUBLIC_CORTEX_VERSION |
(auto-detected) | Override displayed CortexPrism version |
DISCORD_CLIENT_ID |
— | Discord OAuth app client ID |
DISCORD_CLIENT_SECRET |
— | Discord OAuth app client secret |
NEXT_PUBLIC_DISCORD_CLIENT_ID |
— | Discord OAuth app client ID (public) |
DISCORD_BOT_TOKEN |
— | Discord bot token for slash commands |
DISCORD_GUILD_ID |
— | Guild ID for guild-specific command registration |
DISCORD_SUBMISSION_WEBHOOK_URL |
— | Webhook URL for marketplace submission notifications |
DISCORD_ADMIN_IDS |
— | Comma-separated Discord user IDs with bot admin access |
After seeding: admin@cortexprism.io / admin12345
Cortex instances consume the marketplace API to discover and install plugins. The MARKETPLACE-INTEGRATION.md document details:
marketplace:URI scheme for plugin references- Plugin manifest and agent config data contracts
- Installation and download flows
- CORS policy
Contributions of all kinds are welcome — bug reports, feature requests, documentation improvements, and plugin development.
- Issues: github.com/CortexPrism/cortex/issues
- Pull Requests: github.com/CortexPrism/cortex/pulls
- Discord: Join the community
- Plugin Development: See the Developer Guide and Submission Standards
MIT