@ibeex/pi-fetch
pi extension that fetches web content into session context with Jina/raw fallback and cleaned previews
Package details
Install @ibeex/pi-fetch from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@ibeex/pi-fetch- Package
@ibeex/pi-fetch- Version
0.1.0- Published
- Apr 16, 2026
- Downloads
- 122/mo · 7/wk
- Author
- ibeex
- License
- unknown
- Types
- extension
- Size
- 33.4 KB
- Dependencies
- 0 dependencies · 2 peers
Pi manifest JSON
{
"extensions": [
"./index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
@ibeex/pi-fetch
Installable pi package that adds a /fetch slash command.
Published package name: @ibeex/pi-fetch
Repository: https://github.com/ibeex/pi-fetch
/fetch retrieves web content and injects it into pi's session context so the next prompt can use it.
Features
/fetch <url>only- uses
jinafor normal public URLs andrawfor localhost, private-network, and other likely local URLs - retries Jina once with auth on 401/429/auth-required style responses
- loads Jina API key from
JINA_API_KEY,JINA_API_TOKEN, orpass api/jina - supports site-specific cleanup before truncation
- currently cleans Hacker News item pages so the model sees story metadata + comment text instead of repetitive UI noise
- shows a live footer status while fetching
- shows a visible fetch result row in chat; expand it with
Ctrl+Oto inspect what was captured - truncates fetched content before injecting it into context
- when truncation happens, only the first
PI_FETCH_MAX_CONTEXT_CHARSchars are added to context and the full fetched response is saved to a temp file - default fetch context limit is
28000chars, roughly~7ktokens for normal English text - stores fetched content as a hidden custom session message, so it is available to the model without cluttering chat
Install
Because this repo now has a package.json with a pi manifest, you can install it as a pi package.
Install from npm
pi install npm:@ibeex/pi-fetch
Clone the repository
git clone git@github.com:ibeex/pi-fetch.git
cd pi-fetch
Install globally
pi install /absolute/path/to/pi-fetch
Install into another project
From the target project directory:
pi install /absolute/path/to/pi-fetch -l
Then start pi in that project, or run:
/reload
Quick test without installing
From outside this repo:
pi -e /absolute/path/to/pi-fetch
If you test from inside this repo and already have another copy of @ibeex/pi-fetch auto-loaded, disable extension auto-discovery to avoid duplicate /fetch commands:
pi --no-extensions -e .
Or load the raw extension file directly:
pi --no-extensions -e ./index.ts
Usage
/fetch https://example.com/docs
/fetch http://localhost:3000/health
After /fetch, ask a normal question in the next prompt, for example:
/fetch https://example.com/docs
What are the main points from that page?
In interactive mode, /fetch also shows:
- a temporary footer spinner while the request is running
- a visible result row after completion
- a short collapsed preview of the captured content
- expandable details with
Ctrl+O, including the exact content that was injected into context
Jina auth
Lookup order:
JINA_API_KEYJINA_API_TOKENpass api/jina
Example:
pass insert api/jina
Optional env vars
PI_FETCH_TIMEOUT_MSdefault30000PI_FETCH_MAX_CONTEXT_CHARSdefault28000(roughly~7ktokens)PI_FETCH_JINA_PASS_PATHdefaultapi/jina
Notes
- This is intentionally slash-command based, not an LLM tool.
/fetchadds context for the next prompt; it does not automatically ask the model a follow-up question.PI_FETCH_MAX_CONTEXT_CHARSonly affects fetched-page context from this extension.truncatedmeans the fetched response was larger thanPI_FETCH_MAX_CONTEXT_CHARS, so only the first chunk was injected into model context.- If truncated, the visible result row shows how many chars were kept vs omitted, and expanded details show the temp file path for the full response.
- The visible fetch result row is filtered out of model context; only the hidden fetched-content message is sent to the model.
- Jina reader is used only for public web URLs. Localhost, private-network, and other likely local URLs use raw fetch automatically.