Skip to content

About

The Researcher: a research and context loader for AI agents. Named sets, saved presets, and a popup to tick what this session needs, saving those precious tokens, keeping your context close at all times in every chat.

Topics

Resources

Contributing

Security policy

Stars

3 stars

Watchers

0 watching

Forks

Repository files navigation

The Researcher

A research and context loader for AI agents.


est. tokens squeezed est. tokens not loaded

estimates, from the installs that chose to share

A white robot sits on a mossy rock by a misty mountain lake at sunrise, reading an old book, chin resting on its hand

You keep research on disk. HTML reports, Markdown notes, saved PDFs. Every session, you tell Claude "read my notes on Rust first" and watch it chew through files it already read yesterday. Some of those files are fat with markup, page numbers, and invisible padding that costs tokens but adds nothing.

The Researcher fixes that in one move. You type /researcher rust. A small window pops up. It shows your documents, their size in tokens, and what you picked last time. You tick what this session needs. Claude reads exactly those — converted to clean text, squeezed for tokens, nothing else. What you leave unticked costs zero.

Works in Claude Code and opencode. New here? The user manual walks through everything step by step.

Why these numbers should bother you

Every token you spend on research is one less token for the actual work.

Raw HTML Converted text PDF
85 documents measured 1,289,597 tokens 745,528 tokens
Relative cost 1.7x 1x (baseline) 2.2x

A PDF costs 2.2 times what the same content costs as clean text. Raw HTML is 1.7 times heavier. The squeeze step strips another 36% from PDFs alone — layout padding, repeated headers, page numbers that say "Page 14 of 38" on every page. Gone. Content stays.

That "tokens not loaded" number in the badge? It is a ceiling, not a measurement: for each load, the size of the whole library minus what was ticked, counted as if you would otherwise have loaded everything. Nobody would, and anyone can post numbers to the receiver, so read both badges as estimates. The saving that is real is the documents you don't open.

