Skip to content

claude-code

claude-code - open an interactive Claude Code session

state-name:
tool: claude-code
arguments:
prompt: <initial-prompt>
model: <model-name> # optional

The claude-code tool launches an interactive Claude Code terminal session. Unlike the non-interactive claude tool, this provides the full TUI experience where users can continue the conversation, approve tool calls, and interact with Claude in real-time.

The session starts with the provided prompt as the initial message. The user then interacts freely until exiting the session (Ctrl+C or completing the task).

Important: This tool does not support output capture. The session is fully interactive with the terminal.

ArgumentRequiredDefaultDescription
promptYes-Initial prompt to start the session
modelNoDefault modelModel to use (e.g., sonnet, opus)
CodeMeaning
0Session completed normally
1Failed to start Claude
OtherUser exit or error

Output capture is not supported. A warning is displayed if output is specified:

Warning: claude-code tool does not support output capture. Running interactively.
code-with-claude:
tool: claude-code
arguments:
prompt: "Help me refactor the authentication module"
complex-task:
tool: claude-code
arguments:
prompt: "{{ file(./prompts/architecture-review.md) }}"
model: opus
start-at: prepare
states:
prepare:
tool: bash
arguments:
command: git checkout -b feature/new-api
next: implement
implement:
tool: claude-code
arguments:
prompt: |
Implement a new REST API endpoint for user preferences.
Requirements:
- GET /api/users/:id/preferences
- POST /api/users/:id/preferences
- Follow existing patterns in src/routes/
next: review
review:
tool: bash
arguments:
command: npm test

When the workflow continues after a claude-code session, subsequent states can work with any files Claude created or modified:

implement:
tool: claude-code
arguments:
prompt: "Create unit tests for the UserService class"
next: verify-tests
verify-tests:
tool: bash
arguments:
command: npm test -- --coverage

The session runs in the project root directory, giving Claude full access to the codebase. This matches the behavior of running claude directly in the terminal.

  • Cannot be used in parallel blocks (requires interactive terminal)
  • No output capture available
  • Session blocks workflow until user exits
start-at: setup
states:
setup:
tool: bash
arguments:
command: |
git fetch origin
git checkout -b feature/$(date +%Y%m%d)
next: develop
develop:
tool: claude-code
arguments:
prompt: |
I need to implement {{ feature_description }}.
Context:
{{ file(@/docs/requirements.md) }}
next: test
test:
tool: bash
arguments:
command: npm test
on-error:
_: develop # Go back to Claude if tests fail
next: done
review-session:
tool: claude-code
arguments:
prompt: |
Please review the changes in this PR:
$(git diff main...HEAD)
Focus on:
- Security concerns
- Performance implications
- Code style consistency
  • claude - For non-interactive prompts
  • ask-user - For simple user input