Metadata-Version: 2.5
Name: graph-me-maybe
Version: 0.2.11
Summary: Graph-Me-Maybe: local-first multimodal graph RAG over documents
Author: Graph-Me-Maybe contributors
License-Expression: Apache-2.0
License-File: LICENSE.md
License-File: THIRD_PARTY_NOTICES.md
Requires-Python: >=3.11
Requires-Dist: httpx<1,>=0.28
Requires-Dist: lxml<7,>=5
Requires-Dist: neo4j-graphrag[openai]>=1.22.0
Requires-Dist: neo4j>=6.4.0
Requires-Dist: numpy<3,>=2.2
Requires-Dist: olefile>=0.47
Requires-Dist: openpyxl<4,>=3.1
Requires-Dist: pillow<13,>=11
Requires-Dist: playwright<2,>=1.55
Requires-Dist: pydantic<3,>=2.11
Requires-Dist: pymupdf<2,>=1.26
Requires-Dist: python-docx<2,>=1.2
Requires-Dist: python-pptx<2,>=1.0
Requires-Dist: pyyaml<7,>=6.0
Requires-Dist: truststore<1,>=0.10
Requires-Dist: typer<1,>=0.16
Provides-Extra: app
Requires-Dist: fastapi<1,>=0.116; extra == 'app'
Requires-Dist: keyring<26,>=25; extra == 'app'
Requires-Dist: mcp<2,>=1.20; extra == 'app'
Requires-Dist: pystray<0.20,>=0.19.5; (sys_platform == 'darwin' or sys_platform == 'win32') and extra == 'app'
Requires-Dist: python-multipart<1,>=0.0.20; extra == 'app'
Requires-Dist: pywebview<7,>=5.4; (sys_platform == 'darwin' or sys_platform == 'win32') and extra == 'app'
Requires-Dist: uvicorn<1,>=0.35; extra == 'app'
Provides-Extra: dev
Requires-Dist: fastapi<1,>=0.116; extra == 'dev'
Requires-Dist: keyring<26,>=25; extra == 'dev'
Requires-Dist: langchain-core<2,>=0.3; extra == 'dev'
Requires-Dist: mcp<2,>=1.20; extra == 'dev'
Requires-Dist: mypy<2,>=1.17; extra == 'dev'
Requires-Dist: pystray<0.20,>=0.19.5; (sys_platform == 'darwin' or sys_platform == 'win32') and extra == 'dev'
Requires-Dist: pytest<9,>=8.4; extra == 'dev'
Requires-Dist: python-multipart<1,>=0.0.20; extra == 'dev'
Requires-Dist: pywebview<7,>=5.4; (sys_platform == 'darwin' or sys_platform == 'win32') and extra == 'dev'
Requires-Dist: ruff<1,>=0.12; extra == 'dev'
Requires-Dist: types-pyyaml<7,>=6.0.12; extra == 'dev'
Requires-Dist: uvicorn<1,>=0.35; extra == 'dev'
Provides-Extra: langchain
Requires-Dist: langchain-core<2,>=0.3; extra == 'langchain'
Provides-Extra: server
Requires-Dist: fastapi<1,>=0.116; extra == 'server'
Requires-Dist: python-multipart<1,>=0.0.20; extra == 'server'
Requires-Dist: uvicorn<1,>=0.35; extra == 'server'
Description-Content-Type: text/markdown

<div align="center">

# Graph-Me-Maybe

**Turn your PDF, Word, PowerPoint and Excel files — and your mail — into one knowledge graph, and ask it questions.**

