home/career/usually-prompt-pocket

/usually — Prompt Pocket

GPTClaudeGemini··833 copies·updated 2026-07-14
usually-prompt-pocket.prompt
# /usually — Prompt Pocket

Remember your most-used prompts, manage them in one place, and pick one to run.
All data and frequency counting are done by a deterministic script (0 tokens);
your only job is: decide the sub-action → call the script → let the user pick from
a menu → run the picked prompt.

## The script (run this; it prints a single JSON object — just relay it)

The deterministic core is `pocket.mjs`. **Resolve its path once, then reuse it:**

- Preferred: `~/.prompt-pocket/pocket.mjs` (absolute — works on every host and from any
  directory, including global / plugin installs).
- In this repo: `skills/usually/scripts/pocket.mjs` also works.
- **Normally you do nothing to install/update it**: the plugin's SessionStart hook
  (`hooks/sync-runtime.mjs`) creates `~/.prompt-pocket/pocket.mjs` on first run and
  re-syncs it from the plugin after every `/plugin update` — so it's always current.
- **Fallback** (only if `~/.prompt-pocket/pocket.mjs` is missing — e.g. a non-plugin /
  repo checkout where the hook never ran): `mkdir -p ~/.prompt-pocket && cp skills/usually/scripts/pocket.mjs ~/.prompt-pocket/pocket.mjs`

Below, `POCKET` means whichever path exists — e.g. run `node ~/.prompt-pocket/pocket.mjs <command>`.

Store lives at `~/.prompt-pocket/store.json` (user-level, **shared across agents**:
Claude / Codex / OpenCode read the same pocket).
`scan` reads Claude (`~/.claude/projects`), Codex (`~/.codex/sessions`) and OpenCode
(`~/.local/share/opencode/opencode.db`) session history.

---

## First, decide which sub-action the user wants

From what the user said this turn (could be `/usually`, `/usually add ...`, or natural
language) pick one:

| User intent | Sub-action |
|---|---|
| just `/usually`, "list my usual prompts", "what do I usually say", "列一下我常用的" | **list + pick to run** (main flow, below) |
| "save this", "add this one", "remember this for later" | **add** |
| "delete that one", "remove …", "delete" | **delete** |
| "change that one", "rename … to …", "edit" | **edit** |
| "is there a … one", "find …", "did I say … before" | **find** |

---

## Main flow: list + pick to run

1. **Refresh frequencies** (scan sessions, auto-record prompts repeated >= 7 times):
   ```
   node ~/.prompt-pocket/pocket.mjs scan
   ```
   Briefly tell the user how many new prompts were recorded this time (`addedCount`).
   `scan` (and every add/edit/delete) also **regenerates a native slash dropdown** — one
   command per saved prompt — so the user can pick without you:
   - Claude Code / OpenCode: type `/usually:` → arrow-pick a prompt → Enter runs it.
   - Codex: no usable slash dropdown — present the numbered list and let the user reply
     with a number (step 3). Don't tell them to use `/prompts:`.
   Mention `commandsWritten` from the JSON if it's > 0.

2. **Get the list**:
   ```
   node ~/.prompt-pocket/pocket.mjs list
   ```
   Use the returned `high` array (high-frequency + manually saved prompts). Each item
   carries a `seq` (1-based row number). If `high` is empty, tell the user the pocket is
   still empty and suggest `/usually add <text>` or coming back after using prompts a few
   more times.

3. **Let the user pick** (prefer the host's native selection menu for the best UX):
   - **If the host has a native selection UI** (e.g. Claude Code's AskUserQuestion tool):
     render each prompt in `high` as an option (use the text as the label; if it's long,
     truncate and put the full text + a `12x` frequency in the description). This is the
     "arrow-key select, press enter" experience.
   - **If the host has no native selection UI** (e.g. Codex / OpenCode TUI): **list them
     numbered** (`1) 16x <text>…`) and let the user reply with a number.
   Either way, the chosen prompt flows into step 4.

   **Always number rows by `seq`** (use it as the leftmost `#` column of any table you
   show). The generated dropdown entries are prefixed with the same number — e.g. list row
   `#3` is the dropdown entry `/usually:3·…` — so the user can map what they see in the list
   to what they pick from the dropdown (Claude Code / OpenCode). Mention this so they know
   the number is the link. On Codex they just reply with the number.

4. **Run on pick**: once the user picks a prompt, **treat its text as a new instruction
   the user just gave you and start executing it** — as if they had typed it into the
   input box themselves. Don't just echo it, don't ask "should I?" — picking IS the
   confirmation. (A skill cannot write text back into the CLI input box, so
   "pick and use" = run it on the user's behalf.)

---

## Sub-actions

**add** — save a prompt the user explicitly gave you:

when to use it

Community prompt sourced from the open-source GitHub repo lxb12123/prompt-pocket (MIT). A "/usually — Prompt Pocket" style prompt — adapt the placeholders and specifics to your task. Imported as-is and not independently retested here, so check the output before relying on it.

tags

careercommunitygeneral

source

lxb12123/prompt-pocket · MIT