This file provides context for AI assistants (Claude, etc.) working on the Algora project.
Algora is a 24/7 Live Agentic Governance Platform for MOC (Moss Coin) holders. The system features dynamically scalable AI agents that engage in continuous discussion and deliberation, transparently visualizing all governance activities for token holders in real-time.
Domain: https://algora.moss.land
- Monorepo: pnpm workspaces + Turborepo
- Backend: Node.js + TypeScript + Express.js + Socket.IO
- Frontend: Next.js 14 + React 18 + TanStack Query + Tailwind CSS
- Database: SQLite (better-sqlite3) with WAL mode
- LLM External: Anthropic Claude / OpenAI GPT / Google Gemini (Tier 2)
- LLM Local: Ollama (Tier 1) - Llama 3.2, Qwen 2.5, Phi-4
- i18n: next-intl (English primary, Korean secondary)
algora/
├── apps/
│ ├── api/ # Express REST API + Socket.IO backend
│ └── web/ # Next.js frontend with i18n
├── packages/
│ ├── core/ # Shared types, utilities
│ ├── reality-oracle/ # L0: Signal collection
│ ├── inference-mining/ # L1: Issue detection
│ ├── agentic-consensus/ # L2: Agent system
│ ├── human-governance/ # L3: Voting/Delegation
│ └── proof-of-outcome/ # L4: Result tracking
└── docs/ # Additional documentation
- L0 (Reality Oracle): Signal collection from RSS, GitHub, On-chain, Social
- L1 (Inference Mining): Anomaly detection, issue identification
- L2 (Agentic Consensus): 30 AI agents deliberate on issues
- L3 (Human Governance): MOC token holders vote on proposals
- L4 (Proof of Outcome): Execution tracking, KPI verification
- Tier 0: Free operations (RSS/GitHub collection, no LLM)
- Tier 1: Local LLM (Ollama) - Agent chatter, simple summaries
- Tier 2: External LLM (Claude/GPT) - Serious deliberation, Decision Packets
Current configuration: 38 agents in 11 clusters (architecture supports infinite scaling):
- Visionaries (5): Future-oriented thinkers
- Builders (5): Engineering guild
- Investors (4): Market watchers
- Guardians (4): Risk management
- Operatives (5): Data collection specialists
- Moderators (3): Discussion facilitators
- Advisors (4): Domain experts
- Orchestrators (2): Workflow coordinators (Nova Prime, Atlas)
- Archivists (2): Document keepers (Archive Alpha, Trace Master)
- Red Team (3): Devil's advocates (Contrarian Carl, Breach Tester, Base Questioner)
- Scouts (1): Opportunity detectors (Horizon Seeker)
- Language: TypeScript for all code
- Comments: English only
- Commit Messages: English only
- Linting: ESLint + Prettier
All documentation files must have Korean translations:
README.md/README.ko.mdARCHITECTURE.md/ARCHITECTURE.ko.mdCONTRIBUTING.md/CONTRIBUTING.ko.mdALGORA_PROJECT_SPEC.md/ALGORA_PROJECT_SPEC.ko.md
IMPORTANT: Update ALL documentation (including Korean translations) with every commit.
UI/UX is critically important for this project:
- The system must feel "alive" and running 24/7
- Agent avatars must show status (idle/active/speaking)
- Activity feed must never pause more than 10 seconds
- Modern, clean design using Tailwind CSS
- Responsive design (mobile-first)
# Install dependencies
pnpm install
# Start development
pnpm dev
# Build all packages
pnpm build
# Run tests
pnpm test
# Lint code
pnpm lint
# Initialize database
pnpm db:initKey environment variables (see .env.example for full list):
ANTHROPIC_API_KEY: For Claude API (Tier 2)OPENAI_API_KEY: For OpenAI GPT API (Tier 2)GOOGLE_API_KEY: For Google Gemini API (Tier 2)LOCAL_LLM_ENDPOINT: Ollama endpoint (default: http://localhost:11434)LOCAL_LLM_MODEL_CHATTER: Fast model for chatter (llama3.2:8b)LOCAL_LLM_MODEL_ENHANCED: Quality model (qwen2.5:32b)ANTHROPIC_DAILY_BUDGET_USD: Daily budget limit ($10 default)
Target machine: Mac mini M4 Pro
- 14-core CPU, 20-core GPU, 16-core Neural Engine
- 64GB Unified Memory
- 2TB SSD
Recommended models:
- Chatter: Llama 3.2 8B, Phi-4 14B
- Enhanced: Qwen 2.5 32B, Mistral Small 3 24B
- Fallback: Qwen 2.5 72B-Q4 (when external budget exhausted)
- Base URL:
/api - Authentication: Bearer token (for protected endpoints)
- Response format: JSON with consistent structure
- Namespace: Default
- Key events:
activity:event,agent:chatter,agora:message - Auto-reconnect: 5 attempts, 1-second interval
- Unit tests: Vitest
- Integration tests: Playwright
- API tests: Supertest
- Coverage target: 80%+
- URL: https://algora.moss.land
- Architecture: nginx (Lightsail) → pm2 (Local Machine)
- Lightsail Server: 13.209.131.190 (nginx reverse proxy + SSL)
- Local Machine: 211.196.73.206 (pm2 managed services)
- Frontend: http://localhost:3200
- Backend API: http://localhost:3201
# Start with pm2
pm2 start ecosystem.config.cjs
# View status
pm2 status
# View logs
pm2 logs algora-api
pm2 logs algora-web
# Restart
pm2 restart all- SQLite with WAL mode (single-server deployment)
- Path:
apps/api/data/algora.db
- Components: PascalCase (
AgentAvatar.tsx) - Utilities: camelCase (
formatDate.ts) - Types: PascalCase with
.types.tssuffix - Tests: Same name with
.test.tssuffix
- Human Sovereignty: AI only recommends; humans make final decisions
- Auditability: All outputs must include provenance metadata
- Cost Control: Always check budget before Tier 2 operations
- Documentation Sync: Korean translations must match English versions
When starting a new session, follow these steps:
- Read Status: Check
DEVELOPMENT_STATUS.mdfor current progress - Check Git: Run
git log --oneline -10andgit status - Start Servers: Run
pnpm dev(or start api/web separately) - Continue Work: Follow the "Next Steps" in DEVELOPMENT_STATUS.md
- Update Docs: After significant changes, update:
DEVELOPMENT_STATUS.md- Progress trackingCHANGELOG.md- Version history- Korean translations if docs changed
- pm2 process management (
ecosystem.config.cjs) - nginx reverse proxy on Lightsail with SSL
- Fixed Next.js i18n middleware for static assets
- Location:
apps/web/src/app/[locale]/governance/page.tsx - Components:
apps/web/src/components/governance/PipelineVisualization.tsx- 9-stage pipeline displayWorkflowCard.tsx- Workflow type cards (A-E)DocumentCard.tsx- Official document cardsDualHouseVoteCard.tsx- Dual-house votingLockedActionCard.tsx- Safe autonomy actions
- API:
/governance-os/*endpoints
@algora/safe-autonomy- LOCK/UNLOCK, Risk Classification@algora/orchestrator- Workflow State Machine, 5 Workflows (A-E)@algora/document-registry- 15 Document Types, Versioning@algora/model-router- LLM Routing, Ollama Provider@algora/dual-house- Dual-House Governance@algora/governance-os- Unified Integration Layer
- Location:
apps/web/src/app/[locale]/live/page.tsx - Real-time dashboard with WebSocket updates
- Hydration Safety: Use deterministic initial values, randomize only after mount
- API URL: Use
NEXT_PUBLIC_API_URLenv var for API server URL - Socket Events:
signals:collected,agent:chatter,activity:event,agora:message - i18n Middleware: Exclude
_next,api,favicon.icofrom locale processing
Last Updated: 2026-01-13 Version: 0.12.3