Add two new sections to AGENTS.md and CLAUDE.md: - .memory Files: consult knowledge.md, decisions.md, plans/, research/ at task start - Instruction File Sync: keep AGENTS.md, CLAUDE.md, .cursorrules, and Copilot CLI instructions in sync when any is updated Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
4.6 KiB
4.6 KiB
Voyage Development Instructions (OpenCode)
Project
- Name: Voyage
- Purpose: Self-hosted travel companion web app (fork of AdventureLog)
- Stack: SvelteKit 2 (TypeScript) frontend · Django REST Framework (Python) backend · PostgreSQL + PostGIS · Memcached · Docker · Bun (frontend package manager)
Architecture Overview
- API proxy pattern: Frontend never calls Django directly. All API calls go through
frontend/src/routes/api/[...path]/+server.ts, which proxies tohttp://server:8000, handles cookies, and injects CSRF behavior. - AI chat: Embedded in Collections → Recommendations via
AITravelChat.sveltecomponent. No standalone/chatroute. Provider list is dynamic from backendGET /api/chat/providers/(sourced from LiteLLM runtime + custom entries likeopencode_zen). Chat conversations use SSE streaming via/api/chat/conversations/. Chat composer supports per-provider model override (persisted in browserlocalStorage). LiteLLM errors are mapped to sanitized user-safe messages via_safe_error_payload()(never exposes raw exception text). - Service ports:
web→:8015server→:8016db→:5432cache→ internal only
- Authentication: Session-based via
django-allauth; CSRF token from/auth/csrf/; mutating requests sendX-CSRFToken; mobile middleware path supportsX-Session-Token.
Codebase Layout
- Backend:
backend/server/- Apps:
adventures/,users/,worldtravel/,integrations/,achievements/,chat/ - Chat provider config:
backend/server/chat/llm_client.py(CHAT_PROVIDER_CONFIG)
- Apps:
- Frontend:
frontend/src/- Routes:
src/routes/ - Shared types:
src/lib/types.ts(includesChatProviderCatalogEntry) - Components:
src/lib/components/(includesAITravelChat.svelte) - i18n:
src/locales/
- Routes:
Development Commands
Frontend (prefer Bun)
cd frontend && bun run formatcd frontend && bun run lintcd frontend && bun run checkcd frontend && bun run buildcd frontend && bun install
Backend (Docker required; prefer uv for local Python tooling)
docker compose exec server python3 manage.py testdocker compose exec server python3 manage.py migrate
Docker
docker compose up -ddocker compose down
Pre-Commit Checklist
Run in this order:
cd frontend && bun run formatcd frontend && bun run lintcd frontend && bun run checkcd frontend && bun run build
Known Issues (Expected)
- Frontend
bun run check: 0 errors + 6 warnings expected (pre-existing inCollectionRecommendationView.svelte+RegionCard.svelte) - Backend tests: 6/30 fail (pre-existing: 2 user email key errors + 4 geocoding API mocks)
- Docker dev setup has frontend-backend communication issues (500 errors beyond homepage)
Key Patterns
- i18n: use
$t('key')for user-facing strings - API calls: route through proxy at
/api/[...path]/+server.ts - Styling: use DaisyUI semantic colors/classes (
bg-primary,text-base-content, etc.) - Security: handle CSRF tokens via
/auth/csrf/andX-CSRFToken - Chat providers: dynamic catalog from
GET /api/chat/providers/; configured inCHAT_PROVIDER_CONFIG - Chat model override: composer text input for per-provider model selection; persisted in
localStoragekeyvoyage_chat_model_prefs; backend accepts optionalmodelparam insend_message - Chat error surfacing:
_safe_error_payload()maps LiteLLM exceptions to sanitized user-safe categories (never forwards rawexc.message)
Conventions
- Do not attempt to fix known test/configuration issues as part of feature work.
- Use
bunfor frontend commands,uvfor local Python tooling where applicable. - Commit and merge completed feature branches promptly once validation passes (avoid leaving finished work unmerged).
.memory Files
- At the start of any task, read
.memory/knowledge.mdand.memory/decisions.mdfor project context. - Check relevant files in
.memory/plans/and.memory/research/for prior work on related topics. - These files capture architectural decisions, code review verdicts, security findings, and implementation plans from prior sessions.
- Do not duplicate information from
.memory/into code comments — keep.memory/as the single source of truth for project history.
Instruction File Sync
AGENTS.md(OpenCode),CLAUDE.md(Claude Code),.cursorrules(Cursor), and the Copilot CLI custom instructions must always be kept in sync.- Whenever any of these files is updated (new convention, new decision, new workflow rule), apply the equivalent change to all the others.