Learning Timeline
Key Insights
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.
Prompts
Context Validation Prompt
Target:
Claude Code CLI
Hey, is this video going to be any good?
Step by Step
Executing Context-Aware Headless Claude Commands
- Open the configuration panel for your SSH execution node (e.g., within n8n).
- Begin the command string with the change directory command `cd` followed by the path to the specific folder containing your relevant project files/scripts.
- Input the chain operator `&&` immediately after the directory path to ensure the next command runs only if the directory change is successful.
- Append the Claude CLI command `clo`.
- Add the `-p` flag after `clo` to enable 'print' mode (headless execution), preventing the tool from opening an interactive interface.
- Type your prompt in double quotes (e.g., "Analyze these scripts") immediately after the `-p` flag.
- Execute the node/command to run the prompt against the local files located in the specified directory.