Skip to content

Conversation

@bobrowadam
Copy link
Contributor

  • I added a entry in changelog under unreleased section.

Summary

  • Optimize large shell output: When shell command output exceeds a configurable threshold (default: 1000 chars), write to a cache file (~/.cache/eca/{workspace-hash}/shell-output/) instead of returning inline. Reduces LLM context bloat for commands like find, git log, etc.
  • Auto-allow reading cache files: Shell output cache files don't require additional read approval since the original command was already approved.

Details

  • New config option: toolCall.shellCommand.outputFileThreshold (default: 1000)
  • Response includes file path, size, exit code, and last 20 lines for context
  • Graceful fallback to inline output if file write fails
  • Works for both success (exit 0) and error (non-zero exit) cases

- Auto-allow reading shell output cache files without approval

Shell output cache files (~/.cache/eca/*/shell-output/*) are auto-allowed
for reading without requiring additional user approval, since the original
shell command was already approved.
@bobrowadam bobrowadam force-pushed the optimize-large-shell-output branch from b1fc834 to b18b402 Compare January 20, 2026 21:12
The shell-output-cache-dir-test was checking for ".cache/eca" with
forward slashes, but Windows uses backslashes in paths. Normalize
to forward slashes for cross-platform compatibility.

🤖 Generated with [eca](https://eca.dev)

Co-Authored-By: eca <noreply@eca.dev>
input (assoc :in input)))))

(defn ^:private shell-command [arguments {:keys [db tool-call-id call-state-fn state-transition-fn]}]
(defn ^:private workspaces-hash
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we duplicating this function if it exists in eca.cache/workspaces-hash?

key (.encodeToString encoder digest)]
(subs key 0 (min 8 (count key)))))

(defn ^:private shell-output-cache-dir
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this functoin is better to live in eca.cache along with the workspace-cache-file

Copy link
Member

@ericdallo ericdallo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bobrowadam thank you for the help, but I wish we could discuss this better in a issue before a PR, I believe @zikajk has some concerns about this approach

@bobrowadam
Copy link
Contributor Author

@bobrowadam thank you for the help, but I wish we could discuss this better in a issue before a PR, I believe @zikajk has some concerns about this approach

@ericdallo sure no problem. I'll be happy to be part of a discussion regarding optimizing token usage this way or another.

@bobrowadam
Copy link
Contributor Author

closing this PR for now

@bobrowadam bobrowadam closed this Jan 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants