Skip to content

feat(ce-work): reduce token usage by extracting late-sequence references#540

Merged
tmchow merged 2 commits intomainfrom
tmchow/ce-work-token-efficiency
Apr 9, 2026
Merged

feat(ce-work): reduce token usage by extracting late-sequence references#540
tmchow merged 2 commits intomainfrom
tmchow/ce-work-token-efficiency

Conversation

@tmchow
Copy link
Copy Markdown
Collaborator

@tmchow tmchow commented Apr 9, 2026

Summary

Extract Phase 3-4 shipping content from ce:work and ce:work-beta SKILL.md files into on-demand references/shipping-workflow.md files. This late-sequence content (quality check, code review, PR creation, quality checklist, code review tiers) rode in context for the entire Phase 2 execution loop — 20-60+ tool calls — without being used until the very end. Follows the same extraction pattern established by ce:plan (PR #489) and ce:brainstorm.

Token savings

Skill Before After Reduction
ce:work 445 lines (~6,500 tokens) 316 lines (~4,600 tokens) ~29%
ce:work-beta 518 lines (~7,600 tokens) 389 lines (~5,700 tokens) ~25%

Per-session savings: ~2,200 tokens x ~32 messages before shipping content is needed = ~70,400 context tokens per session for each skill.

What changed

  • New reference files: plugins/compound-engineering/skills/ce-work/references/shipping-workflow.md and the identical file under ce-work-beta/references/. Each contains Phase 3 (quality check, code review, final validation, operational validation plan), Phase 4 (screenshots, commit/PR, plan status, notify), Quality Checklist, and Code Review Tiers.
  • SKILL.md stubs: Both SKILL.md files replace Phase 3-4 with a 2-line stub that instructs the agent to read the reference file when all Phase 2 tasks are complete.
  • Contract tests: Updated to use dual-read pattern — positive assertions read from reference files, negative assertions stay on SKILL.md to confirm extraction completeness. Two new stub pointer tests verify both SKILL.md files reference shipping-workflow.md and don't contain extracted content.

Key decisions

  • One reference file per extraction, not four: Phase 3, Phase 4, Quality Checklist, and Code Review Tiers are all used at the same workflow stage (after Phase 2 completes). Bundling into one file matches ce:brainstorm's approach.
  • Independent files for stable and beta: Per AGENTS.md skill self-containment rules, each skill directory owns its references. The files are currently identical; beta's sits alongside its existing codex-delegation-workflow.md.
  • Key Principles and Common Pitfalls stay inline: Small (~40 lines combined) and provide behavioral guardrails throughout execution.

Test plan

  • bun test — 636 pass, 0 fail
  • Contract tests verify extracted content is in reference files and absent from SKILL.md
  • New stub pointer tests confirm both SKILL.md files reference the shipping-workflow file
  • Reference files are byte-identical between stable and beta
  • Manual: run ce:work on a plan and verify shipping-workflow.md loads at Phase 3 transition (not prematurely during Phase 2)

Post-Deploy Monitoring & Validation

No additional operational monitoring required — this is a content restructuring within plugin skill files with no runtime or infrastructure impact.


Compound Engineering
Claude Code

tmchow and others added 2 commits April 9, 2026 12:41
Extract Phase 3-4 shipping content (quality check, code review, PR
creation, quality checklist, code review tiers) from ce:work and
ce:work-beta SKILL.md into on-demand references/shipping-workflow.md
files. This content rode in context for the entire Phase 2 execution
loop without being used until the very end.

Both skills get identical reference files. Contract tests updated with
dual-read pattern: positive assertions read from reference files,
negative assertions stay on SKILL.md to confirm extraction completeness.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move "Update Plan Status" (active -> completed) before "Commit and
Create Pull Request" so the status change is included in the commit
rather than leaving a dirty working tree after the PR is created.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@tmchow tmchow merged commit bb59547 into main Apr 9, 2026
2 checks passed
@github-actions github-actions Bot mentioned this pull request Apr 9, 2026
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