Skip to content

Add sudo privileges guidance to Claude Code agent system prompt - #17

Merged
Wanli-Lee merged 78 commits into
mainfrom
fix/claudecode-sudo-prompt
Jul 8, 2026
Merged

Add sudo privileges guidance to Claude Code agent system prompt#17
Wanli-Lee merged 78 commits into
mainfrom
fix/claudecode-sudo-prompt

Conversation

@94wen94

@94wen94 94wen94 commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

The Claude Code harness runs its Bash tool as the unprivileged user account. Without explicit guidance, commands that need root (installing packages/games, editing system config, managing services) fail with permission errors, and the agent sometimes fabricates results instead of installing what the task needs.

This adds a PRIVILEGES section to the system prompt instructing the agent to use sudo -n (non-interactive, passwordless) for privileged operations, with concrete examples, and to avoid plain sudo/sudo -S which hang on the password prompt.

Impact

  • Games/tools that need install now get installed via sudo -n apt-get install rather than being skipped or faked.
  • No behavior change for tasks that don't need root.

Wanli-Lee added 30 commits July 5, 2026 12:14
Wanli-Lee and others added 28 commits July 6, 2026 10:18
The Claude Code harness runs Bash as the unprivileged `user` account. Without
guidance, commands needing root (installing packages/games, editing system
config, managing services) fail with permission errors and the agent may
fabricate results instead of installing what it needs. Instruct it to use
`sudo -n` for privileged operations.
@Wanli-Lee
Wanli-Lee merged commit e5fa9bd into main Jul 8, 2026
6 checks passed
@Wanli-Lee
Wanli-Lee deleted the fix/claudecode-sudo-prompt branch July 8, 2026 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants