sloplint-judge 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8d0f2ca219849b87d6bf196a574de47ecfd12954b4930d66ec58b5204283f6fe
4
- data.tar.gz: 33f01aa98179abb5d16329e2731c52f55d20e00009e5c02749717f98398e4eea
3
+ metadata.gz: 3de0904c51dfed9616bd143356830f2106dcd8120814c5019e6f809369830803
4
+ data.tar.gz: aa6ec368418d4818a33cd8f59301fc4f9f902d98dec8d137bb1607bbb43001ac
5
5
  SHA512:
6
- metadata.gz: 928d962a370cc1b47091b2cb9a0b8f2ec654cb2f07e9866a87c96f29147ed50d0b38d898f4196fce1689809554f32d3696de80c4826c73a6f071b752a5fb814e
7
- data.tar.gz: 9fd7bb807b0e0a956ba9e10a8d5708cb9399a4ac9110ee2bae08437370f7eb99d938a2fb9d9460114b7a3d16d7e13a5675e15ac0c271587dfcd94044af9aa03b
6
+ metadata.gz: 0aa5aebd5e6e1ed1e70a078701b479fd26470525341287760eecb1db5b50793fbac55b98b35448ef379f7ca708a972ad1c111191c9846766eb5d56138b8b3ec2
7
+ data.tar.gz: 8392d8738ae9ecb169ecf82e0e5083d0523d36e860c7f67416a83bbc656ee67efe9debe411a6fcde314663995e44c0ccc8c8dd8ec356b84fc9c0b01dcfae05b7
data/docs/JUDGE.md CHANGED
@@ -212,11 +212,11 @@ Fixtures are synthetic, as in sloplint. No sentence read during calibration is p
212
212
 
213
213
  ## Rule catalog (v1)
214
214
 
215
- Twenty rules, two categories. A number appears only where it decides something a reader can see in the rule: its severity, its confidence ceiling, or a caveat. It is the probability that a model unit scores higher than a human one in the same register; below 0.5 means the rule ranks model prose lower, which is what a rule is for. The full runs, with corpus sizes and the models on each side, are in the commit that added or last changed the rule.
215
+ Twenty-one rules, two categories. A number appears only where it decides something a reader can see in the rule: its severity, its confidence ceiling, or a caveat. It is the probability that a model unit scores higher than a human one in the same register; below 0.5 means the rule ranks model prose lower, which is what a rule is for. The full runs, with corpus sizes and the models on each side, are in the commit that added or last changed the rule.
216
216
 
217
217
  ### paragraph
218
218
 
219
- Run on every paragraph of three or more sentences. One request per paragraph carries every paragraph question in the run, five by default.
219
+ Run on every paragraph of three or more sentences. One request per paragraph carries every paragraph question in the run, six by default, and the triage question described under sentence when the run has sentence rules and is not `--strict`.
220
220
 
221
221
  - **particulars** (`warning`, `high`). How much of the paragraph is a fact, name, number, step or quote a reader could check: none of it, some of it, most of it. Flags at none. Ranks model prose lower in every register the tool is for, against 2023 models and current ones.
222
222
  - **wrap-up** (`warning`, `high`). How the paragraph ends: restating, moralising or hoping, transition, or new fact. Flags at the first. The hope is the "despite these challenges, the future looks bright" closer, which names nothing and so tells the reader nothing new.
@@ -224,12 +224,13 @@ Run on every paragraph of three or more sentences. One request per paragraph car
224
224
  - **self-narration** (`info`, `medium`). Whether the paragraph says something about its subject or signposts the document: most sentences tell the reader what the text will do, is doing or has done, or the paragraph carries facts, decisions, rules or events with at most one signpost. Two levels. Flags at signposting. `throat-clearing` is the first sentence only; this is the paragraph that is a table of contents in prose. The flag is rare, so the counts are the number: in 30 abstracts, 1 human paragraph against 32 for llama-chat, 4 for GPT-4 and 49 for Claude Sonnet 5; in news nothing on either side; in 34,000 words of READMEs and design documents nothing. The rank statistic sits at 0.45 to 0.78 in abstracts because human abstracts carry the one-sentence "in this paper we" signpost that does not flag, and `info` because abstracts and the introductions to standards signpost by convention.
225
225
  - **promotional** (`warning`, `medium`). How the paragraph evaluates its subject: every evaluative word favorable with nothing measured and no drawback, or evaluation absent, measured, or with a cost in the same paragraph. Two levels. Flags at the first. The regex catalog's `puffery-words` sees the watch words, which age out with each model release; this is the paragraph that is positive without any of them. Ranks model prose lower in news (0.12 to 0.27) and abstracts (0.09 to 0.45); no human paragraph flagged in either register, against 7 to 17 of about 30 model paragraphs in news and 1 to 9 in abstracts. One hit in 34,000 words of READMEs and design documents, on a paragraph that was selling.
