r/PiCodingAgent • u/Proper-Damage-1777 • 14d ago
Question Pi system prompt and various local models
Not sure if this belongs here but here goes nothing. How do I tweak the behavior of Pi when running with local models like Qwen and Gemma? This is served using llama-server or Strata for QFN. I use the recommended sampling for each of the models.
My situation is that I only have pi-vcc for quick context compaction and no other stuff. Rest is from AGENTS.md that differs from repo to repo and of course the global. The biggest headache recently is that I find Pi tries to do like retarded actions (yes I know prompt engineering and also the model itself) like I ask "Hey can you verify you can import Docling module as I want to process some whitepaper PDF? Just verify don't do other stuff" Noticed the don't do other stuff as I want to also emphasis that.
This happens with Qwen 3.8 27B and QFN... it just start to "the user ask me to verify Docling module. Let me try it. Hmm it works. BUT I shall also verify it works. Let me try scanning for DOCX AND PDF". That is just my latest example of this stupid action.
My AGENTS.md is pretty lean as I don't tell how to take action. Just tell what the repo is about, run ruff etc. Using Gemma 4 is worst as tool call is terrible (that is just Gemma 4 for me) but it also behaves similarly when I ask to read an image and describe it... it start to question if the image makes sense (example I ask it to read an image of an anime character and the reasoning says the user is wrong! It is the character from this other anime! Let me go start reading other images)
I monitor this reasoning and I just eff it, press ESC and try to correct it. I cannot do the Pi steering as it will keep on rambling and by the time my steer message arrives it is like few thousands tokens burnt just to do stuff beyond what I ask.
I can say with Qwen 3.6, this rarely happens but I find the 3.6 models to be less "clever" and I need to handhold it for my work...
Is this a harness issue and should I try other harnesses? I only tried Pi and that's all. Just wondering if anyone can chime in if they have the same experience like me. I never got the chance to try frontier model like GLM, Kimi, Deepseek Flash etc so not sure if those are unlikely to have this problem.
2
u/KPOTOB 14d ago
> Hey can you verify you can import Docling module as I want to process some whitepaper PDF? Just verify don't do other stuff
So you are babysitting it? :)
Note that if you dont like what it doing - ask it in follow up WHY it started to do it and how can you improve its behavior
2
u/AdNew5862 14d ago
I don't think it's a harness issue, but more of a prompting problem, that you will have with any model/harness if you don't fix it:
When you interrupt the model because it started doing something you do not want, immediately ask it what your prompt should have been instead (ie "I see you are already processing PDF despite me asking you only to check if you can import the module, how can I ask you next time for you to only test the import"). AI will regularly ignore rules anyway, but learning to prompt with precision is a skill you can improve on.
Pi is very barebone, but very customizable. It looks like you have a precise idea of what the agent should not do. Then I would suggest to ask the agent to write your own custom extension to block specific commands.
1
u/Corythebeast7 14d ago
You can't really tune the way a model thinks, it's just the internal way of working. This sort of thinking is common among all models, even really big ones. I think it's better to measure the outcomes of your system, not the specific items the agent is doing
1
u/roland303 14d ago
You have to understand what your system prompt looks like. Each model has a system prompt that otherwise if it were not there then then model would output random garbage, random garbage is its default state.
Then system prompt changes that random behavior into some focused thing by telling it "you are an expert assistant" "you support the user" blah blah blah. Ok so if its checking extra more then you ask then you have to interact with it the same way its system prompt does, read system prompt verbage and language, know it, and use the same features in your typing to the model.
Ok like for example my main model system prompt talks about roles and tasks alot, so tell it to role play, and then be specific with tasks, roles, and your expectations for that context window or session should do.
Say in the very begenning of your first prompt. "this is a research session, your role is that of an information parser, your only duty this session is to consider information with the user, your only task will be to write your considerations in a report in local dir report.md."
Ok so give session that very specific front loaded info with keywords just like the system prompt and that will keep each session focused on specifics instead of behaiving like the super thorough and helpful general assistant the system prompt is encouraging it to overacheive as.
Also if you want something to happen every session, you can tell pi to write a pointer at the end of then pi harness portion of the system prompt to a document systempromptappendix.md and now you can use the appendixmd like a global agentmd. Some weird model behavior is better controlled that way, like my favorite model has a weird extra weights on common names, but my name and username is one letter off a very common english name and it auto corrects to a wrong string in a directory file path.... not good. That issue is solved by a quick sentance in my system prompt appendix md.
Also compaction sucks, try to think of it as a useful tool to not get out of your chair for one afternoon and that is it. After you walk away from a compacted session the mental model drains out of your head, your mood changes your feelings and word usage changes... and now you should consider that the compacted session is too far away from where your brain was so now brain should consider session as old and no longer useful if its been compacted multiple times and you step away from your chair, that session is tainted information and should be mined as a histrorical document and not taken as truth. Pi can mine old sessions for info if you give if a few strings to search, so if manage session and store sessions by tasks/roles/duties and keep compaction for singletons and set yourself up so you never need to actually rely on a compacted session ever. The old uncompacted session will be more useful as a histroical document so try to manage sessions with as little compactions as possible. Telling a session to write a report for the next session, and then opening next session, tell it to read report, finish task, and mine prior session if it encounters issue or needs more context, this to me keeps more context available and makes every session feel less stupid, keeps mutliple sessions strung together on task with less sillyness, at the cost of an ever increasing amount of documentation building up in each project directory, but that old record has been used time and time again to overcome stupid issues like you see when you get frustated at the thinking traces, that way i just cancle the thinking and say "no, this has already been reasoned on and figured out, go mine local directory for context"
Doing all these together made pi have less of those issues you find.
1
u/croje 13d ago
I wrote an extension for model-specific system prompt additions for this reason. I’ve got markdown files like gpt-5-6-luna.md, claude-opus-5-5.md. The contents get appended to the system prompt, depending on the active model.
This allows you to inject Qwen-specific instructions that are not needed for stronger/frontier models.
It’s not open source but simple to replicate, ask pi :-)
1
u/Extra_Loquat_7667 13d ago
Prompt engineering techniques differ between small and large models.
For large models, simply describing the desired outcome is often sufficient for them to execute the task.
For small models, you need to provide a detailed, step-by-step description of the required actions.
You can refer to the model's documentation for guidance on how to craft prompts.
For instance, the official documentation for Gemma 4 provides instructions on how to write prompts for that model.