feat(prompts): expose template variables - #111
Merged
Merged
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a746f13. Configure here.
kxzk
force-pushed
the
feature/aai-392-expose-variables-on-prompt-clients
branch
from
August 17, 2026 17:53
81ee1a3 to
1765636
Compare
kxzk
changed the base branch from
main
to
feature/aai-391-add-tracing-enabled-kill-switch
August 17, 2026 17:53
kxzk
force-pushed
the
feature/aai-392-expose-variables-on-prompt-clients
branch
from
August 17, 2026 18:19
1765636 to
a1a844c
Compare
kxzk
changed the base branch from
feature/aai-391-add-tracing-enabled-kill-switch
to
main
August 17, 2026 18:20
kxzk
changed the base branch from
main
to
feature/aai-391-add-tracing-enabled-kill-switch
August 17, 2026 18:21
kxzk
force-pushed
the
feature/aai-391-add-tracing-enabled-kill-switch
branch
from
August 17, 2026 18:29
cb9b93d to
9aa3f32
Compare
kxzk
force-pushed
the
feature/aai-392-expose-variables-on-prompt-clients
branch
from
August 17, 2026 18:29
a1a844c to
7a831cc
Compare
kxzk
changed the base branch from
feature/aai-391-add-tracing-enabled-kill-switch
to
main
August 17, 2026 18:33
kxzk
changed the base branch from
main
to
feature/aai-391-add-tracing-enabled-kill-switch
August 17, 2026 18:34
kxzk
force-pushed
the
feature/aai-392-expose-variables-on-prompt-clients
branch
from
August 17, 2026 18:43
7a831cc to
99d3b65
Compare
kxzk
changed the base branch from
feature/aai-391-add-tracing-enabled-kill-switch
to
main
August 17, 2026 18:43
kxzk
changed the base branch from
main
to
feature/aai-391-add-tracing-enabled-kill-switch
August 17, 2026 18:44
kxzk
force-pushed
the
feature/aai-391-add-tracing-enabled-kill-switch
branch
from
August 17, 2026 19:05
a33e0ba to
918ca30
Compare
kxzk
force-pushed
the
feature/aai-392-expose-variables-on-prompt-clients
branch
from
August 17, 2026 19:05
99d3b65 to
c18a05b
Compare
kxzk
changed the base branch from
feature/aai-391-add-tracing-enabled-kill-switch
to
main
August 17, 2026 19:05
kxzk
changed the base branch from
main
to
feature/aai-391-add-tracing-enabled-kill-switch
August 17, 2026 19:06
kxzk
merged commit Aug 17, 2026
6408b2a
into
feature/aai-391-add-tracing-enabled-kill-switch
12 checks passed
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.

TL;DRText and chat prompt clients expose the unique variables referenced by their Mustache templates.
WhyCallers need the variable list before compilation so they can validate inputs and build prompt-aware tools. The work tracks the prompt variable issue.
ChecklistCloses #
Note
Kade's words:
Summary
Text and chat prompt clients now return unique referenced variable names through
#variables. The result keeps source order and full dotted paths. It includes section names and variables inside nested sections. Chat prompts combine variables across message templates and exclude message placeholders.The extractor reads Mustache parser tokens. It recognizes escaped tags, unescaped tags, sections, inverted sections, and comments according to the template grammar. Existing prompt compilation behavior stays unchanged.
Change diagram
flowchart LR accTitle: Prompt variable extraction accDescr: Text and chat templates use the Mustache parser to return unique variable paths in source order. T["Text template"] --> P["Parse Mustache tokens"] C["Chat message templates"] --> P P --> X["Collect full variable paths"] X --> U["Keep first occurrence"] U --> V["Return variables"]Verification
I ran the complete RSpec suite locally. All 1,575 examples passed. Line coverage was 97.25%.
I ran RuboCop against 97 files. RuboCop reported no offenses.
I fetched
synthetic-prompt-132908c3d42cversion 1 through the Ruby SDK with thelatestlabel. The prompt source wasReturn a synthetic result for {{input}}..#variablesreturned["input"], and compilation producedReturn a synthetic result for sdk-cli-e2e..The Langfuse CLI read back the same prompt name, version, type, and source template. Unit tests cover repeated variables, dotted paths, nested and inverted sections, comments, unescaped tags, invalid syntax, cross-message deduplication, and message placeholders.
I did not preview the rendered Mermaid diagram in GitHub. I reviewed the Mermaid source and syntax locally.
Note
Low Risk
Additive read-only API on prompt clients with no changes to compilation; covered by new specs.
Overview
Text and chat prompt clients now expose
#variables, returning unique Mustache variable names in source order (dotted paths, section names, and nested-section scoping).A new
Langfuse::PromptVariableshelper walks Mustache parser tokens to collect tags and sections; chat prompts aggregate across message templates and skip message placeholder entries. Invalid template syntax surfaces asMustache::Parser::SyntaxError.#compilebehavior is unchanged.Reviewed by Cursor Bugbot for commit c18a05b. Bugbot is set up for automated code reviews on this repo. Configure here.