Skip to content

Temporal filtering parameters (startTime/endTime) not exposed in /query endpoint #105

@netbja

Description

@netbja

Description

The HSG query function in memory/hsg.ts supports temporal filtering via startTime and endTime parameters, but the /query endpoint in server/routes/vercel.ts doesn't pass these parameters to hsg_query().

This means users cannot filter memories by creation date via the REST API, even though the core functionality exists.

Current behavior

// vercel.ts line ~14
const matches = await hsg_query(query, k, { user_id });

The startTime and endTime from the request body are ignored.

Expected behavior

The endpoint should extract and pass temporal parameters:

const startTime: number | undefined = b.startTime ? Number(b.startTime) : undefined;
const endTime: number | undefined = b.endTime ? Number(b.endTime) : undefined;
const matches = await hsg_query(query, k, { user_id, startTime, endTime });

Steps to reproduce

  1. Store a memory
  2. Query with startTime set to a future timestamp:
    curl -X POST http://localhost:8090/query \
      -H "Content-Type: application/json" \
      -d '{"query": "test", "startTime": 9999999999999}'
  3. Expected: 0 results (no memories created after that timestamp)
  4. Actual: Returns all matching memories (filter ignored)

Suggested fix

In backend/src/server/routes/vercel.ts, add extraction of startTime/endTime and pass them to hsg_query().

The same fix should be applied to /memory/query in memory.ts for consistency.

Version

v1.2.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions