content dir #12

Closed
opened 2026-04-01 12:01:12 +00:00 by despiegk · 4 comments
Owner

Slide Generator Content + Prompting Spec

Goal

Add a structured content system to the slide generator so a user can:

  • create a deck from a presentation folder
  • reuse contextual background content
  • create new slides from short typed or spoken intent
  • automatically transform rough input into structured slide content
  • generate final slide instructions/specs using selected background context

1. Folder Structure

Each presentation folder must support this layout:

<presentation>/
  content/
    slides/
      01_intro.md
      02_problem.md
      03_solution.md
    background/
      company/
        overview.md
        positioning.md
      market/
        trends.md
        sizing.md
      style/
        tone.md
        visual_principles.md

the slides/ not used for now

Rules

  • content/slides/ contains the ordered markdown files representing slide content.
  • content/background/ contains reusable context grouped in subdirectories.
  • Each subdirectory under background/ is selectable as a context source during deck creation or slide generation.
  • Markdown files inside selected background folders are concatenated in a stable order and injected as contextual input to the generation prompt.

2. Core Concepts

Slide Content

A markdown file describing:

  • what the slide is about
  • what message it should communicate
  • why it exists

This is not the final visual instruction output.

Background Context

Reusable markdown grouped by theme, such as:

  • company context
  • product narrative
  • market facts
  • visual language
  • terminology
  • tone

Slide Instruction Spec

The final generated output used by the slide generator to render the slide.


3. Main User Flows

A. Create Deck

When the user clicks Create Slide as part of a deck:

System behavior

  1. Check whether <presentation>/content/ exists.
  2. Check whether <presentation>/content/background/ exists.
  3. If background exists:
    • scan all immediate subdirectories under background/
    • show them as selectable options
    • allow single or multi-select
  4. When generating slides for this deck, all markdown files in the selected background folders are included as prompt context.

Expected result

The deck is created with persistent selected context sources.


B. Create New Slide

When the user creates a new slide:

UI fields

  • Title field
  • Intent text box
  • Voice record button

User options

The user can:

  • type intent directly
  • record intent by voice
  • do both

System behavior

  1. If voice is used:
    • transcribe audio to text
    • pass transcript through a rough-input-to-structured-slide-content prompt see how we do it in our existing editor for slides, do same way
    • populate the editable intent/content box with the structured result
  2. User may edit the generated structured content
  3. User can select one or more background folders for this slide if desired
    • default can inherit deck-level background selection
  4. Final structured content + selected background context are sent to a slide-spec-generation prompt
  5. Output is saved as the final slide instruction/spec
# Slide Generator Content + Prompting Spec ## Goal Add a structured content system to the slide generator so a user can: * create a deck from a presentation folder * reuse contextual background content * create new slides from short typed or spoken intent * automatically transform rough input into structured slide content * generate final slide instructions/specs using selected background context --- # 1. Folder Structure Each presentation folder must support this layout: ```text <presentation>/ content/ slides/ 01_intro.md 02_problem.md 03_solution.md background/ company/ overview.md positioning.md market/ trends.md sizing.md style/ tone.md visual_principles.md ``` the slides/ not used for now ## Rules * `content/slides/` contains the ordered markdown files representing slide content. * `content/background/` contains reusable context grouped in subdirectories. * Each subdirectory under `background/` is selectable as a context source during deck creation or slide generation. * Markdown files inside selected background folders are concatenated in a stable order and injected as contextual input to the generation prompt. --- # 2. Core Concepts ## Slide Content A markdown file describing: * what the slide is about * what message it should communicate * why it exists This is not the final visual instruction output. ## Background Context Reusable markdown grouped by theme, such as: * company context * product narrative * market facts * visual language * terminology * tone ## Slide Instruction Spec The final generated output used by the slide generator to render the slide. --- # 3. Main User Flows ## A. Create Deck When the user clicks **Create Slide** as part of a deck: ### System behavior 1. Check whether `<presentation>/content/` exists. 2. Check whether `<presentation>/content/background/` exists. 3. If background exists: * scan all immediate subdirectories under `background/` * show them as selectable options * allow single or multi-select 4. When generating slides for this deck, all markdown files in the selected background folders are included as prompt context. ### Expected result The deck is created with persistent selected context sources. --- ## B. Create New Slide When the user creates a new slide: ### UI fields * **Title** field * **Intent** text box * **Voice record** button ### User options The user can: * type intent directly * record intent by voice * do both ### System behavior 1. If voice is used: * transcribe audio to text * pass transcript through a **rough-input-to-structured-slide-content prompt** see how we do it in our existing editor for slides, do same way * populate the editable intent/content box with the structured result 2. User may edit the generated structured content 3. User can select one or more background folders for this slide if desired * default can inherit deck-level background selection 4. Final structured content + selected background context are sent to a **slide-spec-generation prompt** 5. Output is saved as the final slide instruction/spec
Author
Owner

