Skip to content

Add Strategy Pulse: monthly portfolio rebalancing analysis (#525)#535

Open
jonschull wants to merge 1 commit intomainfrom
issue/525
Open

Add Strategy Pulse: monthly portfolio rebalancing analysis (#525)#535
jonschull wants to merge 1 commit intomainfrom
issue/525

Conversation

@jonschull
Copy link
Owner

Summary

Implements the Strategy Pulse system from issue #525 — monthly automated analysis that reads ERA's operational data and produces a portfolio health memo aligned to ERA's adaptive strategy framework (Act → Observe → Learn → Rebalance).

  • New script: scripts/strategy_pulse.py
  • New spec doc: docs/knowledge/ERA_Strategy_Pulse_Spec.md

What it does

  1. Collects data from four sources:

    • ERA DB: member count, active projects, attendance trends, recent Town Halls, call volume
    • ERA Landscape Sheet (nodes + edges tabs): 999 network nodes, partnership relationships
    • Town Hall Highlights Doc: speaker history and themes from 100+ events
    • Bio Research Sheet: member competencies (degrades gracefully if not shared)
  2. Calls Claude Haiku with a structured analyst prompt covering the four rebalancing inputs (funder interest, core competencies, impact evidence, context shifts)

  3. Delivers via append to Pulse Log Google Doc + email to Jon

Validation

Ran --dry-run locally with real data:

  • DB stats: 540 members, 286 active projects, 3 recent events, 50 calls/30 days ✓
  • Landscape Sheet (nodes/edges tabs): 180 orgs, 999 nodes, partnerships ✓
  • Town Hall Highlights Doc: 23K char document read successfully ✓
  • Claude analysis: complete 400-600 word memo with actionable recommendations ✓

Sample output snippet from dry-run:

Core Competency strength: world-class field capabilities (USGS Sky Island gabion structures, Cuenca Los Ojos 150K+ acres, 40-year track record). Gap: policy/advocacy layer absent from recent town halls. Town Hall attendance 10% decline (251 vs 280 prior period) — directional signal worth investigating.

Key fixes from initial attempt

The previous timeout was likely due to the Landscape Sheet range fix:

  • Script was using 'Sheet1!A1:J50' — wrong tab name → 400 error → collection failed silently
  • Fixed to use correct 'nodes!A1:J1000' and 'edges!A1:H100'

Deploy: Render cron setup

After merge, create Render cron era2-strategy-pulse:

  • Schedule: 0 9 1 * * (1st of each month, 9am UTC)
  • Build: pip install -r requirements.txt
  • Start: python3 scripts/strategy_pulse.py
  • Env vars: ANTHROPIC_API_KEY, GOOGLE_SERVICE_ACCOUNT_JSON, DATABASE_URL, STRATEGY_PULSE_LOG_DOC_ID

Full spec: docs/knowledge/ERA_Strategy_Pulse_Spec.md

Cost: ~$0.10/month (one Claude Haiku call + free-tier Google APIs)

Closes #525

🤖 Generated with Claude Code

Monthly automated system that reads ERA operational data (DB stats,
BigMap Landscape Sheet, Town Hall Highlights Doc) and calls Claude Haiku
to produce a concise portfolio health memo across four rebalancing inputs:
funder interest, core competencies, impact evidence, context shifts.

Key fixes from initial implementation:
- Landscape Sheet uses 'nodes' and 'edges' tabs (not 'Sheet1')
- Bio Research Sheet gracefully handles 403 (needs service account share)
- max_tokens increased to 2048 to avoid truncated memos

Validated with --dry-run locally: all accessible data sources load OK,
analysis produces 400-600 word memo with actionable rebalancing recommendations.

Deploy: create Render cron 'era2-strategy-pulse' per spec in
docs/knowledge/ERA_Strategy_Pulse_Spec.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jonschull jonschull added the auto-merge Non-strategy change: auto-merge after review PASS label Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-merge Non-strategy change: auto-merge after review PASS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Strategy Pulse: monthly automated portfolio rebalancing analysis

1 participant