@miraiforge/pi-jbcontext
v0.1.0
Published
Pi extension that mirrors the JetBrains Context (jbcontext) agent hooks: session-boundary indexing and bootstrap-first semantic-search reminders
Maintainers
Readme
pi-jbcontext
A pi extension that mirrors the
JetBrains Context (jbcontext) agent hooks, so pi gets the
same semantic code-search behavior that jbcontext setup-agent installs for Claude Code,
OpenAI Codex, and Junie.
What it does
| jbcontext hook (Claude/Codex/Junie) | pi equivalent (this extension) |
| --- | --- |
| SessionStart → jbcontext index --silent (async) | session_start → detached index refresh |
| SessionEnd → jbcontext index --silent (async) | session_shutdown → detached index refresh |
| session-start-instruct tip | injected once per session via before_agent_start prompt guidelines |
| UserPromptSubmit reminder | input event → tip injected into the following turn |
| PreToolUse on Bash\|Grep reminder | tool_call on bash commands containing grep/rg/find/ack/ag, tip appended to the tool result |
The extension does not reimplement any logic. It shells out to
jbcontext hook <event> — the same internal subcommand the other agents' hooks call —
so the tip wording, the throttle state ("occasional" reminders), and the REMIND/ENFORCE
policy stay identical and pick up JetBrains-side changes for free. Empty hook output is a
no-op, and any CLI failure is silently ignored: jbcontext can never break your session.
The reminder workflow the hooks teach:
- When the relevant file is unknown, run one broad
jbcontext searchfirst. - Read at least one returned file and inspect nearby code locally.
- If that fails, at most one narrowed retry scoped to the best hit's directory
(
jbcontext search -p <path> ...). Never a second broad search.
Prerequisites
- pi
jbcontextCLI onPATH, logged in (jbcontext login), with the project indexed (jbcontext index). Seejbcontext doctorfor an end-to-end self-test.
Install
pi install npm:@miraiforge/pi-jbcontextOr try it without installing:
pi -e npm:@miraiforge/pi-jbcontextENFORCE mode
Default behavior is REMIND: occasional tips. To gate text-search bash commands behind a
bootstrap semantic search (the same as jbcontext hook --mode=ENFORCE):
pi --jbcontext-enforce
# or
JBCONTEXT_ENFORCE=1 piWhat this package deliberately leaves out
- Skills / instructions / subagents — install those with the official CLI:
jbcontext setup-agent --agent=GENERIC --auto(instructions + skill files) or point pi at the generated skill directory. This package is hooks only. - MCP — pi core intentionally ships without MCP; the CLI-first approach above is the idiomatic pi path.
Development
No build step — pi loads TypeScript extensions directly (jiti).
git clone https://github.com/MiraiForge/pi-jbcontext
cd pi-jbcontext
pi -e ./extensions/jbcontext.ts # smoke test in any indexed repoLicense
MIT
