Implement BDEF v1.1 grading: scoring core, per-deck pipeline, ledger, dashboard, StartOS layer

- Deterministic scoring.py (quant 60 / qual 40 / flags -15, profitability heaviest)
- Per-company JSON ledger with forecast-target chaining deck N-1 -> N
- Single-shot sandbox agent with guided-JSON fallback ladder (no tool loop)
- Portfolio dashboard with sparklines, KPI hit rates, BDEF category bars
- 48 unit tests green; endpoints smoke-tested; npm check+build green

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Jonathan Kirkwood
2026-07-06 14:15:12 -05:00
co-authored by Claude Fable 5
parent 1dde915540
commit b1d7aed9f4
48 changed files with 4907 additions and 971 deletions
@@ -0,0 +1,83 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "boardroom_extraction",
"type": "object",
"additionalProperties": false,
"required": ["schema_version", "deck", "kpis", "forward_targets", "red_flag_candidates", "narrative"],
"properties": {
"schema_version": {"type": "integer"},
"deck": {
"type": "object",
"additionalProperties": false,
"required": ["period"],
"properties": {
"company_hint": {"type": ["string", "null"]},
"period": {"type": ["string", "null"], "description": "Reporting period as printed on the deck, e.g. 2026-Q2, 2026-H1, FY2026, 2026-05"},
"meeting_date": {"type": ["string", "null"]},
"title": {"type": ["string", "null"]},
"truncated": {"type": "boolean", "default": false}
}
},
"kpis": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"required": ["name", "canonical_name", "actual", "direction", "profitability", "source"],
"properties": {
"name": {"type": "string", "description": "KPI label exactly as printed in the deck"},
"canonical_name": {"type": "string", "pattern": "^[a-z0-9_]+$", "description": "lower_snake_case, generic, stable across quarters (arr, ebitda_margin, churn_rate...)"},
"actual": {"type": "number"},
"unit": {"type": "string", "default": ""},
"period": {"type": ["string", "null"]},
"direction": {"type": "string", "enum": ["gte", "lte"], "description": "gte = higher is better, lte = lower is better"},
"profitability": {"type": "boolean", "description": "true only for profit/margin/cash metrics (EBITDA, net margin, FCF, burn...)"},
"target_in_deck": {"type": ["number", "null"], "description": "Target/plan value printed NEXT TO the actual for the SAME period, if any"},
"source": {"type": "string", "description": "Where in the deck, e.g. 'slide 6, financial summary'"},
"notes": {"type": "string", "default": ""}
}
}
},
"forward_targets": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"required": ["name", "canonical_name", "target", "target_period", "direction", "profitability", "source"],
"properties": {
"name": {"type": "string"},
"canonical_name": {"type": "string", "pattern": "^[a-z0-9_]+$"},
"target": {"type": "number"},
"unit": {"type": "string", "default": ""},
"target_period": {"type": "string", "description": "Period this guidance applies to, e.g. 2026-Q3"},
"direction": {"type": "string", "enum": ["gte", "lte"]},
"profitability": {"type": "boolean"},
"source": {"type": "string"}
}
}
},
"red_flag_candidates": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"required": ["code", "description", "severity"],
"properties": {
"code": {"type": "string", "pattern": "^[a-z0-9_]+$"},
"description": {"type": "string"},
"severity": {"type": "integer", "minimum": 1, "maximum": 5},
"evidence": {"type": "string", "default": ""}
}
}
},
"narrative": {
"type": "object",
"additionalProperties": false,
"required": ["summary"],
"properties": {
"summary": {"type": "string"},
"asks": {"type": "array", "items": {"type": "string"}, "default": []}
}
}
}
}
+53
View File
@@ -0,0 +1,53 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "boardroom_grades",
"type": "object",
"additionalProperties": false,
"required": ["schema_version", "grader", "categories", "red_flags", "overall_comment"],
"properties": {
"schema_version": {"type": "integer"},
"grader": {"type": "string"},
"categories": {
"type": "array",
"minItems": 8,
"maxItems": 8,
"items": {
"type": "object",
"additionalProperties": false,
"required": ["id", "score", "evidence", "rationale"],
"properties": {
"id": {"type": "string", "enum": ["A", "B", "C", "D", "E", "F", "G", "H"]},
"score": {"type": "integer", "minimum": 1, "maximum": 5},
"evidence": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"required": ["quote", "location"],
"properties": {
"quote": {"type": "string", "description": "Verbatim text from the deck"},
"location": {"type": "string", "description": "e.g. 'slide 3'"}
}
}
},
"rationale": {"type": "string"}
}
}
},
"red_flags": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"required": ["code", "description", "severity"],
"properties": {
"code": {"type": "string", "pattern": "^[a-z0-9_]+$"},
"description": {"type": "string"},
"severity": {"type": "integer", "minimum": 1, "maximum": 5},
"evidence": {"type": "string", "default": ""}
}
}
},
"overall_comment": {"type": "string"}
}
}