Implementation Spec for Issue #12: Content Background System

Objective

Add a structured background content system to hero_slides so users can organize reusable contextual material (company info, market data, style guides) in content/background/ subdirectories within each presentation folder, select which background folders to include, and have their markdown content automatically concatenated and injected into AI generation prompts.

Requirements

  • Scan <deck>/content/background/ for subdirectories (company/, market/, style/)
  • Each subdirectory is a selectable context source; selecting it concatenates all .md files within it
  • Expose RPC methods to list available background folders and read concatenated content
  • Inject selected background context into slide generation prompt via {{background_context}} template variable
  • Add Rhai bindings for discovering and reading background content
  • Add UI controls in dashboard for viewing/selecting background folders per deck
  • Add has_background field to DeckInfo
  • Create seed example in geomind example

Out of Scope

  • content/slides/ reading (issue says "not used for now")
  • Voice transcription

Implementation Plan (7 Steps)

Step 1: Library types and discovery

Files: types.rs, discovery.rs

  • Add BackgroundFolder struct and has_background to DeckInfo
  • Add find_background_folders() and read_background_content() functions

Step 2: Public deck API

Files: deck.rs, lib.rs

  • Add deck_list_background() and deck_read_background() public functions
  • Re-export new types

Step 3: Prompt injection

Files: generator.rs, generator_slide_image.md

  • Add {{background_context}} placeholder to prompt template
  • Modify build_prompt() and generate_slide() to accept background context

Step 4: Server RPC methods

Files: rpc.rs, openrpc.json

  • Add deck.listBackground and deck.readBackground RPC methods
  • Pass background context through to generation

Step 5: Rhai bindings

Files: deck_module.rs

  • Register deck_list_background and deck_read_background Rhai functions

Step 6: Dashboard UI

Files: dashboard.js, index.html

  • Background folder selection panel with checkboxes
  • Preview button for concatenated content
  • Pass selected folders to generation RPC calls

Step 7: Seed example content

Files: examples/geomind/content/background/

  • Create sample company overview and style tone files

Acceptance Criteria

  • deck_list_background() returns empty vec for decks without background content
  • deck_list_background() returns correct folder names and file counts
  • read_background_content() concatenates .md files with proper headers
  • DeckInfo.has_background is correct
  • RPC methods work correctly
  • Background context appears in generation prompt when folders selected
  • Generation works unchanged when no folders selected
  • UI shows/hides background panel based on deck content
  • Rhai bindings work correctly
  • All existing tests pass
  • geomind example has populated background folders
## Implementation Spec for Issue #12: Content Background System ### Objective Add a structured background content system to hero_slides so users can organize reusable contextual material (company info, market data, style guides) in `content/background/` subdirectories within each presentation folder, select which background folders to include, and have their markdown content automatically concatenated and injected into AI generation prompts. ### Requirements - Scan `<deck>/content/background/` for subdirectories (company/, market/, style/) - Each subdirectory is a selectable context source; selecting it concatenates all `.md` files within it - Expose RPC methods to list available background folders and read concatenated content - Inject selected background context into slide generation prompt via `{{background_context}}` template variable - Add Rhai bindings for discovering and reading background content - Add UI controls in dashboard for viewing/selecting background folders per deck - Add `has_background` field to `DeckInfo` - Create seed example in `geomind` example ### Out of Scope - `content/slides/` reading (issue says "not used for now") - Voice transcription ### Implementation Plan (7 Steps) #### Step 1: Library types and discovery Files: `types.rs`, `discovery.rs` - Add `BackgroundFolder` struct and `has_background` to `DeckInfo` - Add `find_background_folders()` and `read_background_content()` functions #### Step 2: Public deck API Files: `deck.rs`, `lib.rs` - Add `deck_list_background()` and `deck_read_background()` public functions - Re-export new types #### Step 3: Prompt injection Files: `generator.rs`, `generator_slide_image.md` - Add `{{background_context}}` placeholder to prompt template - Modify `build_prompt()` and `generate_slide()` to accept background context #### Step 4: Server RPC methods Files: `rpc.rs`, `openrpc.json` - Add `deck.listBackground` and `deck.readBackground` RPC methods - Pass background context through to generation #### Step 5: Rhai bindings Files: `deck_module.rs` - Register `deck_list_background` and `deck_read_background` Rhai functions #### Step 6: Dashboard UI Files: `dashboard.js`, `index.html` - Background folder selection panel with checkboxes - Preview button for concatenated content - Pass selected folders to generation RPC calls #### Step 7: Seed example content Files: `examples/geomind/content/background/` - Create sample company overview and style tone files ### Acceptance Criteria - [ ] `deck_list_background()` returns empty vec for decks without background content - [ ] `deck_list_background()` returns correct folder names and file counts - [ ] `read_background_content()` concatenates .md files with proper headers - [ ] `DeckInfo.has_background` is correct - [ ] RPC methods work correctly - [ ] Background context appears in generation prompt when folders selected - [ ] Generation works unchanged when no folders selected - [ ] UI shows/hides background panel based on deck content - [ ] Rhai bindings work correctly - [ ] All existing tests pass - [ ] geomind example has populated background folders
Author
Owner

