Prevent Claude edit stalls from missing reads#39
Merged
Conversation
Claude Code rejects edits to existing files when the file has not been read in the current session. Surface that rule in the Claude playbook and inject a short UserPromptSubmit reminder only for claude-code sessions so Update/Edit/MultiEdit attempts read their target first instead of stalling mid-task. Constraint: Claude Code enforces read-before-edit outside Colony, so the fix must guide the agent before it plans edit tools. Rejected: Treat this as a Colony hook error | the failing message is emitted by Claude Code before PostToolUse can record an edit. Confidence: high Scope-risk: narrow Directive: Keep this reminder Claude-only; do not add it to Codex or other IDE contexts unless their edit tools need the same guard. Tested: pnpm --filter @colony/hooks test; pnpm --filter @colony/hooks build; pnpm exec biome check CLAUDE.md packages/hooks/src/handlers/user-prompt-submit.ts packages/hooks/test/runner.test.ts .changeset/claude-edit-read-guard.md Not-tested: pnpm --filter @colony/hooks typecheck is blocked by existing missing declaration for better-sqlite3 in @colony/storage.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Automated by gx branch finish (PR flow).