00 — Master Orchestrator: Avivatec AI-First FP&A Platform
Version: 2.0 — Decomposed Orchestration Model Date: 2026-02-03 Pattern: Orchestrator-Workers with Dependency Graph
PURPOSE
This is the master orchestration prompt for designing the Avivatec AI-First FP&A platform. It coordinates 10 specialized sub-prompts, each focused on a single architectural domain. Execute sub-prompts in dependency order, feeding outputs forward as context.
PLATFORM IDENTITY
| Attribute | Value |
|---|---|
| Codename | Avivatec FP&A |
| Type | Standalone AI-first Financial Planning & Analysis platform |
| Markets | Brazil (primary) + USA (secondary) |
| Target Users | CFOs, Controllers, FP&A Analysts, Accountants, Auditors |
| Deployment | Self-hosted, private cloud (GCP/AWS), or managed SaaS |
| AI Model | Air-gapped local LLMs — zero external AI dependencies |
| Licensing | Open-source core (MIT/Apache 2.0/AGPL/BSD) |
CURRENT STATE (Avivatec AS-IS)
Stack: Angular / .NET Core / SQL Server / Azure
AI: Azure OpenAI (chat, OCR, categorization)
Modules: 13 functional modules (F-001 → F-013), 100+ user stories
Budget: R$298,368 / 9 months
Compliance: LGPD, BACEN/CVM (from case studies)
Limitations: Azure lock-in, proprietary AI, no forecasting/budgeting/scenarios
Existing Modules (preserve and enhance): F-001 Architecture, F-002 Access Control, F-003 Subscriptions, F-004 Subscribers, F-005 Onboarding, F-006 Competency Vision, F-007 Accounts Payable, F-008 Accounts Receivable, F-009 Cash & Bank, F-010 Expense Reimbursement, F-011 Accounting Integration, F-012 Reports & Dashboards, F-013 Financial Agent / AI
TARGET STATE (AI-First TO-BE)
Stack: React (Refine) / FastAPI+Go / PostgreSQL 16 / Kubernetes
AI: DeepSeek-R1 via vLLM (self-hosted), NeuralProphet, PyOD, LangGraph
Data: Airbyte → dbt Core → Dagster orchestration
Audit: immudb (Merkle tree) + pgaudit
Auth: OpenFGA (Zanzibar) + Zitadel (OIDC)
Monitoring: Prometheus + Grafana + Vector
New FP&A: Forecasting, Budgeting, Scenarios, Variance Analysis, Agentic AI
SUB-PROMPT INVENTORY
| ID | Sub-Prompt | Domain | Dependencies | Output Artifacts |
|---|---|---|---|---|
| 01 | Data Architecture | PostgreSQL schema, RLS, DuckDB, data model | None (foundation) | DDL, ER diagrams, RLS policies |
| 02 | AI/ML Pipeline | Forecasting, NLQ, model serving, explainability | 01 (schema) | Training pipelines, model registry, APIs |
| 03 | Integration & ELT | Airbyte, dbt, Dagster, CDC, ERP connectors | 01 (schema) | Connector configs, dbt project, DAGs |
| 04 | Security & Compliance | Auth, audit, LGPD, SOC 2, RBAC, encryption | 01 (schema) | OpenFGA policies, audit schema, controls |
| 05 | Core Financial Ops | AP, AR, Cash, Reimbursement, Accounting | 01, 03, 04 | Feature specs, API contracts, workflows |
| 06 | FP&A Intelligence | Forecasting, Budgeting, Scenarios, Variance | 01, 02, 05 | Engine specs, calculation models |
| 07 | Agentic AI System | Multi-agent orchestration, chat, bots | 02, 04, 05, 06 | Agent architecture, delegation templates |
| 08 | Infrastructure | Docker, K8s, Helm, Terraform, DR | 01–04 (all services) | IaC files, deployment guides |
| 09 | Frontend & UX | React components, dashboards, Excel, mobile | 05, 06, 07 (APIs) | Component architecture, design system |
| 10 | Coditect Impact | Product strategy, template library, positioning | All (synthesis) | Impact matrix, strategy doc |
EXECUTION DEPENDENCY GRAPH
┌──────────┐
│ 01-DATA │ ← Foundation (execute first)
└────┬─────┘
┌──────────┼──────────┐
▼ ▼ ▼
┌──────────┐ ┌──────────┐ ┌──────────┐
│ 02-AI/ML │ │ 03-ELT │ │ 04-SECUR │ ← Layer 2 (parallel)
└────┬─────┘ └────┬─────┘ └────┬─────┘
│ │ │
└──────────┼──────────┘
▼
┌──────────┐
│ 05-FINOP │ ← Layer 3
└────┬─────┘
▼
┌──────────┐
│ 06-FP&A │ ← Layer 4
└────┬─────┘
▼
┌──────────┐
│ 07-AGENT │ ← Layer 5
└────┬─────┘
┌──────────┼──────────┐
▼ ▼ ▼
┌──────────┐ ┌──────────┐ ┌──────────┐
│ 08-INFRA │ │ 09-UX │ │ 10-CODIT │ ← Layer 6 (parallel)
└──────────┘ └──────────┘ └──────────┘
EXECUTION PROTOCOL
For Each Sub-Prompt:
- INJECT CONTEXT: Prepend this master orchestrator as system context
- FEED DEPENDENCIES: Append output artifacts from upstream sub-prompts
- EXECUTE: Run the sub-prompt against the target model
- VALIDATE: Check output against constraints below
- STORE: Save artifacts for downstream consumption
Context Injection Template:
[This Master Orchestrator — 00]
+
[Upstream artifacts from dependency sub-prompts]
+
[Target sub-prompt — 01 through 10]
GLOBAL CONSTRAINTS (Apply to ALL sub-prompts)
Non-Negotiables
- Zero proprietary AI — all inference local (vLLM/Ollama)
- Open-source core — MIT, Apache 2.0, AGPL, BSD only
- Multi-tenant RLS — every table, every query, tenant-isolated
- Dual jurisdiction — Brazilian (NF-e, LGPD, BACEN) + US (GAAP, SOX, SOC 2)
- P95 API < 500ms — forecast generation < 30s for 5-year history
- Air-gap capable — full offline/on-premises deployment
- Audit everything — every AI decision, mutation, access event → immudb
- Explainable AI — every forecast → source transactions + model version + reasoning
Technology Stack (locked)
| Layer | Choice | Locked? |
|---|---|---|
| OLTP DB | PostgreSQL 16+ | ✅ |
| OLAP DB | DuckDB | ✅ |
| Audit DB | immudb | ✅ |
| Backend | FastAPI (Python) + Go | ✅ |
| Frontend | React (Refine/Next.js) | ✅ |
| ELT | Airbyte + dbt Core | ✅ |
| Orchestration | Dagster | ✅ |
| AI Inference | vLLM (DeepSeek-R1) | ✅ |
| Forecasting | NeuralProphet | ✅ |
| Agent Framework | LangGraph + CrewAI | ✅ |
| Auth Policy | OpenFGA | ✅ |
| Identity | Zitadel | ✅ |
| Containers | Kubernetes + Helm | ✅ |
Output Standards
- Format: Markdown with Mermaid diagrams
- Code: Production-ready (not pseudocode)
- Citations: Official docs, arxiv papers, GitHub repos
- Compliance: Annotate features → regulatory requirements
- ADR format: Context → Decision → Consequences → Alternatives
MIGRATION PHASES (Timeline Reference)
| Phase | Months | Focus | Sub-Prompts |
|---|---|---|---|
| Phase 1 | 1–3 | Decouple infrastructure | 01, 03, 04, 08 |
| Phase 2 | 4–6 | AI layer modernization | 02, 07 |
| Phase 3 | 7–9 | ELT universalization + core ops | 03, 05 |
| Phase 4 | 10–12 | Advanced FP&A + UX | 06, 09, 10 |
SUCCESS CRITERIA (Global)
- Senior engineer deploys full stack in < 4 hours via IaC
- CFO generates rolling 12-month forecast in < 5 clicks
- Auditor verifies AI provenance back to source transactions
- Pen test passes with zero critical vulnerabilities
- All 13 existing modules have documented migration paths
- AI agent completes autonomous month-end variance analysis
- Multi-currency consolidation matches Excel to < $0.01
SUGGESTED EXECUTION ORDER
Sequential (recommended for thoroughness): 01 → 02 → 03 → 04 → 05 → 06 → 07 → 08 → 09 → 10
Parallel (recommended for speed):
- Wave 1: 01
- Wave 2: 02 + 03 + 04 (parallel)
- Wave 3: 05
- Wave 4: 06
- Wave 5: 07
- Wave 6: 08 + 09 + 10 (parallel)
This orchestrator replaces the monolithic 700+ line master prompt with 10 focused sub-prompts averaging 80-120 lines each, enabling parallel execution, targeted iteration, and efficient token usage per model invocation.