Skip to content

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

Closed
Wanli-Lee wants to merge 78 commits into
mainfrom
fix/claudecode-sudo-prompt
Closed

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

Conversation

@Wanli-Lee

Copy link
Copy Markdown
Contributor

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 27 commits July 6, 2026 10:31
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.
@94wen94

94wen94 commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Reopening under the correct contributor account (94wen94).

@94wen94 94wen94 closed this Jul 8, 2026
@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