226
226
  - **same-weight** (`info`, `low`). Whether the paragraph marks which of its sentences are facts, which are inferences and which are the writer's opinions: none marked, some marked, or all marked (or nothing to mark, because the paragraph is only facts, steps or events). Flags at none. Ranks model prose lower in news (0.26 to 0.38) and, against 2023 models, in abstracts (0.16 to 0.38); against Claude Sonnet 5 abstracts sit at 0.52. Off by default: a design document states its decisions in flat sentences on purpose and gives the reason a paragraph later, and read against READMEs and design documents about one hit in six was fair. `--select same-weight` or `--strict` runs it.
227
+ - **set-piece** (`info`, `medium`). Whether any sentence in the paragraph makes its point through a device written as a line (a reversal or mirror, a slogan, a maxim, a coined figure, a payoff line) or every sentence states a fact, decision, step or event. Two levels. Flags at the device. A line in quotation marks written for someone to say, a script line or a tagline, counts; a quotation reporting what someone already said does not. It was added to send device sentences in otherwise plain paragraphs on to `device-before-claim` and `maxim`; the triage question now does that for every sentence rule, and `set-piece` stays for its own note. It reverses in news (0.56 to 0.73) and abstracts (0.53 to 0.90) and separates in blogs only against 2023 models (0.32, 0.43; 0.54 against Claude Sonnet 5), so it is `info`. The flag is rare in news and abstracts: news, 1 of 30 human paragraphs (a reported quote built as a mirror, which the quotation exception does not always catch) against 0 to 3 of 21 to 41 model paragraphs; abstracts, none on either side. In blogs it flags 18 of 30 human posts against 21 to 28 of 29 to 48 model ones; HAP-E posts have no paragraph breaks, so each is read as one paragraph of about 500 words, and read for fairness about 13 of the 18 human hits carry a real device.
227
228
 
228
229
  ### sentence
229
230
 
230
- Run on every sentence of the paragraphs a paragraph rule flagged, and on the sentences of the short paragraphs no paragraph rule looked at, so the expensive questions are asked where the cheap ones found something and no paragraph goes unexamined. Two details keep that shortcut honest. A paragraph is "flagged" only by a note that survives the confidence bands; a paragraph answer that fell to `low` and was dropped opens nothing. And when the run contains no paragraph rule at all, because `--select` named only sentence rules or `--ignore paragraph` removed them, the sentence rules run on every sentence, since there is nothing to triage by and a silent clean exit would be a lie. `--strict` runs them on every sentence regardless. One request per sentence carries every sentence question in the run, seven by default, with the sentence's paragraph and its index in the state so the model sees the neighbours.
231
+ Run on every sentence of the paragraphs a paragraph rule or the triage question flagged, and on the sentences of the short paragraphs no paragraph rule looked at, so the expensive questions are asked where the cheap ones found something and no paragraph goes unexamined. The triage question rides in the paragraph request and makes no note: it asks whether any sentence in the paragraph does one of the things the sentence rules look for (a stock figure, an explanation the reader does not need, a claim that names nothing, a verdict or moral on the fact before it, an unnamed authority, a maxim, a device). It is not a rule, so `rules` does not list it and `--select` cannot name it, and it is written for recall, because a paragraph sent on by mistake costs a few requests and a paragraph held back by mistake hides a tell. Without it the paragraph rules were the only gate, and a tell in the middle of a long paragraph that was otherwise fine was never asked about: set between plain sentences, 21 of the 27 bad examples of the default sentence rules reached no sentence question; with it, 25 do, and the two that do not are examples `device-before-claim` misses in its own fixtures. Two details keep that shortcut honest. A paragraph is "flagged" only by a note, or a triage answer, that survives the confidence bands; an answer that fell to `low` opens nothing. And when the run contains no paragraph rule at all, because `--select` named only sentence rules or `--ignore paragraph` removed them, the sentence rules run on every sentence, since there is nothing to triage by and a silent clean exit would be a lie. `--strict` runs them on every sentence regardless. One request per sentence carries every sentence question in the run, seven by default, with the sentence's paragraph and its index in the state so the model sees the neighbours.
231
232
 
