elorasmus/AGENTS.md
agent d26b262a90 Add container setup and docs
Dockerfile (pinned node:26.13.0-alpine3.24, non-root, no npm install) and
compose.yaml (loopback by default, read-only root fs, dropped capabilities,
healthcheck, named volume). Every setting is an env var, documented in
.env.example and README.md. AGENTS.md records project conventions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HA82gXkMmmRRKLSnY6vQN3
2026-11-12 20:55:35 +00:00

2.7 KiB

AGENTS.md: Elorasmus

Project specifics for anyone (human or agent) working in this repo. The box-wide rules live in the global instructions; this file covers only this project.

What this is

A mobile-first web app for ranking CTU FEL exchange partner schools by pairwise picks (Elo). The user hosts it themselves with compose.yaml. See README.md for the user-facing docs.

Stack and ports

  • Node ≥ 22 (image pinned to node:26.13.0-alpine3.24). No npm dependencies: keep it that way unless there is a strong reason.
  • Front end: plain ES modules in public/js/, no build step.
  • Dev port: 8317 (ELORASMUS_PORT=8317). On the dev box, bind to loopback only; preview via ssh -p 14922 -L 8317:localhost:8317 <host>.
  • Node isn't installed on the dev box: run tests in the pinned image (see README.md, Development).

Commands

podman run --rm -v "$PWD":/app:Z,ro -w /app docker.io/library/node:26.13.0-alpine3.24 node --test test/
podman compose -p elorasmus up -d --build                  # serve on 127.0.0.1:8317
python3 -I scripts/validate_research.py                    # research files vs the contract
python3 -I scripts/build_data.py                           # rebuild public/data/schools.json
python3 -I scripts/parse_catalog.py <saved.html> data/catalog.json   # new CTU catalogue

Rebuild public/data/schools.json after any change under research/raw/ or data/, and commit it: the container image serves it as is.

Conventions

  • State is an append-only event log (match, drop, restore, review, undo) in DATA_DIR/events.jsonl. Ratings are never stored; clients replay the log. Don't add mutable rating state on the server.
  • Escaping: build HTML only with the html tagged template from public/js/ui.js. It escapes interpolations, and research text is web-sourced. Links go through safeUrl/extLink.
  • CSP is strict (script-src 'self'; style-src 'self'): no inline scripts, styles or style="" attributes. Bar widths are .w0….w10 classes.
  • Pure logic (elo.js, pairing.js, metrics.js) must stay DOM-free and covered by test/.
  • Config comes only from environment variables (server/config.js). Document every new one in .env.example, README.md and compose.yaml together.
  • Research files follow research/BRIEF.md: never invent numbers, URLs or course names; use null plus text and lower the confidence instead.

Research status (update when it changes)

As of 2026-11-12, research covers most of the 170 schools; scripts/build_data.py prints the count. Schools without research still appear, marked "research pending". The web-search budget per session is limited (~200 calls), so later research relied on fetching official pages directly.