Skip to content

feat(research): Add research module with manual retry, resume, and lifecycle states#186

Open
dakshmhatre434-ops wants to merge 3 commits into
OpenScanAI:masterfrom
dakshmhatre434-ops:feat/research-module
Open

feat(research): Add research module with manual retry, resume, and lifecycle states#186
dakshmhatre434-ops wants to merge 3 commits into
OpenScanAI:masterfrom
dakshmhatre434-ops:feat/research-module

Conversation

@dakshmhatre434-ops

Copy link
Copy Markdown

Summary

This PR adds a comprehensive research module to Levi, enabling AI-powered research sessions with manual retry/resume capabilities and full lifecycle state management.

Features

  • Research Sessions: Create and manage research sessions with configurable depth (shallow/medium/deep) and max subtopics
  • Research Tasks: Auto-generated subtopics as tasks with sequence ordering and status tracking
  • Research Findings: Extracted findings with confidence scoring, categorization, and source attribution
  • Research Sources: Track sources with quality scoring and reliability metrics
  • Research Memory: Key-value memory store for cross-session learning
  • Research Engine: LLM-powered plan generation, content extraction, and report generation
  • Search Integration: Support for multiple search providers (mock/Serper/Semantic Scholar)
  • Lifecycle States: Full state management - planning, running, cancelling, paused, completed, failed, cancelled
  • Manual Controls: Retry failed tasks, resume paused sessions, cancel running research
  • Progress Tracking: Real-time progress updates with task-level and session-level reporting

Technical Changes

  • Added 5 new DB tables: research_sessions, research_tasks, research_findings, research_sources, research_memory
  • Added research routes and service layer
  • Added shared validators for all research schemas
  • Added research config properties (search provider, LLM model, API keys)
  • Added migration journal entries for research tables
  • Mock search provider included for development without API keys

Configuration

New environment variables:

    • Enable/disable research module (default: true)
    • Search provider: mock/serper/semantic-scholar
    • Serper API key
    • Semantic Scholar API key
    • LLM model for research
    • LLM API key
    • Max results per search (default: 10)
    • Max findings per task (default: 20)

Testing

  • Type checking passes for all research-related code
  • Shared package builds successfully
  • DB package builds and migrations check pass
  • Server routes properly registered in app.ts

Notes

  • The research engine uses a mock search provider by default for development
  • LLM integration supports configurable providers via environment variables
  • All research operations are scoped to company level with proper access control

- Add distinct 'cancelled' terminal state (was conflated with 'completed')
- Add resumeSession() for cancelled/failed sessions
- Add manual retryTask() with UI button (replaces automatic retry)
- Add POST /tasks/:taskId/retry endpoint
- Fix agent adapter type: 'claude' -> 'claude_local' with command config
- Add migration 0095 for cancelled/cancelling enum values
- Fix migration 0094 IF NOT EXISTS for idempotent installs
…fecycle states

- Add research sessions, tasks, findings, sources, and memory tables
- Add research engine with plan generation, task execution, and report generation
- Add manual retryTask() with UI button
- Add resumeSession() for cancelled/failed sessions
- Add distinct cancelled/cancelling terminal states
- Add POST /tasks/:taskId/retry endpoint
- Add research routes and services
- Add DB schema exports and shared validators
- Fix migration journal for 0094 and 0095
…fecycle states

- Add research sessions, tasks, findings, sources, and memory tables
- Add research engine with LLM integration and search providers
- Add research routes and service layer
- Add shared validators for research schemas
- Add research config properties (search provider, LLM model, API keys)
- Support mock search provider for development
- Include migration journal entries for research tables
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant