Repository navigation
Description
Summary
recent_activity in project-specific mode displays at most 5 entities (and 5 relations) regardless of the page_size parameter, while the trailing "Activity Summary" line reports the true total returned by the API. This produces a misleading output where the user is told N items exist but only sees 5.
Reproduction
Call recent_activity against a project that has 9 entities in the timeframe, with default page_size=10:
recent_activity(project_id="755a4414-...", timeframe="today")
Output:
## Recent Activity: 755a4414-... (today)
**📄 Recent Notes & Documents (9):**
• 01 - Welcome to Basic Memory
• 02 - The Toolbox
• 03 - The Structure of Basic Memory
• 04 - Semantic Memory - Putting It All Together
• 05 - Markdown Means It's Always a Two-Way Street
**Activity Summary:** 9 items found.
Only 5 of 9 entities are listed. Confirmed via Logfire: the API span api.memory.recent_activity.shape_response reports result_count: 9, so all 9 items came back from the API — the formatter is dropping 4 of them.
Root cause
src/basic_memory/mcp/tools/recent_activity.py, in _format_project_output:
# line 498
for entity in entities[:5]: # Show top 5
...
# line 531
for rel in relations[:5]: # Show top 5
...The hardcoded [:5] slices are independent of page_size. Even recent_activity(page_size=100) will show only 5 entities and 5 relations.
The summary line at lines 543–550 uses len(activity_data.results) (the true count), so the heading says one number and the body shows another:
total = len(activity_data.results)
if activity_data.has_more:
lines.append(f"\n**Activity Summary:** Showing {total} items (page {page}). ...")
else:
lines.append(f"\n**Activity Summary:** {total} items found.")Expected
Either:
- Replace the
entities[:5]/relations[:5]slices withentities[:page_size]/relations[:page_size], or - Drop the slice entirely (the API already paginates by
page_sizeupstream —params["page_size"] = page_sizeis passed at line 149).
Option 2 is cleaner: the API is the canonical source of truth on how many items to return per page; the formatter shouldn't impose a second, lower cap.
There are similar hardcoded slices for observations (lines 513, 519, 521) and key items in discovery mode (lines 437, 444, 453) that may deserve the same review, though those have more nuanced grouping logic and may be intentional.
Environment
- Discovered while exercising the cloud MCP surface from Claude Code.
- Verified against
Basic Memory Cloud - DevMCP server. - Underlying server uses
basic_memorypackage; bug is in the OSS code path.
Activity
claude commentedon May 3, 2026
Claude finished @groksrc's task in 2m 58s —— View job •
claude/issue-784-20260503-0201• Create PR ➔Triage & Fix:
recent_activityhardcoded display caprecent_activity.pyto understand full context[:5]slices in_format_project_outputfor entities and relations[:10]cap on observations (API already paginates)test_format_project_output_shows_all_entities_beyond_five)buglabel (other triage labels don't exist in the repo yet)Issue Classification:
recent_activitycall where the project has >5 results in the timeframerecent_activity)Root cause confirmed
In
src/basic_memory/mcp/tools/recent_activity.py,_format_project_outputwas slicing the already-paginated results a second time:The API already returns exactly
page_sizeitems (default 10). These secondary caps silently dropped results, producing the "9 items found / only 5 shown" discrepancy reported.Fix applied
Removed all three formatter-side caps — the API is the canonical source of truth on result count:
for entity in entities[:5]:for entity in entities:for obs in observations[:10]:for obs in observations:for rel in relations[:5]:for rel in relations:The
[:5]category grouping caps inside observations (show top 5 categories, 2 examples each) were left intentionally — those are display-density choices for the grouped view, not pagination caps.Discovery mode slices (lines 437, 444, 453) also left as-is per the issue's note that "those have more nuanced grouping logic and may be intentional."
Files changed
src/basic_memory/mcp/tools/recent_activity.py— remove the three hardcoded slicestests/mcp/test_tool_recent_activity.py— addtest_format_project_output_shows_all_entities_beyond_fiveregression test with 9 entities|
fix(mcp): drop recent_activity display cap; render all returned rows
refactor(mcp): port context and recent-activity tests to bm_context a…