fix: minimal system prompt sanitization#34
fix: minimal system prompt sanitization#34remorses wants to merge 3 commits intoanomalyco:masterfrom
Conversation
Instead of replacing all OpenCode/opencode references in system prompts, only replace the specific blocked string 'You are OpenCode, the best coding agent on the planet.' with the Claude Code equivalent. This is a more targeted fix as the API only checks for that specific identity string, not all mentions of OpenCode.
…m-prompt-sanitization
There was a problem hiding this comment.
Pull request overview
This PR fixes critical authentication issues (issues #33, #32, #12) where Anthropic began blocking requests with "credential only authorized for Claude Code" errors. The fix changes the system prompt sanitization from broad regex replacements to a minimal, targeted string replacement to avoid detection.
Changes:
- Replaced broad regex replacements (
/OpenCode/g,/opencode/gi) with a single specific string replacement to minimize detection surface - Bumped version from 0.0.13 to 0.0.14
- Added AGENTS.md documentation with plugin testing instructions
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| package.json | Version bump to 0.0.14 |
| index.mjs | Changed system prompt sanitization from broad regex to targeted string replacement |
| AGENTS.md | New documentation file with testing instructions and feature list |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
before merge: #33 (comment) |
|
have you tested this? I just tried this and this doesn't patch the issue. This PR is a moot |
|
Did you follow instructions in AGENTS.md? @coleleavitt |
I found the proper fix to this. I got a custom fork with a variety of features in addition to the upstream version |
|
This works. Since the "You are Claude Code, Anthropic's official CLI for Claude." spoof is automatically injected by OpenCode itself, the simpler solution is to do nothing. |
Followed the guide, got error. |
Fixes the plugin by only replacing the specific OpenCode identity string instead of broader replacements that were causing Anthropic to block requests.
Also adds AGENTS.md with plugin testing instructions.
Fixes #33, fixes #32, fixes #12