Telegraph style. Root rules only. Read scoped AGENTS.md before touching a subtree. Every rule actionable. See
CLAUDE.mdfor the thin router + full doc index.
- Version 0.5.2. Status: 82 sprints done, 3,035 unit tests passing, 0 failures.
- Primary entry point for human context:
CLAUDE.md(thin router). - Primary entry point for Codex CLI / Gemini CLI: this file.
- Detailed docs:
docs/*.md. Never load all at once.
domain/— pure business logic, zero deps. Never imports SQLAlchemy / FastAPI / LiteLLM.application/— use cases, DTOs.infrastructure/— port impls, LLM gateway, LAEE, agent CLI drivers, persistence.interface/— FastAPI + CLI entry points, DI wiring.shared/— cross-cutting (config only).tests/{unit,integration,e2e}/— TDD, unit runs DB-free.migrations/— Alembic async.ui/— Next.js 15 dark theme.specs/— spec-driven feature folders..specify/— constitution + templates..claude/agents/— subagents..claude/skills/— skills..claude/commands/— slash commands.
- 4-layer Clean Architecture:
Interface → Application → Domain ← Infrastructure. - Dependency rule: inner layers never import outer. Reverse via
domain/ports/*ABCs. - 23 ports, 17 use cases, 18 domain services, 6 agent CLI drivers.
- Execution priority: Engine routing → ReactExecutor fallback → Direct LLM fallback.
- Fractal bypass: LLM intent analysis classifies SIMPLE vs COMPLEX; SIMPLE skips planning (TD-167).
- Persistence: PG (primary), SQLite (fallback), InMemory (default).
uv sync— install deps.uv run --extra dev pytest tests/unit/ -v— fast unit tests (DB-free).uv run --extra dev pytest tests/integration/ -v— requires Docker Compose up.uv run --extra dev ruff check .— lint.uv run uvicorn interface.api.main:app --port 8001 --reload— dev server.morphic doctor check— health check.
- All unit tests pass (0 failures, 0 warnings).
- Lint clean (
ruff check). - No
domain/imports of infrastructure / framework code. - No
@importsexpanding CLAUDE.md past 40KB warning.
- Python:
from __future__ import annotations, Pydantic v2, async-first. - No emojis in code unless user asks.
- No trailing summary comments.
- Domain entities: immutable Pydantic models, no ORM.
- Ports: ABCs in
domain/ports/, implementations ininfrastructure/.
- TDD: RED → GREEN → REFACTOR. Never ship without tests.
- Unit tests mock ports; integration tests use real PG/Redis/Qdrant.
- Never mock the DB in tests that cover migrations.
- Commit messages: concise English, imperative mood.
- Never push to main without explicit user request.
- Never use
--no-verify,--no-gpg-signunless user asks. - 1 fix → commit & push → report. No batching.
- Secrets under
~/.ssh,~/.aws,.env→ CRITICAL risk level. - LAEE default approval mode:
confirm-destructive.full-autorequires explicit user opt-in. - All LAEE actions logged to
.morphic/audit_log.jsonl(append-only). - Risk classification is separate from approval transport (OpenClaw pattern).
- System prompt prefix must be stable. Never put timestamps in the first N bytes.
- Append-only context. Never edit past messages.
- Tool definitions: mask, don't delete. See
domain/services/tool_state_machine.py. - JSON/YAML serialization:
sort_keys=Truedeterministic.
- Long-running dev → OpenHands (Docker sandbox).
- Complex reasoning → Claude Code SDK.
- Long context (>100K) → Gemini CLI.
- Fast code gen → Codex CLI.
- Cost-zero / draft → Ollama (
qwen3:8b). - Workflow pipeline (Seq/Par/Loop) → Google ADK.
- Thin
CLAUDE.mdis the router. Full details indocs/<topic>.md. - Update
docs/CHANGELOG.mdfor any structural change. - Update
docs/CONTINUATION.mdat session end for handoff.
Add these as the codebase grows:
domain/AGENTS.md— domain invariants, ports contract rules.infrastructure/local_execution/AGENTS.md— LAEE-specific safety rules.infrastructure/agent_cli/AGENTS.md— engine driver conventions.interface/api/AGENTS.md— FastAPI + DI conventions.tests/AGENTS.md— TDD conventions, mock/real rules.
- OpenHands v0.59 sends
temperature+top_pto Claude API → rejected. Use Gemini or upgrade image. - OpenAI GPT-4o quota insufficient on this account; use
o4-mini. qwen3:8bis the default Ollama model (16GB RAM machines).- Fractal bypass misclassifies some complex tasks as SIMPLE — see Round 19 regression (TD-181).