Skip to content

feat(lfg): add delegate flag and configurable MCP/agent providers#13

Closed
davidalee wants to merge 2 commits intomainfrom
feat/lfg-delegate-and-mcp-config
Closed

feat(lfg): add delegate flag and configurable MCP/agent providers#13
davidalee wants to merge 2 commits intomainfrom
feat/lfg-delegate-and-mcp-config

Conversation

@davidalee
Copy link
Copy Markdown
Owner

Summary

Adds delegation and configurable MCP/agent provider support to the lfg autonomous-pipeline skill so the user-level CLAUDE.md two-lane review pattern can fire from the autopilot path.

  • delegate:codex / delegate:local argument tokens (and matching lfg_delegate config key) route the work phase through ce-work-beta delegate:codex instead of ce-work.
  • mcp:<list> argument token (and lfg_mcp_providers config) accepts simple provider names; codex enables the parallel adversarial review lane, perplexity is passed as a research hint into ce-plan and the work skill. The set is intentionally closed for now; unknown names no-op with a notice.
  • New step 3 dispatches ce-code-review mode:autofix and mcp__codex__codex adversarial in the same response so they execute in parallel; codex residuals flow through the standard residual handoff with synthesized owner: downstream-resolver and source: codex-adversarial tags.
  • ## Residual Review Findings gains an Items applied with low confidence subsection plus an inline [needs human review] marker for findings flagged requires_human_judgment so the user can spot redirect-worthy items.

Files

  • Plan: docs/plans/2026-05-06-001-feat-lfg-delegate-and-mcp-config-plan.md
  • Skill: plugins/compound-engineering/skills/lfg/SKILL.md
  • New reference: plugins/compound-engineering/skills/lfg/references/codex-adversarial-prompt.md
  • Example config: .compound-engineering/config.local.example.yaml (new lfg_* keys documented)

Review

Ran ce-code-review (project-standards + correctness + maintainability) in parallel with the codex MCP adversarial lane per the new design. Autofixes applied in commit 88ca47a6:

  • Removed the inaccurate "ce-work-beta owns CLI/MCP fallback" claim — ce-work-beta only delegates via codex exec, not MCP. Adversarial codex MCP is now scoped to the review lane only.
  • Tightened the lane gate to adversarial_review_active AND codex_mcp_available, dropping the OR-providers branch that would have admitted the lane when the tool wasn't loaded.
  • Restructured step 3/3b into a single review phase that explicitly dispatches both lanes in the same response.
  • Synthesized the fields tracker-defer needs on codex residuals (owner, autofix_class).
  • Added an in-memory finding map keyed by finding_id so the rendered markdown preserves confidence / requires_human_judgment / suggested_fix after tracker-defer's lightweight return.
  • Token normalization rules made explicit (case, empty mcp:, whitespace, repeated tokens, mcp:none escape hatch, union semantics for the list).
  • Codex adversarial prompt updated to forbid file modifications.

Test plan

  • bun test (1246 pass, 0 fail)
  • bun run release:validate (sync clean)
  • tests/skill-shell-safety.test.ts (new pre-resolution blocks pass; one safety failure during dev was fixed by wrapping && in a subshell)
  • tests/frontmatter.test.ts
  • Behavioral validation via skill-creator — per plugins/compound-engineering/AGENTS.md, behavioral changes to skills require skill-creator evals; recommended before merge for U1 (token parsing), U2 (delegation routing), U3 (parallel adversarial lane).

Items needing your judgment

The original ask said "delegate to codex CLI (or MCP, as fallback) as needed". The codex adversarial review surfaced that this isn't actually achievable today: ce-work-beta only delegates via codex exec (CLI), not via the codex MCP. The skill prose now reflects what's actually implemented (CLI for work; MCP for adversarial review). Three options if you want CLI-or-MCP delegation for the work phase:

  1. Accept current behavior (this PR's choice): codex CLI for work, codex MCP only for adversarial review. Simpler, faithful to ce-work-beta's actual capability.
  2. Add MCP work-phase delegation directly in lfg: lfg invokes mcp__codex__codex with the plan and unit prompts itself when CLI is missing. Bypasses ce-work-beta entirely on that path; large new surface.
  3. Extend ce-work-beta to support MCP delegation as a fallback. Bigger lift, touches the canonical delegation owner.

Let me know which you want; option 1 ships as-is in this PR.

davidalee added 2 commits May 6, 2026 23:37
Adds delegate:codex|delegate:local and mcp:<list> argument tokens plus
matching config keys (lfg_delegate, lfg_mcp_providers,
lfg_adversarial_review). When delegation is active the work phase routes
to ce-work-beta; codex MCP serves as fallback and as a parallel
adversarial review lane alongside ce-code-review. Perplexity in the
provider list is passed as a research hint to ce-plan and the work
skill. Residuals from the codex lane flow through the standard handoff;
low-confidence autofixes appear in a dedicated subsection so the user
can re-direct.
Address review findings from ce-code-review and parallel codex MCP
adversarial lane on the lfg delegation/MCP-config skill:

- Drop the misleading 'ce-work-beta owns CLI/MCP fallback' claim:
  ce-work-beta delegates via codex exec only. Document that codex MCP
  is used solely for the adversarial review lane, not as work-phase
  fallback. Tighten the global delegation fallback to check codex CLI
  alone.
- Restructure step 3 as a single review phase that explicitly dispatches
  the ce-code-review and codex MCP adversarial lanes in the same agent
  response, removing the prior 3/3b ambiguity.
- Tighten the adversarial-lane gate to adversarial_review_active AND
  codex_mcp_available (drop the providers-only OR branch) and suppress
  the skip notice when adversarial_review_active was default-derived
  AND codex MCP is unavailable.
- Synthesize owner: downstream-resolver / autofix_class on codex
  residuals so they flow through the standard residual handoff.
- Build a finding_id-indexed merged list before tracker-defer so the
  rendered markdown can preserve confidence, requires_human_judgment,
  and applied-autofix metadata after tracker-defer's lightweight return.
- Add an inline [needs human review] marker for not-autofixed
  judgment-required findings; keep the low-confidence-applied subsection
  for autofixed items.
- Add explicit token-normalization rules (case, empty mcp:, whitespace,
  repeated tokens, unknown delegate values, mcp:none escape hatch).
- Specify mcp_providers as union (arg + config), with mcp:none as the
  exclusion mechanism.
- Drop unused delegation_source state var; clarify the
  Provider auto-invoke mapping as a closed set.
- Fix step 7 stale 'step 5 already opened a PR' wording.
- Codex adversarial prompt: explicitly forbid file modifications.
@davidalee
Copy link
Copy Markdown
Owner Author

Superseded by #14, which moves these changes into a new lfg-beta skill (parallel to ce-work-beta) so stable /lfg stays untouched.

@davidalee davidalee closed this May 8, 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