Skip to content

chore: add no-bash-file-writes rule to CLAUDE.md#968

Merged
Aureliolo merged 3 commits intomainfrom
chore/no-bash-file-writes
Apr 1, 2026
Merged

chore: add no-bash-file-writes rule to CLAUDE.md#968
Aureliolo merged 3 commits intomainfrom
chore/no-bash-file-writes

Conversation

@Aureliolo
Copy link
Copy Markdown
Owner

Summary

  • Add shell usage rule prohibiting Bash-based file writes (cat > file, echo >, python -c, tee) in favor of Write/Edit tools
  • Targets subagent behavior -- agents were bypassing permission checks by writing files via Bash

Test plan

  • Pre-commit hooks pass
  • Verify subagents respect the rule in subsequent sessions

Review coverage: Quick mode (docs-only change, no agents run)

🤖 Generated with Claude Code

Subagents were using cat/echo/python to write plan files and configs
instead of the Write/Edit tools, bypassing permission checks.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 1, 2026 18:14
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 1, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 4fa6ee72-91f9-483e-acc5-f076a0ccb48c

📥 Commits

Reviewing files that changed from the base of the PR and between e5b415b and 68b0fe4.

📒 Files selected for processing (1)
  • CLAUDE.md
📜 Recent review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Dependency Review
  • GitHub Check: Analyze (python)
🧰 Additional context used
🧠 Learnings (6)
📚 Learning: 2026-03-21T11:08:01.542Z
Learnt from: CR
Repo: Aureliolo/synthorg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-03-21T11:08:01.542Z
Learning: NEVER use `cd` in Bash commands — the working directory is already set to the project root. Use absolute paths or run commands directly.

Applied to files:

  • CLAUDE.md
📚 Learning: 2026-03-31T14:17:24.182Z
Learnt from: CR
Repo: Aureliolo/synthorg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-03-31T14:17:24.182Z
Learning: NEVER use `cd` in Bash commands — working directory is already set to project root; use absolute paths or run commands directly

Applied to files:

  • CLAUDE.md
📚 Learning: 2026-04-01T17:54:44.448Z
Learnt from: CR
Repo: Aureliolo/synthorg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-01T17:54:44.448Z
Learning: Never use 'cd' in Bash commands. Working directory is already set to project root. Use absolute paths or run commands directly.

Applied to files:

  • CLAUDE.md
📚 Learning: 2026-03-15T20:45:14.430Z
Learnt from: CR
Repo: Aureliolo/synthorg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-03-15T20:45:14.430Z
Learning: Shell commands: for Go CLI work, cd cli is an exception because Go tooling requires working directory to be the module root. Go commands require `cd cli` for other work, never use `cd`.

Applied to files:

  • CLAUDE.md
📚 Learning: 2026-03-30T16:36:33.495Z
Learnt from: CR
Repo: Aureliolo/synthorg PR: 0
File: cli/CLAUDE.md:0-0
Timestamp: 2026-03-30T16:36:33.495Z
Learning: Applies to cli/**/*.{sh,bash} : Use `go -C cli` instead of `cd cli` to change directories for Go tooling - `go -C cli` changes directory internally without affecting the shell, whereas `cd cli` poisons the cwd for all subsequent Bash calls

Applied to files:

  • CLAUDE.md
📚 Learning: 2026-04-01T17:54:44.448Z
Learnt from: CR
Repo: Aureliolo/synthorg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-01T17:54:44.448Z
Learning: NEVER create a PR directly. ALWAYS use /pre-pr-review to create PRs. For trivial/docs-only changes, use /pre-pr-review quick to skip agents but still run automated checks.

Applied to files:

  • CLAUDE.md
🔇 Additional comments (1)
CLAUDE.md (1)

122-122: Scoped shell-write prohibition is clear and aligned with intent.

This update correctly targets only Bash-based file creation/modification while allowing read-only usage, matching the objective and resolving the earlier over-broad wording concern.


Walkthrough

