aeb197d5f4b2343db0b8e2d968361c0eb5740ead
Replace stateless one-shot extraction with a stateful, paced, cancellable pipeline. Six subtasks: - 3.1 Sentence-aware chunking with 800-char overlap (was paragraph-only at 4000 chars). Hard-split fallback for runaway sentences. - 3.2 Stateful extraction: chunks 2+ receive an "already-extracted topic IDs" hint capped at 200 IDs, so the model reuses IDs instead of inventing variants like software-developer vs software-engineer. - 3.3 Token-bucket limiter in llmRetry.js (extractionLimiter, 5 req/min). callLLM awaits the limiter before fetch; 429+Retry-After calls pauseUntil. Replaces hard setTimeout(12000) and setTimeout(15000). - 3.4 relevance_locked column on topics — admin edits to relevance are sticky across re-extraction. Migration + merge respects the flag + unlock checkbox in KnowledgeGraph edit form. - 3.5 Unify relation vocabulary — handbook prompt no longer mentions legacy "executes"; one-shot migration rewrites existing executes rows to executed_by with source/target swapped. - 3.6 Cancellation — Cancel button on UploadZone wired to an AbortController threaded into callLLM; aborted runs persist status = "cancelled" rather than "failed". Tests: 16 new unit tests for chunkText, buildKnownIdsHint, and createLimiter. All 61 tests pass, 0 lint errors, build clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Respellion Learning Platform
An internal AI-powered learning platform that keeps Respellion employees up to date with the company's evolving knowledge base.
Features
- Weekly Learning Station — Each employee is assigned a topic each week (via deterministic hash of user ID + week number). They choose their preferred format: Article, Slides, or Infographic. Content is generated on-demand by Claude and cached per topic.
- Weekly Test — AI-generated quiz based on the knowledge graph. Results are stored and feed the leaderboard.
- Leaderboard & Gamification — Points for correct answers, badges for streaks and perfect scores.
- R42 Chatbot — An always-available AI assistant (backed by Claude) with access to the full knowledge graph. Can propose graph updates that admins approve or reject.
- Admin Panel — Manage the knowledge graph, sync from GitHub, review generated content, refine it with AI, and monitor team progress.
Tech Stack
| Layer | Technology |
|---|---|
| Frontend | React 18 + Vite |
| Styling | Vanilla CSS (custom properties) + Tailwind utility classes |
| Animations | Framer Motion |
| Icons | Lucide React |
| Graph viz | D3.js (admin knowledge graph only) |
| Backend / DB | PocketBase (self-hosted) |
| AI | Anthropic Claude (via Caddy reverse proxy) |
| Infra | Docker + Caddy |
Getting Started (local dev)
# 1. Install dependencies
npm install
# 2. Start PocketBase (Windows)
./pocketbase.exe serve
# 3. Start the dev server
npm run dev
The Vite dev server proxies /api/anthropic and /pb — see vite.config.js.
Deployment (Docker)
docker compose up -d
The Caddyfile handles:
- SPA fallback routing
/pb/*→ PocketBase sidecar/api/anthropic/*→ Anthropic API (with server-side API key injection)
Key Files
| File | Purpose |
|---|---|
src/lib/learningService.js |
Selective content generation (article / slides / infographic) |
src/lib/extractionPipeline.js |
GitHub file → knowledge graph extraction |
src/lib/api.js |
Anthropic API wrapper (generateContent + chat) |
src/lib/db.js |
All PocketBase data access |
src/lib/giteaService.js |
GitHub API client (folder listing + raw file fetch) |
src/store/AppContext.jsx |
Global state; computes ISO week number on load |
src/components/admin/UploadZone.jsx |
GitHub sync UI (default folder: docs/knowledge-base/) |
AI_AGENT.md |
Detailed context guide for AI coding agents |
Content Types
Learning content is generated on demand per type and merged into the cached object:
| Type | Key in DB | Description |
|---|---|---|
| Article | content.article |
Long-form reading |
| Slides | content.slides |
Slide deck with speaker notes |
| Infographic | content.infographic |
Visual summary with stats and steps |
The podcast type was removed. Do not re-add it.
Documentation
AI_AGENT.md— Full architectural guide for AI coding agents (patterns, gotchas, decisions).CHANGELOG.md— PocketBase upstream changelog (not application changelog).
Description
Languages
JavaScript
95.6%
TypeScript
3.6%
CSS
0.8%