# @coda/server

Express API server and AI agent loop for the Abacus royalties platform. Handles chat sessions, tool execution, streaming responses, and conversation caching via Redis.

## Quick start

```bash
cp .env.shadow .env   # fill in required values
pnpm --filter @coda/server dev
```

Server runs on `http://localhost:8080` by default.

## Docs

- [Architecture](../../ARCHITECTURE.md)
- [API Reference](../../docs/api/server.md)
- [Tool Catalog](../../docs/api/tool-catalog.md)
- [Testing](../../docs/guides/testing.md)
- [Runbook](../../docs/operations/runbook.md)

## Key files

- `src/index.ts` — entry point (starts the server)
- `src/server.ts` — Express app setup, middleware, route mounting
- `src/ai/` — agent loop, orchestrator, tool registry, skills, providers
- `src/routes/` — HTTP and SSE route handlers
- `src/cache/` — Redis-backed conversation and response caching
- `src/config/` — environment config loading and validation
- `src/middleware/` — auth, rate limiting, request logging
- `.env.shadow` — env template
