Skip to content

refactor(server): recent memory api#26

Merged
kwaa merged 5 commits intomainfrom
refactor/recent-memory
Feb 20, 2026
Merged

refactor(server): recent memory api#26
kwaa merged 5 commits intomainfrom
refactor/recent-memory

Conversation

@kwaa
Copy link
Copy Markdown
Member

@kwaa kwaa commented Feb 20, 2026

No description provided.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @kwaa, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors the server by introducing a new API for retrieving recent episodic memories. It provides two endpoints: one for raw JSON data and another for markdown-formatted summaries suitable for LLM consumption. This enhancement allows for more flexible and human-readable access to conversational memory, improving the system's ability to recall and present past interactions.

Highlights

  • New Recent Memory API: Introduced /api/v0/recent_memory and /api/v0/recent_memory/raw endpoints to retrieve episodic memories, supporting filtering by conversation ID and time limits.
  • Dependency Updates: Added chrono-humanize for human-readable time formatting and plastmem_entities for database entity definitions.
  • TypeScript SDK Integration: Updated the TypeScript SDK to include new types and client functions for the recentMemory and recentMemoryRaw API endpoints.
Changelog
  • Cargo.lock
    • Added chrono-humanize dependency.
    • Added plastmem_entities dependency.
  • crates/server/Cargo.toml
    • Added chrono-humanize as a workspace dependency.
    • Added plastmem_entities as a workspace dependency.
  • crates/server/src/api/mod.rs
    • Imported the new recent_memory module.
    • Exported RecentMemory struct.
    • Registered recent_memory and recent_memory_raw routes with the OpenAPI router.
    • Added RecentMemory to the OpenAPI schema components.
  • crates/server/src/api/recent_memory.rs
    • Created a new file implementing the recent_memory API.
    • Defined the RecentMemory request payload structure.
    • Implemented recent_memory_raw endpoint to return recent episodic memories in JSON.
    • Implemented recent_memory endpoint to return recent episodic memories formatted as Markdown.
    • Included logic for filtering by conversation ID, days limit, and sanitizing the result limit.
    • Utilized chrono-humanize for time formatting in the Markdown output.
  • packages/plastmem/src/index.ts
    • Exported recentMemory and recentMemoryRaw functions from sdk.gen.
    • Exported RecentMemory, RecentMemoryData, RecentMemoryRawData, RecentMemoryRawResponse, RecentMemoryRawResponses, RecentMemoryResponse, RecentMemoryResponses types from types.gen.
  • packages/plastmem/src/sdk.gen.ts
    • Imported new RecentMemoryData, RecentMemoryRawData, RecentMemoryRawResponses, RecentMemoryResponses types.
    • Added recentMemory client function for the markdown-formatted endpoint.
    • Added recentMemoryRaw client function for the raw JSON endpoint.
  • packages/plastmem/src/types.gen.ts
    • Defined the RecentMemory type for the API request body.
    • Defined RecentMemoryData, RecentMemoryResponses, RecentMemoryResponse types for the markdown endpoint.
    • Defined RecentMemoryRawData, RecentMemoryRawResponses, RecentMemoryRawResponse types for the raw JSON endpoint.
Activity
  • No human activity has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new API for retrieving recent episodic memories, providing both raw JSON and formatted Markdown outputs. The implementation is solid and integrates well with the existing architecture. I have identified a few areas for improvement, primarily concerning input validation for the limit parameter and potential issues with u64 to i64 casting and deprecated chrono::Duration::days usage for the days_limit parameter. Addressing these will enhance the robustness and safety of the API.

Comment thread crates/server/src/api/recent_memory.rs Outdated
Comment thread crates/server/src/api/recent_memory.rs Outdated
Comment thread crates/server/src/api/recent_memory.rs
@kwaa kwaa merged commit e9e340a into main Feb 20, 2026
@kwaa kwaa deleted the refactor/recent-memory branch February 20, 2026 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant