@tduyng/pi-session0.0.2
Session lifecycle: name an unnamed session after its first message, and resume once a provider quota resets.
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.
Reports 0
No reports yet.
Readme
@tduyng/pi-session
Session lifecycle: sessions name themselves and resume once a provider quota resets. No more untitled rows in the picker, no more waiting out a usage limit by hand.
Auto-name
A new session starts unnamed. On agent_end, the extension reads the first user message and uses it as the name. It takes the first line, strips a leading / or #, collapses whitespace, and limits the result to 60 characters, cutting at a word boundary.
An expanded skill uses its argument when one is present, or the skill name when it has no argument. The extension ignores the expanded instructions and the skill's filesystem path. A /skill:name task command follows the same rule and uses task when present. A Skill invocation protocol message without a skill block is skipped because an extension injected it. A name you set with /name always wins. Naming runs last and swallows its own errors. It is cosmetic and never blocks the turn.
The extension finds the first user-role message in the event.messages array. If the message content is a block array, it extracts text blocks and joins them with spaces. When no user message exists, naming is skipped silently.
Before: a week of 2026-09-01 14:22, 2026-09-01 14:47, 2026-09-02 09:03. After: fix retry backoff, review auth diff, migrate schema.
Autoresume
When a provider quota exhaustion kills a turn, the extension parses a reset time from the error text. Formats it accepts:
- Epoch timestamps:
limit reached|1757193000 - ISO timestamps:
resets at 2026-09-06T23:30:00+02:00 - Relative times:
try again in 2h 15m,retry after 3600 seconds - Clock times:
resets 11:30pm (Europe/Paris),reset at 23:30 - Retry-after headers:
retry-after: 3600
For claude-bridge sessions where the error carries no reset time, autoresume queries the Anthropic OAuth usage endpoint and picks the latest reset among all exhausted windows, with the credential from the macOS keychain (Claude Code-credentials) or ~/.claude/.credentials.json.
A 5-second safety delay is added past the reset time. The timer caps at 24 hours. A parsed reset further than 24 hours out schedules nothing and posts a warning: Usage limit resets in over 24h, auto-resume not scheduled. Any user turn or session shutdown cancels it. The resume sends a real user message: "The usage limit has reset. Continue the previous task from where it stopped."
Commands: /autoresume, /autoresume status, /autoresume on, /autoresume off, /autoresume cancel.
Design
Auto-naming reads at agent_end, when real conversation content exists. Autoresume touches no session storage and adds no tools beyond the one command. Session creation, storage, and selection stay with pi.
Install
pi install npm:@tduyng/pi-session
Local checkout: pi install /path/to/dotfiles/pi/agent/extensions/pi-session
Configure
None. It works out of the box.