Docs / Commands

Get folded output back

Updated

TL;DR — Copy the 12-character hash from the fold banner and run `tokenade expand-ref <hash> --prompt "q1, q2"` or `--grep <pattern>`. `--raw` returns the bytes in bounded pages. Stashes older than 7 days can be evicted.

When Tokenade folds a large output, the complete original goes to a local stash and the banner prints a hash. tokenade expand-ref <hash> is how you get what you need from it: ask it questions, grep it, or page through the exact bytes. Nothing is re-run.

Where the hash comes from

Every fold ends with a banner like this one:

[tokenade:find 443263 tokens folded away; the stash holds the COMPLETE output — this blob is ~444645 tokens — too large to dump whole. recover with `tokenade expand-ref 6f961168e46c` · `--prompt "q1, q2"` to ask (RAG, several at once) · `--grep <pat>` exact lines. Any other hash above covers only what was shown.]

The hash is 12 hex characters. Your agent reads the banner and can call expand-ref itself; you can too.

expand-ref

tokenade expand-ref <hash> [--prompt "q1, q2"] [--grep <pat>…] [--raw]

Alias: xref.

FlagEffect
--prompt "q1, q2"Ask several questions in one call and get only the passages that answer. The cheapest option in tokens. Also --question, -q
--grep <pat>Exact matching lines, repeatable. The pattern is a regex matched per line. Prints N matching line(s) of M total so a narrow match never looks like the whole output
--ignore-case, -iFold case on both sides of --grep
--raw, --fullThe bytes, verbatim, in bounded pages
--from-line NWith --raw: resume from line N
--budget NWith --raw: move the ceiling to N tokens; --budget 0 removes it

Reach for --prompt or --grep first. --raw puts the stored bytes back in context, which is what the fold existed to avoid, so it stops at a budget and tells you exactly how to continue.

$ tokenade expand-ref f6351f5ead9a --grep '^1999[0-2]$'
19990:19990
19991:19991
19992:19992
[tokenade:expand-ref] 3 matching line(s) of 20000 held under this hash
$ tokenade expand-ref f6351f5ead9a --raw
1
2
…
12399
[tokenade: lines 1-12399 of 20000 (~59997 tokens). 7601 line(s) left — continue with `tokenade expand-ref f6351f5ead9a --raw --from-line 12400`, narrow with `--grep <pattern>`, or take the rest in one go with `--budget 0`.]

Unknown or expired hash

$ tokenade expand-ref 000000000000 --grep x
expand-ref: hash '000000000000' not found in dedup cache or stash
…
the bytes are gone, so there is no second way back to THEM: re-run the command that printed this hash (`tokenade raw <cmd>` re-runs it uncompacted)

Exit code 1. Stashes unused for 7 days are evicted (see maintenance), and the stash directory is capped at 2 GiB, oldest first. After that, re-run the command.

expand-fold

tokenade expand-fold <id>

Alias: xfold. Some folds shorten a run of repetitive log lines and print an id for it in the banner. expand-fold brings that one run back as its raw lines.

disclose: stash anything yourself

disclose applies the same stash-and-ask pattern to any output you pipe in.

<cmd> | tokenade disclose stash [--source web|shell|mcp|graphql]
tokenade disclose read <hash>
tokenade disclose search <hash> <query>
SubcommandEffect
stashReads stdin. Below the size threshold it passes the input through unchanged and stashes nothing. Above it, writes the blob to the stash and prints a folded preview plus a banner with the file, an estimated token count and the hash
read <hash>Returns the stashed bytes
search <hash> <query>Returns only the passages that match

--source tells the reader what produced the blob; omit it and the content is sniffed.

$ seq 1 30000 | tokenade disclose stash --source shell
1
…
30000
[stashed: ~/.cache/tokenade/stash/5bc81dbc42fe.txt · ~129290 tokens · folded summary (omits middle lines) · recover with `tokenade expand-ref 5bc81dbc42fe` · …]

An unknown hash says so and exits 1 instead of returning nothing with exit 0.

Where the stash lives

ItemValue
Directory~/.cache/tokenade/stash/ on Linux (the platform cache directory elsewhere); override with TOKENADE_STASH_DIR
Stash thresholdAbout 5,000 tokens for command output (TOKENADE_DISCLOSE_THRESHOLD), 25,000 for file reads
Size cap2 GiB in total, oldest evicted first (TOKENADE_STASH_MAX_DIR_BYTES)
Lifetime7 days since last use

Everything in the stash has already been through secret redaction. Details in output compaction and the stash.