Skip to content

Add permissionMode to code-writing agents#4174

Merged
JAORMX merged 1 commit intomainfrom
fix-agent-permission-mode
Mar 17, 2026
Merged

Add permissionMode to code-writing agents#4174
JAORMX merged 1 commit intomainfrom
fix-agent-permission-mode

Conversation

@JAORMX
Copy link
Copy Markdown
Collaborator

@JAORMX JAORMX commented Mar 17, 2026

Summary

  • Code-writing agents (golang-code-writer, unit-test-writer, site-reliability-engineer, documentation-writer) were creating _new.go file copies instead of editing existing files in place. The root cause is that agents without permissionMode inherit the parent's default mode, which requires interactive approval for each Edit/Write operation. When running as subprocesses, those prompts get auto-denied, so the agent falls back to creating new files as a workaround.
  • Adds permissionMode: acceptEdits to all four code-writing agents so file modifications are auto-approved.
  • Updates the golang-code-writer description to include "edit" and "modify" language (not just "create new"), adds an example showing editing existing code, and adds a "File Modification Rules" section that explicitly prohibits creating _new.go copies.

Type of change

  • Bug fix

Test plan

  • Manual testing (describe below)

Verified by inspecting the agent frontmatter to confirm permissionMode: acceptEdits is present in all four agents. The fix addresses a runtime permission behavior — the agents will now auto-approve Edit/Write operations instead of falling back to creating new files.

Changes

File Change
.claude/agents/golang-code-writer.md Add permissionMode: acceptEdits, update description to cover editing existing code, add "File Modification Rules" section
.claude/agents/unit-test-writer.md Add permissionMode: acceptEdits
.claude/agents/site-reliability-engineer.md Add permissionMode: acceptEdits
.claude/agents/documentation-writer.md Add permissionMode: acceptEdits

Does this introduce a user-facing change?

No direct user-facing change. Improves Claude Code agent behavior so code-writing agents edit files in place instead of creating _new.go copies.

Generated with Claude Code

@github-actions github-actions Bot added the size/XS Extra small PR: < 100 lines changed label Mar 17, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.29%. Comparing base (79a2e6c) to head (e884b27).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4174   +/-   ##
=======================================
  Coverage   69.29%   69.29%           
=======================================
  Files         466      466           
  Lines       46774    46774           
=======================================
+ Hits        32411    32414    +3     
+ Misses      11872    11870    -2     
+ Partials     2491     2490    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions github-actions Bot added size/XS Extra small PR: < 100 lines changed and removed size/XS Extra small PR: < 100 lines changed labels Mar 17, 2026
Agents with Write and Edit tools but no permissionMode inherit the
parent's default mode, which requires interactive approval for each
file operation. When running as subprocesses the prompts get
auto-denied, causing agents to create _new.go copies instead of
editing files in place.

Set permissionMode: acceptEdits on all four code-writing agents and
update the golang-code-writer description and prompt to explicitly
prefer editing existing files over creating new ones.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@JAORMX JAORMX force-pushed the fix-agent-permission-mode branch from d57a568 to e884b27 Compare March 17, 2026 09:56
@github-actions github-actions Bot added size/XS Extra small PR: < 100 lines changed and removed size/XS Extra small PR: < 100 lines changed labels Mar 17, 2026
Comment thread .claude/agents/golang-code-writer.md
@JAORMX JAORMX merged commit ca7f127 into main Mar 17, 2026
44 of 45 checks passed
@JAORMX JAORMX deleted the fix-agent-permission-mode branch March 17, 2026 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XS Extra small PR: < 100 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants