Overleaf Sync logo

Overleaf Sync

CommunityPopular
wanshuiyin
overleaf-sync

Two-way sync between a local paper directory and an Overleaf project, so ARIS audit/edit workflows stay on the local copy while collaborators edit in the Overleaf web UI. Use when user says "同步 overleaf", "overleaf sync", "推送到 overleaf", "connect overleaf", "Overleaf 桥接", "pull overleaf", "push overleaf", or wants to bridge their ARIS paper directory with an Overleaf project.

Overview

Publisherwanshuiyin
RepositoryAuto-claude-code-research-in-sleep
Skill nameoverleaf-sync
Stars
16.3K
Forks
1.4K
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by wanshuiyin on GitHub. Read the source before you install it.

Installation

Install the Overleaf Sync AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/wanshuiyin/Auto-claude-code-research-in-sleep.git /tmp/Auto-claude-code-research-in-sleep
mkdir -p .claude/skills
cp -r /tmp/Auto-claude-code-research-in-sleep/skills/overleaf-sync .claude/skills/overleaf-sync
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Overleaf Sync in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Overleaf Sync on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Overleaf Sync is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Overleaf Sync

Bridge a local paper directory with an Overleaf project so that:

  • You can keep editing in the Overleaf web UI (or share editing access with collaborators)
  • ARIS can read your changes, run audits (/paper-claim-audit, /citation-audit, /auto-paper-improvement-loop), and push fixes back

This uses the official Overleaf Git bridge (Premium feature). The agent never sees your authentication token — you do the one-time auth manually so the token lives in macOS Keychain, not in chat history or .git/config.

When to Use This Skill

  • You want to use Overleaf as the editing surface (better collaboration, shared with team) but still run ARIS pipelines locally
  • You want to take an existing local ARIS paper and push it to Overleaf for a co-author to edit
  • A collaborator made changes in Overleaf and you want to pull + diff them before continuing local work

Constants

  • CLONE_DIR_DEFAULT = paper-overleaf (sibling of existing paper/, NOT inside paper/)
  • CREDENTIAL_HELPER = osxkeychain (macOS) / manager (Windows) / cache (Linux fallback)
  • TOKEN_HANDLING = NEVER write token to disk, env var, or chat. User pastes it once into the terminal credential prompt; the OS keychain stores it from then on.

Architecture

┌─────────────────┐       git pull/push      ┌─────────────────┐
│  Local paper/   │ ◄─── rsync ──── ►       │ paper-overleaf/ │ ◄──► Overleaf web
│  (ARIS audits)  │                          │ (git bridge)    │     (collaborators)
└─────────────────┘                          └─────────────────┘

The paper-overleaf/ directory is a git clone of the Overleaf project. The paper/ directory is the working copy where ARIS skills run. They are kept in sync via rsync.

Single-source-of-truth rule: at any given time, treat one of them as authoritative for active editing. Switch directions explicitly with pull or push, and run a status check before either to surface unexpected divergence.

Sub-commands

setup <project-id> — one-time

