feat(ce-plan): reduce token usage by extracting conditional references (#489)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Trevin Chow
2026-04-02 01:55:53 -07:00
committed by GitHub
parent bbd4f6de56
commit fd562a0d02
6 changed files with 378 additions and 348 deletions

View File

@@ -118,10 +118,11 @@ describe("ce:plan testing contract", () => {
describe("ce:plan review contract", () => {
test("requires document review after confidence check", async () => {
const content = await readRepoFile("plugins/compound-engineering/skills/ce-plan/SKILL.md")
// Document review instructions extracted to references/plan-handoff.md
const content = await readRepoFile("plugins/compound-engineering/skills/ce-plan/references/plan-handoff.md")
// Phase 5.3.8 runs document-review before final checks (5.3.9)
expect(content).toContain("##### 5.3.8 Document Review")
expect(content).toContain("## 5.3.8 Document Review")
expect(content).toContain("`document-review` skill")
// Document review must come before final checks so auto-applied edits are validated
@@ -130,16 +131,24 @@ describe("ce:plan review contract", () => {
expect(docReviewIdx).toBeLessThan(finalChecksIdx)
})
test("uses headless mode in pipeline context", async () => {
test("SKILL.md stub points to plan-handoff reference", async () => {
const content = await readRepoFile("plugins/compound-engineering/skills/ce-plan/SKILL.md")
// Stub references the handoff file and marks document review as mandatory
expect(content).toContain("`references/plan-handoff.md`")
expect(content).toContain("Document review is mandatory")
})
test("uses headless mode in pipeline context", async () => {
const content = await readRepoFile("plugins/compound-engineering/skills/ce-plan/references/plan-handoff.md")
// Pipeline mode runs document-review headlessly, not skipping it
expect(content).toContain("document-review` with `mode:headless`")
expect(content).not.toContain("skip document-review and return control")
})
test("handoff options recommend ce:work after review", async () => {
const content = await readRepoFile("plugins/compound-engineering/skills/ce-plan/SKILL.md")
const content = await readRepoFile("plugins/compound-engineering/skills/ce-plan/references/plan-handoff.md")
// ce:work is recommended (review already happened)
expect(content).toContain("**Start `/ce:work`** - Begin implementing this plan in the current environment (recommended)")