# TalkEdit Copilot Instructions (Living Project Context) Purpose: give AI assistants immediate, accurate context for this repository and define what must be kept in sync when the project evolves. ## How To Use This File - This is a workspace instruction file for VS Code Chat/Copilot. - Treat this as the first source of truth for architecture and workflow expectations. - If your code changes make any section outdated, update this file in the same change. ## Project Snapshot - Name: TalkEdit - Product: local-first, AI-powered, text-based audio/video editor. - Primary runtime: Tauri + React frontend + Python FastAPI backend. - Desktop only (Electron has been removed; Tauri is the exclusive desktop runtime). ## Tech Stack - Frontend: React 19, TypeScript, Vite, Tailwind, Zustand. - Desktop bridge: Tauri API (IPC commands via `window.electronAPI` polyfill in `frontend/src/lib/tauri-bridge.ts` for unified call-site interface). - Backend: FastAPI + Uvicorn (`backend/main.py`) with routers in `backend/routers` and core services in `backend/services`. - Media tooling: FFmpeg for edit/export and codec operations. - AI tooling: WhisperX/faster-whisper for transcription; provider layer supports OpenAI/Anthropic/Ollama. ## Code Map - `frontend/src/components`: editor UI (player, transcript, waveform, settings, export, AI panel). - `frontend/src/store`: Zustand state (`editorStore`, `aiStore`). - `frontend/src/hooks`: keyboard/video sync behavior. - `backend/routers`: API surface (`/transcribe`, `/export`, `/ai/*`, `/captions`, `/audio/*`). - `backend/services`: heavy operations (transcription, captioning, diarization, video editing, cleanup). - `shared/project-schema.json`: saved project schema contract. - `src-tauri`: Rust/Tauri host code and app configuration. ## Run And Build (Preferred) - Frontend dev: `npm run dev` - Backend dev: `npm run dev:backend` - Tauri dev: `npm run dev:tauri` - Tauri build: `npm run build:tauri` Use project virtualenvs where available (`.venv312`, `.venv`, or `venv`) for backend execution. ## Working Conventions - Keep router files thin; put heavy logic in `backend/services`. - Preserve response compatibility for existing frontend callers unless task explicitly allows API breakage. - Frontend uses unified `window.electronAPI` interface (Tauri-backed via tauri-bridge.ts); desktop APIs are implemented exclusively in Tauri. - Prefer small, focused edits over broad refactors. ## Known Risk Areas - Startup/rendering on Linux WebKit can regress when reintroducing remote fonts/CSP allowances; prefer local font assets. - Media URL handling between project load paths should remain consistent to avoid format-specific regressions (especially WAV/MP3 behavior). - Export pipeline changes must preserve caption modes (`none`, `sidecar`, `burn-in`) and audio enhancement behavior. - WAV export uses `pcm_s16le` codec — only available for audio-only inputs (no video stream). Format selector conditionally shows WAV based on input file extension. - `` elements in ExportDialog use `[color-scheme:dark]` to ensure readable native dropdown popups on Linux WebKit. ## Update Rules (Important) When a task changes architecture, app wiring, commands, API shape, project schema, or major conventions, update this file before finishing. Always update these sections if affected: - `Project Snapshot` - `Tech Stack` - `Code Map` - `Run And Build (Preferred)` - `Working Conventions` - `Known Risk Areas` - Recent changes section (if applicable) - `Code Map` - `Run And Build (Preferred)` - `Known Risk Areas` If behavior changed significantly, add a short note under a new `Recent Changes` section with: - Date (`YYYY-MM-DD`) - What changed - What future edits should preserve ## Assistant Behavior For This Repo - Validate assumptions against current files before editing. - Prefer existing patterns in neighboring files over introducing new patterns. - Call out uncertainty explicitly when code and docs disagree. - If you discover stale docs, fix them as part of the same task when reasonable.