This file provides guidance to AI agents when working with the codebase.
The root project folder contains the following application:
backend:
stack: python, uv, fastapi, langchain, read pyproject.toml for more information.
description: This is the REST API for the ./frontend and ./cli clients.
deployment: https://chat.ruska.ai/docs
commands:
- `make test` Run ALL test cases (uses ENV_FILE=~/.env/orchestra/.env.backend).
- `make test ENV_FILE=~/.env/orchestra/.env.backend.test` Run tests with test env.
- `make format` Format project files with ruff. Use after making changes.
- `make lint` Lint check with ruff (no auto-fix).
- `make dev` Run dev server.
- `make seeds.user` Seed default users.
frontend:
stack: typescript, vite, react, shadcn, tailwind, read package.json for more details.
description: This is built during CI and bundled into the backend during `.github/build.yml`
deployment: https://chat.ruska.ai
commands: See package.json
website:
stack: typescript, nextjs, shadcn
description: Our main landing page
url: https://ruska.ai
commands: See package.json
wiki:
stack: typescript, react, docusaurus
description: Documentation for how to use the application interface of frontend and api of backend.
url: https://docs.ruska.ai
commands: See package.json
cli:
stack: typescript, react-ink
description: New server-side client we are working on for perform actions against the API
commands: See package.jsonThe main way external AI Agents find out information about RUSKA will be from the ./website/public/llm.txt that should ALWAYS reflect the current public documentation for LLM search engines. If something in the application is out of sync with this file we should make sure to update the file the llm.txt so that it reflects the most accurate picture of the application and how users can get the MOST out of it.
- Use Python 3.12+ features
- Follow PEP 8 conventions
- Type hints required for all functions
- Use Pydantic for data validation
backend/srccontains the FastAPI stack, with domain logic split intocontrollers,routes,services, andrepos, plus shared helpers incommonandutils.- Database assets live in
backend/migrationsandbackend/seeds; reusable automation sits underbackend/scripts. frontend/srchosts the Vite/React client (components,pages,routes,tests), whiledecks/,deployment/, anddocker/hold reference material and ops tooling.
- Setup: Run
make setupfrom the repo root to install pre-commit hooks. - Backend:
cd backend && uv venv && source .venv/bin/activate && uv syncinstalls dependencies,make devruns the API with reload, andmake testexecutes the suite. UseENV_FILE=~/.env/orchestra/.env.backend.testfor the test environment. - Frontend:
cd frontend && npm install,npm run devfor local dev,npm run buildfor production bundles, andnpm run docsregenerates MkDocs API docs. - Infrastructure:
docker compose up postgres pgadminprovisions Postgres + PgAdmin; stop withdocker compose down.
- When to use: Backend development requiring all API services (backend, worker, postgres, redis, search) running together via
docker-compose.dev.yml. - Start the stack:
make dev.docker.up— builds and starts all services in detached mode.- Override env files:
make dev.docker.up BACKEND_ENV_FILE=/path/to/.env - Default:
./backend/.env.docker.dev
- Override env files:
- Services and ports:
backend— :8000 (FastAPI with hot-reload)worker— TaskIQ worker (auto-reloads on code changes)postgres— :5432 (pgvector/pg16)redis— :6379search_engine— :8080 (SearXNG)dozzle— :8088 (container log viewer)
- Frontend: Run from the host (
cd frontend && npm run dev) and connect to the backend API on :8000. Use theagent-browserskill for browser-based testing. - Management commands:
make dev.docker.logs— tail logs for all services (override withDOCKER_DEV_LOG_SERVICES="backend worker")make dev.docker.ps— show running containersmake dev.docker.down— stop and clean upmake dev.docker.migrate— run Alembic migrations inside the backend container
- Optional sandbox:
COMPOSE_PROFILES=tools make dev.docker.upstartsexec_serveron :3005 for sandboxed code execution. - Key details: Source directories are volume-mounted for hot-reload. Backend runs
uv syncandalembic upgrade headon startup automatically.
- Run
pre-commit run --all-files; hooks run backend format/lint/test and frontend prettier/lint/test. - Python: ruff configured in
backend/pyproject.tomlwithline-length = 120, select["E", "F"]. Per-file E402 ignores for files withload_dotenv()before imports. Use 4-space indents,snake_casefiles, typed Pydantic models inbackend/src/schemas. - React: Prettier 2-space indent; components in
PascalCase, hooks incamelCase.
- Place backend unit specs in
backend/tests/unitand integration cases inbackend/tests/integration; seed demo data withpython -m seeds.user_seederwhen needed. - Frontend tests rely on Vitest and Testing Library (
npm run test,npm run test:watch,npm run test:coveragefor reports). - Use descriptive filenames (
tests/routes/test_agents.py,src/tests/AgentFlow.test.tsx) and assert observable behavior.
- Sign every commit with
git commit -s ...; keep subject lines imperative and reference issues or tickets when helpful. - Before opening a PR, ensure
uv run pytest,npm run test, and any affected docs or.envsamples reflect your changes; squash WIP noise locally. - PRs target
development, link tracking issues, provide concise change notes, and include screenshots or API traces for UI-facing work. - Foramt outputs from plan mode in
.claude/plans/[short-plan-desc].md
- EXTREMELY IMPORTANT: NEVER read a .env* file in your exploration.