Skip to content

Custom AI Prompts for Transaction Categorization #102

@letehaha

Description

@letehaha

Overview

Allow users to provide custom instructions (prompts) to guide how AI categorizes their transactions. This gives users control over categorization behavior based on their personal spending patterns and preferences.

Context

  • AI-powered transaction categorization already exists
  • Categorization runs during bank connection sync and manual import
  • Users can add their own AI API keys in settings
  • Users without personal keys use shared server keys

Requirements

Core Feature

  • Add a "Custom Instructions" text field in /settings/ai
  • Users can enter a free-form prompt to provide context for AI categorization
  • The custom prompt is included in AI categorization calls during bank sync and manual import

Constraints

  • Requires personal AI key: Feature only available to users who have configured their own AI API key (not shared server keys)
  • Character limit: ~500 characters (adjust if needed)
  • Sanitization: Input should be sanitized to prevent prompt injection attacks (developer decides appropriate approach)

UX

  • Show a helpful placeholder with examples like: "Transactions from 'Starbucks' should be 'Coffee'. My freelance income comes from 'Acme Corp'."
  • Show character count
  • Disabled state with explanation for users without personal AI keys

Acceptance Criteria

  • Users can enter and save a custom prompt
  • Feature is only enabled for users with personal AI keys
  • Custom prompt is used in AI categorization (bank sync & import)
  • Input is sanitized against prompt injection
  • UI shows helpful placeholder example
  • Character limit is enforced

Future Enhancements (Out of Scope)

  • Per-account custom prompts
  • Multiple prompt rules that can be toggled individually
  • Prompt templates/presets

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions