Skip to main content

Module Research Prompts

AI-First FP&A Platform - Deep Requirement Decomposition


Usage Instructions

Each prompt is designed to be executed independently with full context. Copy the entire prompt block and use with Claude or another LLM to generate production-ready specifications and code.

Estimated Execution Time: 3-8 hours per prompt
Output Format: Technical specification + code + tests + documentation


MOD-001: General Ledger Engine

Prompt

# CONTEXT
You are designing the General Ledger (GL) Engine for an AI-first FP&A platform. This module is the core accounting backbone that must support multi-entity structures, real-time posting, soft/hard close controls, and integration with AI agents for automated journal entry creation.

# REQUIREMENTS

## Functional Requirements
1. **Multi-Entity Support**: Unlimited legal entities within a tenant
2. **Real-Time Posting**: Sub-second journal entry posting with ACID guarantees
3. **Soft/Hard Close**: Period close management with configurable controls
4. **Retained Earnings**: Automatic year-end rollforward
5. **Segment Accounting**: 10+ custom dimensions (cost center, project, customer, etc.)
6. **Currency Support**: Multi-currency with FX revaluation
7. **Intercompany**: Automated intercompany transaction tracking

## Technical Constraints
- PostgreSQL 16 with RLS for multi-tenancy
- Event-driven architecture (Kafka events on all state changes)
- OpenFGA for authorization (who can post, approve, close)
- immudb for audit trail

## Integration Points
- AI Agents: Journal entry creation/approval workflows
- Planning Module: Actuals for budget vs actual
- Reporting Module: Trial balance, financial statements
- Integration Module: Receive transactions from ERPs

# DELIVERABLES

1. **Data Model**: Complete PostgreSQL schema with:
- Tables, indexes, constraints
- RLS policies
- Triggers for audit/events
- Partitioning strategy

2. **API Specification**: OpenAPI 3.1 spec for:
- CRUD operations
- Posting workflow
- Period close operations
- Query endpoints

3. **Domain Events**: Event schemas for:
- journal_entry.created
- journal_entry.posted
- journal_entry.reversed
- period.closed

4. **Business Logic**: Python implementation for:
- Double-entry validation
- Period validation
- Authorization checks
- Balance calculation

5. **Test Cases**: Pytest specifications for:
- Unit tests
- Integration tests
- Compliance tests

# OUTPUT FORMAT
Structure your response as:
1. Architecture Overview (with Mermaid diagram)
2. Data Model (SQL DDL)
3. API Specification (OpenAPI YAML)
4. Event Schemas (JSON Schema)
5. Core Business Logic (Python)
6. Test Specifications
7. Deployment Considerations

MOD-002: Chart of Accounts Manager

Prompt

# CONTEXT
Design the Chart of Accounts (COA) Manager for an AI-first FP&A platform. This module manages hierarchical account structures, cross-system account mapping, and provides AI-assisted account classification.

# REQUIREMENTS

## Functional Requirements
1. **Hierarchical Structure**: Unlimited levels with parent-child relationships
2. **Account Types**: Asset, Liability, Equity, Revenue, Expense with subtypes
3. **Mapping Engine**: Map external ERP accounts to standard COA
4. **AI Classification**: Suggest account mappings based on name/description
5. **Version Control**: Track COA changes over time
6. **Rollup Definitions**: Configurable financial statement mappings
7. **Bulk Operations**: Import/export COA structures

## Technical Constraints
- Use LTREE extension for hierarchical queries
- Maintain audit trail of all changes
- Support account renumbering without breaking references
- Handle account mergers and splits

## AI Integration
- Auto-suggest mappings for new ERP accounts
- Classify transactions to accounts
- Detect anomalies in account usage

# DELIVERABLES

1. **Data Model**:
- Account hierarchy with LTREE
- Mapping rules engine
- Version history

2. **AI Components**:
- Account similarity model
- Classification prompt templates
- Confidence scoring

3. **API Specification**:
- Account CRUD
- Hierarchy operations
- Mapping management
- Bulk import/export

4. **Visualization**:
- React component for COA tree viewer
- Drag-drop hierarchy editor

# OUTPUT FORMAT
Provide complete technical specification with code samples, schema, and tests.

MOD-003: Journal Entry Processor

Prompt

# CONTEXT
Design the Journal Entry (JE) Processor for an AI-first FP&A platform. This module handles manual and automated journal entries with approval workflows, recurring entries, and AI-assisted entry creation.

# REQUIREMENTS

## Functional Requirements
1. **Entry Types**: Standard, Adjusting, Closing, Reversing, Recurring
2. **Approval Workflows**: Configurable multi-level approval chains
3. **Validation Rules**: Double-entry balance, period validation, account validation
4. **Attachments**: Support for source documents (PDF, images)
5. **Templates**: Reusable entry templates for common transactions
6. **Recurring Entries**: Scheduled automated entries with variation support
7. **Auto-Reversal**: Automatic reversal on period open

## AI Agent Integration
1. **Entry Suggestion**: AI suggests entries based on patterns
2. **Anomaly Detection**: Flag unusual entries for review
3. **Description Enhancement**: Generate clear, audit-ready descriptions
4. **Compliance Check**: Verify entries against policies

## Workflow States
draft → pending_approval → approved → posted → (reversed)

## Authorization Model (OpenFGA)
- can_create: editor role
- can_approve: approver role AND NOT creator
- can_post: after approval
- can_reverse: admin role

# DELIVERABLES

1. **State Machine**: Entry lifecycle with transitions
2. **Workflow Engine**: Approval routing logic
3. **Validation Framework**: Extensible rule engine
4. **AI Integration**: LangGraph workflow for suggestions
5. **API + Events**: Complete interface specification

# OUTPUT FORMAT
Technical specification with state diagrams, code, and test cases.

MOD-006: Budget Planning Engine

Prompt

# CONTEXT
Design the Budget Planning Engine for an AI-first FP&A platform. This module supports multiple budgeting methodologies (top-down, bottom-up, zero-based) with AI-assisted forecasting and scenario modeling.

# REQUIREMENTS

## Functional Requirements
1. **Budget Types**: Annual, Quarterly, Rolling, Zero-Based
2. **Methodologies**: Top-down allocation, Bottom-up collection, Hybrid
3. **Version Control**: Multiple budget versions with comparison
4. **Approval Workflow**: Multi-level budget approval process
5. **Allocation Engine**: Distribute budgets to cost centers/projects
6. **Driver-Based**: Link budgets to business drivers
7. **Phasing**: Spread annual budgets across periods

## AI Integration
1. **Auto-Forecast**: AI-generated budget suggestions based on history
2. **Anomaly Detection**: Flag unrealistic budget entries
3. **Driver Analysis**: Identify key budget drivers
4. **Commentary**: Generate budget narrative

## Workflow
draft → under_review → approved → locked → archived

# DELIVERABLES

1. **Data Model**: Budget structures, versions, allocations
2. **Calculation Engine**: Allocation algorithms, phasing logic
3. **Workflow System**: Approval state machine
4. **AI Components**: Forecasting integration
5. **API Specification**: Complete endpoint documentation
6. **Excel Interface**: Import/export with formula preservation

# OUTPUT FORMAT
Complete technical specification with calculation formulas and code.

MOD-008: Rolling Forecast Engine

Prompt

# CONTEXT
Design the Rolling Forecast Engine powered by NeuralProphet for an AI-first FP&A platform. This module generates 13-week and 18-month rolling forecasts with ML-powered predictions.

# REQUIREMENTS

## Functional Requirements
1. **Forecast Horizons**: 13-week (cash flow), 18-month (P&L)
2. **Methods**: NeuralProphet, ARIMA, XGBoost, Ensemble
3. **Regressors**: Include external drivers (seasonality, economic indicators)
4. **Confidence Intervals**: 80% and 95% prediction bands
5. **Scenario Integration**: Apply scenario adjustments to forecasts
6. **Accuracy Tracking**: Historical accuracy metrics
7. **Explanation**: Decompose forecast into components

