Skip to content

feat: cluster 3 delivery ledger (block-level dedup + get_workflow slimming)#223

Merged
m2ux merged 5 commits into
mainfrom
feat/189-cluster3-delivery-ledger
Jul 13, 2026
Merged

feat: cluster 3 delivery ledger (block-level dedup + get_workflow slimming)#223
m2ux merged 5 commits into
mainfrom
feat/189-cluster3-delivery-ledger

Conversation

@m2ux

@m2ux m2ux commented Jul 12, 2026

Copy link
Copy Markdown
Owner

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 merged rules block 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

  • Delivery ledger — A dedupTechniqueBlocks helper replaces already-delivered contract and rules blocks of a projected technique with unchanged-markers, content-keyed in the technique: channel; the new key namespaces are documented in the delivery module.
  • get_technique — Block dedup applies on the full-delivery branch under persistent mode; the whole-technique marker path and the full: true escape are unchanged.
  • get_activity — Block dedup applies to each eagerly-inlined step technique before it is bundled.
  • get_workflow (C12) — The orchestrator ops bundle is brought into the ledger under a single content-keyed workflow_bundle key and collapses to a marker on resume in persistent mode.
  • Tests — The reference-delivery suite covers block-marker emission, cross-technique dedup, the full-content escape, fresh-mode invariance, and C12; 30/30 passing.
  • Docs — Block-level delivery and get_workflow notes added to the API reference and the get_technique / get_activity tool descriptions.

🤖 AI Assistance

  • Assistant / Model: claude / claude-opus-4-8
  • Context scope: repo-only
  • Prompt classes: code-generation, test-writing, docs
  • Provenance log: 08-provenance-log.md

📌 Submission Checklist

  • Changes are backward-compatible (or flagged if breaking)
  • Pull request description explains why the change is needed
  • Self-reviewed the diff
  • I have included a change file, or skipped for this reason: workflow-server repo does not use per-change files
  • If the changes introduce a new feature, I have bumped the node minor version: N/A — fork-strategy (node) item; workflow-server version unchanged at 0.1.0
  • Update documentation (if relevant)
  • No new todos introduced

🔱 Fork Strategy

  • Node Runtime Update
  • Node Client Update
  • Other
  • N/A

🗹 TODO before merging

  • Ready for review

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 m2ux self-assigned this Jul 12, 2026
m2ux and others added 3 commits July 13, 2026 09:28
… 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>
@m2ux m2ux marked this pull request as ready for review July 13, 2026 10:35
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>
@m2ux m2ux merged commit d2e84b6 into main Jul 13, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant