Add long-term-memory module: file, vector and summary memory on one Spring AI agent. AutoMemoryTools and AutoMemoryToolsAdvisor, fact extraction with a privacy gate into PostgreSQL and pgvector, VectorStoreChatMemoryAdvisor, a versioned summary, updating, forgetting, isolation, expiry, recall with all-MiniLM-L6-v2 and token cost. Scripted ChatModel; no provider or local LLM called. Spring Boot 4.2.0, Spring AI 2.1.0, Java 25.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b4RzcCS5JCAgcxLz7T
This commit is contained in:
Claude
2026-12-05 16:19:40 +05:30
parent c8fa0912f7
commit 5724303728
37 changed files with 1833 additions and 0 deletions
@@ -0,0 +1,21 @@
# File memory: save in conversation 1, recall in conversation 2 (scripted model)
conversation 1: "I am vegetarian. Please remember that."
model call 1 input~ 4469 tokens
model call 2 input~ 4488 tokens after tool result: Error: Path does not exist: MEMORY.md
model call 3 input~ 4547 tokens after tool result: Successfully created file: user_diet.md (102 bytes)
model call 4 input~ 4584 tokens after tool result: Successfully created file: MEMORY.md (42 bytes)
model calls: 4, input tokens across them: ~18088
conversation 2: "Book me a flight to Delhi."
model call 1 input~ 4468 tokens
model call 2 input~ 4511 tokens after tool result: File: MEMORY.md | Lines 1-1 of 1 | | 1\t- [Diet](user_diet.md) - vegetarian meals |
model call 3 input~ 4595 tokens after tool result: File: user_diet.md | Lines 1-6 of 6 | | 1\t--- | 2\tname: diet | 3\tdescr...
model calls: 3, input tokens across them: ~13574
first request of conversation 2 already contains the saved fact: false
first request of conversation 2 contains the MEMORY.md index line: false
files under <root>/asha:
MEMORY.md (42 bytes)
user_diet.md (102 bytes)