on main help sign in
fix: reduce token usage, use short tool descriptions by default (#2679)

* Follow-up of #2592 We've been testing this for 2 weeks, and it's working great. This is a very useful enhancement to reduce token usage, cost, and make smaller models behave better. This is particularly significant for local models. These models are tiny, and with a long enough system prompt they have little context window left for work. It's still possible to have the old behavior by setting: export CRUSH_SHORT_TOOL_DESCRIPTIONS=0

commitda3388385da340dcd94a2c73491e3152e8e4cacf authorAndrey Nering <andreynering@users.noreply.github.com> dateWed 22 Apr 2026, 10:33 (6 months ago) parent4d7c55e
1 file changed+3−3
internal/agent/tools/tools.go+3−3
internal/agent/tools/tools.go+3−3
@@ -60,11 +60,11 @@ func GetModelNameFromContext(ctx context.Context) string {
6060}
6161
6262// FirstLineDescription returns just the first non-empty line from the embedded
63−// markdown description when CRUSH_SHORT_TOOL_DESCRIPTIONS is set, significantly
64−// reducing token usage. Otherwise returns the full description.
63+// markdown description. The full description can be used by setting
64+// CRUSH_SHORT_TOOL_DESCRIPTIONS=0.
6565func FirstLineDescription(content []byte) string {
6666 if !testing.Testing() {
67− if v, _ := strconv.ParseBool(os.Getenv("CRUSH_SHORT_TOOL_DESCRIPTIONS")); !v {
67+ if v, err := strconv.ParseBool(os.Getenv("CRUSH_SHORT_TOOL_DESCRIPTIONS")); err == nil && !v {
6868 return strings.TrimSpace(string(content))
6969 }
7070 }