Commit Graph

21 Commits

Author SHA1 Message Date
Solaria 585e9a4713 Make LLM timeout configurable via AgentConfig (#37) 2026-03-14 09:29:01 +00:00
mrhavens 0f62267806 Fix circular import in __init__.py (#35) 2026-03-14 09:24:31 +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 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 b7f072a3ce Merge: Team 3 - Infrastructure 2026-03-13 18:22:24 +00:00
mrhavens f55570ceeb fix: Infrastructure - GitHub token, API validation, cost controls
Team 3: Infrastructure & Config

Fixed:
- #4: GitHub Ingestor now works without token for public repos
  - Token is now optional
  - Uses unauthenticated requests (with rate limit warning) when no token
  - Private repos still require token

- #14: Added startup API key validation
  - get_config() now validates API keys at startup
  - Raises clear error if neither OPENAI_API_KEY nor MINIMAX_API_KEY is set
  - Fail-fast instead of silent failures

- #10: Added CostConfig for rate limiting and budget controls
  - max_tokens_per_run: limit tokens per generation
  - max_cost_usd: budget cap in dollars
  - track_usage: enable/disable usage tracking
  - price_per_million_tokens: pricing by model
2026-03-13 18:16:38 +00:00
mrhavens 452c3daec1 fix: Critical bugs - LLM client, server imports, error handling
Team 1: Critical Bug Fix Squad

Fixed:
- #1: LLM Client async methods use undefined self.client
  Changed to self._async_client in utils/llm.py
- #3: Server Upload endpoint missing UploadFile/File imports
  Added to server.py imports
- #17: LangGraph workflow error recovery
  - Replaced fake fallback with proper error raising
  - Enabled MemorySaver checkpointing for state persistence
  - Added traceback printing for debugging
2026-03-13 18:14:11 +00:00
mrhavens 0f647e4e93 Add rigorous nonfiction frameworks
NEW frameworks:
- Diátaxis Tutorial - Learn by doing a project
- Diátaxis How-To - Accomplish a specific task
- Diátaxis Explanation - Clarify and deepen understanding
- Diátaxis Reference - Complete information lookup
- Technical Manual - From foundations to mastery
- Codebase Tour - Document code systematically
- API Documentation - Complete API reference

NonfictionGenerator class to use these frameworks.
CLI integration with --framework flag.

Example:
opus generate --framework codebase-tour --concept 'Linux Kernel'
2026-03-13 08:43:54 +00:00
mrhavens 81bfe8994a Witness ALL data: Include source code in ingestion
- LocalIngestor: Include ALL files by default (source code, configs, etc.)
- GitHubIngestor: Include ALL files by default
- AI witnesses everything and transforms it into documentation
- Filter only build artifacts (.pyc, .so, dist, build)

Philosophy: Don't filter what the AI can see - let it decide
what's relevant. The AI can document code directly!
2026-03-13 05:59:03 +00:00
mrhavens 8cb29889cc Add live research capabilities with innovation detection
Research Tools:
- SearchTool: Multiple backends (Tavily, Serper, Brave, DuckDuckGo)
- WikipediaTool: Wikipedia lookup
- AcademicSearchTool: CrossRef, Semantic Scholar
- ResearchOrchestrator: Comprehensive multi-source research

ResearchAgent:
- NOT just fact-checking - actively discovers NEW information
- Identifies trends beyond training data cutoff
- Generates innovations from cross-referencing sources
- Deep research with subtopics

VerifiedFactChecker:
- Live claim verification against web sources
- Confidence scoring
- Citation needed detection

Dependencies added: tavily, wikipedia, arxiv, duckduckgo-search
2026-03-13 05:03:52 +00:00
mrhavens 6766e93c3d Final cleanup: Merge LLM, add Dockerfile
- Merge llm.py + llm_sync.py into single unified client
- Remove llm_sync.py (now just llm.py with both sync/async)
- Add requests to dependencies
- Add Dockerfile for containerized deployment
- Add .dockerignore

All issues resolved!
2026-03-13 04:47:01 +00:00
mrhavens 8e92e99205 Fix: Remove hardcoded paths - now fully standalone
- Changed all load_dotenv() calls to use relative path (just load_dotenv())
- No OpenClaw dependencies
- Works anywhere after pip install
2026-03-13 04:34:22 +00:00
mrhavens 64cdabd2f8 Add local file/directory ingestion support
- LocalIngestor class for files and directories
- CLI: opus ingest-local PATH
- Generate from local: opus generate --local ./my-notes/
- Support for extensions, recursive scanning, summarize
- Pattern-based exclusion (.git, __pycache__, etc.)
2026-03-13 03:45:43 +00:00
mrhavens c248487d2e Add S3/MinIO ingestion support
- S3Ingestor class for S3-compatible storage
- Supports: AWS S3, MinIO, DigitalOcean Spaces, Wasabi
- CLI: opus ingest-s3 --bucket my-bucket --prefix notes/
- Features: list objects, download, upload, text extraction

Environment:
- AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY
- AWS_REGION
- S3_ENDPOINT_URL (for MinIO/non-AWS)
2026-03-13 03:18:02 +00:00
mrhavens 64bea5cae6 Add comprehensive CLI, OpenAPI server, and documentation
CLI Commands:
- generate: Full manuscript generation with full GitHub content
- serve: Start FastAPI server with OpenAPI docs
- ingest: Standalone GitHub ingestion
- frameworks: List all story frameworks
- config: Show configuration
- docs: Show comprehensive docs (terminal/markdown/html)
- api: Export OpenAPI spec

Server:
- FastAPI with /docs, /redoc interactive docs
- /generate, /ingest, /frameworks, /health endpoints
- OpenAPI 3.0 specification

Documentation:
- Terminal, markdown, and HTML formats
- Full API reference
- Framework documentation
- Environment variables guide
- Project structure

Fix: Use full GitHub content as seed (not just 5000 chars)
2026-03-13 03:10:01 +00:00
mrhavens 9eee1ac1e7 Add GitHub ingestion - pull content from repos as source material
- GitHubIngestor class to fetch repo contents
- Support for .md, .txt, .notes, .draft files
- Method to ingest from GitHub directly into orchestrator
- Export GitHubIngestor in __init__.py

Usage:
    orch = OpusOrchestrator(book_type='fiction', genre='memoir')
    content = await orch.ingest_from_github('mrhavens/my-notes')
    await orch.run()
2026-03-13 00:40:47 +00:00
mrhavens 9692c89214 Add sync LLM client for LangGraph compatibility
The main structure is in place. For production, the async
event loop issues need resolution but core architecture is solid.
2026-03-12 20:17:19 +00:00
mrhavens fe1e001878 Implement full Snowflake Method pipeline
- Stage 1: One sentence summary
- Stage 2: One paragraph outline
- Stage 3: Character sheets
- Stage 4: Four-page outline
- Stage 5: Detailed character charts
- Stage 6: Scene list
- Stage 7: Scene descriptions
- Then: Style guide → Write chapters → Critique → Compile

Full pre-writing workflow now wired up.
2026-03-12 19:36:25 +00:00
mrhavens e151cee69f Add MiniMax LLM integration and local .env support
- Add .env to .gitignore (API keys stay local)
- Add LLM client with MiniMax and OpenAI support
- Update config to load from environment variables
- Wire up Architect agent to actually call the LLM
- Add MiniMax API key to local .env file
2026-03-12 18:33:29 +00:00
mrhavens 40378ad65e Initial commit: Opus Orchestrator AI - Full-flow book generation
- LangGraph workflow orchestration
- CrewAI agent crews (Fiction Fortress & Nonfiction Fortress)
- PydanticAI schema validation
- Fiction agents: Architect, Worldsmith, Character Lead, Voice, Editor
- Nonfiction agents: Researcher, Analyst, Writer, Fact-Checker, Editor
- Complete schema definitions for books, chapters, critiques
- Configuration management
- Basic test suite
2026-03-12 17:45:05 +00:00