🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

oh-my-prompt

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oh-my-prompt

CLI prompt journal for AI coding assistants — capture, analyze, and sync your prompts

latest
Source
npmnpm
Version
2026.514.1
Version published
Maintainers
1
Created
Source

Oh My Prompt

CLI tool for capturing, analyzing, and syncing AI coding prompts

npm version Node.js License

Oh My Prompt captures your AI coding sessions (Claude Code, Codex, OpenCode, etc.) to a local SQLite database, syncs them to a server, and provides analytics insights into your prompting patterns.

Features

  • Automatic capture: Hook into Claude Code, Codex, OpenCode, and Gemini CLI
  • Tool tracking: Per-prompt log of every tool_use the agent ran (Bash, Edit, Write, Read, WebFetch, etc.) with extracted program name for Bash commands so you can answer "which programs did the agent actually run"
  • Local storage: SQLite database at ~/.omp/prompts.db
  • Server sync: Upload prompts to self-hosted server for analytics
  • Prompt analysis: Get quality scores and improvement suggestions
  • Export/Import: JSONL, CSV, or JSON formats
  • Privacy-first: Redact secrets, responses optional

Installation

npm install -g oh-my-prompt

Using npx (No install)

npx oh-my-prompt setup

From Source

git clone https://github.com/jiunbae/oh-my-prompt.git
cd oh-my-prompt
pnpm install
pnpm build:cli
cd packages/omp-cli
npm link

Quick Start

1. Setup

Run the interactive setup wizard:

omp setup

This will:

  • Create config at ~/.omp/config.json
  • Initialize SQLite database
  • Detect installed CLIs (Claude, Codex, OpenCode)
  • Optionally configure server sync

2. Install Hooks

Install hooks for your CLI(s):

omp install claude      # For Claude Code
omp install codex       # For Codex
omp install opencode    # For OpenCode
omp install all         # For all detected CLIs

This adds prompt capture hooks to:

  • Claude: ~/.claude/hooks/prompt-logger.sh
  • Codex: ~/.config/oh-my-prompt/hooks/codex/notify.js + ~/.codex/config.toml notify entry
  • OpenCode: ~/.config/oh-my-prompt/hooks/opencode/omp-opencode-plugin.mjs + ~/.config/opencode/opencode.json plugin entry

3. Verify Setup

omp status

Expected output:

Server: https://your-server.example.com (or not configured)
Token: configured / not configured
Storage: sqlite
SQLite: /Users/you/.omp/prompts.db
Hooks: claude=installed, codex=installed, opencode=installed
Last capture: 2026-02-08T10:30:00.000Z
Queue: 0 files, 0 bytes

4. Use Your CLI

Just use Claude Code, Codex, or OpenCode normally:

claude "Write a function to parse TOML"
codex "Add error handling to this file"
opencode run "Add retry logic to the sync command"

Prompts are automatically captured!

5. View Stats

omp stats
omp report
omp analyze <prompt-id>

Start with Agent

Copy-paste this prompt into your coding agent to install Oh My Prompt with interactive setup:

Install Oh My Prompt from https://github.com/jiunbae/oh-my-prompt on this machine.

Before running commands, ask me to choose only the install method:
1) npm install -g oh-my-prompt (recommended)
2) npx oh-my-prompt setup (no global install)
3) from source (git clone + pnpm build:cli)

After installation, run:
  omp setup

Important:
- Do NOT use setup flags like --server, --token, --hooks, --yes.
- Use the interactive wizard only, and let me provide values directly in the prompts.
- Ask me each setup input in order (server URL, auth/login or token, device name, hook install confirmations).

After setup completes, verify with:
- omp doctor
- omp status

Finally, show exactly what was configured (hooks, server URL, and token status).

Commands

Hook Management

omp install [claude|codex|opencode|all]    # Install prompt capture hooks
omp uninstall [claude|codex|opencode|all]  # Remove hooks
omp status                         # Show config and hook status
omp doctor                         # Validate setup and diagnose issues

Data Management

omp sync                           # Sync local prompts to server
omp sync status                    # Show sync history
omp export [--format json|jsonl|csv] [--out file.json]
omp import codex-history [--path ~/.codex/history.jsonl]

Analytics

omp stats [--view overview|projects|sources|hourly|weekday|sessions] [--since 7d] [--group-by day|week|month|project|source|hour|weekday]
omp report [--format text|json] [--since 2026-01-01]
omp analyze <prompt-id>            # Analyze prompt quality
omp analyze --file prompt.txt      # Analyze file
omp analyze --stdin < prompt.txt   # Analyze from stdin

Configuration

omp config get                     # Show full config
omp config get server.url          # Get specific value
omp config set server.url https://your-server.example.com
omp config set server.token YOUR_TOKEN
omp config validate                # Check config validity

Database

omp db migrate                     # Run schema migrations

Low-level

omp ingest --stdin < payload.json  # Manually ingest payload
omp ingest --replay                # Replay failed queue

Configuration

Config file: ~/.omp/config.json

{
  "server": {
    "url": "https://your-server.example.com",
    "token": "your-api-token"
  }
}

Or via CLI:

omp config set server.url https://your-server.example.com
omp config set server.token YOUR_TOKEN

Storage

{
  "storage": {
    "type": "sqlite",
    "sqlite": {
      "path": "/Users/you/.omp/prompts.db"
    }
  }
}

Capture Options

