Token optimization: scope glossary-maintainer toolsets and pre-fetch git history#25228
Draft
Token optimization: scope glossary-maintainer toolsets and pre-fetch git history#25228
Conversation
…p, add constraints Agent-Logs-Url: https://github.com/github/gh-aw/sessions/a1c03712-96c0-4e67-995f-d798bab63ca6 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Optimize token usage for glossary maintainer
Token optimization: scope glossary-maintainer toolsets and pre-fetch git history
Apr 8, 2026
pelikhan
reviewed
Apr 8, 2026
| echo "Scan scope: $SCOPE (since: $SINCE)" | ||
|
|
||
| # Fetch recent commits (all files) — includes file names for context | ||
| git log --since="$SINCE" --oneline --name-only \ |
Collaborator
There was a problem hiding this comment.
@copilot use the checkout feature to get a non-sparse checkout of the repo
Contributor
Author
There was a problem hiding this comment.
Added checkout: fetch-depth: 0 to the frontmatter in 4e0511b. This configures a full (non-sparse) checkout with complete git history, ensuring git log --since='24 hours ago' and --since='7 days ago' in the pre-step can see all commits rather than just the shallow single-commit default.
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/7e07c897-b13b-4cc1-814a-056d0edf7521 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
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.
The Glossary Maintainer was consuming 3.8M tokens/run, with
search_repositoriesaccounting for 342 of 588 total tool calls (58%) — a global GitHub search tool that's irrelevant to a local glossary update task.issue_readadded another 232 unnecessary calls.Changes
[default]→[repos, pull_requests], eliminatingsearch_repositoriesfrom the available tool surfaceissues: readpermission: glossary maintenance has no need for issue datacheckout: fetch-depth: 0sogit log --sincein the pre-step can traverse the full commit history rather than the default shallow clonegit logbefore the agent starts, writing commit history and doc-touching commits to/tmp/gh-aw/agent/files the agent reads directly — eliminates ~45 data-gathering API turns## Constraintssection to the prompt: explicit hard limits onsearch_repositories, issue reading, commit/PR counts, and repository scope