Skip to main content

workplan

Plan and record development work in git, for agent-driven and AI-assisted development.

Site | PyPI | GitHub

A workplan breaks one goal into tasks. Each task is one commit; the workplan reaches the parent branch, master or main, as one squash commit listing every task. The plans and the task definitions are Markdown files in workplans/, and every task's state comes from git history. Any clone holds the whole record, and every step can be done by hand with git and an editor: PROTOCOL.md defines the protocol and gives each step as git commands.

An agent, such as Claude Code, Codex, or a model behind any OpenAI-compatible endpoint, defines the tasks and produces each task's patch in a separate worktree. The maintainer reads each diff and accepts or rejects it.

  • Git as state. Plans, tasks and their states are files and commits; there is no other store, and any clone is the whole record.
  • A protocol, not a service. No server, no account, any agent or none; PROTOCOL.md is enough to implement it again.

Every step can be done by hand; PROTOCOL.md gives each as git commands. Most steps are several git operations in a fixed order: patch accept applies the patch, checks COMMIT_MSG and commits it with the task's files; merge runs the tests, squashes, commits and deletes the branch. The library ensures that order, checks what a step needs before it starts, and restores the tree when a step fails. It reads and changes the repository through git commands only.

Install

pipx install workplan

Python 3.11 or later and git. No other dependencies. It runs on Linux; the hooks and dispatch.sh need a POSIX shell.

The command is wp; workplan is its full name, for use where WP-CLI, the WordPress command line, also installs wp.

Getting started

GETTING_STARTED.md: trying it on this repository, a first workplan without an agent, then with one.

Commands

wp works on the current workplan, its tasks and its patches, as git works on the checked-out branch. The checked-out branch names the current workplan: workplan/<id>/definition and workplan/<id>/task/<nnnn> both name <id>. Switching branch is switching workplan, one git command, so there is no wp switch; for a workplan held only on the remote, git creates the tracking branch:

wp list                                   # the workplans, and the branch holding each
git switch workplan/<id>/definition       # that workplan becomes current

Off a workplan branch, the current workplan is the newest dated workplan by id, else the only workplan; otherwise a command needs the id. list, changelog and serve read across every workplan; new and merge move between the parent branch and a workplan branch.

The commands that complete a step or change a document commit it: init, new, edit, task add, task gen, task edit, task drop, patch accept, merge and release. patch apply stages a patch for review and commits nothing. publish is the only command that pushes to a branch the remote already has.

The workplan's commands are verbs on their own: new, list, show, edit and merge; new and merge are the two that change branches. Tasks and patches take a noun, then a verb: task add, patch show. list and show read; add is you supplying something; gen is the agent producing it; edit changes a document; apply, accept, reject and merge are the protocol's steps. status is a second name for task list.

"master", in these documents and in the command's help and prompts, refers to the parent branch of the workplan branch.

To write tasks yourself in place of task gen, use task add "Say goodbye" --depend 0000 for each.

new opens the editor git uses for commit messages, on WORKPLAN.md rendered from its template; closing it unchanged creates nothing. new greeting -m "app.txt says goodbye" writes the goal and skips the editor. new greeting --reply WORKPLAN.md takes a whole WORKPLAN.md, written by a chat or by hand; its heading must name the new id. edit and task edit open the editor the same way on an existing document.

Every command that changes a document commits it, on the checked-out branch and with nothing else that is staged: new as <id> workplan, task add as <id> add <nnnn>, task add --reply as <id> define tasks, and edit and task edit as <id> edit <document>. An edit that changes nothing commits nothing.

Every command also runs under its full name, workplan.

Protocol commands change the repository in the protocol's terms; each links to its git commands in PROTOCOL.md.