232
- - **stock-figure** (`warning`, `high`). The sentence uses a figure of speech that is stock, a figure that is the writer's own, or no figure. Flags at stock. A command or identifier in code, one of a set of options, verdicts, statuses or modes the paragraph lists together, or a term defined in the same paragraph, the defining sentence included, is read as a name the writer chose, not a figure, and the rest of the sentence is still judged; a lone bold phrase the paragraph never sets up as a name still counts.
233
+ - **stock-figure** (`warning`, `high`). The sentence uses a figure of speech that is stock, a figure that is the writer's own, or no figure. Flags at stock. A command or identifier in code, one of a set of options, verdicts, statuses or modes the paragraph lists together, or a term defined in the same paragraph, the defining sentence included, is read as a name the writer chose, not a figure, and the rest of the sentence is still judged; a lone bold phrase the paragraph never sets up as a name still counts. A figure inside a quotation that reports what someone said is theirs, not the writer's, and does not flag; a line the document writes for someone to say, a script line or a tagline, is the writer's and does. The suggestion asks the writer to try the literal words and keep the figure when they lose something, or when the reader's field uses the figure as the plain name for the thing: a stock figure is worth a look, not always a cut.
233
234
  - **no-news** (`warning`, `high`). For the stated reader, the sentence explains what they already know, states what they could have guessed, or tells them something new. The explains-known level also catches a second-person sentence that reads the reader's own past actions or their own past words back to them: a fact they know because they did it or said it is not news, however specific it is. Flags at explains-known.
234
235
  - **names-nothing** (`warning`, `high`). The sentence names nothing, names a kind of thing, or names a thing a reader could look up. It is judged with its paragraph: a short label that the next sentence spells out does not flag, and a sentence flags when nothing in its paragraph makes its own claim checkable, even if the paragraph names other things. Flags at names-nothing. This is the concreteness dimension from the spike, renamed to say what the flag means.
235
236
  - **ends-on-verdict** (`info`, `high`). The sentence ends on a verdict or moral, trails off on a qualifier, or ends on the fact that carries it. Flags at verdict.
@@ -242,7 +243,7 @@ Run on every sentence of the paragraphs a paragraph rule flagged, and on the sen
242
243
  - **name-the-thing** (`info`, `low`). Whether the sentence calls things by their names or makes the reader map a pointer back to one: a position (the former, the latter, the second one, the last of three, the fourth item), even when the list was named a clause earlier; a stand-in noun or figure for a named thing (the engine for a named service, the seat for a named role); an allusion to a divide it never names ("where you stood when the old scheduler went away"); or a self-reference such as "this entire writeup" standing for a point it never states. A position that is the thing's own name (step 4, the second retry, Q3, the first argument), a which-clause about named things, and a pronoun pointing at something just named all pass. Two levels. Flags at the first. `the-x-is-not-the-x` is the repeated-noun case; this is the general one. `info` because it reverses in news: human sentences flag at 17 in 584, model sentences at 0 to 2 per side of about 100, and the human hits are the sports desk's epithet for a player named a sentence earlier ("the striker", "the Leeds-born sprinter"), which the rule is right to flag and which news does by convention. In abstracts 1 human and 0 to 1 model sentences flag. Off by default because in 31,000 words of gem READMEs it made 5 hits at the confidence `check` reports and 24 under `--strict`, and none of them was fair: an argument or a request whose position is its name, and a "this" or "these" pointing at the code beside it. `--select name-the-thing` or `--strict` runs it.
243
244
  - **maxim** (`info`, `medium`). Whether `target` is a saying, a general rule about how things always go stated in a turned phrase that could stand alone, or a fact about this system, team or event, how a particular tool, protocol or piece of code behaves, or a step, a requirement or a decision. Two levels. Flags at the first. `info` because the rule reverses in abstracts against 2023 models (rank statistic 0.52 to 0.58; it holds at 0.48 against Claude Sonnet 5 there), while it holds in news (0.37 to 0.50) and blogs (0.39 to 0.46). At the confidence `check` reports: news, human 0 of 584 against 0 to 5 per model side; abstracts, human 0 of 243 against 0 on every model side; blogs, where a saying is part of the register's own voice, human 37 of 964 against 13 to 43 per model side. Read against 30,600 words of gem READMEs, 0 hits. `medium` because the question turns on the sentence's shape, not a fixed list of words, and a plain general statement of fact ("adding a volatile-default column rewrites the table") has to be told apart from an aphorism built the same short, declarative way.
244
245
  - **dressed-pair** (`info`, `low`). Whether the sentence says one fact as if it were two: a second clause that gives a second subject the first clause's verb and adds little beyond a tie back (X deploys and Y deploys with it), or a "both" or "those two things" summing up a pair set out earlier and handing the sum a verdict (is the real work, is the whole point). A pair whose halves carry different facts, a choice between two named options, a plain "both", and a pairing of groups with roles the paragraph defined all pass. Two levels. Flags at the first. `matched-shape` is any pair built to a rhythm and `name-the-thing` a pair pointed at by position or figure; this is the pair restated instead of named. `info` because no current model is caught doing it: at the confidence `check` reports, Claude Sonnet 5 flags 0 sentences in news, abstracts or blogs, against 5 of 964 human blog sentences, 12 of 959 for GPT-4o and 3 of 966 for Llama 3; news and abstracts flag at most 1 sentence a side. Read on a second draw, 2 of the 6 human blog hits are the device, a verb carried over to a second subject, and the rest are a pair of some other kind. Off by default because in 35,000 words of gem READMEs it made 2 hits at the confidence `check` reports and 13 under `--strict`, and none of them was this device. `--select dressed-pair` or `--strict` runs it.
