Remove hardcoded identity strings from system prompt
All checks were successful
Build Nanobot OAuth / build (push) Successful in 6m13s

- Remove "# nanobot" branding and "You are nanobot" from context.py
- Remove "You are a helpful AI assistant" personality line
- Remove fake "required" Claude Code system prefix from OAuth provider
- Identity is now fully customizable via IDENTITY.md in workspace

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
wylab
2026-02-13 18:10:54 +01:00
parent 2d3c94e609
commit af436f5e6c
3 changed files with 4 additions and 14 deletions

View File

@@ -71,7 +71,7 @@ Skills with available="false" need dependencies installed first - you can try in
return "\n\n---\n\n".join(parts)
def _get_identity(self) -> str:
"""Get the core identity section."""
"""Get the core identity section with runtime context."""
from datetime import datetime
import time as _time
now = datetime.now().strftime("%Y-%m-%d %H:%M (%A)")
@@ -79,10 +79,8 @@ Skills with available="false" need dependencies installed first - you can try in
workspace_path = str(self.workspace.expanduser().resolve())
system = platform.system()
runtime = f"{'macOS' if system == 'Darwin' else system} {platform.machine()}, Python {platform.python_version()}"
return f"""# nanobot 🐈
You are nanobot, a helpful AI assistant. You have access to tools that allow you to:
return f"""You have access to tools that allow you to:
- Read, write, and edit files
- Execute shell commands
- Search the web and fetch web pages

View File

@@ -11,7 +11,7 @@ import httpx
from loguru import logger
from nanobot.providers.base import LLMProvider, LLMResponse, ToolCallRequest
from nanobot.providers.oauth_utils import get_auth_headers, get_claude_code_system_prefix
from nanobot.providers.oauth_utils import get_auth_headers
class AnthropicOAuthProvider(LLMProvider):
@@ -78,7 +78,7 @@ class AnthropicOAuthProvider(LLMProvider):
Returns (system_prompt, anthropic_messages)
"""
system_parts = [get_claude_code_system_prefix()]
system_parts = []
converted: list[dict[str, Any]] = []
for msg in messages:

View File

@@ -36,11 +36,3 @@ def get_auth_headers(token: str, is_oauth: bool = False) -> dict[str, str]:
headers["x-api-key"] = token
return headers
def get_claude_code_system_prefix() -> str:
"""Get the required system prompt prefix for OAuth tokens.
Anthropic requires this identity declaration for OAuth auth.
"""
return "You are Claude Code, Anthropic's official CLI for Claude."