Loading repository dataβ¦
Loading repository dataβ¦
omerakben / repository
π§ Open-source AI reasoning research platform β persistent reasoning graphs, multi-agent swarms, Graph-of-Thoughts, and MemGPT-style memory. Built with Claude Opus 4.6 by Anthropic. Explore, verify, and fork AI thinking in real-time.
Opus Nx turns model reasoning traces into persistent, inspectable artifacts you can explore, verify, rerun, and improve. Every thinking step becomes a node in a navigable graph β not a black box.
This repository is positioned for research and open-source collaboration. Run it locally with your own credentials.
Most AI workflows keep only final answers. Opus Nx keeps the entire reasoning path and supports policy improvement over time.
| Standard AI UX | Opus Nx |
|---|---|
| Final answer only | Persistent reasoning graph artifacts |
| Single perspective | 6-agent swarm + 4-style branching workflows |
| Limited traceability | Decision points, typed edges, step verification, lifecycle state |
| Prompt-only iteration | Promote β rerun β compare β retain loops |
| Ephemeral context | 3-tier memory hierarchy (working β recall β archival) |
Full visual walkthrough with all screenshots:
docs/features.md
Every extended thinking session becomes a graph of discrete reasoning steps β nodes scored for confidence, connected by typed edges showing how ideas flow, branch, and build on each other.
Deploy a swarm of 6 specialized AI agents that collaborate in real-time via WebSocket streaming. Maestro decomposes the problem, DeepThinker analyzes, Contrarian challenges, Verifier validates, Synthesizer merges, and Metacognition audits.
Explore problems using arbitrary reasoning graphs with BFS, DFS, or best-first search. Thoughts branch, aggregate, and get verified at each depth level β a visual implementation of Besta et al. (2023).
Process Reward Model verifies each reasoning step independently. See structured steps (CONSIDERATION β HYPOTHESIS β EVALUATION β CONCLUSION) with confidence scores, decision counts, and edge relationships.
Fork any question into 4 concurrent reasoning styles: conservative, aggressive, balanced, and contrarian. Each branch reasons independently, then results are compared with confidence scores and key points.
A 3-tier memory system: working context (active reasoning), recall buffer (recent history), and archival storage (long-term knowledge). Entries persist across sessions with semantic search and importance scoring.
Two-service runtime with shared persistence:
Browser
-> Next.js web app (apps/web)
-> packages/core reasoning modules
-> packages/db Supabase access
-> swarm proxy routes
-> Python FastAPI swarm service (agents)
-> Supabase Postgres + pgvector
See full architecture details: docs/architecture.md
git clone https://github.com/omerakben/opus-nx.git
cd opus-nx
./scripts/dev-start.sh
The setup script handles everything: prerequisites check, dependency install, env bootstrap, connection verify, build, and launch. It will prompt you for API credentials on first run.
Run everything locally with just an Anthropic API key β no Supabase cloud account needed. Data stays on your machine.
Prerequisites: Docker, Node.js 22+, pnpm. Optional: Python 3.12+ and uv for the agent swarm.
git clone https://github.com/omerakben/opus-nx.git
cd opus-nx
./scripts/docker-start.sh
The script handles everything: checks prerequisites, copies .env.docker to .env, prompts for your Anthropic API key, starts a local PostgreSQL + pgvector database in Docker, installs all dependencies, builds the project, and launches the dev servers.
When it's done, open http://localhost:3000 in your browser.
Or step by step:
cp .env.docker .env
# Edit .env β add your ANTHROPIC_API_KEY
docker compose -f docker-compose.local.yml up -d # Start local DB
pnpm install && pnpm build && pnpm dev # Install, build, run
| Service | URL | Purpose |
|---|---|---|
| Dashboard | http://localhost:3000 | Next.js web app β open this in your browser |
| Agent Swarm | http://localhost:8000 | Python FastAPI backend (auto-starts if uv is installed) |
| REST API | http://localhost:54321 | Supabase-compatible DB API (used internally) |
| PostgreSQL | localhost:54322 | Direct DB access (psql, pgAdmin) |
# Lifecycle
./scripts/docker-start.sh --stop # Stop everything (dev servers + database)
./scripts/docker-start.sh --reset # Wipe database and start fresh
./scripts/docker-start.sh --db-only # Start only the database (no dev servers)
# Database access
docker exec -it opus-nx-postgres psql -U postgres -d opus_nx # Direct SQL access
docker compose -f docker-compose.local.yml logs -f postgres # Stream DB logs
git clone https://github.com/omerakben/opus-nx.git
cd opus-nx
pnpm install
pnpm setup
This creates .env and agents/.env if missing and aligns AUTH_SECRET across both files.
Required values:
ANTHROPIC_API_KEYAUTH_SECRETSUPABASE_URLSUPABASE_SERVICE_ROLE_KEYSUPABASE_ANON_KEYpnpm setup:verify
pnpm dev
Optional local swarm backend:
cd agents
uv run uvicorn src.main:app --reload --port 8000
Use your own provider accounts and keys.
AUTH_SECRET consistent across web and agentsDEMO_MODE=true only when intentionally enabled)pnpm dev # Start all dev servers
pnpm lint # Lint all packages
pnpm typecheck # Type-check all packages
pnpm test # Run tests
pnpm db:migrate # Run Supabase migrations
pnpm setup # Bootstrap env files
pnpm setup:verify # Verify API connections
./scripts/dev-start.sh # Full setup + launch (recommended)
./scripts/docker-start.sh # Docker local DB + dev servers
./scripts/docker-start.sh --db-only # Docker DB only (no dev servers)
Agent tests:
cd agents
uv run pytest
POST /api/thinking β Extended thinking requestPOST /api/thinking/stream β SSE streaming for thinking deltasPOST /api/fork β ThinkFork parallel reasoningPOST /api/verify β PRM step-by-step verificationPOST /api/got β Graph of Thoughts reasoningGET/POST /api/sessions β List/create sessionsGET /api/sessions/[sessionId]/nodes β Get thinking nodesGET /api/reasoning/[id] β Get reasoning node detailsPOST /api/swarm β Initiate multi-agent swarmGET /api/swarm/token β WebSocket auth tokenPOST /api/swarm/[sessionId]/checkpoint β Human-in-the-loop checkpointGET/POST /api/memory β Hierarchical memory operationsGET/POST /api/insights β Metacognitive insights| Layer | Technology |
|---|---|
| LLM | Claude Opus 4.6 (50K extended thinking budget) |
| Dashboard | Next.js 16, React 19, Tailwind CSS 4, shadcn/ui |
| Agent Swarm | Python 3.12, FastAPI, Anthropic SDK, NetworkX |
| Database | Supabase (PostgreSQL + pgvector with HNSW indexes) |
| Visualization | @xyflow/react (react-flow) |
| Deployment | Vercel (dashboard) + Fly.io (agents) |
| Runtime | Node.js 22+, TypeScript 5.7+ |
| Testing | Vitest 4, Playwright, pytest |
Implemented concepts are grounded in:
| Paper | Module | Key Contribution |
|---|---|---|
| Tree of Thoughts (Yao et al., 2023) | ThinkFork | BFS/DFS search over reasoning trees with state evaluation |
| Let's Verify Step by Step (Lightman et al., 2023) | PRM Verifier | Process supervision β verify each reasoning step in |