refactor(llm): move the production prompts into files behind one loader - #1279
Merged
Merged
Conversation
jasonssdev
force-pushed
the
refactor/1277-prompts-folder
branch
from
October 2, 2026 20:02
b3b0c0d to
aa95297
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
First slice of #1277: the 13 production system prompts and 3 prompt fragments move out of Python string constants into one folder, one file each, behind one loader. No prompt wording changes — every rendered prompt is byte-identical to before.
src/openkos/prompts/<task>/<name>.md, 16 files in 11 task folders (adjudication,contradiction,edge_typing,volatility_typing,reconciliation,decision_subject,decision_revision,answer,extraction,rationale).src/openkos/llm/prompts.py, stdlib-only, reads throughimportlib.resourcesliketemplates/, as bytes decoded UTF-8 with no stripping (several prompts end without a newline, one with a blank line)..gitattributesmarks the folder-textso a checkout cannot rewrite line endings.extraction/system,edge_typing/system,answer/system,answer/sufficiency); their files hold{{name}}placeholders thatload_promptfills. The loader refuses an unfilled placeholder or an unused argument.contradiction._SYSTEM_PROMPT), now loaded from its file, so evals that import or.replace()them are unaffected.SUBJECT_PROMPT_VERSIONandJUDGE_PROMPT_VERSIONare derived throughprompt_hashwith identical values, so the revision-findings cache is not invalidated.docs/architecture.mdtree updated.Not in this PR: stamping prompt identity into eval results (point 5 of the issue).
Related issue
Refs #1277
Type of change
feat— new featurefix— bug fixdocs— documentation onlyrefactor— no behavior changetest— tests onlychore/ci— tooling, build, or CIHow was this tested?
tests/unit/test_prompt_byte_identity.py, its own commit): records the rendered hash of 16 prompt constants plus the 2 cache-key versions. It passed on the old code and passes unchanged after the move — 16/16 and 2/2 equal.tests/unit/llm/test_prompts.py): one table of prompt id → file hash; fails on any edited or unregistered file, and covers the loader's refusals and the no-carriage-return rule.contradiction/system.mdfails the pin and the oracle.uv buildships all 16.mdfiles; installed into a clean venv outside the repo, the loaded prompts hash the same as the oracle.tests/smoke/test_cross_platform_wheel.pygainstest_every_prompt_file_ships_and_loads.ruff check,ruff format --check,mypy .,pytest --cov(96.46%),evals/run_self_tests.py(46/46) pass locally.Checklist
ruff,mypy,pytest).