## ML Pipeline
1. Data extraction and feature engineering
2. Model selection (auto-ML or manual)
3. Training with cross-validation
4. Prediction with uncertainty quantification
5. Explanation generation
6. Accuracy tracking and retraining triggers

## Integration
- Actuals from GL for training data
- Planning module for baseline adjustments
- Reporting module for visualization
- NLG for forecast commentary

# DELIVERABLES

1. **ML Pipeline**: Dagster DAG for forecast generation
2. **Model Configuration**: NeuralProphet hyperparameters
3. **API Specification**: Forecast endpoints
4. **Explanation Module**: Component breakdown
5. **Monitoring**: Accuracy dashboards

# OUTPUT FORMAT
Complete ML pipeline specification with Python code and configuration.

MOD-011: Variance Analysis Agent

Prompt

# CONTEXT
Design the Variance Analysis Agent using LangGraph for an AI-first FP&A platform. This agent automatically analyzes budget vs actual variances, identifies root causes, and generates executive-quality commentary.

# REQUIREMENTS

## Functional Requirements
1. **Variance Calculation**: Budget vs Actual, Period over Period
2. **Root Cause Analysis**: Drill down to driver level
3. **Materiality Filtering**: Focus on significant variances
4. **Trend Detection**: Identify recurring patterns
5. **Commentary Generation**: CFO-quality narratives
6. **Recommendations**: Suggest corrective actions

## Agent Architecture (LangGraph)

classify_request ↓ load_variance_data ↓ calculate_variances ↓ identify_drivers (parallel analysis) ↓ generate_commentary (LLM) ↓ compliance_check ↓ return_results


## LLM Prompts
1. **Driver Analysis**: "Given these variances, identify the top 3 contributing factors..."
2. **Commentary Generation**: "Write CFO-quality variance commentary for..."
3. **Recommendation**: "Based on this variance analysis, recommend..."

## Output Formats
- Executive summary (1 paragraph)
- Detailed analysis (structured report)
- Action items (bulleted list)
- Visualizations (waterfall chart data)

# DELIVERABLES

1. **LangGraph Workflow**: Complete state graph
2. **Prompts**: Optimized LLM prompts
3. **Data Loaders**: Variance data extraction
4. **Commentary Templates**: Multiple formats
5. **API Integration**: Endpoint specification
6. **Tests**: Agent behavior tests

# OUTPUT FORMAT
LangGraph workflow definition with Python code and prompt templates.

MOD-016: Bank Reconciliation Agent

Prompt

# CONTEXT
Design the Bank Reconciliation Agent for an AI-first FP&A platform. This agent automates matching bank transactions to GL entries with ML-powered fuzzy matching and exception handling.

# REQUIREMENTS

## Functional Requirements
1. **Auto-Matching**: 95%+ automatic match rate target
2. **Fuzzy Matching**: Handle amount/date variations
3. **Pattern Learning**: Improve matching from feedback
4. **Exception Management**: Workflow for unmatched items
5. **Multi-Currency**: Handle FX rate differences
6. **Reconciliation Reports**: Statement summaries

## Matching Algorithm
1. Exact match (amount + date + reference)
2. Fuzzy match (±$0.10, ±2 days)
3. One-to-many / Many-to-one matching
4. AI-suggested matches with confidence scores

## Agent Workflow

load_bank_statement ↓ load_gl_transactions ↓ exact_matching (parallel) ↓ fuzzy_matching (remaining) ↓ ai_suggestion (low confidence) ↓ human_review (exceptions) ↓ finalize_reconciliation


## Learning Loop
- Track user corrections
- Retrain matching model weekly
- Improve confidence thresholds

# DELIVERABLES

1. **Matching Engine**: Rule-based + ML hybrid
2. **LangGraph Workflow**: Reconciliation agent
3. **Exception UI**: React component
4. **Reporting**: Reconciliation status
5. **API Specification**: Endpoints
6. **ML Model**: Matching classifier

# OUTPUT FORMAT
Complete reconciliation engine with ML pipeline and agent workflow.

MOD-021: Orchestrator Agent

Prompt

