AGENTS.md instructions for /Users/prayash/learn/agent-labs <INSTRUCTIONS> CLAUDE.md This…
- User
AGENTS.md instructions for /Users/prayash/learn/agent-labs
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Common commands
bash# Start everything locally (Temporal dev server + backend + frontend) make dev # Start local Postgres for app/test DBs docker compose up -d postgres # Run backend tests (starts local Postgres + ensures test DB, no real LLM calls) make test # Run a single test file cd backend && uv run pytest tests/test_workflow_exec.py -v # Run a single test by name cd backend && uv run pytest tests/test_agents_api.py::test_create_agent -v # Seed the database with templates and demo agents make seed # Format and lint make fmt # Upgrade all dependencies (enforces 14-day supply chain guard) make upgrade-deps # Kill all local services make kill # Stop local Postgres docker compose downThe backend runs on
http://localhost:8000, frontend onhttp://localhost:3000, Temporal UI onhttp://localhost:8233.Repository structure
codebackend/app/ api/ REST routers (agents, workflows, runs, messages, settings) + WebSocket db/ SQLAlchemy models, async session, init_db runtime/ Pure logic: agent_factory, tools, guardrails, conditions, cost temporal_app/ OrchestratorWorkflow, activities, in-process EventBus, worker channels/ Telegram long-polling poller seeds/ Idempotent seed for payments-demo agents + 2 workflow templates config.py Pydantic-settings Settings class (reads .env) main.py FastAPI factory + lifespan web/app/ agents/ Agent CRUD UI workflows/[id]/ React Flow visual builder runs/[id]/ Live event monitor (WebSocket) chat/ Telegram mirror settings/ BYOK form health/ GET /health — excluded from Basic Auth middleware web/lib/api.ts All REST + WS URL helpers; injects X-API-Key on every request web/middleware.ts HTTP Basic Auth (AUTH_PASSWORD env var); skips /health and static assets - User
<environment_context> /Users/prayash/learn/agent-labs zsh <current_date>2026-05-25</current_date> Asia/Kolkata </environment_context>
- User
investigate commit 4c754a8, is the docker-compose and .env.example change make sense?
- Assistant
I’ll check the prior repo context briefly, then inspect commit
4c754a8and compare the compose/env changes against the current app defaults and docs. - Assistant
The commit is the local Postgres setup commit. I’m reading the actual diffs and the DB/config/test code now, because the key question is whether the env values line up with what the app and tests really consume.
- Assistant
One important nuance: in
4c754a8itself,make testdid not yet start Postgres; the commit only added compose plus docs/env notes. I’m going to sanity-check the compose interpolation shape, then I’ll give you the review verdict. - Assistant
Findings:
-
docker/postgres/init/01-create-test-db.sql is broken.
CREATE DATABASE agent-lab_test;is invalid SQL becauseagent-lab_testcontains a hyphen. It should be:sqlCREATE DATABASE "agent-lab_test";Without this, first container init can fail before creating the test DB.
-
docker-compose.yml and .env.example otherwise make sense. The app URL
postgresql+asyncpg://localhost/agent-labomits a user, and compose defaults to , so asyncpg’s local username default should match the container DB user on macOS. resolves this correctly on this machine to .
-
- User
can we not have 'prayash'? I would want this to be personal information free
- Assistant
Yes. The current approach leaks the macOS username through Compose interpolation and also makes the URLs depend on local OS identity. I’ll switch the local DB user to a generic
postgres, update the documented/default URLs to include that user explicitly, and fix the quoted test DB name while I’m there. - Assistant
I’ve found all places where the local username behavior is encoded. The edit is small: compose gets a fixed generic user, env/test defaults get explicit
postgres@localhost, and the docs stop mentioning$USER. - Assistant
The code/docs are now personal-information-free for the local DB path. I’m validating the rendered Compose config and scanning for the old username-dependent URL pattern.
- User
run the tests to be sure
- Assistant
I’ll run the repo’s test target now. It should bring up Postgres and ensure the test database before pytest, so this verifies the compose/env path rather than just static config.
- Assistant
The test run exposed a real migration wrinkle: the existing local Docker volume was initialized with the previous username-based role, so changing
POSTGRES_USERnow does not rewrite the already-created cluster. Fresh checkouts will usepostgres, but this machine needs the local Postgres volume recreated before the tests can validate the new default. - Assistant
The stale local volume is gone. I’m rerunning
make testnow against a clean Postgres initialization, which is the case this repo will present to another developer. - Assistant
The clean run got past the role mismatch, but hit a second issue:
make teststarts Postgres and immediately runs pytest without waiting for the server to finish accepting connections. I’m checking container health/logs and will maketest-dbwait on Postgres before pytest. - Assistant
The logs confirm the race: pytest connected during Postgres’ init-time shutdown/restart window. I’m tightening readiness to wait for the final TCP listener, then I’ll rerun the tests.
- Assistant
Readiness now targets
127.0.0.1, so it won’t pass against Postgres’ temporary Unix-socket-only bootstrap server. I’m running the full test target again. - Assistant
Done. I removed the username-derived DB setup and made the local Postgres path generic:
docker-compose.ymlnow defaultsPOSTGRES_USERtopostgres, not${USER}..env.example,AGENTS.md, and test defaults now usepostgresql+asyncpg://postgres@localhost/....- Fixed the init SQL to quote
"agent-lab_test". - Added a
make testreadiness wait so pytest does not race Postgres during first-time initialization.
Verification:
make testnow passes:46 passed in 6.35s.- Scanned the touched tracked files for
prayash,$USER, old username-dependent URLs, and the bad unquoted SQL; no matches.
Note: I removed the existing local Postgres Docker volume during verification because it had been initialized with the old username-derived role. That was necessary for a clean test of the new default.