Skip to main content

resources/
model_notes.rs

1//! Notes for the model a prompt is rendered for: short rules a model family needs said outright, which the others
2//! follow unasked (or are hurt by). One table, matched by the start of the model id.
3
4const COMMENTS: &str = "Comments: write one only where the code cannot show its reason (a hidden constraint, an invariant, a workaround for a named bug). Never describe what the code does, and never mention this task, its review or its callers in a comment.";
5const PROSE: &str = "Prose for the user: plain words in whole sentences. No clipped shorthand, no arrows or symbols in place of words, no ornate phrasing.";
6const PARALLEL: &str =
7    "Independent operations (reads and searches above all) go in one cell under `asyncio.gather`, not one cell each.";
8
9/// Model id prefix (dots read as dashes) and its notes; the first matching row wins, so a longer prefix comes first.
10const TABLE: &[(&str, &[&str])] = &[
11    ("claude-fable-5-", &[COMMENTS, PARALLEL, PROSE]),
12    ("claude-fable-5", &[COMMENTS, PROSE]),
13    ("claude-opus-5", &[COMMENTS, PROSE]),
14    ("claude-sonnet-5", &[COMMENTS]),
15    ("claude-opus-4-7", &[COMMENTS]),
16    ("claude-opus-4-8", &[COMMENTS]),
17];
18
19/// The notes for `model_id` as one prompt section's text, `None` for a model without any.
20pub fn model_notes(model_id: &str) -> Option<String> {
21    let id = model_id.replace('.', "-");
22    TABLE
23        .iter()
24        .find(|(prefix, _)| id.starts_with(prefix))
25        .map(|(_, notes)| {
26            notes
27                .iter()
28                .map(|note| format!("- {note}"))
29                .collect::<Vec<_>>()
30                .join("\n")
31        })
32}