Sets up the bridge for a new Overleaf project. The user runs this in their own terminal, never through the agent. The skill ships with a hardened setup script that:

  1. Refuses to run unless stdin/stdout are a TTY (won't run inside an agent harness)
  2. Reads the token from a hidden prompt (no chat history, no shell history)
  3. Strips the token from the remote URL immediately after cloning
  4. Primes the OS keychain so subsequent agent operations are auth-free
  5. Auto-installs a pre-commit hook in paper-overleaf/.git/hooks/ that refuses to commit any blob containing the token pattern olp_[A-Za-z0-9]{20,} — a hard technical block, not a behavioral rule

The agent's only role here is to print the user instruction:

Run this in your own terminal (NOT through me):

    bash <ARIS_REPO>/tools/overleaf_setup.sh <project-id-or-url>

When it finishes, tell me "setup done" and I'll verify.

After the user reports "setup done", the agent verifies (token-free):

bash
cd paper-overleaf
git remote -v                    # must show URL WITHOUT token
git config --get credential.helper
git fetch && git log --oneline -3   # must succeed without prompting
ls .git/hooks/pre-commit         # must exist
bash <ARIS_REPO>/tools/overleaf_audit.sh .   # must report "Audit clean"

If paper-overleaf/ exists but is empty (new Overleaf project), the agent then mirrors local paper/ into it (see push workflow).

pull — before each editing session

bash
cd paper-overleaf && git pull --ff-only

# Show what changed since last pull
LAST=$(git rev-parse HEAD@{1})
git diff --stat $LAST..HEAD
git diff $LAST..HEAD -- 'sec/*.tex'        # detailed view for prose changes

Diff protocol — DO NOT blindly merge into local paper/. Overleaf edits frequently include:

  • Half-finished sentences (collaborator clicked save mid-thought)
  • Typos that aren't in canonical references (Lrage for Large)
  • Commented-out blocks that may be intentional or may be a stash
  • Number changes that should re-trigger /paper-claim-audit
  • Cite key changes that should re-trigger /citation-audit

For each diff hunk, decide one of:

Hunk characterAction
Clean editorial improvementSync into paper/, no audit needed
Numerical / claim changeSync, then re-run /paper-claim-audit
New \cite{...}Sync, then re-run /citation-audit
Half-sentence / obvious typoFlag to user, do NOT auto-sync
New section / restructureStop, ask user before syncing

After deciding per-hunk:

bash
# Sync only the files the user approved into local paper/
rsync -av paper-overleaf/sec/0.abstract.tex paper/sec/0.abstract.tex
# (or use Edit tool for surgical changes that skip half-sentences)

push — after local editing

Use after ARIS skills have edited paper/ and you want collaborators on Overleaf to see the changes.

bash
# 1. Always pull first to surface remote drift
cd paper-overleaf && git pull --ff-only

# 2. If pull was a no-op, sync local paper → paper-overleaf
rsync -av --delete \
  --exclude='.git' --exclude='.DS_Store' \
  --exclude='*.aux' --exclude='*.log' --exclude='*.bbl' --exclude='*.blg' \
  --exclude='*.fls' --exclude='*.fdb_latexmk' --exclude='*.out' \
  --exclude='*.synctex.gz' --exclude='*.toc' \
  paper/ paper-overleaf/

# 3. Show what would be pushed
git status --short
git diff --stat

# 4. Commit + push
git add -A
git commit -m "<descriptive message — what ARIS changed and why>"
git push

Commit message protocol: include the ARIS skill that produced the change so collaborators on Overleaf understand provenance. Examples:

  • paper-write: regenerated sec/3.assurance after audit cascade refactor
  • citation-audit: fix 14 metadata entries (madaan2023, lee2024, ...)
  • paper-claim-audit: correct sec/5 numbers vs results/run_2026_04_19.json

Confirmation gate: push writes to a shared resource. ALWAYS show the user git diff --stat (and a representative hunk for prose changes) before running git push. Wait for explicit confirmation unless the user said auto: true upfront.

status — diagnostic

bash
cd paper-overleaf
git fetch
echo "=== Remote-vs-local divergence ==="
git log --oneline HEAD..origin/master    # remote ahead
git log --oneline origin/master..HEAD    # local ahead
echo "=== paper/ vs paper-overleaf/ divergence ==="
diff -rq --brief paper/ paper-overleaf/ 2>/dev/null \
  | grep -v "Only in paper/.*\.\(aux\|log\|out\|fls\|fdb_latexmk\|bbl\|blg\|synctex\|toc\)" \
  | grep -v "Only in paper-overleaf/.git" \
  | grep -v "DS_Store"

Three-way state assessment:

Remote ahead?paper/ vs paper-overleaf/ differ?MeaningRecommended action
NoNoCleanNothing to do
YesNoOverleaf has new editsRun pull, then re-run status
NoYesLocal ARIS edits unsyncedRun push
YesYesDiverged — needs mergeStop, surface to user, do NOT auto-resolve

Conflict Resolution

If git pull --ff-only fails because of true divergence:

  1. Do not run git pull (which would auto-merge).
  2. Do not run git reset --hard or git push --force (destructive).
  3. Show the user git log origin/master ^HEAD (their Overleaf commits) and git log HEAD ^origin/master (local ARIS commits).
  4. Ask the user which side to take per file, or to manually merge in Overleaf and then re-pull.

Token Security — Defense in Depth

Behavioral rules alone are not enough — the next agent reading this skill might forget them. The skill therefore relies on technical guards that hold even if the agent misbehaves:

LayerGuardWhere enforced
1. Setupoverleaf_setup.sh refuses to run without an interactive TTY (agents don't have one)tools/overleaf_setup.sh
2. InputToken is read by read -s (hidden prompt, no shell history, never enters chat)tools/overleaf_setup.sh
3. StorageToken goes straight into OS keychain via git credential approve; remote URL is stripped to a token-free formtools/overleaf_setup.sh
4. Commitspaper-overleaf/.git/hooks/pre-commit greps staged content for olp_[A-Za-z0-9]{20,} and abortsauto-installed by setup script
5. Auditoverleaf_audit.sh scans working tree, remote URLs, git history, credential filestools/overleaf_audit.sh

Behavioral rules (still apply, but secondary):

  • Never ask the user to paste a token into chat. If they do anyway: (a) acknowledge it, (b) tell them to revoke it at https://www.overleaf.com/user/settings, (c) recover via keychain if already primed.
  • Never write a token to a file (.env, .netrc, tools/*.sh, etc.) committed to any repo.
  • Never include a token in a git remote -v URL — strip it after clone.
  • On 401 Unauthorized from push/pull, tell the user the keychain entry expired and to re-run overleaf_setup.sh. Do not ask for a fresh token.

Mutual-Exclusion Rule

The single biggest source of pain in two-way sync is simultaneous editing on both sides.

  • If the user is in an active Overleaf editing session, ARIS skills should read-only access paper/ until the user runs /overleaf-sync pull.
  • If ARIS is in the middle of /auto-paper-improvement-loop or /paper-write, the user should pause Overleaf editing until the loop finishes and /overleaf-sync push is run.

When in doubt, run status first.

Output Contract

  • paper-overleaf/ directory at repo root, git clone of Overleaf project (origin URL has NO token)
  • paper/ directory unchanged in role — still the ARIS working copy
  • Each pull/push operation: a one-line summary back to the user (commits pulled / pushed, file count, link to Overleaf project URL)

See Also

  • /paper-claim-audit — re-run after pulling Overleaf changes that touch numbers
  • /citation-audit — re-run after pulling Overleaf changes that add/edit \cite{...}
  • /paper-compile — local LaTeX build; Overleaf compiles independently in the cloud
  • Overleaf Git bridge docs: https://www.overleaf.com/learn/how-to/Using_Git_and_GitHub

Frequently asked questions

What does the Overleaf Sync AI skill do?

Two-way sync between a local paper directory and an Overleaf project, so ARIS audit/edit workflows stay on the local copy while collaborators edit in the Overleaf web UI. Use when user says "同步 overleaf", "overleaf sync", "推送到 overleaf", "connect overleaf", "Overleaf 桥接", "pull overleaf", "push overleaf", or wants to bridge their ARIS paper directory with an Overleaf project.

Why use Overleaf Sync on TypingMind?

Because you install it once and use it with any model. Overleaf Sync is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Overleaf Sync in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/wanshuiyin/Auto-claude-code-research-in-sleep/tree/main/skills/overleaf-sync. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Overleaf Sync?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Overleaf Sync?

As many as you like. As long as a model supports skills, you can use Overleaf Sync with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Overleaf Sync AI skill free?

Yes. It is published on GitHub by wanshuiyin under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