Skip to content

fix: prompt_score scope scoring no longer rewards length over clarity - #248

Open
TerminalGravity wants to merge 1 commit into
mainfrom
fix/prompt-score-scope-bug
Open

fix: prompt_score scope scoring no longer rewards length over clarity#248
TerminalGravity wants to merge 1 commit into
mainfrom
fix/prompt-score-scope-bug

Conversation

@TerminalGravity

Copy link
Copy Markdown
Collaborator

Bug

prompt_score gave full scope points (25/25) to any prompt longer than 100 characters, regardless of whether scope was actually defined. A rambling prompt like "I want you to look at the codebase and think about what could be improved and then maybe do some things" scored the same as "Fix only the login validation in auth.ts".

Fix

Removed the text.length > 100 shortcut. Scope is now scored purely on semantic signals:

  • Bounding words (only, just, specific, this) → 25 pts
  • Broad words (all, every, entire) → 10 pts + feedback
  • Neither → 15 pts + suggestion

Also bumped the default 'neither' case from 10→15 (no scope indicators isn't as bad as actively broad).

Tests

Added 13 unit tests for scorePrompt covering all dimensions + the regression case. Exported the function for direct testing.

Previously, any prompt >100 chars got full scope points (25/25) regardless
of whether scope was actually clear. A rambling 150-char prompt with no
bounding language scored the same as a tightly scoped one.

Now scope scoring is purely semantic:
- Bounding words (only, just, specific, this) → 25 pts
- Broad words (all, every, entire) → 10 pts (with feedback)
- Neither → 15 pts (with suggestion to scope)

Also exports scorePrompt for direct testing and adds 13 unit tests
covering all scoring dimensions and the regression case.

@TerminalGravity TerminalGravity left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — text.length > 100 was sneaking full scope points to verbose-but-vague prompts. The bounding-vs-broad logic is much more intentional. One thought: the fallback score went 10→15 for unclear scope — might be worth a brief comment explaining the reasoning so future contributors don't second-guess it. ✅

@TerminalGravity TerminalGravity left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good fix. The old text.length > 100 giving full scope points was rewarding verbosity, not clarity. New bounding-word logic is better, and the regression test nails it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant