Repository navigation
Closed
Labels
Description
Summary
Uteke only supports semantic search (/recall) and keyword search (/search). No way to perform structured queries like:
WHERE memory_type = 'decision' AND namespace = 'cmo'WHERE importance > 0.5 AND created_at > '2026-07-01'WHERE json_extract(metadata, '$.platform') = 'threads'
Proposed Endpoint
POST /query
{
"namespace": "cmo",
"memory_type": "fact",
"tags": ["threads"],
"importance_min": 0.5,
"created_after": "2026-07-01",
"metadata_filters": {"platform": "threads"},
"order_by": "created_at",
"order_dir": "desc",
"limit": 20
}
Acceptance Criteria
Functional
- New
POST /queryendpoint accepting structured filter parameters - Supports column filters: namespace, memory_type, tags, importance range, date range, pinned, deprecated
- Supports metadata JSON filters via
json_extract - ORDER BY + LIMIT + OFFSET pagination
- Returns same memory format as
/list
Verification (CMO can run without reading code)
-
curl POST /query {"namespace":"cmo","memory_type":"fact","limit":5}→ returns up to 5 memories, all namespace=cmo and type=fact -
curl POST /query {"tags":["codecoradev","threads"]}→ returns memories with BOTH tags (AND logic) -
curl POST /query {"importance_min":0.5,"importance_max":1.0}→ only memories in range -
curl POST /query {"created_after":"2026-01-01","order_by":"created_at","order_dir":"desc"}→ chronologically sorted, after date -
curl POST /query {"metadata_filters":{"platform":"threads"}}→ only memories with that metadata key-value -
curl POST /query {"limit":5,"offset":5}→ returns 2nd page (different from offset=0) -
curl POST /querywith empty body{}→ returns all memories (no filter = no constraint) -
curl POST /query {"memory_type":"nonexistent"}→ returns empty array[], not error - Response format matches
/listoutput (same JSON shape)
Error handling
- Invalid JSON body → 400 with clear error message
- Invalid date format → 400 with clear error message
- Negative limit/offset → 400 validation error
Tests
- Unit: query with namespace + memory_type filter → correct subset
- Unit: query with metadata_filters → json_extract works
- Integration: pagination offset/limit returns correct slices
Priority
High — essential for using Uteke as dual semantic + structured store.
Dependencies
- fix: /remember does not set memory_type column #656 (DB indexes for performance)
Activity
ajianaz commentedon Jul 14, 2026
Dependencies
ajianaz commentedon Jul 14, 2026
Duplicate of #668 (same scope, newer issue)