245
- - **device-before-claim** (`info`, `medium`). Whether the sentence makes its claim through a mirror, a riddle, a held-back answer, a coined figure or a maxim, or states it plainly. Two levels. Flags at the device. Ranks model prose lower in blogs against every side (0.34 to 0.43) and against the current model in news (0.39) and abstracts (0.44), but reverses against the 2023 models in news (0.51, 0.51) and abstracts (0.54 to 0.58). `info` because of that reversal. Flag counts at the confidence `check` reports: news, 37 of 584 human sentences against 8 to 26 of 67 to 133 model sentences; abstracts, 17 of 243 human against 8 to 37 of 155 to 240 model sentences; blogs, 104 of 964 human against 110 to 329 of 483 to 966 model sentences.
246
+ - **device-before-claim** (`info`, `medium`). Whether the sentence makes its claim through a mirror, a riddle, a held-back answer, a coined figure or a maxim, or states it plainly. Two levels. Flags at the device. A sentence that reports an event or a result is a fact even when it sets two sides against each other, and so is a quotation reporting what someone said: news and abstracts report contests and comparisons. Ranks model prose lower in blogs against every side (0.33 to 0.42) and in news against every side (0.43 to 0.48 against the 2023 models, 0.34 against the current one), and against the current model in abstracts (0.43), but reverses against the 2023 models in abstracts (0.53 to 0.56). `info` because of that reversal. Flag counts at the confidence `check` reports: news, 23 of 584 human sentences against 6 to 19 of 67 to 133 model sentences; abstracts, 10 of 243 human against 3 to 26 of 152 to 240 model sentences; blogs, 105 of 964 human against 100 to 336 of 371 to 959 model sentences.
246
247
 
247
248
  Each sentence rule reports on its own. There is no combined score and no threshold that combines them.
248
249
 
