Memory 3: Service Layer
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 101
- Forks
- 46
- Avg merge
- 6h 19m
- Merged PRs (30d)
- 23
Description
Create a package resembling:
src/server/app/memory/
|-- adapters.py
|-- config.py
|-- registry.py
|-- schemas.py
+-- service.py
Responsibilities:
- Resolve the configured database pool and model credentials.
- Translate the repository's
LiteLlmModelSpecand embedding configuration into SDKLlmandEmbedderinstances. - Cache components by database, model, and configuration identity, not by user.
- Invalidate the cache after relevant configuration or credential changes.
- Close SDK components during application shutdown.
- Require a
MemoryPrincipalon every scoped call. - Always search with exact
user_idmatching. - Return project-owned Pydantic DTOs rather than exposing SDK objects directly.
- Map SDK exceptions into stable API error categories.
- Never log prompts, stored content, search queries, metadata, user IDs, or thread IDs.
Recommended service methods:
create_threadget_threadappend_turnget_messagesadd_memorysearch_memoriesupdate_memorydelete_memorydelete_threadget_summaryget_context_card
Include request or turn IDs and deterministic message IDs for retry safety. This matters for streaming reconnects and multi-replica deployments.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the proposed src/server/app/memory/ package layout and review the responsibilities for adapters.py, config.py, registry.py, schemas.py, and service.py. Use the listed service methods as the scope, including principal checks, exact user matching, caching, invalidation, shutdown, DTOs, error mapping, and retry-safe IDs. Done means the service satisfies these requirements without exposing sensitive data in logs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- ai, backend-api-design, databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100