Claude Code icon

Claude Code

Use Claude Code SDK to execute AI-powered coding tasks with customizable tool support

Overview

The "Approve Plan" operation of the Claude Code node allows users to approve and execute a previously created AI-generated plan for coding or project tasks. This operation is typically used after a plan has been generated (e.g., via the "Plan" operation) and reviewed by the user. It supports applying modifications or feedback to the plan before execution, enabling iterative refinement.

This node leverages the Claude Code SDK to interact with an AI assistant specialized in coding tasks, allowing it to run commands, edit files, search content, and more within a specified project directory. The "Approve Plan" operation is beneficial in scenarios where complex coding workflows need to be planned, reviewed, and then executed automatically, such as:

  • Automating multi-step development tasks based on AI-generated plans.
  • Reviewing and modifying AI-generated project plans before running them.
  • Integrating AI-assisted code generation and execution into CI/CD pipelines.

Example use case: A developer generates a detailed plan to refactor a Python project, reviews the plan, adds feedback to skip certain tests, and then uses this operation to approve and execute the modified plan automatically.


Properties

Name Meaning
Prompt The instruction or request describing the task or plan to be approved and executed. Required field.
Model The Claude model to use:
• Sonnet — Fast and efficient for most tasks
• Opus — More capable for complex tasks
Max Turns Maximum number of conversation turns (back-and-forth exchanges) allowed during the interaction with Claude Code.
Timeout Maximum time in seconds to wait for completion before aborting the operation.
Project Path Directory path where Claude Code should run. If empty, uses the current working directory. This sets the working directory for file access and command execution.
Output Format How to format the output data:
• Structured — Returns an object with messages, summary, result, and metrics
• Messages — Returns raw array of all exchanged messages
• Text — Returns only the final result text
Allowed Tools Built-in tools Claude Code is allowed to use during execution. Options include:
Bash, Edit, Exit Plan Mode, Glob, Grep, LS, MultiEdit, Notebook Edit, Notebook Read, Read, Task, Todo Write, Web Fetch, Web Search, Write
Additional Options Collection of optional settings:
• Plan Modifications — Feedback or changes to apply to the plan before execution
• Debug Mode — Enable debug logging
• Require Permissions — Whether to require permission for tool use
• System Prompt — Extra context or instructions for Claude Code

Output

The output depends on the selected Output Format:

  • Structured: An object containing:

    • messages: Array of all messages exchanged during execution.
    • summary: Counts of user messages, assistant messages, tool uses, presence of results, and available tools.
    • result: The final result text or error message.
    • metrics: Performance data including duration in milliseconds, number of turns, cost, and usage statistics.
    • success: Boolean indicating if the execution succeeded.
  • Messages: Raw array of all messages exchanged with Claude Code, including user inputs, assistant responses, and tool usage events.

  • Text: Only the final result text from the execution or error message.

No binary data output is produced by this operation.


Dependencies

  • Requires an API key credential for authenticating with the Claude Code service.
  • Uses the Claude Code SDK (@anthropic-ai/claude-code) to communicate with the AI backend.
  • Access to the local filesystem for reading/writing files and executing commands in the specified project directory.
  • Node.js environment with permissions to change working directories and execute asynchronous operations.
  • Proper configuration of timeout and allowed tools to match the intended use case.

Troubleshooting

Common Issues

  • Empty Prompt: The prompt must not be empty; otherwise, the node throws an error.
  • Invalid Project Path: If a project path is specified but does not exist, is not a directory, or lacks read permissions, the node will throw an error or warning.
  • Timeouts: Operations may time out if the AI response takes longer than the configured timeout. Increase the timeout setting if needed.
  • Permission Errors: If the node lacks permissions to read/write in the project directory, some operations may fail or produce warnings.
  • Working Directory Changes: Changing the working directory may fail or cause unexpected behavior if the path is invalid or inaccessible.

Error Messages and Resolutions

  • "Prompt is required and cannot be empty": Provide a non-empty prompt.
  • "Project Path Error: ...": Verify that the specified project directory exists and has appropriate read/write permissions.
  • "Operation timed out after X seconds": Increase the timeout value in the node's settings.
  • "Claude Code execution failed: ...": Check the error details for specific issues; enable debug mode for more verbose logs.
  • "Failed to restore working directory": Ensure the process has permissions to change back to the original directory.

Enabling Debug Mode in additional options can provide detailed logs to help diagnose issues.


Links and References

Discussion