r/PiGCodingAgent • • Oct 07 '26

Find the extension writting/porting guide from repo is a bit of hard to read, so I write myself this tutorial (with agent :))

https://www.liyu1981.xyz/article/write-extension-for-pig

It is a tutorial on how to write extensions for PiG. It focuses on building the right concepts and an overview of how it works — the necessary foundation for driving a code agent to turn your idea into a good PiG extension.

For a concrete running example, the tutorial builds a small feature: a /prefer command that lets you pin which real service provider serves your session. OpenRouter is a router in front of many real service providers — the same model can be hosted by several of them. An OpenRouter spec can end with a provider suffix:

openrouter/deepseek-v4.1-flash:deepseek
^model ^only this real provider

The trailing :deepseek tells OpenRouter: serve this request from DeepSeek's infrastructure only, never hand it to another host. The extension's job is to let you set that preference from inside the terminal, in one command.

The tutorial walks the full loop, from editor to the little program can spot running on machine:

author → install (local or npm) → first session → the process you can see → (optionally) fuse it into a binary.

If you would like to build a high level concept on PiG's extension, read it here: https://www.liyu1981.xyz/article/write-extension-for-pig

5 Upvotes

1 comment sorted by

1

u/Educational-Yak8793 Oct 07 '26

Great work and thank you for this :) I’m gonna also make sure your pig sprite PR comes in today, go PiG! 🐷