Use when
- A WIN backend job endpoint or public DTO must be available in
../aipodcasting. - AIP frontend code needs generated job paths, job types, or DTO types from WIN.
- Contract sync, generated AIP types, or
lib/aip/contracts/**drift is involved.
Operating Rules
winowns contract sources;aipodcasting/lib/aip/contracts/**is generated output.- Run local sync; do not wait for CI or cloud cross-repo sync.
- Do not hand-edit generated files under
aipodcasting/lib/aip/contracts/**. - Generated job endpoint IDs are path slugs: strip slashes and replace
/and-with_. Example:/operations/episodes/retry-ingestbecomesoperations_episodes_retry_ingest. Verify the final key inaipodcasting/lib/aip/contracts/job-endpoints.ts. - Keep database models internal; expose public DTOs only.
- Ask only when frontend fields or UX placement cannot be inferred safely.
- Do not commit or push unless the user explicitly asks or repo-local automation handles it.
Workflow
- Inspect repo state:
Work around unrelated local changes; do not revert them.git -C /Users/dobby/GitHub/win status -sb git -C /Users/dobby/GitHub/aipodcasting status -sb - For backend changes in
win:- For job endpoints, keep
@register_endpointmetadata and request/result schemas contractable. - For synchronous UI data, define or update a public Pydantic response DTO and set
response_model=.... - Add frontend-consumed DTOs to
PUBLIC_DTOSinscripts/contracts/export_public_dto_contracts.py. - Map DB/internal models to DTOs explicitly.
- For job endpoints, keep
- Run generated sync from
win:
The wrapper exports job contracts, clears stale generated DTO output, writes current DTOs, and formats with AIP's Biome config.cd /Users/dobby/GitHub/win scripts/local/sync_aip_contracts.sh - If frontend work is needed in
aipodcasting:- Import generated types from
lib/aip/contracts/**. - Submit jobs through the generic AIP job proxy using generated endpoint IDs/paths.
- For synchronous reads or writes, add thin Next.js API proxies to WIN; do not add MongoDB access.
- Keep feature-local filters, form state, and UI-only types outside generated contracts.
- Import generated types from
- Validate:
- Confirm expected generated files exist under
../aipodcasting/lib/aip/contracts/**. - Run
scripts/local/check_aip_contracts_drift.shwhen you need a non-mutating stale-contract check. - Run focused backend tests for changed WIN contract exporters or handlers.
- Run
pnpm type-checkin../aipodcastingwhen frontend TypeScript or contract consumers changed. - Report
git status -sbfor both repos.
- Confirm expected generated files exist under
References
win/AGENTS.mdwin/docs/references/api-endpoint-implementation.mdwin/docs/references/scripts-and-tools-reference.mdwin/scripts/local/sync_aip_contracts.shaipodcasting/AGENTS.mdaipodcasting/docs/references/aip-backend-integration.mdaipodcasting/docs/references/aip-integration-patterns.md