How thenetworkchuck/n8n-claude-code-guide works
1. Repository purpose
- This repo is not an application implementation; it is an integration guide for wiring n8n to a remote AI terminal tool, specifically Claude Code.
- The architecture is therefore operational: n8n orchestrates work, and Claude Code runs as a remote command-line agent over SSH.
2. Primary control plane
- n8n is the workflow engine and main orchestrator.
- It owns triggers, branching, retries/timeouts, credential management, and the overall automation graph.
- In architecture diagrams, n8n should be shown as the central controller coordinating all downstream actions.
3. Execution boundary
- The actual AI execution happens on a Linux server reached via SSH.
- Claude Code is installed on that server and invoked as a CLI process, not as an API service.
- This means the runtime boundary is between n8n’s workflow environment and the remote shell environment.
4. Remote AI worker
- Claude Code is the worker process that interprets prompts, accesses local context, and can run tools or agents.
- It is called in headless mode using -p for prompt/response execution.
- The guide also implies compatibility with other terminal AI tools, but Claude Code is the reference implementation.
5. Context and file access
- The remote server provides Claude with access to local project files, skills, and context by running commands in a chosen working directory.
- This is a key architectural feature: the AI is not just answering from text input; it can inspect the server-side filesystem context.
6. Workflow data flow
- The basic flow is: n8n trigger or node input → SSH command → Claude response → back to n8n.
- n8n passes the prompt into the SSH node, which executes the Claude CLI command remotely and returns stdout/stderr as workflow output.
- This makes the SSH connection the transport layer for all AI interactions.
7. State management
- Conversation continuity is handled through a session ID generated inside n8n, typically by a Code node.
- The session ID is then forwarded to Claude using --session-id, and follow-up requests use -r to resume the same session.
- State is therefore split across n8n-generated identifiers and Claude’s session persistence.
8. Advanced tool/agent mode
- The guide includes an optional “dangerous mode” using --dangerously-skip-permissions.
- This expands the remote worker’s capabilities to run tools, scripts, agents, and external integrations.
- Architecturally, this is a trust boundary escalation: Claude moves from read/answer mode to tool-execution mode.
9. Human-facing interface via Slack
- A more advanced workflow uses Slack as the user interface and n8n as the bridge to the SSH-backed Claude worker.
- Flow: Slack trigger → session creation → Claude via SSH → response back to Slack → optional resume loop.
- Slack is an optional presentation layer, not the compute layer.
10. Operational constraints and failure boundaries
- The guide calls out practical issues that shape the architecture: SSH auth, PATH/profile loading, file permissions, command timeouts, and Slack message length limits.
- These constraints matter because the system depends on shell execution over SSH rather than a native integration API.
- In diagrams, these should be shown as edge conditions around the SSH/remote-shell boundary.
11. Infrastructure options
- Claude Code can run on the same VPS as n8n, on a dedicated Ubuntu server, on a Raspberry Pi, or on another hosted machine.
- The important architectural point is that compute is decoupled from orchestration: n8n and the AI worker can be colocated or separate.
12. What to diagram
- The key boxes are: n8n workflow engine, SSH transport, remote Linux host with Claude Code, local files/context, and optionally Slack.
- The key arrows are: prompt/context into SSH, Claude output back to n8n, and session IDs flowing through successive runs.
Components 8
Orchestration
Workflow control plane and user-facing automation entry points.
- n8n · Central orchestrator that triggers workflows, manages branching, retries, credentials, and overall automation flow.
- Slack · Optional human-facing entry point for conversations and responses.
- Session ID · n8n-generated conversation identifier used to resume Claude sessions across runs.
Remote Execution
SSH-backed Linux host where Claude Code runs as a CLI worker.
- SSH · Command transport layer that carries prompts and returns stdout/stderr between n8n and the remote host.
- Linux host · Remote machine reached over SSH; provides the execution boundary and working directory context.
- Claude Code · Headless Claude Code process invoked remotely with prompt/response execution and optional resume support.
- Local files · Project files, skills, and other server-side context available to the CLI through the working directory.
- Dangerous mode · Optional permission-escalated mode that allows tool, script, and agent execution on the remote host.
Connections 11
- Slack → n8n: trigger/input · Slack messages can start or continue a workflow.
- n8n → Session ID: create · A workflow step generates or updates the conversation session identifier.
- Session ID → n8n: resume token · The session ID is reused by later workflow runs to continue the same conversation.
- n8n → SSH: prompt + session · n8n sends the prompt, session ID, and command parameters into the SSH node.
- SSH → Linux host: remote command · SSH executes the Claude CLI on the remote Linux host.
- Linux host → Claude Code: launch · The host starts Claude Code as a headless CLI process.
- Claude Code → Local files: read context · Claude inspects local files and working-directory context on the remote machine.
- Dangerous mode → Claude Code: escalate · Dangerous mode expands Claude's ability to run tools, scripts, and agents.
- Claude Code → SSH: stdout/stderr · Claude's response is returned through the SSH transport.
- SSH → n8n: result · n8n receives the remote output for branching, retries, formatting, or downstream delivery.
- n8n → Slack: reply · Optional workflow step posts the Claude response back to Slack.