Skip to content

jgabor/opencode-lfg

Repository files navigation

@jgabor/opencode-lfg

 _      ______ _____
| |    |  ____/ ____|
| |    | |__ | |  __
| |    |  __|| | |_ |
| |____| |   | |__| |
|______|_|    \_____|

Agentic feature delivery for OpenCode.

LFG is a workflow engine built for OpenCode-native software execution. It turns high-level objectives into deterministic delivery loops across research, planning, coding, review, simplification, and docs.

If you want autonomous momentum with real guardrails, LFG is the "go build the feature" mode for OpenCode.

Features

  • Deterministic stage pipeline: Research -> Plan -> Code -> Review -> Simplify -> Docs -> Done
  • Stage-specific contracts with explicit handoff artifacts
  • Anchor continuity enforcement across stages to prevent focus drift
  • YOLO mode for highly automated feature development with bounded iteration control
  • Guided /lfg brainstorm flow to turn rough ideas into actionable plans and documentation-ready output
  • Structured /lfg roadmap flow to create prioritized multi-item plans with explicit Now/Next/Later horizons
  • Native OpenCode command integration through /lfg ... (no sidecar tooling)
  • Live visibility via /lfg status and /lfg logs
  • Lifecycle controls for active work: resume, cancel, complete, sweep, merge, and worktree cleanup

Why LFG

Agentic engineering often breaks down when planning, implementation, and review run as disconnected prompt chains. LFG keeps all stages in one auditable system:

  • each card has a clear objective
  • each stage has a purpose and expected output
  • transitions are deterministic
  • execution and artifacts stay traceable

The result is faster, safer automated delivery with less manual orchestration.

Quick start

Prerequisites

  • OpenCode installed and configured
  • Bun available in your shell

1) Bootstrap your project

From your repository root:

bunx @jgabor/opencode-lfg init

This command:

  • initializes .lfg/lfg.sqlite
  • creates or updates .lfg/config.json
  • creates or updates opencode.jsonc with the plugin entry
  • copies opencode-lfg.schema.json into the project root (if missing)

2) Confirm plugin registration

opencode.jsonc should include:

{
  "plugin": ["@jgabor/opencode-lfg@latest"]
}

3) Run your first workflow

/lfg run "Add stage-level cache invalidation with tests"
/lfg status
/lfg logs

YOLO mode

Use YOLO mode when you want automated feature follow-through with fewer interruptions.

You can provide an explicit objective, or omit it and let LFG derive one from repository context (for example from TODO.md, TODO/FIXME scans, and focus signals).

Reliability behavior:

  • YOLO retries lifecycle failures (including output retrieval failures) per task/iteration and records retry events in the current column
  • LFG_YOLO_RETRY_LIMIT controls retry count (1-5, default 1) with backoff starting at 250ms and doubling on later attempts
  • non-YOLO lifecycle retries remain capped at one attempt

Completion behavior:

  • YOLO emits milestone updates when a card transitions columns
  • on completion, YOLO creates a commit on lfg/yolo-<slug>-<card-identifier> (empty commit when no changes)
  • chained runs start the next YOLO card once per card and stop at the configured --limit
/lfg yolo "Implement package-scoped defaults and validate schema drift"
/lfg yolo

Tune automation per objective:

/lfg yolo --limit 3 --auto-merge "Ship docs and config UX polish"

Brainstorm and roadmap

LFG includes native ideation and planning workflows so discovery and execution stay in one system.

/lfg brainstorm:

  • runs an interactive idea-shaping interview tailored to your repository
  • helps converge on one concrete concept quickly
  • can generate documentation-ready output blocks and actionable next steps

/lfg roadmap:

  • runs a guided roadmap interview for multi-item prioritization
  • outputs structured outcomes, scope, and success criteria
  • organizes items across Now/Next/Later horizons for execution clarity
/lfg brainstorm
/lfg roadmap

Native OpenCode integration

LFG is designed to feel built-in, not bolted on:

  • command-driven UX inside OpenCode sessions
  • session-aware lifecycle behavior
  • direct status and log surfaces for active and merge queues
  • consistent semantics between interactive chat and automated execution

/lfg status

🚦 LFG Status
📦 db: /workspace/my-repo/.lfg/lfg.sqlite

╔══════════════════════════════════════════════════════════════════════════════
║ 📊 Metrics
║ • Active: 3   • Done: 14   • Merge total: 5
║ • 🏃 Running: 1   • 🕓 Active queue: 2   • 📬 Merge queue: 5   • 🧊 Stale: 0
║ • ⚙ Concurrency: 1/2
╔══════════════════════════════════════════════════════════════════════════════
║ 🕓 Active queue
║ ├─ 5f2a7c1d | 💻 Code | 2/3 | 🏃 running | session:sess_91a2
║ ┆  └─ Add anchor drift validation for stage transitions
║ └─ 9b6d11e0 | Plan | 1/2 | 🕓 queued | waiting for runner
║    └─ Define package release checklist and test matrix
╔══════════════════════════════════════════════════════════════════════════════
║ 📬 Merge queue
║ └─ #1 4ac81f20 | 📬 queued for merge | Tighten command parsing and status rendering
╔══════════════════════════════════════════════════════════════════════════════
║ 🪵 Recent logs (last 5)
║ ├─ 10:42:14 🧭 5f2a7c1d stage transition: Plan -> Code
║ ├─ 10:41:52 🪵 5f2a7c1d tool: read src/plugin/lfg/config.ts
║ └─ 10:41:18 🪵 9b6d11e0 artifact: plan.md updated
legend: 🏃 running | 🕓 active queue | 📬 merge queue | 🔄 merging

Command highlights

/lfg run [--limit N] [--auto-merge] <objective>
/lfg yolo [--limit N] [--auto-merge] [objective]
/lfg status [--json] [--simple] [--show-origin]
/lfg logs [<card-id>] [--limit N] [-n N] [-f|--follow] [--verbose] [--stop] [--json]
/lfg resume [<card-id>] [--origin-session <id>] [--json]
/lfg cancel [<card-id>] [--origin-session <id>] [--reason text] [--json]
/lfg complete [<card-id>] [--origin-session <id>] [--json]
/lfg merge [<card-id>] [--limit N] [--dry-run] [--retry-failed]
/lfg sweep [--dry-run] [--reason text] [--json]
/lfg worktrees [--cleanup] [--dry-run] [--json]
/lfg config [--simple|--advanced] [--json]
/lfg brainstorm
/lfg roadmap
/lfg prime

Development

bun install
bun lint
bun tsc
bun test

Focused runs:

bun test tests/engine.test.ts
bun test tests/workflow-integration.test.ts
bun test --grep "config"

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors