Sub topic 9
Versioning and Documenting Workflows for a Team
A workflow that works today will be edited tomorrow. Someone tightens the voice rules, a new model replaces the old one, or a legal team adds a disclosure line. If nobody records those changes, the team can't explain why last month's newsletter read differently from this month's, and nobody can undo a change that made things worse.
This chapter assumes you have read the earlier chapters on prompt templates, structured output, and testing with fixed inputs. You should be comfortable reading short Python snippets, and you should know basic file and folder habits. Using Git is helpful but not required. The ideas also work in a shared drive with disciplined naming.
What counts as part of a workflow version
A workflow is more than a prompt. The output depends on every piece below, so a change to any of them changes the workflow.
| Component | Example | Why it changes the output |
|---|---|---|
| Prompt templates | `newsletter_v1.txt` | Wording, order, and constraints shape the draft |
| Brand context | Voice guide, banned phrases | Tone and claims shift when these change |
| Output schema | Required fields, length limits | Downstream steps and tools depend on it |
| Model and settings | Model name, temperature | A new model can phrase things very differently |
| Step order | Summarize, then draft, then review | Reordering changes what each step sees |
| Test inputs and checklist | Six sample briefs, a 10-item checklist | They define what "good" means for this version |
Store these together, as one unit. If the prompt lives in a chat tool, the brand voice in a slide deck, and the schema in someone's head, you cannot reproduce a past run.
A folder layout that a team can navigate
A simple layout keeps each part in a predictable place:
weekly-newsletter/
README.md
CHANGELOG.md
manifest.json
templates/
summarize.txt
draft.txt
context/
brand_voice.md
schema/
email_draft.json
tests/
inputs/
checklist.md
last_results.mdKeep one folder per workflow. A new teammate should be able to open the folder and answer three questions without asking anyone: what this does, how to run it, and who to ask.
Choosing a version number
Use three numbers, MAJOR.MINOR.PATCH, with meanings adapted for workflows:
- PATCH (1.3.0 to 1.3.1): a fix that should not change meaning. Examples are a typo, a clearer sentence, or a corrected placeholder name.
- MINOR (1.3.0 to 1.4.0): a change that alters output in a compatible way. Examples are a new optional constraint, an added example in the prompt, or a refreshed brand phrase list.
- MAJOR (1.3.0 to 2.0.0): a change that can break something that depends on the workflow. Examples are a renamed or removed output field, a new required input, a different channel, or a switch to a different model family.
The test for MAJOR is whether another step, tool, or person has to change because of your edit. If an email platform import expects a preview_text field and you rename it, that is a major change even if the prompt looks nearly identical.
Prompt edits are hard to classify because small wording changes can have large effects. When unsure, run the fixed test inputs. If the results differ in ways a reviewer would notice, treat it as at least a minor change.
Record every change in a changelog
A changelog is a short, dated list of what changed and why. The "why" is the part people skip and later miss.
## 1.4.0 - 2026-11-20
- Added a banned-phrase list ("game-changing", "revolutionary") to brand context.
- Reason: three of the last eight drafts needed manual removal of hype words.
- Test result: 6 of 6 sample briefs pass the checklist; the hype-word check went from 3 failures to 0.
- Owner: Priya N.
## 1.3.1 - 2026-11-06
- Fixed placeholder name `{audiance}` to `{audience}` in draft.txt.
- Reason: the audience line was being sent to the model as literal text.Each entry should include the change, the reason, the test evidence, and the person responsible. The test line matters most. It turns "I think this is better" into something a colleague can check.
Stamp each run with the version
Versions are most useful when every output can be traced back to the one that produced it. Write a small run record next to each draft. The script below builds one, using a fingerprint of the exact prompt text to catch edits that nobody logged.
import hashlib
import json
from datetime import datetime, timezone
MANIFEST = {
"name": "weekly-newsletter",
"version": "1.4.0",
"owner": "[email protected]",
"model": "your-model-name",
}
PROMPT_TEMPLATE = "Write a newsletter intro for $audience about: $topic"
def fingerprint(text):
"""Return a short hash of the text so silent edits are detectable."""
return hashlib.sha256(text.encode("utf-8")).hexdigest()[:12]
def build_run_record(manifest, template_text, inputs):
return {
"workflow": manifest["name"],
"version": manifest["version"],
"model": manifest["model"],
"template_fingerprint": fingerprint(template_text),
"inputs": inputs,
"run_at": datetime.now(timezone.utc).isoformat(timespec="seconds"),
}
record = build_run_record(
MANIFEST,
PROMPT_TEMPLATE,
{"audience": "commuter cyclists", "topic": "spring service discount"},
)
print(json.dumps(record, indent=2))If the fingerprint for version 1.4.0 differs between two runs, someone changed the template without bumping the version. A scheduled check that compares the stored fingerprint with the current one will catch this. Keep records free of personal data (see the privacy chapter). Log the input names and non-sensitive values, not customer details.
A second small check keeps the changelog honest. It fails if the manifest version has no changelog entry:
def changelog_has_version(changelog_text, version):
return any(
line.startswith("## ") and version in line
for line in changelog_text.splitlines()
)
sample = "## 1.4.0 - 2026-11-20\n- Added banned-phrase list.\n"
print(changelog_has_version(sample, "1.4.0")) # True
print(changelog_has_version(sample, "1.5.0")) # FalseRun this before releasing. It will not judge whether the entry is good, but it stops the common case of a version bump with no explanation.
A change process people will follow
Heavy process gets ignored. Aim for the smallest process that still protects the live workflow. Editing should happen in a copy, never in the version the team runs every week.
If you use Git, this maps onto branches and pull requests: edit on a branch, attach the test results to the pull request, and merge after another person approves. Tag each release (v1.4.0) so you can return to it by name. Without Git, copy the folder to weekly-newsletter_v1.4.0 and keep the older folders in an archive directory. This is clumsier, but it works.
Rollback
Plan for the day a release goes wrong. A rollback is simple if three things are true:
- Previous versions are kept, not overwritten.
- The team knows which version is live. One line in the README, or a
currentpointer, is enough. - Any dependent tools tolerate the older output shape. This is where major versions matter, because rolling back after a schema change may require changing the downstream tool as well.
When you roll back, write a changelog entry for it. A rollback is a change, and the next person needs to know why the live version went backward.
Documenting for the next person
The README is for someone who has never seen the workflow. Keep it to one page. Cover these points:
- Purpose: one sentence on the task and the outcome, such as "Drafts the weekly customer newsletter from the campaign brief."
- Inputs: each placeholder, its meaning, an example value, and whether it is required.
- Steps: the order of steps and what each produces.
- Outputs: the schema, with one valid example.
- Human review points: who approves what, and what they check.
- Known limits: cases where the workflow performs badly, such as very short briefs or product names with unusual spellings.
- Owner and backup: a named person and a second contact.
- How to test: where the inputs and checklist are and how to run them.
- Current version and last review date.
Writing "known limits" feels like admitting weakness, but it saves the most time. When a teammate hits a bad draft, they can check whether it is a known case before debugging for an hour.
Document decisions as well as mechanics. A short note such as "We use temperature 0.3 because higher values produced inconsistent subject lengths" prevents someone from undoing a deliberate choice.
Ownership and review cadence
Every workflow needs a named owner. Without one, the changes pile up from many hands and nobody feels responsible for quality. The owner approves releases, keeps the README current, and decides when the workflow should be retired.
Set a review date, for example every quarter. At each review, check three things:
- Do the test inputs still reflect the briefs the team receives now?
- Has the model or tool changed under the workflow? Providers update and retire models, and a silent change can shift output even when your files are untouched.
- Are the brand and legal rules in the context files still current?
Re-run the checklist on the current version at each review, even if you changed nothing. If results have drifted, you have found a problem before a customer did.
Common mistakes
- Editing the live version. One quick fix at 5 p.m. becomes an untracked change. Edit a copy.
- Versioning only the prompt. A schema or brand-context change can break a workflow just as easily.
- Bumping the number without a changelog entry. The number alone tells nobody what changed.
- Shared copies in personal folders. Two people improve two copies and the team ends up running different workflows under one name.
- No test evidence. "Looks better" is not a reason that survives a staff change.
- Over-documenting. A 15-page document that nobody updates is worse than a one-page README that is current.
Putting it together
Start small. For one existing workflow, create the folder layout, write the README from the list above, add a manifest with a version, and write the first changelog entry describing the current state as 1.0.0. From then on, every change goes through a copy, the fixed test inputs, a second reviewer, and a changelog line. The next chapters build on this: scheduled runs and tool connections both depend on knowing exactly which version is running.
Exercise
Your team changes the email workflow so the model returns the field headline instead of subject. The email platform import still expects subject. Is this a patch, minor, or major change, and what else must you do before release?
Show answer
It is a major change (for example 2.0.0 from 1.4.0), because a downstream tool depends on the renamed field. Before release you must update or confirm the email platform import, run the fixed test inputs and checklist against the new schema, add a changelog entry that states the reason and the test result, and keep the previous version available so you can roll back if the import fails.
Exercise
Two runs both report version 1.4.0 but their template fingerprints differ. What does this tell you, and what should you do?
Show answer
Someone edited the template without bumping the version, so the version number no longer identifies one specific workflow. Find the difference between the two templates, decide whether it is intended, and release it properly with a new version number, a changelog entry, and test results. If it was not intended, restore the template from the tagged or archived 1.4.0 copy.
Exercise
List four things a workflow README should contain so that a new teammate can run and troubleshoot the workflow without asking the author.
Show answer
Any four of these: the purpose of the workflow, the inputs with example values and which are required, the order of steps and what each produces, the output schema with a valid example, the human review points, known limits, the owner and a backup contact, how to run the tests, and the current version with the last review date.