Execute Headless Claude Code Commands with Local Context
Press play on the video. It'll jump straight to the section that answers the
title above — no need to watch the full video.
Run Claude Code in headless mode using n8n SSH and chain commands to provide local directory context for file-aware AI responses.
The Power of the '-p' Flag
The `-p` (print) flag is mandatory for automation. Without it, Claude Code attempts to open an interactive session, which will cause headless workflows (like n8n) to hang or fail.
Local Context vs. RAG
By changing the directory (`cd`) before running the prompt, you effectively give the AI 'memories' of that specific project without needing to set up a vector database or upload files to a web GUI. The AI reads the local files immediately.
More from AI-Powered Coding & App Development
View All
None
Claude
Build automated AI agents with Claude Code
Claude
Syncing work context with Multi-AI workflows
Claude
Google Gemini
Managing project memory and context with Claude Memory
Claude
Building web apps with Claude Code and GitHub integration
Claude
GitHub
4 Ways to Edit and Customize Your Designs in Claude Design
Claude