Command Does
init create workplans/ with README, PRINCIPLES.md, BACKLOG.md, config.toml and dispatch.sh; add the working files to .gitignore; commit
new NAME [-m GOAL | --reply FILE] workplans/<date>-NAME/WORKPLAN.md from its template, or the whole file given, on a new branch from the parent branch; commit
edit [ID] WORKPLAN.md in the editor; commit
merge [ID] [-m MESSAGE] [--show] with the workplan's branch checked out, squash the workplan into the parent branch, with the message from its template; --show prints the message
publish [ID] push the parent branch to the remote, then each tag on its head, then delete the workplan's branches there; stops, doing nothing after it, if a push is refused; after release, pushes the branch and the tag
release VERSION [--show] write the changelog section for VERSION under the title of CHANGELOG.md, commit it as release VERSION and tag that commit VERSION; refuses unless the parent branch is checked out with no changes to tracked files, VERSION is a new tag, and a workplan was merged since the latest tag; --show prints the section
task add TITLE [--depend N] [-m CHANGE] the next task's TASK.md and BREAKDOWN.md from their templates, and its line in WORKPLAN.md; the editor opens on TASK.md; commit
task add --reply FILE the new tasks in a task gen reply from a chat; - reads standard input; commit
task gen [ID] [--prompt] the agent writes each new task's TASK.md and BREAKDOWN.md; they are listed in WORKPLAN.md and committed with it; --prompt prints the prompt for a chat
task edit NNNN [--doc NAME] TASK.md, BREAKDOWN.md or NOTES.md in the editor; commit
task drop NNNN move the task to ## Dropped in WORKPLAN.md and commit WORKPLAN.md
patch add NNNN [FILE] a reply from a chat, with its commit message line and diff, becomes output.patch and COMMIT_MSG; standard input when FILE is left out
patch gen NNNN [--prompt] the agent writes output.patch and COMMIT_MSG; --prompt prints the prompt for a chat
patch apply NNNN stage the patch in the tree and the index
patch accept NNNN commit the patch with COMMIT_MSG, together with the task's directory and WORKPLAN.md
patch reject NNNN take an applied patch back out
patch drop NNNN delete an unapplied output.patch and its COMMIT_MSG

Supporting commands read git or run the library; they change nothing in the protocol.

Command Does
list every workplan, in the tree or on another branch, and whether it is editable
show [ID] the workplan's goal and its tasks' states
task list [ID], status [ID] each task's state; a workplan held only on another branch shows its committed states
task show NNNN the task's state and TASK.md
patch show NNNN the task, its state, COMMIT_MSG, its dependencies and their states, the files changed; then the staged change if applied, else output.patch
changelog [FROM] [TO] [--audience NAME] [--version VERSION] [--all] the changelog in Markdown, from the squash commits between two tags or commits and their tasks' trailers; --version heads it VERSION, dated today; --all gives a section per tag, newest first; writes nothing
route [REV] [--dispatch] the next step after a commit
install post-commit and post-merge hooks that run route --dispatch
serve [--port N] the board in a local web page, on 127.0.0.1

A task is ID/NNNN, or NNNN in the current branch's workplan. Every command takes --json to print its result as JSON.

Manual mode with a chat

With no agent configured, any chat can do the agent's work. --prompt prints the prompt the none agent would send, with the files it names; paste it into a chat, and paste the reply back:

wp task gen --prompt          # paste into a chat
wp task add --reply reply.txt # its new tasks; - reads standard input
wp patch gen 0000 --prompt
wp patch add 0000 reply.txt   # its diff and commit message line

patch add applies the reply's diff to the head of the workplan's branch in a separate worktree, and refuses a reply with no diff or one that does not apply. In the page, Copy prompt and Paste reply do the same, beside Gen tasks and Gen patch.

Changelog

Each task ends with git trailers saying what kind of change it makes, for whom, and what it breaks:

Depends: 0000
Change: feat
Audience: users
Breaking: wp add-task is now wp task add

wp changelog reads the squash commits since the latest tag, and each of their tasks' trailers, and prints a changelog: breaking changes first, then Added, Fixed, Changed and Other.

wp changelog                     # the latest tag to HEAD
wp changelog v0.1.0 v0.2.0       # between two tags or commits
wp changelog --audience users    # leave out developers and internal
wp changelog --version v0.4.0    # headed v0.4.0, dated today, before the tag exists
wp changelog --all               # a section per tag, newest first

