{"slug": "show-hn-i-built-threadshelf-to-reuse-hard-to-export-ai-chats-like-openrouter", "title": "Show HN: I built ThreadShelf to reuse hard-to-export AI chats like OpenRouter", "summary": "A developer released ThreadShelf, a local-first tool that archives and semantically searches AI chat exports from six providers: ChatGPT, Claude, Google AI Studio, OpenRouter, LM Studio, and Grok. The archive pipeline — parsing, embeddings, LanceDB storage, search, HTTP API, and MCP — runs locally, while conversation generation is labeled an Experimental Beta that keeps llama.cpp loopback-only and sends context off-device only through the explicitly marked OpenRouter external provider. ThreadShelf is tested against snapshots of specific versions, such as LM Studio 0.4.x, and its developer warns that Google AI Studio, OpenRouter, LM Studio, and Grok have no documented, stable export schema.", "body_md": "**Local-first archive, semantic search, and continuation for your AI conversations.**\n\nOne private workspace across **ChatGPT, Claude, Google AI Studio, OpenRouter,\nLM Studio, and Grok**. Search old conversations by meaning, reopen the complete\nthread, and continue it with a local GGUF model through `llama.cpp` or the\nexplicitly external OpenRouter provider.\n\nThe archive pipeline—parsing, embeddings, LanceDB storage, search, HTTP API, and\nMCP—runs locally. Conversation generation is an **Experimental Beta**:\n`llama.cpp` stays loopback-only; switching to the clearly marked\n**OpenRouter · external** provider sends the selected user/assistant context and\nnew prompt off-device.\n\n| Capability | What ThreadShelf provides | \n|---|---|\n| **Archive & retrieval** | Multi-provider normalization, local multilingual embeddings, semantic and exact search, complete thread reconstruction | \n| **Continue & create** | Local GGUF inference through managed `llama.cpp` , plus optional OpenRouter streaming | \n| **Use it anywhere** | React UI, command-line ingest/search, HTTP API, and an MCP stdio server over the same index | \n| **Keep control** | Loopback defaults, isolated local storage, explicit off-device labeling, synthetic test data | \n\n1. You export/copy your chats as JSON (see [Get your data](#get-your-data) ).\n2. ThreadShelf parses them into a common format, embeds them **locally** , and\nstores them in a local vector database (LanceDB).\n3. You search by meaning in the web UI, open the full original thread, and export any conversation to Markdown — or query the same index from an MCP client.\n4. Optionally start a new chat or continue an archived thread through local\n`llama.cpp` or explicitly external OpenRouter.\n\n``` php\nflowchart LR\n  exports[\"AI chat exports\"] --> parser[\"Provider parsers\"]\n  parser --> turns[\"Normalized turns\"]\n  turns --> chunks[\"Chunks\"]\n  chunks --> embed[\"Local embeddings\"]\n  embed --> db[(\"LanceDB + thread store\")]\n  db --> ui[\"React UI\"]\n  db --> api[\"HTTP API\"]\n  db --> mcp[\"MCP stdio\"]\n  db --> generation[\"Generation registry\"]\n  generation --> llama[\"llama.cpp<br/>local GGUF\"]\n  generation -. \"explicit off-device provider\" .-> openrouter[\"OpenRouter\"]\n```\n\n- **One normalized archive across six providers.** It includes sources whose\nhistory is otherwise split between exports, Drive files, browser pages, and\nlocal application data.\n- **Semantic, not just keyword.** Find a conversation by topic even when you don't\nremember the exact words — plus an exact-match mode for when you do (error\nstrings, identifiers, code).\n- **A local archive with an optional generation layer.** Search remains useful\nwithout configuring any LLM. When generation is wanted, the primary engine is\na loopback-only`llama.cpp` server; OpenRouter is a separately marked external\nchoice.\n- **One index, three front-ends.** The same archive is searchable from the web UI,\nthe HTTP API, and any MCP-capable tool.\n\n| Source | How export works | Format stability | \n|---|---|---|\n| **Google AI Studio** | Download your Drive \"Google AI Studio\" folder |  | \n| **OpenRouter** | Browser-console export script (this repo) |  | \n| **LM Studio** | Copy local conversation files | **0.4.x** | \n| **Grok / xAI** | Account data export ( `prod-grok-backend.json` ) |  | \n| **ChatGPT / OpenAI** | Official data export ( `conversations.json` ) | semi-stable | \n| **Claude / Anthropic** | Official data export | semi-stable | \n\n**Format note.** Google AI Studio, OpenRouter, LM Studio, and Grok have no\ndocumented, stable export schema — their vendors can change it without warning.\nThreadShelf is tested against snapshots of specific versions (e.g. LM Studio\n0.4.x). If a newer app version changes the shape, parsing may break; please open\nan issue with an anonymized sample.\n\n⚠️ \n\nYou only need the providers you actually use. Put exported files anywhere, then point ThreadShelf at that folder.\n\nYour prompts are saved to **Google Drive** in a folder named **`Google AI Studio`**.\n\n1. Open [Google Drive](https://drive.google.com) , find the`Google AI Studio` folder.\n2. Right-click → **Download** (Drive zips it). Unzip somewhere local.\n3. Index that folder. (Files have no `.json` extension — that's fine, they're\ndetected by content.)\n\nText chats and Imagen prompt histories from the July 2026 Drive export shape are supported. The format is undocumented and may change.\n\nOpenRouter has no bulk export, so this repo ships two browser-console scripts:\n\n- **All chats:**[`scripts/openrouter-export-all.js`](/ChrystianSchutz/ThreadShelf/blob/main/scripts/openrouter-export-all.js) — walks every chat in your sidebar and downloads one JSON per chat.\n- **Single chat:**[`scripts/openrouter-export-browser.js`](/ChrystianSchutz/ThreadShelf/blob/main/scripts/openrouter-export-browser.js) — exports just the chat currently open.\n\nTo export everything:\n\n1. Open [openrouter.ai](https://openrouter.ai/) signed in, with your chat list\n(sidebar) visible.\n2. Open DevTools → Console (`F12` →*Console* tab).\n3. Copy the entire contents of `scripts/openrouter-export-all.js` , paste into the\nconsole, press Enter.\n4. The script clicks each chat, scrolls to load full history, and downloads one\nJSON per chat. Allow \"**multiple downloads** \" if the browser asks.\n5. Move the downloaded files into a folder and index that folder.\n\nThe selectors are pinned to OpenRouter's current chat UI and covered by\n`test/playwright/openrouter-export.spec.js`. If OpenRouter changes its markup and\nthe script finds no chats, that test is where to update the contract.\n\nYou'll get a file shaped like this (this is what the parser reads):\n\n```\n{\n  \"platform\": \"openrouter\",\n  \"exportedAt\": \"2026-05-24T12:00:00.000Z\",\n  \"pageTitle\": \"OpenRouter chat title\",\n  \"sourceUrl\": \"https://openrouter.ai/chat/...\",\n  \"turns\": [\n    { \"role\": \"user\", \"content\": \"User message text\" },\n    { \"role\": \"assistant\", \"content\": \"Assistant reply\", \"model\": \"optional/model-name\" }\n  ]\n}\n```\n\nVerify a download before indexing:\n\n```\nnpm run parse -- path/to/openrouter-export.json\n```\n\nSee [docs/OPENROUTER.md](/ChrystianSchutz/ThreadShelf/blob/main/docs/OPENROUTER.md) for details and limitations.\n\nLM Studio stores **one JSON file per conversation** locally — no export step\nneeded, just point ThreadShelf at the folder (paths below):\n\n| OS | Path | \n|---|---|\n| Windows | `%USERPROFILE%\\.lmstudio\\conversations\\` | \n| macOS / Linux | `~/.lmstudio/conversations/` | \n| Older builds | `~/.cache/lm-studio/conversations/` (check here too) | \n\nPaste that path straight into the **manual folder path** box and index it — or copy\nit somewhere first:\n\n```\n# macOS / Linux\ncp -r ~/.lmstudio/conversations ~/lmstudio-export\n\n# Windows (PowerShell)\nCopy-Item \"$env:USERPROFILE\\.lmstudio\\conversations\" \"$env:USERPROFILE\\lmstudio-export\" -Recurse\n```\n\nFiles are named `<id>.conversation.json` and look like this (trimmed — the parser\nreads `messages[].versions[currentlySelected]`, splitting `thinking` steps from the\nanswer):\n\n```\n{\n  \"name\": \"My chat\",\n  \"createdAt\": 1700000000000,\n  \"lastUsedModel\": { \"identifier\": \"gpt-oss-20b\" },\n  \"messages\": [\n    {\n      \"versions\": [\n        { \"type\": \"singleStep\", \"role\": \"user\", \"content\": [{ \"type\": \"text\", \"text\": \"Hi\" }] }\n      ],\n      \"currentlySelected\": 0\n    },\n    {\n      \"versions\": [\n        {\n          \"type\": \"multiStep\",\n          \"role\": \"assistant\",\n          \"steps\": [\n            {\n              \"type\": \"contentBlock\",\n              \"style\": { \"type\": \"thinking\" },\n              \"content\": [{ \"type\": \"text\", \"text\": \"reasoning…\" }]\n            },\n            { \"type\": \"contentBlock\", \"content\": [{ \"type\": \"text\", \"text\": \"Hello!\" }] }\n          ]\n        }\n      ],\n      \"currentlySelected\": 0\n    }\n  ]\n}\n```\n\nConversation folders/subfolders are walked recursively. *Tested on LM Studio 0.4.x\n(0.4.16); the format is undocumented and may change.*\n\n**Note — LM Studio's local server (\"router\").** LM Studio can also run an\nOpenAI-compatible local server (Developer tab, default `http://localhost:1234`)\nthat routes requests across loaded models. That's an *inference* endpoint, not an\nexport — ThreadShelf indexes the on-disk `conversations/` files above, so you\ndon't need the server running to import or search your history.\n\nChatGPT → **Settings → Data controls → Export data**. You'll get an email with a\nzip; index the `conversations.json` inside it.\n\nClaude → **Settings → export your data**. Index the exported conversation JSON.\n\nGrok → request your **account data export** (xAI account/privacy settings). You'll\nget a download containing a `prod-grok-backend.json` somewhere under an\n`export_data/.../` folder. Index the folder that contains it — ThreadShelf\ndetects the file by content, so the surrounding directory names don't matter.\n\nThe file holds every conversation in one document, shaped roughly like this (the\nparser reads `conversations[].responses[].response`, splitting the model's\n`agent_thinking_traces` reasoning from its `message` answer):\n\n```\n{\n  \"conversations\": [\n    {\n      \"conversation\": {\n        \"id\": \"…\",\n        \"title\": \"My chat\",\n        \"create_time\": { \"$date\": { \"$numberLong\": \"1771000000000\" } }\n      },\n      \"responses\": [\n        {\n          \"response\": {\n            \"sender\": \"human\",\n            \"message\": \"Hi\",\n            \"create_time\": { \"$date\": { \"$numberLong\": \"1771000000000\" } }\n          }\n        },\n        {\n          \"response\": {\n            \"sender\": \"assistant\",\n            \"message\": \"Hello!\",\n            \"model\": \"grok-3\",\n            \"agent_thinking_traces\": [{ \"thinking_trace\": \"reasoning…\" }]\n          }\n        }\n      ]\n    }\n  ]\n}\n```\n\n*Timestamps are MongoDB extended JSON (`{ \"$date\": { \"$numberLong\": … } }`). The\nformat is undocumented and may change.*\n\nRequires **Node.js 20.19+** and npm.\n\n```\nnpm install            # installs server + client (npm workspaces)\nnpm run build:client   # builds the React UI into public/\nnpm start              # serves on http://localhost:3000\n```\n\nThen in the browser:\n\n1. **Create or select a collection** (think of it as a folder/project, e.g.`ai_studio` ,`chatgpt` ,`work_2026` ). Start with a throwaway one.\n2. **Select a folder** of exports, or paste an absolute folder path.\n3. Click **Index folder** and watch live progress.\n4. **Search** in natural language; use role filters (user / thinking / response).\nSwitch**Semantic → Exact** for case-insensitive substring matches — best for\nidentifiers, error messages, and code fragments the embedding model blurs.\n5. **Click a result** to open the full source thread; copy or export to\nMarkdown or JSON.\n\nUse **Stop indexing** to cancel an active run. The current embedding batch is\nallowed to finish safely; completed files stay indexed and an uncommitted file\nkeeps its previous index rows.\n\nFirst indexing is slow while the local embedding model downloads once, then it's\ncached. Working on the UI? `npm run dev` (backend) + `npm run dev:client` (Vite\nhot reload on :5173, API proxied to :3000).\n\nFor scheduled local backups or headless indexing:\n\n```\nnpm run ingest -- path/to/exports work_2026\n```\n\nOmit the collection to use `chunks`. Add `--clear` only when you want to wipe the\ncollection before indexing.\n\nTo keep a folder indexed as it changes (LM Studio rewrites its conversation\nfiles as you chat; AI Studio folders grow), add `--watch`:\n\n```\nnpm run ingest -- ~/.lmstudio/conversations lmstudio -- --watch\n```\n\nAfter the initial pass the process stays running, watches the folder\nrecursively, and re-indexes just the files that changed (debounced; tune with\n`--debounce <ms>`). Deleting a source file never removes it from the index —\nThreadShelf is an archive, and indexed conversations outlive their files.\n\nYou can also search straight from the terminal:\n\n```\nnpm run search -- \"that regex for polish postal codes\"\nnpm run search -- \"ECONNREFUSED 127.0.0.1\" -- --mode keyword --n 5\nnpm run search -- \"prompt injection\" -- --collection work_2026 --json\n```\n\nThe second `--` before CLI options is intentional: current npm versions can\notherwise consume option names that appear after positional arguments.\n\nFull walkthrough: [docs/GETTING_STARTED.md](/ChrystianSchutz/ThreadShelf/blob/main/docs/GETTING_STARTED.md).\n\nClick any result to open the full source thread, jump to the matched turn, filter user/reasoning/response roles, copy text, or export the conversation to Markdown or JSON. With no query, the search page lists all indexed conversations with provider badges — sort them by recency, length, or title, and narrow the list with the filter box.\n\n- **More like this** — one click on any search result or thread turn runs a\nsemantic search seeded with that passage, for \"I know I discussed this\nsomewhere else\" moments.\n- **Saved searches & pins** — star a query (with its filters and mode) to rerun\nit later, and pin conversations to keep them at the top of the browse list.\nBoth are stored in your browser's localStorage; nothing leaves the machine.\n\n**Experimental Beta.** The archive/search path is the stable release scope;\ngeneration interfaces and model compatibility may still change. Original\nexport files are never modified.\n\nUse **New chat** to start a locally saved ThreadShelf conversation, or open an\nimported thread and choose **Continue this conversation**:\n\n- **llama.cpp · local** — the primary engine. ThreadShelf discovers GGUF files,\nlaunches a loopback-only`llama-server` , streams tokens, reports CPU/GPU/hybrid\nplacement, and can eject the model from memory without deleting it.\n- **OpenRouter · external** — an optional provider with a live model catalog.\nSelecting this tab is the off-device choice: the model button carries an`off-device` chip and the composer says that the request is sent through\nOpenRouter. Archived`thinking` turns are excluded. Optional ZDR-only and\ndata-collection-denial routing can reduce eligible providers.\n\nCompleted chats and archive continuations are stored locally, embedded, and\nsearchable. A ghost-icon **Private conversation** is tab-scoped and is never\nwritten to the thread store or semantic index. Failed or stopped streams remain\nin a clearly marked, unsaved recovery card for the current tab.\n\nThe model menu discovers common LM Studio, llama.cpp, and Hugging Face model directories plus custom roots. It separates model selection from context/output settings, supports favorites, and exposes detailed runtime logs only on demand. Active streams hold a model lease so concurrent eject or configuration changes cannot unload a model mid-response.\n\n**Settings → Conversation generation → Set up local generation** resolves one\nplan for the whole first run: the official `llama.cpp` build for this machine,\nplus a GGUF model sized for the detected accelerator. The plan is shown before\nanything is fetched — every URL, SHA-256 digest, size, and destination — and one\nconfirmation runs it. Nothing downloads until you confirm, and Cancel stops an\nin-flight transfer immediately.\n\nThe plan is re-resolved on the server when you confirm; a client can never hand the server a URL to fetch and execute. If the resolved plan no longer matches the one you approved — a nightly build moved, the catalog changed, free VRAM shifted the recommendation — the run stops and shows the new plan for a fresh confirmation instead of downloading something you never agreed to.\n\n**Settings → Conversation generation → Download a model…** — or the same action\nin the chat's model menu — opens a read-only browser over the public Hugging\nFace API. It needs no account or token: search\nor sort by downloads, likes, trending, or recency, inspect a repository's\nquantizations, and see a per-quantization verdict for your hardware — **fits**\ninside the accelerator budget, **tight** (partly on CPU), or **too large**.\nBuilds from known publishers (`unsloth`, `lmstudio-community`, `bartowski`,\n`ggml-org`, `Qwen`, `google`, `mistralai`) are marked.\n\nDownloads land in `.threadshelf/models` (override with\n`THREADSHELF_MODELS_PATH`), which is gitignored and always searched for models,\nso a downloaded model appears in the model menu without further configuration\nand is selected automatically when the download finishes.\nEvery file is verified against the repository's LFS `oid` (its SHA-256) before\nit is moved into place. A cancelled transfer keeps its `.part` file and the next\nattempt resumes from there; any other failure deletes it.\n\nGated repositories are detected up front and marked in the UI. To use one, accept\nits licence on Hugging Face and set `HF_TOKEN` in the gitignored root `.env`. A\nconfigured token is sent with every Hugging Face request; without one, public\nrepositories still work. No conversation content is ever sent to Hugging Face —\nonly catalog metadata requests and file downloads.\n\nThe guided setup above covers the common case. The CLI installer remains the scripted, offline, and custom-build path, and stays the only way to install an archive ThreadShelf did not resolve itself.\n\nThe setup command is cross-platform (Windows x64/ARM64, macOS x64/Apple Silicon,\nLinux x64/ARM64 where official release assets exist). With no arguments it only\nlooks for `llama-server`; it does not make a network request, download, install,\nor execute it:\n\n```\nnpm run setup:llama\n```\n\nInspect the newest compatible official release without downloading an archive:\n\n```\nnpm run setup:llama -- -- --check\n```\n\nInstall the current official `ggml-org/llama.cpp` release. The interactive form\nrequires typing `install`; automation requires the explicit `--yes` flag. The\nofficial GitHub SHA-256 digest is verified and the MIT license/source metadata is\nkept beside the installed files:\n\n```\nnpm run setup:llama -- -- --install\nnpm run setup:llama -- -- --install --yes\n```\n\nUpstream's `/releases/latest` points at a semver release that carries no\nbinaries, so ThreadShelf follows its `nightly-tag.txt` pointer to the real\n`bNNNNN` build. Pin an exact upstream build with `--release`, and set\n`GITHUB_TOKEN` if you hit the anonymous API rate limit:\n\n```\nnpm run setup:llama -- -- --install --release b10088\n```\n\nDefault builds are portable CPU builds (Metal is automatic on macOS). Accelerated\nofficial variants may be selected with `--variant vulkan|cuda|rocm|sycl`; their\ndriver/runtime requirements still apply. Official variants are installed\nside-by-side under release-and-variant folders,\nso adding a GPU build never overwrites a working CPU build. Paste the desired\nvariant's printed `llama-server` path into Settings when more than one is present.\nAutodiscovery prefers the newest managed release and an accelerator variant over\nCPU for the same release; an explicitly configured executable still wins.\n\nOfficial Windows CUDA releases split the server and CUDA runtime DLLs across two archives. The CUDA install command downloads and SHA-256 verifies both. Re-running the same explicitly approved command repairs an older ThreadShelf CUDA directory that is missing the companion runtime without touching GGUF models:\n\n```\nnpm run setup:llama -- -- --install --variant cuda\n```\n\nFor Alpine, an unsupported architecture, or a custom build, provide your own\narchive URL. Supplying `--url` is explicit download consent; provide a trusted\nSHA-256 whenever possible:\n\n```\nnpm run setup:llama -- -- --url https://example.invalid/llama-build.tar.gz --sha256 64_HEX_DIGEST --tag custom\n```\n\nThe default destination is `.threadshelf/tools/`, which is gitignored. No model is\ndownloaded by this installer. Add existing GGUF directories and an optional\n`llama-server` path in **Settings → Conversation generation**.\n\nOpenRouter keys should preferably be supplied as `OPENROUTER_API_KEY` in the\ngitignored root `.env` file (copy `.env.example`, then restart the server). A key\nentered in the UI exists only in server memory for the current process and is\nnever written to `.threadshelf/generation.json` or returned by the API.\n\nGeneration configuration, created-chat storage, eject, and chat endpoints are\nloopback-only even when the read/search UI is exposed with `HOST` and\n`ALLOWED_HOSTS`. Full setup, persistence semantics, routing controls, runtime\ndiagnostics, and API examples are documented in\n[Experimental Generation](/ChrystianSchutz/ThreadShelf/blob/main/docs/GENERATION_BETA.md).\n\nThe **Insights** view charts your whole archive from data captured at ingest\ntime: activity over time, top models, turns per provider, and your longest\nconversations — scoped to one collection or all of them.\n\nThreadShelf exposes your local index to MCP clients (e.g. Claude Desktop, or any MCP-capable agent) over stdio — so a model can search your past chats as a tool.\n\n```\nnpm run mcp   # starts the stdio MCP server\n```\n\nExample Claude Desktop config (`claude_desktop_config.json`):\n\n```\n{\n  \"mcpServers\": {\n    \"threadshelf\": {\n      \"command\": \"npm\",\n      \"args\": [\"run\", \"mcp\"],\n      \"cwd\": \"/absolute/path/to/this/repo\"\n    }\n  }\n}\n```\n\nIt reads the same local LanceDB the UI uses — no extra setup. See\n[docs/MCP.md](/ChrystianSchutz/ThreadShelf/blob/main/docs/MCP.md) for the exposed tools.\n\n- **Collections** are local LanceDB tables (use them like folders/projects).\n- **Threads** are full conversations reconstructed from the parsed export; search\nreturns matching chunks, opening a result shows the whole thread.\n- **Stored thread snapshots** keep indexed conversations readable after source\nfiles are moved, rewritten, or deleted.\n- **Generation providers** implement one streaming contract over managed`llama.cpp` and OpenRouter, while per-thread leases and write locks protect\nconcurrent saves and model transitions.\n\nInternals: [docs/ARCHITECTURE.md](/ChrystianSchutz/ThreadShelf/blob/main/docs/ARCHITECTURE.md).\n\nThreadShelf is an npm-workspaces TypeScript/ESM project with a React 19 client and an Express 5 server. The full gate is deliberately broader than unit tests:\n\n| Layer | What is exercised | \n|---|---|\n| **Unit/regression** | Provider parsing, Unicode, chunking, validation, generation config/runtime helpers, thread persistence, client utilities | \n| **API + MCP E2E** | A real server, isolated temporary LanceDB/uploads/collections, ingest/search/thread/generation routes, and MCP stdio | \n| **Browser E2E** | The built production UI in Chromium: search, routing, collections, uploads, generation streams, privacy labels, responsive layouts | \n| **Repository gate** | Git/privacy hygiene, Markdown links, ESLint, TypeScript, client build, and all tests above | \n\nEvery provider has small synthetic fixtures. Real exports are used only to learn the JSON shape; private conversation content is never copied into the repository. CI runs the full gate on Linux and lightweight core checks on Windows.\n\n- Conversations indexed with the current version keep working (search, listing, and full thread view) even if the original export file is later moved, rewritten, or deleted — normalized turns are stored alongside the vectors at ingest time. Collections indexed with older versions still read threads from the original file path until you re-index them.\n- Very large archives are supported in normal use, but >100k chunk collections should still be validated against your own data before relying on exact stats.\n- Undocumented provider formats can change without notice; keep small anonymized fixtures for any real export shape that breaks parsing.\n- Conversation generation is **Experimental Beta** ; archive indexing and search\ndo not depend on it.\n- ThreadShelf is a single-user local application. The HTTP API has no user accounts or authentication and should remain bound to loopback unless it is placed on a trusted network with deliberate host configuration.\n\n| Command | Description | \n|---|---|\n| `npm start` | Start server on port 3000 ( `npm start -- 3001` for another port). | \n| `npm run dev` | Server with file watch. | \n| `npm run dev:client` | Vite dev server (UI hot reload on :5173). | \n| `npm run build:client` | Build the UI into `public/` . | \n| `npm run check` | Full gate: repo hygiene, lint, typecheck, unit + API/MCP E2E, build, Playwright. | \n| `npm run check:repo` | Reject tracked private artifacts/secrets before commit. | \n| `npm test` | Fast unit/regression tests. | \n| `npm run test:e2e` | API + MCP E2E with a temporary server and LanceDB. | \n| `npm run test:playwright` | Browser E2E (needs `npm run build:client` + Playwright). | \n| `npm run mcp` | Start the MCP stdio server. | \n| `npm run parse -- <file> -- [flags]` | Parse one export file ( `--no-user` ,`--no-thinking` ,`--no-ai` ). | \n| `npm run ingest -- <folder> [collection] -- [flags]` | Ingest a folder ( `--clear` ,`--watch` ,`--debounce <ms>` ). | \n| `npm run search -- \"<query>\" -- [flags]` | Search from the CLI ( `--mode keyword` ,`--collection` ,`--roles` ,`--n` ,`--json` ). | \n| `npm run setup:llama` | Discover local `llama-server` ; add`-- -- --check` or explicit install flags. | \n\nMissing Playwright browsers? `npx playwright install chromium`.\n\n| Variable | Default | Purpose | \n|---|---|---|\n| `PORT` | `3000` | Server port. | \n| `HOST` | `127.0.0.1` | Server host. Set explicitly only when trusted LAN access is required. | \n| `ALLOWED_HOSTS` | *(empty)* | Comma-separated extra Host/Origin names for trusted LAN access. | \n| `LANCEDB_PATH` | `.lancedb` | LanceDB directory. | \n| `UPLOADS_DIR` | `.uploads` | Uploaded source files. | \n| `COLLECTIONS_PATH` | `.collections.json` | Manual-collections registry file. | \n| `CHUNK_MAX_CHARS` | `2000` | Max characters per embedded chunk. | \n| `CHUNK_OVERLAP_CHARS` | `100` | Overlap between long chunks. | \n| `EMBED_BATCH_SIZE` | `25` | Embedding batch size during ingest. | \n| `GENERATION_CONFIG_PATH` | `.threadshelf/generation.json` | Non-secret Experimental Beta generation settings. | \n| `MASTER_PROMPTS_PATH` | `.threadshelf/master-prompts.json` | Saved master (system) prompts. | \n| `LLAMA_CPP_SERVER` | *(auto)* | Absolute path to an existing `llama-server` executable. | \n| `LLAMA_CPP_BASE_URL` | *(empty)* | Existing loopback-only llama.cpp server URL. | \n| `LLAMA_CPP_CONTEXT_SIZE` | `8192` | Managed local server context size. | \n| `LLAMA_CPP_ACCELERATION` | `auto` | `auto` ,`cpu` ,`gpu` ,`hybrid` , or`multi-gpu` . | \n| `LLAMA_CPP_GPU_LAYERS` | `20` | Exact layer offload for the hybrid profile. | \n| `LLAMA_CPP_SPLIT_MODE` | `layer` | Multi-GPU split: `layer` or`row` . | \n| `LLAMA_CPP_MAIN_GPU` | `0` | Main GPU index for applicable profiles. | \n| `LLAMA_CPP_TENSOR_SPLIT` | *(empty)* | Optional multi-GPU proportions, e.g. `3,1` . | \n| `LLAMA_CPP_THREADS` | `-1` | CPU generation threads; `-1` lets llama.cpp choose. | \n| `LLAMA_CPP_FLASH_ATTENTION` | `auto` | Flash Attention: `auto` ,`on` , or`off` . | \n| `LLAMA_MODEL_PATHS` | *(defaults)* | Extra model roots ( `;` on Windows,`:` on macOS/Linux). | \n| `THREADSHELF_TOOLS_PATH` | `.threadshelf/tools` | llama.cpp discovery/installer root. | \n| `THREADSHELF_MODELS_PATH` | `.threadshelf/models` | Catalog download root; always searched for models. | \n| `THREADSHELF_DISABLE_DEFAULT_MODEL_PATHS` | `0` | Set `1` to scan only explicitly configured roots. | \n| `HF_TOKEN` | *(empty)* | Hugging Face token; required only for gated repositories. | \n| `HUGGING_FACE_HUB_TOKEN` | *(empty)* | Alternative name for `HF_TOKEN` . | \n| `GITHUB_TOKEN` | *(empty)* | Raises the GitHub API rate limit for llama.cpp releases. | \n| `GH_TOKEN` | *(empty)* | Alternative name for `GITHUB_TOKEN` . | \n| `OPENROUTER_API_KEY` | *(empty)* | OpenRouter key; may be set in `.env` , never exposed to the browser. | \n| `OPENROUTER_BASE_URL` | `https://openrouter.ai/api/v1` | Override primarily intended for testing. | \n\nFor LAN access, bind to the interface you need and allow the exact browser host,\nfor example `HOST=0.0.0.0 ALLOWED_HOSTS=192.168.1.50,my-pc.local`. Without\n`ALLOWED_HOSTS`, API requests from other machines are rejected by Host/Origin\nchecks.\n\n- [Getting Started](/ChrystianSchutz/ThreadShelf/blob/main/docs/GETTING_STARTED.md) — install, run, index, search.\n- [Architecture](/ChrystianSchutz/ThreadShelf/blob/main/docs/ARCHITECTURE.md) — data flow, modules, storage, API.\n- [MCP Setup](/ChrystianSchutz/ThreadShelf/blob/main/docs/MCP.md) — run the stdio MCP server and what it exposes.\n- [OpenRouter Export](/ChrystianSchutz/ThreadShelf/blob/main/docs/OPENROUTER.md) — the browser export flow + limitations.\n- [Experimental Generation](/ChrystianSchutz/ThreadShelf/blob/main/docs/GENERATION_BETA.md) — llama.cpp/OpenRouter setup, privacy, and API.\n- [Real Data Testing](/ChrystianSchutz/ThreadShelf/blob/main/docs/REAL_DATA_TESTING.md) — validate private exports safely.\n- [FAQ](/ChrystianSchutz/ThreadShelf/blob/main/docs/FAQ.md) — common questions.\n- [Changelog](/ChrystianSchutz/ThreadShelf/blob/main/CHANGELOG.md) — release highlights.\n- [AGENTS.md](/ChrystianSchutz/ThreadShelf/blob/main/AGENTS.md) — guidance for AI coding agents and contributors.\n\nIndexing, embeddings, storage, search, MCP, and llama.cpp inference are local.\nThe explicitly selected **Experimental Beta OpenRouter generation is not\nlocal**: it sends the selected archive or ThreadShelf chat's user/assistant\nhistory and prompt to OpenRouter and\nthe routed provider. Two other surfaces reach the network but never carry\nconversation content: GitHub Releases for `llama.cpp` builds, and Hugging Face\nfor model catalog metadata and GGUF downloads — both only after you ask for\nthem. **Do not commit real chat exports, uploaded files, local\ndatabases, `.threadshelf/`, logs, or temp folders** — `.gitignore` excludes them.\n`npm run check:repo` also rejects these paths if they become commit candidates.\nFixtures in `test/fixtures/` are synthetic and anonymized. See\n[SECURITY.md](/ChrystianSchutz/ThreadShelf/blob/main/SECURITY.md).\n\nSee [CONTRIBUTING.md](/ChrystianSchutz/ThreadShelf/blob/main/CONTRIBUTING.md): add tests for parser/ingest/search changes,\nkeep real exports out of git, and run `npm run check` before opening a PR.\n\nMIT — see [LICENSE](/ChrystianSchutz/ThreadShelf/blob/main/LICENSE).", "url": "https://wpnews.pro/news/show-hn-i-built-threadshelf-to-reuse-hard-to-export-ai-chats-like-openrouter", "canonical_source": "https://github.com/ChrystianSchutz/ThreadShelf", "published_at": "2026-09-13 12:37:22+00:00", "updated_at": "2026-09-13 13:10:33.735363+00:00", "lang": "en", "topics": ["ai-tools", "ai-products", "large-language-models", "developer-tools", "ai-infrastructure"], "entities": ["ThreadShelf", "ChatGPT", "Claude", "Google AI Studio", "OpenRouter", "LM Studio", "Grok", "LanceDB"], "alternates": {"html": "https://wpnews.pro/news/show-hn-i-built-threadshelf-to-reuse-hard-to-export-ai-chats-like-openrouter", "markdown": "https://wpnews.pro/news/show-hn-i-built-threadshelf-to-reuse-hard-to-export-ai-chats-like-openrouter.md", "text": "https://wpnews.pro/news/show-hn-i-built-threadshelf-to-reuse-hard-to-export-ai-chats-like-openrouter.txt", "jsonld": "https://wpnews.pro/news/show-hn-i-built-threadshelf-to-reuse-hard-to-export-ai-chats-like-openrouter.jsonld"}}