Repository navigation
fix(planner): few-shot examples that teach the format, not answers - #34
Merged
Merged
Conversation
…kip ci] Two of the planner's few-shot examples pre-fitted answers to questions of the chat evaluation (scripts/chat_eval.json) and of the maintainer's own sessions: "list the files in the current directory" -> ls -la, and "how do I see how big a directory is?" -> du -sh. A third, "create hello.py", sat close to its "write a C program" turn. Examples must teach the output format, never pre-fit an answer; the maintainer ruled out such hard-coding. They are replaced by examples of the same three forms on unrelated subjects: a command (git log --oneline -3, which the default allow-list allows -- git branch would be refused), a file_write (.gitignore), and a reply (grep -r). * src/codebud/planner.py (LLMPlanner._FEW_SHOT_EXAMPLES): Examples 1, 3 and 6. * tests/test_reply_or_plan.py: Check the reply form, not its text.
Owner
Author
Review summary: correctCondition. Every few-shot example teaches an output form (command, file_write, patch, plan_error, reply) on a subject that matches no chat_eval turn and no turn of the maintainer's sessions; every example command is on the default allow-list. Verified:
Merging. CI was skipped on purpose (prompt text only; see the PR body). |
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.
The first PR of the agent-loop plan: no pre-fitted content in the prompt. The maintainer ruled out hard-coding: prompts may teach the output format and state facts, never pre-fit answers to particular questions.
Audit of the planner prompt
ls -lagit log --oneline -3du -sh(added by me in #29)The new Example 1 was checked against the default allow-list:
git logis allowed, whilegit branch(the first candidate) would have been refused, and an example of a refused command would teach a refusal.CI skipped (
[skip ci]), and whyThe change is text in a prompt constant plus one test assertion (the test now checks the reply form, not its words). Nothing here can behave differently on another platform. The full suite passed locally (1897) and ruff is clean. Measurement of the prompt changes comes with the agent-loop PR.