Forked from harshallmstudio/document-streamer
Forked from harshallmstudio/document-streamer
A local-document streaming plugin for LM Studio. It gives the model tools to open a document, read its extracted text one chunk at a time, search within the extracted text, and close the document session.
The model receives only the chunks it requests rather than the entire document at once. This avoids automatically inserting a large document into the model context.
| Format | Support |
|---|---|
| TXT, LOG, CSV, TSV, JSON, JSONL, XML | Built-in text decoding |
| MD, Markdown | Built-in text decoding |
| HTML, HTM | Tag removal and basic entity decoding |
Text extraction with pdfjs-dist | |
| DOCX | Raw text extraction with mammoth |
| DOC, PPT, PPTX, XLS, images, scanned PDFs | Not supported |
The HTML and spreadsheet conversions are intentionally lightweight. They do not reproduce page layout, comments, formulas, footnotes, or visual formatting perfectly.
Encrypted, password-protected, corrupted, and some malformed documents cannot be read. Scanned PDFs and images require OCR, which this version does not provide. Very large extracted documents can consume substantial memory because the current version retains the extracted text and chunks in memory until the document session expires.
No document content is uploaded by this plugin. The language model running in LM Studio receives only the chunks or search results returned through tool calls.
Install the dependencies and start the plugin in development mode:
Then enable Document Streamer for a chat in LM Studio and enable tool use for the selected model.
Ask the model:
Open
/absolute/path/to/report.pdfand summarize it. Read every chunk before giving the final summary.
For a spreadsheet:
For a targeted question:
Open
/path/to/manual.pdfand search it for “factory reset”. Only read relevant surrounding chunks.
| Tool | Purpose |
|---|---|
open_document | Validates a path, extracts text, creates chunks, and returns the first chunk |
read_document_chunk | Returns any chunk by its one-based number |
search_document | Searches extracted text and returns matching excerpts with nearby chunk numbers |
close_document | Releases the stored document and its chunks |
| Setting | Default | Description |
|---|---|---|
| Additional allowed directories | Empty | Extra absolute directories from which documents may be read |
| Chunk size | 12,000 characters | Maximum target size of each chunk |
| Chunk overlap | 200 characters | Text repeated between adjacent chunks |
| Idle expiration | 120 minutes | Inactive sessions are removed after this period |
| Search results | 8 | Maximum matches returned by one search |
| Maximum stored documents | 8 | Inactive sessions are evicted beyond this limit |
Chunk sizes are characters, not model tokens. A smaller chunk size generally requires more model tool calls; a larger size consumes more model context per call.
open_document resolves the requested path and verifies that it is inside the working directory or an allowed directory.read_document_chunk for subsequent chunks, or search_document when only relevant passages are needed.The first open_document response includes the first chunk. The model must explicitly request later chunks. A model may stop early, so instructions such as “read the entire document before answering” are recommended when complete coverage matters.
Parsing and chunk storage happen locally in the plugin process. The plugin does not transmit documents to an external service. However, text returned by tools becomes available to the active model; a remotely hosted model provider could therefore receive that text.
Paths are resolved and checked against allowed directories. Do not add sensitive directories unless you intend the active model to read them.
Run lms dev while changing the source to reload the plugin during development.
Set your LM Studio username in manifest.json, update the package description and README, commit package-lock.json, verify the plugin, and run:
The model only sees the first chunk.
Ask it to continue with read_document_chunk, or explicitly request that it read every chunk before answering.
A session expired.
Call open_document again. Sessions are intentionally temporary to limit memory use.
A format is rejected. Convert it to PDF, DOCX, XLSX, HTML, or UTF-8 text. Scanned documents require OCR first.
Extraction produces little or no text. The file may contain scanned images rather than selectable text.
Parsing fails for a valid document. Try converting it to UTF-8 text or PDF. Complex layouts and malformed files can defeat simple extraction.
MIT
A local-document streaming plugin for LM Studio. It gives the model tools to open a document, read its extracted text one chunk at a time, search within the extracted text, and close the document session.
The model receives only the chunks it requests rather than the entire document at once. This avoids automatically inserting a large document into the model context.
| Format | Support |
|---|---|
| TXT, LOG, CSV, TSV, JSON, JSONL, XML | Built-in text decoding |
| MD, Markdown | Built-in text decoding |
| HTML, HTM | Tag removal and basic entity decoding |
Text extraction with pdfjs-dist | |
| DOCX | Raw text extraction with mammoth |
| DOC, PPT, PPTX, XLS, images, scanned PDFs | Not supported |
The HTML and spreadsheet conversions are intentionally lightweight. They do not reproduce page layout, comments, formulas, footnotes, or visual formatting perfectly.
Encrypted, password-protected, corrupted, and some malformed documents cannot be read. Scanned PDFs and images require OCR, which this version does not provide. Very large extracted documents can consume substantial memory because the current version retains the extracted text and chunks in memory until the document session expires.
No document content is uploaded by this plugin. The language model running in LM Studio receives only the chunks or search results returned through tool calls.
Install the dependencies and start the plugin in development mode:
Then enable Document Streamer for a chat in LM Studio and enable tool use for the selected model.
Ask the model:
Open
/absolute/path/to/report.pdfand summarize it. Read every chunk before giving the final summary.
For a spreadsheet:
For a targeted question:
Open
/path/to/manual.pdfand search it for “factory reset”. Only read relevant surrounding chunks.
| Tool | Purpose |
|---|---|
open_document | Validates a path, extracts text, creates chunks, and returns the first chunk |
read_document_chunk | Returns any chunk by its one-based number |
search_document | Searches extracted text and returns matching excerpts with nearby chunk numbers |
close_document | Releases the stored document and its chunks |
| Setting | Default | Description |
|---|---|---|
| Additional allowed directories | Empty | Extra absolute directories from which documents may be read |
| Chunk size | 12,000 characters | Maximum target size of each chunk |
| Chunk overlap | 200 characters | Text repeated between adjacent chunks |
| Idle expiration | 120 minutes | Inactive sessions are removed after this period |
| Search results | 8 | Maximum matches returned by one search |
| Maximum stored documents | 8 | Inactive sessions are evicted beyond this limit |
Chunk sizes are characters, not model tokens. A smaller chunk size generally requires more model tool calls; a larger size consumes more model context per call.
open_document resolves the requested path and verifies that it is inside the working directory or an allowed directory.read_document_chunk for subsequent chunks, or search_document when only relevant passages are needed.The first open_document response includes the first chunk. The model must explicitly request later chunks. A model may stop early, so instructions such as “read the entire document before answering” are recommended when complete coverage matters.
Parsing and chunk storage happen locally in the plugin process. The plugin does not transmit documents to an external service. However, text returned by tools becomes available to the active model; a remotely hosted model provider could therefore receive that text.
Paths are resolved and checked against allowed directories. Do not add sensitive directories unless you intend the active model to read them.
Run lms dev while changing the source to reload the plugin during development.
Set your LM Studio username in manifest.json, update the package description and README, commit package-lock.json, verify the plugin, and run:
The model only sees the first chunk.
Ask it to continue with read_document_chunk, or explicitly request that it read every chunk before answering.
A session expired.
Call open_document again. Sessions are intentionally temporary to limit memory use.
A format is rejected. Convert it to PDF, DOCX, XLSX, HTML, or UTF-8 text. Scanned documents require OCR first.
Extraction produces little or no text. The file may contain scanned images rather than selectable text.
Parsing fails for a valid document. Try converting it to UTF-8 text or PDF. Complex layouts and malformed files can defeat simple extraction.
MIT
close_document releases one immediately.npm install
npm run typecheck
npm test
lms dev
Open /path/to/budget.xlsx and summarize each sheet.
npm install
npm run typecheck
npm test
npm run build
lms dev
lms push
close_document releases one immediately.npm install
npm run typecheck
npm test
lms dev
Open /path/to/budget.xlsx and summarize each sheet.
npm install
npm run typecheck
npm test
npm run build
lms dev
lms push