Navin

Cost

Lower AI agent cost: shell output compaction in Navin

August 8, 2026 · 3 min read · Navin team

How git, test, docker and Kubernetes output inflate context - and how Navin compacts it before the model, with no external tool.

intro handled in meta - body only

Every time a coding agent runs git status, pytest, docker compose, or kubectl get pods, the model receives the full output. Those logs are often long and repetitive, and only a fraction helps decide the next step. Context fills up, latency rises, and the bill follows.

Navin automatically compacts that output before it enters the model context. No external proxy, no extra binary: compaction is built into the local exec tool.

Where an agent's tokens come from

An agent request is not limited to your message. Each turn usually includes:

  1. system instructions and project rules;
  2. tool schemas;
  3. session history;
  4. the latest shell command output.

The first three blocks often repeat across turns and benefit from prompt caching when available. The fourth changes on every command. A verbose npm install or kubectl describe therefore hits both cost and context window directly.

That is why a debug session can consume millions of tokens across a few dozen requests, even when your instructions stay short.

What compaction does

Compaction does not hide errors. It keeps useful signal and drops noise:

  • progress bars and ANSI sequences;
  • secondary columns in docker ps or kubectl get;
  • low-value events in a describe;
  • long green test blocks when only failures matter;
  • Git progress that does not change the next decision.

Navin classifies the command family (git, tests, Kubernetes, installs…), applies a matching filter, then exposes a shorter version to the model. When shrinkage is meaningful, the full log remains under .navin/tool-results/exec/.

Coverage

AreaExamplesWhat the model keeps
Gitstatus, diff, log, pushDirty files, useful status
Testspytest, jest, cargo/go test, playwrightFailures and summary
Pythonruff, mypy, pip, uvFindings or install summary
JS / buildeslint, tsc, next, npm installErrors first
Containersdocker, podmanEssential columns, deduped logs
Kuberneteskubectl, oc, helmCompact tables, quieter describe
Infraterraform, make, gradleErrors and summary
Networkcurl, ghShort bodies or tables

Wrappers such as bash -lc '…' are resolved so the real command is classified.

Behavior in the workbench

SituationEffect
Synchronous commandCompaction after the process exits
Background commandCompaction when the process completes
Terminal while runningLive output unchanged

You keep a readable terminal; the model receives the compacted result once the command finishes. Product docs: Command output compaction.

Cost impact

Session typeTypical effect
Light chat, little shellSmall
Heavy git, tests, dockerOften material on the tool-output share
Debug with large logs or KubernetesStronger on that same share

Compaction does not remove the system prompt, tool schemas, or history. It acts on the most volatile part: command output. For Free quotas versus subscription budgets, see free models and plans.

Alongside other Navin levers

LeverRole
exec compactionCuts shell tool noise
Prompt cachingReuses the stable prefix (system, tools)
Plan / MissionFewer exploratory turns
Project BrainLess re-reading the repo on resume

HTTP response caching (identical response bodies) is a poor fit for agents: every turn has a different body.

FAQ

Are important errors preserved?

Yes. Filters prioritize failures, findings, and useful status. The raw log stays on disk when compaction applies.

Do I need to enable an option?

No. It is the default exec behavior in Navin.

Are Kubernetes and Docker covered?

Yes, including kubectl, oc, helm, and common docker/podman commands (ps, logs, compose).

Does it replace prompt caching?

No. Caching covers the stable prefix; compaction covers variable outputs.

How do I recover the full output?

From the file referenced in the [compacted…] note under .navin/tool-results/exec/.

Next steps

  1. Download Navin.
  2. Open a project in the Code module.
  3. Let the agent run git, tests, or docker: compaction applies automatically.

Download Navin · Features · Documentation

Try Navin on your machine

Local agent, cross-platform. Code, debug, scrape, leads, security and review - without leaving Navin.

Related reading