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

@centerforagenticai/pi-context-aware

v0.5.7

Published

Context-budget and compaction handoff support for pi: pressure markers, seed rewriting, proactive compaction, prior-session search, and context cache.

Readme

@centerforagenticai/pi-context-aware

Kind: extension · Status: stable · Pi: * · Node: >=22.19.0

Context-aware helps long Pi sessions keep their purpose through compaction. It tracks context pressure, turns short handoff seeds into self-contained prompts, and carries durable focus, tasks, and selected reference material into the next phase.

What it does

  • Shows context pressure and usable output headroom without changing the prompt on every tool call.
  • Rewrites /compact-then and compact_session seeds before Pi compacts the conversation.
  • Can compact proactively when context usage or output headroom reaches a configured limit.
  • Preserves a prior-transcript reference and exposes bounded prior-session search.
  • Keeps optional durable focus, session tasks, and scoped context-cache documents across compaction.
  • Repairs orphaned tool results before provider requests leave the process.
  • Offers a typed protocol-v1 service for other Pi extensions.

The detailed behavior, recovery rules, and examples are in commands and concepts.

How it fits

The compact-and-continue handoff

The handoff sequence

The agent starts a handoff with compact_session or /compact-then. Context-aware resolves or generates a raw seed, asks the active model to rewrite it when rewriting is enabled, then gives the final seed to Pi as compaction guidance. After Pi drains queued input, context-aware delivers the seed once to start the next phase. In a worker session, it records a round-boundary request instead of starting a new turn.

The extension also listens to Pi lifecycle events. It records stable telemetry, task, focus, cache, and transcript metadata in the session without treating those records as user instructions.

Install and enable

Install the public package with Pi:

pi install npm:@centerforagenticai/pi-context-aware

Restart Pi or run /reload. The package declares Pi peer dependencies as *; its deterministic compatibility gate currently pins and tests Pi 1.0.0. It needs Node >=22.19.0.

For a local checkout, add its absolute path to the packages array in ~/.pi/agent/settings.json, run npm run build, then restart Pi or run /reload. The manifest loads ./dist/index.js.

For seeded automatic handoffs, let context-aware own automatic compaction and turn off Pi's native automatic threshold checks:

{
  "compaction": { "enabled": false }
}

Manual /compact, /compact-then, and compact_session remain available. See configuration for ownership warnings and the complete settings.

Surface

| Kind | Name | Purpose | | --- | --- | --- | | Tool | compact_session | Compact at a clean phase boundary and continue from a self-contained seed. Available when summarizer.enabled is true. | | Tool | session_focus | Read or update one optional durable objective. | | Tool | session_tasks | Maintain a one-level checklist that survives compaction. | | Tool | search_prior_sessions | Search bounded transcript snippets from earlier sessions or compacted-away current history. | | Tool | session_recall | Search the context cache and session history together. | | Tool | session_compaction_history | Report current-branch compaction counts and boundary identifiers. | | Command | /compact-then [seed] [--model provider/id] | Run the seeded handoff flow. Available when summarizer.enabled is true. | | Commands | /context-status, /context-aware-* | Inspect pressure and configure seed, model, ambiguity, and proactive behavior. | | Commands | /focus, /sessions, /tasks, /checkin | Inspect durable workstream state, task state, and session health. | | Commands | /context-cache-* | Inspect and manage scoped context-cache documents. | | Export | @centerforagenticai/pi-context-aware/context-service | Discover the typed protocol-v1 service over pi.events. |

Every command, parameter, and example is in commands and concepts, configuration, and session tasks. The service contract is in context-service.md.

Configuration

Settings come from built-in defaults, ~/.pi/agent/context-aware.json, trusted project .pi/context-aware.json, CLI flags, session policy, and host policy. Later layers win per key.

| Key | Default | Purpose | | --- | --- | --- | | seedMode | "auto-gen" | Generate a seed when /compact-then has none. | | seedRewrite | true | Rewrite raw seeds into self-contained prompts. | | seedAuthorityGuard | "warn" | Check generated handoffs against session authority. | | ambiguityMode | "inherit" | Ask, proceed cautiously, or proceed automatically when a seed is unclear. | | compactionModel | null | Use the active model unless a summary model is named. | | overflowFallbackModel | null | Keep overflow recovery on the primary model unless another model is named. | | summarizer.enabled | true | Own the compaction summary hook and register handoff surfaces. | | proactiveCompaction.enabled | true | Prepare a handoff before the context limit; threshold defaults to 0.78. | | contextCache.enabled | true | Surface scoped cache documents; the default scope is "worktree". | | restartNotice.enabled | true | Remind the agent to re-check volatile state after time away. | | workstream.enabled | true | Enable durable focus and bounded session projections. | | sessionNaming.scope | "all" | Name sessions with a bounded lightweight-model chain. |

Read configuration for the full JSON shape, every leaf, precedence details, runtime flags, defaults, and recovery behavior.

When it runs

The extension starts session-scoped services on session_start and tears them down on session_shutdown. It adds stable context guidance before agent work, appends one pressure snapshot per outer user turn, and updates pressure after messages, model changes, and turns.

At turn_end and agent_settled, it may prepare proactive compaction, continue an active task list, name the session, or record durable activity. At session_before_compact, it can produce the summary, cache artifacts, and handoff metadata. At session_compact, it records the completed boundary and schedules the next-phase seed. Features stay idle when disabled, when no relevant state exists, or when a worker host owns the round boundary.

Develop

The source is maintained in a private repository and published as release snapshots; contributions are welcome as pull requests on GitHub, which maintainers carry into the source repository.

npm install
npm test

Documentation

License

MIT. See LICENSE.