Claude Context Builder
Chain Claude runs together by turning the last output into the next one's context
- memory
Claude Context Builder is the pack's chaining node - the thing that makes multiple agent runs feel like one conversation instead of a stack of strangers. Each Claude Code Execute run is stateless: it starts in a fresh folder with a fresh agent and zero memory of anything. This node closes that gap by reading a run's output folder and turning it into context text that the next run can consume. First run generates code, Context Builder digests the folder, second run builds on it. That's the whole pattern, and it's the difference between using this pack for one-off tasks and using it for actual pipelines.
How it works
The mechanism is straightforward: you give it the output_folder (the timestamped folder name a Claude run produced - output_20240615_143022-style, under claude_code_outputs/), and it reads the files inside, respecting the file_filter (comma-separated extensions, defaulting to the common code/text types) and max_file_size_kb (files bigger than this get skipped from the content, default 100 KB). ## The inputs
Then context_mode decides what comes out:
- full_content - every matching file's contents, inlined.
- file_list - just names and sizes, plus the run's execution metadata.
- summary (default) - the file list plus truncated contents of the first few files, capped at ~1,000 characters each. The sensible default: enough to orient the next agent without flooding it.
- custom - your own template, with
{file_list},{file_contents}, and{metadata}placeholders.
base_memory prepends existing context, so you can layer a project brief under the folder digest.
A wiring gotcha
One thing to know before you wire it up: the output is a plain STRING memory, while Execute's memory input expects the CLAUDE_MEMORY type. The clean path is to run it through Claude Memory Builder - drop the Context Builder's string into its text_memory (or append_to) and take its memory output into Execute. Yes, that's an extra node for what feels like a passthrough; it's how you get the right wire type without hand-typing anything.
Installing
Install: ComfyUI Manager, or:
cd ComfyUI/custom_nodes
git clone https://github.com/christian-byrne/claude-code-comfyui-nodes
and restart. Pure Python string assembly - no models, no API calls, instant.
Common issues
Where it trips people up: the folder name is text you have to get right, and it's easy to paste the response text instead of the folder name. If the node returns an "Output folder not found" message as its output, that's the problem - check what Execute actually printed, or look at the output_path in its metadata JSON. And pick file_list over full_content when you just want the next run to know what exists; dumping every file's contents into context is how you spend tokens restating code the next agent can read itself.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| output_folder | STRING | The output folder from a previous ClaudeCodeCommand | |
| context_mode | COMBO | summary | How to build the context from the folder |
| base_memoryopt | STRING | Base memory to append the folder context to | |
| file_filteropt | STRING | *.py,*.js,*.ts,*.md,*.txt,*.json | Comma-separated file extensions to include |
| custom_templateopt | STRING | # Previous Output The following files were generated: {file_list} Key files: {file_contents} | Custom template for context (available vars: {file_list}, {file_contents}, {metadata}) |
| max_file_size_kbopt | INT | 1001–1000 | Maximum file size in KB to include in full content |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| memory | STRING | — |