Skip to content

Stop AI from judging user habit content#4

Merged
thomasluizon merged 1 commit into
mainfrom
fix/ai-content-policy
Mar 20, 2026
Merged

Stop AI from judging user habit content#4
thomasluizon merged 1 commit into
mainfrom
fix/ai-content-policy

Conversation

@thomasluizon

Copy link
Copy Markdown
Owner

Summary

  • Remove overly restrictive scope boundaries (homework, coding, etc.) from AI system prompt
  • Add explicit content policy: AI must process any habit/task without moralizing or refusing
  • Only boundary: refuse requests describing serious real-world harm to others
  • Update out-of-scope handling to default to creating habits when request can be interpreted as one

Test plan

  • Send crude/vulgar habit creation requests - AI should create them without judgment
  • Send requests with slang or explicit language - AI should extract intent and execute
  • Send a request describing real harm to others - AI should refuse
  • Verify normal habit creation still works as expected

🤖 Generated with Claude Code

Remove overly restrictive scope boundaries and add explicit content
policy so the AI processes any habit/task request without moralizing.
Only refuse requests describing serious real-world harm to others.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@thomasluizon
thomasluizon merged commit f2141ba into main Mar 20, 2026
1 check passed
@thomasluizon
thomasluizon deleted the fix/ai-content-policy branch March 20, 2026 20:17
thomasluizon added a commit that referenced this pull request Apr 5, 2026
StringComparison.OrdinalIgnoreCase in LINQ cannot be translated to SQL
by EF Core/Npgsql, causing query_habits to throw on every call.
Replaced with ToLower().Contains() which translates to LOWER() in SQL.

Also updated AI prompt rule #4 so the AI immediately searches for
existing habits instead of asking the user for permission to check.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
thomasluizon added a commit that referenced this pull request Apr 15, 2026
…page size

Adds two new DistributedRateLimitService policies:
- bulk (10 req/min): gates /api/habits/bulk, bulk/log, bulk/skip, DELETE /api/habits/bulk
  so a script can't push thousands of rows in a burst.
- agent-execute (20 req/min): gates /api/ai/pending-operations/{id}/execute on top
  of the step-up enforcement already in AgentPolicyEvaluator, so even with a
  valid confirmation token the destructive path is throttled.

Also clamps GET /api/habits pageSize to [1, 200] so a crafted ?pageSize=100000
can't force a multi-second scan.

Covers backend plan F5 (P0 #4) and P1 input validation for PageSize.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
thomasluizon added a commit that referenced this pull request Apr 15, 2026
…page size

Adds two new DistributedRateLimitService policies:
- bulk (10 req/min): gates /api/habits/bulk, bulk/log, bulk/skip, DELETE /api/habits/bulk
  so a script can't push thousands of rows in a burst.
- agent-execute (20 req/min): gates /api/ai/pending-operations/{id}/execute on top
  of the step-up enforcement already in AgentPolicyEvaluator, so even with a
  valid confirmation token the destructive path is throttled.

Also clamps GET /api/habits pageSize to [1, 200] so a crafted ?pageSize=100000
can't force a multi-second scan.

Covers backend plan F5 (P0 #4) and P1 input validation for PageSize.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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