Skip to content
This repository was archived by the owner on Sep 23, 2026. It is now read-only.

feat(toolset): improve dedup with sparse reminders and canonical args - #2372

Merged
sailist merged 2 commits into
MoonshotAI:mainfrom
jackfish212:feat/tool-dedup-sparse-reminders
May 26, 2026
Merged

sailist merged 2 commits into
MoonshotAI:mainfrom
jackfish212:feat/tool-dedup-sparse-reminders

Conversation

@jackfish212

@jackfish212 jackfish212 commented May 26, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

This PR improves the tool call deduplication system with smarter repeat detection and sparse reminders, makes /clear a true alias for /new in the shell UI, and updates the welcome tip.


1. Tool Call Deduplication Improvements

Problem: The previous deduplication system appended a reminder on every cross-step duplicate call, which could be noisy. It also did not normalize JSON argument key order, causing identical calls with different key orderings to be treated as distinct.

What was done:

  • Canonicalize tool arguments by sorting JSON keys for stable dedup comparison
  • Track consecutive repeat streaks across steps instead of treating each step independently
  • Use sparse reminders: gentle reminder at the 3rd consecutive repeat, stronger detailed reminder at 5th and 8th repeats showing tool name, repeat count, and canonical arguments
  • Expand test coverage for canonicalization and sparse reminder thresholds

2. Shell UI Improvements

Problem: /clear and /new had overlapping but slightly different implementations.

What was done:

  • Extract shared _do_new_session helper in shell slash commands
  • Make /clear a proper alias for /new with consistent session reset behavior
  • Update welcome tip to promote Kimi Code download link

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked the related issue, if any.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have run make gen-changelog to update the changelog.
  • I have run make gen-docs to update the user documentation.

Extract shared _do_new_session helper so /clear and /new reuse the same new-session logic.

@devin-ai-integration devin-ai-integration 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.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 5 additional findings.

Open in Devin Review

- canonicalize tool arguments by sorting JSON keys for stable dedup keys\n- track consecutive repeat streaks across steps instead of single-step history\n- append gentle reminder only at 3rd consecutive repeat\n- append stronger detailed reminder at 5th and 8th repeats showing tool name, repeat count, and canonical args\n- update shell welcome tip to promote Kimi Code download link
@jackfish212
jackfish212 force-pushed the feat/tool-dedup-sparse-reminders branch from e2bc3f5 to fde829c Compare May 26, 2026 10:50
@sailist
sailist added this pull request to the merge queue May 26, 2026
Merged via the queue into MoonshotAI:main with commit 4a27e76 May 26, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants