Skip to content

About

Open-source document intelligence with citation-first RAG, semantic search, and grounded QA.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

DocuLens Personal

DocuLens watches your Downloads folder, reads each new file, and puts it in the folder where you would have put it. It shows you what it decided and why. You press one key to agree, or pick somewhere else and it remembers. Nothing moves until you say so, and every move can be undone.

The DocuLens inbox, with a suggestion open: the file, where it is going, and why

It reads the document, not the filename. In the first run over a demo folder, download (3).txt and scan_0012.txt both landed in the right folder, because DocuLens had opened them.

There is no DocuLens server

DocuLens is a harness, not a service. There is no DocuLens server, no DocuLens account and no telemetry. Files are read by a model you already have: your Claude Code or Codex subscription, your own API key, or a model running on your own Mac. Whatever gets sent goes from your machine to your provider under your terms, and we are never in the path.

Everyone in this category says something like that. This repo can show you the code that makes it true: src/doculens_personal/classify.py builds the entire prompt in about thirty lines, tests/test_prompt_privacy.py pins down what may and may not be in it, and docs/what-is-sent.md prints a real one.

If you pick a model that runs on your Mac, nothing leaves it at all. If you pick a hosted one, DocuLens will tell you plainly what it sends there. A hosted model is not private just because the app around it is local, and this README is not going to pretend otherwise.

Install

macOS on Apple Silicon. There is no download link yet, so for now you build the app:

git clone <this repo> && cd doculens-personal
cd desktop && npm install && npm run dist:full

That writes desktop/release/DocuLens-0.1.0-arm64.dmg (about 160 MB; it has the whole engine frozen inside, so the Mac you install it on needs no Python and no terminal). The build machine needs Node 20+, uv and the Xcode command-line tools; packaging/README.md explains the rest.

The app is not signed by Apple and not notarised, because that needs a paid developer account this project does not have yet. So the first time you open it, macOS will refuse:

"Apple could not verify DocuLens is free of malware."

Right-click (or Control-click) DocuLens in Applications, choose Open, then Open again in the dialog. That is a one-time exception for that app; it opens normally afterwards, and you do not have to change any system-wide security setting. (The terminal version of the same thing is xattr -dr com.apple.quarantine /Applications/DocuLens.app.)

Prefer the engine on its own, or you are on Linux? It is a normal Python package:

python3 -m venv .venv && source .venv/bin/activate
pip install -e .
doculens init     # writes ~/.doculens/config.toml and picks a model you already have
doculens scan     # suggest homes for what is already in Downloads

How DocuLens reads your files

Five choices, and the app tells you what each one means for your files before you pick:

The setup screen: how DocuLens reads your files

Choice What you need Where your files go
On this Mac (Ollama) Ollama running, e.g. ollama pull llama3.2:3b Nowhere. It runs locally
Claude Code Claude Code installed and signed in the opening text goes to Anthropic, on your subscription
Codex Codex CLI installed and signed in the opening text goes to OpenAI, on your subscription
Claude API key a key from the console, pasted into Settings the opening text goes to Anthropic, on your key
Any model (your key) a key for anything that speaks the OpenAI chat API the opening text goes to whatever address you typed

Any model (your key) is the newest one. Paste an address and a key and DocuLens will use OpenRouter, Groq, Together, DeepInfra, OpenAI, or a model server running on your own Mac like LM Studio. The key is written to ~/.doculens/openai-key, readable only by you, never into config.toml (people paste that into screenshots), and no endpoint ever hands it back. A Claude API key is kept the same way, in ~/.doculens/claude-key, and both are typed into Settings — setting ANTHROPIC_API_KEY still works and takes precedence, but nothing requires it.

Setting up Any model with an OpenRouter address and key

The two subscription options run the official claude and codex command-line tools in headless mode with every tool turned off, inside an empty temporary folder. The document's text is untrusted input, so the model on the other end can answer and nothing else. It cannot touch your files.

What is actually sent

For one file: your folder names and the descriptions you wrote for them, the filename, a line of cheap facts about the file (the site it was downloaded from, its size, its page count), up to 8,000 characters of the document's own text, and the filenames of your recent corrections. That is the entire message.

Not sent: your username, any folder path, the contents of any other file, or anything about you as a user, because there is nothing to send.

docs/what-is-sent.md shows a real prompt and names the test that holds each of those promises in place.

Your folders, in your words

You describe your folders the way you would describe them to a person. That description is what the model is given, so writing a better one is how you make DocuLens better.

[[categories]]
name = "Grants"
folder = "Research/Grants"   # under library_root, or an absolute path
description = "Funding proposals, budgets, award letters, reports to funders."
auto = false                 # true = file without asking, when confident

