Commit Graph

4 Commits

Author SHA1 Message Date
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 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 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