Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
80bf391
Add root project knowledge base (AGENTS.md)
jeremymanning Feb 16, 2026
483d4fa
Add scripts-level knowledge base (AGENTS.md hierarchy)
jeremymanning Feb 16, 2026
a724a86
Add feature spec for public release (Issue #18)
jeremymanning Feb 16, 2026
0ee60e9
Clarify spec: question allocation, localStorage lifecycle, a11y, lazy…
jeremymanning Feb 16, 2026
1b2cfe5
Add implementation plan, research, data model, contracts, and quickst…
jeremymanning Feb 16, 2026
e302bdd
Add phased task breakdown for public release implementation (72 tasks…
jeremymanning Feb 16, 2026
30b26dd
Fix analysis findings: 100% question verification, state definition c…
jeremymanning Feb 16, 2026
0c0ef87
Add Vite build config and dependencies
jeremymanning Feb 16, 2026
fd797c8
Add module skeleton stubs for Phase 1 setup
jeremymanning Feb 16, 2026
4eabf7e
Add test stubs for algorithm and visual testing
jeremymanning Feb 16, 2026
bb81632
Replace monolithic index.html with Vite entry point and add domains d…
jeremymanning Feb 16, 2026
64926a2
Update task tracking and add Phase 1 implementation session notes
jeremymanning Feb 16, 2026
179cb26
Implement state management store and persistence layer
jeremymanning Feb 16, 2026
3e2dbf4
Implement math utilities for statistical calculations
jeremymanning Feb 16, 2026
78efcab
Implement domain modules: registry, loader, and questions
jeremymanning Feb 16, 2026
5bbac3a
Implement Gaussian process estimator for adaptive learning
jeremymanning Feb 16, 2026
6d6535f
Implement visualization renderer for adaptive quiz interface
jeremymanning Feb 16, 2026
b2fcb95
Implement accessibility utilities for WCAG compliance
jeremymanning Feb 16, 2026
ff12d23
Implement app entry point with module initialization
jeremymanning Feb 16, 2026
2b6d1a3
Update task tracking for Phase 2 implementation completion
jeremymanning Feb 16, 2026
0e822d1
Implement T026: Add rich landing page content with icons and CTA
jeremymanning Feb 16, 2026
7f0ae5a
Implement quiz UI: domain selector, progress bars, and question panel…
jeremymanning Feb 16, 2026
be04928
Implement active learning: uncertainty-based sampler and sigmoid curr…
jeremymanning Feb 16, 2026
a6c6ebb
Wire end-to-end quiz loop: domain select, question cycle, heatmap upd…
jeremymanning Feb 16, 2026
e6eba4a
Update task tracking for Phase 3 implementation completion
jeremymanning Feb 16, 2026
677f421
Implement domain transition logic with IoU detection, point-set mergi…
jeremymanning Feb 16, 2026
30c788f
Add transition support to renderer: abort, pan-fade, and crossfade an…
jeremymanning Feb 16, 2026
83b1469
Implement canvas-based minimap with domain regions, viewport indicato…
jeremymanning Feb 16, 2026
f062c01
Wire domain transitions, minimap, and rapid-switch abort into quiz flow
jeremymanning Feb 16, 2026
3b8185e
Update task tracking for Phase 4 implementation completion
jeremymanning Feb 16, 2026
e0ff07d
Implement smart question mode selector with availability gating and t…
jeremymanning Feb 16, 2026
ff0c68a
Wire question modes into quiz flow with mode-aware selection and avai…
jeremymanning Feb 16, 2026
80eac99
Update task tracking for Phase 5 implementation completion
jeremymanning Feb 16, 2026
5b7d607
Implement knowledge insights panels and extend mode selector with exp…
jeremymanning Feb 16, 2026
22b6ff4
Calibrate GP kernel for cross-domain predictions and add reduced-opac…
jeremymanning Feb 16, 2026
1a6b1f1
Add About modal content with research links and improve button access…
jeremymanning Feb 16, 2026
8a6ffaf
Update task tracking for Phases 6-8 implementation completion
jeremymanning Feb 16, 2026
8d99d3e
Complete Phases 9-13: 950 domain questions, responsive/a11y UI, Playw…
jeremymanning Feb 17, 2026
0ee51c2
Add synthwave CSS variables and theme foundation to index.html
jeremymanning Feb 18, 2026
e580e35
Update deck.gl renderer with neon effects and transition durations
jeremymanning Feb 18, 2026
94ec333
Add theme toggle and app orchestration with synthwave support
jeremymanning Feb 18, 2026
8f397f4
Apply synthwave theming to quiz, modes, and progress UI components
jeremymanning Feb 18, 2026
52a4175
Update visual test screenshots for synthwave theme
jeremymanning Feb 18, 2026
193286e
feat: add prominent domain selector to landing page
jeremymanning Feb 18, 2026
116d071
feat: add particle background, answered-question dots, and interactiv…
jeremymanning Feb 18, 2026
389a219
feat: custom dropdown selectors, welcome screen polish, and about mod…
jeremymanning Feb 18, 2026
c3c6ea0
chore: backup screenshots from visual QA session
jeremymanning Feb 18, 2026
563527d
feat: replace deck.gl with Canvas 2D renderer, add pan/zoom and minim…
jeremymanning Feb 18, 2026
66bc1d2
feat: add light mode heatmap, colorbar, tooltip text builder, and fix…
jeremymanning Feb 18, 2026
43e7af1
feat: migrate theme from synthwave to professional academic aesthetic…
jeremymanning Feb 18, 2026
43a142c
feat: UI polish — theme-aware minimap/colorbar/tooltips, quiz panel t…
jeremymanning Feb 18, 2026
161b4c9
fix: hover tooltips update on domain switch, fix quiz answer layout
jeremymanning Feb 19, 2026
95b8b20
feat: global concept insights, KA link improvements, modal explanator…
jeremymanning Feb 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Deploy to GitHub Pages

on:
push:
branches: [main]
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: pages
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm ci
- run: npm run build
- uses: actions/upload-pages-artifact@v3
with:
path: dist

deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/deploy-pages@v4
id: deployment
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,12 @@ marimo/_static/
marimo/_lsp/
__marimo__/

# Node.js / Frontend
node_modules/
dist/
.vite/
*.local

# Project-specific
CLAUDE.md

Expand Down Expand Up @@ -247,6 +253,22 @@ checkpoints/level_*_final.json
# Large output files (>50MB)
wikipedia_articles_level_*.json
level_*_concepts.json

# Legacy pipeline data files (root-level, superseded by data/domains/)
cell_distances.json
cell_questions_level_*.json
cell_questions.json
level_*_concepts_checkpoint.json
neighbor_analysis.json
optimal_rectangle.json
question_coordinates.json
questions.json
review.html
find_domain_clusters.py
review.html

# Playwright test artifacts
test-results/
.DS_Store
*/.DS_Store
*/*/.DS_Store
Expand Down
142 changes: 142 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
# PROJECT KNOWLEDGE BASE

**Generated:** 2026-02-16 13:54 UTC
**Commit:** d3cc534
**Branch:** main

## OVERVIEW

Wikipedia Knowledge Map: distributed GPU pipeline that generates semantic embeddings for 250K Wikipedia articles, projects them to 2D via UMAP, enriches cells with LLM-generated labels/questions across 5 difficulty levels, and serves an interactive adaptive quiz visualization. Stack: Python (sentence-transformers, UMAP, OpenAI Batch API, TensorFlow 2.19) + vanilla HTML/JS frontend.

## STRUCTURE

```
mapper/
├── index.html # 3591-line monolithic visualization (KaTeX, adaptive quiz UI)
├── adaptive_sampler_multilevel.js # RBF-based adaptive testing algorithm (MultiLevelAdaptiveSampler)
├── run_full_pipeline.sh # Shell orchestrator: L4→L3→L2 simplification + merge
├── scripts/ # Core pipeline (see scripts/AGENTS.md)
│ ├── run_full_pipeline.py # Python orchestrator: 9-step pipeline with idempotency
│ ├── generate_level_n.py # Hierarchical article expansion (1272 lines, most complex)
│ ├── utils/ # Shared API/embedding/Wikipedia utilities (see scripts/utils/AGENTS.md)
│ ├── tests/ # Module tests + benchmarks (pytest)
│ └── diagnostics/ # Pipeline verification scripts
├── tests/ # Root-level integration tests (embedding dims, UMAP, model loading)
├── notes/ # 63 session notes, implementation plans, troubleshooting guides
├── data/benchmarks/ # Batch size benchmark results
├── embeddings/ # Generated .pkl embedding files (gitignored, multi-GB)
├── backups/ # Data backups
└── logos/ # Logo assets
```

## WHERE TO LOOK

| Task | Location | Notes |
|------|----------|-------|
| Run full pipeline | `scripts/run_full_pipeline.py` | Idempotent; use `--force` flags to rerun steps |
| Simplify questions by level | `scripts/simplify_questions.py --level N` | Levels 2-4 need simplification |
| Shell pipeline (simplify+merge) | `run_full_pipeline.sh` | Only runs simplification + merge, not full generation |
| Generate new difficulty level | `scripts/generate_level_n.py --level N` | LLM-based article suggestion + embedding + questions |
| Heatmap labels (GPT-5-nano) | `scripts/generate_heatmap_labels_gpt5.py` | Uses OpenAI Batch API |
| Heatmap labels (LM Studio) | `scripts/generate_heatmap_labels.py` | Local LLM alternative |
| UMAP rebuild | `scripts/rebuild_umap.py` | 30-60 min for 250K articles |
| Merge levels into final JSON | `scripts/merge_multi_level_data.py` | Deduplicates articles, merges questions by cell |
| OpenAI API integration | `scripts/utils/api_utils.py` | Key in `.credentials/openai.key` |
| Batch API helpers | `scripts/utils/openai_batch.py` | `batch_with_cache()` for cached LLM calls |
| Wikipedia download | `scripts/utils/wikipedia_utils.py` | `download_articles_batch()` |
| Distributed GPU embeddings | `scripts/utils/sync_and_merge_embeddings.py` | SSH/SFTP via paramiko to tensor01/tensor02 |
| Frontend visualization | `index.html` | Served via `python -m http.server 8000` |
| Adaptive sampling logic | `adaptive_sampler_multilevel.js` | `MultiLevelAdaptiveSampler` class |
| Debug pipeline issues | `scripts/diagnostics/diagnose_pipeline.py` | General pipeline diagnostics |
| Verify labels | `scripts/diagnostics/verify_cell_labels.py` | Label quality checks |

## DATA FLOW

```
wikipedia.pkl (250K articles, 752MB, gitignored)
↓ rebuild_umap.py
umap_coords.pkl + umap_reducer.pkl + umap_bounds.pkl
↓ find_optimal_coverage_rectangle.py
optimal_rectangle.json
↓ export_wikipedia_articles.py
wikipedia_articles_level_0.json
↓ generate_heatmap_labels_gpt5.py (OpenAI Batch)
heatmap_cell_labels.json (1,521 labels)
↓ generate_level_n.py --level 0 (concepts + questions)
level_0_concepts.json + cell_questions_level_0.json
↓ generate_level_n.py --level 1..4 (broader articles + questions)
cell_questions_level_{1..4}.json + wikipedia_articles_level_{1..4}.json
↓ simplify_questions.py --level {2,3,4}
cell_questions_level_{2,3,4}_simplified.json
↓ merge_multi_level_data.py
wikipedia_articles.json + cell_questions.json → consumed by index.html
```

## CONVENTIONS

- **Credentials**: `.credentials/` directory (gitignored). `openai.key` for API, `tensor01.txt`/`tensor02.txt` for clusters.
- **API key validation**: Must start with `sk-` (enforced in `api_utils.py`).
- **macOS env vars**: Scripts set `TOKENIZERS_PARALLELISM=false`, `OMP_NUM_THREADS=1`, `MKL_NUM_THREADS=1` to prevent Metal threading issues.
- **TensorFlow pinned**: `tensorflow==2.19.0` — 2.20 has macOS mutex blocking bug.
- **Imports**: Scripts in `scripts/` use `sys.path.append(str(Path(__file__).parent.parent))` to import from `scripts.utils.*`.
- **LLM model**: Pipeline uses `gpt-5-nano` via OpenAI Batch API (cost: ~$0.50/level).
- **Embedding model**: `Qwen/Qwen3-Embedding-0.6B` (distributed) or `google/embeddinggemma-300m` (local).
- **JSON data in root**: Pipeline outputs (`cell_questions*.json`, `wikipedia_articles.json`, etc.) live in project root, not `data/`.
- **Two pipeline scripts**: `run_full_pipeline.sh` (shell, simplification only) vs `scripts/run_full_pipeline.py` (Python, full 9-step pipeline). Use the Python one.
- **Idempotency**: Python pipeline checks for existing outputs and skips steps. Use `--force` to rerun.

## ANTI-PATTERNS (THIS PROJECT)

- **Never commit `.pkl` files** — multi-GB embedding/UMAP files are gitignored. `remove_large_files_from_history.sh` exists to clean mistakes.
- **Never commit `.credentials/`** — API keys, cluster passwords.
- **Never use TensorFlow >= 2.20** — macOS mutex blocking error.
- **Never mock in tests** — project policy requires real API calls, real models, real I/O (see CLAUDE.md instructions).
- **Never use `generate_heatmap_labels.py` in production** — use `generate_heatmap_labels_gpt5.py` (Batch API) instead.
- **Never run `build_wikipedia_knowledge_map.py`** — legacy (nvidia/nemotron). Use `build_wikipedia_knowledge_map_v2.py` or the pipeline.

## COMMANDS

```bash
# Full pipeline (idempotent, skips completed steps)
python scripts/run_full_pipeline.py

# Force rerun everything
python scripts/run_full_pipeline.py --force

# Simplification-only pipeline
./run_full_pipeline.sh

# Single level generation
python scripts/generate_level_n.py --level 2

# Simplify specific level
python scripts/simplify_questions.py --level 4

# Serve visualization
python -m http.server 8000

# Run tests
pytest tests/ scripts/tests/

# Distributed GPU (requires .credentials/)
scripts/launch_distributed.sh
python scripts/utils/sync_and_merge_embeddings.py
```

## NOTES

- `index.html` is a 3591-line monolith — all CSS, JS, and HTML inline. No build system.
- `adaptive_sampler_multilevel.js` is the only extracted JS module. Contains RBF uncertainty estimation math.
- Questions use **LaTeX notation** (`$x^2$`, `$\frac{1}{2}$`) rendered by KaTeX in the frontend.
- LaTeX `$` signs require careful handling to distinguish from currency `$` — see commits d3cc534, 7018ca3, 3ab088c.
- No CI/CD — all testing is manual. No GitHub Actions, no Makefile.
- `notes/` contains 63 implementation logs — useful for understanding decisions but not code reference.
- Cluster config: 2 clusters (tensor01, tensor02) x 8 GPUs = 16 workers. Uses `screen` sessions + `paramiko` SSH.
- License: CC BY-NC-SA 4.0 (non-commercial).

## Active Technologies
- JavaScript ES2020+ (frontend), Python 3.11+ (pipeline) (001-demo-public-release)
- localStorage (browser-side, versioned schema per FR-007 clarification). No server-side storage. (001-demo-public-release)

## Recent Changes
- 001-demo-public-release: Added JavaScript ES2020+ (frontend), Python 3.11+ (pipeline)
Loading