DSH familySearch GitHub

hook / EffectTS

ets-hook-dsh-ccr

Compresses oversized tool output, caches it, and retrieves it on demand

0.2.1 hook EffectTS

Facts

Package
@playform/ets-hook-dsh-ccr
Version
0.2.1
Kind
hook
Release
EffectTS
Licence
CC0-1.0
Directory
EffectTS/packages/ets-hook-dsh-ccr

What it does

Compresses oversized tool output, caches it, and retrieves it on demand.

Read the full description in the README.

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.

session 7c41e0a2 | deepseek-v4.1-flash | max | 3 turns | 9 steps | 40 records | simulated

*emit~waterfall=serial>parallel

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.

Turn 1Read the specimens14 records | 3 steps

Step 12 calls, 265 chars

Step 24 calls, 313 chars

Step 33 calls, 153 chars

Turn 2Write the run13 records | 3 steps

Step 43 calls, 174 chars

Step 52 calls, 258 chars

Step 62 calls, 115 chars

Turn 3Repair the run13 records | 3 steps

Step 72 calls, 143 chars

Step 83 calls, 184 chars

Step 92 calls, 123 chars

The turn

The same 3 calls on every plugin page, so a reader who moves between plugins stays in the same frame.

The 3 calls every plugin page shares, in sequence order
SeqCallOutcome
20bash ls -laok
21write src/index.tsok
22read src/index.tsok

Change

The one line that differs with this package installed, transcribed from its source by the dissection.

  1. Model the full make output, 5231 bytes
  2. 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

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.

  1. 01
    1. seam tools/post-execute on the result
    why

    The dispatch arrives after the tool ran and before the model reads anything.

  2. 02
    branch 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.

  3. 03
    the 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.

  4. 04
    the 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.

  5. 05
    the 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.

  6. 06
    the 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.

  7. 07
    branch 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.

  8. 08
    the stored bytes are returned, whole or by line range
  9. 09
    store ~/.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.

The surfaces ets-hook-dsh-ccr registers
KindNameWhat
listenertools/post-execute (prepend)the compression gate: replace oversized results with a preview + <<<CCR:...>>> marker
listeneragent/pre-step (with contextEngine)the engine phase: archives oversized stored results between turns
toolccr_retrieverestores stored output by exact hash, optionally a { start, count } line range
configSCHEME.mdthe full Schemastery schema (see the table below)

Install

The package as the profile adds it.

Install sh
pnpm add @playform/ets-hook-dsh-ccr

Configuration

Every knob this plugin documents, with its default.

Configuration of ets-hook-dsh-ccr
FieldTypeDefaultMeaning
logbooleantruevolatile - the shared factory log switch
logFilestring~/.dsh/playform/hook-dsh-ccr.logvolatile - the ledger file
targetsarraybash, glob, grep, read, web_fetch, web_search, list, searchthe tools whose results the gate compresses
exemptarraywrite, edit, raw-write, subagent, ask_user_question, ccr_retrievenever compressed
thresholdBytesnumber1024volatile - the base size threshold
inlineThresholdBytesnumber1024results under this stay inline untouched
autoExpandbooleantruestore but return FULL while the content is cheap enough
autoExpandLimitBytesnumber102400the auto-expand ceiling
compressFailuresbooleanfalseoff, error results pass through
multipliersobjectterminal 1, error 8, grep 2, paths 2, file 1, json 1, web 2, default 1volatile - the per-type threshold multipliers
previewMaxCharsnumber240volatile - the preview length cap
ttlSecondsnumber3600the store TTL
storeBudgetBytesnumber268435456the LRU budget (256 MiB)
journalPathstring""memory-only unless a JSONL journal path is set
contextEnginebooleanfalsethe engine phase stays inert
contextEngineThresholdPctnumber30the engine's budget-percentage trigger
protectFirstTurnsnumber2turns the engine never archives at the front
protectLastTurnsnumber4turns 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.

The family's answers at tools/post-execute, in the order the behavior map lists them
AnswerEffectPosition
hook-dsh-ccrrewriteits twin
hook-dsh-comment-filterrewriteneighbour
hook-dsh-convention-suggesteradviseneighbour
hook-dsh-doc-suggesteradviseneighbour
hook-dsh-edit-suggesteradviseneighbour
hook-dsh-graph-suggesteradviseneighbour
hook-dsh-replay-suggesteradviseneighbour
hook-dsh-search-suggesteradviseneighbour
hook-dsh-test-suggesteradviseneighbour
hook-dsh-tool-coachadviseneighbour

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 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.

Dependencies of ets-hook-dsh-ccr
PackageRole
@playform/ets-base-dshfamily
@playform/ets-lib-dsh-corefamily
@playform/ets-plugin-dsh-factoryfamily

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.

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

The entries the store holds at one insert, oldest access first, with the eviction each one meets
HashTypeSizeLast accessStoredState
3c8f5a1d9e2b7046f3c8f5a1web24 MiB70 min70 minexpired
b41c9e7a2d5f8031c6a9e4d2terminal96 MiB42 min42 minvictim
6f0a2c8e1b4d7935a2c8e0f6grep64 MiB2 min50 minlive
d9e2a7c4f10b8365e2a7c4f1file120 MiBnownowfresh

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.

The four answers ccr_retrieve can return
CallThe store answersThe model receivesThe 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), unknownNo 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), expiredThe 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.

Open the package source

Origin

The files this page was built from, and what each one supplies.

The files this page was read from 5
The files behind https://github.com/PlayForm/DeepSeek/tree/Current/EffectTS/packages/ets-hook-dsh-ccr
FileContributedState
package.jsonThe name, the version, the private flag, and the dependencies.read
README.mdThe summary, the surface table, and the configuration table.read
CHANGELOG.mdThe release lines and their versions.read
cordis.patch.ymlActivation: the bundle entry that mounts the plugin.read
Source/Function/Apply.tsThe 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.