Add provider-specific context file loading extension for Pi coding agent
Session from pi-extensions-sessions on Hugging Face by thomasmustier · MIT · condensed by Coders Talk
Make Pi's project-context loading (AGENTS.md/CLAUDE.md) provider-aware so different models (Claude, Codex, Gemini) get different steering, then package this as a proper extension repo.
- +0Prompt · +0Pi always loads AGENTS.md over CLAUDE.md regardless of model; can we make context loading provider-aware?
- +0mAgent did · +0mExplored pi-mono repo's system-prompt.ts and extension API, discovered 0.37.5 lets extensions query the active model, then designed a supplementing/dedup scheme for provider-specific context files (CLAUDE.md, CODEX.md, GEMINI.md) alongside core AGENTS.md.
- Break · 2h 27m away, not counted
- +49mAgent did · +49mImplemented provider-context.ts extension, passed lint/type checks, moved it into a new ~/pi-extensions repo, committed and pushed.
- +1h 1mIntervention · +1h 1mReviewed the paraphrased CODEX.md and asked for a near-verbatim lift-and-shift from steipete's AGENTS.md instead, only swapping personal details.Why: It reads totally generic. I wanted the real content adapted, not a generic rewrite that lost all the specific, useful guidance.
- Break · 7h 22m away, not counted
- +1h 20mAgent did · +1h 20mTested the extension by invoking pi directly with different --provider/--model flags, fixed the openai vs openai-codex provider mismatch, and confirmed AGENTS.md plus the right provider file both load.
- Break · 30m away, not counted
- +1h 28mIntervention · +1h 28mChanged mind on the flat extensions/ layout and asked to restructure into one folder per extension (context files, setup script, README together) with better naming.Why: I changed my mind - grouping by extension with its own setup and README makes more sense than one shared setup.sh and a generic 'context' name.
- +1h 42mIntervention · +1h 42mAfter several mermaid diagram rewrites (simplified, colored, hierarchical), asked to revert back to the very first, simplest diagram.Why: I liked the original chart better - the newer ones got too complicated to read.
- +2h 13mIntervention · +2h 13mQuestioned why AGENTS.md lived in the extension's templates at all, since Pi core already loads the user's own AGENTS.md; had it removed from templates and setup.sh.Why: Users already have their own AGENTS.md - it's not our job to provide or overwrite that, only the provider-specific files.
- +2h 15mAgent did · +2h 15mWorked through fresh-install edge cases: warned users when no AGENTS.md exists, offered to copy an existing CLAUDE.md into AGENTS.md, then added dedup logic in the extension itself to skip loading a provider file if its content is identical to AGENTS.md.
- +2h 41mOutcome · +2h 41mFinal repo structure (agent-guidance, tab-status, arcade) cleaned up and pushed across ~10+ commits; all extensions and context files symlinked into ~/.pi/agent/ locally and verified working via live model switches.
Next time I'd open with the full picture up front - that I wanted a reusable, documented extension repo, not just a one-off fix - since a lot of turns went into restructuring folders and diagrams after I kept changing my mind. The correction that did the most real work was catching that AGENTS.md shouldn't live in our templates at all, since it's the user's own file; that reframing is what made the setup script and dedup logic in the extension actually correct.