Repository navigation
feat(templates,examples): add 8-slot context pruning policy and Genkit example - #59
Merged
Merged
Conversation
…t example - Add canonical templates/agent_context_pruning.json.tmpl and companion templates/agent_context_pruning.examples.json passing TestAllShippedTemplatesRenderAndValidate and SampleVars JSON coercion round-trips. - Register fallback sample variables (task_goal, turn_index, token_budget, blocks) in cmd/serve.go. - Add runnable examples/genkit-context-pruning/ executing agent_context_pruning.json.tmpl via Genkit SystemOne and solving the exact Pareto-filtered Multiple-Choice Knapsack under hard token-budget and pinned-block constraints.
ghchinoy
approved these changes
Nov 10, 2026
This was referenced Nov 10, 2026
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
Splits the 8-slot trajectory context pruning policy and token-budget knapsack example out of PR #36 so each PR has a clean single responsibility and zero unwired code in
pkg/decisionindex:.examples.jsonSidecar:templates/agent_context_pruning.json.tmpl: evaluates up to 8 candidate trajectory blocks (b0..b7) acrossfull,stub, anddropin a singledgempass with schema-nestedlayout: "document_first"andisolate: "auto".templates/agent_context_pruning.examples.json: providestypical(unambiguous: truewith validatedexpected_answers),edge, andminimalvariable sets that round-trip cleanly throughCoerceJSONVariableStrings.examples/genkit-context-pruning/):agent_context_pruning.json.tmplviadgemgenkit.DecideWithTemplateand solves the exact Pareto-filtered Multiple-Choice Knapsack (SelectContextPruningActions) subject toTokenBudgetandPinnedblock constraints.Verification
env -u DGEM_VERTEX_URL go vet ./...env -u DGEM_VERTEX_URL go test -race ./cmd/... ./pkg/...env -u DGEM_VERTEX_URL go -C examples vet ./genkit-context-pruning/...env -u DGEM_VERTEX_URL go -C examples test -race -v ./genkit-context-pruning/...