[kimi-task] [feat] Add /api/matrix/memory/search endpoint — visitors query Timmy's memory #678

Closed
opened 2026-03-21 03:12:10 +00:00 by kimi · 1 comment
Collaborator

Epic: Matrix Unification

Task

Add GET /api/matrix/memory/search?q= endpoint that lets Matrix visitors search
Timmy's memory. Returns relevant memories formatted for the 3D world display.

Files

  • src/dashboard/routes/world.py — add /api/matrix/memory/search route
  • tests/timmy/test_world_api.py — add test

Acceptance Criteria

  • GET /api/matrix/memory/search?q=bitcoin returns JSON array of memory snippets
  • Each result: {text (truncated 200 chars), relevance (0-1), created_at, context_type}
  • Max 5 results per query
  • Returns 400 if q param missing or empty
  • Rate limited to 1 search per 5 seconds per IP
  • Reuses existing memory_system.search() internals
  • tox -e unit passes
  • tox -e lint passes

Context

In the Matrix 3D world, visitors can interact with Timmy. Being able to search his memory
("what do you remember about sovereignty?") is a core presence feature. Results will appear
as floating crystal-ball text in the Workshop room.

## Epic: Matrix Unification ## Task Add GET /api/matrix/memory/search?q=<query> endpoint that lets Matrix visitors search Timmy's memory. Returns relevant memories formatted for the 3D world display. ## Files - src/dashboard/routes/world.py — add /api/matrix/memory/search route - tests/timmy/test_world_api.py — add test ## Acceptance Criteria - [ ] GET /api/matrix/memory/search?q=bitcoin returns JSON array of memory snippets - [ ] Each result: {text (truncated 200 chars), relevance (0-1), created_at, context_type} - [ ] Max 5 results per query - [ ] Returns 400 if q param missing or empty - [ ] Rate limited to 1 search per 5 seconds per IP - [ ] Reuses existing memory_system.search() internals - [ ] tox -e unit passes - [ ] tox -e lint passes ## Context In the Matrix 3D world, visitors can interact with Timmy. Being able to search his memory ("what do you remember about sovereignty?") is a core presence feature. Results will appear as floating crystal-ball text in the Workshop room.
kimi self-assigned this 2026-03-21 03:12:10 +00:00
Author
Collaborator

PR created: http://143.198.27.163:3000/rockachopa/Timmy-time-dashboard/pulls/740

Implementation Summary

Implemented the /api/matrix/memory/search endpoint as specified:

Acceptance Criteria Met

  • GET /api/matrix/memory/search?q=bitcoin returns JSON array of memory snippets
  • Each result includes: text (truncated 200 chars), relevance (0-1), created_at, context_type
  • Max 5 results per query
  • Returns 400 if q param missing or empty
  • Rate limited to 1 search per 5 seconds per IP (with Retry-After header)
  • Reuses existing memory_system.search() internals
  • tox -e unit passes (2535 passed)
  • tox -e lint passes

Additional Features

  • IP extraction respects X-Forwarded-For header (for proxy support)
  • Graceful degradation returns empty array on search failure
  • Comprehensive test coverage (18 new tests)

Files Changed

  • src/dashboard/routes/world.py (+120 lines)
  • tests/dashboard/test_world_api.py (+263 lines)
PR created: http://143.198.27.163:3000/rockachopa/Timmy-time-dashboard/pulls/740 ## Implementation Summary Implemented the `/api/matrix/memory/search` endpoint as specified: ### ✅ Acceptance Criteria Met - [x] GET `/api/matrix/memory/search?q=bitcoin` returns JSON array of memory snippets - [x] Each result includes: `text` (truncated 200 chars), `relevance` (0-1), `created_at`, `context_type` - [x] Max 5 results per query - [x] Returns 400 if `q` param missing or empty - [x] Rate limited to 1 search per 5 seconds per IP (with `Retry-After` header) - [x] Reuses existing `memory_system.search()` internals - [x] `tox -e unit` passes (2535 passed) - [x] `tox -e lint` passes ### Additional Features - IP extraction respects `X-Forwarded-For` header (for proxy support) - Graceful degradation returns empty array on search failure - Comprehensive test coverage (18 new tests) ### Files Changed - `src/dashboard/routes/world.py` (+120 lines) - `tests/dashboard/test_world_api.py` (+263 lines)
kimi closed this issue 2026-03-21 14:52:32 +00:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Rockachopa/Timmy-time-dashboard#678