omp packages

@miraiforge/pi-jbcontext0.2.0

Pi extension that mirrors the JetBrains Context (jbcontext) agent hooks: session-boundary indexing and bootstrap-first semantic-search reminders

aditzel Published 8 days ago MIT ~305 downloads/mo

Untested on omp

This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

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:

  1. When the relevant file is unknown, run one broad jbcontext search first.
  2. Read at least one returned file and inspect nearby code locally.
  3. 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
  • jbcontext CLI on PATH, logged in (jbcontext login), with the project indexed (jbcontext index). See jbcontext doctor for an end-to-end self-test.

Install

pi install npm:@miraiforge/pi-jbcontext

Or try it without installing:

pi -e npm:@miraiforge/pi-jbcontext

ENFORCE 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 pi

What 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
npm test                         # dependency-free regression tests and coverage
pi -e ./extensions/jbcontext.ts   # smoke test in any indexed repo

Tests use Node's built-in runner and TypeScript stripping (Node 22.8+), with minimum 90% line and branch coverage enforced. They verify JSON payload delivery, stdin closure, and silent failure handling, including a real subprocess that reads its input until EOF. No jbcontext login, network access, or indexed project is needed for the automated tests.

License

MIT