{
  "capture": {
    "response": true,
    "redact": {
      "enabled": true,
      "mask": "[REDACTED]"
    }
  }
}

Environment Variables

Override config with env vars:

export OMP_SERVER_URL="https://your-server.example.com"
export OMP_SERVER_TOKEN="your-token"
export OMP_STORAGE_TYPE="sqlite"
export OMP_SQLITE_PATH="/custom/path/prompts.db"
export OMP_CAPTURE_RESPONSE="true"

Hooks

How Hooks Work

Claude Code:

  • Adds ~/.claude/hooks/prompt_sent.sh
  • Triggered after every claude command
  • Reads env vars: $CLAUDE_PROMPT, $CLAUDE_RESPONSE, $CLAUDE_SESSION_ID

Codex:

  • Adds/updates notify in ~/.codex/config.toml
  • Triggered on agent-turn-complete events
  • Parses Codex event JSON

OpenCode:

  • Adds a plugin path in ~/.config/opencode/opencode.json
  • Plugin listens to session.idle events
  • Captures the latest user/assistant turn pair per session

Custom Hook Environment

Set OMP_BIN to use a custom omp binary:

export OMP_BIN="/custom/path/to/omp"

Manual Hook Installation

If auto-install fails, manually add to ~/.claude/config.toml:

[[hooks]]
name = "oh-my-prompt"
on = "prompt_sent"
script = "/Users/you/.omp/hooks/claude_prompt_sent.sh"

Analytics Features

Prompt Quality Score

omp analyze <prompt-id>

Output:

Score: 85 (Good)
Signals:
- Goal: present
- Context: present
- Constraints: missing
- Output format: present
- Examples: missing
Suggestions:
- Add specific constraints or requirements
- Include examples of expected output

Stats Report

omp stats --view weekday --since 7d

Output:

┌──────────────────────────────────────────────────────────────┐
│ Local Analytics                                             │
│ Range: 7d -> now                                            │
└──────────────────────────────────────────────────────────────┘

Top Projects
api       ██████████████████████████ 42  6.2k tok · 88% rsp
frontend  ████████████████░░░░░░░░░ 27  3.8k tok · 91% rsp

Grouped By weekday
Mon       ██████████████████████████ 18  2.1k tok · 94% rsp
Tue       ████████████████████░░░░░░ 14  1.8k tok · 86% rsp

Report

omp report --since 2026-02-01

Generates:

  • Total prompts, tokens, words
  • Prompts per day/project
  • Quality score distribution
  • Top projects
  • Improvement suggestions

Sync to Server

Setup Server Sync

  • Get an API token from your Oh My Prompt server

  • Configure sync:

    omp config set server.url https://your-server.example.com
    omp config set server.token YOUR_TOKEN
    
  • Run initial sync:

    omp sync
    

Automatic Sync

Add to your shell profile (~/.zshrc or ~/.bashrc):

# Sync prompts every hour
(crontab -l 2>/dev/null | grep -Fv 'omp sync' ; echo "0 * * * * /usr/local/bin/omp sync # oh-my-prompt") | crontab -

Or use a background service (launchd on macOS, systemd on Linux).

Manual Sync

omp sync                  # Sync all new prompts
omp sync --since 2026-01-01  # Sync from date
omp sync --dry-run        # Preview sync
omp sync status           # Show sync history

Export / Import

Export

omp export --format jsonl --out prompts.jsonl
omp export --format csv --out prompts.csv --since 2026-01-01
omp export --format json > prompts.json

Import

omp import codex-history --path ~/.codex/history.jsonl
omp import codex-history --dry-run  # Preview

Troubleshooting

Hooks Not Working

  • Check hook status:

    omp status
    
  • Run doctor:

    omp doctor
    
  • Manually test hook:

    bash ~/.omp/hooks/claude_prompt_sent.sh
    
  • Check logs:

    tail -f ~/.omp/state.json
    

Sync Failing

  • Check config:

    omp config validate
    
  • Test connectivity:

    curl -H "Authorization: Bearer YOUR_TOKEN" https://your-server.example.com/api/health
    
  • Force sync:

    omp sync --force
    

Database Issues

omp db migrate            # Run migrations
omp config get storage.sqlite.path  # Check DB location
sqlite3 ~/.omp/prompts.db ".schema"  # Inspect schema

Development

Build from Source

git clone https://github.com/jiunbae/oh-my-prompt.git
cd oh-my-prompt
pnpm install
pnpm build:cli
cd packages/omp-cli
npm link

Run Tests

cd packages/omp-cli
npm test

Project Structure

packages/omp-cli/
├── bin/omp              # CLI entry point
├── lib/                 # Core modules (copied from src/omp/)
│   ├── cli.js           # Command router
│   ├── config.js        # Config management
│   ├── db.js            # SQLite operations
│   ├── hooks.js         # Hook installation
│   ├── ingest.js        # Payload processing
│   ├── sync.js          # Server sync
│   └── ...
└── package.json

Contributing

Contributions welcome! Please:

  • Fork the repo
  • Create a feature branch: git checkout -b feature/my-feature
  • Commit changes: git commit -m 'Add my feature'
  • Push to branch: git push origin feature/my-feature
  • Open a Pull Request

License

MIT © Jiun Bae

Acknowledgments

  • Inspired by oh-my-zsh and prompt engineering best practices
  • Built for Claude Code, Codex, and OpenCode users
  • Uses better-sqlite3 for fast local storage

Keywords

cli

FAQs

Package last updated on 14 May 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts