EmAySee Context Reader V5
Context Reader V5 — the read half of ComfyUI's file-based LLM memory
- history_text
- status
By the V5 generation, EmAySee split the context system into a dedicated reader and writer pair - and Context Reader is the read half. It loads the last few prompt/response blocks from a text file on disk and hands them to your LLM as conversation history, so a multi-turn workflow doesn't start from a blank slate every time.
The key difference from the older Context Manager nodes: the Reader knows how to seed itself. If the file is empty or missing, you can wire a seed_text string into it, and it writes that text to the file as the first block and returns it - with a status that says exactly what it did. That solves the chicken-and-egg problem of "I need context to start, but the file starts empty." It's the cleaner architecture: one node reads and seeds, its partner (Context Writer V5) appends new generations.
How it works
The path handling is what changed most. Where the V1/V2 managers resolved paths against ComfyUI's working directory (a reliable source of "where did my file go?" confusion), the V5 reader resolves file_name relative to the ComfyUI root - the code walks up two levels from the pack's py/ folder and joins your filename to that. So the default user/default/emaysee_prompts/prompt_v2.txt lands inside your ComfyUI install directory, and the file sits in a predictable place.
Under the hood it's the familiar PROMPT:/STATE: block regex. Read the file, pull the last history_count blocks, return them joined. If nothing's there, seed from seed_text (returning status SEEDED) or return an empty string with status EMPTY. force_reset_file deletes the file first, giving you a clean slate on demand.
The inputs that matter
- file_name (default
user/default/emaysee_prompts/prompt_v2.txt) - the context file, resolved against the ComfyUI root. This is also the default the Context Writer V5 uses, so the pair lines up out of the box. - history_count (2) - how many recent blocks to return.
- force_reset_file - delete and start fresh.
- seed - kept for parity with the writer (the pair share a seed input); with the reader it doesn't change what's read.
- seed_text (optional) - the seed written if the file is empty.
Outputs: history_text (the context string) and status (a short string like READ 2, SEEDED, or EMPTY - genuinely handy for logging or for a debug display).
Install
Part of the EmAySee pack:
cd ComfyUI/custom_nodes
git clone https://github.com/EmAySee/ComfyUI_EmAySee_CustomNodes
Restart ComfyUI (or Manager → "ComfyUI_EmAySee_CustomNodes"). Category: EmAySee/Automation/V5. No extra dependencies.
Gotchas
The block-format requirement still applies: blocks need both PROMPT: and STATE: markers to be found by the regex. The Reader's writer partner auto-repairs missing headers when it appends, but if you hand-edit the file or write it with something else, plain text won't be read back. Also note the two different "V5" nodes in this pack - Context Reader/Writer (this family, relative paths, seed support) and the standalone Context Writer V5 (absolute paths, truncation guard) - and make sure you're looking at the right one. Hobbyware, no support, README says so; but the status output makes it one of the more debuggable nodes in the pack.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| file_name | STRING | user/default/emaysee_prompts/prompt_v2.txt | — |
| history_count | INT | 21–10 | — |
| force_reset_file | BOOLEAN | false | — |
| seed | INT | 00–18446744073709550000 | — |
| seed_textopt | STRING | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| history_text | STRING | — |
| status | STRING | — |