Commit Graph

102 Commits

Author SHA1 Message Date
Solaria a9d10583bd Add more templates: romance, thriller, koma, cookbook 2026-03-14 19:52:56 +00:00
Solaria 4d3255c9aa Add more templates: tufte, sci-fi, business, minimal 2026-03-14 17:39:38 +00:00
Solaria d8047bdd2f Add established templates: classicthesis, legrand, cleanthesis, university-press 2026-03-14 17:29:48 +00:00
Solaria ada022709a Add RPG templates: rulebook, adventure, CYOA 2026-03-14 17:19:25 +00:00
Solaria 7fdc8d8948 Add 8 more LaTeX templates: kdp sizes, hardcover, screenplay, journal 2026-03-14 17:15:15 +00:00
Solaria 35d7b1ff08 Add LaTeX templates: novel, kdp-trade, poetry, textbook, childrens 2026-03-14 17:10:11 +00:00
Solaria b809713a52 Add HTML export - browser-based PDF, no LaTeX deps 2026-03-14 15:04:50 +00:00
Solaria 8693d2ffa9 Add LaTeX compile support with templates (memoir, academic) 2026-03-14 13:16:09 +00:00
Solaria c42556d147 Add ExportOptions and auto-branch push to Scrivener export 2026-03-14 12:52:32 +00:00
Solaria 0ebf662d59 Add Scrivener-style export with chapter splitting and binder.json 2026-03-14 12:06:12 +00:00
Solaria 134b74d690 Update default model to MiniMax-M2.5 2026-03-14 11:24:36 +00:00
Solaria 01806579c3 Remove OpenAI fallback - MiniMax only 2026-03-14 11:23:49 +00:00
Solaria fe6dcf4124 Make MiniMax primary provider (default, cost-effective) 2026-03-14 11:23:04 +00:00
Solaria b417626778 Add comprehensive test suite: GitHub, S3, Generation, Output, E2E
- tests/test_github_ingest.py - GitHub repository ingestion
- tests/test_s3_ingest.py - S3/Backblaze ingestion
- tests/test_generation.py - Document generation
- tests/test_output_push.py - Output file and push handling
- tests/test_e2e.py - End-to-end integration tests