A section is headed by --version, else by a tag at TO, else "Unreleased". --all takes the tags in version order, each section from the tag before it, with the section since the latest tag first when a workplan was merged since.

It reads git and writes nothing; its output can go into CHANGELOG.md or a release. The squash commits in the range with a Workplan trailer give the workplans, and each task's trailers, as the files stand at TO, give its section:

from=v0.1.0; to=HEAD
git log --reverse --format='%(trailers:key=Workplan,valueonly)' $from..$to |
  while read -r plan; do
    [ -n "$plan" ] || continue
    for f in $(dirname "$plan")/[0-9][0-9][0-9][0-9]/TASK.md; do
      echo "$f"; git show "$to:$f" | git interpret-trailers --parse
    done
  done

Configuration

workplans/config.toml; wp init writes it with every key, and writes workplans/dispatch.sh for route.dispatch. Environment variables override it, and API keys come from the environment only.

Key Variable Default
parent WORKPLAN_PARENT master; init writes the branch checked out
remote WORKPLAN_REMOTE origin
llm.api_base WORKPLAN_API_BASE http://localhost:8000/v1
llm.api_key_env WORKPLAN_API_KEY
llm.params {}, added to each request body
route.classifier WORKPLAN_ROUTE_CLASSIFIER rules
route.model WORKPLAN_ROUTE_MODEL
route.dispatch WORKPLAN_ROUTE_DISPATCH
agent.name WORKPLAN_AGENT none
agent.model WORKPLAN_AGENT_MODEL
agent.setup WORKPLAN_AGENT_SETUP
agent.command WORKPLAN_AGENT_COMMAND []
agent.attempts, agent.timeout 3, 1800
hooks.<name> WORKPLAN_HOOK_<NAME>

Hooks

Each protocol command runs a hook before it and a hook after it, when one is set: pre-<command> and post-<command>, the command's words joined by -, such as pre-merge and post-patch-accept. A hook is a shell command in the [hooks] table of workplans/config.toml, run from the repository root. WORKPLAN_HOOK_<NAME> overrides one, the name in upper case with _ for -: WORKPLAN_HOOK_POST_MERGE. An empty value is no hook.

[hooks]
pre-merge = "python -m unittest discover -s tests -q"     # on the workplan branch
pre-release = "python -m unittest discover -s tests -q"   # on the parent branch
post-merge = "notify-send \"merged $WP_WORKPLAN\""
post-patch-accept = "scripts/ticket-done.sh"

The order is the pre hook, the command, the post hook; merge and release first make every check they would refuse on, so a pre hook that runs the tests does not run for a merge or a release that would be refused. A pre hook that exits non-zero stops the command, which changes nothing. A post hook that exits non-zero makes the command fail after its change, which stays. A hook's output is shown when it fails. --show and --prompt run no hooks, and the commands that only read have none. A key in [hooks] that names no protocol command fails the command.

Variable Holds
WP_HOOK, WP_COMMAND the hook and its command: post-merge, merge
WP_BRANCH the checked-out branch
WP_WORKPLAN, WP_TASK the workplan and the task, where the command has one
WP_COMMIT the commit the command made, in a post hook
WP_TAG the tag, in post-release

A pre hook's standard input is the command's arguments as JSON; a post hook's is the command's result, as --json prints it.

The stages of a piece of work, and their hooks:

Stage Hook
a workplan is created post-new
its tasks are written post-task-add, post-task-gen
a task is complete post-patch-accept
a workplan is complete post-merge
the work reaches the remote post-publish
a release is made post-release

Hooks run code from the repository's config: a clone runs the hooks its config.toml sets. Commits made by hand run no hooks; route.dispatch runs after every commit, by hand or not (Routing).

Agents

task gen and patch gen work in a worktree at the head of the workplan branch, so the maintainer's own tree is never touched:

