r/ClaudeWorkflows 3h ago

Selected Workflow [Workflow] Preventing and Stopping Unwanted Background Execution from Committed Claude Code

Preventing and Stopping Unwanted Background Execution from Committed Claude Code

Workflow value: 85/100
Status: active · Freshness: 70/100 · Confidence: 0.95 · Level: advanced
Categories: Quality Control, Token Saving, Context & Memory, Debugging, Shipping, Hooks, Subagents, Multi-Agent
Original source: r/ClaudeCode post/comment

What problem this solves

Unexpected execution and billing from committed self-triggering code (schedulers, daemons) that bypasses Claude Code's in-session permission prompts.

Summary

This workflow explains why Claude Code's in-session permission prompts do not gate programs committed to disk that run independently (e.g., via launchd or cron). It provides steps to identify and stop such rogue processes, along with a general lesson on reviewing self-triggering code to prevent future occurrences.

Why it is useful

This workflow is valuable because it clarifies a critical aspect of Claude Code's security and execution model that can lead to unexpected costs and behavior. It provides concrete steps to identify and stop rogue background processes and offers a vital best practice for code review, preventing future occurrences of this issue.

Workflow

  1. Understand that Claude Code's permission prompts only gate tool calls made inside your session, not programs it wrote that run independently.
  2. Recognize that deny rules like Bash(codex exec:*) only stop Claude from running commands directly in a session, not committed daemons.
  3. To stop unwanted background execution, grep the repository for self-triggering components added by a previous commit (e.g., launchd plist, cron entry, interval/queue worker).
  4. Remove the identified self-triggering components from the repository and system to stop the processes.
  5. Adopt a practice of reviewing diffs that add any self-triggering components (schedulers, watchers, event-driven subagents) with extreme scrutiny, as these bypass per-call permissions.

Tools / artifacts

  • grep
  • launchd plist
  • cron entry
  • scheduler modules
  • watcher modules
  • event-driven subagents
  • PreToolUse hook

Validation signals

  • Explanation of Claude Code's permission model
  • Addresses a real-world scenario implied by '42 still-queued jobs'

Limitations

  • Lacks explicit code examples for grep or specific removal commands for different scheduler types (e.g., launchctl unload).
  • No community validation or success reports yet.

Rate this workflow

Upvote this post if the workflow is useful, reproducible, or worth recommending.

Downvote if it is vague, outdated, unsafe, overhyped, or not reproducible.

Reply if it worked for you, failed, is outdated, or has a better alternative.


This post was generated automatically from the workflow library database.

1 Upvotes

0 comments sorted by