Added a new rule to CLAUDE.md prohibiting Bash from writing or modifying files. The prohibition explicitly covers shell redirection and here-doc patterns (e.g., cat >, cat << EOF), echo redirection, tee to files, in-place edits (e.g., sed -i), and one-off inline execution that writes files (e.g., python -c). The rule is defined to apply to all files, including plan/config/source code, and to all subagents. One line was added and no lines were deleted.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a no-bash-file-writes rule to CLAUDE.md, which is the primary modification in this documentation-only PR.
Description check ✅ Passed The description is directly related to the changeset, clearly explaining the purpose of the rule (preventing subagents from bypassing permission checks), what it prohibits, and the test plan.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the shell usage guidelines in CLAUDE.md to prohibit using Bash for writing files, mandating the use of specific Write or Edit tools instead. The review feedback suggests expanding this prohibition to include appending and in-place modifications like 'sed -i', while also explicitly naming the 'write_file' and 'edit_file' tools for better clarity.

CLAUDE.md Outdated
## Shell Usage

- **NEVER use `cd` in Bash commands** -- the working directory is already set to the project root. Use absolute paths or run commands directly. Do NOT prefix commands with `cd C:/Users/Aurelio/synthorg &&`.
- **NEVER use Bash to write files** -- use the Write or Edit tools. NEVER use `cat > file`, `cat << EOF`, `echo >`, `python -c`, or `tee` to write file contents. This includes plan files, config files, and all other files. This rule applies to all subagents.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The rule should explicitly prohibit appending (>>), in-place modifications (e.g., sed -i), and other shell-based file manipulations to prevent permission bypasses. Additionally, referencing the specific tool names write_file and edit_file provides clearer instructions for the agent.

Suggested change
- **NEVER use Bash to write files** -- use the Write or Edit tools. NEVER use `cat > file`, `cat << EOF`, `echo >`, `python -c`, or `tee` to write file contents. This includes plan files, config files, and all other files. This rule applies to all subagents.
- **NEVER use Bash to write or modify files** -- use the write_file or edit_file tools. NEVER use cat > file, cat << EOF, echo >, echo >>, sed -i, python -c, or tee to write or modify file contents. This includes plan files, config files, and all other files. This rule applies to all subagents.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Shell Usage rule to prevent agents/subagents from writing files via Bash redirection/commands, steering them to the sanctioned Write/Edit tooling to preserve permission checks and auditing.

Changes:

  • Add an explicit prohibition on Bash-based file writes (e.g., redirection, heredocs, tee, etc.) for all agents/subagents.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

CLAUDE.md Outdated
## Shell Usage

- **NEVER use `cd` in Bash commands** -- the working directory is already set to the project root. Use absolute paths or run commands directly. Do NOT prefix commands with `cd C:/Users/Aurelio/synthorg &&`.
- **NEVER use Bash to write files** -- use the Write or Edit tools. NEVER use `cat > file`, `cat << EOF`, `echo >`, `python -c`, or `tee` to write file contents. This includes plan files, config files, and all other files. This rule applies to all subagents.
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid the examples being interpreted as an exhaustive allowlist, consider explicitly stating that the command list is non-exhaustive (e.g., “including but not limited to …”) and that the prohibition applies to any shell-based creation/modification of repo files (redirects like >/>>, heredocs, in-place editors, etc.). This would make the policy intent clearer for subagents.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Snapshot Warnings

⚠️: No snapshots were found for the head SHA 68b0fe4.
Ensure that dependencies are being submitted on PR branches. Re-running this action after a short time may resolve the issue. See the documentation for more information and troubleshooting advice.

Scanned Files

None

