- internal/jobs replaces explain.Jobs: one registry for every kind of
background job, with records in DATA_DIR/jobs. A job's draft is written
before its commit, so a failed commit can be saved again (POST
/jobs/<kind>/<key>/save) and a restart mid-commit resumes it, without
paying Claude twice.
- Graceful shutdown: SIGTERM stops new jobs and waits SHUTDOWN_GRACE for
running ones while still serving the pages that poll them.
- internal/usage records every Claude call's tokens and estimated cost in
DATA_DIR/usage.jsonl; CLAUDE_MONTHLY_BUDGET refuses new jobs (429) once a
month reaches it. The stats page shows the admin the spend.
- auth.SameOrigin refuses cross-origin writes to admin routes.
- The LeetCode importer runs the clone's script without the server's
secrets in its environment.
- A sync that leaves HEAD where it was skips the re-index.
- docs_test.go checks README's route table against the routes, and the CLI
page against the root README's commands.
- The repo is going private: Gitea links on the site are admin-only.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The admin can upload a recording of themselves explaining a problem's
solution out loud (mp3, m4a, wav, webm, ogg or flac, up to 25 MB) and
get interview-style feedback, committed as reviews/<id>.md so every
attempt is kept.
Claude can't take audio, so the recording is transcribed first by an
OpenAI-compatible endpoint (whisper-1 by default; TRANSCRIBE_API_KEY,
with TRANSCRIBE_URL for a self-hosted server). Pace, pauses, filler
words and when complexity first comes up are measured from the word
timestamps and given to Claude with the timestamped transcript, the
statement and optionally the code. The reply covers the verdict, scores
in five areas, the approach and its complexity, missed edge cases,
delivery and what to work on.
Recordings are kept for playback in an S3 bucket (Garage) when the
S3_* settings are given, and are thrown away otherwise. Reviews are
admin-only. The job runs in the background like Explain, and the
statement fetch and save-error handling are now shared between the two.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
When stuck, the admin can ask Claude for an intuitive explanation of a
problem. It is committed as explain.md and shown as folded sections, so
the reader opens only as much as they need: the key observation, hints
that get stronger, the approach, a walkthrough with an SVG diagram per
step, complexity, pitfalls and a pseudocode sketch.
- internal/claude: streamed call with a JSON-schema reply, high effort,
the server-side refusal fallback, fixed error messages and logged
token usage. CLAUDE_API_KEY and CLAUDE_MODEL (default claude-opus-5-5);
without a key only this feature is off.
- internal/explain: the prompt, the schema, rendering to markdown, and
a per-problem job tracker. The request starts a job and the page polls,
since a call outlasts nginx's 120s timeout.
- internal/statement: fetches statements from LeetCode's GraphQL API and
USACO's problem pages. Others (Codeforces is behind Cloudflare) are
pasted.
- problem.md holds the statement, editable from the meta editor and
shown only to the admin. Diagrams are sanitized with DOMPurify.
Co-Authored-By: Claude Opus 5.5 <[email protected]>