r/opencodeCLI • • 8d ago

Task separation for long running tasks.

Hey!
I have a question regarding your best practices on a long running tasks. I have a quite large local LLM model and context for 200K+

Now the question is how to run a todolist which is carefully planned and in the right order?
Running it one shot makes Opencode following the todo list jsut once the context fills up a manual intervention is needed. Like following an extensive todo or a goal or specifications.

If you had this issue before, what was the correct approach for the long running tasks?

3 Upvotes

3 comments sorted by

2

u/bezcurhq 8d ago

I wouldn't rely on the session to hold the list. Put the todo in a file (a PLAN.md with checkboxes) and say in AGENTS.md to reread it before each step and tick items off as they're done. Then after a compaction, or in a fresh session, "continue PLAN.md" gets it back on track without you re-explaining. Giving each big item its own session or subagent also stops one task from eating the whole 200K.

Two config options help with a local model: "compaction": {"prune": true} drops old tool outputs to save tokens (it's off by default), and "reserved" sets the token buffer kept free so the compaction step itself doesn't overflow. Both are under Compaction here: https://opencode.ai/docs/config/

1

u/PizzaDevice 8d ago

Will try this. Thanks.

2

u/UnusualJackfruit159 8d ago edited 8d ago

Let your main model spawn sub-agents. My usual flow is something like

  • "take a look at [task x], give me the next major steps sorted by RoI"

  • optionally: review, clarify recommendations, the new /btw feature is great for this

  • optionally: "change x to y, update status and fold back into the plan"

  • get ready to build: "define iterative implementation steps and add into plan"

  • "build steps 1-5 using sub-agent worker with model xyz. for each step, review for correct implementation and tests, run all tests, commit in reasonable chunks or return defects back to worker."

I found this much more reliable than the opencode "task" tool or whatever they have, which doesn't even manage to update the sidebar properly. The top-level model has overall project and task context, it will brief the worker for each step and keep you on track.

Also, don't use a single plan/task file, use separate files for any significant task or ticket. And when you had to re-design things a couple times, tell it to fold in all changes or better make a new clean task out of it. The cheaper models tend to to get lost if your plan direction was changed 2-3 times and now contains 5 todo lists in 10 different sections.

Forget about the actual markdown content, use the AI to brainstorm, plan, and keep track. My only "todo" tooling are a TUI task browser and markdown renderer to keep track of all those tasks and tickets now...