Expand description
Amp (ampcode.com): one JSON document per thread at
~/.local/share/amp/threads/<T-…>.json.
The native Body is Amp’s thread document — the same shape the
local-first CLI wrote to disk and amp threads export emits today:
{v, id, created, title, env, messages, …}. Only messages is typed (as
raw JSON values); every other top-level key rides in extra, so the
document round-trips without loss across schema eras (the legacy
local-first files and the modern server-side export differ in bookkeeping
keys like meta, protocolMessageID, and readAt, and in tool names —
legacy Bash{cmd,cwd} vs modern shell_command{command,workdir} — all of
which this codec accepts).
Amp already follows the Anthropic convention: assistant messages carry
tool_use blocks and the user messages that follow carry tool_result
blocks, so messages map 1:1 onto Common. Turn attribution lives on the
assistant message itself (usage.model, usage.timestamp, state).
Current Amp CLI versions are server-authoritative: they neither read nor
write the local threads/ directory (verified by bisection — a thread
file placed there is invisible to amp threads list/export). The store
therefore targets the legacy local-first location, which era-matched CLI
versions (@sourcegraph/amp ≤ early 2026) read and resume natively.
Bisecting against such a version: created is the one top-level field
its parser requires (from_common always writes it); v, agentMode,
nextMessageId, and env are optional but observed-shaped.
Known representational losses through Common (the native body keeps
them; they do not survive from_common):
run.progress,run.trackFiles, and per-run~debugon tool results;cancelled/rejected-by-userresult statuses collapse tois_error: truetext results.- Message bookkeeping:
userState,fileMentions,interrupted,originalToolUseInput,turnElapsedMs,readAt,protocolMessageID, andusage.credits. - An assistant with no stop reason renders as
end_turn(Amp requires astate);StopReason::Abortedmaps tostate: {type: "cancelled"}. sourcePathon image blocks andsignature-less thinking providers.- Shared-thread-era kinds never observed locally (
role: "parent"messages,manual_bash_invocationblocks) pass through the native body unmodeled and carry nothing intoCommon.
Structs§
- Amp
- The Amp harness marker.
- AmpStore
- Reads and writes Amp threads as JSON documents in a flat directory
(default
~/.local/share/amp/threads). - Thread
- Amp’s thread document.
messagesholds each message as raw JSON — the codec interprets them, serde stays lossless — and every other top-level key (v,id,created,title,env,agentMode,~debug, …) passes throughextrauntouched.