Add the session view to the trace page. Read the specimens first, then build the lane strip, the tree, the document, and the inspector from one authored run. The family's plugins must be visible on the records they touch, and the page must read the same run with the family off.
hook / Classic
hook-dsh-ccr
Compresses oversized tool output, caches it, and retrieves it on demand
Facts
- Package
- @playform/hook-dsh-ccr
- Version
- 0.2.1
- Kind
- hook
- Release
- Classic
- Licence
- CC0-1.0
- Directory
- Classic/packages/hook-dsh-ccr
What it does
Compresses oversized tool output, caches it, and retrieves it on demand.
Conversation
The turn as a document: the calls every plugin page shares, what this package changes in them, and the order its work happens in.
Conversational
Lane
The same run as time: one row per resource, a bar per span, and the clock every record shares. A wait is drawn as an outline, because nothing is busy.
Session
The tree, the document, and the inspector read one record list. The switch at the top of the document changes the face they read, and the run changes with it.
The turn
The same 3 calls on every plugin page, so a reader who moves between plugins stays in the same frame.
| Seq | Call | Outcome |
|---|---|---|
20 | bash ls -la | ok |
21 | write src/index.ts | ok |
22 | read src/index.ts | ok |
Change
The one line that differs with this package installed, transcribed from its source by the dissection.
- Model the full make output, 5231 bytes
- Transcript [terminal:exit 0 | 142 lines | make: *** Error 1] plus <<<CCR:9d3c1f0a|terminal|5231>>>
87 character changed, from 32 to 87.
- Property
- Bounded context
- Knob
- autoExpandLimitBytes, 102400 by default
- Seam
- tools/post-execute
Retrieve
The loop the marker opens: the result arrives, the gate replaces it, the model asks for the bytes by hash, and the store returns them exactly.
- The result arrives
5231 bytesthe tool wrote more than the ceiling - The gate replaces it
What the model reads text [terminal:exit 0 | 142 lines | make: *** Error 1] <<<CCR:9d3c1f0a7b2e4d5c6a8b9c0d|terminal|5231>>> - The model asks for the bytes ccr_retrieve
9d3c1f0a7b2e4d5c6a8b9c0dAn exact hash and an optional line range. No prefix, no fuzzy match: the marker is the address. - The store returns it
The body, byte-exact text make: Entering directory '/repo' go build ./... make: *** Error 1
Flow
The order this package's work happens in, with the branch that decides it inline, transcribed from the source; the rule it obeys is the last band of Architecture.
- 01
- seam tools/post-execute on the result
why
The dispatch arrives after the tool ran and before the model reads anything.
- 02branch the result is smaller than the ceiling
why
It returns by identity: no marker reaches the model while the content is cheap enough to keep inline.
- 03the type is classified and the bytes are serialized
why
One of eight types, and the size is the UTF-8 byte length of the serialized content, not the preview's.
- 04the preview line and the marker are composed
why
The preview names the type, the count, and the first location; the marker carries the hash, the type, and the size.
- 05the original is stored under its hash
why
An LRU store with a byte budget and a TTL: the oldest and the expired entries evict first.
- 06the model reads the preview, not the bytes
why
The result the model sees is the preview plus the marker; the original is one call away.
- 07branch ccr_retrieve is called with the hash
why
An exact match only: no prefix, no fuzzy. A miss returns an unknown-hash line, an expired entry a gone line.
- 08the stored bytes are returned, whole or by line range
- 09store ~/.dsh/hook-dsh-ccr.log
Harness
The laws the package states, the line it writes when it loads, the seam the harness dispatches with none of the family, and the surface and knobs a run can set.
Default
What the harness does at this package's seam with none of the family installed, so the surface below has something to be a difference from.
The harness dispatches tools/post-execute as a waterfall and already has listeners there: claude-code-mods, hooks-claude-code, hooks-codex, repeat-tool-reminder, spill-policy, tool-fs-search.
A waterfall listener receives the payload and may return a changed one, so the harness's own listeners can already change what the model reads. This package adds another listener to that list.
Surface
Every listener, tool, service, and knob the README documents.
| Kind | Name | What |
|---|---|---|
| listener | tools/post-execute (prepend) | the compression gate: replace oversized results with a preview + <<<CCR:...>>> marker |
| listener | agent/pre-step (with contextEngine) | the engine phase: archives oversized stored results between turns |
| tool | ccr_retrieve | restores stored output by exact hash, optionally a { start, count } line range |
| config | SCHEME.md | the full Schemastery schema (see the table below) |
Install
The package as the profile adds it.
pnpm add @playform/hook-dsh-ccrConfiguration
Every knob this plugin documents, with its default.
| Field | Type | Default | Meaning |
|---|---|---|---|
| log | boolean | true | volatile - the shared factory log switch |
| logFile | string | ~/.dsh/playform/hook-dsh-ccr.log | volatile - the ledger file |
| targets | array | bash, glob, grep, read, web_fetch, web_search, list, search | the tools whose results the gate compresses |
| exempt | array | write, edit, raw-write, subagent, ask_user_question, ccr_retrieve | never compressed |
| thresholdBytes | number | 1024 | volatile - the base size threshold |
| inlineThresholdBytes | number | 1024 | results under this stay inline untouched |
| autoExpand | boolean | true | store but return FULL while the content is cheap enough |
| autoExpandLimitBytes | number | 102400 | the auto-expand ceiling |
| compressFailures | boolean | false | off, error results pass through |
| multipliers | object | terminal 1, error 8, grep 2, paths 2, file 1, json 1, web 2, default 1 | volatile - the per-type threshold multipliers |
| previewMaxChars | number | 240 | volatile - the preview length cap |
| ttlSeconds | number | 3600 | the store TTL |
| storeBudgetBytes | number | 268435456 | the LRU budget (256 MiB) |
| journalPath | string | "" | memory-only unless a JSONL journal path is set |
| contextEngine | boolean | false | the engine phase stays inert |
| contextEngineThresholdPct | number | 30 | the engine's budget-percentage trigger |
| protectFirstTurns | number | 2 | turns the engine never archives at the front |
| protectLastTurns | number | 4 | turns the engine never archives at the back |
Family
The neighbours at the same seam, the arms beyond it, the twin in the other release tree, and the packages this one needs.
Neighbours
The behavior map lists 10 answers at tools/post-execute, in the order the family registers them.
| Answer | Effect | Position |
|---|---|---|
| hook-dsh-ccr | rewrite | this package |
| hook-dsh-comment-filter | rewrite | neighbour |
| hook-dsh-convention-suggester | advise | neighbour |
| hook-dsh-doc-suggester | advise | neighbour |
| hook-dsh-edit-suggester | advise | neighbour |
| hook-dsh-graph-suggester | advise | neighbour |
| hook-dsh-replay-suggester | advise | neighbour |
| hook-dsh-search-suggester | advise | neighbour |
| hook-dsh-test-suggester | advise | neighbour |
| hook-dsh-tool-coach | advise | neighbour |
Arms
The seams its source also registers, beyond the one its README documents.
- agent/pre-step
Twin
The same package in the other release tree, when one exists.
Its twin is ets-hook-dsh-ccr.
It registers the same listeners in the same order and composes the same ledger strings; the ledger file's name, which carries the package identity, and the factory base import are the only differences.
Dependencies
The packages this one imports, and whether each one is the family's own.
| Package | Role |
|---|---|
| family | |
| family |
Person
What the person waits for, reads, and never sees.
The person sees the text after the rewrite and not what it replaced, so the change stays invisible unless the source is read beside the result.
The gate reads the content, the tool name, and the failure flag, and returns one verdict; only the last two write the store, and the write happens before the verdict leaves.
- pass empty content, an exempt tool, a failure while compressFailures is off, a name outside targets, or a size at or under the threshold times the type's multiplier
- store over the gate, with auto-expand on and the size at or under its ceiling: the full content returns, the entry is retrievable, and no marker reaches the model
- replace over the gate and over the auto-expand ceiling: one preview line and one retrieval marker, while the original stays in the store
When Size is the UTF-8 byte length of the serialized content. The default configuration returns replace only above the auto-expand ceiling of 102400 bytes; at or under it the same result returns store, and at or under 1024 bytes times the type's multiplier it returns pass.
Architecture
This plugin's own structure: the shape the portrait gives it, the facts its source documents, and the rule its flow obeys.
Shape
Plugs into the tools/post-execute waterfall (prepended), the ccr_retrieve tool, and the agent/pre-step engine phase.
The gate on oversized tool output: whole, stored, or a marker the model can retrieve.
- Reads the result, the tool name, and the failure flag before any other listener sees them
- Returns pass, store, or replace, and writes the store only for the last two
- Replaces an oversized result with a one-line type-aware preview and a retrieval marker
- Answers ccr_retrieve by exact hash, or by a line range inside that hash
Its shape machine belongs to Person.
Detail
The address the gate writes, the store behind it, the four answers the retrieval returns, and the tools the gate never touches.
- <<<CCR: literal required
- The fixed prefix; the marker must occupy the whole trimmed line, byte for byte.
- hash 24 hex required
- The SHA-256 of the serialized bytes, truncated to 24 lowercase hex characters; matched exactly, with no prefix and no fuzzy match.
- | literal required
- The separator between the hash and the type.
- type type token required
- The classified type: terminal, error, grep, paths, file, json, web, default.
- | literal required
- The separator between the type and the size.
- size integer required
- The UTF-8 byte length of the serialized content, not the preview's; a ranged retrieval returns less than this.
- >>> literal required
- The fixed suffix; anything after it on the line refuses the parse.
- Budget
- 256 MiB
- TTL
- 60 min
- On the insert
- 304 MiB
- After the eviction
- 184 MiB
304 MiB on the insert 256 MiB budget
| Hash | Type | Size | Last access | Stored | State |
|---|---|---|---|---|---|
3c8f5a1d9e2b7046f3c8f5a1 | web | 24 MiB | 70 min | 70 min | expired |
b41c9e7a2d5f8031c6a9e4d2 | terminal | 96 MiB | 42 min | 42 min | victim |
6f0a2c8e1b4d7935a2c8e0f6 | grep | 64 MiB | 2 min | 50 min | live |
d9e2a7c4f10b8365e2a7c4f1 | file | 120 MiB | now | now | fresh |
The lines the insert writes
ccr: evicted 3c8f5a1d9e2b7046f3c8f5a1 (ttl)ccr: evicted b41c9e7a2d5f8031c6a9e4d2 (budget)The victim is the entry with the smallest lastAccessed, so the oldest read leaves first; the TTL counts from the store, not from the last read, so an entry expires on its own clock.
| Call | The store answers | The model receives | The ledger |
|---|---|---|---|
ccr_retrieve(hash) | The entry is found, and its clock is refreshed. | The original text: the text blocks newline-joined, byte for byte. | retrieved <hash> |
ccr_retrieve(hash, range) | The entry is found, and the range slices the joined text. | A 0-based line slice: start defaults to 0, count to the end, and both clamp. Asking past the end returns an empty slice, never an error. | retrieved <hash> |
ccr_retrieve(hash), unknown | No entry under that hash. | A self-describing error: the entry is gone, and the model should re-run the original tool. | retrieval miss <hash> (unknown) |
ccr_retrieve(hash), expired | The entry was at or past its ttlAt, so it was dropped. | The same error, with the TTL as the reason. | retrieval miss <hash> (expired) |
Record
The release line, the source, and the files this page was read from.
Release
The versions the package's own changelog records, newest first.
- 0.3.0
- 0.2.1
- 0.2.0
- 0.1.0
Source
The package as the repository holds it.
Origin
The files this page was built from, and what each one supplies.
The files this page was read from 5
| File | Contributed | State |
|---|---|---|
| package.json | The name, the version, the private flag, and the dependencies. | read |
| README.md | The summary, the surface table, and the configuration table. | read |
| CHANGELOG.md | The release lines and their versions. | read |
| cordis.patch.yml | Activation: the bundle entry that mounts the plugin. | read |
| Source/Function/Apply.ts | The listeners, their registration order, and the service the flow calls. | read |
- Data
- The monorepo, read during the build
- Connection
- Build-time read; nothing is fetched at runtime
- Capture
- package.json, README.md, CHANGELOG.md, Source/Function/Apply.ts
Expand provenance source
This page is static. It cannot invoke the plugin, read a ledger, or change a configuration. Every figure comes from those files; a missing README falls back to the manifest's own description, and a package with no surface table shows no surface section.