SlothPlan:告訴你截止時間前可以休息多久的本地 AI
SlothPlan: a local AI that tells you how long you can rest before the deadline
SlothPlan 是一款本地 AI 排程工具,根據任務、截止時間和精力水平,拆解工作步驟並估算所需時間,再計算仍可休息多久。它以 Ollama 本地執行 LLM,由 Python 負責時間計算;用戶可修改估算、按進度重新規劃,資料留在自己的裝置上。
This is a submission for the Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady
What I Built
It's evening, something is due later tonight or tomorrow, and I'm bored and don't want to start. I also have no idea whether I can safely rest for an hour or whether I'm already secretly late. So I either start too early and burn out, or rest and then panic.
SlothPlan 🦥 answers one question: "I have a task and a deadline. How long can I rest and still finish?"
You type the task, pick the deadline, and set your energy from 1 to 5. A local model breaks the task into steps and guesses the minutes. You fix any guesses that look wrong, then SlothPlan gives you your point of no return:
You can rest until 6:34 PM (68 min guilt-free). Then three work blocks, short breaks, and a buffer before the deadline.
The other half matters just as much: when there's no room to rest, it tells you straight away ("No rest. You need 379 min but have 137") instead of handing you a pretty schedule you can't keep. On a sick day or an emergency that eats your time, the question stops being "how much can I slack?" and becomes "what's the minimum I have to do, and when must I start?" You cut steps from the table, re-plan, and repeat until the numbers fit.
It also tracks you as you go: tick a step off, re-plan from the current time, and log how long the task really took so the next plan is more honest.
Demo
A short screen recording of SlothPlan taking a study task from breakdown to plan:
I'm sharing a video and the repo instead of a hosted link on purpose. It runs on my laptop, and a hosted version would need a server running a model, which defeats the point (more on that below).
Code
SlothPlan 🦥
Give it a task and a deadline. It tells you how long you can rest and still finish.
A local LLM (Ollama) breaks the task into steps and guesses the minutes. Plain Python does all the time math. Nothing leaves your machine.
Run
ollama pull qwen2.5:7b # or llama3.2:3b for less RAM
pip3 install streamlit requests
python3 -m streamlit run app.py
Test
python3 test_slothplan.py
Your logged times live in history.json next to the app.
How I Built It
Stack: Python, Streamlit, and Ollama running qwen2.5:7b locally on a 16 GB MacBook Air.
The one design decision that mattered: the model never does time math. LLMs are bad at clocks, so the job is split:
- Local model: turns the task into ordered steps with minute estimates, returned as JSON.
- Plain Python: does everything else.
needed = work + break_min + buffer
slack = available - needed # minutes you can rest
start_by = now + timedelta(minutes=slack) # your point of no return
Energy changes the sprint and break lengths (50 min work and 5 min break at energy 5, 20 and 8 at energy 1), and low energy also slows the work estimate by up to 25%. I wrote a small test file that checks the schedule never has gaps or overlaps and always ends exactly at the deadline.
What went wrong along the way:
- The first plan was absurd. For "read a 100-line stored procedure, dry run 4 blocks, fix the errors", the model estimated 170 minutes and repeated "fix errors" once per block. That left me 12 minutes of rest. The model was padding and duplicating.
- My own scheduler was wrong too. I sorted steps hardest-first, so it told me to fix errors before reading the code. Steps have dependencies, so now the model's order is kept.
- The same kind of task gave different estimates. One run said 105 minutes, another said 75, which swung my rest time by an hour. I set temperature to 0 with a fixed seed and tightened the prompt (merge similar steps, no padding, short titles) so the same task gives the same breakdown.
- The model can't know my pace. So the steps appear in an editable table. I know "read 100 lines" takes 10 minutes and a 7B model doesn't. A correction factor learned from the times I log is meant to close the gap over time.
-
A silent privacy bug. I claimed "nothing leaves your machine", but my config file sat outside the
.streamlit/folder, so Streamlit ignored it and its telemetry setting never applied. I only noticed because the Deploy button was still showing.
Known limitation: energy is one fixed setting for the whole plan. Real tiredness builds up through a long night, so the next version should let energy decay over the session.
Why Does Open Innovation Matter?
- Private by default. Assignments, work notes and deadlines never leave my laptop. A tool that asks "what are you avoiding?" shouldn't send the answer to a server I don't control.
- It works offline. No API key, no rate limit, no cost after the one-time model download.
- I could control the model. Fixing the 105 vs 75 minute problem needed temperature, a seed and JSON-constrained output. With a hosted API, I'd be hoping.
-
I can swap models. Changing
qwen2.5:7bto a smaller model is one text box, so I can trade accuracy for RAM. - It's why I didn't host it. Local-only is the feature, not a limitation.
A closed API would probably give better estimates out of the box. But what actually fixed the estimates was the editable table, the logged history and the code around the model, and open tooling made all of that easy to build.
The Lazy Payoff
I used it to plan studying for an exam: two chapters of reading plus their questions. My estimate was 180 minutes. SlothPlan scaled it to 198 for my energy level, added breaks and a 50-minute buffer, and told me I had only 3 minutes of guilt-free rest. No false comfort.
It actually took me about 240 minutes, so I underestimated by around a third. That's the honest result: the estimates are only as good as my own guesses, and the correction factor needs a few logged runs before it fixes that.
What I didn't expect was the other benefit. Having the task split into steps, ticking each one off, and seeing a plan that ended before my deadline gave me a clear sense that the task was finishable, and a small feeling of completion with every tick. That felt better than the rest time would have.
來源:DEV Community · dev.to