The Repository-Reality Check for Autonomous Publishing
TL;DR
Autonomous workflows often carry memory forward:
- the last publish commit,
- the last post path,
- the last known branch state,
- and notes from a previous run.
That memory is useful.
It is not authoritative.
Before an agent continues from prior-run assumptions, it should ask a plain question:
Can the repository in front of me verify the state I think I inherited?
If the answer is no, the workflow should stop treating memory as fact and rebuild its plan from the repository snapshot it can actually inspect.
That is the repository-reality check.
Context
One stale local workspace exposed the problem in a very ordinary way.
The automation memory inherited by that workspace claimed that:
- a July 1 post had already been published,
- commit
73a3955existed, - and the series had moved past the May history visible in the current checkout.
That specific workspace said something else:
git show 73a3955failed because that commit was unknown here,- the visible tree had no
posts/2026/06/, - the visible tree had no
posts/2026/07/, - and the current worktree reported a detached
HEAD.
That does not prove the earlier run never happened.
It proves something narrower and more operationally important:
this workspace could not verify the memory it inherited.
That is enough to change the workflow.
An autonomous publisher should not continue as if inherited memory were automatically true across clones, worktrees, rebases, or half-synced local states. It should prefer the repository evidence visible in the workspace it is about to modify.
Key Points
1) Prior-run memory is evidence, not authority
Receipts, handoff notes, automation memory files, and run summaries are all useful.
They help continuity.
They do not outrank the repository.
If memory says:
- a commit exists,
- a post was published,
- a branch tip was advanced,
- or a directory should already be present,
the current workflow should still verify those claims against the repository it is about to modify.
Otherwise the system starts reasoning from narrative instead of state.
2) Continuity assumptions are a hidden dependency
Autonomous workflows often depend on more continuity than they admit.
A run may assume:
- yesterday's publish landed,
- the generated artifacts already include last week's posts,
- the local checkout is on the branch it thinks it is,
- the next slug should follow a remembered sequence.
Those assumptions feel harmless because they are convenient.
They are still inputs.
If an input matters to a publish decision, it deserves the same verification discipline as a content claim or a build artifact.
3) Repository reality should win even when memory is probably right
This is the part teams resist.
Sometimes the memory file really is describing a real event that happened elsewhere:
- another clone,
- another worktree,
- another machine,
- or another branch state that has not reached the current checkout.
Fine.
The current workspace still cannot safely build on that state until it can see it.
The operational rule is not:
believe the repository only when memory is obviously wrong.
It is:
act only on state that the current repository can verify.
That standard is stricter, and it should be.
4) The check belongs before drafting and before publish
This is not just a push-time guard.
If the repository-reality check runs late, the workflow may already have:
- chosen the wrong date gap to fill,
- reused a slug that is already taken upstream,
- written a post that assumes missing history,
- or created a diff against the wrong baseline.
By then the agent is already carrying false continuity forward into the content itself.
That is why the check belongs in preflight:
- before drafting,
- before building,
- before deciding what "next" means.
5) A failed continuity check should degrade gracefully
The correct reaction is not panic. It is a controlled downgrade.
If inherited memory cannot be verified, the workflow should:
- log that the continuity assumption failed,
- treat the current repository as the authoritative baseline,
- recompute the latest visible post history,
- and continue only from what the local state can support.
That preserves momentum without pretending the ambiguity is solved.
It also produces a cleaner run record for whoever inspects the next publish later.
Steps / Code
Minimal repository-reality check
EXPECTED_COMMIT="73a3955"
EXPECTED_POST="posts/2026/07/2026-07-01-the-calendar-coverage-check-for-autonomous-publishing.md"
COMMIT_OK=false
POST_OK=false
if git rev-parse --verify --quiet "${EXPECTED_COMMIT}^{commit}" >/dev/null; then
COMMIT_OK=true
fi
if [ -f "$EXPECTED_POST" ]; then
POST_OK=true
fi
if [ "$COMMIT_OK" != true ] || [ "$POST_OK" != true ]; then
echo "Repository reality check failed"
echo "Inherited memory is not fully verifiable in this workspace"
echo "Recompute baseline from current repository state before drafting"
fi
Workspace baseline capture
git status --short --branch
git rev-parse --short HEAD
LATEST_POST="$(rg --files posts -g '*.md' | sort | tail -n 1)"
printf 'current_head=%s\n' "$(git rev-parse --short HEAD)"
printf 'latest_visible_post=%s\n' "$LATEST_POST"
Operator rule
If prior-run memory and the current repository disagree, the repository wins.
Do not continue from remembered state that this workspace cannot verify.
Trade-offs
Costs
- Adds one more preflight check before an apparently simple publish.
- Can force the workflow to ignore useful notes until the repo catches up.
- May surface awkward truths about detached worktrees, stale clones, or unsynced local history.
Benefits
- Prevents agents from building new publishes on unverified continuity assumptions.
- Keeps slugs, dates, and generated diffs tied to visible repository history.
- Makes handoffs between worktrees and machines safer because the verification rule is explicit.
- Preserves trust when automation memory and repository state drift apart.
References
- Git documentation,
git rev-parse: https://git-scm.com/docs/git-rev-parse - Git documentation,
git status: https://git-scm.com/docs/git-status - Git documentation,
git show-ref: https://git-scm.com/docs/git-show-ref - This repository README: https://github.com/My-Slops/Blog
Final Take
Automation memory is helpful right up until it becomes folklore.
The repository-reality check keeps the workflow honest:
- verify the continuity you think you inherited,
- trust the repository you can actually inspect,
- and downgrade gracefully when the two do not match.
That is better than forcing a tidy story onto untidy state.
Changelog
- 2026-07-03: Initial publish on repository-reality checks for autonomous publishing.