cos_search
Search past observations and learned patterns ranked by confidence and impact to find relevant experience during the Orient step.
Instructions
Search observations and learned patterns with 5-signal ranking.
Use during Orient step to find relevant past experience. Read-only over memory rows (writes retrieval telemetry only; reinforcement happens on cos_details, not here — TASK-109).
Stage-1 metadata pre-filter:
min_confidencedrops decayed/low-trust patterns BEFORE ranking. Stale low-signal patterns can otherwise crowd out fresh hits. Default 0.3 skips decayed/unvalidated noise (fresh patterns start at 0.5, so they still pass); pass 0.0 to include everything.since_dayscaps row age. 0 = no cap (default) — age is opt-in so a valuable old decision is never silently hidden from default recall.
Args:
query: Search text (e.g. "backend rework", "django migration").
limit: Max results (1-20, default 5).
memory_type: Filter by type (pattern/workflow/error/decision/discovery). Optional.
min_confidence: Drop learned_patterns with confidence below this
value (0.0-1.0). Default 0.3 (skips decayed noise). 0.0 = no filter.
since_days: Drop rows older than now-since_days. 0 = no cap.
Common: 90 (one quarter) for "recent" queries.
Returns: str: JSON with results list [{id, title, confidence, impact_score, memory_type, source_table}].
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| query | Yes | ||
| since_days | No | ||
| memory_type | No | ||
| min_confidence | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |