Overview
Major architectural improvements to prevent API timeouts through section-by-section processing, plus comprehensive brand expansion with MaC VC assets and SVG logo support.
Changelog: 2025-11-19_01
Overview
Major architectural improvements to prevent API timeouts through section-by-section processing, plus comprehensive brand expansion with MaC VC assets and SVG logo support.
🚀 Core Architecture Changes
Section-by-Section Processing
Problem Solved: LLM API timeouts when processing full 50k+ character memos in single calls.
Solution: Process ONE SECTION AT A TIME through the pipeline.
Writer Agent (src/agents/writer.py)
Complete rewrite to iterative section-by-section writing
Writes 10 sections sequentially (10 separate API calls)
Each section: ~500 words, ~5k chars (manageable payload)
Progressive saving: writes section → saves to
2-sections/→ stitches togetherBetter error isolation: if one section fails, others are preserved
Added
write_single_section()helper function
Benefits:
✅ No more connection timeouts
✅ Progressive work preservation
✅ Faster debugging (can retry individual sections)
✅ Clearer progress tracking
Citation Enrichment Agent (src/agents/citation_enrichment.py)
Complete rewrite to section-by-section enrichment
Loads each section file from
2-sections/directoryEnriches citations independently via Perplexity Sonar Pro
Saves enriched section back to disk
Added
enrich_section_with_citations()functionAdded
renumber_citations_globally()functionGlobal citation renumbering across all sections (prevents duplicate [^1]s)
Benefits:
✅ Prevents API timeouts on large memos
✅ Better citation accuracy (focused context per section)
✅ Global citation numbering (unique IDs across entire memo)
🎨 Branding Enhancements
SVG Logo Support (src/branding.py)
Added
BrandLogodataclass with theme-aware configurationlight_mode: Path to light theme logodark_mode: Path to dark theme logowidth,height: Configurable dimensionsalt: Accessibility text
Logo validation: checks if SVG files exist, warns if missing
Integrated into
BrandConfigclass
HTML Export with Embedded SVGs (export-branded.py)
New
embed_svg_logo()function: reads and embeds SVG contentTheme-aware logo selection: uses dark logo for dark mode, light for light mode
Fallback to text-based logos if SVG not found
Maintains backward compatibility with existing configs
CSS Fixes (templates/base-style.css)
Fixed footnote arrow rendering with custom fonts
Forces system fonts for
↩arrow character (prevents rendering issues)
📁 New Assets & Files
Brand Assets: MaC VC
Created: Complete branding package for MaC Venture Capital
Logo Files (templates/trademarks/)
trademark__MaC-VC--Light-Mode.svg(2.8KB)trademark__MaC-VC--Dark-Mode.svg(2.8KB)trademark__MaC-VC.svg(2.7KB)
Font Family (templates/fonts/ABCDiatype/)
Complete ABC Diatype font family with 16 WOFF2 files:
Regular, Bold, Light, Medium, Heavy, Black, Ultra
Italic variants for all weights
Total: ~1.2MB optimized web fonts
abc-diatype.css: Font-face declarations
Brand Configuration (templates/brand-configs/)
brand-mac-config.yaml: MaC VC brand specificationColors, fonts, logo paths
Company info and confidential footer
README.md: Brand configuration documentation (6.3KB)
Utility Scripts
Purpose: Standalone tools for testing and debugging
enrich-citations.py: Standalone citation enrichmentfix-powerline-citations.py: Fix citations for Powerline memorun-citations-now.py: Quick citation runnertest_anthropic.py: Anthropic API connectivity testtest_perplexity.py: Perplexity API connectivity test
Company Data
data/Powerline.json: Company context file for Powerline
📖 Documentation Updates
CLAUDE.md
Added "Section-by-Section Processing" explanation
Documented why this prevents timeouts (10 small calls vs 1 giant call)
Updated Writer agent description
Updated Citation Enrichment agent description
Added technical rationale for architecture change
.claude/settings.local.json
Added bash permissions for section loop commands
Enables automation of section processing
🔧 Technical Details
Architecture Pattern
OLD: Full memo (50k chars) → Single API call → Timeout ❌
NEW: 10 sections (5k chars each) → 10 API calls → Success ✅File Structure Impact
output/Company-v0.0.x/
├── 2-sections/
│ ├── 01-executive-summary.md ← Written individually
│ ├── 02-business-overview.md ← Written individually
│ ├── ... (10 sections)
│ └── 10-recommendation.md ← Written individually
└── 4-final-draft.md ← Stitched together progressivelyCitation Workflow
1. Each section enriched independently [^1], [^2], [^3]
2. Sections saved back to 2-sections/
3. Global renumbering: [^1], [^2]... [^50] across full memo
4. Final draft with unique citation IDs🎯 Impact Summary
Performance
Eliminated: API connection timeouts on large memos
Improved: Processing reliability (10 small calls vs 1 large call)
Enabled: Progressive work preservation
Brand Capabilities
Added: SVG logo support with theme awareness
Expanded: Multi-brand support (Hypernova, Collide, Accel, MaC VC)
Enhanced: Professional typography with ABC Diatype fonts
Developer Experience
Better error isolation: Failed sections don't lose all work
Clearer progress: See which section is being processed
Easier debugging: Can inspect/retry individual sections
📊 Files Changed
Modified (7 files)
.claude/settings.local.jsonCLAUDE.mdexport-branded.pysrc/agents/citation_enrichment.pysrc/agents/writer.pysrc/branding.pytemplates/base-style.css
Added (Untracked)
changelog/(new directory)data/Powerline.jsonenrich-citations.pyfix-powerline-citations.pyrun-citations-now.pytest_anthropic.pytest_perplexity.pytemplates/brand-configs/README.mdtemplates/brand-configs/brand-mac-config.yamltemplates/fonts/ABCDiatype/(17 files)templates/trademarks/(3 SVG files)
🔜 Next Steps
Recommended Testing
Run full pipeline on a test company to verify section-by-section processing
Test citation renumbering with multiple sections
Verify SVG logo rendering in both light/dark modes
Export test memo with MaC VC branding
Potential Enhancements
Add section retry mechanism for failed individual sections
Implement parallel section writing (if API rate limits allow)
Add progress indicators for section-by-section processing
Cache enriched sections to avoid re-enrichment
Date: November 19, 2025 Author: Investment Memo Orchestrator Team Version: Pre-release (pending tag)