[![Website](https://img.shields.io/badge/website-graphme.io-4F46E5)](https://graphme.io)
[![License: Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-blue)](LICENSE.md)
[![Python 3.11+](https://img.shields.io/badge/python-3.11%2B-blue)](https://www.python.org/)
[![Neo4j 5.26](https://img.shields.io/badge/Neo4j-5.26-018bff)](https://neo4j.com/)
![Platforms](https://img.shields.io/badge/platform-macOS%20%7C%20Windows%20%7C%20Linux-lightgrey)

[Website](https://graphme.io) ·
[Live demo](https://graphme.io/demo/en/) ·
[Benchmarks](https://graphme.io/benchmarks/) ·
[What it does](#-what-it-does) ·
[Try it](#-things-to-try) ·
[Install](#-install-the-app) ·
[Usage](#-usage) ·
[How it works](#-how-it-works) ·
[Configuration](#-configuration) ·
[Develop](#-develop-from-source) ·
[Contribute](CONTRIBUTING.md)

<br>

<a href="https://graphme.io/demo/en/"><img src="docs/assets/demo.gif" alt="Asking a question in Graph-Me-Maybe: the answer cites a spreadsheet row and a slide, and the source cell is highlighted on the rendered page" width="860"></a>

<sub>An invented company's 32 documents. [Watch it as video](docs/assets/demo.mp4) · [Try the live demo](https://graphme.io/demo/en/)</sub>

</div>

---

Graph-Me-Maybe is a desktop app that reads your documents the way a person does — as rendered
pages — and answers questions about them with the exact page, slide, cell or paragraph behind each
statement. It links documents that cite or resemble each other into one graph, so an answer can
follow a memo to the specification it names. It runs on your computer: the graph, the search and
your files stay there.

## ✨ What it does

### Reads documents as you see them

- **Every common format, one graph.** PDF, Word, PowerPoint, Excel and Hangul (HWP, HWPX), scanned
  PDFs, and files embedded inside other files (a workbook in a deck, a PDF in a memo).
- **Structure read off the page.** A vision-language model reads each rendered page and decides what
  sits under what — headings, sections, which note belongs to which table — instead of trusting
  styles or font sizes.
- **Tables, charts and pictures too.** A value in a chart, a cell in a table or a label in a diagram
  can be found and cited, and is highlighted on the page it came from.

### Answers with its sources

- **Documents and an answer.** A question returns the documents that match, the documents linked to
  them, and an answer that cites them. Each statement is checked against the passages and marked
  ✓ when they bear it out, ⚠ when they do not.
- **Hybrid search.** Vector and full-text search run side by side and are fused; a question about
  nothing in the graph gets "no related documents", not a guess.
- **A period, said or chosen.** "Mail from last month", "the Q3 2025 reports", "latest" — the period
  a question names is read from it, or picked beside the box (last week, month, 3 months, year, or
  two dates). A mail counts by when it was sent, a file by when it was last changed.
- **Conversations.** A follow-up is asked after the turns before it, and a conversation can be kept
  to the files you drop on it.

### Takes documents from where they already are

- **Folders and cloud drives.** A local folder, or the folders Google Drive, OneDrive and SharePoint,
  Box, Dropbox, iCloud Drive and Synology Drive sync to this computer. A file kept online only is
  given back to the cloud once read, so a large drive does not fill the disk.
- **Mail, through Thunderbird.** Gmail, Outlook, Naver or any other mailbox, connected in
  Thunderbird — the free mail app the app installs for you — so no password is kept here. Replies
  are linked as one conversation and attachments are read as documents under their mail.
- **Kept up to date.** A folder or a mailbox can be built again by itself when it changes, or daily;
  only the pages that changed are read again.

### Stays on your machine

- **Local graph and local search.** The app installs and runs its own Neo4j (no Docker, no account)
  and a small search model, so searching needs no key and sends nothing out. Only a page being read
  and a question being answered go to the model provider you choose.
- **An API key, or a subscription you already have.** Pages are read and answers written by OpenAI,
  Anthropic or Gemini with your key, or — an advanced option, off by default — on a Claude, ChatGPT
  or Gemini subscription you already pay for, with no per-page cost. Subscriptions are meant for the
  providers' own apps, so this may be against their terms; see the
  [user guide](docs/user-guide.md#subscription-accounts-advanced) before turning it on.
- **Workspaces.** Graphs kept apart — a project, a client, a mailbox — switched in seconds.

### Works with your other tools

- **Right-click any file** in Finder or Explorer and choose **Ask Graph-Me-Maybe** to ask about it in
  a small window.
- **Claude Code, Claude Desktop and Cursor** search and read your documents through MCP.
- **CLI, Python and HTTP APIs** over the same graph.
- **An open graph.** Export to a `neo4j-admin` import bundle, a `.dump` for Neo4j Desktop or Aura, or
  straight to Aura — Neo4j's own GraphRAG retrievers work on it with no code from here.

## 🧪 Things to try

After installing, open **Ask** and press **Try sample documents**: the app writes a small invented
company's specifications, procedures, test records, meeting decks and reports, reads them, and is
ready for questions.

| Try | Ask or do | What you see |
|---|---|---|
| A fact in a specification | *What pressure does the leak test use?* | the answer, the specification it came from, and the sentence highlighted on its page |
| A value in a spreadsheet | *Which valve failed the leak test, and by how much?* | the row of the test record, cited and highlighted on the sheet |
| Documents that cite each other | *What does the work order require, and which procedure does it follow?* | the work order found first, the procedure and specification it names inside it as linked documents |
| A follow-up | *And how long is the pressure held?* | the same conversation, answered from what was asked before |
| One document only | ⋯ › **Ask only this** on a found document | every later question kept to that file |
| A file from your desktop | right-click it › **Ask Graph-Me-Maybe** | a small window asking about that file alone |
| The links between documents | **Manage › Links** | every document as a node, cites, replies and look-alikes as edges, in 2D or 3D |
| Your own folder | drop it on the box, or **Manage › Add folder** | it is read, linked and ready to ask |
| Your mail | **Manage › Mail › Connect Gmail and Outlook with Thunderbird** | then ask *What did the supplier ask for last week?* |

## 📦 Install the app

Paste one line into a terminal. It installs the app and what it needs (Python, the web app, the
document viewer, a browser to draw pages with, Neo4j and Java), then opens the app. Run it again to
update.

**macOS and Linux**

```bash
curl -fsSL https://raw.githubusercontent.com/ToBeSuperior/Graph-Me-Maybe/main/install.sh | sh
```

**Windows** (PowerShell)

```powershell
powershell -ExecutionPolicy ByPass -c "irm https://raw.githubusercontent.com/ToBeSuperior/Graph-Me-Maybe/main/install.ps1 | iex"
```

Then open **Graph-Me-Maybe** from Applications (macOS) or the Start menu (Windows) and, in
**Manage › Keys and model**, put in an OpenAI, Anthropic or Gemini key — or turn on a subscription
under **Advanced**.

> [!NOTE]
> On Windows, install from PowerShell, not inside WSL. Updating, uninstalling, where the app keeps
> its files, and troubleshooting are in [docs/installation.md](docs/installation.md).

## 🚀 Usage

A tour of every screen is in [docs/user-guide.md](docs/user-guide.md).

### Ask

Drop a folder of documents on the **Ask** tab, wait for it to be read, and ask. The documents found
are shown as folders by how they were reached — found by the question, linked to those, linked to
those in turn — with the matching passage highlighted on the rendered page on the right. Files
dropped on the box, or a found document's **Ask only this**, keep the conversation to them; **Period**
beside the box keeps it to some dates.

### Manage

The document list, the map of links, each document's outline, the cloud drives, mail, automatic
builds, export, keys and model, and the danger zone. The workspace open is named in the top bar,
where another is opened or made.

### Right-click a file

Turned on in **Manage › Keys and model › Advanced settings**. On Windows it is in the right-click
menu at once (on Windows 11, under **Show more options**).

> [!TIP]
> On macOS, **Ask Graph-Me-Maybe** first shows under **Finder › Services** (also at the bottom of a
> folder's right-click menu). To have it in every file's right-click menu, right-click a file, choose
> **Quick Actions › Customize…**, and tick **Ask Graph-Me-Maybe** (System Settings › Extensions ›
> Finder).

### Claude Code, Claude Desktop and Cursor

```bash
graphme mcp install --client claude-code   # or claude-desktop, cursor
graphme doctor                             # what is ready and what is not, each with its fix
```

The client can then search your documents, read an outline and a part of it, look at a page, and
add a folder. Details in the [user guide](docs/user-guide.md#using-it-from-claude-code-claude-desktop-or-cursor).

### Command line

The CLI uses the same graph as the app.

```bash
graphme build-graph ./docs            # read a folder, put it in the graph, link and embed it
graphme ask "What pressure does the leak test use?"
graphme export-corpus ./out --dump    # one .dump file for Neo4j Desktop or Aura
graphme --help                        # every command
```

### Python

```python
import graphme

doc = graphme.read("report.pptx")        # one document -> ExtractedDocument (no Neo4j needed)

with graphme.GraphMe() as g:              # settings from .env / the environment
    g.add("docs/")                        # a folder or one file -> BuildReport
    g.embed()                             # cut passages and embed them for search
    for hit in g.search("leak test pressure"):
        print(graphme.shown_name(hit.file), hit.score)
    print(g.ask("What pressure does the leak test use?").text)
    g.export("out/")                      # neo4j-admin import bundle (dump=True for a .dump)
```

The public API is exactly the names in `graphme.__all__`. More in [`examples/`](examples/).

### HTTP API

```bash
graphme serve                          # http://127.0.0.1:8765 — the API, its docs at /docs, the web app
curl -s -X POST http://127.0.0.1:8765/v1/ask -H 'content-type: application/json' \
  -d '{"question": "What pressure does the leak test use?"}'
```

Long work (reading, embedding, exporting) runs as jobs you poll at `GET /v1/jobs/{id}`; every error
body is `{"detail": "..."}`. Without `GRAPHME_API_KEY` the server answers this machine only. The
full contract is at `/docs` and in [`src/graphme/server/models.py`](src/graphme/server/models.py).

## 🧠 How it works

```text
  files ──▶ extract ──▶ render pages ──▶ bind visuals ──▶ VLM: figures, paragraphs, outline
                                                                        │
  answer ◀── walk links (2-3 hops) ◀── hybrid search ◀── passages ◀── one Neo4j graph
                                       (vector + BM25,                  (documents, outlines,
                                        weighted RRF)                    citations, similarity)
```

1. **Extract.** Text, tables and pictures come straight from the file. The file owns the graph:
   what the model sees later can add evidence, never invent nodes.
2. **Render and bind.** Each page is drawn (Office files in a browser, PDFs rasterised) and every
   unit is placed on it, so a table or a picture has an exact crop.
3. **Read the page.** A vision-language model is asked, page by page, which units form one figure,
   which pieces form one paragraph, and what reads under what. Long documents carry their outline
   from page to page.
4. **Link.** A document that names another is linked to it; documents with similar passages are
   linked too.
5. **Retrieve.** The outline is cut into passages and embedded. A question runs vector and full-text
   search in Neo4j, fuses them, keeps only passages with real evidence, then walks the links to bring
   the connected documents along — see [docs/retrieval.md](docs/retrieval.md).


## 📄 Supported formats

| Format | Read | Drawn by | Notes |
|---|---|---|---|
| PDF | text, tables, images, attachments, scanned pages | PyMuPDF; scanned pages read by the page-reading model | text read off a scan is marked as the model's reading |
| DOCX | paragraphs, tables, pictures, embedded files | browser viewer (WASM) | |
| PPTX | slides, shapes, tables, charts, pictures, embedded files | browser viewer (WASM) | slides keep their order |
| XLSX | sheets, tables, charts, pictures, formulas, embedded files | browser viewer (WASM) | a formula links the cells it reads |
| HWP, HWPX | what the page shows, read as a PDF | rhwp (WASM) in the browser, printed to PDF | |
| Mail (from Thunderbird) | headers, body, attachments | not drawn | attachments are read as documents under their mail |

## ⚙️ Configuration

Settings come from defaults, then `.env`, then a YAML file named by `GRAPHME_CONFIG` (never secrets),
then the environment. The installed app keeps its `.env` in its own folder; the app's
**Manage › Keys and model** page writes it for you. Every setting is listed with comments in
[`.env.example`](.env.example).

| Setting | What it is |
|---|---|
| `GRAPHME_PROVIDER` | who reads documents and answers: `openai` (default), `anthropic` or `gemini` |
| `OPENAI_API_KEY` / `ANTHROPIC_API_KEY` / `GEMINI_API_KEY` | that provider's key |
| `GRAPHME_EMBEDDING_PROVIDER` | who embeds passages for search: `general` (default) or `korean`, run on this machine with no key; or `openai` / `gemini` with that provider's key |
| `GRAPHME_NEO4J_URI` (+ `GRAPHME_NEO4J_PASSWORD`) | use a Neo4j you run yourself (Desktop, a server, Aura) instead of the app's own |
| `GRAPHME_HOME` | the app's folder (settings, graph, viewer) |
| `GRAPHME_RETRIEVAL_DOCUMENTS` | how many documents a question finds when it does not say (5; `GRAPHME_RETRIEVAL_TOP_K` is its old name) |
| `GRAPHME_HIERARCHY_READINGS` | how many times each page is read (more readings, steadier outlines, more cost) |
| `GRAPHME_CHECK_ANSWERS` | check each statement of an answer against the passages found and mark it (`true`, default) |
| `GRAPHME_LINK_DISCOUNT` | how much a linked document's passage counts per hop when it competes with the documents found (`0.85`) |
| `GRAPHME_NEO4J_HEAP` / `GRAPHME_NEO4J_PAGECACHE` | memory of the app's Neo4j, for large graphs |
| `GRAPHME_API_KEY` | required by `graphme serve` before it opens beyond this machine |
| `GRAPHME_BOX_CLIENT_ID` / `GRAPHME_BOX_CLIENT_SECRET` | your own Box app, to sign in to Box directly (Box Drive needs none) |

## 🛠 Develop from source

**Requirements:** Python 3.11+ and [uv](https://docs.astral.sh/uv/) for everything Python; Node.js 24+
(npm 11+) for the web app; Google Chrome (or Playwright's Chromium) and, once, Rust with
`wasm32-unknown-unknown` plus [`wasm-pack`](https://github.com/rustwasm/wasm-pack) to build the
document viewer. Running only the tests needs Python and uv alone.

```bash
git clone https://github.com/ToBeSuperior/Graph-Me-Maybe.git
cd Graph-Me-Maybe
uv sync --extra dev                               # Python 3.11 and the dependencies
(cd frontend && npm ci && npm run build)          # the web app
cp .env.example .env                              # your settings (never copy another machine's)
src/graphme/adapters/rendering/viewer/setup.sh   # the document viewer, once (~1-2 min)
```

Put your provider's key in `.env` (see [Configuration](#-configuration)). To use it only as a
library, `pip install graph-me-maybe` installs the CLI and the Python API (`[server]` adds
`graphme serve`, `[app]` the app). The viewer that draws Office files, a Chromium and Neo4j
are fetched on first use, or ahead with `graphme setup`. See [docs/library.md](docs/library.md).

Run the app with the sample documents, or the bare server:

```bash
uv run graphme app --no-browser               # http://127.0.0.1:8765, with "Try sample documents"
uv run graphme serve                          # the same server without the samples
(cd frontend && npm run dev)                  # http://127.0.0.1:5173, hot reload, /v1 proxied to 8765
```

The first start fetches Neo4j and Java into the app folder (about 210 MB) and starts them; with
`GRAPHME_NEO4J_URI` in `.env` it uses that Neo4j instead.

**Checks** — what CI runs, and what a pull request has to pass:

```bash
uv run ruff check src tests/public && uv run mypy
uv run pytest tests/public                     # no key, no Neo4j, no real document needed
cd frontend && npm run typecheck && npm test && npm run e2e && npm run build
```

## 🤝 Contributing

Contributions are welcome — bug reports, fixes, new format support, documentation. Start with
[CONTRIBUTING.md](CONTRIBUTING.md): it walks through the setup, the layout of the code, how tests are
written here (invented data only, a failing test first), and how a pull request is reviewed. Please
also read the [Code of Conduct](CODE_OF_CONDUCT.md); security issues go to
[SECURITY.md](SECURITY.md), not to public issues.

## 🔒 Security and data

- Never commit `.env`, real documents, API keys or OAuth files.
- Open `graphme serve` beyond this machine only with `GRAPHME_API_KEY` set; without one it stays on
  127.0.0.1.
- Check your model provider's data terms before sending confidential documents to it -- and the
  embedding provider's, if you choose OpenAI or Gemini for search (the default runs on this machine).
- Generated captions are kept apart from what the file says and are never used as a citation.

## 📜 License

[Apache License 2.0](LICENSE.md). PDFs are read with PyMuPDF, which is installed as a dependency
under its own license (GNU AGPL 3.0, or Artifex's commercial license). The bundled document viewer
is MIT-licensed; Neo4j, Java, llama.cpp and the search models are fetched from their publishers
under their own licenses — see [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
