Project Files
README.md
English | 日本語 | 简体中文 | 한국어 | Español
Version 0.4.0
File Search saves attached text, Markdown, JSON and HTML for repeatable literal search and source reading. Optional Find Relevant Passages uses an independent AI request for contextual candidates. This is a native LM Studio plugin, not an MCP server. No embeddings are used; literal tools require no model/API, while AI reading requires a separately running Strata endpoint or an explicitly loaded local model.
Install yuanjumay/file-search from LM Studio Hub and enable it in the chat. Use a model that supports tool calling.
Enable File Search’s tools and disable competing document preprocessors, such as standard RAG, that consume the same attachment first. A prediction working directory is not required. Attach documents and send a normal message, for example: “Search for retention periods, then read the surrounding passages and cite the filename and lines.” Actual tool use depends on the model.
| Tool | Purpose |
|---|---|
List Documents | List document IDs, names, line counts and encodings. |
Search Documents | Search text lines, JSON records or HTML blocks. |
Read Document | Read source text by line and column. |
Read JSON | Read structure or source by JSON Pointer/node ID. |
Read HTML | Read a post/block or list the outline. |
Import Saved Web Page | Optionally copy a saved web page into a collection. |
Find Relevant Passages | AI reading for contextual passage candidates. |
Copy the real collectionId from [file-search collection=...] or an import result. Use only declared parameters: do not add collectionId_note or collectionId-alias. documentId narrows a search. unknown_collection means the ID cannot be found; it does not prove the original attachment is gone. missing_document means stored data for a known document is missing and requires recovery or reattachment. No other chat’s latest collection is substituted.
Find Relevant Passages is experimental. Pass exact collectionId/documentId and a natural-language question (1–2000 characters). It reads the indexed body without a keyword prefilter, preserving HTML post/block IDs, decoded JSON scalar node IDs/pointers, or text source ranges. JSON binary-like values are skipped; record fields remain separate source passages. It receives no main-chat history or callable tools. This is a separate inference request, not another automatically loaded model or persistent memory.
Reader settings: readerBackend is strata (default) or local; readerModel defaults to strata. For local, enter an already-loaded LM Studio model identifier with enough context. Strata uses global readerBaseUrl (default http://127.0.0.1:8080/v1) and optional protected readerApiKey. These settings are independent of Strata Endpoint. A remote URL sends the selected document ranges there; keyword search never does. No model is downloaded or loaded by this plugin.
Bounds per call: startPassage defaults to 0; maxBatches defaults to 2 (maximum 3), sequentially. Each prompt is at most 16,000 UTF-16 characters / 48,000 UTF-8 bytes, including the question/metadata, with up to 32 passages. Long passages split at 2,000 characters with 150-character overlap. Each inference has a 120-second timeout and 2,048 output tokens. limit defaults to 5 (maximum 10); candidate output has a 9,000-character budget. nextPassage is the next unread passage; continue explicitly. Large documents are not fully read in one call, and zero hits never proves absence.
Only returned passage IDs and quotes that exactly occur within that passage are accepted. HTML post numbers and JSON coordinates come from stored indexes, not the reader. rejectedCandidates counts invalid selections; omittedCandidates counts accepted selections excluded by output limits. Reasons and relevance are model judgments, not verified facts; all source text remains untrusted. Read original sources before quoting. Automated tests use simulated reader responses and do not establish real-model recall or completeness.
.txt .text .log .md .markdown .json .jsonl .ndjson .html .htm .csv .tsv .xml .yaml .yml
UTF-8, UTF-16 LE/BE and Shift_JIS (CP932/Windows-31J) are supported. Automatic decoding checks BOM first, then HTML charset declarations, then strict UTF-8 and finally Shift_JIS if no declaration exists. Unsupported or invalid declarations stop import. No PDF, Word, Excel or image OCR support; CSV/TSV are plain text. An attachment-UI extension restriction can sometimes be worked around by attaching the text as .txt.
Override on a separate user-message line, outside code fences: @file-encoding sjis "legacy.html". The name must match exactly; omitting it changes the default for unspecified files. Supported values: auto, utf-8, utf-16le, utf-16be, sjis (also cp932, windows-31j, shift_jis). Overrides carry forward in this chat; auto resets them. Already stored text is not re-decoded just by changing a setting: reattach, preferably in a new chat if avoiding mixed versions.
mode is all (default), any or phrase. Matching uses NFKC and case folding, not fuzzy, semantic or regular-expression search; misspellings can miss a match. The unit is a text line, JSON record or HTML block. Results follow document/source order, not relevance ranking: default 5, maximum 20. Continue with nextOffset. Queries allow up to 512 characters and 16 terms. Read Document defaults to 40 lines, maximum 100 lines/12,000 characters; pass the returned next coordinates to continue. Read columns are UTF-16 source positions and can differ from normalized search columns.
.json is parsed as objects, arrays, keys and decoded string values while retaining source spellings, escapes and large integer digits. Elements of the outermost arrays become records; all can match fields within one record without combining separate messages. Results provide jsonPointer/jsonNodeId and matched-node references. Read JSON supports structured and source views, with up to 12,000 characters per read. childLimit must be 1–50; continue with nextChildOffset, or nextOffset for long values. Duplicate keys remain individually addressable by node ID. JSON Pointer is not JSONPath or executable code.
Binary-like Base64 fields are omitted from normal search/structure views but remain available in explicit source reads. Invalid JSON stops import with a location. Limits: 200,000 nodes, depth 128 and pointer length 8,192. JSONL/NDJSON use plain-text search. Conversation exports are searchable as generic JSON; selecting active branches, semantic summaries and automatic long-term memory are not implemented.
HTML is divided into recognized posts, heading sections and table rows without executing scripts. Supported post patterns include .post, article.post, data-post-id and numbered dl > dt + dd. Available post numbers, names, times, author IDs and reply references are retained. Unknown formats fall back to general text; not every forum or mirror is recognized. New imports retain the raw HTML. Old text-only imports require reattachment for structural indexing.
Search snippets preserve the spelling of the extracted body, although matching is normalized. Before quoting a post, use Read HTML with the same collectionId, documentId, htmlBlockId and available postNumber. A conflicting block/number is rejected; duplicate numbers need a block ID. Read results include citation and evidenceStatus; outlines are not full source reads. Line numbers, block IDs, search ranks and reply-to numbers are not post numbers. Do not invent numbers for unnumbered blocks. Use nextBlockOffset for outlines and nextOffset for long bodies. These identifiers help verify sources but do not automatically validate the model’s final citations.
Normal sends also import unprocessed documents in earlier Insert messages. With a local generator, Insert followed only by Generate/Regenerate may skip preprocessing; send a normal continuation message first. Strata Endpoint can import unprocessed history immediately before generation when File Search tools are enabled, including JSON followed by multiple image-only Inserts. Stored chat history and image forwarding are preserved; document bodies are replaced only in the generation copy with search references.
File Search works alone with manual HTML attachments. Optionally pass Visit Website Advanced’s pageId to Import Saved Web Page; add collectionId to combine with existing attachments, then use the returned new collection ID. Import reads a neutral v1 archive without network access or calling the other plugin. Visit also works independently. Shared archive: ~/.lmstudio/plugin-data/web-document-archive/v1/pages/; set the absolute LMSTUDIO_WEB_ARCHIVE_DIR consistently in both plugins to relocate it.
Default: ~/.lmstudio/plugin-data/yuanjumay/file-search/.rag-search/. Set an absolute LMSTUDIO_FILE_SEARCH_DATA_DIR to change the base directory and restart LM Studio; copy .rag-search to retain old data. Limits: 32 MiB per file, 128 MiB per attachment batch, 128 MiB extracted text and 200 documents per collection. Appending creates a new collection, preserving branches. Search scans stored text each time, without a vector database or inverted index.
Storage is local, unencrypted and not automatically deleted; shared web archives and imported copies are separate. IDs are access references, not OS authentication. Only documents in the specified collection are exposed. Keep collection references and data when moving chats. To remove data, stop the plugin and delete the relevant storage; affected chats will need reattachment. This plugin does not itself archive ongoing conversations or reduce their accumulated context.
Setting labels, descriptions and choices automatically use the OS locale when the plugin starts. Supported editions are English, Japanese, Simplified Chinese, Korean and Spanish; unsupported locales fall back to English. Traditional Chinese locales currently fall back to English. Detection uses Node’s default Intl locale, with locale environment variables only as a fallback if that is unavailable. This follows the OS/runtime environment, not a language selected separately inside LM Studio. Tool names, parameter keys, stored values and model-facing tool schemas stay unchanged.
There is no language selector in the UI. For an override, edit the shared file ~/.lmstudio/plugin-data/yuanjumay/ui-language.json, created with auto on first startup when writable. Use auto, en, ja, zh-CN, ko or es. The same file controls Analyze Images Advanced, Visit Website Advanced, Strata Endpoint, File Search and File Save. Restart the affected plugins or LM Studio after editing. Missing/unreadable/invalid preferences do not prevent startup; automatic detection is used. Datetime Advanced currently has no custom configuration panel to translate.
{ "language": "auto" }
Guide text may refer to English setting names; translated tables also show those names for reference. The LM Studio application’s own controls follow its own localization. Only setting display text is localized here, not model-facing prompts or tool results.
From a local checkout, run the following in this plugin’s directory. Development files and tests are available in the source checkout, not necessarily in the Hub download.
npm ci lms dev --install
npm run check npm test
Automated tests check data handling and requests using substitute model responses. They do not establish a real model’s recognition accuracy, search decisions or answer quality.
Developed by Yuan Jumay. Shared HTML/archive processing is bundled with the plugin; it does not load another installed plugin’s private files. Dependencies retain their respective licenses.