RaymondVerhoef 229246f7b6
All checks were successful
On Pull Request to Main / test (pull_request) Successful in 32s
On Pull Request to Main / publish (pull_request) Successful in 57s
On Pull Request to Main / deploy-dev (pull_request) Successful in 1m34s
feat: phase 5 of AI pipeline hardening — R42 retrieval & telemetry
- Add dependency-free TF-IDF retrieval (src/lib/retrieval.js) with NL+EN
  stopwords and a WeakMap-cached index.
- Rewrite buildKbContext to ship the top-K relevant topics + verbatim-
  mentioned ids only, filter relations to the included set, and append a
  [kb_hash: <8 hex>] suffix so the ephemeral prompt cache busts when the
  graph changes. Returns { context, retrievedTopics, allTopics }.
- Add LOOKUP_TOPIC_TOOL and drive useChat through callLLM directly with a
  multi-hop tool_result loop capped at 3 hops; preserve Anthropic-provided
  tool_use ids through callLLM so the loop can echo correct tool_use_id.
- Truncate R42 history to the last 12 turns and prepend a single
  "(earlier conversation truncated)" assistant message.
- Set R42 chat defaults: temperature 0.3, maxTokens 2048.
- Add pb_migrations/1780500002_created_llm_calls.js (the best-effort
  logger in callLLM was already wired) and a new Admin → Diagnostics
  view showing the last 100 calls with token usage, cache-hit rate, and
  USD cost from a local Anthropic price table.
- Finalize AI_PIPELINE_HARDENING_PLAN.md: mark Phases 1–5 shipped and
  Phase 6 (eval harness) explicitly out of scope.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 21:36:40 +02:00

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
No description provided
Readme 95 MiB
Languages
JavaScript 95.6%
TypeScript 3.6%
CSS 0.8%