# Implementation status & maintenance guide

The platform is **fully implemented and deployed**. This document replaces the
original phased build plan (which targeted a Next.js + Qdrant architecture that was
never shipped). It describes what exists today and where to work.

---

## Build status

| Area | Status | Where it lives |
|---|---|---|
| Auth & onboarding | ✅ shipped | `src/store/AppContext.jsx`, `src/pages/Login.jsx`, `src/pages/Onboarding.jsx` |
| Knowledge ingestion | ✅ shipped | `src/lib/extractionPipeline.js`, `src/components/admin/UploadZone.jsx` |
| Knowledge graph (view/edit) | ✅ shipped | `src/components/admin/KnowledgeGraph.jsx` (D3) |
| Learning content generation | ✅ shipped | `src/lib/learningService.js` (article/slides/infographic) |
| Micro-learnings | ✅ shipped | `src/lib/microLearningService.js`, `src/components/micro_learning/` |
| Weekly test | ✅ shipped | `src/lib/testService.js`, `src/pages/Testen.jsx` |
| Curriculum (26-week, per-user) | ✅ shipped | `src/lib/curriculumService.js`, `src/components/admin/CurriculumManager.jsx` |
| R42 chatbot | ✅ shipped | `src/components/chat/`, `src/lib/kbStore.js`, `src/lib/retrieval.js` |
| Gamification | ✅ shipped | `src/pages/Leaderboard.jsx`, `leaderboard` collection |
| Admin panel | ✅ shipped | `src/pages/Admin/index.jsx` (+ `src/components/admin/`) |
| AI wrapper (tiers/retry/telemetry) | ✅ shipped | `src/lib/llm.js`, `src/lib/llmRetry.js`, `src/lib/llmSchemas.js`, `src/lib/llmTools.js` |
| Deployment (Docker/Caddy/Ansible) | ✅ shipped | `Dockerfile`, `Caddyfile`, `docker-compose.yml`, `infra/` |

---

## Where to make changes

- **New PocketBase field/collection:** add a migration in `pb_migrations/`
  (follow the existing JS migration style) and mirror it in
  `scripts/setup-pb-collections.mjs`. Then add async helpers in `src/lib/db.js`.
- **New AI capability:** add a tool in `src/lib/llmTools.js`, a Zod schema in
  `src/lib/llmSchemas.js` (register it in `toolSchemaRegistry`), and call it through
  `callLLM`. Never hit `/api/anthropic` directly.
- **New screen:** add a page under `src/pages/`, route it in `src/App.jsx`, and gate
  it with `ProtectedRoute` (which also enforces curriculum enrollment).
- **New admin tool:** add a tab in `src/pages/Admin/index.jsx` and a panel under
  `src/components/admin/`.

---

## Verification before shipping

```bash
npm test          # Vitest unit tests (lib services)
npm run lint      # ESLint
npm run build     # production build to dist/
```

For UI/feature correctness, run the app against a local PocketBase
(`npm run dev` + `./pocketbase.exe serve`) and exercise the flow in the browser.

---

## Constraints (see CLAUDE.md / PROTECTED.md)

- Do not edit `stylesheet.css` or the deployment files (`Dockerfile`, `Caddyfile`,
  `docker-compose.yml`, `infra/`, `.github/workflows/`) without a request.
- Do not re-enable PocketBase auto-cancellation.
- Do not re-add the podcast content type or the `reflection_prompt` micro-learning.
- Ignore the abandoned `/app` Next.js scaffolding.
