Docs / Commands
Get folded output back
Updated
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:
The hash is 12 hex characters. Your agent reads the banner and can call expand-ref itself; you can too.
expand-ref
Alias: xref.
| Flag | Effect |
|---|---|
--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, -i | Fold case on both sides of --grep |
--raw, --full | The bytes, verbatim, in bounded pages |
--from-line N | With --raw: resume from line N |
--budget N | With --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.
19990:19990
19991:19991
19992:19992
[tokenade:expand-ref] 3 matching line(s) of 20000 held under this hash
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
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
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.
tokenade disclose read <hash>
tokenade disclose search <hash> <query>
| Subcommand | Effect |
|---|---|
stash | Reads 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.
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
| Item | Value |
|---|---|
| Directory | ~/.cache/tokenade/stash/ on Linux (the platform cache directory elsewhere); override with TOKENADE_STASH_DIR |
| Stash threshold | About 5,000 tokens for command output (TOKENADE_DISCLOSE_THRESHOLD), 25,000 for file reads |
| Size cap | 2 GiB in total, oldest evicted first (TOKENADE_STASH_MAX_DIR_BYTES) |
| Lifetime | 7 days since last use |
Everything in the stash has already been through secret redaction. Details in output compaction and the stash.