[infra] agentic tool-use and token-efficiency guidance - #504
Draft
pq wants to merge 3 commits into
Draft
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request adds configuration files for AI coding assistants, including custom rules in .agents/AGENTS.md, ignore patterns in .geminiignore and .claudeignore, and updates to .gitignore for IDE, Gradle, and Dart/Flutter files. Feedback was provided on .claudeignore because simply listing .geminiignore inside it does not inherit the ignore patterns; the patterns should be copied directly to prevent token bloat.
pq
marked this pull request as draft
June 30, 2026 20:06
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Using the estimate-conversation-tokens tool I've been noodling on, Gemini did some analysis and came up with some opportunities for improvement. The analysis is below but the TL;DR is with a little guidance we might enjoy something like a 60% to 80% reduction in total token consumption per session and get better results generally by making sure we're leveraging "smarter" tools such as the Dart MCP Server.
See: #503 .
📊 Agentic Token Efficiency & Savings Analysis
To make agentic programming in this repository as cost-effective and responsive as possible, we have analyzed the token overhead in our development sessions using the estimate-conversation-tokens tool.
The Context Overhead Problem (Our Baseline)
In a typical long-running session (spanning ~395 model invocations), the total token footprint can exceed 27 Million tokens (without caching).
Estimated Savings from Proposed Optimizations
view_filewithStartLine/EndLine(~200 tokens)./gradlew buildorflutter analyzeto check types (~20,000 tokens of logs)analyze_files/lspMCP tools (~500 tokens of clean JSON)researchsubagent and returning a concise summaryExpected Impact
By implementing strict
ignore_patterns(to filter build cache and IDE garbage files), enforcing line limits on file reads, and prioritizing language-server MCP tools over subprocess runs, we project a 60% to 80% reduction in total token consumption per session, while keeping the agent's context window highly stable.Contribution guidelines:
dart format.