#3652·headroom

[BUG] Columnar command output (ls -la, git status) classifies as PLAIN_TEXT and loses fields to Kompress — Bash missing from DEFAULT_EXCLUDE_TOOLS

Author: chopratejasCreated Sep 18, 2026Updated Sep 25, 2026
Labelsbug

Summary

Two compounding gaps let columnar command output (ls -la, git status, docker ps, ...) reach the prose word-dropping compressor on default config:

  1. Bash is not in DEFAULT_EXCLUDE_TOOLS (headroom/config.py:221-266) — every other raw-output tool (Read, Glob, Grep, view, read_file, ...) is excluded from lossy compression by name; Bash isn't, even though its output is exactly the same category of "bytes the agent will act on verbatim."
  2. Fixed-width columnar rows classify as PLAIN_TEXT (headroom/transforms/content_detector.py), not as structured/tabular content, so they route to the same word-dropping compressor as prose — the mechanism #3580/#3590 identified for grep. #3599 (merged) fixed the grep -A/-B/-C dash-context shape specifically; it did not touch ls -la / git status style output, which carries no line-number prefix at all.

This is #3590 with the wrong root-cause framing corrected, plus the residual reach of #3580 that #3599 didn't cover. Filing separately since #3580 is closed by #3599 and shouldn't be reopened for a different input shape.

Reproduce

Stock ContentRouterConfig(), no flags:

python
from headroom.transforms.content_router import ContentRouter, ContentRouterConfig
from headroom.transforms.content_detector import detect_content_type
import random
random.seed(1)

rows = [f"-rw-r--r--  1 tejas staff {random.randint(1000,99999)} Sep {d} 09:{d:02d} file_{d}.py" for d in range(1, 60)]
payload = "total 480\n" + "\n".join(rows)

print(detect_content_type(payload))          # PLAIN_TEXT, confidence=0.5
out = ContentRouter(ContentRouterConfig()).compress(payload).compressed

Observed on main:

  • input: 60 lines
  • output: 2 lines (every newline dropped; all rows joined with spaces)
  • all 59 filenames survive, but the owner field is dropped from 17 of 59 rows — a row that reads -rw-r--r-- 1 staff 39848 ... file_59.py with no username is indistinguishable from a row that never had one
  • trailer: [533 words compressed to 482 (from 60 source lines). Retrieve more: hash=...]

git status output (On branch main\nChanges not staged for commit:\n\tmodified: ... × 30) also classifies PLAIN_TEXT under the same call.

Why this matters

The marker at the end names a word count and a line count, but not which lines lost which fields, and every surviving row keeps its original position — so an agent parsing git status/ls -la for a subsequent command (git add <the 12 modified files>, rm <files over 50KB>) is working from data with unmarked, un-locatable holes. This is the same "the marker is present but doesn't disclose the event" class as #3580/#3545/#3590, on inputs that don't carry line numbers at all, so the retrieval-by-hash escape hatch is the only recovery path and the agent has no signal it needs it.

Suggested fix

Either half closes most of the reach on its own; both together is more robust:

  1. Add Bash/bash (and any other raw-shell-exec tool name) to DEFAULT_EXCLUDE_TOOLS, mirroring the existing entries for Read/view/read_file.
  2. Extend content detection to recognize fixed-width columnar/tabular text (repeated-whitespace-delimited rows with a consistent column count) as a distinct type routed to a lossless or tabular-aware compressor instead of the prose path — the same shift #3599 made for the line-numbered grep shape, generalized to inputs without line-number prefixes.

Related

  • #3580 / #3545 (closed by #3599) — same underlying mechanism, different input shape (line-numbered grep context vs. columnar command output).
  • #3590 — reported this exact symptom (ls -la fusion) but framed it as a min-token-floor problem; the min-token floor is a mitigation, not the cause, and remains a live gap since Bash is still unlisted after #3599.

Source: headroomlabs-ai/headroom