Repository navigation
feat(narrative): extract analyst prompt skeleton (B3) - #19
Merged
Merged
Conversation
B3 of the eval-harness extraction. The recurring scaffold of the analyst
run prompt (claim schema, query_path rules, output file list, headings)
moves into insight-kit so any consumer can reuse it without forking. Project-
specific bits — founder context, data scope description — are runtime
parameters.
## New module
`insight_kit.narrative.analyst_prompt`:
- `ANALYST_PROMPT_TEMPLATE` — the literal template string with named
placeholders {goal_slug}, {question}, {run_dir}, {data_scope},
{founder_context_block}.
- `render_analyst_prompt(goal_slug, question, run_dir, data_scope='',
founder_context='')` — formats the template. Founder-context block is
completely omitted (no empty heading left over) when the string is empty.
Includes the strict `query_path` rules block hardened in growth_insights
PR #8 (no concatenation, single .sql path per claim, upstream refs in
`cites`).
## Tests
11 new tests in `tests/narrative/test_analyst_prompt.py` cover:
- goal_slug + question + run_dir interpolation
- run_dir accepts str + Path
- founder_context block included when set, omitted when empty
- data_scope default placeholder vs custom markdown
- JSON claim-schema block renders with literal { } (not unescaped {{ }})
- strict query_path rules block is present (omp-drift hardening)
- output files list + persona instructions hook
- ANALYST_PROMPT_TEMPLATE constant exposes all named placeholders
## Version
0.1.5 → 0.1.6
## Next (B3 cont. on growth_insights side)
Update growth_insights/src/growth_insights/analyst/runner.py to import
`render_analyst_prompt` instead of carrying its own `_ANALYST_HEADER`
constant. nairomarket founder context becomes the `founder_context`
kwarg. Meta JSON + Shopify parquet + prior claim paths become the
`data_scope` markdown.
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
B3 of eval-harness extraction. The recurring analyst prompt scaffold (claim schema, query_path rules, output file list, headings) moves into insight-kit so any consumer reuses without forking. Project-specific bits (founder context, data scope description) become runtime kwargs.
New module
insight_kit.narrative.analyst_prompt:ANALYST_PROMPT_TEMPLATE— literal template with{goal_slug}{question}{run_dir}{data_scope}{founder_context_block}placeholders.render_analyst_prompt(...)— formats template. Founder block fully omitted when empty.Includes hardened query_path rules from growth_insights PR #8 (single path, no concat, upstream refs go in
cites).Version
0.1.5 → 0.1.6
Test plan
pytest tests/narrative/— 11/11Companion
growth_insights side: update
src/growth_insights/analyst/runner.pyto callrender_analyst_promptinstead of carrying its own_ANALYST_HEADER.