feat: cluster 3 delivery ledger (block-level dedup + get_workflow slimming)#223
Merged
Conversation
Seed the feature branch for issue #189 (cluster 3 — block-level delivery ledger + get_workflow slimming). Implementation follows. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
m2ux
added a commit
that referenced
this pull request
Jul 12, 2026
… slimming Extend the reference-not-repeat delivery mechanism to a finer granularity (#189, cluster 3), additive and with no schema change. C2 - block-level delivery ledger. Add a pure dedupTechniqueBlocks helper (and the DEDUP_BLOCKS constant) to delivery.ts, operating on projectTechnique's projected ordered record. On a not-yet-seen technique in persistent mode, each shared contract/rules block (inherited_inputs, inherited_outputs, rules) whose per-block content hash was already delivered by a sibling technique collapses to the canonical unchanged-marker at its position, while the technique-specific core stays full. Block keys are content-keyed (technique:<block>:<hash>), so an annotated block variant hashes differently and correctly delivers full. Wired into the full-delivery branch of get_technique and the eager step-technique bundling of get_activity; projectTechnique itself is untouched (avoids its CRITICAL blast radius). C12 - get_workflow ops-bundle slimming. Under persistent mode, collapse the orchestrator ops bundle to a single content-keyed workflow_bundle:<hash> marker on a resume where the agent already holds it; the ops bundle is now built and hashed before the session advances so the ledger key commits in the same advanceSession mutator. The post-separator workflow summary stays full. Fresh/default sessions pay nothing. Extend tests/reference-delivery.test.ts with cross-technique block dedup, the full/bundle:full escape, fresh-mode non-markering, ledger-key, and C12 cases. Refresh delivery.ts header, docs/api-reference.md, and the get_technique/get_activity tool descriptions + bundle_note. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Mike Clay <mike.clay@shielded.io>
Lean-coding audit (#189, cluster 3). The get_technique full-delivery branch already computes ordered = projectTechnique(technique) for block dedup, then called projectTechniqueToYaml(technique) for text -- which re-runs projectTechnique internally. Reuse the already-projected record: text = stringifyForResponse(ordered), byte-identical output, one fewer projection pass. Drop the now-unused projectTechniqueToYaml import from this file. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Mike Clay <mike.clay@shielded.io>
…ck-dedup test Post-implementation review corrections for the cluster 3 delivery ledger: - Trim get_technique / get_activity tool descriptions, the get_activity bundle_note, and the get_workflow ops-bundle marker note. Behavioral contract preserved (block-dedup semantics, unchanged-marker, full/reference); only padding and repetition removed. - Remove planning-reference/cluster-tag narration from source comments, replacing with concise plain-English comments where needed. Refresh one now-stale comment (resource inlining) for consistency with the docs. - Condense the dedupTechniqueBlocks docstring to a conventional what/params/return form. - Add a reference-delivery test covering the get_activity eager-bundle path of dedupTechniqueBlocks (the prior C2 tests only exercised get_technique): a persistent-mode get_activity collapses a sibling bundled step's shared contract/rules block to a marker while its core stays full. - Regenerate site/api/tools.html (build:site) to track the trimmed descriptions. typecheck + build clean; reference-delivery 30/30; site + all non-baseline suites green (only the pre-existing workflows-pointer binding-fidelity baseline failure remains, unrelated to this change). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Mike Clay <mike.clay@shielded.io>
m2ux
added a commit
that referenced
this pull request
Jul 13, 2026
Commit the work-package planning artifacts (design, plan, reviews, validation, strategic review, comprehension) and record the DCO attestation in the provenance log for PR #223. Sets WP status to submitted-for-review. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Mike Clay <mike.clay@shielded.io>
Strip cluster tags (C2, C12), issue-number annotations (#189), and cluster-labeled test fixture slugs from the block-level delivery-ledger tests, leaving plain-English descriptions of the behavior under test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Mike Clay <mike.clay@shielded.io>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extend the persistent-mode delivery ledger to two finer granularities — block-level dedup inside technique payloads (C2) and the orchestrator ops bundle in
get_workflow(C12) — removing roughly 25% of repeated technique-delivery volume in long-running single-agent sessions.🐛 Issue 📐 Engineering
Motivation
In persistent-mode sessions the server re-delivers the shared workflow-contract blocks (
inherited_inputs,inherited_outputs) and the mergedrulesblock on every technique fetch. They are identical across most techniques of a workflow, but the whole-payload hash always differs on the technique-specific core, so the existing whole-payload dedup never matches — roughly 25% of technique-delivery volume is needless repetition. Separately, the orchestrator ops bundle sits outside the delivery ledger entirely and is re-paid in full on every session resume. Neither is a correctness defect, but both erode the agent's working context and inflate token cost in long sessions.Changes
dedupTechniqueBlockshelper replaces already-delivered contract and rules blocks of a projected technique with unchanged-markers, content-keyed in thetechnique:channel; the new key namespaces are documented in the delivery module.full: trueescape are unchanged.workflow_bundlekey and collapses to a marker on resume in persistent mode.get_workflownotes added to the API reference and theget_technique/get_activitytool descriptions.🤖 AI Assistance
📌 Submission Checklist
🔱 Fork Strategy
🗹 TODO before merging