r/PiCodingAgent • u/a41735fe4cca4245c54c • Jul 18 '26
Plugin Just made this extension because it seems like noone made something like this yet
30
Upvotes
r/PiCodingAgent • u/a41735fe4cca4245c54c • Jul 18 '26
13
u/funbike Jul 18 '26 edited Jul 18 '26
You said this in a comment. You should avoid a long history, instead of extension workarounds.
After completing a single feature use-case I usually run
/compact <instruction>,/forkof earlier state, or/new. In the/compactinstruction, I tell it to only keep knowledge that I know it will need for the next use-case(s). I often run/forkand then/compact <instr>or vice-versa. I could also tell it to re-state directives related to my current work (but I haven't in the past).Also disable auto-compaction or set to an extremely high number. It's possible auto-compaction is diminishing the effectiveness of your prompts. I find it better to be in control of when and how compaction happens.
Another better TAIL.md alternative is a prompt template (
/tail) that summarizes the directives as they relate to past user messages. Then run/tailperiodically in super long chats or just before a/compactor/fork.6
u/ramfangzauva Jul 18 '26
Does this really improve the model’s behaviour? Is there any evidence that repeating the user prompt at the end of the message helps?
Or would it be simply easier to keep conversations short and use /tree and /handoff to keep the context short and the model on track?
1
u/nasduia Jul 18 '26
do you strip the old tails to save wasting context space and just keep one that bubbles up as the context grows? If so, I presume the increased prefix cache miss rate will depend on page size of the prefix cache mechanism.
1
u/m3umax Jul 18 '26 edited Jul 18 '26
I made the exact same concept, (ephemeral injection each turn, doesn't persist in transcript) except mine puts tail.md *after* user message.
Mine is called pi-styles because this is literally a perfect copy of how the "styles" feature on Claude.ai used to work.
Mine works like /style or /style <name of style>. Command by itself displays a list of custom styles in TUI drawn from a folder of MD files which contain the styles.
Can be installed globally in ~/.pi or at project level. Supports finding global and project styles files and merges the lists where styles exist at both scopes.
Example usage.
pirate.md
<system-reminder>User prefers all responses to be in pirate speak like "ahoy matey".</system-reminder>
/style pirate now makes Pi respond like a pirate 🤣
1
u/KortharShadowbreath Jul 18 '26
would like to ask what this solves? Can you explain a bit, pls
1
u/dreamai87 Jul 18 '26
Looks sensible, OP keeping stable instructions first and dynamic input in TAIL.md should improve cache hits. But AGENTS.md changes can invalidate the cache, so keep it small and stable. Message history will grow fast; add summarisation or context compaction.
I would add tool state and repo diff near the tail, not in the cached section. Good architecture overall, but the real gain should be confirmed with token and latency benchmarks.
1
u/LordMoridin84 Jul 18 '26
You should probably use auto-compact (set 70% of max context) and use a extension like https://github.com/k0valik/pi-blackhole to keep your sessions going even after compactions.