oracle / oracle/ai-optimizer

Memory 3: Service Layer

Open
#562 0 comments 0 reactions 0 assignees View on GitHub

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 LiteLlmModelSpec and embedding configuration into SDK Llm and Embedder instances.
  • 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 MemoryPrincipal on every scoped call.
  • Always search with exact user_id matching.
  • 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_thread
  • get_thread
  • append_turn
  • get_messages
  • add_memory
  • search_memories
  • update_memory
  • delete_memory
  • delete_thread
  • get_summary
  • get_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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.