omp packages

@robhowley/pi-session-hygiene0.3.0

A tiny Pi extension that adds a session-health light to the status bar.

GitHub Actions Published 12 days ago ~230 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

session-hygiene

A tiny Pi extension that adds a session-health light to the status bar.

๐ŸŸข ctx ok
๐ŸŸก ctx watch
๐Ÿ”ด ctx compact

Health is based on:

  • Cumulative assistant cost for the current session branch
  • Current context tokens from ctx.getContextUsage()

The extension also publishes a separate cache chip when token usage data is available:

  • Prompt cache hit rate as cache <percent> from cacheRead / (input + cacheRead)

It only updates the status bar. It does not prompt, auto-compact, or inject guidance into responses.

Status Example

~/src/my-project (main)
โ†‘34 โ†“18k R868k W175k $1.982 7.4%/1.0M (auto)
๐ŸŸก ctx watch
cache 98%

Default Thresholds

Level Cost Context
๐ŸŸก Yellow $5 100K tokens
๐Ÿ”ด Red $15 200K tokens

Command

/session-hygiene

Opens interactive threshold configuration. You can pick a preset or enter custom values, then the status bar refreshes immediately.

Configuration

Config lives at ~/.pi/agent/extensions/session-hygiene/config.json:

{
  "yellow": { "cost": 5, "context": 100000 },
  "red": { "cost": 15, "context": 200000 }
}

If the file is missing or invalid, the extension falls back to the Default preset. Successful saves use 0600 permissions.

Presets

Preset Yellow Red
Conservative $2 / 60K tokens $8 / 120K tokens
Default $5 / 100K tokens $15 / 200K tokens
Relaxed $10 / 150K tokens $25 / 250K tokens
Custom you decide you decide

Validation rejects non-positive or non-numeric values, and any config where yellow is not strictly below red.

When It Updates

  • session_start โ€” reload config, reconstruct assistant cost from branch history, paint the status bar
  • turn_end โ€” add the latest assistant cost and cache stats, refresh the status bar
  • session_compact โ€” reset running cost/cache totals and repaint from current context usage