[Feature]: add time-range filters to ls/tree so memories can be listed by window

Aperta
#7,321 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
55/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
api, backend

Direzione di ricerca

Start by tracing the existing since, until, and time_field handling in /api/v1/search/find and /api/v1/search/search, then locate the /api/v1/fs/ls, /api/v1/fs/tree, and MCP list implementations. Check the listing tests and add coverage for filtering before pagination, combined tags and time bounds, invalid ranges, and entries without timestamps. Done means all three listing surfaces accept the bounds and the acceptance cases pass.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary

ls currently supports exactly one predicate, tags (k=v retrieval tags). There is no way to ask for "the memories I wrote this week" without pulling the whole directory and filtering client-side.

The retrieval side already answers this question: /api/v1/search/find and /api/v1/search/search accept since / until / time_field and compile them into a metadata range on the indexed created_at / updated_at field. The directory listing does not, even though it is the surface an agent uses to enumerate viking://user/<uid>/memories.

Proposal

Add the same time bounds to the listing surfaces:

Surface New parameters
GET /api/v1/fs/ls since, until
GET /api/v1/fs/tree since, until
MCP list tool since, until

The bounds are applied to the entry modification time (modTime) and use the same syntax as the retrieval endpoints: relative (2h, 7d) or absolute (ISO 8601 / YYYY-MM-DD), timezone-less values are UTC.

Why this shape

  • The filter runs before pagination. offset and limit apply to the entries inside the window, not to the raw directory page. A narrow window therefore still returns the entries that sit past the first raw page instead of coming back empty.
  • A time-ordered listing can stop early. When the listing is ordered by mtime, the scan stops as soon as it walks past the window, so a bounded window stays cheap on a large directory. A name-ordered listing is scanned to the end, because its order says nothing about the timestamps.
  • No model call, no extra embedding. The window is a metadata predicate, so it does not change the recall or the accuracy of the retrieval path and it does not add latency to the request.
  • Entries without a resolvable timestamp are omitted when a window is given: a time window can only be honoured for entries that carry a usable timestamp.

Relationship to the existing tags predicate

tags and the time window are independent and can be combined. tags uses AND semantics over the retrieval tags; the time window uses AND semantics over the modification time. Both are evaluated before offset and limit.

Acceptance

  • GET /api/v1/fs/ls?uri=viking://user/<uid>/memories&since=7d returns only the entries modified in the last seven days.
  • GET /api/v1/fs/ls?uri=viking://user/<uid>/memories&since=7d&limit=10&offset=5 pages over the entries inside the window.
  • GET /api/v1/fs/ls?uri=...&since=2099-01-01 returns an empty list.
  • GET /api/v1/fs/ls?uri=...&since=2099-01-01&until=2000-01-01 returns 400.
  • The MCP list tool accepts the same two parameters.
Lingua principale
Python
Stelle
41.8k
Fork
3.4k
Merge medio
19h 29m
PR unite (30g)
500

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di volcengine/OpenViking

Tutte le issue di volcengine/OpenViking

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.