Skip to content

fix: prune agent command output via Claude Code's shell prefix - #3

Merged
Vaibhavtripathi7 merged 17 commits into
mainfrom
fix/ack-exec
Sep 29, 2026
Merged

Vaibhavtripathi7 merged 17 commits into
mainfrom
fix/ack-exec

Conversation

@Vaibhavtripathi7

Copy link
Copy Markdown
Owner

Overview

ACK used to wrap the agent's terminal. Agents like Claude Code run commands in their own subprocesses, so the model never saw the pruned output. This PR moves ACK onto that path: every Bash command Claude runs now goes through ACK, and the model gets the summary plus a recall handle.

Changes

  • ack exec runs a command, streams its output through the existing pruners and archives the full log. Output is sent after a short pause or every five seconds, so dev servers stay visible.
  • ack hook install / ack hook uninstall set ACK as Claude Code's shell prefix through a small shim. The prefix runs after Claude's permission checks, so allow rules, aliases and cd keep working.
  • Fails safe. Exit codes pass through unchanged, and if ACK can't start, the shim runs the command directly.
  • Recall works for the model. Banners print a command it can run as is, and searches stay in the current Claude session.
  • Sandbox support. When the home directory is read only, the archive moves to $TMPDIR and the banner points there.
  • Fixes found while testing:
    • lost SQLite writes when commands run in parallel
    • lines after a traceback being dropped
    • files that only mention a traceback being rewritten
    • a 500ms startup cost from loading the TUI on every run
  • README now explains where ACK plugs in, and what ack run does and doesn't do.

Impact

  • The README's main claim holds again: with the hook installed, Claude reads the pruned output, not the raw wall.
  • ack run is unchanged, apart from a banner that no longer says a failed archive write succeeded.
  • About 150ms added per command.

Testing

  • 190 tests (up from 107). Ruff and mypy strict are clean. The benchmark is unchanged: 95% compression, 100% signature fidelity.
  • Live run on Claude Code with only python3 and ack recall allowed: the model saw a 3 line summary, ran ack recall from the banner on its own, and got the exact traceback line back.
  • Same run in Claude's sandbox mode: recall read from the fallback archive.
  • Not checked yet: interactive Claude sessions, zsh, macOS.

@Vaibhavtripathi7
Vaibhavtripathi7 merged commit 3db3824 into main Sep 29, 2026
4 checks passed
@Vaibhavtripathi7
Vaibhavtripathi7 deleted the fix/ack-exec branch September 29, 2026 11:18
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.

1 participant