feat: add theme system, improve creative scoring spam detection

Theme system (Section 5.1):
- Add PromptTheme type ('bitcoin' | 'conspiracy' | 'pc_culture' | 'bot_coding')
- Add optional theme field to PromptEntry interface
- pickChallenge now accepts optional theme bias, picks target theme with
  30/20/20/30 distribution, prefers themed prompts when available
- challenges-extra.ts now imports PromptEntry type from challenge-data.ts

Creative scoring improvements (Section 7.2):
- Detect repeated phrases via trigram analysis (>25% duplicate = spam)
- Detect question echo (answer copies prompt back)
- Detect all-caps spam (>80% uppercase letters)
- Detect punctuation-only spam (<30% letter content)
- Minimum word count threshold (< 3 words = low score)
- 5 new tests: repeated phrases, question echo, all-caps, short answer, legit short

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dorian
2026-03-09 07:56:51 +00:00
co-authored by Claude Opus 4.6
parent 2ceef08f55
commit 3b863d1f5f
5 changed files with 134 additions and 14 deletions
+3
View File
@@ -1,9 +1,12 @@
// Challenge prompt data — separated from challenge logic
export type PromptTheme = 'bitcoin' | 'conspiracy' | 'pc_culture' | 'bot_coding'
export interface PromptEntry {
prompt: string
answers?: string[]
choices?: string[]
theme?: PromptTheme
}
export interface ChallengeTemplate {