Skip to content

Fix summary extraction promotion#316

Merged
abrookins merged 3 commits into
mainfrom
fix/summary-extraction
Jun 18, 2026
Merged

Fix summary extraction promotion#316
abrookins merged 3 commits into
mainfrom
fix/summary-extraction

Conversation

@abrookins

@abrookins abrookins commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fix automatic working-memory promotion for sessions configured with the singular summary extraction strategy, and make the resulting thread summaries usable as first-class long-term memory records for dashboards and summary views.

Problems

Summary extraction existed as a strategy, but automatic thread promotion did not honor it. The delayed extraction path built the full conversation and then always used the discrete strategy, so a session configured with long_term_memory_strategy={"strategy":"summary"} would not produce a durable thread summary through the automatic promotion path.

Summary records also lacked reliable provenance and filterability. The RedisVL adapter did not store or return extraction_strategy, strategy config, or generic metadata, which made it hard for dashboards and summary views to reliably select thread summaries by strategy, source session, source messages, or timestamp range.

Summary view empty partitions returned placeholder text instead of a structured empty result, and the long-term summary prompt flattened memory text without enough metadata or deterministic ordering.

Solution

  • Honor the configured singular extraction strategy in extract_memories_from_session_thread() instead of hardcoding discrete.
  • Build and pass full thread context into strategy extraction, including session, namespace, user, source message IDs, message count, source timestamp range, and a source-message fingerprint.
  • Convert summary strategy output into one deterministic durable thread-summary memory per session using thread_summary_<sha256(namespace|user_id|session_id)[:24]>.
  • Store summary provenance in MemoryRecord.metadata, including source session, source messages, source timestamp range, summary version, and source fingerprint.
  • Skip unchanged summary re-extraction when an existing summary memory has the same summary version and source fingerprint.
  • Store, return, and filter extraction_strategy, extraction_strategy_config, and metadata through RedisVL and the Python, TypeScript, and Java client models.
  • Add extraction_strategy filtering to REST, MCP, Python, TypeScript, and Java search surfaces.
  • Improve summary views with extraction_strategy, topics, and event_date filters, deterministic memory ordering, metadata-rich JSON prompt lines, and structured empty partition results.
  • Document the summary strategy behavior and the RediSearch index rebuild requirement for the new indexed field.

Testing

  • source .venv/bin/activate && pytest tests/test_extraction_logic_fix.py tests/test_summary_views.py tests/test_memory_vector_db.py (110 passed)
  • source .venv/bin/activate && pytest tests/test_client_strategy_support.py tests/test_mcp_strategy_support.py tests/test_working_memory_strategies.py (21 passed)
  • CI=true npm run test:coverage && npm run typecheck in agent-memory-client/agent-memory-client-js (195 passed, coverage and typecheck passed)
  • export JAVA_HOME=$(/usr/libexec/java_home -v 21) && export PATH="$JAVA_HOME/bin:$PATH" && ./gradlew test in agent-memory-client/agent-memory-client-java (BUILD SUCCESSFUL)

Note

Medium Risk
Touches core long-term indexing, automatic extraction, and Redis schema fields; deployments need index rebuild for new tag filters, and summary idempotency/dedup behavior changes affect stored thread summaries.

Overview
Automatic thread extraction now uses the session’s configured long_term_memory_strategy instead of always running discrete. The summary path builds full thread context, can skip unchanged reruns via fingerprint + summary_version, coalesces model output to one semantic record with a deterministic thread_summary_* id, provenance in metadata, and skips hash/semantic dedup for those records.

Long-term memory gains indexed extraction_strategy, extraction_strategy_config, and metadata in RedisVL (schema + read/write), extraction_strategy search filters on API/MCP/clients, and soft-filter fallback hints for that field.

Summary views accept extraction_strategy, topics, and event_date filters; prompts use sorted, metadata-rich JSON lines; empty partitions return empty / empty_reason instead of placeholder text.

Python, TypeScript, and Java clients and docs are updated accordingly (including index rebuild note for extraction_strategy).

Reviewed by Cursor Bugbot for commit 8a3589f. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review completed. Found one potential issue related to the default extraction strategy fallback logic.


🤖 Automated review complete. Please react with 👍 or 👎 on the individual review comments to provide feedback on their usefulness.

Comment thread agent_memory_server/memory_vector_db.py Outdated
@abrookins abrookins force-pushed the fix/summary-extraction branch from fa4f7d5 to b795029 Compare June 17, 2026 19:55
Comment thread agent_memory_server/long_term_memory.py Outdated
@jit-ci

jit-ci Bot commented Jun 17, 2026

Copy link
Copy Markdown

🛡️ Jit Security Scan Results

CRITICAL HIGH MEDIUM

✅ No security findings were detected in this PR


Security scan by Jit

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 0cf3a43. Configure here.

Comment thread agent_memory_server/long_term_memory.py
@abrookins abrookins merged commit 241eaea into main Jun 18, 2026
26 checks passed
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