Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

address review (codex): narrow the sense-of AI-tell pattern, gate transition-ratio on raw count

Adam Eivy4be1114a1c22
diff --git a/server/lib/editorial/checks/slop.js b/server/lib/editorial/checks/slop.js
index 8d942de006..710f4ba995 100644
--- a/server/lib/editorial/checks/slop.js
+++ b/server/lib/editorial/checks/slop.js
@@ -281,7 +281,7 @@ export const slopChecks = [
}
const transitions = transitionOpenerRatio(text);
- if (findings.length < max && transitions.total > 0 && transitions.ratio > transitionThreshold) {
+ if (findings.length < max && transitions.count >= MIN_DENSITY_OCCURRENCES && transitions.ratio > transitionThreshold) {
findings.push({
severity: ctx.severityDefault,
category: 'style',
diff --git a/server/lib/editorial/slopScore.js b/server/lib/editorial/slopScore.js
index 6eb3fda8df..5df5f1ef9a 100644
--- a/server/lib/editorial/slopScore.js
+++ b/server/lib/editorial/slopScore.js
@@ -195,11 +195,26 @@ export function findSuspiciousWordClusters(text, opts = {}) {
// occurrence) — a recurring idiom is one tic to fix, not many, mirroring
// cliches.js's dedupe-to-first-occurrence philosophy.
// ---------------------------------------------------------------------------
+// Abstract/atmospheric/emotional nouns that make "a sense of X" the vague AI
+// tell it's meant to catch. Deliberately NOT a bare "any word(s)" match —
+// ordinary English idioms ("a sense of humor", "a sense of direction", "a
+// sense of purpose", "a sense of self") are common, unremarkable prose, not a
+// tell; a bare match fired on "she had a sense of humor about the whole
+// thing" (caught in codex review). Curated, not exhaustive.
+const SENSE_OF_WORDS = [
+ 'dread', 'unease', 'uneasiness', 'foreboding', 'wrongness', 'calm', 'peace',
+ 'urgency', 'loss', 'longing', 'dislocation', 'disquiet', 'malaise',
+ 'dissonance', 'emptiness', 'finality', 'inevitability', 'wonder', 'awe',
+ 'danger', 'doom', 'melancholy', 'nostalgia', 'belonging', 'isolation',
+ 'alienation', 'vertigo', 'menace', 'warmth', 'unreality', 'otherness',
+ 'relief', 'anticipation', 'anxiety', 'foreignness', 'displacement',
+];
+
export const AI_TELL_PATTERNS = Object.freeze([
{
id: 'sense-of',
label: 'vague "a sense of X" telling',
- re: /\ba sense of\s+[a-z]+(?:\s+[a-z]+){0,2}/gi,
+ re: new RegExp(`\\ba sense of\\s+(?:${SENSE_OF_WORDS.join('|')})\\b`, 'gi'),
suggestion: 'Replace the vague abstraction with a concrete, dramatized detail specific to this moment.',
},
{
@@ -610,7 +625,7 @@ export function computeSlopPenalty(text, opts = {}) {
if (rhythm && rhythm.cv < w.lowSentenceCvThreshold) penalty += w.lowSentenceCvPenalty;
const transitions = transitionOpenerRatio(text, opts);
- if (transitions.total > 0 && transitions.ratio > w.transitionRatioThreshold) penalty += w.highTransitionRatioPenalty;
+ if (transitions.count >= MIN_DENSITY_OCCURRENCES && transitions.ratio > w.transitionRatioThreshold) penalty += w.highTransitionRatioPenalty;
if (paragraphLengthUniformity(text, opts).length > 0) penalty += w.paragraphUniformityPenalty;
diff --git a/server/lib/editorial/slopScore.test.js b/server/lib/editorial/slopScore.test.js
index f1a59ce74b..ff28d31712 100644
--- a/server/lib/editorial/slopScore.test.js
+++ b/server/lib/editorial/slopScore.test.js
@@ -129,6 +129,15 @@ describe('findAiTells', () => {
expect(findAiTells('The door creaked open and she stepped through.')).toHaveLength(0);
});
+ it('does NOT flag ordinary "sense of" idioms — humor, direction, purpose, self (regression)', () => {
+ // The original bare `[a-z]+` match fired on any noun phrase after "a sense
+ // of", including common non-tell idioms. Caught in codex review.
+ expect(findAiTells('She had a sense of humor about the whole thing.')).toHaveLength(0);
+ expect(findAiTells('He always had a good sense of direction.')).toHaveLength(0);
+ expect(findAiTells('It gave her life a sense of purpose.')).toHaveLength(0);
+ expect(findAiTells('He never lost his sense of self.')).toHaveLength(0);
+ });
+
it('"couldn\'t help but" matches the typographic curly apostrophe too', () => {
// ’ is the curly apostrophe Word/Scrivener/Google Docs auto-substitute.
const hits = findAiTells('She couldn’t help but smile at the memory.');
@@ -390,6 +399,14 @@ describe('computeSlopPenalty', () => {
expect(computeSlopPenalty(text)).toBeLessThan(SLOP_PENALTY_WEIGHTS.emDashPenalty);
});
+ it('does NOT add the transition-opener penalty for a single transition sentence, even though its ratio is 1 (regression)', () => {
+ // A lone sentence opening with a transition word gives ratio=1 — the
+ // degenerate "100% of 1 sentence" case, not repeated essay-style
+ // signposting. Caught in codex review; MIN_DENSITY_OCCURRENCES gates this.
+ const text = 'Meanwhile, she waited. She smiled and walked home slowly through the quiet evening street.';
+ expect(computeSlopPenalty(text)).toBeLessThan(SLOP_PENALTY_WEIGHTS.highTransitionRatioPenalty);
+ });
+
it('adds the section-break penalty for an over-fragmented rate of scene breaks', () => {
// 40 words total (two 20-word paragraphs), 1 section-break line -> 25/1000
// words, far above the default 8/1000 threshold. Regression test: