@nestbox-ai/cli 1.0.63 → 1.0.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,28 @@
1
+ You are a Nestbox report composer expert. Your job is to generate a valid `report.yaml` configuration file that drives a GraphRAG-powered document analysis report.
2
+
3
+ ## Your workflow
4
+
5
+ Use the provided tools in this order:
6
+ 1. Read the user's instructions carefully — they describe the document type, what metrics to extract, and how the report should look
7
+ 2. Call `write_and_validate_report` with your complete report.yaml content
8
+ 3. If the tool returns validation errors, read them carefully, fix ALL issues, and call the tool again
9
+ 4. Keep iterating until the file passes validation
10
+ 5. Once valid, call `finish` to signal completion
11
+
12
+ ## Rules
13
+
14
+ - Always set `schema_version: "2.2"` — this is the current version
15
+ - Generate a `report.id` that is lowercase with underscores/hyphens only (e.g., `acme_cfo_report_q4`)
16
+ - Every field computation must have at least one agent subtask with a `prompt` and `output_schema`
17
+ - Every `output_schema` must include `type: object` at the root and a `citations` array property
18
+ - Use `mcp_scope: []` on every computation unless the user specifically requests MCP integration
19
+ - Set `docset_id` at the computation level (not just at the subtask level) for all computations
20
+ - Use autonomous agent mode (omit `search_type`) unless there is a clear reason to constrain it
21
+ - Every computation prompt must include a ## Search Strategy section with 2–3 concrete queries
22
+ - Always include `notes: { type: string }` in output_schema for the agent to record missing data
23
+ - The `template.content` must reference every field and table computation via placeholders
24
+ - Include at least 2 guardrails: one for citation completeness and one for fabrication detection
25
+ - Set all API keys using `${ENV_VAR}` syntax — never hardcode secrets
26
+ - Use `doc_repository` with `${DOC_REPO_API_KEY}` when documents will be fetched from a repo
27
+ - Never use placeholder text like "..." or "TODO" in the output file
28
+ - The `report.id` field is required and must match the pattern `^[a-z0-9][a-z0-9_-]*[a-z0-9]$`
@@ -0,0 +1,633 @@
1
+ # Public Company Annual Report / 10-K Analysis
2
+ # Use case: Structured extraction from a public company's annual report or SEC 10-K filing.
3
+ # Extracts the income statement, balance sheet, cash flow, key ratios, segment breakdown,
4
+ # management outlook (MD&A), and risk factors for equity research or credit analysis.
5
+ # Schema v2.2
6
+
7
+ schema_version: "2.2"
8
+
9
+ report:
10
+ id: annual_report_acme_fy2025
11
+ name: "Annual Report Analysis — Acme Technologies, FY2025 10-K"
12
+ description: |
13
+ Structured extraction from Acme Technologies FY2025 Annual Report / 10-K.
14
+ Covers consolidated income statement, balance sheet, cash flow statement,
15
+ segment performance, key financial ratios, MD&A highlights, and risk factors.
16
+ version: "FY2025"
17
+
18
+ context:
19
+ company_name: "Acme Technologies, Inc."
20
+ ticker: "ACME"
21
+ fiscal_year: "FY2025"
22
+ fiscal_year_end: "2025-12-31"
23
+ currency: "USD"
24
+ reporting_units: "thousands" # most 10-Ks report in $thousands — adjust if different
25
+ units_policy: |
26
+ The 10-K reports values in thousands of dollars. Return values as STATED in the filing.
27
+ If the filing says "$1,234,567" that is already in thousands — return 1234567 (not 1234567000).
28
+ Clarify the unit in the notes field.
29
+ Return percentages as whole numbers (34.5 not 0.345).
30
+ Return null for any value not explicitly stated.
31
+ answer_quality_policy:
32
+ numeric_requirements:
33
+ - "Every financial statement line must have a citation"
34
+ - "Note the reporting units (thousands, millions) for each figure"
35
+ - "Distinguish between continuing and discontinued operations where relevant"
36
+
37
+ doc_repository:
38
+ api_base_url: ${DOC_REPO_URL:-http://localhost:8080}
39
+ api_key: ${DOC_REPO_API_KEY}
40
+ rotation: 200
41
+
42
+ mcp: []
43
+
44
+ docsets:
45
+ - id: annual_report
46
+ description: "Acme Technologies FY2025 Annual Report / 10-K Filing"
47
+ api_key: ${OPENAI_API_KEY}
48
+ docs:
49
+ - id: ten_k_filing
50
+ locator: "repo:doc-acme-10k-fy25"
51
+ description: "Acme Technologies 10-K FY2025 Full Filing"
52
+ alias: ten_k
53
+
54
+ llamaindex:
55
+ model: gpt-4o
56
+ base_url: ${OPENAI_BASE_URL:-https://api.openai.com/v1}
57
+ api_key: ${OPENAI_API_KEY}
58
+ max_tool_calls: 60
59
+ tool_timeout_seconds: 180
60
+ max_agent_iterations: 45
61
+ system_prompt: |
62
+ You are an equity research analyst extracting structured data from a public company 10-K.
63
+
64
+ ## ANTI-FABRICATION RULE
65
+ ALL values MUST come from your search tool results — the actual 10-K text.
66
+ Never use prior knowledge of this company's financials.
67
+ Return null for any value not explicitly stated in the filing.
68
+
69
+ ## 10-K Extraction Rules
70
+ 1. Financial statements are typically reported in thousands — note this in output
71
+ 2. Use the audited figures from the financial statements, not the MD&A summaries
72
+ 3. Always extract both the current year and prior year comparatives
73
+ 4. Segment data may be in a separate note — search explicitly for segment disclosures
74
+ 5. Non-GAAP measures (Adjusted EBITDA, etc.) are in MD&A — distinguish from GAAP
75
+ 6. Risk factors are in Item 1A — use global_search to find cross-cutting themes
76
+
77
+ computations:
78
+ fields:
79
+
80
+ # ── Income Statement ──────────────────────────────────────────────────────
81
+ - id: income_statement
82
+ label: "Consolidated Income Statement (FY2025 & FY2024)"
83
+ type: object
84
+ priority: 1
85
+ docset_id: annual_report
86
+ agents:
87
+ - id: income_stmt_extract
88
+ search_type: basic # income statement tables are best retrieved by basic search
89
+ options:
90
+ basic_search:
91
+ k: 15
92
+ prompt: |
93
+ Extract the consolidated income statement for FY2025 and FY2024.
94
+
95
+ ## What to Find
96
+ For each year (fy2025, fy2024):
97
+ - revenue: Total net revenue
98
+ - cost_of_revenue: Cost of revenue / cost of goods sold
99
+ - gross_profit: Gross profit
100
+ - gross_margin_pct: Gross profit / revenue × 100
101
+ - r_and_d: Research and development expense
102
+ - sales_and_marketing: Sales and marketing expense
103
+ - g_and_a: General and administrative expense
104
+ - total_opex: Total operating expenses (below gross profit line)
105
+ - operating_income: Operating income (EBIT)
106
+ - operating_margin_pct: Operating income / revenue × 100
107
+ - interest_expense: Interest expense (net)
108
+ - other_income_expense: Other income/expense
109
+ - pretax_income: Income before income taxes
110
+ - income_tax_expense: Income tax expense (benefit)
111
+ - net_income: Net income
112
+ - net_margin_pct: Net income / revenue × 100
113
+ - eps_diluted: Diluted EPS
114
+ - shares_diluted: Diluted weighted average shares outstanding
115
+ - units_label: What units are used ("thousands" / "millions")
116
+
117
+ ## Search Strategy
118
+ 1. basic_search: "consolidated statements of operations income revenue FY2025"
119
+ 2. basic_search: "gross profit operating income net income EPS diluted"
120
+ 3. Look for the formal income statement tables
121
+ output_schema:
122
+ type: object
123
+ properties:
124
+ units_label: { type: string }
125
+ fy2025:
126
+ type: object
127
+ properties:
128
+ revenue: { type: number }
129
+ cost_of_revenue: { type: number }
130
+ gross_profit: { type: number }
131
+ gross_margin_pct: { type: number }
132
+ r_and_d: { type: number }
133
+ sales_and_marketing: { type: number }
134
+ g_and_a: { type: number }
135
+ total_opex: { type: number }
136
+ operating_income: { type: number }
137
+ operating_margin_pct: { type: number }
138
+ interest_expense: { type: number }
139
+ pretax_income: { type: number }
140
+ income_tax_expense: { type: number }
141
+ net_income: { type: number }
142
+ net_margin_pct: { type: number }
143
+ eps_diluted: { type: number }
144
+ shares_diluted: { type: number }
145
+ fy2024:
146
+ type: object
147
+ properties:
148
+ revenue: { type: number }
149
+ gross_profit: { type: number }
150
+ gross_margin_pct: { type: number }
151
+ operating_income: { type: number }
152
+ net_income: { type: number }
153
+ eps_diluted: { type: number }
154
+ citations: { type: array, items: { type: string } }
155
+ notes: { type: string }
156
+ mcp_scope: []
157
+ prompt: "Return consolidated income statement for FY2025 and FY2024."
158
+
159
+ # ── Balance Sheet ─────────────────────────────────────────────────────────
160
+ - id: balance_sheet
161
+ label: "Consolidated Balance Sheet (FY2025 & FY2024)"
162
+ type: object
163
+ priority: 1
164
+ docset_id: annual_report
165
+ agents:
166
+ - id: balance_sheet_extract
167
+ search_type: basic
168
+ options:
169
+ basic_search:
170
+ k: 15
171
+ prompt: |
172
+ Extract the consolidated balance sheet as of FY2025 year-end and FY2024 year-end.
173
+
174
+ ## Current Assets
175
+ - cash_and_equivalents: Cash and cash equivalents
176
+ - short_term_investments: Short-term investments / marketable securities
177
+ - accounts_receivable: Net accounts receivable
178
+ - inventory: Inventory (if applicable)
179
+ - prepaid_and_other_current: Prepaid expenses and other current assets
180
+ - total_current_assets: Total current assets
181
+
182
+ ## Non-Current Assets
183
+ - ppe_net: Property, plant and equipment, net
184
+ - goodwill: Goodwill
185
+ - intangible_assets_net: Intangible assets, net
186
+ - operating_lease_rou: Operating lease right-of-use assets (if stated separately)
187
+ - other_long_term_assets: Other long-term assets
188
+ - total_assets: Total assets
189
+
190
+ ## Current Liabilities
191
+ - accounts_payable: Accounts payable
192
+ - accrued_liabilities: Accrued liabilities / accrued expenses
193
+ - deferred_revenue_current: Deferred revenue (current)
194
+ - current_debt: Current portion of long-term debt
195
+ - total_current_liabilities: Total current liabilities
196
+
197
+ ## Non-Current Liabilities
198
+ - long_term_debt: Long-term debt (net of current portion)
199
+ - deferred_revenue_lt: Deferred revenue (long-term)
200
+ - operating_lease_lt: Long-term operating lease liabilities
201
+ - other_long_term_liabilities: Other long-term liabilities
202
+ - total_liabilities: Total liabilities
203
+
204
+ ## Equity
205
+ - total_stockholders_equity: Total stockholders' equity
206
+ - total_liabilities_and_equity: Total liabilities and stockholders' equity
207
+
208
+ ## Search Strategy
209
+ 1. basic_search: "consolidated balance sheet total assets liabilities equity"
210
+ 2. basic_search: "cash receivable goodwill debt long-term"
211
+ output_schema:
212
+ type: object
213
+ properties:
214
+ units_label: { type: string }
215
+ fy2025:
216
+ type: object
217
+ properties:
218
+ cash_and_equivalents: { type: number }
219
+ short_term_investments: { type: number }
220
+ accounts_receivable: { type: number }
221
+ total_current_assets: { type: number }
222
+ ppe_net: { type: number }
223
+ goodwill: { type: number }
224
+ intangible_assets_net: { type: number }
225
+ total_assets: { type: number }
226
+ accounts_payable: { type: number }
227
+ current_debt: { type: number }
228
+ total_current_liabilities: { type: number }
229
+ long_term_debt: { type: number }
230
+ total_liabilities: { type: number }
231
+ total_stockholders_equity: { type: number }
232
+ fy2024:
233
+ type: object
234
+ properties:
235
+ cash_and_equivalents: { type: number }
236
+ total_assets: { type: number }
237
+ long_term_debt: { type: number }
238
+ total_stockholders_equity: { type: number }
239
+ citations: { type: array, items: { type: string } }
240
+ mcp_scope: []
241
+ prompt: "Return consolidated balance sheet for FY2025 and FY2024."
242
+
243
+ # ── Cash Flow Statement ───────────────────────────────────────────────────
244
+ - id: cash_flow
245
+ label: "Consolidated Cash Flow Statement (FY2025)"
246
+ type: object
247
+ priority: 1
248
+ docset_id: annual_report
249
+ agents:
250
+ - id: cash_flow_extract
251
+ search_type: basic
252
+ options:
253
+ basic_search:
254
+ k: 15
255
+ prompt: |
256
+ Extract the consolidated cash flow statement for FY2025.
257
+
258
+ ## Operating Activities
259
+ - net_income_cf: Net income (starting line)
260
+ - depreciation_and_amortization: D&A
261
+ - stock_based_compensation: Stock-based compensation
262
+ - changes_in_working_capital: Net change in working capital
263
+ - other_operating_adjustments: Other adjustments
264
+ - net_cash_from_operations: Net cash provided by operating activities
265
+
266
+ ## Investing Activities
267
+ - capex: Capital expenditures (should be negative)
268
+ - acquisitions: Cash paid for acquisitions (negative)
269
+ - purchases_of_investments: Purchases of investments
270
+ - proceeds_from_investments: Proceeds from maturities/sales of investments
271
+ - net_cash_from_investing: Net cash from investing activities
272
+
273
+ ## Financing Activities
274
+ - proceeds_from_debt: Proceeds from borrowings
275
+ - repayments_of_debt: Repayments of debt (negative)
276
+ - share_repurchases: Common stock repurchases (negative)
277
+ - dividends_paid: Dividends paid (negative, null if none)
278
+ - net_cash_from_financing: Net cash from financing activities
279
+
280
+ ## Summary
281
+ - net_change_in_cash: Net change in cash and equivalents
282
+ - free_cash_flow: net_cash_from_operations + capex (compute this)
283
+ - fcf_margin_pct: Free cash flow / revenue × 100
284
+
285
+ ## Search Strategy
286
+ 1. basic_search: "cash flow operations investing financing activities FY2025"
287
+ 2. basic_search: "capital expenditures free cash flow stock compensation"
288
+ output_schema:
289
+ type: object
290
+ properties:
291
+ units_label: { type: string }
292
+ net_income_cf: { type: number }
293
+ depreciation_and_amortization: { type: number }
294
+ stock_based_compensation: { type: number }
295
+ net_cash_from_operations: { type: number }
296
+ capex: { type: number }
297
+ acquisitions: { type: number }
298
+ net_cash_from_investing: { type: number }
299
+ share_repurchases: { type: number }
300
+ dividends_paid: { type: number }
301
+ net_cash_from_financing: { type: number }
302
+ net_change_in_cash: { type: number }
303
+ free_cash_flow: { type: number }
304
+ fcf_margin_pct: { type: number }
305
+ citations: { type: array, items: { type: string } }
306
+ notes: { type: string }
307
+ mcp_scope: []
308
+ prompt: "Return consolidated cash flow statement for FY2025."
309
+
310
+ # ── Key Financial Ratios ──────────────────────────────────────────────────
311
+ - id: key_ratios
312
+ label: "Key Financial Ratios & Metrics"
313
+ type: object
314
+ priority: 2
315
+ depends_on: [income_statement, balance_sheet, cash_flow]
316
+ docset_id: annual_report
317
+ agents:
318
+ - id: ratios_extract
319
+ docset_id: annual_report
320
+ prompt: |
321
+ Compute or extract key financial ratios from the financial statements.
322
+ Use the FY2025 figures from the statements in your context (from depends_on).
323
+
324
+ ## Profitability
325
+ - gross_margin_pct: Gross profit / Revenue × 100 (from income statement)
326
+ - operating_margin_pct: Operating income / Revenue × 100
327
+ - net_margin_pct: Net income / Revenue × 100
328
+ - fcf_margin_pct: Free cash flow / Revenue × 100 (from cash flow)
329
+ - roa_pct: Net income / Total assets × 100
330
+ - roe_pct: Net income / Stockholders equity × 100
331
+
332
+ ## Liquidity
333
+ - current_ratio: Current assets / Current liabilities
334
+ - quick_ratio: (Cash + Short-term investments + AR) / Current liabilities
335
+ - cash_and_investments: Cash + short-term investments
336
+
337
+ ## Leverage
338
+ - net_debt: Long-term debt + current debt - cash and investments
339
+ - net_debt_to_ebitda: Use reported EBITDA if available; otherwise skip
340
+ - interest_coverage: Operating income / Interest expense
341
+
342
+ ## Growth (YoY)
343
+ - revenue_growth_yoy_pct: (FY2025 revenue - FY2024 revenue) / FY2024 revenue × 100
344
+ - operating_income_growth_yoy_pct: YoY operating income growth %
345
+ - eps_growth_yoy_pct: YoY diluted EPS growth %
346
+
347
+ Compute from the financial statement data in your context.
348
+ Note: If a prior-year figure is not available, set growth metrics to null.
349
+ output_schema:
350
+ type: object
351
+ properties:
352
+ gross_margin_pct: { type: number }
353
+ operating_margin_pct: { type: number }
354
+ net_margin_pct: { type: number }
355
+ fcf_margin_pct: { type: number }
356
+ roa_pct: { type: number }
357
+ roe_pct: { type: number }
358
+ current_ratio: { type: number }
359
+ quick_ratio: { type: number }
360
+ cash_and_investments: { type: number }
361
+ net_debt: { type: number }
362
+ interest_coverage: { type: number }
363
+ revenue_growth_yoy_pct: { type: number }
364
+ eps_growth_yoy_pct: { type: number }
365
+ notes: { type: string }
366
+ mcp_scope: []
367
+ prompt: "Return key financial ratios computed from FY2025 financial statements."
368
+
369
+ # ── MD&A Highlights & Outlook ─────────────────────────────────────────────
370
+ - id: mda_and_outlook
371
+ label: "MD&A Highlights & Management Outlook"
372
+ type: object
373
+ priority: 2
374
+ docset_id: annual_report
375
+ agents:
376
+ - id: mda_extract
377
+ prompt: |
378
+ Extract the key highlights from Management's Discussion & Analysis (MD&A)
379
+ and the company's forward-looking guidance.
380
+
381
+ ## What to Find
382
+ - performance_narrative: Management's explanation of FY2025 performance (2-3 sentences)
383
+ - revenue_drivers: Key factors that drove revenue growth or decline
384
+ - margin_commentary: Management commentary on margin changes
385
+ - fy2026_revenue_guidance: FY2026 revenue guidance (full dollars or range)
386
+ - fy2026_eps_guidance: FY2026 diluted EPS guidance
387
+ - fy2026_other_guidance: Any other FY2026 metrics guided (operating margin, FCF, etc.)
388
+ - non_gaap_measures: Any non-GAAP measures highlighted (Adjusted EBITDA, Non-GAAP EPS, etc.)
389
+ - capital_allocation_commentary: Buybacks, dividends, M&A intent mentioned
390
+
391
+ ## Search Strategy
392
+ 1. basic_search: "management discussion analysis MD&A results operations"
393
+ 2. basic_search: "fiscal 2026 guidance outlook revenue earnings per share"
394
+ 3. global_search: "strategic priorities company direction growth drivers"
395
+ output_schema:
396
+ type: object
397
+ properties:
398
+ performance_narrative: { type: string }
399
+ revenue_drivers: { type: array, items: { type: string } }
400
+ margin_commentary: { type: string }
401
+ fy2026_revenue_guidance: { type: string }
402
+ fy2026_eps_guidance: { type: string }
403
+ fy2026_other_guidance: { type: array, items: { type: string } }
404
+ non_gaap_measures: { type: array, items: { type: string } }
405
+ capital_allocation_commentary: { type: string }
406
+ citations: { type: array, items: { type: string } }
407
+ mcp_scope: []
408
+ prompt: "Return MD&A highlights and FY2026 guidance."
409
+
410
+ # ── Risk Factors ──────────────────────────────────────────────────────────
411
+ - id: risk_factors
412
+ label: "Key Risk Factors (Item 1A)"
413
+ type: object
414
+ priority: 2
415
+ docset_id: annual_report
416
+ agents:
417
+ - id: risks_extract
418
+ search_type: global # risk factors are cross-cutting — global search is best
419
+ prompt: |
420
+ Extract the key risk factors from Item 1A of the 10-K.
421
+
422
+ ## What to Find
423
+ Identify 6-10 of the most material risks across these categories:
424
+ - business_risks: Competition, technology, product, operational
425
+ - financial_risks: Debt, liquidity, covenant, foreign exchange
426
+ - regulatory_risks: Compliance, government, data privacy, IP
427
+ - macro_risks: Economic conditions, interest rates, supply chain
428
+ - cyber_risks: Cybersecurity, data breaches, system failures
429
+
430
+ For each risk:
431
+ - category: One of the above
432
+ - title: Short risk title (as used in the 10-K if possible)
433
+ - summary: 1-sentence summary of the risk
434
+
435
+ ## Search Strategy
436
+ Use global_search to extract cross-cutting risk themes:
437
+ Query 1: "risk factors competition market technology"
438
+ Query 2: "regulatory compliance data privacy cybersecurity"
439
+ Query 3: "financial risks debt interest liquidity"
440
+ output_schema:
441
+ type: object
442
+ properties:
443
+ risks:
444
+ type: array
445
+ items:
446
+ type: object
447
+ properties:
448
+ category: { type: string }
449
+ title: { type: string }
450
+ summary: { type: string }
451
+ citations: { type: array, items: { type: string } }
452
+ citations: { type: array, items: { type: string } }
453
+ mcp_scope: []
454
+ prompt: "Return the most material risk factors from Item 1A."
455
+
456
+ tables:
457
+ - id: income_statement_table
458
+ title: "Consolidated Income Statement (FY2025 vs FY2024)"
459
+ priority: 1
460
+ depends_on: [income_statement]
461
+ docset_id: annual_report
462
+ agents:
463
+ - id: income_table_build
464
+ docset_id: annual_report
465
+ prompt: |
466
+ Build the income statement comparison table from the data in your context.
467
+ For each line item, create one row:
468
+ - metric: Line item name
469
+ - fy2025: FY2025 value
470
+ - fy2024: FY2024 value
471
+ - change_pct: YoY change % (null if FY2024 not available)
472
+
473
+ Include: Revenue, Cost of Revenue, Gross Profit, Gross Margin %,
474
+ R&D, S&M, G&A, Operating Income, Operating Margin %, Net Income, Diluted EPS.
475
+ Return {"rows": [...]}
476
+ output_schema:
477
+ type: object
478
+ properties:
479
+ rows:
480
+ type: array
481
+ items:
482
+ type: object
483
+ properties:
484
+ metric: { type: string }
485
+ fy2025: { type: number }
486
+ fy2024: { type: number }
487
+ change_pct: { type: number }
488
+ mcp_scope: []
489
+ prompt: "Return income statement comparison table."
490
+
491
+ template:
492
+ format: markdown
493
+ sections:
494
+ header: |
495
+ # {{report.name}}
496
+ > **Company:** {{context.company_name}} ({{context.ticker}}) | **Fiscal Year:** {{context.fiscal_year}}
497
+ > **Reporting units:** USD {{context.reporting_units}}
498
+
499
+ content: |
500
+ {{sections.header}}
501
+
502
+ ---
503
+
504
+ ## Income Statement
505
+
506
+ {{table.income_statement_table}}
507
+
508
+ ---
509
+
510
+ ## Balance Sheet Highlights
511
+
512
+ | Metric | FY2025 | FY2024 |
513
+ |--------|--------|--------|
514
+ | Cash & Equivalents | {{ field.balance_sheet.fy2025.cash_and_equivalents | number(0) | default("—") }} | {{ field.balance_sheet.fy2024.cash_and_equivalents | number(0) | default("—") }} |
515
+ | Total Current Assets | {{ field.balance_sheet.fy2025.total_current_assets | number(0) | default("—") }} | — |
516
+ | Total Assets | {{ field.balance_sheet.fy2025.total_assets | number(0) | default("—") }} | {{ field.balance_sheet.fy2024.total_assets | number(0) | default("—") }} |
517
+ | Long-Term Debt | {{ field.balance_sheet.fy2025.long_term_debt | number(0) | default("—") }} | {{ field.balance_sheet.fy2024.long_term_debt | number(0) | default("—") }} |
518
+ | Total Stockholders' Equity | {{ field.balance_sheet.fy2025.total_stockholders_equity | number(0) | default("—") }} | {{ field.balance_sheet.fy2024.total_stockholders_equity | number(0) | default("—") }} |
519
+
520
+ ---
521
+
522
+ ## Cash Flow
523
+
524
+ | | FY2025 |
525
+ |-|--------|
526
+ | Cash from Operations | {{ field.cash_flow.net_cash_from_operations | number(0) | default("—") }} |
527
+ | Capital Expenditures | {{ field.cash_flow.capex | number(0) | default("—") }} |
528
+ | **Free Cash Flow** | **{{ field.cash_flow.free_cash_flow | number(0) | default("—") }}** |
529
+ | FCF Margin | {{ field.cash_flow.fcf_margin_pct | number(1) | default("—") }}% |
530
+ | Stock-Based Compensation | {{ field.cash_flow.stock_based_compensation | number(0) | default("—") }} |
531
+ | Share Repurchases | {{ field.cash_flow.share_repurchases | number(0) | default("—") }} |
532
+
533
+ ---
534
+
535
+ ## Key Financial Ratios (FY2025)
536
+
537
+ | Ratio | Value |
538
+ |-------|-------|
539
+ | Gross Margin | {{ field.key_ratios.gross_margin_pct | number(1) | default("—") }}% |
540
+ | Operating Margin | {{ field.key_ratios.operating_margin_pct | number(1) | default("—") }}% |
541
+ | Net Margin | {{ field.key_ratios.net_margin_pct | number(1) | default("—") }}% |
542
+ | FCF Margin | {{ field.key_ratios.fcf_margin_pct | number(1) | default("—") }}% |
543
+ | ROE | {{ field.key_ratios.roe_pct | number(1) | default("—") }}% |
544
+ | Current Ratio | {{ field.key_ratios.current_ratio | number(2) | default("—") }}x |
545
+ | Net Debt | {{ field.key_ratios.net_debt | number(0) | default("—") }} |
546
+ | Revenue Growth YoY | {{ field.key_ratios.revenue_growth_yoy_pct | number(1) | default("—") }}% |
547
+ | EPS Growth YoY | {{ field.key_ratios.eps_growth_yoy_pct | number(1) | default("—") }}% |
548
+
549
+ ---
550
+
551
+ ## MD&A Highlights & FY2026 Guidance
552
+
553
+ {{ field.mda_and_outlook.performance_narrative | default("—") }}
554
+
555
+ **Revenue drivers:** {{ field.mda_and_outlook.revenue_drivers | default("—") }}
556
+ **Margin commentary:** {{ field.mda_and_outlook.margin_commentary | default("—") }}
557
+
558
+ ### FY2026 Guidance
559
+ | | |
560
+ |-|-|
561
+ | Revenue | {{ field.mda_and_outlook.fy2026_revenue_guidance | default("Not provided") }} |
562
+ | EPS | {{ field.mda_and_outlook.fy2026_eps_guidance | default("Not provided") }} |
563
+ | Other | {{ field.mda_and_outlook.fy2026_other_guidance | default("—") }} |
564
+
565
+ **Capital allocation:** {{ field.mda_and_outlook.capital_allocation_commentary | default("—") }}
566
+
567
+ ---
568
+
569
+ ## Key Risk Factors
570
+
571
+ {{ field.risk_factors.risks | default("—") }}
572
+
573
+ guardrails:
574
+ - id: gr_balance_sheet_balances
575
+ target: field.balance_sheet
576
+ on_fail: warn
577
+ model: gpt-4.1-mini
578
+ api_key: ${OPENAI_API_KEY}
579
+ description: "Total assets must equal total liabilities plus equity"
580
+ prompt: |
581
+ Verify: total_assets ≈ total_liabilities + total_stockholders_equity (within 1%)
582
+ Also verify: total_current_assets < total_assets
583
+ Return JSON: {"pass": boolean, "issues": []}
584
+ Content: {{content}}
585
+
586
+ - id: gr_income_stmt_math
587
+ target: field.income_statement
588
+ on_fail: warn
589
+ model: gpt-4.1-mini
590
+ api_key: ${OPENAI_API_KEY}
591
+ description: "Income statement lines must add up correctly"
592
+ prompt: |
593
+ Verify for FY2025: gross_profit ≈ revenue - cost_of_revenue (within 1%)
594
+ Verify: net_income < gross_profit (unless extraordinary items)
595
+ Verify: eps_diluted ≈ net_income / shares_diluted (within 5%)
596
+ Return JSON: {"pass": boolean, "issues": []}
597
+ Content: {{content}}
598
+
599
+ - id: gr_fcf_math
600
+ target: field.cash_flow
601
+ on_fail: warn
602
+ model: gpt-4.1-mini
603
+ api_key: ${OPENAI_API_KEY}
604
+ description: "FCF must equal operating cash flow plus capex"
605
+ prompt: |
606
+ Verify: free_cash_flow ≈ net_cash_from_operations + capex (capex is negative, so this is effectively subtracted)
607
+ Allow 1% tolerance for rounding.
608
+ Return JSON: {"pass": boolean, "issues": []}
609
+ Content: {{content}}
610
+
611
+ - id: gr_no_fabrication
612
+ target: computations
613
+ on_fail: warn
614
+ model: gpt-4.1-mini
615
+ api_key: ${OPENAI_API_KEY}
616
+ description: "Detect fabricated values"
617
+ prompt: |
618
+ FAIL if citations are "Source A"/"Source B" style (real ones use c_xxxxxxxx).
619
+ FAIL if ALL financial statement values are round multiples of 100000.
620
+ Return JSON: {"pass": boolean, "issues": []}
621
+ Content: {{content}}
622
+
623
+ execution:
624
+ retries:
625
+ max_attempts: 3
626
+ backoff_seconds: 2.0
627
+ output:
628
+ directory: ./output
629
+ timestamp_suffix: false
630
+ include_final_report: true
631
+ include_computed_json: true
632
+ include_evidence: true
633
+ include_guardrails: true
@@ -0,0 +1,18 @@
1
+ export interface ReportComposerAgentOptions {
2
+ /** Full instruction text (from the instructions file) */
3
+ instructions: string;
4
+ /** Anthropic API key */
5
+ anthropicApiKey: string;
6
+ /** Claude model ID, e.g. "claude-sonnet-4-6" */
7
+ model?: string;
8
+ /** Maximum agentic iterations before giving up */
9
+ maxIterations?: number;
10
+ /** Called on each status update (for spinner / logging) */
11
+ onProgress?: (message: string) => void;
12
+ }
13
+ export interface ReportComposerAgentResult {
14
+ reportYaml: string;
15
+ iterations: number;
16
+ reportValid: boolean;
17
+ }
18
+ export declare function runReportComposerAgent(options: ReportComposerAgentOptions): Promise<ReportComposerAgentResult>;