oh-my-prompt
v2026.514.1
Published
CLI prompt journal for AI coding assistants — capture, analyze, and sync your prompts
Maintainers
Readme
Oh My Prompt
CLI tool for capturing, analyzing, and syncing AI coding prompts
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_usethe agent ran (Bash, Edit, Write, Read, WebFetch, etc.) with extractedprogramname 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
Global Install (Recommended)
npm install -g oh-my-promptUsing npx (No install)
npx oh-my-prompt setupFrom 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 linkQuick Start
1. Setup
Run the interactive setup wizard:
omp setupThis 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 CLIsThis adds prompt capture hooks to:
- Claude:
~/.claude/hooks/prompt-logger.sh - Codex:
~/.config/oh-my-prompt/hooks/codex/notify.js+~/.codex/config.tomlnotify entry - OpenCode:
~/.config/oh-my-prompt/hooks/opencode/omp-opencode-plugin.mjs+~/.config/opencode/opencode.jsonplugin entry
3. Verify Setup
omp statusExpected 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 bytes4. 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 issuesData 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 stdinConfiguration
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 validityDatabase
omp db migrate # Run schema migrationsLow-level
omp ingest --stdin < payload.json # Manually ingest payload
omp ingest --replay # Replay failed queueConfiguration
Config file: ~/.omp/config.json
Server Sync (Recommended)
{
"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_TOKENStorage
{
"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
claudecommand - Reads env vars:
$CLAUDE_PROMPT,$CLAUDE_RESPONSE,$CLAUDE_SESSION_ID
Codex:
- Adds/updates
notifyin~/.codex/config.toml - Triggered on
agent-turn-completeevents - Parses Codex event JSON
OpenCode:
- Adds a plugin path in
~/.config/opencode/opencode.json - Plugin listens to
session.idleevents - 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 outputStats Report
omp stats --view weekday --since 7dOutput:
┌──────────────────────────────────────────────────────────────┐
│ 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% rspReport
omp report --since 2026-02-01Generates:
- 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_TOKENRun 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 historyExport / 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.jsonImport
omp import codex-history --path ~/.codex/history.jsonl
omp import codex-history --dry-run # PreviewTroubleshooting
Hooks Not Working
Check hook status:
omp statusRun doctor:
omp doctorManually test hook:
bash ~/.omp/hooks/claude_prompt_sent.shCheck logs:
tail -f ~/.omp/state.json
Sync Failing
Check config:
omp config validateTest connectivity:
curl -H "Authorization: Bearer YOUR_TOKEN" https://your-server.example.com/api/healthForce 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 schemaDevelopment
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 linkRun Tests
cd packages/omp-cli
npm testProject 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.jsonContributing
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
Links
- GitHub: https://github.com/jiunbae/oh-my-prompt
- npm: https://www.npmjs.com/package/oh-my-prompt
- Issues: https://github.com/jiunbae/oh-my-prompt/issues
- Docs: See docs/
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
