This content goes at ~/.config/opencode.
The prompt enhancer functionality has been reimplemented in Go to replace the original Bash script. The new implementation provides equivalent functionality with improved robustness and maintainability.
The Go prompt enhancer is located in prompt-enhancer/ subdirectory:
cd prompt-enhancer
./prompt-enhancer <command> [model] "prompt text"feature- New Feature Requestchange- New Change Requestrefactoring- New Refactoring Request Specificationtests- New Test Requestbugfix- Critical Bug Fix Requestquestion- Question (no code editing)bare- Bare command (minimal formatting)
# Feature request with default model
./prompt-enhancer feature "Add a new authentication system"
# Question with specific model
./prompt-enhancer question github-copilot/claude-sonnet-4 "How does database work?"
# Question using ask alias (equivalent to question)
./prompt-enhancer ask "What is testing strategy?"
# Test request
./prompt-enhancer tests "Create comprehensive tests for user management"
# Feature request with RFC compliance (lowercase)
./prompt-enhancer feature rfc "Add a new authentication system"
# Feature request with model and RFC compliance (uppercase)
./prompt-enhancer feature qwen3-coder-flash RFC "Add a new authentication system"The prompt enhancer supports command aliases for convenience:
ask→question(Both commands behave identically)
# These two commands are equivalent:
./prompt-enhancer question "How does system work?"
./prompt-enhancer ask "How does system work?"The prompt enhancer supports optional RFC arguments as an alternative to environment variables:
rfc(lowercase) - Equivalent to settingRFC2119=1, includes RFC2119 compliance phraseRFC(uppercase) - Equivalent to settingRFC2119=1, includes RFC2119 compliance phrase and full (well, slightly trimmed) RFC2119 text
The RFC argument can be positioned as second or third argument:
# RFC as second argument (no model specified)
./prompt-enhancer feature rfc "Add authentication"
# RFC as third argument (with model specified)
./prompt-enhancer feature qwen3-coder-flash rfc "Add authentication"DEBUG__LOG_ARGUMENTS=1- Enable argument parsing debug outputDEBUG__SKIP_ENHANCING=1- Skip opencode enhancement stepDEBUG__OUTPUT_FENCES=1- Wrap output in BEGIN/END markersRFC2119=1- Include RFC2119 compliance phraseRFC2119=2- Include full RFC2119 content
Note: Command-line RFC arguments take precedence over RFC2119 environment variable.
The prompt enhancer uses a semaphore file to coordinate with other plugins and prevent conflicts during operation.
The semaphore file is created at: ~/.config/opencode/prompt-enhancer-semaphore
- Creation: The semaphore file is created immediately when
prompt-enhancerstarts - Deletion: The semaphore file is removed when
prompt-enhancerexits (normally or due to error) - Purpose: Other plugins (such as terminal bell plugin) check for this file and skip their actions while helper is running
- Cleanup: If a stale semaphore file exists from a previous crash, it will be automatically removed on startup
Plugins can check for semaphore file using standard file existence checks. For example, terminal bell plugin will not play sounds while semaphore file is present.
The prompt enhancer maintains an automatic log file that records all invocations, allowing you to easily review and re-execute previous commands.
The log file is created at: ~/.config/opencode/prompt-enhancer/log.md
Each invocation is recorded as a Markdown list item with a timestamp:
- [HH:MM:SS] command arg1 arg2 ...Example log file:
- [09:30:15] feature Add authentication system
- [09:35:22] question What is deployment process?
- [09:40:45] tests Create integration tests for API endpoints
- [09:45:12] Created semaphore file
- [09:45:15] Removed semaphore file- Append-only: All entries are appended to the log, preserving chronological order
- Atomic: File operations are atomic, ensuring no data corruption even with concurrent access
- Always recorded: Entries are logged regardless of whether the enhancement succeeds or fails
- Semaphore tracking: Semaphore file creation and deletion are also logged for debugging
- Human-readable: Format is simple and suitable for copying commands for re-execution
go build -o prompt-enhancer/prompt-enhancer ./prompt-enhancercd prompt-enhancer
go test -vThe Go implementation maintains full compatibility with the original Bash script's behavior and output format while providing better error handling, type safety, and testability.
go build -o prompt-enhancer/prompt-enhancer ./prompt-enhancer && DEBUG__SKIP_ENHANCING=1 ~/oc/prompt-enhancer/prompt-enhancer ask rfc What does using RFC keyword in command doThe toggle-paste-summary.sh script provides a convenient way to toggle experimental disable_paste_summary configuration option without manually editing JSON.
~/.config/opencode/scripts/toggle-paste-summary.sh
# Toggle current setting (true ↔ false)
./scripts/toggle-paste-summary.sh
# Enable (disable paste summary feature)
./scripts/toggle-paste-summary.sh --enable
# Disable (enable paste summary feature)
./scripts/toggle-paste-summary.sh --disable
# Check current status without modifying
./scripts/toggle-paste-summary.sh --status
# Show help information
./scripts/toggle-paste-summary.sh --help- Automatic backup: Creates timestamped backups before each modification
- JSON validation: Validates JSON structure before and after changes
- Smart defaults: Handles missing
experimentalobject gracefully - Atomic updates: Uses temporary files to prevent corruption
- Clear feedback: Provides colored output showing current and new values
- Error handling: Comprehensive error checking for file permissions, malformed JSON, etc.
The script modifies the following configuration path in opencode.json:
{
"experimental": {
"disable_paste_summary": true
}
}When disable_paste_summary is true, OpenCode will not display paste summaries. When false (or not present), paste summaries are shown normally.
jq- JSON processor (install withbrew install jqon macOS)
# Enable experimental feature (disable paste summaries)
$ ./scripts/toggle-paste-summary.sh --enable
ℹ Current setting: disable_paste_summary = false
ℹ Backup created: /Users/user/.config/opencode/opencode.json.backup.20251101_204419
✓ Updated setting: disable_paste_summary = true
✓ Paste summary is now DISABLED
# Check current status
$ ./scripts/toggle-paste-summary.sh --status
ℹ Current setting: disable_paste_summary = true
ℹ Paste summary is currently DISABLED
# Toggle back to default behavior
$ ./scripts/toggle-paste-summary.sh
ℹ Current setting: disable_paste_summary = true
ℹ Backup created: /Users/user/.config/opencode/opencode.json.backup.20251101_204425
✓ Updated setting: disable_paste_summary = false
✓ Paste summary is now ENABLED