Files
orangecat/docs/standards/engineering_principles.md
T
g-butandClaude Opus 4.5 2df79381f1 feat: streaming AI, canonical rate limiting, cleanup demo pages
Major changes:
- AI streaming: Add unified client for OpenRouter SSE and local (Ollama) providers
- Local AI detection: Auto-detect and configure local model providers
- Rate limiting: Canonical adapters with X-RateLimit-* headers across APIs
- SSE: Add lib/sse.ts for consistent event-stream parsing

Cleanup:
- Remove /demo, /donate, /fund-us, /funding, /fundraising pages
- Simplify ModelSelector component (288 → 80 lines)
- Consolidate timeline queries

New features:
- Voice input component and hook
- Query provider for React Query
- Model registry with status badges
- HTTP headers config

Tests & Docs:
- E2E tests for project creation wizard
- Unit tests for auth, streaming, components
- CHANGELOG.md for version tracking
- Deployment checklist and PR summary docs

Bug fixes:
- Timeline schema and functions migration fixes
- Messaging RLS recursion fix
- Auth callback improvements
- Bitcoin formatting precision
- Lint fixes for unused variables

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 16:02:26 +01:00

2.5 KiB

created_date, last_modified_date, last_modified_summary
created_date last_modified_date last_modified_summary
2026-01-18 2026-01-18 Initial engineering principles (privacy/local-first, SSOT/DRY/SoC, a11y, security-by-default)

Engineering Principles

These principles guide feature design and implementation across Orangecat.

Product Principles

  • Privacy-first: Minimize data collection and retention; private by default; explicit user actions to persist/share.
  • Local-first: Prefer local execution paths when feasible; remote as opt-in or fallback.
  • Progressive disclosure: Simple defaults; reveal complexity only when needed.
  • Empower users: Provide model choice and clear trade-offs (cost, rate limits, capabilities).

Technical Principles

  • SSOT: Single sources of truth for entities, models, navigation, and configuration.
  • DRY: Reuse workflows/components (CreateEntityWorkflow, EntityForm, ModelSelector, etc.).
  • Separation of concerns: Thin UI; provider adapters; clear API surfaces; isolated persistence concerns.
  • SSR safety: Guard browser-only features with 'use client' and runtime checks.
  • Accessibility: Keyboard navigation, visible focus, proper aria labels, readable contrast.

Security Principles

  • Least privilege: Scope keys, tokens, and access; never expose secrets to the client.
  • Encrypt at rest: BYOK/API keys encrypted using AES-256-GCM with dedicated secrets.
  • No sensitive content logging: Avoid logging chat contents or PII; use structured metadata only.
  • Feature flags: Gate non-critical features and risky integrations.
  • Defense in depth: Rate limiting, RLS, CSP/headers, dependency scanning.

Observability & Quality

  • Errors: User-friendly messages; structured error responses; correlation IDs where applicable.
  • Tests: Unit + integration for core logic; E2E for critical flows; mock external services.
  • Performance: Streaming for incremental UX; avoid heavy client bundles; cache where appropriate.
  • Documentation: ADRs for key decisions; specs for reusable components; update docs with code changes.

Application to AI/Voice Features

  • Private chat: No server-side persistence of My Cat chats by default; only explicit conversion to entities persists.
  • Model choice: Local runtime support (Ollama/LM Studio) and BYOK with encrypted storage; offer a client-only key mode where practical.
  • Voice input: Default to browser Web Speech API; future optional local Whisper endpoint; no audio uploads by default.
  • Prefill flows: Use localStorage as a transient bridge; keep server decoupled from chat.