feat(lfg): add compounding workflow and bring the skill to parity#879
feat(lfg): add compounding workflow and bring the skill to parity#879kieranklaassen wants to merge 6 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 46b93a0b09
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (!planPath) { | ||
| log('Plan phase produced no plan file — aborting before work (mirrors the /lfg plan gate).') | ||
| return { error: 'no-plan', research: researchBrief, direction, worktree: worktreePath } |
There was a problem hiding this comment.
Clean up worktrees on abort paths
If the workflow has already created an isolated worktree and this gate aborts, the direct return bypasses the Cleanup phase, so the sibling worktree (and its branch) is left behind. The same pattern exists for the Doc Review fatal and no-changes gates; users who hit these normal failure paths have to manually discover and remove the stale worktree/branch. Route aborts through shared cleanup/finally logic before returning.
Useful? React with 👍 / 👎.
A 13-phase re-imagining of the linear /lfg skill as a deterministic
multi-agent Workflow: Riffrec intake, parallel institutional recall,
judge-panel shaping, plan + adversarial stress-test, build, dedup +
adversarially-verified review, fix + re-review, simplify, verify,
always-on dogfood, ship, CI-monitor-until-green, and gated compound-out.
Includes a dryRun mode (args { dryRun: true } or a [dry-run] marker) that
stops before Ship/CI/Compound for safe testing.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Each phase now reads as the CE step/skill it runs (Riffrec, Research, Ideate, Plan, Doc Review, Work, Code Review, Autofix, Re-review, Simplify, Test, Dogfood, Commit & PR, Compound). Splits the plan stress-test out as its own Doc Review phase. Orchestration unchanged — relabel only. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
A dry-run test still opened a real PR because args arrived as a
JSON-encoded string ('{"task":...,"dryRun":true}'), landed in the
string branch, and dryRun was never read. Normalize args: if it's a
string that parses to an object, use the parsed object. Also document
that a non-dry run does real git ops on the live checkout.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Adds a Worktree phase that creates lfg/<slug> in a sibling worktree, and a Cleanup phase that removes it (keeping the branch/PR on real runs, dropping the throwaway branch on dry runs). Every mutating phase from Plan onward is told to operate inside the worktree; Riffrec/Research/Ideate stay in the main checkout (read-only, and Riffrec must search the user's real ~/Downloads). Compound now commits+pushes its learning doc to the branch so worktree cleanup doesn't discard it. Fixes the test-surfaced problem where the Commit & PR phase switched the user's live branch mid-run. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Bring the linear /lfg skill and the lfg workflow to parity and extend both: - Add a Dogfood step to the skill, inlining ce-dogfood-beta's diff-scoped behavior (it is disable-model-invocation and can't be invoked from the pipeline), mirroring the workflow's Dogfood phase. - Accept a Riffrec bundle, video, audio, or screenshots as input and analyze it before planning, on both surfaces. - Reproduce bugs locally with synthetic, anonymized state before writing the fix. - Capture demos non-interactively via ce-demo-reel for observable changes, and emit a fixed PR template for feedback-sourced runs. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… anchors The lfg workflow reimplements review inline with its own severity (blocker/high/medium/low) and confidence (low/medium/high) scales, forking from the canonical ce-code-review model that the ce-* persona reviewers it dispatches natively emit. Map both to P0-P3 and the 0/25/50/75/100 confidence anchors so the workflow speaks the plugin's review vocabulary and the personas aren't forced through a lossy remap. Vocabulary only: dedup, severity-gated autofix, and the report-then-apply architecture are unchanged.
46b93a0 to
999f526
Compare
|
Heads up @kieranklaassen — I rebased this branch onto current Why the rebase was needed (not just a courtesy): One follow-up commit — Deliberately not changed: since the workflow runs its own review, Verification on the rebased + reconciled branch: rebase applied with zero conflicts; full |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 999f526bdd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| compound = await agent( | ||
| wt + | ||
| `Invoke the ce-compound skill with mode:headless to capture the durable learning from this task into docs/solutions/. Focus on what was NON-OBVIOUS: the approach chosen and why, any gotcha hit during work, review, simplify, test, dogfood, or CI, and how it connects to the learnings surfaced in research. ${NON_INTERACTIVE}\n\n` + | ||
| (worktreeBranch ? `IMPORTANT: after ce-compound writes the doc, commit it (\`docs(compound): capture learning\`) and push to ${worktreeBranch} so it lands on the PR — otherwise Cleanup will discard it.\n\n` : '') + |
There was a problem hiding this comment.
Re-watch CI after pushing compound docs
When worthCompounding is true on a real run, this instruction commits and pushes a new docs/solutions/ change after the Commit & PR phase has already finished its CI monitor, so the PR head changes after the workflow decided whether CI was green. I checked the workflow ordering: the CI loop runs in Commit & PR before Compound, which means the returned ciGreen value can refer to the previous head while the latest pushed commit is still pending or failing; move Compound before the CI loop or rerun/watch CI after this push.
Useful? React with 👍 / 👎.
| `Commit, push, and open a pull request for this work. This repo requires a PR — NEVER push to main directly. Invoke the ce-commit-push-pr skill. ${NON_INTERACTIVE}\n\n` + | ||
| (worktreeBranch ? `You are already on branch ${worktreeBranch} in the worktree — commit ALL work to THIS branch, push it, and open the PR from it. Do NOT create another branch or switch branches.\n\n` : '') + | ||
| (observable | ||
| ? `This change has an observable surface (${surfaceList}) — also invoke the ce-demo-reel skill to capture visual/CLI proof and include its markdown in the PR body.\n\n` |
There was a problem hiding this comment.
Avoid invoking interactive demo capture here
For observable web/CLI/iOS changes, this background workflow delegates to ce-demo-reel, but I checked plugins/compound-engineering/skills/ce-demo-reel/SKILL.md and its tier-selection/upload flow requires asking the user and even says batch/background mode should wait for a reply. In those runs the supposedly non-interactive Commit & PR phase can block before CI; add a headless demo mode/default tier or inline a non-interactive capture path instead of invoking the interactive skill as-is.
Useful? React with 👍 / 👎.
Summary
/lfgwas linear and amnesiac: every run started from zero and ended teaching the next one nothing. This branch adds a compounding re-imagining as a multi-agent workflow (.claude/workflows/lfg.js) and brings the original linear skill up to the same capabilities, so both surfaces behave consistently.The workflow keeps lfg's end-to-end autonomy and adds the two halves that make it compound — institutional recall in, a durable learning out — runs in an isolated git worktree so it never touches your checkout, and fans out the phases the Workflow engine can parallelize.
What's new
The compounding workflow runs 16 named phases:
Worktree → Riffrec → Research → Ideate → Plan → Doc Review → Work → Code Review → Autofix → Re-review → Simplify → Test → Dogfood → Commit & PR → Compound → Cleanupce-compoundphase captures the non-obvious learning intodocs/solutions/(committed to the branch) so the next run's Research starts ahead.file:line, then adversarially verified by skeptics before any autofix; a re-review pass catches regressions the fixes themselves introduce.{ dryRun: true }stops before Commit & PR / CI / Compound.Skill parity — the linear
/lfgskill gained the capabilities it was missing:ce-demo-reel, plus a fixed PR template for feedback-sourced runs.Design decisions
disable-model-invocationskills are inlined, not invoked.ce-dogfood-beta(andce-test-xcode) can't be called from a model-driven pipeline, so their behavior is inlined into Dogfood/Test on both surfaces.dryRunis honored (a stringified object once opened a real PR during a dry run).Testing
bun test(frontmatter + shell-safety),bun run release:validate, and a wrapped-parse check of the workflow JS all pass. The LLM-behavior changes to the skill/workflow are not exercised bybun test— validate those via the skill-creator eval workflow or a fresh session, per the repo's plugin-caching rule.