What it does

  • Sets: named lists of documents in a small config.toml. Sets can include other sets, and ids can be globs (rust/*).
  • Saved defaults: next time your last choice is pre-ticked, and documents added since are marked NEW.
  • Custom sets: name a set you never defined (/researcher side-project) and the first call shows your whole library; what you tick becomes that set.
  • Earlier chats as context: /load-context opens the same window but lists your earlier Claude Code and opencode chats. Tick the ones this session needs, and your past conversations become context — without reading every transcript in full. Chats you will come back to can be set apart with /mark and are found again under a Marked chip.
  • Project profiles: source code, chats and research side by side with presets. One click loads "the GUI files, the two chats where we debugged the renderer, and the colour-theory paper".
  • Formats: .html, .md, .txt, and .pdf (through pdftotext when installed, otherwise the built-in reader). Folders with an index.html count as one document.
  • Read-only: your library is never changed or moved. Claude reads a plain-text copy kept in the researcher's own folder (see The text copy). The one exception is --retitle, off until you add a [retitle] section: it gives documents from other tools a name in your own style (see the manual).

The challenge

Run researcher --usage after a week. Look at the numbers. The tokens squeezed, the tokens you didn't load, the difference between what you would have spent and what you actually spent. Then, if you like, run researcher --usage-share on and add your numbers to the live counters. The two badges at the top update every five minutes.

How it looks

The first picture is a set with a saved preset (a load window now opens with nothing ticked; Back to saved preset ticks them), a document added since is marked NEW, and the rest of your library follows below it, unfolded. The second is a set you have never used: your whole library, grouped by folder, with nothing ticked. Above the list are the topic chips: All (always on when the window opens) and one chip per set in your config; rename gives a document or a set a display name. Cancel (load nothing) always leaves without sending anything.

Popup with a saved preset

Popup for a new set

The first time you load research, before a library is set, a smaller window asks where your research is: the folder that holds it, or the folder where you will make or copy it from now on. Type a path or press Choose folder… for the system folder dialog. A folder that does not exist yet is made. The choice is saved as library in config.toml, and the chooser opens right after.

First use: choose the research folder

/load-context (earlier chats as context, see below) opens the same window on its Chats tab; the Research tab next to it loads only when you click it (see One window, two tabs). The first picture is a saved preset on the Week chip, grouped by time (the window now always opens on All with nothing ticked and every chat in view; Back to saved preset ticks the preset), and chats started since are marked NEW. The second is a preset you have never used: the chats of this week under Today, Yesterday and Earlier this week, nothing ticked, with the preset's name field next to Remember.

Chat window with a saved preset

Chat window for a new preset

/researcher profile myapp gui opens a project profile: Code | Chats | Research, with the preset buttons on top. The preset gui ticked two source files, two chats and one research document at once; Chats and Research loaded because the preset needed them.

A project profile with the preset gui

All pictures use the made-up documents in examples/library and made-up chats. tools/screenshots.sh makes them again: it opens the windows six times for about a second each, needs a display, and runs with a throwaway home folder, so none of your own files, settings or paths are touched or shown.

The text copy

Every document of your library gets one plain-text file in the researcher's own folder, ~/.local/share/researcher/text/ (or text_dir in config.toml). Your own files are only read.

  • Files in other encodings are read right: UTF-16 (as Windows PowerShell writes it), old Western files (windows-1252) and web pages that name their own charset. Files and folders whose name is not UTF-8 are included too.
  • Made once per document, and again only when the source file changes (size or modified time) or the researcher's converter changes. Opening the popup on a library you already converted costs about a tenth of a second instead of a pdftotext run per PDF.
  • researcher --sync makes or refreshes the copy of the whole library and loads nothing.
  • Copies stay when a document leaves the library (a library on an unplugged drive keeps working), so a deleted private document can still be read from its copy. researcher --sync --prune removes the copies whose source file is really gone (not "no permission"). Delete the folder any time; it is rebuilt.
  • HTML and Markdown comments (<!-- ... -->) are dropped before anything else, so text hidden in a comment never reaches Claude. A <!-- inside a Markdown code span or fenced code block is text and stays. Hidden elements (display:none, <details>) are still kept.
  • The text is squeezed for tokens, without dropping content: PDF layout padding and indentation, page numbers and headers/footers that repeat on most pages, lines of rule characters, zero-width characters, runs of blank lines and exact repeated lines (PDF and HTML only). Markdown and text files are only tidied (indentation, code and repeated lines are kept).
  • What the conversion leaves out. HTML: <script>, <style> and <svg> blocks and comments, link targets (the link text stays), image alt text, and any table structure beyond | between cells; Markdown: comments. PDF: lines of only a page number, headers and footers that repeat on most pages, and, as everywhere, runs of padding. Hidden text (display:none, white on white) is not removed: it reaches the model like any other text. If a document depends on any of the left-out parts, read the original.
  • Measured in characters on 11 sampled PDFs (16 Nov 2026): 394,359 characters from pdftotext -layout, 251,104 after squeezing, so 36% fewer; per document 2% to 48%. The spread follows how much of a PDF is padding. Tokens were not counted for this step. A library that mostly holds HTML gains little, because HTML is already converted to text.

Usage log

After every load the researcher appends one line to ~/.local/share/researcher/usage.jsonl, so you can see what it saves on your library. A load is a library load (researcher SET) or earlier chats loaded as context (--context, --session-load); listing, setting up and cancelling load nothing and log nothing. It is local and anonymous, and nothing is sent unless you say yes (see Sharing below).

What a line holds, and nothing else: the day, a random install id (usage-id next to the log; delete it to start a new one), how many documents were loaded and in which formats (pdf, html, md, txt, or chat for a chat loaded as context), and character sums: source bytes, converted text before and after squeezing, the loaded characters per format, and the whole library (for a chat load: every chat up to the newest one picked) after squeezing. It never holds a title, a path, a set name or where your library is. The log is plain JSON lines; read it before you share anything.

researcher --usage                 totals: characters loaded, squeezed away, left unticked, with estimated tokens
researcher --usage-export [FILE]   write the records to FILE (default researcher-usage.json) so you can look at them
  • Squeezed away is real: converted text before minus after the squeeze, for the documents you loaded.
  • Converted is the saving from reading text instead of the original: an HTML page costs 1.73x its converted text and a PDF 2.2x (measured below), so each loaded HTML character saves 0.73 and each PDF character 1.2 of a text character. Markdown, text files and chats are read as they are and save nothing here. Older log lines (before 0.5) do not say their formats and add nothing to this number.
  • Counted against how you read research before. If you used to give Claude the PDFs, run researcher --usage-before pdf (or html): every loaded document that also exists in your library as a PDF then counts its saving against the PDF, even when the researcher loaded the HTML or Markdown copy (1.2 per character instead of 0.73 or 0). A document without a PDF counts against the one copy it has. Without the setting (a new user, or --usage-before none), each document counts against the file it was loaded from, on the reasoning that you keep one copy of each and would have read that one; research kept only as Markdown or text then saves nothing here. Saved as before = "pdf" under [usage] in config.toml; log lines from before 0.7 count the loaded format.
  • Left unticked compares each load with loading your whole library; it is a ceiling, not a measurement, because nobody would load everything. For earlier chats the comparison is every past chat up to the newest one you picked (last active at or before it), minus the ones you loaded: what catching up on all of them would have cost.
  • Tokens are estimated from characters (2.4 per token, see below), not counted by a tokenizer.
  • Switch the log off with [usage] log = false in config.toml; then no log and no install id are written.

Sharing (opt-in)

You can send the same anonymous lines to the project, so it can see what the researcher saves across installs. It is off until you say yes: while you have not decided, a load ends with USAGE SHARING: not decided and the skill asks you once.

researcher --usage-share on        send the lines (saved as `share = true` under [usage] in config.toml)
researcher --usage-share off       never send (`share = false`)
researcher --usage-send --dry-run  print exactly what would be sent, send nothing
researcher --usage-send            send the lines not sent yet, now
  • With sharing on, a load starts a sender in the background at most once a day: the load never waits on the network, the lines in between wait in your log and go together with the next send, and a failed send is tried again after the next load. To send after every load instead, put every = "change" under [usage] in config.toml. usage-last-send next to the log holds when the last send went through. --usage-send always sends at once.
  • What is sent is the log lines as they are, plus seq: the line's number in your log, so two identical loads on one day both count and a line sent twice is stored once. Nothing else: no title, path, set name, library location, GitHub login or account. The receiver (worker/) refuses any other field and keeps no IP address, headers or request logs (Cloudflare still sees the connection, as any host does).
  • The two badges at the top are live totals over every shared load, and estimates: the receiver cannot check what a client sends. It only takes the app's own ratio (2.4 characters per token), library sizes up to 200 million characters and at most 500 loads per install and day, and rate-limits posts, but anyone can still post made-up records, so the totals show what sharing installs report, not what users saved. est. tokens squeezed is the squeeze (the converted text before minus after squeezing) plus the conversion saving above (reading text instead of the HTML or PDF), both from the ratios measured on 85 reports; est. tokens not loaded compares each load with loading the whole library every time, so it is a ceiling, not a measurement (for a chat load: every past chat up to the newest one picked). Both are estimated from characters with the ratio each load used (2.4 per token). A shared load shows up on this page about 5 to 10 minutes after it is sent (the badge images are cached for 5 minutes), so with the daily send up to a day after the load. Raw totals: /v1/stats.
  • researcher --usage ends with the sharing state and how many lines wait. usage-sent next to the log holds how far the log was sent.
  • [usage] url = "..." sends to your own receiver instead (the same worker/ deployed on your account).
  • To have your lines removed from the project's receiver, open an issue with your install id (the usage-id file); then delete usage-id to start a new one. The sharing is therefore pseudonymous rather than anonymous: the install id is stable until you delete it, and a removal request names it publicly.
  • The log is rotated above 2 MB: it becomes usage.jsonl.1 (the one before it is dropped), --usage still adds both up, and usage-base keeps the line numbers (seq) counting. With sharing on, nothing is rotated away before it was sent.

What it saves

Measured with Anthropic's count_tokens endpoint (model claude-sonnet-5-5, 16 Nov 2026) on 85 reports from one library, about 1.29M tokens of HTML in total. Each was counted as the raw HTML and as the text the researcher converts it to. For the first 50 (the ones that also exist as PDF) the PDF was counted too. The 85 are the library's reports that have an HTML version, apart from duplicate copies of the same title and a layout test page (nine of them Dutch).

Raw HTML Converted text PDF (first 50 only)
Total, 85 documents 1,289,597 745,528
Average per document 15,172 8,771
Total, first 50 documents 755,968 443,537 975,533
Average per document, first 50 15,119 8,871 19,511
Relative to the converted text 1.7x 1x 2.2x
  • Converting HTML to text cuts the load to 57.8% of the raw HTML (42% saved). Per document it ranged from 34% to 83% (median 58%): pages heavy in markup, tables and inline CSS gain most.
  • A PDF read as a document costs 2.2x the converted text (1.9x to 2.8x per document, median 2.3x, measured on the first 50), because the page images are counted as well.
  • The researcher still reads every ticked document in full. The larger saving is what you leave unticked, which costs nothing. It also replaces the search-and-read turns of "read my notes on X" with one call.
  • The converted text came to 2.4 characters per token over the 85 documents (2.0 to 3.0 per document, token-weighted 2.42), and the popup sizes and the usage log assume 2.4. An earlier flat 4 characters per token understated the real cost by roughly 1.7x. The ratio varies with the content: code, tables and non-English text tokenize denser than prose (the nine Dutch documents averaged 2.05, the others 2.5), so treat popup sizes as close, not exact.

Measure it yourself

tools/measure-tokens.sh LIBRARY repeats this measurement on any folder: it converts the library with the researcher (using a throwaway config, so your own settings are untouched), then counts every original and every converted copy with count_tokens and prints a table per document, the totals, the ratio and the characters per token. A PDF is sent as a document, like an agent would read it, and a PDF that sits next to its HTML or Markdown original is counted too. Try it on the made-up examples/library:

export ANTHROPIC_API_KEY=...        # counting tokens generates nothing, but it needs a key
tools/measure-tokens.sh examples/library

Needs curl, jq and the researcher program. --model ID picks the tokenizer (default claude-sonnet-5-5, the one the table above used; counts are model-specific) and --limit N stops after N documents. The text of every counted document is sent to the Anthropic API, so use a library you are fine sending there. The table above was counted on 85 reports from one private library that is not in this repository, so your numbers on other documents will differ; the example library is made up and small, so it shows the method, not the ratios. The script was tested against a local stand-in for the endpoint, not yet against the live one.

Keep research out of MEMORY.md

Claude Code loads MEMORY.md (and CLAUDE.md) in full at the start of every session. If it lists a pointer to every research document you own, you pay for all of those lines in every session, including the ones that never touch the topic. Do not do that. Keep at most one line in MEMORY.md that says research lives in the library and is loaded with /researcher SET, and let the window pick what a session needs. The pointers then cost nothing until you load them.

Eighty-five documents from one person's library is still a sample of one topic mix, so read the percentages as indicative.

Why it is built this way

The choices below are the reasons, and where they are open to doubt, so you can judge them. None of the alternatives was measured against this tool; the only measurements here are the token counts above.

  • A tick-box window, not @ imports in CLAUDE.md. @ imports load the same files every session. The use this is for is a library of dozens to hundreds of reports where each session needs a different handful, so the choice is made per session, by you, in a few seconds, and remembered as a named set. If your library is small and the same few documents always matter, a short @ list is simpler and you do not need this.
  • A command-line program the agent runs, not an MCP server. It needs no server process or registration, works the same in Claude Code and opencode, and the user (not the model) decides what is loaded. The cost: the agent cannot search the library by itself, and a document server could, which this tool does not do (see "Not done" below).
  • It prints file paths instead of the text. The agent reads the files with its own read tool, so the output stays small (long tool results get cut), the host's own limits and permissions apply, and a document can be read again later without running anything. Inlining the text would put every ticked document into one tool result.
  • Characters divided by 2.4, no tokenizer. Claude's tokenizer is not published; the only exact count is the count_tokens API call, which needs a key and sends your text away. The 2.4 was measured once with that call on 85 reports (see "What it saves") and is used for the window sizes and the usage numbers, so they are estimates.
  • One program, Rust. The first version was a Python script. The Rust one gives a native window and a single binary for Linux and Windows. The Python version was kept for a while as a fallback and retired after v0.7.6: it doubled every change, and its GTK window was never tested. Old releases and the git history still have it.
  • Usage sharing is a separate, optional part. It measures what the tool saves across installs. It is off until you say yes, the receiver is a small Worker you can read in worker/, and the numbers on the badges are estimates (see Sharing). Nothing in loading depends on it.

Not done

No tokenizer, no MCP mode, no macOS release, no Office formats, no OCR (a scanned PDF has no text to extract; it is reported as UNREADABLE ... no text found, not loaded empty), no search over the library, no warning when a selection is bigger than the model's context window, and no output as JSON: the lines the agent reads are described in the manual.

Requirements

  • Linux x86_64 with a desktop (Wayland or X11) for the popup, or Windows 10/11 x86_64. Without a display it uses your saved defaults.
  • For PDFs: nothing extra. When pdftotext (poppler, poppler-utils) is installed it is used, because it keeps the page layout; otherwise the built-in reader does the job. Either one runs as its own process with a time and size limit, so a broken PDF can't crash or hang the loader. RESEARCHER_PDF_READER=builtin always uses the built-in one.

The program is written in Rust (src/) and the popup in egui, so nothing else is needed. macOS builds are checked in CI but not supported yet. On Windows and macOS the config and data folders are the native ones: on Windows %APPDATA%\researcher (config, text copy, usage log) and %LOCALAPPDATA%\researcher (cache). On Windows XDG_CONFIG_HOME, XDG_DATA_HOME and XDG_CACHE_HOME override the folders (handy for test runs).

Install

  1. The program: download researcher-<version>-x86_64-linux and SHA256SUMS.txt from the latest release, check and install it:
    sha256sum -c --ignore-missing SHA256SUMS.txt
    install -m 755 researcher-*-x86_64-linux ~/.local/bin/researcher     # any folder on your PATH
    From v0.7.5 on, SHA256SUMS.txt is also signed with minisign. Download SHA256SUMS.txt.minisig too and check it first (apt install minisign, or see the minisign page for other systems):
    minisign -Vm SHA256SUMS.txt -P RWSbaymJe3S6ENOvNpzqgBcc6FlX2MjcdiSVhWPBh76zOPTdnqWMsQns
    The key is the one in minisign.pub. It never leaves the maintainer's machine, so a release whose files were swapped on GitHub fails this check even when its SHA256SUMS.txt was swapped too. Or build it from the clone: cargo install --locked --path .
  2. The skill, and a starter config:
    git clone https://github.com/LudaLunizz/the-researcher.git
    cd the-researcher
    mkdir -p ~/.claude/skills
    cp -r skills/researcher ~/.claude/skills/        # or: ln -s "$PWD/skills/researcher" ~/.claude/skills/researcher
    cp -r skills/load-context ~/.claude/skills/      # optional: /load-context for earlier chats
    cp -r skills/mark ~/.claude/skills/              # optional: /mark to set a chat apart
    
    researcher --init ~/research                     # optional: writes ~/.config/researcher/config.toml

The skill runs researcher from your PATH. You can skip --init: on the first load the program asks for your research folder in a window and writes the config itself.

On Windows

Every release has researcher-<version>-x86_64-windows.exe and install.ps1. Download both into one folder and run, in PowerShell:

powershell -ExecutionPolicy Bypass -File .\install.ps1

It checks the .exe against SHA256SUMS.txt, puts it in %LOCALAPPDATA%\Programs\researcher\researcher.exe, adds that folder to your user PATH (no admin rights needed), and copies the researcher, load-context and mark skills of the same version into %USERPROFILE%\.claude\skills (-NoSkills skips that; a skill folder that is a link is left alone). -Version v0.8.0 installs a given release. Then open a new terminal, start Claude Code and type /researcher: on the first load a window asks for your research folder.

By hand: check the file with Get-FileHash researcher-*-x86_64-windows.exe against its line in SHA256SUMS.txt, rename it to researcher.exe, put it in any folder on your PATH, and copy skills\researcher, skills\load-context and skills\mark into %USERPROFILE%\.claude\skills.

Good to know:

  • The .exe is not code-signed yet, so Windows SmartScreen may warn the first time ("More info", "Run anyway"). The checksum is how you know it is the released file.
  • It needs nothing else: no Visual C++ Redistributable, no poppler (PDFs use the built-in reader unless pdftotext is on your PATH), no Python.
  • Earlier chats (/load-context, [sessions]) are read from %USERPROFILE%\.claude\projects, like on Linux. --resume prints cd 'FOLDER'; claude --resume ID for PowerShell (quotes in the folder name, straight or curly, are doubled); Git Bash runs it too when the folder name has no quotes. opencode installed with npm (opencode.cmd) is found on the PATH.
  • Build it yourself: cargo build --locked --release with the MSVC toolchain (Visual Studio Build Tools).

In opencode

The same skill works in opencode. opencode reads skills from ~/.config/opencode/skills/ and slash commands from ~/.config/opencode/command/:

mkdir -p ~/.config/opencode/skills ~/.config/opencode/command
ln -s "$PWD/skills/researcher" ~/.config/opencode/skills/researcher
cp opencode/commands/researcher.md ~/.config/opencode/command/researcher.md

Restart opencode, then type /researcher rust, or say "load my research for rust". It runs the same researcher program with the same config, library, text copy and usage log, so Claude Code and opencode share everything. If opencode runs sandboxed (a container, bubblewrap) it needs read access to the program, ~/.config/researcher, your library and the text copy, and a display for the popup; without a display you get the saved defaults. opencode also reads ~/.claude/skills/ on its own unless OPENCODE_DISABLE_CLAUDE_CODE is set, so the Claude Code install above may already be enough.

opencode asks before reading files outside the project folder, and the loader prints paths in the researcher's own folders. To skip that question for just those two folders, add this to ~/.config/opencode/opencode.jsonc:

"permission": { "external_directory": { "~/.cache/researcher/*": "allow", "~/.local/share/researcher/text/*": "allow" } }

The popup title names the program that asked: opencode when opencode started the loader (it sets OPENCODE=1), Claude Code otherwise. RESEARCHER_HOST="name" overrides it.

/load-context works in opencode too: copy opencode/commands/load-context.md next to the other command, link skills/load-context, and switch on opencode chats in the config (see Sessions, below). Without that, --sessions and --context only know Claude Code's chats.

Try it first on the made-up documents in examples/library: researcher --library examples/library rust. Then edit ~/.config/researcher/config.toml (see examples/config.toml) and in Claude Code type /researcher rust, or just say "load my research for rust".

Configure

library = "~/research"        # folder with your documents
default_set = "rust"          # used when you name no set
exclude = ["scratch/*"]       # ids left out of the library (globs)

[aliases]
rs = "rust"

[sets.rust]                   # a topic
docs = ["rust/linux-notes", "rust/memory-*"]

[sets.myapp]                  # a project: other sets plus its own documents
include = ["rust"]
docs = ["myapp/roadmap"]

A document id is its path inside the library without the extension: ~/research/rust/linux-notes.html is rust/linux-notes. If x.html and x.pdf both exist, the HTML one is used. Hidden files and folders are skipped. all is a built-in set with the whole library.

RESEARCHER_LIBRARY or --library PATH overrides the library for one run.

Command line

researcher [SET ...]              popup, then convert the ticked documents and print their paths
researcher --setup SET            popup only: change the saved defaults, load nothing
researcher --no-popup SET         use the saved defaults without asking
researcher --list                 sets, document counts, saved defaults
researcher --sync                 make or refresh the text copy of the whole library, load nothing
researcher --sync --prune         the same, and remove the copies whose source file is gone
researcher --usage                local totals of what it saved (see Usage log)
researcher --usage-export [FILE]  write the anonymous usage records to a file; nothing is sent
researcher --usage-share on|off   share the anonymous usage counts with the project, or not
researcher --usage-before pdf|html|none  how you read research before; the conversion saving counts against it
researcher --usage-send [--dry-run]  send the usage records not sent yet (only with sharing on)
researcher --retitle [--dry-run]  give documents from other tools a name in your style (opt-in [retitle], see the manual)
researcher --init [LIBRARY]       write a starter config
researcher --sessions             list tracked closed sessions (opt-in, see Sessions)
researcher --rename ID NAME       rename a tracked session ("" = back to the automatic name)
researcher --resume ID            print the command that resumes a session
researcher --session-load ID      write a session's conversation as a .txt to load as context
researcher --context [PRESET ...] pick earlier chats in a popup and load them (see Earlier chats)
researcher --mark [NOTE]          set this chat apart: the Marked chip finds it later (see Marked chats)
researcher --unmark               take the mark off this chat
researcher --marked               list the marked chats
researcher --mark|--unmark --chat ID  mark or unmark another chat (an id or a unique prefix)
researcher --start code|chats|research  the tab the window opens on (see One window, two tabs)
researcher --profile NAME [PRESET]  code, chats and research of a project, with presets (see Project profiles)
researcher --context --setup P    change a context preset, load nothing
researcher --context --list       list the saved context presets

It prints one path per ticked document; the skill tells Claude to read each one in full. The output lines and files are described in the manual. Exit codes: 0 ok, 2 a mistyped flag or argument (the command-line parser's own), 10 a set, preset or profile name that is not valid or not known, 3 cancelled, 4 popup timed out, 5 custom set with no saved choice and no popup, 6 config or library problem, 7 sessions switched off, 8 session id not found or ambiguous, 9 usage sharing not switched on (--usage-send), 11 another --retitle is running, 1 a send failed (the records stay queued) or a --retitle step failed.

Files: config, saved choices, the session registry and context presets in ~/.config/researcher/ (config.toml, choices.json, sessions.json, contexts.json, marked chats in marks.json, display names in names.json, the last time chip and grouping in ui.json), the text copy in ~/.local/share/researcher/text/ (.index.json there tracks which source each copy came from), the usage log (usage.jsonl and its rotated usage.jsonl.1, usage-id, usage-sent, usage-base) in ~/.local/share/researcher/, and session loads in ~/.cache/researcher/.

Sessions (optional)

Off by default. Switch it on in config.toml:

[sessions]
enabled = true
# idle_minutes = 10                  # a session untouched this long counts as closed
# projects_dir = "~/.claude/projects"
# extra_dirs = ["~/old-chats"]       # more folders with moved chats (see below)
# opencode = true                    # also list opencode's chats (asks the opencode program)
# opencode_cmd = "opencode"          # the program to ask, when it is not on PATH

Then researcher --sessions lists every closed Claude Code (and, if switched on, opencode) session, newest first: the full session id (the one Claude Code prints when you close a session), the last-active time and a name. The name comes from Claude Code's own title if the session has one, otherwise from the first prompt. --rename ID NAME replaces it, and a rescan never overwrites a name you set.

Name and id are stored together, keyed by the full id, and every command prints them together ("name" (id)), so a name can't drift onto the wrong session. ID may be a unique prefix of 4 or more characters. --resume ID prints cd <project folder> && claude --resume <id> (Claude Code only finds a session from its own folder). --session-load ID writes the session's prompts and replies, without tool output, as a .txt; the skill reads it like a research document. Sessions longer than 200,000 characters keep their start and their end.

opencode chats. opencode keeps its chats in its own database, so with opencode = true the researcher asks the program itself (opencode session list, opencode export ID) and keeps one plain transcript per chat in sessions-opencode/ next to sessions.json. Each chat is exported once and again only after it changed; the first run takes a few seconds per chat (four at a time). They show up in --sessions, --context and the other commands like any chat, with opencode's own title as the name (the first prompt when it has none) and the folder opencode ran in. --resume ID prints cd <folder> && opencode -s <id>. Only top-level chats are listed, not the helper sessions a sub-agent opens. Inside opencode (it sets OPENCODE=1) the chat you type /load-context in is left out. If the program cannot be run, the output says OPENCODE SKIPPED (...) and Claude Code's chats still load. Set opencode_cmd to the full path when opencode is not on PATH (a sandbox, say); the program must see the same opencode data as your chats. Switched off again, opencode's chats are no longer listed or loaded; they stay on record and come back when it is switched on.

Moved chats. If something moves closed chats out of ~/.claude/projects (a cleanup on /clear, an archive drive), list those folders in extra_dirs. Each one may hold project folders like ~/.claude/projects does (<folder>/<project>/<id>.jsonl), or one folder per moved session that holds a projects folder (<folder>/<anything>/projects/<project>/<id>.jsonl); both are read. A chat found in more than one place is taken from projects_dir first, then from the newest-named moved folder. A chat that moved keeps its name and presets: the registry follows it to its new place on the next scan.

The registry only reads ~/.claude/projects (plus extra_dirs) (and asks opencode for its chats); it never changes your transcripts. Sessions are loaded as reference material, the same caution as the documents below applies.

Earlier chats as context (/load-context)

With sessions switched on, /load-context in Claude Code (or researcher --context) opens the same kind of window as a research set, but it lists your earlier chats: every project folder, the most recently used folder first, newest chat first. Each chat shows its first prompt (or the name you gave it with --rename), its size in tokens and the day it was last active. A filter box finds a chat by words from its first prompt or its folder. The chat you type /load-context in is never listed; chats you closed a minute ago are.

Pictures of this window are under How it looks.

Presets work like custom sets. /load-context noname the first time shows every chat unticked; tick what belongs to noname and keep "Remember" ticked, and the next /load-context noname starts with those ticked. Chats added since show NEW and are never ticked on their own, and Remember is only pre-ticked the first time, so a one-off pick does not replace the preset. Without a name the preset is default. --context --setup NAME changes a preset, --context --list shows them, --no-popup loads a saved preset without asking.

Each ticked chat is written like --session-load (prompts and replies, no tool traffic) to ~/.cache/researcher/, and the skill reads them. Presets live in ~/.config/researcher/contexts.json.

Install the skill next to researcher: cp -r skills/load-context ~/.claude/skills/ (or ln -s "$PWD/skills/load-context" ~/.claude/skills/load-context).

Marked chats (/mark)

Some chats are the ones you will come back to over several days. With hundreds or thousands of chats, finding one by its first prompt is slow, so a chat can be marked: type /mark (or /mark the long refactor, the words are a note) in the chat itself. The chat is then listed under the Marked chip in the /load-context window, next to Day | Week | Month | All, whatever its age, with its note beside it. /mark off takes the mark away, researcher --marked lists them without a window.

A chat that was never marked can be marked later from the window: every row has a mark / marked button, and what you click is saved when you press Load (Cancel saves nothing, like a rename); with nothing ticked the button reads Save marks and names. The running chat is not listed in the window, so /mark is the way to mark that one; --mark --chat ID marks any chat by id (the way to mark an opencode chat, because opencode does not tell the program which chat it is in).

A mark is one line in ~/.config/researcher/marks.json (the day, the note); the chat transcripts are never touched, and a mark follows the chat when it is renamed or moved. Marking changes nothing about what a load reads or what the usage log counts. Install the skill like the others: cp -r skills/mark ~/.claude/skills/.

One window, two tabs

When sessions are switched on, every load opens one window with two tabs: Chats | Research. researcher SET (and /researcher) opens on Research, researcher --context (and /load-context) opens on Chats, and --start chats|research picks the tab yourself. The other tab holds your preset default (chats) or the config's default_set (research), but it loads nothing until you click it: then it shows "loading…" while it scans (chats can take a few seconds the first time), so a load you only want one side of never waits for the other. Once open it has its saved ticks; a set or preset you never saved starts unticked. Each tab keeps its own ticks, filter and presets, and one Load button loads what is ticked in both ("Load 3 chats + 5 docs"). The tab the window opened on prints first. Without a window (--no-popup, no display) there is no tab to click, so only the command's own side loads. A load of both writes two usage records, one for the documents and one for the chats.

Topic chips (research). The research tab always opens on All, grouped by folder, so all research is in view without looking for it. Next to All is one chip per set in config.toml, each with its count; a chip shows only that topic. When a document was written is left out of this window.

Time chips (chats). Above the chat list: Day | Week | Month | All (the last 24 hours, 7 days, 30 days), each with its count, by when a chat was last active. Group by: time puts the rows under Today, Yesterday, Earlier this week, Earlier this month and Older, newest first, with the project folder as a small label on each chat; folder is the old view. A ticked row the chip hides keeps its tick and is still loaded; the line above the buttons says how many. The window always opens on All with nothing ticked; it remembers the chats grouping in ui.json (first time by time; research always by folder).

Names. rename next to a row (or a double-click on it) renames it in place; Enter keeps the name, Esc undoes it.

  • A chat's name goes into sessions.json, the same as --rename; an empty name gives it its first prompt back.
  • A document's name and a research set's name (rename next to the set) go into names.json; your files are never touched. The window shows the name with the real id in small text, the filter finds both, and the output gets a DOC "name" (id) line before the document's path.
  • A chat preset has a name field next to Remember: a new name moves the saved ticks to it. Lowercase letters, digits, ., _ and -, and not the name of another preset.

Project profiles

A profile puts a project's source code next to its chats and research, with presets that tick all three at once: say one for the full source, one for the GUI and one for the libraries, each with its own chats and research. Set it up in config.toml:

[profiles.myapp]
root = "~/src/myapp"          # the project folder (optional: without it there is no Code tab)
code = ["src/*", "*.toml"]    # globs over paths inside root; `*` crosses folders (default: "*")

researcher --profile myapp opens one window with Code | Chats | Research and a row of preset buttons. Code is ready at once; Chats and Research load when you click their tab or a preset that needs them. Clicking a preset ticks its files, chats and documents (you can still change the ticks); tick Save these ticks as the profile preset, give it a name and press Load to keep them (an existing name is replaced). Presets live in profiles.json next to the config. researcher --profile myapp gui opens with the preset gui ticked, --no-popup loads it without a window, --profile myapp --list shows the presets.

Source files are printed as CODE <path in the project> followed by their size and full path; Claude reads them from disk, so there is no text copy, and code is not counted in the usage log. Hidden files and folders, target, node_modules, __pycache__, dist, build, venv, symlinks, binaries and files over 1 MB are left out. A hidden or build folder is still read when a code glob spells out its path before the first wildcard: src/build/*.rs, .github/workflows/*.yml. A profile saves no set defaults or chat presets of its own.

Safety

Documents are loaded into Claude's context as text. Treat them like any untrusted input: a saved web page can contain instructions aimed at an AI. The skill tells Claude to treat document contents as reference material, not as commands, but only load documents you trust. HTML and Markdown comments are removed when a document is converted; other hidden content (display:none, collapsed <details>, white text in a PDF) is not.

Tests

cargo test                                  # CI runs it on Linux and Windows

The tests cover the library scan, set expansion, saved defaults, custom sets, and the command line. The egui popup is tested without a display (egui_kittest renders the real window headlessly, and CI runs it). The program only opens a window when it is run for a load or --setup; set RESEARCHER_NO_POPUP=1 to make that impossible (scripts, CI). macOS is only linted (clippy) in CI, never run.

License

MIT License, see LICENSE. Your own documents and config are never part of this repository and are not covered by it.

About

The Researcher: a research and context loader for AI agents. Named sets, saved presets, and a popup to tick what this session needs, saving those precious tokens, keeping your context close at all times in every chat.

Topics

Resources

Contributing

Security policy

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages