C.W.K.
Stream
Lesson 01 of 05 · published

Plan-Execute: Stop Wandering

~30 min · planning, plan-execute

Level 0Observer
0 XP0/40 lessons0/12 achievements
0/100 XP to next level100 XP to go0% complete

A plan is a compression of intent

Reactive agents can wander. Planning compresses the goal into ordered commitments before action starts. The plan does not need to be perfect; it needs to make the next few actions inspectable.

Plan-execute works best when the task has dependencies. Research before writing. Reproduce before fixing. Inspect before editing. Very shocking, I know.

Plans should be executable

A plan item like “improve quality” is mush. A plan item like “run failing test and capture exact error” is executable.

For long tasks, store the plan in run state and update it as steps complete. The model should not rediscover the plan every turn.

Code

Plan-execute loop·python
def plan_execute(task, planner, worker, tools):
    plan = planner(task)
    state = {"task": task, "plan": plan, "done": []}
    for step in plan:
        result = worker(step=step, state=state, tools=tools)
        state["done"].append({"step": step, "result": result})
        if result.get("needs_replan"):
            state["plan"] = planner(task, state=state)
    return synthesize(state)

External links

Exercise

Rewrite three vague plan steps into executable steps.
Hint
Use verbs that a tool or human could actually perform.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.