Test Results

  • Total: 57
  • Passed: 57
  • Failed: 0
  • Ignored: 1

All tests pass including 3 new background content tests:

  • test_find_background_folders_empty
  • test_find_background_folders
  • test_read_background_content
  • test_build_prompt_with_background
## Test Results - **Total**: 57 - **Passed**: 57 - **Failed**: 0 - **Ignored**: 1 All tests pass including 3 new background content tests: - `test_find_background_folders_empty` - `test_find_background_folders` - `test_read_background_content` - `test_build_prompt_with_background`
Author
Owner

Implementation Summary

Files Modified

  • crates/hero_slides_lib/src/types.rs — Added BackgroundFolder struct, has_background field to DeckInfo
  • crates/hero_slides_lib/src/discovery.rs — Added find_background_folders(), read_background_content(), updated deck_info_from_path(), skip content/ in recursive scan, added 3 unit tests
  • crates/hero_slides_lib/src/deck.rs — Added deck_list_background(), deck_read_background() public API
  • crates/hero_slides_lib/src/lib.rs — Re-exported new types and functions
  • crates/hero_slides_lib/src/generator.rs — Added background_context parameter to build_prompt() and generate_slide(), added test
  • crates/hero_slides_lib/src/prompts/generator_slide_image.md — Added {{background_context}} placeholder
  • crates/hero_slides_lib/src/hashing.rs — Fixed pre-existing test compilation (missing ..Default::default())
  • crates/hero_slides_server/src/rpc.rs — Added deck.listBackground and deck.readBackground RPC methods, has_background to all deck JSON responses
  • crates/hero_slides_rhai/src/deck_module.rs — Added deck_list_background and deck_read_background Rhai bindings, has_background to deck info map
  • crates/hero_slides_ui/static/js/dashboard.js — Background folder selection state, loadBackgroundFolders(), renderBackgroundPanel(), previewBackgroundContent() functions
  • crates/hero_slides_ui/templates/index.html — Background context panel with checkboxes and preview button
  • crates/hero_slides_ui/static/css/dashboard.css — Background panel styling

Files Created

  • examples/geomind/content/background/company/overview.md — Seed company context
  • examples/geomind/content/background/style/tone.md — Seed tone/voice guidelines

Test Results

All 57 tests pass (0 failures, 1 ignored).

## Implementation Summary ### Files Modified - `crates/hero_slides_lib/src/types.rs` — Added `BackgroundFolder` struct, `has_background` field to `DeckInfo` - `crates/hero_slides_lib/src/discovery.rs` — Added `find_background_folders()`, `read_background_content()`, updated `deck_info_from_path()`, skip `content/` in recursive scan, added 3 unit tests - `crates/hero_slides_lib/src/deck.rs` — Added `deck_list_background()`, `deck_read_background()` public API - `crates/hero_slides_lib/src/lib.rs` — Re-exported new types and functions - `crates/hero_slides_lib/src/generator.rs` — Added `background_context` parameter to `build_prompt()` and `generate_slide()`, added test - `crates/hero_slides_lib/src/prompts/generator_slide_image.md` — Added `{{background_context}}` placeholder - `crates/hero_slides_lib/src/hashing.rs` — Fixed pre-existing test compilation (missing `..Default::default()`) - `crates/hero_slides_server/src/rpc.rs` — Added `deck.listBackground` and `deck.readBackground` RPC methods, `has_background` to all deck JSON responses - `crates/hero_slides_rhai/src/deck_module.rs` — Added `deck_list_background` and `deck_read_background` Rhai bindings, `has_background` to deck info map - `crates/hero_slides_ui/static/js/dashboard.js` — Background folder selection state, `loadBackgroundFolders()`, `renderBackgroundPanel()`, `previewBackgroundContent()` functions - `crates/hero_slides_ui/templates/index.html` — Background context panel with checkboxes and preview button - `crates/hero_slides_ui/static/css/dashboard.css` — Background panel styling ### Files Created - `examples/geomind/content/background/company/overview.md` — Seed company context - `examples/geomind/content/background/style/tone.md` — Seed tone/voice guidelines ### Test Results All 57 tests pass (0 failures, 1 ignored).
Author
Owner

Implementation committed: 94600bd

Browse: 94600bd

Implementation committed: `94600bd` Browse: https://forge.ourworld.tf/lhumina_code/hero_slides/commit/94600bd
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_slides#12
No description provided.