Skip to content

feat(deslop): improve agent prompts and token efficiency - #117

Merged
avifenesh merged 4 commits into
mainfrom
feature/deslop-agent-improvements
Jan 22, 2026
Merged

feat(deslop): improve agent prompts and token efficiency#117
avifenesh merged 4 commits into
mainfrom
feature/deslop-agent-improvements

Conversation

@avifenesh

Copy link
Copy Markdown
Collaborator

Summary

Improve deslop command and agents based on QA review findings:

  • Convert pseudo-JavaScript to explicit tool instructions - deslop-work.md now uses explicit Bash/Read/Grep/Edit tool calls instead of pseudo-code that agents couldn't execute
  • Add compact format for token efficiency - New formatCompactPrompt() achieves ~60% token reduction via table format
  • Sync documentation with pattern library - deslop-around.md now references canonical slop-patterns.js instead of duplicating patterns
  • Clarify three deslop modes - Mode A (diff), Mode B (path-based), Mode C (codebase) clearly documented as user choice

Changes

File Change
plugins/next-task/agents/deslop-work.md Complete rewrite - explicit tool instructions
lib/patterns/pipeline.js Added formatCompactPrompt() function
plugins/deslop-around/commands/deslop-around.md Mode docs + pattern library reference
__tests__/pipeline.test.js Comprehensive tests for compact format
All plugin lib/ dirs Synced pipeline.js

Test Plan

  • All tests pass (npm test exit code 0)
  • formatCompactPrompt tests cover: table format, certainty counts, truncation, auto-fix summary
  • Token reduction verified: 59% reduction (528 → 217 chars for sample findings)
  • Review orchestrator approved (0 critical/high issues remaining)
  • Delivery validator approved

Related Issues

Closes QA findings from #107 review

- Rewrite deslop-work.md with explicit tool instructions instead of
  pseudo-JavaScript that agents can't execute
- Add compact format option to formatHandoffPrompt() for ~60% token reduction
- Document three deslop modes (diff, path-based, codebase)
- Update deslop-around.md to reference pattern library instead of
  duplicating pattern definitions (reduces documentation drift)

Changes:
- deslop-work.md: Mode A (diff) scope clarified, explicit tool calls
- pipeline.js: Added formatCompactPrompt() with table format
- deslop-around.md: Mode selection docs, pattern lib reference
- Test table structure formatting
- Test certainty counts in header (H:x|M:y|L:z)
- Test abbreviated certainty levels (H, M, L)
- Test dash for non-fixable patterns
- Test truncation with maxFindings limit
- Test auto-fixable summary
- Test empty findings handling
- Test mode in header (report/apply)
- Test compact option in formatHandoffPrompt
- Replace `git add -A` with specific file staging to avoid accidentally
  staging sensitive files
- Clarify Edit tool usage for line removal with concrete example showing
  newline handling
Copilot AI review requested due to automatic review settings January 22, 2026 12:40
@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello @avifenesh, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the deslop command and its associated agents by addressing several QA review findings. The primary goals were to make the agents more robust and efficient by converting abstract instructions into concrete tool calls, optimizing token usage for prompt generation, and improving the clarity and consistency of documentation regarding slop detection and operational modes.

Highlights

  • Improved Agent Prompts: The deslop-work.md agent has been significantly refactored to use explicit Bash, Read, Grep, and Edit tool instructions, replacing previous pseudo-JavaScript. This makes the agent's actions clearer and more directly executable.
  • Token Efficiency: A new formatCompactPrompt() function has been introduced, achieving approximately a 60% reduction in token usage for prompt generation by presenting findings in a concise table format. This is integrated into formatHandoffPrompt via a new compact option.
  • Documentation Sync and Clarity: The deslop-around.md documentation now references the canonical slop-patterns.js for AI slop definitions, avoiding duplication. It also clearly documents the three deslop modes (diff, path-based, codebase) for user choice.
  • Language-Aware Tool Detection: The pipeline now detects project languages and intelligently filters relevant CLI tools, improving the accuracy and efficiency of deep analysis.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces several great improvements for the deslop command and agents. The new compact prompt format is a smart way to improve token efficiency, and the comprehensive tests for it are well-written. The refactoring of agent prompts to use explicit tool instructions and syncing documentation with the pattern library are excellent changes for maintainability and clarity. The logic for language-aware tool detection is also a solid enhancement. I have one suggestion to improve the efficiency of the new formatCompactPrompt function by reducing the number of iterations over the findings array.

Comment thread lib/patterns/pipeline.js Outdated
@github-actions

Copy link
Copy Markdown

Missing CHANGELOG.md Update

This PR introduces significant user-facing changes but doesn't include a CHANGELOG.md update, which violates the project's documented standards.

CLAUDE.md Requirement:

Update CHANGELOG.md with every PR

Source: CLAUDE.md line 103

Changes in this PR that should be documented:

  • Addition of formatCompactPrompt() function (~60% token reduction)
  • Complete rewrite of deslop-work.md agent with explicit tool instructions
  • Documentation updates in deslop-around.md
  • Language detection and CLI tool recommendations

Suggested CHANGELOG.md entry:

## [Unreleased]

### Added
- `formatCompactPrompt()` function for ~60% token reduction in deslop findings (#117)

### Changed
- Rewrote `deslop-work.md` agent to use explicit tool instructions instead of pseudo-code (#117)
- Updated `deslop-around.md` documentation to reference canonical pattern library (#117)
- Added language detection for language-aware CLI tool recommendations (#117)

### Fixed
- Agent prompt clarity issues identified in QA review (#107)

Use reduce instead of multiple filter calls for better performance
when processing large finding sets.

Addresses Gemini code review feedback on PR #117.
@avifenesh

Copy link
Copy Markdown
Collaborator Author

Addressed @gemini-code-assist feedback: refactored formatCompactPrompt to use a single reduce pass instead of 4 separate filter calls. Commit b0f350b.

@gemini-code-assist

Copy link
Copy Markdown

Thanks, @avifenesh! I appreciate you addressing the feedback and refactoring formatCompactPrompt for improved efficiency. Using a single reduce pass is a great way to optimize the token usage further. Keep up the excellent work!

Copilot AI 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.

Pull request overview

This PR improves the deslop tooling with token efficiency optimizations and clearer agent instructions. The changes enhance the slop detection pipeline with a compact reporting format and refactor agent documentation to use explicit, executable tool instructions rather than pseudo-code.

Changes:

  • Added formatCompactPrompt() function achieving ~60% token reduction via table format for large finding sets
  • Rewrote deslop-work.md agent to use explicit Bash/Read/Grep/Edit tool calls instead of non-executable JavaScript examples
  • Enhanced language detection to recommend only relevant CLI tools based on detected project languages
  • Clarified three deslop modes: Mode A (diff-based via deslop-work), Mode B (path-based via deslop-around), Mode C (codebase-wide via deslop-around)

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
lib/patterns/pipeline.js Added formatCompactPrompt function and updated formatHandoffPrompt signature with options parameter
plugins/*/lib/patterns/pipeline.js Synced formatCompactPrompt across all plugin copies; added language-aware tool detection
plugins/next-task/agents/deslop-work.md Complete rewrite with explicit tool instructions, removed pseudo-JavaScript code
plugins/deslop-around/commands/deslop-around.md Added mode documentation and reference to canonical pattern library
__tests__/pipeline.test.js Comprehensive test coverage for compact format including edge cases

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@avifenesh
avifenesh merged commit b0f350b into main Jan 22, 2026
6 checks passed
@avifenesh
avifenesh deleted the feature/deslop-agent-improvements branch January 22, 2026 16:09
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.

2 participants