Skip to content

Commit ca7f127

Browse files
JAORMXclaude
andauthored
Add permissionMode to code-writing agents (#4174)
Add permissionMode to code-writing agents to fix edit behavior 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>
1 parent 79a2e6c commit ca7f127

4 files changed

Lines changed: 13 additions & 0 deletions

File tree

.claude/agents/documentation-writer.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name: documentation-writer
33
description: Maintains consistent documentation, updates CLI docs, and ensures documentation matches code behavior
44
tools: [Read, Write, Edit, Glob, Grep, Bash]
5+
permissionMode: acceptEdits
56
model: inherit
67
---
78

.claude/agents/golang-code-writer.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name: golang-code-writer
33
description: Write, generate, or create new Go code — functions, structs, interfaces, methods, or complete packages
44
tools: [Read, Write, Edit, Glob, Grep, Bash]
5+
permissionMode: acceptEdits
56
model: inherit
67
---
78

@@ -15,6 +16,15 @@ Invoke when: Writing new Go functions, structs, interfaces, methods, packages, o
1516

1617
Do NOT invoke for: Writing tests (unit-test-writer), reviewing code (code-reviewer), architecture decisions (tech-lead-orchestrator), docs (documentation-writer).
1718

19+
## File Modification Rules
20+
21+
**CRITICAL: Always prefer editing existing files over creating new ones.**
22+
23+
- **Use the Edit tool** to modify existing files in place. NEVER create copies with `_new.go`, `_v2.go`, or similar suffixes.
24+
- **Use the Write tool** ONLY when creating genuinely new files that don't exist yet.
25+
- **Read before editing**: Always use the Read tool to examine a file's current content before modifying it.
26+
- If you need to add a function to an existing package, edit the appropriate existing file — do NOT create a new file unless the change warrants a new file for organizational reasons (e.g., a new logical grouping).
27+
1828
## ToolHive Code Conventions
1929

2030
Follow Go style, error handling, logging, and testing conventions defined in `.claude/rules/go-style.md`, `.claude/rules/testing.md`, and `.claude/rules/cli-commands.md`. These rules are auto-loaded when touching matching files.

.claude/agents/site-reliability-engineer.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name: site-reliability-engineer
33
description: Observability and monitoring guidance — OpenTelemetry instrumentation, metrics, tracing, and monitoring stack configuration
44
tools: [Read, Write, Edit, Glob, Grep, Bash]
5+
permissionMode: acceptEdits
56
model: inherit
67
---
78

.claude/agents/unit-test-writer.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name: unit-test-writer
33
description: Write comprehensive unit tests for Go code — functions, methods, or components that need thorough test coverage
44
tools: [Read, Write, Edit, Glob, Grep, Bash]
5+
permissionMode: acceptEdits
56
model: inherit
67
---
78

0 commit comments

Comments
 (0)