Skip to content

CI: fail when a prompt's text changes but its version does not - #913

Merged
mircealungu merged 1 commit into
masterfrom
prompt-version-check
Oct 25, 2026
Merged

mircealungu merged 1 commit into
masterfrom
prompt-version-check

Conversation

@mircealungu

Copy link
Copy Markdown
Member

Stored LLM outputs are stamped with the prompt version that wrote them (AIGenerator), and stale ones are found by querying that version. A prompt edited in place keeps its name, so the stamp then names two different texts. That is how ~900 audio lessons could only be found by a regex over their scripts (May 2026).

  • tools/check_prompt_versions.py hashes the text of every versioned prompt into zeeguu/core/llm_services/prompts/prompt_versions.lock.json: the -vN.txt lesson files, the prompt modules with a PROMPT_VERSION, and each EXAMPLE_GENERATION_PROMPTS entry.
  • The check fails when a version's text changed but its name did not. --update records new versions and refuses to rehash an existing one.
  • Only string literals are hashed: comments and docstrings do not count.
  • .github/workflows/prompt-versions.yml runs it on PRs and pushes to master. Standard library only, no install step.

Not covered: unversioned prompts (article simplification, the old unversioned lesson files) and assess_summary_v1, whose text lives inside simplification_and_classification.py.

Tested locally: an in-place edit of a lesson file, the cloze prompt, or the example v4 entry fails; a comment or docstring change passes; an edit with a version bump asks for --update.

🤖 Generated with Claude Code

Stored LLM outputs are stamped with the prompt version that wrote them,
and stale ones are found by querying it. A prompt edited in place keeps
its name, so the stamp then names two texts: that is how ~900 audio
lessons could only be found by a regex over their scripts.

tools/check_prompt_versions.py hashes the text of every versioned prompt
(the -vN lesson files, the prompt modules with a PROMPT_VERSION, each
EXAMPLE_GENERATION_PROMPTS entry) into prompt_versions.lock.json. The
check fails on a changed hash under an unchanged version; --update adds
new versions and refuses to rehash an existing one. Only string literals
are hashed, so comments and docstrings do not count. Standard library
only, so the workflow needs no install step.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

ArchLens - No architecturally relevant changes to the existing views

@mircealungu
mircealungu merged commit ebbe7a7 into master Oct 25, 2026
3 checks passed
@mircealungu
mircealungu deleted the prompt-version-check branch October 25, 2026 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant