You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
recent_activity formatter hardcodes display cap of 5, ignoring page_size #784
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: 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 498forentityinentities[:5]: # Show top 5
...
# line 531forrelinrelations[: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:
Replace the entities[:5] / relations[:5] slices with entities[:page_size] / relations[:page_size], or
Drop the slice entirely (the API already paginates by page_size upstream — params["page_size"] = page_size is 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 - Dev MCP server.
Underlying server uses basic_memory package; bug is in the OSS code path.
Triage & Fix: recent_activity hardcoded display cap
Analyze issue and classify
Read recent_activity.py to understand full context
Fix hardcoded [:5] slices in _format_project_output for entities and relations
Remove hardcoded [:10] cap on observations (API already paginates)
Add regression test (test_format_project_output_shows_all_entities_beyond_five)
Commit and push changes
Add bug label (other triage labels don't exist in the repo yet)
Issue Classification:
Type: Bug
Priority: Medium — misleading output, not data loss; affects any recent_activity call where the project has >5 results in the timeframe
Component: MCP tool (recent_activity)
Complexity: Simple
Root cause confirmed
In src/basic_memory/mcp/tools/recent_activity.py, _format_project_output was slicing the already-paginated results a second time:
forentityinentities[:5]: # line 498 — hardcoded capforobsinobservations[:10]: # line 513 — hardcoded capforrelinrelations[:5]: # line 531 — hardcoded cap
The API already returns exactly page_size items (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:
Location
Before
After
Entities (line 498)
for entity in entities[:5]:
for entity in entities:
Observations (line 513)
for obs in observations[:10]:
for obs in observations:
Relations (line 531)
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 slices
tests/mcp/test_tool_recent_activity.py — add test_format_project_output_shows_all_entities_beyond_five regression test with 9 entities
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…