Agent-PayMind
CLAUDE.md2 starsChanged 14 months agoMITView on GitHub
PayMind is an AI-powered payment reminder system with two interfaces: 1. CLI Agents - Three specialized Claude Code agents for invoice analysis, message generation, and response handling 2. Next.js Dashboard - Web interface for visualizing workflows and managing invoices with real AI integration Next.js 16.0.10 application with App Router: - State: Zustand store with localStorage persistence (src/lib/store.ts) - Database: Prisma with SQLite (prisma/schema.prisma) - AI Integration: Multi-provider abstraction via callAI() (src/lib/ai-providers.ts) - API Routes: REST endpoints at src/app/api/ - Theme:…
- Reads credentials
- Installs packages
The file
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
PayMind is an AI-powered payment reminder system with two interfaces:
- CLI Agents - Three specialized Claude Code agents for invoice analysis, message generation, and response handling
- Next.js Dashboard - Web interface for visualizing workflows and managing invoices with real AI integration
Architecture
Agent Workflow
CSV Upload → [Payment Monitor] → Analysis Report
↓
[Reminder Generator] → Email/SMS/WhatsApp messages
↓
[Response Handler] → Intent analysis + Suggested actionsCLI Agents (.claude/agents/)
| Agent | Purpose | Output |
| payment-monitor-agent | Analyzes CSV, identifies overdue invoices, calculates priority | Report with metrics and segmentation |
| reminder-generator-agent | Generates personalized messages for Email/SMS/WhatsApp | Channel-appropriate reminder messages |
| response-handler-agent | Analyzes customer responses, identifies intent | Actions + draft response |
Dashboard (dashboard/)
Next.js 16.0.10 application with App Router:
- State: Zustand store with localStorage persistence (
src/lib/store.ts) - Database: Prisma with SQLite (
prisma/schema.prisma) - AI Integration: Multi-provider abstraction via
callAI()(src/lib/ai-providers.ts) - API Routes: REST endpoints at
src/app/api/ - Theme: Dark/light mode toggle persisted in Zustand (uses
.darkclass on<html>) - i18n: Italian/English UI toggle (language stored in Zustand)
- Styling: Tailwind CSS v4 with
@custom-variant dark (&:is(.dark *))for manual dark mode - Responsive: Mobile-first with custom
xsbreakpoint (480px) inglobals.css
Data Flow
- Frontend → Zustand store manages UI state (agents, invoices, workflow steps, logs, theme, language)
- API Routes → Fetch invoices from Prisma DB, call AI provider, return analysis
- AI Providers → Unified interface supporting Anthropic, OpenAI, OpenRouter, Gemini
Zustand Persistence
The store persists to localStorage (paymind-storage): invoices, analysisResult, generatedMessages, responseAnalysis, aiSettings, theme, language, and visibility flags.
Commands
# Dashboard development
cd dashboard
npm install
npm run dev # Start dev server at localhost:3000
npm run build # Production build
npm run lint # ESLint
npx tsc --noEmit # Type checking (no tests defined)
# Database setup
npx prisma db push # Apply schema to SQLite
npx prisma studio # Database GUI
# CLI agent invocation
claude "payment-monitor-agent: analizza invoices.csv"
claude "reminder-generator-agent: genera email per FAT-2025-001"
claude "response-handler-agent: analizza questa risposta: [text]"Environment Variables
Create dashboard/.env:
DATABASE_URL="file:./dev.db"
ANTHROPIC_API_KEY=sk-ant-...
OPENAI_API_KEY=sk-... # Optional
OPENROUTER_API_KEY=... # Optional
GEMINI_API_KEY=... # OptionalPriority Calculation
| Priority | Criteria |
| ALTA | >90 days overdue OR amount >€1,000 OR disputed status |
| MEDIA | 60-90 days overdue |
| BASSA | <60 days overdue |
Response Handler Intents
The response handler recognizes these customer intents:
payment_confirmed- Customer confirms payment was maderequest_info- Customer requests invoice copy or detailsdispute- Customer disputes the invoicerequest_delay- Customer requests payment extension/installmentspayment_promise- Customer promises to pay by specific datealready_paid- Customer claims already paiderror_invoice- Customer reports invoice error
CSV Invoice Format
Required columns: invoice_id, customer_name, amount_total, amount_paid, due_date, status (open/paid/disputed), preferred_channel (email/sms/whatsapp), customer_email, customer_phone
API Routes
| Route | Method | Purpose |
/api/agents/payment-monitor | POST | Run invoice analysis |
/api/agents/reminder-generator | POST | Generate reminder messages |
/api/agents/response-handler | POST | Analyze customer response |
/api/invoices | GET/POST/DELETE | CRUD for invoices |
/api/settings | GET/POST | AI provider settings |
/api/workflow-runs | GET/POST/DELETE | Workflow execution history |
Dark Mode (Tailwind v4)
The app uses manual theme toggle with the .dark class selector, NOT the system prefers-color-scheme. Tailwind v4 requires explicit configuration in globals.css:
@custom-variant dark (&:is(.dark *));Theme flow:
layout.tsxinjects inline script to readlocalStorage('paymind-storage')and apply.darkclass before hydrationpage.tsxuseEffect syncs theme state todocument.documentElement.classList- Store persists theme to localStorage via Zustand persist middleware
Key Files
dashboard/src/lib/ai-providers.ts- Multi-provider AI abstraction withcallAI(),AVAILABLE_MODELS,PROVIDER_INFOdashboard/src/lib/agents.ts- System prompts:PAYMENT_MONITOR_PROMPT,REMINDER_GENERATOR_PROMPT,RESPONSE_HANDLER_PROMPTdashboard/src/lib/store.ts- Global Zustand state includingaiSettings,theme,languagedashboard/src/lib/i18n.ts- Translation system withuseTranslation()hook andformatMessage()for parameterized stringsdashboard/src/lib/pdf-export.ts- PDF report generation using jspdf + jspdf-autotabledashboard/src/types/index.ts- TypeScript interfaces: Agent, Invoice, LogEntry, WorkflowStep, AnalysisResultdashboard/prisma/schema.prisma- Database models: Invoice, Message, ResponseAnalysis, WorkflowRun, WorkflowLogdashboard/src/app/globals.css- Tailwind v4 config with dark mode custom variant
OpenRouter Free Models
OpenRouter provides 5 free models that work well for PayMind:
google/gemini-2.0-flash-exp:free- General purpose (default)deepseek/deepseek-r1-0528:free- Reasoning tasksmeta-llama/llama-3.3-70b-instruct:free- High-quality responsesmistralai/devstral-2512:free- Coding tasksmistralai/mistral-small-3.1-24b-instruct:free- Fast responses
Language
Italian business communications. Agent prompts and generated messages use Italian. Dashboard UI supports Italian/English toggle.
CI/CD
GitHub Actions runs on push/PR to main (.github/workflows/ci.yml): validates project structure (README.md, .claude directory).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

