npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

pi-invisible-continue

v0.3.3

Published

Invisible session continuation for pi — resume the agentic loop without sending ANY prompt the LLM can see

Downloads

1,407

Readme

👻 pi-invisible-continue

Invisible session continuation for pi

Resume the agentic loop without the LLM seeing any new prompt at all.

pi extension license


The Problem

Every existing "continue" extension sends a visible user message to the LLM:

| Package | What the LLM sees | |---------|-------------------| | pi-continue | "Continue from the same-session pi-continue/v3 handoff Pi just saved..." (full handoff doc) | | pi-hodor | "continue" (literal text) | | pi-auto-continue | "continue" (literal text) | | pi-retry | "Continue" on max-tokens, or hidden custom trigger on errors |

Every one of those changes the LLM's context with new user text. That text influences the next response, sometimes in unintended ways — model changes course, re-reads things it already processed, or treats a bare "continue" as a new task.


The Solution

pi-invisible-continue captures the internal Agent instance via a prototype monkey-patch on Agent.prototype.prompt. When /continue is invoked, it calls agent.prompt([]) directly — starting a fresh agent loop with an empty prompt array. No message is injected into the context at all:

  • The agent loop restarts
  • The LLM receives the exact same message list it had before
  • No new text, no handoff, no pollution, no session artifact
  • Nothing in convertToLlm's path — no filtering needed

How It Works

Extension loads
  → Monkey-patches Agent.prototype.prompt to capture the Agent instance
  → First real prompt stores the reference

User types "/continue"
  → agent.prompt([]) called directly
  → runAgentLoop([], contextSnapshot, ...)
  → prompts array is empty — no message emitted, no message pushed to context
  → runLoop → streamAssistantResponse → convertToLlm(unmodified messages)
  → LLM sees same messages as before → responds naturally

Why agent.prompt([]) and not agent.continue()?

agent.continue() has a guard that throws Cannot continue from message role: assistant when the last message is from the assistant — which it always is when the agent stops. agent.prompt([]) starts a fresh loop from the current context snapshot without that restriction.

Trade-off: bypasses AgentSession

agent.prompt([]) is called on the Agent directly, bypassing AgentSession._runAgentPrompt(). This means auto-compaction is not triggered after a /continue. Auto-retry is not a concern — pi-retry covers that gap by listening for agent_end events and re-triggering the loop on errors. Since the agent still emits events through AgentSession's subscriber, pi-retry's handlers fire normally even after an agent.prompt([]) continuation.


Usage

Once loaded, use /continue:

| Command | What it does | |---------|-------------| | /continue | Resume the loop invisibly. Waits for idle, then fires. | | /continue status | Show agent idle state, captured-agent status, and last assistant text (debug). | | /continue help | Show this reference. |


Installation

pi install npm:pi-invisible-continue

Or install from GitHub:

pi install https://github.com/monotykamary/pi-invisible-continue

Or in ~/.pi/agent/settings.json:

{
  "packages": [
    "https://github.com/monotykamary/pi-invisible-continue"
  ]
}

Then /reload or restart pi.

For quick one-off tests:

pi -e ./continue.ts

Comparison with Other Packages

| Feature | pi-invisible-continue | pi-continue | pi-hodor | pi-auto-continue | |---------|----------------------|-------------|----------|-------------------| | LLM sees new user text | ❌ No | ✅ Handoff doc | ✅ "continue" | ✅ "continue" | | Session pollution | None | Full compaction entry + user message | 1 user message | 1 user message | | Mechanism | agent.prompt([]) | sendMessage + handoff | sendMessage | sendMessage | | Auto-triggered | ❌ Manual only | ✅ On compaction | ✅ On error/length | ✅ On agent_end | | Retry integration | ❌ | ❌ | ✅ Error patterns | ❌ | | Complexity | Prototype patch + 1 call | 49 files, multi-stage | 2 files, config-driven | 1 file, loop-based |


About the Hack

The extension uses the public @earendil-works/pi-agent-core package (which pi's extension loader resolves to the same module instance used internally) to import Agent and monkey-patch Agent.prototype.prompt. This captures the live Agent instance when pi first calls agent.prompt() during normal operation.

Then /continue calls agent.prompt([]) — an empty prompt array. The runAgentLoop function spreads the prompts into the context messages, so with an empty array, nothing is added. The loop starts from the unmodified context snapshot and the LLM continues naturally.

This is the approach discussed in pi issue #3721 ("Feature request: Resume agentic loop without sending a message"). The upstream fix would be exposing agent.continue() (or a variant that works from assistant last-message) on AgentSession, but this extension achieves the same effect without waiting for a core change.

License

MIT