AI Agent Coordination Guide
This document explains how AI coding assistants are configured in this repo and how to avoid conflicts when using multiple tools simultaneously.
The Problemโ
When two AI tools (e.g. GitHub Copilot + Gemini) edit the same codebase independently, they can:
- Generate conflicting field names (e.g. one uses
url, another usescdnUrl) - Use different enum casing (
ACTIVEvsactive) - Make incompatible architectural decisions
- Introduce circular dependencies the other tool doesn't know about
- Upgrade packages the other tool's assumptions depend on
The Solution: Single Source of Truthโ
All AI tools in this repo are pointed at the same contract files:
| File | Read by | Purpose |
|---|---|---|
AGENTS.md | Gemini CLI, Claude Code, Cursor, any tool that reads root files | Full contract: conventions, field names, module patterns, forbidden patterns |
.github/copilot-instructions.md | GitHub Copilot (in-editor) | Summary of the same contract, Copilot-specific format |
Both files say the same things. If you update one, update the other.
Which Tool to Use for Whatโ
| Task | Preferred Tool | Reason |
|---|---|---|
| Generate new NestJS module (boilerplate) | Either | Both understand NestJS patterns. Check AGENTS.md first. |
| Prisma schema changes | Carefully in one tool only | Run prisma migrate dev and prisma generate after any change before switching tools. |
| New API endpoint | One tool per feature | Avoid two tools editing the same controller simultaneously. |
| Frontend pages / components | Either | Web is well-isolated. Less risk of conflict. |
| TypeScript type errors | Either | Both can read the Prisma schema. |
| Architecture decisions | Read apps/docs/docs/staff/ docs first | Never let an AI make structural decisions without human review. |
Workflow to Avoid Conflictsโ
Before starting a session with any AI tool:โ
git statusโ confirm clean working treegit pullโ pull latest- Run
npx tsc --noEmitinapps/apiandapps/workerโ confirm zero errors before you start
During a session:โ
- Work on one feature/file set at a time
- Do not let two tools edit the same module simultaneously
- After any tool makes changes: commit or stash before switching tools
After a session:โ
npx tsc --noEmitin every changed app- Review diffs for field names and enum values before committing
- Commit with a message that names which tool made the change (optional but helpful for blame)
Current Known Gotchas (learned from experience)โ
These are bugs that have been introduced and fixed โ every AI must know them:
| Gotcha | Correct |
|---|---|
ImageFile.url | โ ImageFile.cdnUrl |
ImageFile.sizeBytes | โ ImageFile.fileSizeBytes (and it's BigInt) |
ImageFile.exifData | Field does not exist โ EXIF goes on the Image model or is discarded |
Location.lat / .lng | โ Location.latitude / .longitude |
User.displayName | Field removed โ use firstName + lastName |
ImageStatus.PENDING_REVIEW | โ ImageStatus.pending_review |
Role.ADMIN | โ Role.admin |
user.sub | โ user.id (JWT strategy returns { id, email, role }) |
IMAGE_PROCESS_QUEUE from queue.module.ts | โ import from queue.constants.ts |
BullModule.forRoot() in QueueModule with @Global() | โ forRoot stays in AppModule |
experimental.typedRoutes in next.config | โ top-level typedRoutes: true |
middleware.ts in Next.js 16+ | โ rename to proxy.ts, export proxy function |
| Storage backend hard-coded to R2 | โ use runtime storage config and StorageService |
| Photoshoot location without coordinates | โ use upload-style address lookup/geocoding path |
| Automatic payout on photoshoot completion | โ credit wallet only; payouts are explicit requests |
Architecture Docs Referenceโ
Before making structural changes, read the relevant doc:
| Topic | Doc |
|---|---|
| What is in / out of MVP | apps/docs/docs/staff/01-mvp-scope.md |
| System overview | apps/docs/docs/staff/02-architecture-overview.md |
| All tech choices with rationale | apps/docs/docs/staff/03-tech-stack.md |
| Directory layout | apps/docs/docs/staff/04-monorepo-structure.md |
| Database schema | apps/docs/docs/staff/05-database-schema.md |
| REST endpoints | apps/docs/docs/staff/06-api-modules.md |
| Upload & storage pipeline | apps/docs/docs/staff/07-storage-upload-pipeline.md |
| Search & map | apps/docs/docs/staff/08-search-and-map.md |
| Auth & RBAC | apps/docs/docs/staff/09-auth-and-authz.md |
| Admin portal | apps/docs/docs/staff/10-admin-features.md |
| CI/CD | apps/docs/docs/staff/11-cicd-deployment.md |
| Phase roadmap | apps/docs/docs/staff/12-roadmap.md |