@@ -375,7 +376,7 @@ Measured against Jev. Other backends report their own numbers through `script/ca
375
376
  | compare, sentence pair with paragraph context | ~590 | ~500 ms |
376
377
  | compare, paragraph pair | ~800 | ~500 ms |
377
378
 
378
- A 2,000-word design document with forty paragraphs and a quarter of them flagged runs about 40 paragraph requests and 50 sentence requests: roughly 160,000 input tokens and 6 seconds at eight in parallel. With `--strict` the sentence side runs everywhere and the cost roughly triples. At TypeSafe's public price, $42 per billion input tokens with output tokens free, that document is about $0.007, and `check` writes the figure into the `judge` block and onto stderr.
379
+ A 2,000-word design document with forty paragraphs and a quarter of them flagged runs about 40 paragraph requests and 50 sentence requests: roughly 160,000 input tokens and 6 seconds at eight in parallel. With `--strict` the sentence side runs everywhere and the cost roughly triples. The triage question sends more paragraphs on, and how many depends on the prose: in 15 paragraphs of gem READMEs the sentence requests went from 9 to 12 (47 under `--strict`); in 30 human abstracts from 41 to 124 (243); in 30 human news articles, which RAID stores with no paragraph breaks and which quote people throughout, from 89 to 536 (584). At TypeSafe's public price, $42 per billion input tokens with output tokens free, that document is about $0.007, and `check` writes the figure into the `judge` block and onto stderr.
379
380
 
380
381
  ## Agent-first help text
381
382
 
@@ -91,6 +91,10 @@ module Sloplint
91
91
  # paid for.
92
92
  eligible = paragraphs.select { |p| p.sentences.size >= MIN_SENTENCES }
93
93
  questions = questions_for(para_rules, register)
94
+ # Under --strict the sentence rules read every paragraph anyway, and
95
+ # with no sentence rule there is nothing to send a paragraph to.
96
+ triage = !strict && !sent_rules.empty?
97
+ questions[TRIAGE_ID] = format_question(TRIAGE, register) if triage
94
98
  answered = in_parallel(eligible, concurrency) do |p|
95
99
  backend.ask({ "register" => register, "paragraph" => p.asked, "sentence_count" => p.sentences.size }, questions)
96
100
  end
@@ -103,6 +107,7 @@ module Sloplint
103
107
  notes << note
104
108
  flagged << p
105
109
  end
110
+ flagged << p if triage && triaged?(answer_for_id(answers, TRIAGE_ID))
106
111
  end
107
112
  end
108
113
 
@@ -132,12 +137,18 @@ module Sloplint
132
137
  end
133
138
 
134
139
  def questions_for(rules, register)
135
- rules.to_h do |r|
136
- q = r.question.merge("instructions" => format(r.question["instructions"], register: register))
137
- [r.id, q]
138
- end
140
+ rules.to_h { |r| [r.id, format_question(r.question, register)] }
141
+ end
142
+
143
+ def format_question(question, register)
144
+ question.merge("instructions" => format(question["instructions"], register: register))
139
145
  end
140
146
 
147
+ # The triage question flags at its first level, and only at medium
148
+ # confidence or above, the same bar a paragraph rule's flag clears
149
+ # before it opens a paragraph to the sentence rules.
150
+ def triaged?(answer) = answer.top == 0 && band(answer.confidence) != "low"
151
+
141
152
  # The sentence a paragraph rule points at, or the paragraph itself.
142
153
  def unit_for(rule, paragraph)
143
154
  case rule.excerpt
@@ -151,7 +162,9 @@ module Sloplint
151
162
 
152
163
  # A backend that answers some questions and not others is a failed
153
164
  # request, not a clean one.
154
- def answer_for(answers, rule) = answers.fetch(rule.id) { raise BackendError, "no answer for #{rule.id}" }
165
+ def answer_for(answers, rule) = answer_for_id(answers, rule.id)
166
+
167
+ def answer_for_id(answers, id) = answers.fetch(id) { raise BackendError, "no answer for #{id}" }
155
168
 
156
169
  # Model confidence to a band. Provisional -- see docs/JUDGE.md "Note".
157
170
  def band(confidence)
@@ -193,6 +193,37 @@ module Sloplint
193
193
  rationale: "A paragraph in which every judgment is favorable, none is measured and no cost appears is copy, whatever it is attached to. The regex catalog's puffery-words sees the watch words; this rule sees the paragraph that is positive without any of them. Two levels, so the score is the probability of the flag. A README is allowed to like its project, so the clean side is wide: one measure or one drawback anywhere in the paragraph is enough. Warning because no human paragraph in news or abstracts flagged and model paragraphs did in both; medium because the question has two parts."
194
194
  ),
195
195
 
196
+ Rule.new(
197
+ id: "set-piece", category: "paragraph", unit: :paragraph, severity: "info", confidence: "medium",
198
+ question: {
199
+ "type" => "score",
200
+ "instructions" => "Does any sentence in this paragraph make its point through a device written as a line, or does every sentence state its point plainly, for %{register}?",
201
+ "criteria" => [
202
+ { "what" => "At least one sentence, anywhere in the paragraph, is a device: a reversal or mirror built as a line (one short sentence set against the next, a thing is A and another is not, shared everywhere and understood nowhere), a slogan, a maxim, a coined figure, or a payoff line that tells the reader what the facts around it add up to. A line in quotation marks counts when the document writes it for someone to say or print: a script line, a tagline, a line a speaker will open a talk with.",
203
+ "examples" => ["The pitch opens on one slide. \"The product is new. The problem isn't.\" Then the founder walks through the numbers.", "Every team logs to the same bucket. Each team wrote its own parser. The data is shared everywhere and understood nowhere."] },
204
+ { "what" => "Every sentence states a fact, decision, step or event. A contrast between two cases is carried by the facts of each case. A quotation that reports words someone already said, in an interview, a match report, a statement or a meeting, is a fact about what they said, even when their words are a device.",
205
+ "examples" => ["The job runs in staging and fails in production. Production's service account has no write access to the export bucket. We granted the role on Tuesday.", "The mayor told reporters on Friday, \"The budget is tight. Our streets aren't optional.\" The council votes on the plan next week.", "At the review, the database lead said, \"We can't shard this table until the foreign keys are gone.\" The team agreed to drop both keys first. That work starts next sprint."] }
206
+ ]
207
+ },
208
+ flag: { level: 0 },
209
+ excerpt: :all,
210
+ message: "A sentence in this paragraph makes its point through a device.",
211
+ suggestion: "Find the line built as a turn and say its point plainly.",
212
+ examples_bad: [
213
+ "The new search index went live on Monday. Queries that took two seconds now take two hundred milliseconds. The index is new. The questions people ask it aren't. Most of them still come from the same three dashboards.",
214
+ "The launch video runs ninety seconds. It ends on the founder looking into the camera and saying one line: \"We didn't build a faster checkout. We built a reason to come back.\" The last frame is the logo on black.",
215
+ "The migration moved forty tables over two weekends. The schema barely changed; the people who own it changed completely. Three of the five original owners have left, and nobody has picked up the billing tables."
216
+ ],
217
+ examples_ok: [
218
+ "The new search index went live on Monday. Queries that took two seconds now take two hundred milliseconds. Most queries still come from the same three dashboards, so we tuned the index for their filters first.",
219
+ "The launch video runs ninety seconds. It ends on the founder explaining why the company built its own payments service, then cuts to the logo. Legal asked us to drop one claim about settlement times, which we did.",
220
+ "The job runs in staging and fails in production. Production's service account has no write access to the export bucket. We granted the role on Tuesday, and the job has passed every night since.",
221
+ "At the review, the database lead said, \"We can't shard this table until the foreign keys are gone.\" The team agreed to drop both keys first. That work starts next sprint.",
222
+ "The mayor told reporters on Friday, \"The budget is tight. Our streets aren't optional.\" The council votes on the plan next week. Road repairs take up a third of the draft budget."
223
+ ],
224
+ rationale: "A reversal, mirror, slogan or maxim set in the middle of a paragraph reads as a line written to be quoted, not as one more fact. A line in quotation marks written for someone to say, a script line or a tagline, counts; a quotation reporting what someone already said does not, because news quotes people and their devices are part of the story."
225
+ ),
226
+
196
227
  # ── sentence ────────────────────────────────────────────────────────────
197
228
  Rule.new(
198
229
  id: "stock-figure", category: "sentence", unit: :sentence, severity: "warning", confidence: "high",
@@ -204,16 +235,16 @@ module Sloplint
204
235
  "examples" => ["The alert was shouting into an empty room.", "This unlocks a whole new landscape of possibilities."] },
205
236
  { "what" => "Uses a figure that could only have been made for this situation and that tells the reader something literal words would not.",
206
237
  "examples" => ["The renewal script was a smoke detector with the battery pulled.", "The RFC hums rather than votes."] },
207
- { "what" => "Uses no figurative language, or only names the writer chose (a status, an option, a command).",
208
- "examples" => ["The certificate expired at 09:14 and the load balancer rejected every handshake.", "Nobody read the channel.", "Tickets move through **open**, **on ice** and **closed**."] }
238
+ { "what" => "Uses no figurative language, or only names the writer chose (a status, an option, a command), or the figure is inside a quotation that reports what someone said in an interview, a match report, a statement or a meeting: the writer reports those words, not chooses them. A line in quotation marks that the document writes for someone to say or print, a script line or a tagline, is the writer's own and is judged as usual.",
239
+ "examples" => ["The certificate expired at 09:14 and the load balancer rejected every handshake.", "Nobody read the channel.", "Tickets move through **open**, **on ice** and **closed**.", "\"We were up against the wall all season,\" the coach told reporters after the final."] }
209
240
  ]
210
241
  },
211
242
  flag: { level: 0 },
212
243
  message: "Stock figure of speech.",
213
- suggestion: "Say the literal thing, or make a figure that only fits this case.",
244
+ suggestion: "Try the literal words. If they say the same thing, use them. Keep the figure if the literal words lose something the reader needs, or if the reader's field uses it as the plain name for the thing.",
214
245
  examples_bad: ["Migrating the auth service turned out to be a double-edged sword.", "We picked the low-hanging fruit first and moved the needle on latency.", "The reviewer sent the proposal back to the drawing board.", "Moving to the new queue was a **game-changer** for the on-call rota.", "Our answer to flaky builds is the **silver bullet** everyone wanted: retry every step.", "The nightly job writes its errors to `sync-errors.csv`, and so far they are only the tip of the iceberg."],
215
- examples_ok: ["Migrating the auth service cut login time by half and broke password reset for a day.", "The retry loop kept redialing a number the kernel had already disconnected.", "The reviewer returns one of three verdicts: **ship it**, **back to the drawing board**, or **shelve**.", "Run `burn-the-boats` to delete the staging stack and its volumes.", "We call a deploy that skips the canary a cold start. The cold start on Tuesday took checkout down for nine minutes."],
216
- rationale: "A figure anyone could use about anything tells the reader nothing about this case. Model prose reaches for the stock figure where human prose in these registers says the literal thing or makes a figure to fit. A command in code, one of a set of options the paragraph lists, or a term the paragraph defines is a label, not a figure. Bold counts only when the paragraph sets the phrase up as a name."
246
+ examples_ok: ["Migrating the auth service cut login time by half and broke password reset for a day.", "The retry loop kept redialing a number the kernel had already disconnected.", "The reviewer returns one of three verdicts: **ship it**, **back to the drawing board**, or **shelve**.", "Run `burn-the-boats` to delete the staging stack and its volumes.", "We call a deploy that skips the canary a cold start. The cold start on Tuesday took checkout down for nine minutes.", "The club's chairman spoke to reporters after the vote. \"This deal is a game-changer for the academy,\" he said. The board approved the sale nine votes to two."],
247
+ rationale: "A figure anyone could use about anything tells the reader nothing about this case. Model prose reaches for the stock figure where human prose in these registers says the literal thing or makes a figure to fit. A command in code, one of a set of options the paragraph lists, or a term the paragraph defines is a label, not a figure. Bold counts only when the paragraph sets the phrase up as a name. A quotation reporting what someone said is a fact about their words, so a figure in it is theirs, not the writer's."
217
248
  ),
218
249
  Rule.new(
219
250
  id: "no-news", category: "sentence", unit: :sentence, severity: "warning", confidence: "high",
@@ -377,7 +408,7 @@ module Sloplint
377
408
  message: "Matched pair or triple shaped the content.",
378
409
  suggestion: "Keep the items the content needs and drop the one that completes the pattern.",
379
410
  examples_bad: ["The new pipeline is faster, simpler, and cleaner.", "It's not about the tooling, it's about the culture."],
380
- examples_ok: ["The new pipeline runs in four minutes instead of eleven.", "The migration dropped the column in production but not in staging."],
411
+ examples_ok: ["The nightly build now takes four minutes; it took eleven before we cached the dependencies.", "The migration dropped the column in production but not in staging."],
381
412
  rationale: "A pair or triple whose items are interchangeable was built to a rhythm, not to the content. Off by default: it separates strongly against current Claude models and barely against 2023 models, which is a tell of one model family, and much of what it flags in documentation is a parallel the writer built on purpose."
382
413
  ),
383
414
  Rule.new(
@@ -535,8 +566,8 @@ module Sloplint
535
566
  "criteria" => [
536
567
  { "what" => "The sentence is a device: opposites or a matched pair set against each other (everyone and nobody, always and never, the frontend ships one thing and the backend ships another); a noun or phrase repeated to pose a riddle; singling out one item's position in a list or order, the second one, the last one, the fourth item, as the one that actually matters; the payoff sentence that tells the reader what a run of specifics before it adds up to; a coined figure; or a maxim, a general rule stated as if it simply follows, that sums up or restates the point the paragraph was already making. It reads as a turn or a landing, not as one more fact.",
537
568
  "examples" => ["The retry logic is identical everywhere it runs and documented nowhere.", "The frontend team ships the button and the backend team owns the endpoint, and neither one works without the other.", "The third name on the escalation list is the one who actually picks up.", "A deploy that never gets rolled back was never really tested."] },
538
- { "what" => "The sentence states its claim directly, as one more fact in the paragraph, with no matched pair, no riddle, no singled-out position, no payoff over a run of specifics, and no maxim.",
539
- "examples" => ["Nobody has documented the retry logic.", "The frontend team ships the button and the backend team ships the endpoint; both went out this morning.", "The third name on the escalation list is the database team's manager.", "This deploy has never been tested under real failure."] }
569
+ { "what" => "The sentence states its claim directly, as one more fact in the paragraph, with no matched pair, no riddle, no singled-out position, no payoff over a run of specifics, and no maxim. A sentence that reports an event or a result is a fact, even when it sets two sides against each other: one side lost and the other won, a method beat the baseline. A quotation that reports what someone said in an interview, a match report, a statement or a meeting is a fact about what they said, even when their words are a device.",
570
+ "examples" => ["Nobody has documented the retry logic.", "The frontend team ships the button and the backend team ships the endpoint; both went out this morning.", "The third name on the escalation list is the database team's manager.", "This deploy has never been tested under real failure.", "The visitors led at half-time, but the home side scored twice in the last ten minutes to win.", "\"They had more of the ball, but we took our chances,\" the captain said."] }
540
571
  ]
541
572
  },
542
573
  flag: { level: 0 },
@@ -554,11 +585,42 @@ module Sloplint
554
585
  "We wrote a rollback plan before the migration ran because the migration might fail. It covers every table we're touching.",
555
586
  "The build failed twice this morning. A stray comment in the config file caused both failures.",
556
587
  "The deploy at 09:40 tripled error rates on the billing endpoint. The Redis connection pool was maxed at 20 for six minutes. We rolled back to the previous build and error rates returned to normal within two minutes.",
557
- "The incident review named five follow-up tasks, including a rewrite of the retry budget. The retry-budget rewrite would have prevented the outage. The other four tasks were closed within a week.",
558
- "Every cache in the fleet shares one eviction policy. It frees memory by evicting the least recently used entry, even when that entry is needed again a few seconds later."
588
+ "The incident review named five follow-up tasks, including a rewrite of the retry budget. The team agreed the rewrite would have prevented the outage. Four of the five tasks were closed within a week.",
589
+ "Every cache in the fleet shares one eviction policy. It frees memory by evicting the least recently used entry, even when that entry is needed again a few seconds later.",
590
+ "The final went to a deciding set. The defending champion saved two match points and then lost her serve at 5-5. Her opponent served out the match to take the title.",
591
+ "The striker spoke after the draw. \"We played better than them and still dropped two points,\" he said. The club is third in the table.",
592
+ "We train the model on half of the labelled scans. It matches the fully supervised baseline on both test sets while using a tenth of the annotation time."
559
593
  ],
560
- rationale: "A sentence can make its claim by mirroring opposites against each other, posing a riddle with a repeated noun, holding an answer back until a run of specifics resolves into it, coining a figure, or drawing a maxim that restates what the paragraph already showed. mirrored-opposites and the-x-is-not-the-x in the regex catalog each catch one syntactic shape of this; this rule reads the sentence's role in the paragraph instead, so a form neither regex expects is still caught. It only says a device is present, not whether the device earns its place: a figure that explains how something works or a real tradeoff dressed as a mirror is still flagged, and it is for the reader to decide whether cutting it loses anything."
594
+ rationale: "A sentence can make its claim by mirroring opposites against each other, posing a riddle with a repeated noun, holding an answer back until a run of specifics resolves into it, coining a figure, or drawing a maxim that restates what the paragraph already showed. mirrored-opposites and the-x-is-not-the-x in the regex catalog each catch one syntactic shape of this; this rule reads the sentence's role in the paragraph instead, so a form neither regex expects is still caught. It only says a device is present, not whether the device earns its place: a figure that explains how something works or a real tradeoff dressed as a mirror is still flagged, and it is for the reader to decide whether cutting it loses anything. A sentence reporting an event or a result, or a quotation reporting what someone said, is a fact even when it contrasts two sides: news and abstracts report contests and comparisons, and a quoted speaker's device is part of the story."
561
595
  )
562
596
  ].freeze
597
+
598
+ # The question a default run adds to every paragraph request, so that the
599
+ # sentence rules reach a long paragraph no paragraph rule flagged. It is
600
+ # not a rule: it makes no note, nothing lists or selects it, and a flag
601
+ # only sends the paragraph's sentences to the sentence rules, which decide
602
+ # what is reported. So it is asked for recall: a paragraph sent on by
603
+ # mistake costs a few requests, and a paragraph held back by mistake hides
604
+ # a tell. See docs/JUDGE.md "Rule catalog".
605
+ TRIAGE_ID = "sentence-triage"
606
+ TRIAGE = {
607
+ "type" => "score",
608
+ "instructions" => "Does any sentence in this paragraph do something other than state its point plainly, for %{register}?",
609
+ "criteria" => [
610
+ { "what" => "At least one sentence, anywhere in the paragraph, does one of these: uses a stock figure of speech; explains or defines something the reader already knows, or tells the reader what they themselves did or said; makes a claim so general it names nothing; grades, praises or draws a moral from the fact it just stated, in a clause like \"which shows\" or \"highlighting\"; hands a claim to unnamed experts, studies, the industry or what is \"known\"; states a general saying where the fact about this case belongs; makes its point through a mirror, a riddle, a held-back answer or a coined figure; or sums up the facts before it as a balanced pair or a twist (good for one case and bad for the other, the same thing that does one job is the thing that undoes it, a single item picked out as what mattered).",
611
+ "examples" => [
612
+ "The scheduler moved to the new hosts in March. Swapping it out mid-quarter was always going to be a balancing act. The old hosts were retired in April.",
613
+ "The import job now validates every row before it writes. Validation is the process of checking that data is correct. Rejected rows go to a separate file.",
614
+ "The API gateway now rejects requests over 2 MB. Studies show that smaller payloads improve reliability. The limit is set in gateway.yaml.",
615
+ "The nightly report finished at 02:10, which speaks volumes about how far the pipeline has come. It used to finish after six.",
616
+ "Each region keeps its own copy of the price list. Updates reach the copies within a minute. The copy that makes reads fast is the same copy that makes a price change slow to land."
617
+ ] },
618
+ { "what" => "Every sentence states a fact, decision, step, event or reason about this case in plain words. A quotation that reports what someone said is a fact about what they said.",
619
+ "examples" => [
620
+ "The scheduler moved to the new hosts in March. Two jobs failed on the first night because their cron paths were hard-coded. We fixed both paths and the old hosts were retired in April.",
621
+ "The import job now validates every row before it writes. Rows with a missing account number go to rejected.csv. Support reviews that file each morning."
622
+ ] }
623
+ ]
624
+ }.freeze
563
625
  end
564
626
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Sloplint
4
4
  module Judge
5
- VERSION = "0.2.0"
5
+ VERSION = "0.3.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sloplint-judge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Jackson