Repository navigation
Closed
Labels
enhancementNew feature or request
Description
Problem
Agents need to inspect a bounded portion of a note, jump to relevant lines, and expand the range without loading the entire document. Result pagination does not provide this within-note navigation.
This complements #686: compact discovery identifies a note, while line scanning lets an agent inspect only the relevant content.
Proposed scope
- Add optional, 1-based inclusive line bounds to
read_note(for example,start_lineandend_line). - Return the requested range with unambiguous line numbers, total line count, and continuation information indicating whether more content remains and the next range to request.
- Reuse the existing
catline-slicing implementation where practical, with one consistent line-numbering convention across reads and search. - Support line-oriented literal
grepresults: matching line numbers and an optional bounded surrounding context window. - Keep semantic search behavior distinct: do not invent exact matching line numbers for semantic results without a reliable mapping to the note.
- Preserve existing behavior when no line-scanning options are requested.
Example flow:
grep("retry", literal=True, context_lines=3)
→ runbook.md:142, matching text with surrounding lines
read_note("runbook.md", start_line=120, end_line=180)
→ requested lines, total line count, and continuation information
Parameter names above are illustrative; settle them consistently with the existing cat slicing API.
Contract and verification
- Specify whether line numbers include frontmatter, and use the same convention across grep, cat, and read_note.
- Define omitted bounds, invalid ranges, end-of-file behavior, and empty notes.
- Keep matching and returned line references consistent with the content being scanned. Document that intervening edits can shift line positions between calls.
- Add focused tests for exact slices, boundary cases, literal match locations, context windows, and continuation metadata.
Non-goals
- An interactive
lessprocess or terminal session. - Replacing result pagination.
- The entire progressive-loading design in Progressive note loading — compact index with on-demand full content #686.
- A new snapshot or cursor subsystem.
The intended workflow is: find a match → inspect nearby lines → expand or continue as needed.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Activity
claude commentedon Sep 7, 2026
Claude finished @phernandez's task in 33s —— View job
Triage
Type: Enhancement (feature request) — labeled
enhancement.Component: MCP tools (
read_note, and a new/extendedgrep-style search tool). Not cloud-specific, so nocloudlabel.Priority: Medium — quality-of-life for agent context efficiency, not a breakage or blocker.
Complexity: Medium — the repo already has a line-slicing implementation to build on (
src/basic_memory/mcp/tools/posix_tools.py,src/basic_memory/mcp/note_reads.py, and thecat/headman pages), so this is largely extending an existing pattern rather than new architecture. The work spans: threadingstart_line/end_linethroughread_note, adding literal-match + context-window results togrep, and defining/documenting a single consistent line-numbering convention (including the frontmatter-inclusion question) across both tools plus tests for boundary cases.Duplicates: None found. This is complementary to #686 (progressive note loading), as the issue itself notes — not a duplicate.
No reproduction steps or clarifying questions needed; the proposed scope, contract, and non-goals are well specified. Ready for implementation planning.
docs(skills): bring skills up to date with v0.24.0
docs(skills): bring skills up to date with v0.24.0