Skip to main content

Opportunity Engine

src/scheduler/opportunity.py. Feature-flagged via opportunity_engine_enabled (default true).

What it does

Watches the operator's recent activity in episodic memory and surfaces opportunities to automate recurring patterns. It does not execute anything autonomously — every suggestion appears at /opportunities for operator review.

Detection patterns

The engine looks for five classes of automation opportunity:

PatternTriggerSuggested action
Crypto monitoringOperator repeatedly asks for the same coin's priceCreate a price alert (subscribe)
News / RSSOperator regularly fetches the same site for newsSubscribe to its RSS feed
Website monitoringOperator periodically captures the same URLCreate a monitors entry
Periodic reportsOperator generates the same report manuallyCreate a recurring task (task_manager)
API watchingOperator polls the same endpointSet up a scheduled job

Storage

Opportunity(
opp_type, -- crypto | news | website | report | api
description, -- human-readable summary
confidence, -- 0..1
source, -- "episodic_pattern" | "knowledge_graph" | etc.
related_entities, -- JSON array of entity references
action_policy, -- "suggest" | "auto-execute" (always "suggest" by default)
status, -- "pending" | "accepted" | "rejected" | "expired"
fingerprint, -- dedup key
created_at
)

Deduplication

Each opportunity has a fingerprint (e.g., entity + opp_type). Opportunities with the same fingerprint within 48 h are deduplicated. Maximum 2 new opportunities per day to avoid notification storms.

Operator review

/opportunities shows pending suggestions with:

  • Description of the pattern
  • Confidence
  • Suggested action (with parameters)
  • Accept / Reject buttons

Accept → executes the suggested action (creates the subscription, task, or monitor). Reject → marks status rejected; future opportunities with the same fingerprint will not appear unless cleared.

CPI gating

Skipped when agent:cpi_high is set.

See also