Add prep-class-digest task for pre-class cohort gap synthesis#86
Conversation
Synthesizes a 1-page Markdown brief from recent quiz misses, follow-up reply themes, and media-recording transcripts in a configurable lookback window (default 7 days), ending with 2-3 in-class discussion questions targeted at the highest-priority gaps. Local Gemma 4 handles all student-derived content; an opt-in --cloud-questions routes only the final question-drafting step to cloud Gemini 3 with a redacted prompt that contains tag names + miss counts but no transcripts or theme text. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8480bbb974
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| signal (in which case nothing is written). | ||
| """ | ||
| today = datetime.now(timezone.utc).date() | ||
| since_date = today - timedelta(days=days) |
There was a problem hiding this comment.
Subtract one day when computing lookback start
The lookback window currently starts at today - timedelta(days=days) while downstream loaders include files/rows with >= since_date, so --days 7 actually spans 8 calendar dates (today plus 7 prior days). This causes the digest to pull older quiz/follow-up/recording signals than requested and can skew the ranked gaps whenever there is activity exactly one day beyond the intended window.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
@codex Can you take another look at these two new commits also?
The -a/--all flag has worked with send-quiz-reminder for a while but the task-level help description and the README's send-quiz-reminder section didn't mention it, so users had to read the global flag description (or CLAUDE.md) to discover it. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
`canvigator.py <task> --help` (and `-h`) now renders a focused per-task cheat-sheet: description, prerequisites, file inputs/outputs, applicable flags, example invocations, and a Workflow line listing related tasks to run before/after. Addresses the growing pain of keeping 22 tasks, their dependencies, and their I/O straight. Per-task data lives in a new `canvigator_help.py` module so the CLI file doesn't grow with every task. `FLAG_DESCRIPTIONS` is the single source for flag wording — both the global and per-task renderers share it. The existing global `--help` continues to work; a new footer points users at the per-task form. Tests in `TestPerTaskHelp` cover integrity (every task has an entry, required fields non-empty, flag references resolve, run_before/after targets exist), rendering, and end-to-end CLI dispatch via subprocess. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f417cda164
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| signal (in which case nothing is written). | ||
| """ | ||
| today = datetime.now(timezone.utc).date() | ||
| since_date = today - timedelta(days=days) |
There was a problem hiding this comment.
Compute digest cutoff as an N-day inclusive window
prepClassDigest currently sets since_date = today - timedelta(days=days) and downstream loaders include rows where the date is >= since_date, which makes --days 7 include 8 calendar days (today plus 7 prior days). This inflates miss/theme counts with one extra day of older data whenever users rely on the documented “last N days” window. Use an inclusive cutoff of today - timedelta(days=days-1) (or keep current cutoff and switch comparisons to >).
Useful? React with 👍 / 👎.
Summary
prep-class-digesttask: synthesizes a 1-page Markdown brief from recent quiz misses, follow-up reply themes, and media-recording transcripts in a configurable lookback window (default 7 days, override with--days N/-n N), ending with 2–3 in-class discussion questions targeted at the highest-priority gaps.criteria_evaluations, derived themes); an opt-in--cloud-questions/-qroutes only the final question-drafting step to cloud Gemini 3 with a redacted prompt that contains only tag names + integer miss counts (no transcripts, no theme text).canvigator_utils.find_csvs_in_window(date-window companion tofind_latest_csv) and a small refactor ofcanvigator.py's dispatch chain into a_run_course_taskhelper to keep complexity under flake8's max of 15.Implementation notes
canvigator_digest.pyorchestrates the pipeline in five phases: load (no LLM) → per-quiz follow-up theme summarization (Gemma 4) → per-recording analysis (reuses existinganalyze_recording_tags+extract_recording_themes) → discussion-question synthesis (Gemma 4 default, Gemini 3 opt-in) → render to Markdown._buildDiscussionPromptLocalembeds derived theme bullets, while_buildDiscussionPromptCloudonly embeds tag strings and counts.analysis_YYYYMMDD.mdprecedent).Tests
TestXclasses covering: window CSV discovery, quiz-miss tallying, follow-up assessment loading + NaT handling, prompt builders (explain + draw modes, row cap), priority ranking across all three signal sources, model selection, render section ordering, and the empty-window orchestrator path.TestBuildDiscussionPromptCloud): asserts that synthetic transcripts andcriteria_evaluationscontent cannot leak into the redacted cloud prompt.Test plan
python canvigator.py --crn <CRN> prep-class-digestagainst a real course directory with prior data; verifydata/<course>/class_digest_YYYYMMDD.mdis written with all five sections.model=gemma4:31b host=localhost).python canvigator.py --crn <CRN> --days 14 --cloud-questions prep-class-digest; verify log showsmodel=gemini-3-flash-preview host=ollama.com prompt_variant=cloud.🤖 Generated with Claude Code