Skip to content

Add --restricted mode to block dangerous commands for AI agents#4

Merged
scottgl9 merged 1 commit intomainfrom
feature/restricted-ai-mode
Jan 21, 2026
Merged

Add --restricted mode to block dangerous commands for AI agents#4
scottgl9 merged 1 commit intomainfrom
feature/restricted-ai-mode

Conversation

@scottgl9
Copy link
Copy Markdown
Owner

Implements a safety feature for running AI agents (like Claude Code) with thop. When --restricted flag is set, dangerous commands are blocked:

  • Privilege escalation: sudo, su, doas, pkexec
  • Destructive file ops: rm, rmdir, shred, dd, truncate, etc.
  • System modifications: chmod, chown, mkfs, systemctl, mount, etc.

Usage: SHELL="thop --proxy --restricted" claude

Implemented in both Go and Rust:

  • Go: internal/restriction/ module with regex-based filtering
  • Rust: src/restriction.rs module with regex-based filtering
  • Integrated with session manager execute methods
  • Added COMMAND_RESTRICTED error code
  • Updated CLI help text and shell completions
  • Updated TODO.md and PROGRESS.md documentation

Implements a safety feature for running AI agents (like Claude Code) with thop.
When --restricted flag is set, dangerous commands are blocked:

- Privilege escalation: sudo, su, doas, pkexec
- Destructive file ops: rm, rmdir, shred, dd, truncate, etc.
- System modifications: chmod, chown, mkfs, systemctl, mount, etc.

Usage: SHELL="thop --proxy --restricted" claude

Implemented in both Go and Rust:
- Go: internal/restriction/ module with regex-based filtering
- Rust: src/restriction.rs module with regex-based filtering
- Integrated with session manager execute methods
- Added COMMAND_RESTRICTED error code
- Updated CLI help text and shell completions
- Updated TODO.md and PROGRESS.md documentation
@scottgl9 scottgl9 merged commit 8410243 into main Jan 21, 2026
2 of 8 checks passed
@scottgl9 scottgl9 deleted the feature/restricted-ai-mode branch January 21, 2026 23:18
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.

1 participant