git worktree add --detach /tmp/wt $b
cp -r workplans /tmp/wt/                             # uncommitted edits are seen
( cd /tmp/wt && <agent.setup> )
git -C /tmp/wt add -A && base=$(git -C /tmp/wt write-tree)
( cd /tmp/wt && <the agent> )
x=":(exclude)workplans/*/*/output.patch"; y=":(exclude)workplans/*/*/COMMIT_MSG"
git -C /tmp/wt add -A -- . "$x" "$y"
git -C /tmp/wt diff --cached --binary $base -- . "$x" "$y" > $t/output.patch
cp /tmp/wt/$t/COMMIT_MSG $t/
git worktree remove --force /tmp/wt
  • task gen: the new task directories the agent wrote under workplans/<id>/ are copied back; existing tasks are left alone.
  • patch gen: the worktree's diff from the base, output.patch and COMMIT_MSG left out, becomes output.patch; it can change files under workplans/, and the documents copied in are not part of it.
agent.name Runs
none completions from llm.api_base; the plan files and the files they name go in the prompt; the reply holds the task files or a diff, retried with the error up to agent.attempts times
claude-code claude -p --allowedTools Read,Edit,Write,Glob,Grep,Bash, prompt on stdin
codex codex exec --sandbox workspace-write <prompt>
command agent.command; a {prompt} argument is replaced by the prompt, else it goes on stdin

claude-code and codex are presets of command; setting agent.command replaces the preset's arguments. Agents with a shell build the code and run its checks in the worktree. Containers, ports and other host resources are shared with the host, so integration runs stay with the maintainer.

A command agent receives WORKPLAN_ACTION (task-gen or patch-gen) and WORKPLAN_TARGET (the workplan or task id) in its environment, and for patch-gen, WORKPLAN_COMMIT_MSG: the path to write the commit message to. When it writes none, COMMIT_MSG is the task id and TASK.md's title.

Examples

Claude Code, with the project's dependencies installed first:

[agent]
name = "claude-code"
setup = "uv sync"

Codex:

[agent]
name = "codex"

A model behind an OpenAI-compatible endpoint, with no agent:

[llm]
api_base = "https://api.anthropic.com/v1"     # or https://api.openai.com/v1
api_key_env = "ANTHROPIC_API_KEY"             # or OPENAI_API_KEY

[agent]
name = "none"
model = "<model name>"

A local model, through marigold or Ollama:

[llm]
api_base = "http://localhost:8000/v1"         # Ollama: http://localhost:11434/v1

[agent]
name = "none"
model = "<model name>"

Routing

wp route reads a commit and prints the next step: complete, review, patch-gen, task-gen or none, with its targets. The rules take the first action in this table that has targets:

Action When Targets
complete a commit on the parent branch with a Workplan: trailer the workplan
review code changed in a commit whose subject is a task id the task
patch-gen TASK.md or BREAKDOWN.md changed each task
task-gen WORKPLAN.md changed the workplan
none anything else, such as a change to the protocol's files --

A task's commit, which also carries its files and WORKPLAN.md, leads to review; the commit that defines the tasks leads to patch-gen. The rules read git show --name-only --format='%s%n%(trailers:key=Workplan)' REV. With route.classifier = "llm", a model chooses the action from the prompt in templates/prompts/route.md; the targets still come from the commit, and an answer that is not an action with targets falls back to the rules. stderr shows both choices:

$ wp route
route: llm chose patch-gen; the rules chose patch-gen
patch-gen 2026-11-24-greeting/0000

wp install adds hooks that run route --dispatch in the background after each commit. --dispatch runs route.dispatch with the action and its targets. wp init writes a dispatch script, workplans/dispatch.sh: for task-gen it runs task gen, for patch-gen it runs patch gen for each target in parallel, and on review it produces each stale patch again. The hooks and the script call the command by its full name, workplan. Set route.dispatch = "workplans/dispatch.sh" and run wp install for full auto. The hooks clear the variables git sets for hooks, such as GIT_INDEX_FILE, so that the commands a dispatch script runs work in their own worktrees.

Serve

wp serve                     # http://127.0.0.1:8765/?token=...

serve starts a web server on 127.0.0.1 and prints its address, with a token made at startup. The page runs the same operations as the commands, so the whole flow can run from the browser, for instance over a screen share while a team refines the tasks. A workplan is editable while its definition branch is checked out; workplans on other branches are shown read-only, read from their branches.

The page shows the workplan's title, branch and goal, and a board with a column for each state. A card opens the task's TASK.md, BREAKDOWN.md, NOTES.md and patch, rendered, with Edit and Save; its buttons are the steps its state allows: Gen patch, Apply, Accept, Reject. The header holds Gen tasks and Merge, and the merge message opens in a text box. New workplan asks for a name and a goal. The selector lists every workplan, those on other branches marked read-only. The page refreshes every five seconds, so commits made in a terminal appear on their own.

The page and the commands share one API: every command but init, install and serve has a route, given by its verb and noun. task list is GET /api/workplan/{id}/task, patch accept is POST /api/task/{id}/{nnnn}/patch/accept, and so on; registry.py holds the rule.

Every request must name 127.0.0.1 or localhost as its host, and every API request must carry the token, so another site open in the browser can neither read nor change anything. Operations that change the repository run one at a time. The server keeps no state of its own: everything it shows comes from the files and git.

Templates

Documents, prompts and the squash commit message are rendered from templates with string.Template: $name is replaced and nothing else happens. To change one, copy it from src/workplan/templates/<kind>/ into workplans/templates/<kind>/ and edit the copy; the rest keep the package's version. The document templates are listed in PROTOCOL.md; the prompts are the library's:

Template Values
prompts/task-gen.md $id, $next, $context, $task_template, $breakdown_template
prompts/task-gen-none.md as task-gen.md
prompts/patch-gen.md $id, $workplan, $context, $commit_msg
prompts/patch-gen-none.md as patch-gen.md
prompts/route.md $branch, $parents, $subject, $workplan, $paths

Development

python -m unittest discover -s tests

workplans/config.toml sets this as the pre-merge and pre-release hooks, so wp merge runs it on the workplan branch before squashing, and wp release on master before a release.

The tests build temporary repositories, compare each command with its by-hand git sequence, rehearse two clones sharing one origin, and run the none agent and the classifier against a local fake endpoint.

The version comes from git tags through setuptools-scm. A release is a vX.Y.Z tag on master, on the commit that adds its changelog section:

wp release v0.4.0 --show         # the section it will write
wp release v0.4.0                # pre-release, CHANGELOG.md, commit, tag
wp publish                       # push master, then the tag

.github/workflows/release.yaml builds the package on every push to master; on a v* tag it publishes the package to PyPI and creates the GitHub release, with the tag's changelog section, from wp changelog, as its notes. It runs in the release environment and needs the repository secret PYPI_API_TOKEN.

Removing workplan

rm .git/hooks/post-commit .git/hooks/post-merge   # if wp install wrote them
$EDITOR .gitignore                                # remove the two workplans/ lines
git rm -r workplans && git commit -m "remove workplans"
pipx uninstall workplan

The history keeps every workplan's squash commit and its Workplan trailer.

Licence

MIT. See LICENSE.

Metadata

Release files for workplan 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for workplan 0.5.0
File Size Uploaded Provenance Actions
workplan-0.5.0.tar.gz 176.0 kB Without provenance Details for workplan-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for workplan 0.5.0
File Interpreter ABI Platform Actions
workplan-0.5.0-py3-none-any.whl Python 3 none any Details for workplan-0.5.0-py3-none-any.whl

Total release size: 243.7 kB

Release files / workplan-0.5.0.tar.gz

Download URL workplan-0.5.0.tar.gz
Size 176.0 kB
Tags Source
SHA-256 checksum
How to use checksums
c5b903f2134ac06ceeace0e092395ec1d9543882dcde4e4716587c6a822b8d27
BLAKE2b-256 checksum
How to use checksums
dd64e0e48605ffa3bade704801a11801202acd63e6717207d7e1e8e91716021b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Release files / workplan-0.5.0-py3-none-any.whl

Download URL workplan-0.5.0-py3-none-any.whl
Size 67.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4d0c1ba41da8253d3bed1d7c3d50167e4a5c5119592843e6dbd9df34cb473714
BLAKE2b-256 checksum
How to use checksums
91f07fac38c7096f6830e900ba92b2fc1fb1519615c400e4354685d005786a1a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Security for workplan 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page