# Knowledge Base: Agent 2 — The Production Engine

> **Grounding Context Document**: Upload to ChatGPT Custom GPT Knowledge, Gemini Gem Context, or Claude Project Knowledge.

---

## 1. Deterministic Calculation Engine API Schemas (MCP)

To prevent LLM arithmetic errors, Agent 2 invokes deterministic Python/MCP calculation tools using these JSON schemas:

```json
{
  "tools": [
    {
      "name": "calculate_lbo_waterfall",
      "description": "Deterministic Python LBO calculation engine computing debt paydown, MOIC, and Net IRR.",
      "parameters": {
        "type": "object",
        "properties": {
          "entry_ev": { "type": "number" },
          "entry_ebitda": { "type": "number" },
          "debt_percentage": { "type": "number" },
          "interest_rate": { "type": "number" },
          "revenue_growth_rate": { "type": "number" },
          "exit_multiple": { "type": "number" },
          "hold_years": { "type": "integer", "default": 5 }
        },
        "required": ["entry_ev", "entry_ebitda", "debt_percentage", "exit_multiple"]
      }
    },
    {
      "name": "generate_sensitivity_matrix",
      "description": "Compute 2D exit multiple vs debt percentage sensitivity grid.",
      "parameters": {
        "type": "object",
        "properties": {
          "multiples_range": { "type": "array", "items": { "type": "number" } },
          "debt_pct_range": { "type": "array", "items": { "type": "number" } }
        }
      }
    }
  ]
}
```

---

## 2. Plan-Execute Contract Architecture

Before executing any deliverable, Agent 2 generates a strict **Plan-Execute Contract**:

```markdown
# PLAN-EXECUTE CONTRACT: Project Vantage 40-Tab LBO & CIM
- **Contract ID**: `LBO-PLN-882`
- **Execution Mode**: Subagent Parallel Fan-Out

## Execution Plan Steps
1. [STEP 1]: Ingest Agent 1 historical financial payload (Revenue $1,420M, EBITDA $402M).
2. [STEP 2]: Invoke `calculate_lbo_waterfall` via MCP deterministic engine.
3. [STEP 3]: Invoke `generate_sensitivity_matrix` via MCP deterministic engine.
4. [STEP 4]: Fan-out Subagent 1 (Industry Overview), Subagent 2 (Revenue Build), Subagent 3 (Management Bios).
5. [STEP 5]: Perform Integration Review & Brand Voice UI compliance check.
```

---

## 3. Brand Voice & UI Design Tokens

Apply these firm design tokens to all generated artifacts:
- **Typography**: Primary `Inter, sans-serif`, Headings `Outfit, sans-serif`.
- **Color Palette**: Primary Navy `#0F172A`, Accent Blue `#2563EB`, Card Background `#1E293B`, Text `#F8FAFC`.
- **Table Formatting**: Dark slate headers, zebra striping on alternating rows, right-aligned numbers.

---

## 4. Procedural Memory Schema (MD Preference Engine)

```json
{
  "procedural_memory": {
    "md_sarah_jenkins": {
      "ebitda_adjustment_formatting": "Indented line items with asterisk footnotes",
      "debt_tranche_display": "Split Senior Debt into Term Loan A and Term Loan B",
      "sensitivity_matrix_metric": "Net IRR (%)",
      "idempotent_retry_policy": "Max 3 retries with backoff"
    }
  }
}
```
