ack/context-kernel

Less noise in your agent's context.

ACK sits between you and any terminal AI agent. It folds tracebacks, build walls and log floods down to the lines that matter, and keeps every original byte one command away.

pip install git+https://github.com/Vaibhavtripathi7/context_kernel
Read the source on GitHub
ack run
ack run -- python examples/demo_agent.py
[agent] Reproducing the failing checkout test...
[agent] Running: pytest tests/test_checkout.py -x
tests/test_checkout.py::test_charge_declined FAILED
[ACK] Compressed 86 lines → 4 lines (recall: ack #1)
── Traceback ──
at /app/src/views/checkout.py:201 in post
at /app/src/models/cart.py:88 in checkout
↳ KeyError: 'card_token'
[agent] Test failed. Reading the compressed traceback above.
 
ack recall 1 | head -n 3
Traceback (most recent call last):
File "/app/src/views/checkout.py", line 201, in post
order = cart.checkout(user_id=user.pk, payment=payload)

86 lines in, 4 lines to the agent. The full traceback stays in a local archive, byte for byte.

Why fewer tokens help

One failing test can print a 60-frame traceback. A broken Rust build repeats the same error[E0308] for every crate. The model only needs the exception and two frames, but it pays for all of it, and the wall of text shifts the prompt cache so the next turn is recomputed from scratch.

ACK trims that output before it reaches the model. The pruning is structural and deterministic. There is no second LLM and nothing to pay for.

SuiteTokens removedErrors kept
Python tracebacks93%100%
Rust and GCC builds91%100%
Log floods99%100%
Mixed, realistic sessions80%100%

Every exception class, error code and file:line survives. The benchmark runs in CI on every push.

What happens to each chunk of output

Your agent runs inside a real pseudo-terminal, so colors, prompts and cursor movement behave exactly as before. Every flushed chunk goes through the same four steps.

  1. Short output passes through.Anything under 30 lines reaches the agent untouched.
  2. Prompts are never pruned.If the output ends in [Y/n] or Continue?, the agent is waiting on you, so you always see it.
  3. Long output is summarized.Tracebacks keep the exception and the deepest user frames. Build errors are grouped by code. Floods become a frequency table.
  4. The original is stored.Every byte goes to a local SQLite archive with full-text search. The summary is a view, never a deletion.

Anything pruned can be read back

Each summary carries a handle like ack #42. Recall is a plain shell command, so when the summary isn't enough, you or the agent itself can pull the exact original back, by handle or by content.

ack recall 42              # the full log behind that banner
ack recall "card_token"    # or find it by what it contained
ack search "ImportError OR ModuleNotFoundError"   # every session, ranked

Get started

ACK needs Python 3.10 or newer on macOS or Linux (on Windows, use WSL). Put ack run -- in front of the agent you already use.

pip install git+https://github.com/Vaibhavtripathi7/context_kernel

ack run -- claude
ack run -- aider --model gpt-4o

ack run -- python examples/crashing_agent.py   # try it without an agent

Where it's going

ACK treats the context window as a scarce resource to be managed. Pruning is the first of three layers.

  • L1Output reduction. Collapse tracebacks, build walls and floods before they reach the model. Shipped.
  • L2Memory paging. Stable handles and recall, so compression is never a one-way loss. In progress.
  • L3Execution offload. Run well-specified deterministic tasks outside the model and hand back only the result. Exploring.