prompts should become templates #11
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_slides#11
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
this allows users to create and modify their own templates
Implementation Spec for Issue #11 — Prompts as User-Editable Templates
Objective
Replace all hardcoded AI prompt constants in the codebase with file-based templates stored in a
prompts/directory at the decks root level. When a deck root directory is scanned/opened and noprompts/folder exists, the system seeds it with default templates. This allows users to inspect and customize every prompt the system uses without touching source code.Requirements
prompts/directory lives at the same level as deck directories (the root passed todeck.scan)system_instructions.md,agent_build_deck.md, etc.){{variable_name}}syntaxdeck.scanis called, the system checks forprompts/; if absent, it writes all default templates thereinclude_str!so the binary works without external filesload_templatehelper that reads from disk (falls back to embedded default if file is missing)prompts/directory is excluded from deck scanningTemplate Files (9 total)
system_instructions.mdsystem_fix_instructions.mdsystem_rewrite_instructions.mdsystem_fix_slide.mdsystem_rewrite_slide.mdsystem_slide_to_instructions.mdsystem_voice_cleanup.mdagent_build_deck.md{{instructions}},{{deck_name}},{{deck_path}}generator_slide_image.md{{slide_name}},{{slide_content}},{{theme_content}},{{deck_context}}New Files to Create
crates/hero_slides_lib/prompts/*.md— 9 default template filescrates/hero_slides_lib/src/prompts.rs— core module:load_template,render_template,seed_prompts_dir,prompts_dir_for_rootFiles to Modify
crates/hero_slides_lib/src/lib.rs— registerpub mod promptscrates/hero_slides_lib/src/instructions.rs— removeSYSTEM_PROMPTconstant, addprompts_dirparamcrates/hero_slides_lib/src/generator.rs— replace static string inbuild_promptwith template loadingcrates/hero_slides_lib/src/voice.rs— replace inline system prompt with template loadingcrates/hero_slides_lib/src/deck.rs— threadprompts_dir, callseed_prompts_diron createcrates/hero_slides_lib/src/discovery.rs— skipprompts/during deck scancrates/hero_slides_server/src/agent.rs— remove 4 system prompt constants, use templatescrates/hero_slides_server/src/rpc.rs— seedprompts/on scan/create, threadprompts_dirto callersImplementation Steps
.mdtemplate files incrates/hero_slides_lib/prompts/crates/hero_slides_lib/src/prompts.rswith core helperspromptsmodule inlib.rsdiscovery.rsto skipprompts/(independent, parallel with 1-3)instructions.rs— load system prompt from templatevoice.rs— load voice cleanup prompt from templategenerator.rs—build_promptuses template + renderdeck.rs— threadprompts_dir, seed on createagent.rs— remove constants, load from templatesrpc.rs— seed on scan/create, threadprompts_dirto callersAcceptance Criteria
prompts/directory created at deck root when callingdeck.scanfor the first time.mdtemplate filesprompts/not treated as a deck directory during scandeck.createseedsprompts/in parentcargo test) continue to pass{{variable_name}}substitution works; unknown tokens left untouchedNotes
rootargument passed todeck.scan, not individual deck directoriesinclude_str!paths inprompts.rs(atsrc/prompts.rs) reference../prompts/filename.mdImplementation Complete
Changes Made
New files created:
crates/hero_slides_lib/src/prompts/— 8 default template.mdfiles (one per AI prompt)crates/hero_slides_lib/src/prompts.rs— core module:load_template,render_template,seed_prompts_dir,prompts_dir_for_rootFiles modified:
crates/hero_slides_lib/src/lib.rs— addedpub mod promptsand re-exported helperscrates/hero_slides_lib/src/discovery.rs— skipprompts/directory during deck scancrates/hero_slides_lib/src/instructions.rs— removedSYSTEM_PROMPTconstant; loads from templatecrates/hero_slides_lib/src/voice.rs— removed inline system prompt; loads from templatecrates/hero_slides_lib/src/generator.rs—build_promptnow usesgenerator_slide_image.mdtemplate with{{variable}}substitutioncrates/hero_slides_lib/src/deck.rs—scan_decksseedsprompts/;deck_createseedsprompts/in parent; threadsprompts_dirtogenerate_slidecrates/hero_slides_server/src/agent.rs— removed 4 system prompt constants; all handlers load from templatescrates/hero_slides_server/src/rpc.rs— updatedvoice_transcribeandslide_to_instructionscall sitescrates/hero_slides_rhai/src/instructions_module.rs— updated call sitecrates/hero_slides_rhai/src/voice_module.rs— updated call siteHow it works
<deck-root>/prompts/(same level as deck directories)deck.scanordeck.create, theprompts/folder is auto-seeded with defaults.mdfile inprompts/— the next AI call picks up the change immediately, no recompile needed{{variable_name}}syntax (e.g.{{instructions}},{{slide_name}},{{theme_content}})system_rewrite_slide.mdtemplate was improved to focus on structure/content/idea and explicitly NOT specify colors or typography (those come from the deck theme)Test Results
Implementation committed:
1a56ffeBrowse:
1a56ffe