Skip to content

Release v6.8.1: investigation efficiency guidance, overlapping read detection, and zero-result search guidance - #126

Merged
code-crusher merged 2 commits into
mainfrom
release/v6.8.1
Aug 21, 2026
Merged

code-crusher merged 2 commits into
mainfrom
release/v6.8.1

Conversation

@code-crusher

Copy link
Copy Markdown
Member

What's in this release

Extension version bump 6.8.0 -> 6.8.1 plus the pending feature work that was already merged to main and sitting unreleased:

Agent investigation efficiency

  • Added an "Investigation efficiency" section to the shared tool-usage instructions in the system prompt (src/core/prompts/system.ts): classify comprehension questions separately from implementation tasks, form a one-line hypothesis before searching, read call sites rather than implementation internals, avoid reading prose when the question is about control flow, and stop exploring once the answer is known.

Overlapping read detection in read_file

  • src/core/tools/readFileTool.ts now detects when a requested file region partially overlaps with a region already read earlier in the same task (same file, same mtime). The exact-match short-circuit is unchanged; the new overlap check prepends a notice telling the model which lines are already in context, so it stops re-reading overlapping portions (e.g. 600-849 then 800-1059).

Zero-result guidance in search_files

  • src/core/tools/searchFilesTool.ts appends actionable guidance when a search returns 0 matches: tighten/simplify the regex, widen the path scope, try a different glob, or stop after 2+ failed attempts. This breaks the "search to 0 results, tweak regex, search to 0 results" loop.

Native tool description improvements

  • The read_file and search_files native tool descriptions (.ts prompt files) now direct the model to scope paths narrowly, not re-read regions already in context, and stop after repeated zero-result searches.

Changelog

  • Updated CHANGELOG.md with a new [Unreleased] section summarizing the above.

Tests

  • pnpm lint passes (14/14 tasks, 0 warnings).

Notes

@matterai-app matterai-app Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧪 PR Review is completed: PR adds investigation efficiency prompts, overlapping read detection in readFileTool, and zero-result search guidance. The overlap detection logic is sound, but the zero-result string check in searchFilesTool may not match the actual search service output format.

Skipped files
  • CHANGELOG.md: Skipped file pattern
⬇️ Low Priority Suggestions (1)
src/core/tools/searchFilesTool.ts (1 suggestion)

Location: src/core/tools/searchFilesTool.ts (Lines 71-71)

🟡 Potential Bug

Issue: The zero-result guidance is gated on results.includes("Matches: 0"), but a grep for "Matches:" across src/services/** (where the searchFiles service lives) returns no matches. This strongly suggests the search service does not output the literal string "Matches: 0", which would mean the guidance is never appended and the entire feature is dead code.

Fix: Verify the actual output format of searchFiles and adjust the check accordingly. A more robust approach would use a case-insensitive regex and also handle common alternative formats.

Impact: Ensures the zero-result guidance feature actually activates when searches return no matches.

-  			if (results.includes("Matches: 0")) {
+  			if (/matches?:\s*0/i.test(results) || results.includes("No matches") || results.trim() === "") {

…sult guidance

Code review found that results.includes('Matches: 0') could false-positive
when matched file content contains that literal text. Changed searchFiles
to return { text, matchCount } so the tool checks page.matches.length
directly via the structured return value.
@matterai-app

matterai-app Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Context

Release v6.8.1 introduces investigation efficiency guidance, zero-result search guidance, and overlapping read detection enhancements.

Implementation

Updated searchFiles to return both text and matchCount. When matchCount === 0, guidance is appended steering the model toward regex tightening/loosening or path scoping instead of blind retries.

Screenshots

before after
N/A N/A

How to Test

  • Execute a search query that yields zero results.
  • Verify that zero-result search guidance is appended to the search output.

Summary By MatterAI MatterAI logo

🔄 What Changed

Added zero-result search guidance to steering models against blind retries, bumped version to 6.8.1, and updated search service result interfaces to track match counts.

🔍 Impact of the Change

Improves agent investigation efficiency by providing actionable context when file searches return empty results, reducing unnecessary API calls and token waste.

📁 Total Files Changed

Click to Expand
File ChangeLog
Search Tool (src/core/tools/searchFilesTool.ts) Appends zero-result guidance when match count is zero.
Search Test (src/services/search-files/__tests__/index.spec.ts) Updated unit tests to align with search result structure.
Search Service (src/services/search-files/index.ts) Added SearchFilesResult interface returning text and match count.

🧪 Test Added/Recommended

Added

  • Verified unit tests for search engine selection and fallback logic.

Recommended

  • Add test coverage for zero-result guidance appending when matchCount is zero.

🔒 Security Vulnerabilities

  • N/A

@matterai-app

matterai-app Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

✅ Reviewed the changes: Clean refactor: searchFiles now returns a structured result with matchCount, replacing fragile string-based zero-result detection with a direct numeric check. No issues found in the new code.

@code-crusher
code-crusher merged commit 195737e into main Aug 21, 2026
3 of 9 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