4.9 KiB
Great—here’s a detailed implementation plan for Step 2 based on your docs and current project state.
Step 2 Goal
Implement the MVP prompt artifact system by creating a curated transcription prompt file:
prompts/transcribe_document.md
This step primarily satisfies:
- REQ-12: prompts stored as individual Markdown artifacts
- MVP Feature 3: prompt-driven verbatim transcription behavior grounded in
docs/Intent.md
Scope for Step 2
In scope
- Create prompt artifact directory and first prompt file.
- Encode transcription rules from
docs/Intent.mdinto a model-facing prompt. - Define stable prompt structure so future revisions are easy to diff/review.
- Add lightweight tests that validate artifact presence and baseline quality constraints.
- Update docs/README references so Step 3 can consume prompt file directly.
Out of scope
- Provider integration logic (Step 3)
- Worker/job orchestration (Step 4)
- UI behavior (Step 5)
Proposed Deliverables
-
prompts/transcribe_document.md- production prompt text for historical document transcription
-
prompts/README.md(recommended)- conventions for prompt files, revision policy, naming
-
tests/test_prompts.py(recommended)- artifact existence + structure checks
-
Small docs update (README or docs reference)
- indicate that prompts are file-based and loaded from
PROMPT_DIR
- indicate that prompts are file-based and loaded from
Detailed Work Breakdown
1) Create prompt artifact folder and canonical file
- Add
prompts/at repo root. - Add
transcribe_document.mdas the first curated artifact. - Keep filename stable; this becomes the default in Step 3 unless overridden.
2) Author prompt content using a strict, sectioned format
Use section headers so future diffs are clean and policy changes are isolated.
Suggested sections:
-
Purpose
- verbatim scholarly transcription of historical documents
-
Output requirements
- plain text only
- no summaries, no paraphrasing
- preserve reading order and meaningful structure
-
Core fidelity rules
- preserve original wording and punctuation
- don’t silently normalize grammar/spelling
- no invented content
-
Issue-handling rules (mapped from Intent table)
- misspellings with
[sic] - missing words with
[word] - uncertainty with
[guess?] - illegible with
[illegible]/ reason tags - crossed-out text as
[deleted: ...] - inserted text as
[inserted: ...] - superscripts handling guidance
- non-text elements as
[description] - marginalia format
[written in left margin: ...] - line-break hyphen rejoin behavior
- capitalization policy
- hierarchical outline preservation (including unusual numbering)
- misspellings with
-
Confidence/ambiguity policy
- prefer explicit uncertainty markers over hallucination
-
Final self-checklist for model
- did I preserve structure?
- did I mark uncertain text?
- did I avoid silent corrections?
3) Add prompt-library conventions (prompts/README.md)
Recommended conventions:
- one prompt per file
- snake_case names
- each file starts with purpose + behavior contract
- iterative edits, one prompt per PR where possible
- no secrets in prompt files
4) Add tests for prompt assets (tests/test_prompts.py)
Keep tests robust but not brittle.
Recommended tests:
test_prompt_file_existstest_prompt_file_is_not_emptytest_prompt_mentions_verbatim_behaviortest_prompt_includes_uncertainty_and_illegible_markerstest_prompt_includes_deleted_and_inserted_conventions
Avoid exact full-text matching; verify key semantic anchors only.
5) Optional config alignment check
Current config already has:
prompt_dir: Path = Path("./prompts")
In Step 2, ensure docs reflect this and that Step 3 will resolve:
PROMPT_DIR / "transcribe_document.md"
Acceptance Criteria (Definition of Done)
Step 2 is complete when all are true:
prompts/transcribe_document.mdexists and is committed.- Prompt includes all critical handling rules from
docs/Intent.md. - Prompt is structured with stable section headings for future curation.
- Prompt tests pass under
uv run pytest -q. - Existing tests remain green (total suite still passes).
- Docs indicate prompt artifact location and curation policy.
Risks and Mitigations
-
Risk: prompt too vague → hallucinated reconstructions
- Mitigation: explicit uncertainty/illegible conventions and “no invention” rule.
-
Risk: prompt too rigid for mixed document types
- Mitigation: include neutral defaults + clear annotation formats.
-
Risk: brittle tests block iterative prompt tuning
- Mitigation: test semantic anchors, not exact wording.
Handoff to Step 3
After Step 2, Step 3 can immediately:
- Load
transcribe_document.mdfromPROMPT_DIR - Inject prompt into OpenRouter request
- Start validating real transcription behavior with minimal glue code