coderabbitai[bot]
coderabbitai bot previously approved these changes Apr 1, 2026
Add append (>>), in-place edit (sed -i) to the prohibition list and
clarify the list is non-exhaustive with "includes but is not limited to".

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@CLAUDE.md`:
- Line 122: The rule currently bans commands like `python -c` unconditionally;
update the clause in CLAUDE.md so the prohibition only applies to Bash usage
that writes or modifies files. Edit the sentence that lists examples (`cat >`,
`cat << EOF`, `echo >`, `echo >>`, `sed -i`, `python -c`, `tee`) to clarify each
is banned only when used to create/modify files (e.g., “do not use X to write or
modify files”), and add a short parenthetical or phrase making explicit that
read-only/inspection uses (non-write `python -c`, piping to stdout, etc.) are
allowed. Ensure the revised text preserves the original intent and keeps the
example list but makes the file-writing condition explicit.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 12307ccf-bece-4c01-9c2b-7e55b9643d02

📥 Commits

Reviewing files that changed from the base of the PR and between 6c8268f and e5b415b.

📒 Files selected for processing (1)
  • CLAUDE.md
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Dependency Review
  • GitHub Check: Analyze (python)
  • GitHub Check: Analyze (go)
🧰 Additional context used
🧠 Learnings (7)
📚 Learning: 2026-03-21T11:08:01.542Z
Learnt from: CR
Repo: Aureliolo/synthorg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-03-21T11:08:01.542Z
Learning: NEVER use `cd` in Bash commands — the working directory is already set to the project root. Use absolute paths or run commands directly.

Applied to files:

  • CLAUDE.md
📚 Learning: 2026-03-31T14:17:24.182Z
Learnt from: CR
Repo: Aureliolo/synthorg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-03-31T14:17:24.182Z
Learning: NEVER use `cd` in Bash commands — working directory is already set to project root; use absolute paths or run commands directly

Applied to files:

  • CLAUDE.md
📚 Learning: 2026-04-01T17:54:44.448Z
Learnt from: CR
Repo: Aureliolo/synthorg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-01T17:54:44.448Z
Learning: Never use 'cd' in Bash commands. Working directory is already set to project root. Use absolute paths or run commands directly.

Applied to files:

  • CLAUDE.md
📚 Learning: 2026-03-15T20:45:14.430Z
Learnt from: CR
Repo: Aureliolo/synthorg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-03-15T20:45:14.430Z
Learning: Shell commands: for Go CLI work, cd cli is an exception because Go tooling requires working directory to be the module root. Go commands require `cd cli` for other work, never use `cd`.

Applied to files:

  • CLAUDE.md
📚 Learning: 2026-03-30T16:36:33.495Z
Learnt from: CR
Repo: Aureliolo/synthorg PR: 0
File: cli/CLAUDE.md:0-0
Timestamp: 2026-03-30T16:36:33.495Z
Learning: Applies to cli/**/*.{sh,bash} : Use `go -C cli` instead of `cd cli` to change directories for Go tooling - `go -C cli` changes directory internally without affecting the shell, whereas `cd cli` poisons the cwd for all subsequent Bash calls

Applied to files:

  • CLAUDE.md
📚 Learning: 2026-04-01T17:54:44.448Z
Learnt from: CR
Repo: Aureliolo/synthorg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-01T17:54:44.448Z
Learning: NEVER create a PR directly. ALWAYS use /pre-pr-review to create PRs. For trivial/docs-only changes, use /pre-pr-review quick to skip agents but still run automated checks.

Applied to files:

  • CLAUDE.md
📚 Learning: 2026-04-01T17:54:44.448Z
Learnt from: CR
Repo: Aureliolo/synthorg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-01T17:54:44.448Z
Learning: Use 'go -C cli' (never 'cd cli') when running Go CLI commands.

Applied to files:

  • CLAUDE.md

python -c and tee have legitimate read-only uses (inspection, piping
to stdout). Narrow the prohibition to file-writing usage only.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Aureliolo Aureliolo merged commit a854dcc into main Apr 1, 2026
24 checks passed
@Aureliolo Aureliolo deleted the chore/no-bash-file-writes branch April 1, 2026 18:29
Aureliolo added a commit that referenced this pull request Apr 2, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.5.6](v0.5.5...v0.5.6)
(2026-04-02)


### Features

* calendar + hybrid ceremony scheduling strategies
([#985](#985))
([59a9b84](59a9b84)),
closes [#969](#969)
[#970](#970)
* landing page interactive components
([#984](#984))
([49868cb](49868cb))
* log aggregation and shipping (syslog, HTTP, compression)
([#964](#964))
([84be9f8](84be9f8))
* restructure builtin templates into inheritance tree
([#982](#982))
([3794c12](3794c12))
* sprint ceremony runtime scheduler with pluggable strategies
([#983](#983))
([43564a9](43564a9))


### Maintenance

* add no-bash-file-writes rule to CLAUDE.md
([#968](#968))
([a854dcc](a854dcc))
* bump web dependencies (lodash, eslint-react v4, storybook, playwright,
esbuild, codemirror)
([#987](#987))
([c344dfb](c344dfb))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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