Filed documents end up in ordinary Finder folders and get a Finder tag, so Spotlight and Finder see the same organisation. Nothing is locked inside the app. If you delete DocuLens tomorrow, your files are still where it put them.

During setup, DocuLens can also look at the folders you already keep in ~/Documents and suggest those as categories, instead of making you adopt someone else's filing system. It reads folder names and counts only; it never opens a file to do that.

Rules, for the things you have already decided

Some filing is not a judgement call. Rules are checked before the model, so a file a rule catches is filed immediately: no reading, no model call, no waiting.

Ask: a rule written in plain words, and the three rules it produced

You can write one in your own words and DocuLens turns it into a rule, or let it offer one when the evidence is real: "The last 4 files from conf-uploads.test all went to Travel. File them there automatically from now on?" It only offers when at least three files agreed and none went anywhere else. DocuLens knows nothing about any particular website, and there is no built-in list of sites anywhere in it. A domain is a rule that you wrote.

It lives in the menu bar

Most of the time you do not open the window. The menu-bar icon shows how many files are waiting; clicking it files a couple of things without leaving what you were doing.

The menu-bar panel listing files waiting, each with the folder DocuLens picked

⌘1, ⌘2, ⌘3 file the first three. ⌘Z takes the last one back. Light and dark both follow the system.

The command line

The desktop app is the product, but the engine is a normal CLI and everything is there:

doculens scan        # suggest homes for files already in Downloads
doculens watch       # keep watching, one notification per suggestion
doculens review      # accept / change folder / reject, one file at a time
doculens undo        # put the last filed document back
doculens log         # recent activity
doculens serve       # the local API the desktop app talks to (127.0.0.1)

doculens apply --all files everything pending. doculens apply 12 --category Grants files one under a different folder, which also teaches DocuLens. doculens service install runs the watcher at login through a launchd agent, for people who want the engine without the app.

Scanned documents and photos need the optional OCR extra (pip install -e '.[ocr]'), which on macOS reads them with Apple Vision, on your machine. Without it, images and scanned PDFs are classified by filename alone and wait for you.

Everything the app can change lives in ~/.doculens/config.toml, so the CLI and the app are looking at the same settings:

Key Default Meaning
watch ["~/Downloads"] Folders to watch (top level only)
library_root ~/Documents/DocuLens Base for relative category folders
auto_move_threshold 0.85 How sure a model must be before an auto = true folder files on its own
rename true Rename to YYYY-MM-DD Title.ext
finder_tags true Tag filed documents in Finder with their folder's name and colour
provider detected claude-code, codex, claude-api, ollama or openai
model provider default Model override
effort low Claude API effort level
ollama_url http://localhost:11434 Where Ollama is
openai_base_url https://openrouter.ai/api/v1 The address used by Any model (your key)

How well does it work

There is an accuracy harness in eval/ that runs the real pipeline over 44 synthetic documents (22 for a student, 22 for a professor) with known answers. Latest runs on this machine:

Reading the files with Correct Notes
Claude Code 44 / 44 about 4.7 s per file
Codex 12 / 12 a short run of 6 per persona, not the full corpus
Ollama, llama3.2:3b 40 / 44 about 5.9 s per file, entirely local
Ollama, qwen2.5:3b 30 / 44 14 of those were unreadable answers, not wrong ones

Read that for what it is: a synthetic corpus written for this test, not your Downloads folder. It is useful for comparing models and for checking that the 85% auto-file threshold is not letting nonsense through. It is not a claim about your files.

What is not built yet

Honest list, as of v0.1:

  • Users. There is one, and it is me. No testimonials, no pricing, nothing to sign up for.
  • A signed build. Unsigned and un-notarised, hence the right-click dance above.
  • Intel Macs. The frozen engine is built for the machine that builds it, so only Apple Silicon has been built and tested.
  • Precedent (docs/precedent.md): remembering that files like this one went to a folder, not just this exact file. Specified, not written.
  • Tools in the chat (docs/chat.md): letting it answer "can you do that for the ones already waiting?". Specified, not written.
  • Windows. The engine is Python and the pipeline is portable, but Finder tags, OCR and the login agent are macOS, and the app has only been built for macOS.

Development

pip install -e '.[dev]'
pytest                 # never calls a real model
ruff check .
cd desktop && npm run dev:mock     # the app against an in-memory engine, no Python needed

CLAUDE.md is the map of the engine, module by module. docs/API.md is the contract between the engine and the app. desktop/README.md covers the app itself.

Licence

Elastic License 2.0. Read it, run it, change it, self-host it. You may not sell it to other people as a hosted or managed service. The desktop styling is adapted from Superset, also ELv2; see desktop/THIRD_PARTY_NOTICES.md.

About

Open-source document intelligence with citation-first RAG, semantic search, and grounded QA.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages