morph/morph-compactor or a custom compactor you define in models.json or an extension—and places its response inside a <compacted-context> block.
Your full conversation still stays verbatim in session history, and the boundary includes the same history recovery instructions as memory compaction so the agent can pull back anything the compactor omitted.
Quick start: use built-in Morph
1
Authenticate Morph
Run
/login morph inside Atomic, or export MORPH_API_KEY in your shell.2
Select the compaction model
Open
/settings, select Compaction model, and pick morph/morph-compactor. The change applies immediately with no /reload or restart.How custom compactors work
WhencompactionModel names a registered compactor model, Atomic frames the current context window (previous compacted text first, followed by role-labelled user messages, assistant text, tool calls with arguments, tool results, shell commands with exit codes, and extension messages) and sends one HTTP POST request to that model’s endpoint:
- No forced request defaults. Atomic sends
{ messages, query, model }plus any optional keys you put incompactionParams. WhencompactionParamsis omitted, Atomic adds no provider-specific fields so the remote API applies its own defaults. - No built-in output size limit. Whatever the endpoint returns is kept as-is, however long it is. To ask the endpoint for shorter output, set its own parameter in
compactionParams(for Morph,compression_ratio). To reject long output locally, setmaxTokenson the compactor model: output exceeding that token estimate falls back to memory compaction.maxTokenshas no default. - Oversized output does not loop. If a compactor returns output that remains above the automatic threshold, nothing is rejected and Atomic does not re-compact before every tool call of the same turn. The next user turn compacts again before its first request. If the provider reports a context overflow, Atomic compacts and retries once; if the retry still overflows, the provider’s error is shown.
- Content filtering and redaction. Images become omission markers, thinking blocks are omitted, role headers are wrapped in
<keepContext>tags, and messages excluded from model context (such as!!shell commands and display-only extension messages) are not sent. If an endpoint echoes your API key or a sensitive auth header, Atomic replaces it with[redacted]before storing or displaying the output.
Select a compaction model
Open/settings and choose Compaction model to switch between Automatic (memory compaction) and any registered compactor model immediately, without /reload or restarting.
Both built-in morph/morph-compactor and custom remote compactors defined in ~/.atomic/agent/models.json or an extension appear in this searchable picker automatically (authenticated models first; unauthenticated ones show requires /login <provider>). The selector updates project settings when a project override already exists, and global settings otherwise.
You can also set compactionModel directly in ~/.atomic/agent/settings.json or a trusted project’s .atomic/settings.json:
"auto"(lowercase) or""selects memory compaction.- A registered compactor ID must match
provider/modelcase-sensitively (leading and trailing whitespace is trimmed). - Compactor models never appear in
/modeland never run as chat models. ChangingcompactionModeldoes not affect branch summaries.
compactionModel to "auto". Compactor IDs and unknown IDs remain untouched; an unknown ID falls back to memory compaction with a notice.
For programmatic per-run overrides, live SDK/RPC switching, and registering compactors from extensions, see Compaction reference, Compaction and tree navigation, and Custom providers.
Configure Morph or add a custom compactor
Keepsettings.json free of endpoint knobs and configure API-specific parameters directly on the compactor model in ~/.atomic/agent/models.json (see Remote compaction models).
Override built-in Morph parameters
Add a custom remote compactor
type: "compactor"registers the model as a compactor so it appears in/settingsunder Compaction model instead of/model.apiis required on the provider or model for custom compactors (built-in Morph defines"api": "morph-compact"). Overriding an existing compactor undermodelOverridesinherits its provider’sapiandbaseUrl.compactionParamsmerges arbitrary API-specific keys into the JSON request body alongside{ messages, query, model }. Omit it to let the remote API apply its own server defaults.endpointPathappends tobaseUrland defaults to"/compact". Set"endpointPath": ""toPOSTdirectly tobaseUrl.timeoutMsoverrides the default 120-second request timeout.maxTokenssets an optional estimated-token cap on the compactor’s response (no default; longer output falls back to memory compaction).headerssupports$ENV,${ENV}, and!commandfor custom auth headers (such as"X-API-Key": "$MY_KEY"). Sensitive auth headers are redacted automatically from errors and compacted output.
Automatic fallback to memory compaction
Every compactor failure falls back automatically to Automatic (memory compaction) so a broken, unauthenticated, or slow remote endpoint never blocks a session. Atomic does not retry the remote request. If the endpoint reports that your quota is exhausted, the SDK also marks that failure as not retryable; wait for the quota to reset or replenish it before trying remote compaction again. No settings change is needed for fallback:Compaction model not used (<reason>); context cleared instead) without exposing your API key or sensitive headers. Pressing Escape while a compactor request is in flight also falls back to memory compaction with reason request aborted. Taking over with /compact, closing the session, or an extension cancelling compaction stops compaction completely.
Troubleshooting network and DNS errors
If Atomic cannot reach the compactor’s server, the fallback notice names the underlying connection failure while falling back to memory compaction so your session keeps moving.Host name cannot be resolved (ENOTFOUND)
Host name cannot be resolved (ENOTFOUND)
baseUrl.Blocked by a DNS filter (0.0.0.0 or ::)
Blocked by a DNS filter (0.0.0.0 or ::)
A DNS filter such as NextDNS, Pi-hole, or AdGuard can block the compactor by resolving its domain to Add that domain to your DNS filter’s allowlist. Until then, compaction continues working through memory compaction.
0.0.0.0 or ::. When the host resolves only to those addresses, Atomic names the domain to allow: