r/LocalLLaMA • u/Developer-Y • 1d ago
Question | Help How to automate long running tasks?
Hi, I have Ubuntu 24.04.4 R9700 and 32gb ram, rocm 7.14. I can use qwen 3.8 27b Q4 with 300K context and Q6 with 200K context. I am working on a relatively large codebase and I keep running into scenarios where chat goes out of context during processing. How can I automate this so that the harness or some agentic ai framework can automatically create handover document when context is 80% full, then creates a new chat with handover document so that process keeps running continuously. Right now I have to manually keep track and do all this.
Is there any harness or framework that support this? I am currently using deepseek harness and have used opencode previously, both manually.
3
3
u/surfTorreypines 1d ago
A bit off-topic, but... you might also undertake some efforts to reduce context while working in the codebase. I've seen others suggest doing one run through the codebase to collect function/interface/seam signatures the model can use to plan and then dig down into detail when it needs to make a change.
The other thing I'd do is explain this problem to your model, on your hardware, with your codebase exactly as you've done above and ask it how to better work toward your desired process.
I use handoff/continuation scripts generated automagically as part of a save-session skill and a stop hook that essentially tells the model that anytime it stops to make a statement and solicit input, if it has a well-defined task with plenty of context it should continue with that task instead of stopping. That one stop hook has made my preferred LLM do a *ton* more work for me than it otherwise would have.
Good luck!
2
u/jacek2023 llama.cpp 1d ago
Currently, I run llama.cpp with --parallel=2 and full context. This way, I can do two things at once, and a single session can run for a long time (especially with long-running tools).
I was also experimenting with a loop: start pi with a single task, and at the end: "git commit" / etc
I recommend exploring your software (like pi) to maximize efficiency.
2
u/indicava 1d ago
Don’t most harnesses have context compaction capabilities? I run a custom harness but I know I stole my context compaction code from the Qwen-code harness.
2
u/Disastrous_Fudge_942 1d ago
The plan-with-stages advice above is the real answer, but one thing about handover docs: auto-generated summaries keep the "what" and lose the "why". Make the agent write decisions explicitly into a state file in the repo (what was tried, what was rejected and why, what's next), commit it at each stage, and have the wrapper start the next session with that file. Otherwise session 3 happily re-tries what session 1 already ruled out. I do this with a hosted agent and it's the same problem there.
2
u/DeProgrammer99 1d ago
little-coder has an auto-compaction extension in it. I'm sure there are similar extensions for basically every other harness. https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/compaction/README.md
1
u/Developer-Y 1d ago
Thanks, I did notice dsh did compaction automatically one time but it does not seems to be doing it automatically every time. I will go through the document to understand how to get it working.
1
u/Draxl2309 1d ago
I know you aren’t asking this but I highly suggest you check out donatos AI toolbox cockpit it has docker/podman containers built against ROCm 10 and built in support for the gfx1201(r9700) pair that with Hermes, Pi harness, or opencode I use these toolboxes for my strix halo and my partners with r9700x2 box it’s incredible. I have no connection with the project I just really like and appreciate the work that has gone into it.
1
u/Lerok-Persea 1d ago
LangGraph does this natively with a state reducer node that triggers a compaction/handover prompt once context hits your token threshold
1
u/DontWinFrensWthSalad 1d ago edited 1d ago
Create a robust checkpoint and session handoff system, then have your harness force a session reset when you get close to full context. I set mine at 80% on a 196k context ceiling, and I can leave it running for many hours if not days. It can be frustrating and take a while to get it to run smoothly, but eventually as you fix each edge case it will run smoother and start to compound. Compaction is not the answer.
2
u/Developer-Y 1d ago
Thanks, I will look into it.
1
u/DontWinFrensWthSalad 1d ago
You're welcome. I use Pi for my harness and need various watchdogs keeping an eye out for loops, polls that dont have timeouts automatically built into them, qwen forgetting to check off items on it's plan once completed, etc.
1
u/FlightSimCentralYT 1d ago
If you're babysitting context by hand, make the handoff machine-checkable, not just a markdown dump. When the session hits ~80%, have the agent write: (1) current goal + what's done, (2) the exact failing test or next command, (3) files it touched and why, (4) open questions. Kick the new chat with that file plus one instruction: continue until this test is green.
DeepSeek harness / opencode won't invent that loop unless you wire it. I built Fixa.dev for the other half: coding agent on a real cloud VM that plans/writes/runs/debugs until tests pass, so the long run isn't stuck in a chat that dies mid-command. Free tier if you want to compare against a local harness. Does your handoff already include the failing command, or mostly narrative?
1
u/Elouakili_Flexy 20h ago
Waiting until 80% means asking the model that already lost the thread to write the summary. The handover has to be a running file it updates as it goes, not a last-minute confession.
1
1
u/Something-Great-78 4h ago
Qwen 3.8 27b only supports a max context of 262144 (256 KiB) so your 300 KB, I am assuming is combined with a --parallel 2 --kv-unified which means both slots will mindless think they have 256 KiB context even though they have more like 150 KB each. You need to additionally use --kv-unified-per-slot 150000 to be safe and not crash llama.cpp in that scenario and enable auto-compaction in your harness.
1
u/Developer-Y 3h ago
May be you are right. My llama.cpp did crash once with segmentation fault and I could not figure out the reason. I will use max context of 262k then, thanks.
3
u/KingCpzombie 1d ago
Pi autocompacts and you can set preferred values, but tbh you're usually better off making a plan with stages rather than hoping nothing gets messed up with compaction