ResearchKit is an AI-assisted research writing environment built on top of Overleaf Community Edition. It treats Overleaf as the IDE and the LaTeX paper project as the codebase, then layers on a dedicated Python service, project-aware memory, provider configuration, inline patch review, and specialized agents for academic writing workflows.
ResearchKit architecture overview: Overleaf acts as the IDE, while the LaTeX project is treated as the codebase for agent-driven research writing workflows.
- Treats Overleaf as the IDE and a LaTeX project as the codebase for agent-driven paper work
- Adds a ResearchKit sidebar inside the Overleaf editor
- Streams agent responses over SSE
- Captures editor context such as the active file, selected text, and cursor location
- Builds project memory from LaTeX structure and BibTeX files
- Persists conversations per project and supports resume, list, and clear flows
- Supports OpenAI, Anthropic, and OpenAI-compatible providers
- Lets users test provider settings and discover available models from the UI
- Produces inline patches and diff review actions for file changes
- Supports workspace-aware editing plus execution-oriented bash commands through the runner service
- Delegates literature-search tasks to an implemented Research Agent
- Figure Agent is still a placeholder
- Review Agent is still a placeholder
- The broader multi-agent workflow is present, but only the Research Agent is meaningfully implemented today
- Turn rough notes into paper sections
- Start from bullet points, experiment logs, or a draft paragraph and turn them into a cleaner introduction, method, or conclusion.
- Rewrite dense academic text faster
- Paraphrase unclear paragraphs, improve flow, shorten overly long sections, or make writing sound more polished and consistent.
- Use the current draft as context
- Ask for help on a specific selected paragraph or section, so the assistant responds in the context of the actual paper instead of giving generic writing advice.
- Build related work faster
- Use the Research Agent to search literature and bring relevant papers into the writing workflow.
- Verify references before submission
- Check whether citations look real, suspicious, or incomplete before they become submission-time problems.
- Revise with less copy-paste friction
- Review suggested edits as patches and apply only the changes you want, directly in the paper workflow.
- Switch between AI providers without changing workflow
- Use OpenAI, Anthropic, or an OpenAI-compatible endpoint depending on team preference, cost, or deployment constraints.
+---------------------------+ +----------------------------+
| Overleaf Community | ---> | ResearchKit FastAPI |
| Edition | | service |
| - ResearchKit sidebar UI | | - chat + config + memory |
| - Express proxy routes | | - Main Agent |
| - project file snapshot | | - Research Agent |
+---------------------------+ | - MemoryManager |
| | - provider registry |
| +-------------+--------------+
| |
v v
+---------------------------+ +----------------------------+
| MongoDB | | ResearchKit runner |
| - researchkitMemory | | - isolated command exec |
| - researchkitConversations| | - overlay workspace diffs |
| - researchkitConfig | +----------------------------+
+---------------------------+
Read the full breakdown in docs/architecture.md.
- Docker and Docker Compose
- At least one LLM provider key
- Optional ASTA key for literature search features
cp .env.example .envSet the provider credentials you need:
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...
RESEARCHKIT_ASTA_API_KEY=...Common optional settings:
RESEARCHKIT_PORT=3020
OPENAI_BASE_URL=http://your-proxy:4000
RESEARCHKIT_MODEL=gpt-4o
RESEARCHKIT_RUNNER_URL=http://researchkit-runner:3030docker compose up -d --buildMain services:
| Service | Port | Purpose |
|---|---|---|
sharelatex |
80 |
Overleaf UI |
researchkit |
3020 |
FastAPI backend |
researchkit-runner |
3030 |
command runner for bash tool execution |
mongo |
27017 |
shared persistence |
redis |
6379 |
Overleaf dependency |
docker exec sharelatex /bin/bash -c "cd /overleaf/services/web && node modules/server-ce-scripts/scripts/create-user --admin --email=admin@example.com"- Visit
http://localhost - Log in and open a LaTeX project
- Open the ResearchKit rail entry in the editor
- Index the project or start chatting
This repository supports two Cloudflare tunnel modes:
- Remote-managed: the tunnel token is stored in
.envand ingress/public hostname rules are managed in the Cloudflare dashboard. - Local-managed: Docker reads
deploy/cloudflared/config.ymlanddeploy/cloudflared/credentials.json, and you bootstrap the tunnel once with the Cloudflare CLI.
This mode keeps the ingress mapping in the repository and avoids dashboard-managed hostname rules after initial tunnel creation.
- Set the public domain in
.env
OVERLEAF_SITE_URL=https://{domain}
OVERLEAF_SECURE_COOKIE=true
PUBLIC_DOMAIN={domain}- Log in to Cloudflare once on the host
cloudflared tunnel login- Create the tunnel, credentials file, DNS route, and local config
./scripts/setup_cloudflare_local_tunnel.sh researchkitThis writes:
deploy/cloudflared/config.ymldeploy/cloudflared/credentials.jsonCLOUDFLARE_TUNNEL_ID=...into.env
- Start the local-managed tunnel stack
docker compose -f docker-compose.yml -d --build -f docker-compose.cloudflare.local.yml up -d --buildcloudflared will then publish {domain} to http://nginx:8080 using the local config mounted from deploy/cloudflared/.
This repository also includes a production overlay that keeps Overleaf and ResearchKit private on the Docker network, fronts them with nginx, and publishes the site through a Cloudflare Tunnel configured in the Cloudflare dashboard.
OVERLEAF_SITE_URL=https://{domain}
OVERLEAF_SECURE_COOKIE=true
PUBLIC_DOMAIN={domain}
CLOUDFLARE_TUNNEL_TOKEN=<token-from-cloudflare>OVERLEAF_TRUSTED_PROXY_IPS=loopback,linklocal,uniquelocal is already the recommended default for the Docker-network reverse proxy setup.
docker compose -f docker-compose.yml -f docker-compose.cloudflare.yml up -d --buildThis starts:
sharelatexandresearchkitbound to127.0.0.1on the hostnginxon the internal Docker networkcloudflaredforwarding{domain}tonginx
docker compose up --buildUse this when working on agents, API routes, memory, or providers.
docker compose up sharelatex mongo redis
cd services/researchkit
python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
export MONGODB_URL="mongodb://localhost:27017/sharelatex"
export OPENAI_API_KEY="sk-..."
uvicorn researchkit.main:app --reload --host 0.0.0.0 --port 3020ResearchKit's Overleaf integration lives under services/web/modules/researchkit/.
For frontend work, use the normal Overleaf development flow:
cd develop
bin/build
bin/dev- The Overleaf module captures project files and the active editor context.
- ResearchKit treats that LaTeX workspace like a codebase, with files such as
main.tex, section files, bibliography files, and figures forming the working project context. - The Express controller proxies requests to
researchkit. - The FastAPI service loads provider config, refreshes memory when needed, and runs the
MainAgent. - The Main Agent can edit files through
str_replace_editor, run execution-only shell commands through the runner, or delegate literature work to the Research Agent. - The service streams
message,action,patch,response, anddoneevents back to the UI.
services/researchkit/contains the Python backend and runnerservices/web/modules/researchkit/contains the Overleaf proxy layer and React UIdocs/contains project-level architecture, feature status, and roadmap docs
Backend tests:
cd services/researchkit
pip install -e ".[dev]"
pytest -q testsCurrent backend baseline: 67 passed.
This repository is built on top of Overleaf Community Edition. General Overleaf contribution guidance remains in CONTRIBUTING.md.
This project is licensed under the GNU Affero General Public License v3. See LICENSE.
