on main help sign in
chore(tools): gate short descs with CRUSH_SHORT_TOOL_DESCRIPTIONS
commita02ce4a98b6af7ff4f75491d838c901f4a3916a4 authorChristian Rocha <christian@rocha.is> dateThu 9 Apr 2026, 12:53 (6 months ago) parent2e8767d
1 file changed+8−5
internal/agent/tools/tools.go+8−5
internal/agent/tools/tools.go+8−5
@@ -2,6 +2,7 @@ package tools
22
33import (
44 "context"
5+ "os"
56 "strings"
67)
78
@@ -56,12 +57,14 @@ func GetModelNameFromContext(ctx context.Context) string {
5657 return getContextValue(ctx, ModelNameContextKey, "")
5758}
5859
59−// FirstLineDescription returns the first non-empty line from the embedded
60−// markdown description. This extracts just the concise summary line,
61−// significantly reducing token usage while preserving essential tool context.
60+// FirstLineDescription returns just the first non-empty line from the embedded
61+// markdown description when CRUSH_SHORT_TOOL_DESCRIPTIONS is set, significantly
62+// reducing token usage. Otherwise returns the full description.
6263func FirstLineDescription(content []byte) string {
63− lines := strings.SplitSeq(string(content), "\n")
64− for line := range lines {
64+ if os.Getenv("CRUSH_SHORT_TOOL_DESCRIPTIONS") == "" {
65+ return strings.TrimSpace(string(content))
66+ }
67+ for line := range strings.SplitSeq(string(content), "\n") {
6568 line = strings.TrimSpace(line)
6669 if line != "" {
6770 return line