fredgar-ai

Leadership & stakeholder analytics — methodology and responsible use

This Fredgar AI subsystem extracts company leadership from SEC filings and computes a transparent “stakeholder orientation” (people-vs-profits) signal. Read this before relying on any output.

What it is — and is not

Every score decomposes into its source XBRL concepts and periods. Always verify material conclusions against the original filings (linked throughout).

Data sources

Source Used for Status
SEC Forms 3/4/5 (ownership) Officer/director/owner roster, titles, role flags, tenure bounds, insider buy/sell Implemented — legally public, parsed from EDGAR
SEC XBRL facts (10-K/10-Q) Capex, R&D, buybacks, dividends, revenue → orientation signals Implemented
Filing text (bios, human-capital, MD&A) Quotes, initiatives, narrative Foundation present (filing corpus + chunks); narrative extraction is the AI path below
Earnings call transcripts Quotes, forward direction Not scraped. Not on EDGAR and usually copyrighted/paywalled — ingest only user-supplied/licensed transcripts
LinkedIn / third-party profiles Background enrichment Not scraped (ToS/privacy). A pluggable external enrichment field on Person accepts licensed/manual data only

The orientation index (method v1.0)

orientation_index ∈ roughly [−1, +1], a weighted average of the available signals (missing signals are excluded and disclosed). Latest full-year (~annual) facts are used.

Signal Definition Weight
allocation_balance (capex + R&D − buybacks − dividends) / (capex + R&D + buybacks + dividends) 0.40
capex_intensity capex / revenue, scored vs a 5% reference — a local/physical-investment proxy 0.25
rnd_intensity R&D / revenue — capability/people investment 0.20
insider_alignment Net Form 4 acquired(+)/disposed(−) across leadership — directional “skin in the game” 0.15

Label: index ≥ 0.33 → “Reinvestment / stakeholder-tilted”; ≤ −0.33 → “Payout / shareholder-tilted”; otherwise “Balanced”.

Known limitations (important)

AI analysis (Claude by default, grounded)

Narrative extraction — leadership initiatives, verbatim quotes, and stated forward direction — runs through a pluggable analyzer with Claude as the default provider (ENABLE_AI_ANALYSIS=true). It stays purely additive: it degrades to a no-op unless the optional anthropic SDK and a credential are present, so the structured, source-cited signal above is always the default output and a credential-less checkout makes no API calls.

How it stays grounded. When enabled, the analyzer (AnthropicAnalyzer, default model claude-opus-5-5) is sent only excerpts from this company’s already-ingested SEC filing text, each labeled [S1], [S2], …, and is constrained by a strict system prompt to:

  1. Ground every item in the excerpts and cite the source label.
  2. Reproduce quotes verbatim — never invent, paraphrase, or reconstruct a quote; if no verbatim quote exists, return none.
  3. Make no personal, character, competence, popularity, or “approval” judgment about any named individual — only disclosed company/leadership actions and plans.
  4. Use no outside knowledge and no speculation.

Output is validated against a JSON schema (structured outputs), persisted as a LeadershipAnalysis row with the used_sources it cited, and degrades gracefully: if the analyzer is off (or no credential/SDK is configured), no filing text is available, or the model call fails, a clearly-marked empty/error result is returned and stored — never a fabricated one.

Auth & setup. AI analysis is on by default; you only need the SDK and a credential to make it live. Authentication is token-first — a Claude Code OAuth token is preferred and sent as a Bearer token (with the oauth-2025-04-20 beta header); an API key is the fallback. Set only one — the API returns 401 if both are present.

pip install -r requirements-ai.txt                    # installs the optional `anthropic` SDK
export CLAUDE_CODE_OAUTH_TOKEN=$(claude setup-token)  # preferred: Claude Code OAuth token
# or, instead of the token:
# export ANTHROPIC_API_KEY=sk-...                     # fallback: metered API key
# ENABLE_AI_ANALYSIS defaults to true; AI_ANALYSIS_MODEL defaults to claude-opus-5-5

This is narrative extraction with citations, not an opinion about people, and not investment/HR advice. Always verify quotes and initiatives against the cited filings.

Commands & API

python manage.py sync_leadership --ticker TSLA --limit 25          # extract officers/directors
python manage.py compute_stakeholder_assessment --ticker TSLA     # compute the index
python manage.py analyze_leadership --ticker TSLA                  # LLM narrative (Claude; see above)

The static site renders a Leadership table and a Stakeholder orientation section (index, signal breakdown, and these caveats) on each company page, with CSV/JSON export. When a grounded AI analysis exists, it also renders a Leadership analysis (AI) section (summary, initiatives, verbatim quotes with source labels, and the AI caveat).