Closes #58
2026-03-14 10:54:37 +00:00
Solaria e73969cc63 Merge fix/fake-streaming into fix/hardcoded-timeout 2026-03-14 09:30:13 +00:00
Solaria 51fe18323f Fix CRITICAL issues: timeout config, request validation, streaming (#37, #38, #39) 2026-03-14 09:30:01 +00:00
Solaria 585e9a4713 Make LLM timeout configurable via AgentConfig (#37) 2026-03-14 09:29:01 +00:00
mrhavens 919f6b9e42 Remove unused load_dotenv import (#36) 2026-03-14 09:24:45 +00:00
mrhavens 0f62267806 Fix circular import in __init__.py (#35) 2026-03-14 09:24:31 +00:00
mrhavens 1b116108a6 Merge: fix-docs - Add module docstrings 2026-03-14 05:37:34 +00:00
mrhavens 2716dab0dc Merge: fix-logging - Add structured logging 2026-03-14 05:37:34 +00:00
mrhavens 31def1a70b Merge: fix-validation - Add Pydantic validation 2026-03-14 05:37:34 +00:00
mrhavens 9a2e429378 fix(docs): Add module docstrings 2026-03-14 05:37:27 +00:00
mrhavens b52739ca5c fix(logging): Add structured logging module
- Created logging.py with:
  - setup_logging() function
  - Configurable levels
  - Console and file handlers
  - Structured format

This addresses the logging gap.
2026-03-14 05:37:19 +00:00
mrhavens 1f4e7bea6b fix(validation): Add Pydantic request validation
- Created schemas/requests.py with validated models:
  - GenerateRequest
  - IngestRequest
  - ConfigRequest
- Validates: concept length, repo format, numeric ranges
- Prevents invalid input from reaching handlers

This addresses input validation concern.
2026-03-14 05:36:51 +00:00
mrhavens 9148ebaad5 Merge: fix-reliability - Add retry logic and circuit breaker 2026-03-14 05:25:43 +00:00
mrhavens 5b68459e12 Merge: fix-testing - Add comprehensive tests 2026-03-14 05:25:43 +00:00
mrhavens b5da8d272c fix(reliability): Add retry logic and circuit breaker
- Created utils/retry.py with:
  - RetryHandler with exponential backoff
  - CircuitBreaker pattern
  - Config for max attempts, delays
  - Graceful degradation

- Updated LLM client to use retry logic
- API failures now retry with backoff
- Circuit breaker prevents cascade failures
- Graceful degradation on prolonged failures

This addresses the reliability gap identified in code review.
2026-03-14 05:24:09 +00:00
mrhavens d4abe70a79 fix(testing): Add comprehensive test suite
- test_nonfiction.py with 100+ test cases
- Tests for PurposeClassifier
- Tests for taxonomy/frameworks
- Tests for critique criteria
- Tests for all framework types
- Tests for intake agent
- Tests for multi-source ingest

This addresses the testing gap identified in code review.
2026-03-14 05:22:45 +00:00
mrhavens 16cf8cd5ef feat: Add Code Review Crew
Created code_review_crew.py - 5 expert agents:
- SecurityExpert
- PerformanceExpert
- ArchitectureExpert
- TestingExpert
- ErrorHandlingExpert

Each audits specific domain and reports issues.

Also creates initial code review findings as issues.
2026-03-14 05:13:54 +00:00
mrhavens cfbb701284 feat: Add Agent-Driven Web Crawler
Created agent_crawler.py:

AgentWebCrawler - AI-powered crawling that:
1. Analyzes site structure (LLM)
2. Decides what to crawl based on purpose
3. Scores relevance dynamically
4. Adapts as it learns more
5. Knows when it has enough

Purpose types:
- DOCUMENTATION - Technical docs, guides
- TRAINING - Learning materials
- KNOWLEDGE - General knowledge base
- RESEARCH - Research papers
- REFERENCE - Reference material

Usage:

Features:
- Content extraction (not HTML dump)
- Relevance scoring
- Rate limiting
- Configurable depth/pages
- Integration with multi-source ingest
2026-03-14 05:00:44 +00:00
mrhavens 750d30b4de feat: Add Multi-Source Ingestion
Created multi_source_ingest.py:

- MultiSourceIngestor class
- Supports: GitHub repos, S3 buckets, local files, URLs
- Merge strategies: append, smart (deduplicate), priority

Usage:

Features:
- Deduplicates overlapping content
- Tracks source attribution
- Builds summary of ingested content
- Multiple merge strategies
- Hash-based content tracking
2026-03-14 04:22:07 +00:00
mrhavens 039faa660e docs: Update README and add comprehensive framework documentation
- Rewrote README with all 100+ frameworks organized by category
- Added Nonfiction Framework Library docs (docs/NONFICTION_FRAMEWORKS.md)
- Documented all purposes: learn, understand, transform, decide, reference, inspire
- Added framework tables by category
- Documented new categories: Textbook, Academic, Creative, RPG
- Added CLI usage examples
- Added programmatic usage examples
2026-03-14 01:17:51 +00:00
mrhavens 110aab6ce9 feat: Add RPG & Tabletop Gaming Frameworks
Created rpg_frameworks.py with 15 RPG content types:

CORE RULEBOOKS:
1. Core Rulebook - Main game system (300-500 pages)
2. Quickstart - Condensed intro (16-32 pages)

GAME MASTER GUIDES:
3. Game Master Guide - Running games, worldbuilding
4. Adventure Module - Ready-to-run adventure
5. Campaign Setting - Complete world sourcebook

SUPPLEMENTS:
6. Player's Companion - New races/classes/options
7. Monster Manual - Creatures catalog
8. Thematic Sourcebook - Deep dive on theme

ADVENTURE TYPES:
9. Dungeon Crawl - Classic dungeon delve
10. Hex Crawl - Open world sandbox
11. Dungeon World Style - Narrative-forward

SPECIALTY:
12. Worldbuilding Guide - How to build worlds
13. Props and Handouts - Physical/digital props
14. Solo Adventure - Single player RPG
15. LARP Document - Live action roleplaying

Each includes detailed stages, prompt templates, tone guidance, typical length.

Functions:
- get_rpg_frameworks()
- suggest_rpg_framework()
2026-03-14 01:10:11 +00:00
mrhavens 2be17c5e85 feat: Add Creative and Interactive Frameworks
Created creative_frameworks.py with 14 creative formats:

INTERACTIVE/BRANCHING:
1. Choose Your Own Adventure - Branching narrative
2. Gamebook - RPG-style fighting fantasy
3. Visual Novel - Anime/VN script style

EPISTOLARY/DOCUMENTS:
4. Epistolary Novel - Letters, emails, texts
5. Found Documents - Discovered artifacts

MANIFESTO/CALL TO ACTION:
6. Manifesto - Revolutionary call to action
7. Open Letter - Public letter

EXPERIMENTAL:
8. Infinite Story - Serial/neverending
9. Fractal Narrative - Self-similar structure
10. Scrapbook - Non-linear fragments

AUDIO/PERFORMANCE:
11. Podcast Script - Spoken audio content
12. Screenplay - Hollywood film script
13. Stage Play - Theatrical script

Each includes detailed stages, prompt templates, tone guidance.
2026-03-14 01:04:40 +00:00
mrhavens 2778d98e0d feat: Add Academic Paper Frameworks
Created academic_papers.py with 12 established academic paper types:

RESEARCH PAPERS:
1. Empirical Paper - experiments, data collection
2. Theoretical Paper - concepts, models, proofs
3. Methodology Paper - new methods/techniques
4. Case Study Paper - in-depth single case
5. Survey Paper - comprehensive field overview

ARGUMENTATIVE:
6. Position Paper - argue for a stance
7. Policy Brief - recommendations to decision-makers

CRITICAL ANALYSIS:
8. Critical Review - evaluate existing work
9. Meta-Analysis - statistical synthesis

SHORT FORMS:
10. Short Communication - brief findings report
11. Conference Proposal - conference abstract
12. Thesis Proposal - graduate research proposal

Each includes:
- Detailed stages
- Prompt templates
- Tone guidance
- Typical length
- Audience

Functions:
- get_academic_paper_types()
- suggest_academic_paper()
2026-03-14 00:51:12 +00:00
mrhavens 2c7f5a7fca feat: Add Textbook & Academic Frameworks
Created textbook_frameworks.py with 10 educational frameworks:

TEXTBOOK & ACADEMIC (10):
1. Comprehensive Textbook - Complete academic textbook
2. Textbook Chapter - Single modular chapter
3. Online Course / MOOC - Video-friendly course structure
4. Curriculum / Syllabus - Course planning document
5. Study Guide - Exam prep with practice
6. Academic Research Paper - IMRAD format
7. Literature Review - Systematic synthesis
8. Thesis / Dissertation - Graduate research
9. Workbook / Practice Book - Interactive exercises
10. Quick Reference Guide - Cheat sheet / scannable
11. Knowledge Base / Wiki - Organized articles

Each includes:
- Detailed stages
- Purpose mapping
- Prompt templates
- Tone guidance
- Typical length
- Target audience

Functions:
- get_textbook_frameworks()
- suggest_textbook_framework()

These are the foundational 'Field Anchors' for structured learning.
2026-03-14 00:10:17 +00:00
mrhavens ef932973cd feat: Add --thread-id and --resume flags for checkpointing
- Add --thread-id flag to CLI for checkpointing
- Add --resume flag to resume from checkpoint
- Generate UUID if no thread_id provided
- Display thread_id for user to save for resume

Usage:
  opus generate --concept "My book" --thread-id abc123
  # If fails:
  opus generate --concept "My book" --thread-id abc123 --resume
2026-03-13 23:24:41 +00:00
mrhavens 14b22fc8f6 feat: Issue #15 - Research Agent Integration
Created research_integration.py to connect research agent to pipeline:

ResearchIntegrator class:
- research_for_book(): Research for entire book
- research_chapter(): Research specific chapter
- should_use_research(): Determine if purpose needs research
- get_research_stages(): When to integrate research

Research stages:
- Pre-writing: Gather research before writing
- Per-chapter: Research each chapter
- Verification: Check facts post-writing
- Enhancement: Strengthen content with research

Purpose-specific research config:
- UNDERSTAND: Deep research, include academic
- DECIDE: Deep, studies, data, comparisons
- TRANSFORM: Case studies, success stories
- LEARN_HANDS_ON: Best practices, methods
- REFERENCE: Comprehensive documentation
- BE_INSPIRED: Stories, journeys, examples

Functions:
- get_research_config_for_purpose()

The research agent is now integrated into the nonfiction pipeline.
2026-03-13 23:09:57 +00:00
mrhavens f1a5a24504 feat: Issue #22 - Expand Framework Library (35+ Expert Frameworks)
Created expanded_frameworks.py with 35+ top-tier frameworks:

**BUSINESS & LEADERSHIP (8)**
- Big Idea (Jim Collins)
- The One Thing (Gary Keller)
- Blue Ocean Strategy
- Four Disciplines of Execution
- Good to Great

**MEMOIR & PERSONAL NARRATIVE (5)**
- Mountain Structure Memoir
- Loss and Gain
- Scene-Driven Memoir
- Single-Moment Pivot
- Addiction & Recovery

**PHILOSOPHY & IDEAS (3)**
- Socratic Method
- Argumentative Essay
- Danish Philosopher (Kierkegaard)

**SCIENCE & EXPLANATION (4)**
- Discovery Narrative
- Personal Experiment
- Explainer (Pinker style)
- Mental Models

**HISTORY (4)**
- Chronological Narrative
- Thematic History
- Comparative History
- Cause-and-Effect Chain

**HOW-TO NON-TECHNICAL (4)**
- Problem-Agitation-Solution
- Reverse Engineering
- Minimalist How-To
- Challenge-Response

**THOUGHT LEADERSHIP (3)**
- Contrarian + Proof
- Future + Now
- Mistake → Learning

**SPIRITUALITY & WELLNESS (2)**
- Spiritual Journey
- Healing Narrative

**RELATIONSHIPS (2)**
- Relationship Blueprint
- Communication Mastery

Each framework includes:
- Detailed description
- Purpose mapping
- Structure pattern
- 6-9 stage breakdown
- Prompt template
- Tone guidance
- Typical length
- Target audience

Functions:
- get_frameworks_by_category()
- suggest_framework_for_book()
- get_total_framework_count()
2026-03-13 23:04:32 +00:00
mrhavens d3bc43daca feat: Issue #21 - Purpose-Based Critique Criteria
Created critique_criteria.py with purpose-specific evaluation:

TUTORIAL:
- Clarity (30%), Completeness (25%), Progressiveness (20%)
- Actionability (15%), Error Prevention (10%)

EXPLAINER:
- Analogy Quality (25%), Examples (25%), Mental Model (20%)
- Depth (15%), Misconceptions (15%)

TRANSFORMATION:
- Emotional Honesty (30%), Relatability (25%), Hope (20%)
- Specificity (15%), Actionability (10%)

DECIDE:
- Evidence Quality (30%), Balance (25%), Credibility (20%)
- Clarity (15%), Completeness (10%)

REFERENCE:
- Accuracy (35%), Completeness (30%), Organization (20%)
- Examples (15%)

INSPIRED:
- Emotional Impact (30%), Vision (25%), Authenticity (25%)
- Story Quality (20%)

Each criterion has:
- Weight
- Description
- Evaluation questions
- Pass threshold

Functions:
- get_critique_criteria(purpose) → CritiqueCriteriaSet
- evaluate_chapter(content, purpose) → scores
- get_evaluation_prompt(content, purpose) → LLM prompt
- list_all_criteria() → overview
2026-03-13 22:30:26 +00:00
mrhavens be64111515 feat: Issue #20 - Purpose-Based Agent Selection
Created purpose-specific writing agents:

- purpose_writers.py with 6 specialized agents:
  - TutorialWriter: Hands-on learning (steps, exercises, encouragement)
  - ExplainerWriter: Conceptual understanding (analogies, mental models)
  - TransformationWriter: Personal change (emotional honesty, journey)
  - EvidenceWriter: Data-driven decisions (evidence, tradeoffs)
  - ReferenceWriter: Comprehensive reference (completeness, accuracy)
  - VisionaryWriter: Inspirational content (emotion, vision)

Each agent has:
- 100+ line specialized system prompt
- Purpose-specific writing rules
- Structure guidance
- Tone guidance
- Example phrases

Factory functions:
- get_writer_for_purpose(purpose) → BaseAgent
- select_writer_agent(purpose) → str
- list_available_writers() → dict

This completes Issue #20.
2026-03-13 22:26:24 +00:00
mrhavens 8cf833c729 feat: Content-Based Purpose Inference
Added content_infer.py - analyzes existing content to infer purpose:

- ContentPurposeInferer class
- Analyzes blog posts, articles, text
- Detects signals: tutorials, explainers, transformation stories, etc.
- Returns purpose, confidence, reasoning

Updated intake.py to weight all signals:
1. Explicit flags (weight: 1.0)
2. Content inference (weight: 0.4) - NEW
3. Keyword classification (weight: 0.3)
4. Conversational (weight: 0.5)

Now if you point at a blog:
- Tutorial posts → LEARN_HANDS_ON
- Explainers → UNDERSTAND
- Transformation stories → TRANSFORM
- Reviews/Comparisons → DECIDE
- Reference docs → REFERENCE
- Journey/Biography → BE_INSPIRED
2026-03-13 20:50:36 +00:00
mrhavens b46e87ff76 feat: Nonfiction Intake System - All Three Paths
This commit completes Issue #18 (Purpose Classifier), adds Intake Agent
and CLI integration:

1. PURPOSE CLASSIFIER (Issue #18 - DONE earlier)
   - Keyword-based classification into 6 ReaderPurposes
   - LLM-enhanced classification for nuanced cases

2. INTAKE AGENT (NEW - addresses Issue #20, #23)
   - Created opus_orchestrator/nonfiction/intake.py
   - Intelligent agent that combines:
     * Explicit flags (--purpose, --category)
     * Keyword classification (auto-detect)
     * Conversational questions (when ambiguous)
   - IntakeAgent class with process() method
   - determine_intake() convenience function
   - get_questions() for conversational mode
   - Source tracking: explicit | classifier | intake | hybrid

3. CLI INTEGRATION (Issue #23)
   - Added --purpose flag: learn, understand, transform, decide, reference, inspire
   - Added --category flag: business, leadership, memoir, etc.
   - Both passed to orchestrator

Usage:
  # Explicit
  opus generate --book-type nonfiction --purpose transform --category self_help

  # Auto-classify
  opus generate --book-type nonfiction --concept "How to build a startup"

  # Programmatic
  result = await determine_intake(
    concept="Leadership for introverts",
    purpose="transform",  # or None for auto
    category="leadership",
    mode="auto"  # or "conversational"
  )
2026-03-13 20:46:06 +00:00
mrhavens 0b8bf3123a feat: Issue #19 - Taxonomy Integration in Orchestrator
- Added imports for nonfiction taxonomy (PurposeClassifier, ReaderPurpose, etc.)
- Modified OpusOrchestrator.__init__ to accept purpose and category params
- Added _classify_purpose_from_intent() - classifies purpose from intent
- Added _select_nonfiction_framework() - selects framework based on purpose
- Added get_framework_context() - returns framework info for agents
- Added generate_stage_outline() - generates outlines from framework stages

New params:
- purpose: Optional reader purpose (learn, understand, transform, decide, reference, inspire)
- category: Optional nonfiction category (business, self_help, memoir, etc.)

The orchestrator now:
1. Classifies purpose from book intent using keyword classifier
2. Selects appropriate framework from taxonomy based on purpose
3. Generates stage scaffolding from framework definition
4. Provides framework context to agents

This is the core integration (Issue #19).
2026-03-13 20:32:48 +00:00
mrhavens 4b4addedf7 feat: Issue #18 - Purpose Classifier for Nonfiction
- Created opus_orchestrator/nonfiction/classifier.py
  - PurposeClassifier class with keyword-based classification
  - LLM-enhanced classification (optional)
  - ReaderPurpose enum (6 purposes)
  - ClassificationResult dataclass

- Keyword classification covers:
  - LEARN_HANDS_ON: how to, learn to, tutorial, skills, etc.
  - UNDERSTAND: understand, why, concept, mental model, etc.
  - TRANSFORM: change, become, improve, habits, etc.
  - DECIDE: decide, choose, compare, vs, analysis
  - REFERENCE: manual, handbook, comprehensive, API
  - BE_INSPIRED: inspire, story, journey, biography

- Tests pass for all 6 purposes with high confidence

This is the foundation for the entire nonfiction pipeline (Issue #18).
2026-03-13 20:15:20 +00:00
mrhavens d98ef622d9 feat: Add nonfiction taxonomy - Purpose × Structure matrix
- Created nonfiction_taxonomy.py with:
  - ReaderPurpose enum (6 purposes)
  - StructuralPattern enum (7 patterns)
  - PURPOSE_STRUCTURE_MATRIX for intelligent selection
  - NONFICTION_FRAMEWORKS (14+ frameworks)
  - select_framework() function

- Created docs/NONFICTION_PIPELINE.md documenting the workflow

This is the foundation for Issue #16 (Nonfiction Underdeveloped)
2026-03-13 20:00:30 +00:00
mrhavens b59c265966 fix: Restore missing UploadFile/File imports after merge 2026-03-13 19:05:20 +00:00
mrhavens 8374d50516 Merge: Team 5 - Features (resolved conflict) 2026-03-13 18:22:32 +00:00
mrhavens 164851e096 Merge: Team 4 - Architecture 2026-03-13 18:22:24 +00:00