Skip to main content

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

AttributeValue
CodenameAvivatec FP&A
TypeStandalone AI-first Financial Planning & Analysis platform
MarketsBrazil (primary) + USA (secondary)
Target UsersCFOs, Controllers, FP&A Analysts, Accountants, Auditors
DeploymentSelf-hosted, private cloud (GCP/AWS), or managed SaaS
AI ModelAir-gapped local LLMs — zero external AI dependencies
LicensingOpen-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

IDSub-PromptDomainDependenciesOutput Artifacts
01Data ArchitecturePostgreSQL schema, RLS, DuckDB, data modelNone (foundation)DDL, ER diagrams, RLS policies
02AI/ML PipelineForecasting, NLQ, model serving, explainability01 (schema)Training pipelines, model registry, APIs
03Integration & ELTAirbyte, dbt, Dagster, CDC, ERP connectors01 (schema)Connector configs, dbt project, DAGs
04Security & ComplianceAuth, audit, LGPD, SOC 2, RBAC, encryption01 (schema)OpenFGA policies, audit schema, controls
05Core Financial OpsAP, AR, Cash, Reimbursement, Accounting01, 03, 04Feature specs, API contracts, workflows
06FP&A IntelligenceForecasting, Budgeting, Scenarios, Variance01, 02, 05Engine specs, calculation models
07Agentic AI SystemMulti-agent orchestration, chat, bots02, 04, 05, 06Agent architecture, delegation templates
08InfrastructureDocker, K8s, Helm, Terraform, DR01–04 (all services)IaC files, deployment guides
09Frontend & UXReact components, dashboards, Excel, mobile05, 06, 07 (APIs)Component architecture, design system
10Coditect ImpactProduct strategy, template library, positioningAll (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:

  1. INJECT CONTEXT: Prepend this master orchestrator as system context
  2. FEED DEPENDENCIES: Append output artifacts from upstream sub-prompts
  3. EXECUTE: Run the sub-prompt against the target model
  4. VALIDATE: Check output against constraints below
  5. 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

  1. Zero proprietary AI — all inference local (vLLM/Ollama)
  2. Open-source core — MIT, Apache 2.0, AGPL, BSD only
  3. Multi-tenant RLS — every table, every query, tenant-isolated
  4. Dual jurisdiction — Brazilian (NF-e, LGPD, BACEN) + US (GAAP, SOX, SOC 2)
  5. P95 API < 500ms — forecast generation < 30s for 5-year history
  6. Air-gap capable — full offline/on-premises deployment
  7. Audit everything — every AI decision, mutation, access event → immudb
  8. Explainable AI — every forecast → source transactions + model version + reasoning

Technology Stack (locked)

LayerChoiceLocked?
OLTP DBPostgreSQL 16+
OLAP DBDuckDB
Audit DBimmudb
BackendFastAPI (Python) + Go
FrontendReact (Refine/Next.js)
ELTAirbyte + dbt Core
OrchestrationDagster
AI InferencevLLM (DeepSeek-R1)
ForecastingNeuralProphet
Agent FrameworkLangGraph + CrewAI
Auth PolicyOpenFGA
IdentityZitadel
ContainersKubernetes + 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)

PhaseMonthsFocusSub-Prompts
Phase 11–3Decouple infrastructure01, 03, 04, 08
Phase 24–6AI layer modernization02, 07
Phase 37–9ELT universalization + core ops03, 05
Phase 410–12Advanced FP&A + UX06, 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.