You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Parent epic:#1446 (Amicus — AI Study Partner v1) Phase: 3 · Size: M · Depends on:#1447 (embeddings), #1450 (proxy)
Build-time pipeline that pre-generates the chip pool for the FAB peek (#1462). Each chapter gets 3 chip prompts per profile variant (6 variants), batched via Claude Haiku at content build. Output lives in scripture.db and serves ~$0 runtime cost for the inline FAB peek experience.
Each variant has a system-prompt seed that biases chip generation toward scholars/themes that variant's profile would engage with. A separate generic_balanced catches users who don't fit any lean.
Chapter chip generation
For each (chapter × variant), call Claude Haiku with:
System prompt: "Generate 3 concise prompt chips that a scholarly Bible-study user (variant: {X}) might tap when opening {book} {chapter}. Each chip is 6-10 words, phrased as a question or prompt. Return JSON array."
Context: chapter title, subtitle, top 3 retrieved chunks from embeddings (via vector search on chapter summary)
Target per-chip cost: $0.001 with Haiku + prompt caching. Total one-time cost: 1,189 chapters × 6 variants × 3 chips = **$21 one-time** (well under the $42 ceiling called out in plan §10).
Entity chip generation (lightweight templated)
For entity screens (people, places, debates), chips are templated — not LLM-generated. Format:
Person: "Who was {name}?" / "Where does {name} appear in scripture?" / "Scholars on {name}"
Place: "What happened at {place}?" / "Scholars on {place}" / "Related people and events"
Debate topic: "Different views on this" / "Strongest arguments for each side"
Zero LLM cost. _tools/build_prompts_entity.py produces these from meta files.
Parent epic: #1446 (Amicus — AI Study Partner v1)
Phase: 3 · Size: M · Depends on: #1447 (embeddings), #1450 (proxy)
Build-time pipeline that pre-generates the chip pool for the FAB peek (#1462). Each chapter gets 3 chip prompts per profile variant (6 variants), batched via Claude Haiku at content build. Output lives in
scripture.dband serves ~$0 runtime cost for the inline FAB peek experience.Files to create
_tools/build_prompts.py— orchestrator (matchesbuild_embeddings.pystructure from ai-partner: build embeddings pipeline script #1447)_tools/build_prompts_variants.py— profile variant definitions + variant → prompt-seed template_tools/build_prompts_entity.py— entity chips for people/places/debates (lightweight, templated)_tools/prompts_manifest.json— chunk hash tracking for incremental (gitignored)Files to modify
_tools/build_sqlite_schema.py— addprecached_promptstable DDL_tools/build_sqlite_loaders.py— addpopulate_precached_prompts(conn)loader_tools/build_sqlite.py— call the new loader in sequence_tools/content_writer.py—save_chapter()flags the chapter inprompts_manifest.jsonfor re-generation.gitignore— add_tools/prompts_manifest.json,prompts.dbConventions to follow
build_sqlite.py/build_embeddings.pyROOT = Path(__file__).resolve().parent.parent[OK]print markerspythonnotpython3; no Unix path assumptionsProfile variants (6 total, fixed)
Each variant has a system-prompt seed that biases chip generation toward scholars/themes that variant's profile would engage with. A separate
generic_balancedcatches users who don't fit any lean.Chapter chip generation
For each (chapter × variant), call Claude Haiku with:
Target per-chip cost:
$0.001 with Haiku + prompt caching. Total one-time cost: 1,189 chapters × 6 variants × 3 chips = **$21 one-time** (well under the $42 ceiling called out in plan §10).Entity chip generation (lightweight templated)
For entity screens (people, places, debates), chips are templated — not LLM-generated. Format:
Zero LLM cost.
_tools/build_prompts_entity.pyproduces these from meta files.Output DB table (scripture.db)
CLI interface
Cost guardrails
--dry-runprints total API calls, estimated tokens, estimated costContinue? [y/N]if cost > $1.00ANTHROPIC_API_KEYenv required; fail early if missingAcceptance criteria
label,seed_query,expected_source_types)python _tools/validate_sqlite.pypasses with new section verifying chip coverageOut of scope