oh-my-prompt
v2026.218.0
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, 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 via shell scripts
- 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)
- 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 all # For bothThis adds prompt capture hooks to:
- Claude:
~/.claude/hooks/prompt_sent.sh - Codex:
~/.codex/notify.js(or merges with existing)
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
Last capture: 2026-02-08T10:30:00.000Z
Queue: 0 files, 0 bytes4. Use Your CLI
Just use Claude Code or Codex normally:
claude "Write a function to parse TOML"
codex "Add error handling to this file"Prompts are automatically captured!
5. View Stats
omp stats
omp report
omp analyze <prompt-id>Commands
Hook Management
omp install [claude|codex|all] # Install prompt capture hooks
omp uninstall [claude|codex|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 [--since 2026-01-01] [--group-by day|week|project]
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
~/.codex/notify.js - Triggered on
agent-turn-completeevents - Parses Codex event JSON
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 --group-by weekOutput:
Overall:
{ total: 1234, avgLength: 450, avgTokens: 600 }
Grouped:
┌─────────┬───────┬───────┬───────────┐
│ week │ count │ avgLen│ avgTokens │
├─────────┼───────┼───────┼───────────┤
│ 2026-06 │ 120 │ 420 │ 580 │
│ 2026-07 │ 145 │ 480 │ 620 │
└─────────┴───────┴───────┴───────────┘Report
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 and Codex users
- Uses better-sqlite3 for fast local storage
