Skip to content

Memories with directory grouping and optional frontmatter #1055

@MischaPanch

Description

@MischaPanch

Currently memory structure is flat and list_memories just returns the memory names. This is impractical for projects with many memories or for memories where the content isn't easily represented by just the file name.

The solution @opcode81 and I agreed on now is the following:

  1. Memories can be in subdirectories, the directory enters the memory name. So we can have the list of names like global_mem, auth/login_logic, auth/token_verification
  2. Write memory can receive a name with a "/" and will then write to the respective subdir
  3. Memories can have frontmatter, which is at the top of the markdown file, between two lines with ---. The frontmatter for now will only contain summary: .... or be empty or missing.
  4. list_memories returns memory names and any non-empty frontmatter that was found as answer to the agent.
  5. list_memories can receive a path (optionally, by default "", and the kwarg should be called something like topic) and then only lists the memories in that subdir
  6. The tool docstrings are adjusted to make the agent group relevant memories together in subdirs (semantically into topics, arbitrary nesting) and write frontmatter if necessary. The agent is also encouraged to structure existing memories and to add frontmatter to them if appropriate.

I think for restructuring existing memories, we should add a new tool RenameMemoryTool, a renaming to something with "/" will then move the file - @opcode81 do you agree?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions