Rewind — building the product
Rewind is a digital second brain: it captures traces of a user's day (voice, text, photos), stores them as searchable memories, and lets the user rewind by asking in plain language. The full spec is SRS-Rewind-EN.md at the repo root — read the relevant FR/NFR section before implementing a feature, and cite the requirement ID (e.g. FR-1.3) in commits/PRs so work stays traceable.
This skill orients you on the project. The design system already exists in Rewind Design System/ (link styles.css, use its tokens and the MemoryCard / VoiceButton / SourceChip components) — invoke the rewind-design skill for anything visual.
The three non-negotiables
Every change must hold all three at once. When a task touches one deeply, delegate to the matching sub-agent rather than doing it inline.
- Accessibility — WCAG 2.2 AA (core value, not an add-on). Voice + keyboard must do everything, without looking at the screen (NFR-A11Y-2). ≥44px touch targets, 4.5:1 text contrast, semantic HTML + ARIA + live regions, visible focus, never color alone, alt text on every image,
prefers-reduced-motion respected. → delegate review to accessibility-reviewer.
- Zero additional cost (C-2 / NFR-COST-1). Every component must always have a $0 open-source / free-tier path. No paid API as the only option. Local-first by default. → delegate audits to zero-cost-guardian.
- Privacy by design (NFR-SEC-1/2/3, C-4). Personal data (audio, images, transcripts, PII) stays local; passwords hashed; every API authenticated; per-user data isolation. Local-first mode means no data leaves the machine.
Tech stack (C-1 — fixed)
- Frontend/API: Next.js + TypeScript (App Router; routes
/timeline, /chat, /recall). API Routes / Route Handlers; SSE streaming for chat (FR-3.4, §5.4).
- AI Layer: LLM + RAG behind an OpenAI-compatible interface so Local (Ollama) ↔ free-tier (Gemini/Groq) is a config swap, not a code change (§8.3, NFR-MAINT-1).
- Embeddings: Ollama
nomic-embed-text / bge-m3 (local) or Gemini free tier.
- STT: self-hosted Whisper (
faster-whisper / whisper.cpp), Thai + English (FR-4.2). Server-side.
- TTS: Web Speech API (
SpeechSynthesis) in the browser; fallback to local Piper if no Thai voice (FR-5.4).
- Data: PostgreSQL + pgvector via Drizzle ORM; HNSW index for ANN search. Media files on a Docker volume — DB stores only the path/URL (§7.2).
- Infra: Docker / Docker Compose —
docker compose up must bring up the whole system on Linux/macOS/Windows(WSL2) (C-5, NFR-PORT-1).
Reference project structure is in SRS §9.2 (apps/web/, db/, services/whisper/, docker-compose.yml).
Data model (SRS §7)
USER 1—* MEMORY (type: voice|text|image|chat) 1—0..1 EMBEDDING (pgvector); USER 1—* CONVERSATION 1—* MESSAGE; MEMORY — PERSON. Memories carry occurred_at (event time) distinct from created_at. Reliability rule (NFR-REL-1): if AI/STT is down, store raw data first and process later — never drop a capture.
Content & voice (from the design system)
Sentence case everywhere. Address the user as "you"; the product is "Rewind" (third person, never "I"). Verbs first on actions ("Record a memory", "Ask Rewind", "Read aloud"). Be honest about limits — if no memory matches, say so and never fabricate (FR-1.6); grounded answers always cite their source memory (FR-1.4). No emoji, no hype words. Human time in UI ("Yesterday · 3:42 PM"), ISO only in mono metadata.
How to work a feature
- Read the matching FR/NFR in
SRS-Rewind-EN.md; note the acceptance criteria and priority.
- Build with design-system tokens/components (invoke
rewind-design for visuals).
- Keep the AI provider behind the OpenAI-compatible config seam.
- Before calling it done, run the relevant specialist sub-agent(s) below.
Specialist sub-agents (in .claude/agents/)
- accessibility-reviewer — audit any UI/component/page against WCAG 2.2 AA + the SRS a11y requirements. Run after building or changing anything user-facing.
- rag-pipeline-engineer — design/implement ingestion + recall: chunking, embeddings, pgvector schema & HNSW, top-k semantic search, grounded generation with source citations, the provider-swap seam.
- zero-cost-guardian — audit dependencies, services, and config for any forced paid path; verify a local-first $0 route and the free-tier fallback exist.
- docker-infra-engineer — containerization & local-first infrastructure: the Docker Compose topology (Next.js + Ollama + Whisper + Postgres/pgvector), volumes, healthchecks, migrations on boot, and the single-command
docker compose up reproducibility (C-5, NFR-PORT-1).
1---2name: rewind3description: Rewind — building the product4---56# Rewind — building the product78Rewind is a **digital second brain**: it captures traces of a user's day (voice, text, photos), stores them as searchable *memories*, and lets the user **rewind** by asking in plain language. The full spec is `SRS-Rewind-EN.md` at the repo root — read the relevant FR/NFR section before implementing a feature, and cite the requirement ID (e.g. FR-1.3) in commits/PRs so work stays traceable.910This skill orients you on the project. The design system already exists in `Rewind Design System/` (link `styles.css`, use its tokens and the MemoryCard / VoiceButton / SourceChip components) — invoke the `rewind-design` skill for anything visual.1112## The three non-negotiables1314Every change must hold all three at once. When a task touches one deeply, delegate to the matching sub-agent rather than doing it inline.15161. **Accessibility — WCAG 2.2 AA (core value, not an add-on).** Voice + keyboard must do everything, without looking at the screen (NFR-A11Y-2). ≥44px touch targets, 4.5:1 text contrast, semantic HTML + ARIA + live regions, visible focus, never color alone, alt text on every image, `prefers-reduced-motion` respected. → delegate review to **accessibility-reviewer**.172. **Zero additional cost (C-2 / NFR-COST-1).** Every component must always have a $0 open-source / free-tier path. No paid API as the only option. Local-first by default. → delegate audits to **zero-cost-guardian**.183. **Privacy by design (NFR-SEC-1/2/3, C-4).** Personal data (audio, images, transcripts, PII) stays local; passwords hashed; every API authenticated; per-user data isolation. Local-first mode means no data leaves the machine.1920## Tech stack (C-1 — fixed)2122- **Frontend/API:** Next.js + TypeScript (App Router; routes `/timeline`, `/chat`, `/recall`). API Routes / Route Handlers; SSE streaming for chat (FR-3.4, §5.4).23- **AI Layer:** LLM + RAG behind an **OpenAI-compatible interface** so Local (Ollama) ↔ free-tier (Gemini/Groq) is a config swap, not a code change (§8.3, NFR-MAINT-1).24- **Embeddings:** Ollama `nomic-embed-text` / `bge-m3` (local) or Gemini free tier.25- **STT:** self-hosted Whisper (`faster-whisper` / `whisper.cpp`), Thai + English (FR-4.2). Server-side.26- **TTS:** Web Speech API (`SpeechSynthesis`) in the browser; fallback to local Piper if no Thai voice (FR-5.4).27- **Data:** PostgreSQL + **pgvector** via **Drizzle ORM**; HNSW index for ANN search. Media files on a Docker volume — DB stores only the path/URL (§7.2).28- **Infra:** Docker / Docker Compose — `docker compose up` must bring up the whole system on Linux/macOS/Windows(WSL2) (C-5, NFR-PORT-1).2930Reference project structure is in SRS §9.2 (`apps/web/`, `db/`, `services/whisper/`, `docker-compose.yml`).3132## Data model (SRS §7)3334`USER` 1—* `MEMORY` (type: voice|text|image|chat) 1—0..1 `EMBEDDING` (pgvector); `USER` 1—* `CONVERSATION` 1—* `MESSAGE`; `MEMORY` *—* `PERSON`. Memories carry `occurred_at` (event time) distinct from `created_at`. Reliability rule (NFR-REL-1): if AI/STT is down, **store raw data first** and process later — never drop a capture.3536## Content & voice (from the design system)3738Sentence case everywhere. Address the user as "you"; the product is "Rewind" (third person, never "I"). Verbs first on actions ("Record a memory", "Ask Rewind", "Read aloud"). **Be honest about limits** — if no memory matches, say so and never fabricate (FR-1.6); grounded answers always cite their source memory (FR-1.4). No emoji, no hype words. Human time in UI ("Yesterday · 3:42 PM"), ISO only in mono metadata.3940## How to work a feature41421. Read the matching FR/NFR in `SRS-Rewind-EN.md`; note the acceptance criteria and priority.432. Build with design-system tokens/components (invoke `rewind-design` for visuals).443. Keep the AI provider behind the OpenAI-compatible config seam.454. Before calling it done, run the relevant specialist sub-agent(s) below.4647## Specialist sub-agents (in `.claude/agents/`)4849- **accessibility-reviewer** — audit any UI/component/page against WCAG 2.2 AA + the SRS a11y requirements. Run after building or changing anything user-facing.50- **rag-pipeline-engineer** — design/implement ingestion + recall: chunking, embeddings, pgvector schema & HNSW, top-k semantic search, grounded generation with source citations, the provider-swap seam.51- **zero-cost-guardian** — audit dependencies, services, and config for any forced paid path; verify a local-first $0 route and the free-tier fallback exist.52- **docker-infra-engineer** — containerization & local-first infrastructure: the Docker Compose topology (Next.js + Ollama + Whisper + Postgres/pgvector), volumes, healthchecks, migrations on boot, and the single-command `docker compose up` reproducibility (C-5, NFR-PORT-1).