Documentation menu
Compression settings
nid compresses large, repetitive text it hands to agents (board history, task details,
messages, review diffs, CI logs, handoff summaries) so less of each agent's context and usage
window goes to noise. Every compressed block names an id; the agent calls expand("<id>") for
the full text. This page covers how to turn the features on and off and where the savings show
up; compression describes the engine.
The compression setting#
One key, compression, at three levels. The most specific level wins per key:
- built-in defaults
compression:in~/(or.nid/ config .yaml $NID)_HOME/ config .yaml - the group:
compression:innid.yaml,nid group set,nid compression,/compressionin the terminal app, or the dashboard's Compression panel - one session:
compression:on a session innid.yaml, ornid spawn --compression on|off
compression: false is shorthand for { enabled: false }, compression: true for { enabled: true }.
| Key | Default | Meaning |
|---|---|---|
enabled | true | Compress nid's own traffic. Off turns the traffic sources (board … handoff) off too; proxy, terse, proxyTerse, memory and learnAfterDone are separate switches. |
board | true | board_read history and task details. |
messages | true | Teammate and nid messages, mid-turn notices. |
diffs | true | Review-gate diffs. |
ci | true | CI logs that pr checks turns into tasks. |
handoff | true | Rotation handoff summaries. |
minTokens | 300 | Content shorter than this is never compressed. The board is the exception: its compact and incremental views apply at any size (see compression). |
ttlHours | 24 | How long originals stay available to expand. Originals referenced from a task (review diffs, CI logs) are kept at least 30 days; all of a group's originals are deleted when the group is removed. |
proxy | off | Experimental local proxy for agent API traffic (on / off; YAML true / false also work). Routing is decided when an agent starts: turning it off stops compressing a running agent's requests right away, but the agent keeps sending them through the proxy until it restarts. |
terse | false | Ask agents for terse output in nid's system prompt; see terse output. |
proxyTerse | false | With the proxy on: append a fixed terseness note to the end of each proxied request's system prompt. |
memory | true | New sessions receive the project memory in their first message. |
learnAfterDone | false | Run nid learn when a group finishes. |
memory and learnAfterDone are group features: they are read from the group and
~/, and a session's value for them is ignored.
# nid.yaml
groups:
app:
goal: Ship the importer
compression:
diffs: false # reviewers see full diffs
minTokens: 500
sessions:
- agent: claude
name: lead
- agent: codex
compression: false # this session's nid traffic is not compressed
# ~/.nid/config.yaml
compression:
terse: true
ttlHours: 48
An invalid compression: in ~/ does not stop the daemon: nid uses the
defaults and reports the problem in nid doctor, nid compression and /compression.
Changing it#
- Terminal app:
/compressionshows the settings and savings;/,compression off /,compression diffs off /,compression minTokens 500 /(drop the group's override) change this team's setting.compression reset - CLI:
nid compression [group]shows the same report (--jsonfor the raw RPC result);nid compression <group> offornid compression <group> board offchanges it.nid group set <group> compression=falseandnid group set <group> 'compression={"diffs":false}'also work (they replace the whole value). - Dashboard: the Compression panel on a group page has a switch per key.
Terse output#
terse: true saves output tokens: agents write shorter status updates, summaries and messages.
nid appends this section to the end of the system prompt it gives every agent:
## Keep output short
This group asks for terse output to save tokens:
- No preamble or recap. Status updates and replies: at most 3 short lines.
- Do not restate tool output, file contents or diffs you just read; cite paths and line numbers instead.
- task_update summaries and board notes: what changed and how it was verified, at most 5 lines.
- Messages to teammates: one point per message, no pleasantries.
- Never shorten code, commands, error text or identifiers, and never skip verification to save words.
The system prompt is built when an agent process starts and does not change while it runs, so the
prompt cache stays valid. Turning terse on or off therefore applies to new agents and to
running ones when they next start (resume, restart or rotation), not mid-conversation. Because the
section is appended at the end, the rest of the prompt stays byte-identical. Agents that take the
prompt as part of their first message (ACP and PTY custom agents) get it there.
Where the savings show up#
Savings are counted per session and per source (board, messages, diffs, ci, handoff, ...) as tokens before and after compression, and kept in the nid database so they survive daemon restarts.
When an agent calls expand(id), it gets the original back and pays its tokens after all. nid
counts those calls separately (source expand: number of calls and tokens returned) and every
place below shows net savings: tokens saved by compression minus tokens returned by expand.
Net savings can be negative when agents expand most of what they receive; that is a sign a source
compresses too aggressively for the work and is worth turning off. Labels add , N expands when
there were any, and the dashboard badge turns yellow when the net is negative.
Legacy originals outside the tokenizer work limits
use an expansion estimate of ceil(UTF-16 code units / 4); those net figures can
over- or under-count. Expansion still returns every original byte unchanged.
nid ls: aSAVEDcolumn per session (net,12.3k 41%; yellow when negative;offwhen disabled).nid status: aSAVEDcolumn per group and in the total,proxywhen the proxy is on.nid doctor: acompressionline with the global setting, proxy state, tokenizer, the size of the originals store and tokens saved so far./compressionandnid compression: settings with where each value came from, savings per agent and per source, and agents whose proxy routing or proxy terse block still differs from the settings until they restart.- Dashboard: a badge per group (overview and group page), a saved line per session in the sessions table and on the session page, and the Compression panel.
Proxy savings (source proxy) are shown on their own row, labelled "per request, mostly cached
tokens": the proxy compresses the newest tool result in each request, and every later request in
the conversation re-sends that history, which the provider mostly serves from its prompt cache.
They are real per-request savings, but most of them are cache-read tokens, which cost far less
than uncached input, so do not add them to the other sources as if they were.
Programs can read the report with the compression RPC; see the
daemon API reference in packages/.