# CONTEXT
Design the Orchestrator Agent using LangGraph for an AI-first FP&A platform. This is the main entry point that coordinates all other agents, manages conversation state, and routes tasks to specialized agents.

# REQUIREMENTS

## Functional Requirements
1. **Task Classification**: Identify intent from user query
2. **Agent Routing**: Direct to appropriate specialized agent
3. **Context Management**: Maintain conversation state across turns
4. **Error Recovery**: Handle agent failures gracefully
5. **Compliance Gates**: Ensure all actions pass compliance checks
6. **Audit Logging**: Full activity trail

## Supported Task Types
- Reconciliation requests
- Variance analysis
- Forecasting
- Report generation
- Journal entry creation
- Budget queries
- Ad-hoc queries

## Agent Architecture

user_input ↓ classify_intent ↓ route_to_agent ──┬── reconciliation_agent ├── variance_agent ├── forecast_agent ├── report_agent ├── journal_agent └── query_agent ↓ agent_execution (with checkpoints) ↓ compliance_validation ↓ synthesize_response ↓ return_to_user


## State Management
- PostgreSQL checkpoint storage
- 90-day conversation retention
- Context summarization for long conversations

## Human-in-the-Loop
- Escalation triggers
- Approval gates
- Feedback collection

# DELIVERABLES

1. **LangGraph Workflow**: Complete orchestrator graph
2. **Classifier**: Intent classification with examples
3. **Router**: Agent selection logic
4. **State Schema**: AgentState TypedDict
5. **Checkpoint Config**: PostgreSQL setup
6. **API Integration**: Chat endpoints
7. **Tests**: Routing and state tests

# OUTPUT FORMAT
Production-ready LangGraph orchestrator with full documentation.

MOD-024: Compliance Monitoring Agent

Prompt

# CONTEXT
Design the Compliance Monitoring Agent for an AI-first FP&A platform. This agent continuously monitors system activity for compliance with SOX, SOC 2, HIPAA, and FDA 21 CFR Part 11 requirements.

# REQUIREMENTS

## Functional Requirements
1. **Control Monitoring**: Continuous compliance checks
2. **Policy Validation**: Ensure adherence to defined policies
3. **Evidence Collection**: Automated compliance documentation
4. **Gap Identification**: Alert on compliance risks
5. **Remediation Tracking**: Manage corrective actions
6. **Audit Support**: Generate auditor-ready packages

## Compliance Frameworks
| Framework | Key Controls |
|-----------|--------------|
| SOX 302/404 | Access control, audit trail, change management |
| SOC 2 | Security, availability, confidentiality |
| HIPAA | PHI protection, access logs |
| FDA 21 CFR Part 11 | Electronic records, signatures |

## Monitoring Categories
1. **Access Controls**: Segregation of duties violations
2. **Data Integrity**: Unauthorized modifications
3. **Audit Trail**: Completeness verification
4. **Change Management**: Unauthorized changes
5. **Authentication**: Failed login patterns

## Agent Workflow

schedule_trigger (or event_trigger) ↓ collect_evidence ↓ evaluate_controls ↓ detect_violations ↓ risk_assessment ↓ generate_alerts ↓ update_evidence_repository


# DELIVERABLES

1. **Control Library**: Defined controls per framework
2. **Monitoring Rules**: Check implementations
3. **Evidence Collector**: Automated gathering
4. **Alert System**: Notification configuration
5. **Dashboard**: Compliance status visualization
6. **Reports**: Audit package generation

# OUTPUT FORMAT
Complete compliance monitoring system with control definitions and automation.

Summary Matrix

PromptModulePriorityComplexityEst. Hours
MOD-001General Ledger EngineP0High8
MOD-002Chart of Accounts ManagerP0Medium4
MOD-003Journal Entry ProcessorP0High6
MOD-006Budget Planning EngineP0High6
MOD-008Rolling Forecast EngineP0Very High8
MOD-011Variance Analysis AgentP0High6
MOD-016Bank Reconciliation AgentP0High6
MOD-021Orchestrator AgentP0Very High8
MOD-024Compliance Monitoring AgentP0High6

Total Estimated Research Time: ~58 hours for P0 modules