- Core logic lives in
src/learning_agent/; the Typer CLI entrypoint iscli.py, REST surfaces live inserver.pyandapi_server.py, and subpackages implement learning flows, tool wiring, and provider adapters. - Tests reside in
tests/alongside pytest fixtures; add new suites undertests/test_<feature>.py. - Operational assets include the
Makefile,docker-compose.yml,Dockerfile.*, helperscripts/, and the React UI underui/. Copy.env.examplewhen configuring new environments.
make installinstalls runtime dependencies via uv; usemake install-devfor the full contributor toolchain.make devruns the API with auto-reload;make runexecutes the CLI entrypoint locally.- Containers:
make docker-uplaunches Postgres, API, and UI; pair withmake docker-downormake docker-restartwhen services drift. - Quality gates:
make lint,make format,make typecheck, andmake securitywrap ruff, formatting, mypy, and bandit. Runmake pre-commitbefore opening a PR. - Tests:
make testexecutes the suite in Docker;make test-localandmake test-cov-localrun pytest locally with optional coverage HTML.
Target Python 3.11+, stick to ≤100-character lines, and prefer explicit type hints. Use double quotes, snake_case modules, CamelCase classes, and UPPER_SNAKE constants. Format imports and code with make format; add brief comments only for non-obvious logic.
Name test files tests/test_<area>.py and functions test_*. Keep fixtures deterministic, mark integration or slow cases with @pytest.mark.integration / @pytest.mark.slow, and ensure coverage stays healthy via make test-cov-local or the Docker equivalent.
Follow Conventional Commits (e.g., feat(server): add retry guard) and keep subjects ≤100 characters. PRs should link issues (Closes #123), summarize intent, flag breaking changes, and attach relevant logs or screenshots. Confirm CI is green before requesting review.
Never commit secrets. Duplicate .env.example to .env for local credentials. Use make install-sandbox and make verify-sandbox when working in the GitHub sandbox, and rebuild containers with make docker-build after dependency or Dockerfile updates.