chore(context): strip ANSI codes from tool results sent to the LLM#236
Merged
LeeCheneler merged 1 commit intomainfrom Mar 29, 2026
Merged
Conversation
… LLM Tool results with heavy ANSI coloring (e.g. biome/tsc pre-commit output) can inflate token usage by 5-6x, enough to exceed the context window in a single message. Strip ANSI from tool result content before adding to API-bound messages while preserving colored output in the terminal. Closes #234
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.
Summary
This PR adds a utility function to strip ANSI escape codes from tool results before they are sent to the LLM, ensuring that the LLM receives clean text without formatting codes.
GitHub Issue
Closes #234
What Changed
Notes for Reviewers
Usage: biome COMMAND ...
Available options:
-h, --help Prints help information
-V, --version Prints version information
Available commands:
version Shows the Biome version information and quit.
rage Prints information for debugging.
start Starts the Biome daemon server process.
stop Stops the Biome daemon server process.
check Runs formatter, linter and import sorting to the requested files.
lint Run various checks on a set of files.
format Run the formatter on a set of files.
ci Command to use in CI environments. Runs formatter, linter and import sorting to
the requested files.
init Bootstraps a new biome project. Creates a configuration file with some defaults.
lsp-proxy Acts as a server for the Language Server Protocol over stdin/stdout.
migrate Updates the configuration when there are breaking changes.
search EXPERIMENTAL: Searches for Grit patterns across a project.
explain Shows documentation of various aspects of the CLI.
clean Cleans the logs emitted by the daemon.) do not interfere with the LLM's processing.