Simple Perchance AI Character Chat memory test

Like Lore, memories are like a small database of entries. The AI will auto-generate them and they will be saved into the thread's memory DB.

Since the code was rather complex with a lot of iteration, I used Gemini to understand it without me having to spend my whole afternoon. Source: https://gemini.google.com/share/dea0278ff7ff

This is what I could understand from how memories work and are organized:

  1. Before generating the message, the AI analyzes the current situation and forms 3 questions. These will be used by both lore and memories. You can read more about this process here.
  2. Memories that are found are given a relevance score to the questions the AI formed.
  3. The memories with highest relevance score are selected as "seeds".
  4. A few memories near each seed are selected to form a group; some before the seed, some after. These are gathered chronologically.
  5. If a seed ends up grouped with another, one of the seeds is demoted to a normal memory and added to the group of the other seed.
  6. The group is then joined as a large text, like "Memory1 -> Memory2 -> Memory3 -> Memory4".
  7. To fit the amount of tokens available for memories, the groups that have seeds with lower relevance score are discarded. If the group is too large, ACC tries to discard the least relevant entries in the group instead.
  8. Finally, this text is then sent to the AI as a supplement to have more information when composing the next message.

Here is an example of this process. I was in a large thread, and had the AI generate a message. During the mem/lore question phase, it generated the following questions:

Memory/Lore Search Queries Used:
Project Nightfall Phase 2 blueprints and their potential impact on Edrych's mission
Dr. Cameron's involvement with Project Nightfall and any connections to Edrych's past
Recent Security Bureau activity and their awareness of Edrych's identity and whereabouts

From these, it selected several memories. They were all assigned a relevance score. Several groups were formed with the seeds, the memories that have highest relevance scores, and their surrounding memories.

IMPORTANT: Click here to see the example of a JSON file that is what the AI Character Chat processes for the memories.

As you can see, the group has 4 memories. The seed memory was the one with index 517 ("Edrych discovered the blueprints..."). You can also see it is the memory with highest relevance score in the group, thus confirming it as the seed.

It then collected 3 other memories around it, those of indexes 516, 518 and 519. As you can see, it did collect a memory before it, which was 516.

Lastly, it joined them all in a single text, sorted by their chronological order (which is their index), separated by the "⮕" character, like this:

The confrontation between Edrych and Dr. Cameron demonstrated his willingness to use force to protect those he cares about and the urgency of their mission against Atlas Corp. ⮕ Edrych discovered the blueprints for 'Project: Nightfall - Phase 2', a large facility located on the outskirts of Alabaster City, during his confrontation with Dr. Cameron in her hidden lab. This significant find indicates the project's advancement and provides a crucial target for their mission to dismantle the operation. ⮕ Edrych chose not to harm Dr. Cameron after obtaining the information he needed, despite her role in 'Project Nightfall'. This decision reflects his moral compass and possibly his hope for redemption within the chaos of their shared past. ⮕ The theft of an additional unlabelled USB stick from Dr. Cameron's office suggests there may be further undisclosed information about the project or Atlas Corp. This could be pivotal in their ongoing battle against the corporation and its nefarious activities.

Afterwards, it discarded all groups and left only that one.

This is what you see on the brain icon, and it's also what's sent to the AI. For example, this is what appears when I click the brain icon on the bottom right of the message:

Example image

From this, we can try to draw a few conclusions. Since the secondary memories retrieved are those near the seed (the highest relevant ones), at first I thought they should be order chronologically (since the idea of this feature is to remember several events that are recent to each other.)

However, if we categorize our memories ordered by characters instead, it could also be useful in a way. Since it might find memories relative to a specific character (since it will probably have their names), and then get some other entries that are near it. This could have it collect a section of that character's backstory (which may or may not be relevant to what is happening).

Of course, it would all depend on the relevance score. If we order them chronologically, it could select a seed and then get nearby memories, which could be of low relevance but end up picked because of their proximity to the seed.

If someone is to manually edit and create memories, it might be worth an experiment to see in which way they work better, either by chronological order or some other types of divisions.

Edit Report
Pub: 14 Apr 2025 21:37 UTC
Views: 186