2026-04-28 07:01:31 +00:00
# PaperForge Headless Setup — For LLM Agents (English)
2026-04-28 06:17:13 +00:00
> **IMPORTANT**: Read this file directly. Do NOT use WebFetch or summarization — you will lose critical CLI flags and decision logic.
---
## For Humans
2026-04-28 07:01:31 +00:00
Copy this and paste it to your AI agent:
2026-04-28 06:17:13 +00:00
2026-04-28 06:44:44 +00:00
```
Install PaperForge in this vault by following:
https://raw.githubusercontent.com/LLLin000/PaperForge/master/docs/ai-agent-setup-guide.md
```
2026-04-28 06:17:13 +00:00
---
## For LLM Agents
You are installing PaperForge into the user's Obsidian Vault. Follow each step in order. **Do not skip steps.** Report results at each step before proceeding.
2026-04-28 07:01:31 +00:00
**Speak to the user in English.**
2026-04-28 06:50:18 +00:00
2026-04-28 06:17:13 +00:00
---
2026-04-28 07:01:31 +00:00
### Step 0: Collect information — ask before doing anything
2026-04-28 06:17:13 +00:00
2026-04-28 07:01:31 +00:00
Ask ALL questions below before running any command. Do not guess. Do not skip.
2026-04-28 06:17:13 +00:00
2026-04-28 07:01:31 +00:00
**Q1: Vault Path**
2026-04-28 06:17:13 +00:00
2026-04-28 07:01:31 +00:00
> What is the absolute path to your Obsidian Vault?
> (If you don't know: Open Obsidian → bottom-left vault name → "Manage Vaults" → right-click → "Show in system explorer". Send me the full path.)
2026-04-28 06:17:13 +00:00
2026-04-28 07:01:31 +00:00
Require an absolute path. Do not accept relative paths.
2026-04-28 06:17:13 +00:00
2026-04-28 07:01:31 +00:00
**Q2: AI Agent Platform**
2026-04-28 06:17:13 +00:00
2026-04-28 07:01:31 +00:00
> Which AI Agent are you using?
2026-04-28 06:17:13 +00:00
2026-04-28 07:01:31 +00:00
Show the table and wait for one choice:
2026-04-28 06:17:13 +00:00
| Key | Name |
|-----|------|
| `opencode` | OpenCode |
| `cursor` | Cursor |
| `claude` | Claude Code |
| `windsurf` | Windsurf |
| `github_copilot` | GitHub Copilot |
| `cline` | Cline |
| `augment` | Augment |
| `trae` | Trae |
2026-04-28 06:50:18 +00:00
Default if no answer: `opencode` .
2026-04-28 06:17:13 +00:00
2026-04-28 07:01:31 +00:00
**Q3: Zotero Data Directory**
2026-04-28 06:50:18 +00:00
First try auto-detection:
2026-04-28 06:22:23 +00:00
```bash
python -c "from pathlib import Path; d = Path.home() / 'Zotero'; print(str(d) if (d / 'zotero.sqlite').exists() else 'NOT_FOUND')"
```
2026-04-28 07:01:31 +00:00
Then tell the user and ask for confirmation:
2026-04-28 06:28:56 +00:00
2026-04-28 06:50:18 +00:00
> I detected a Zotero data directory at: `<path>`
> This should contain zotero.sqlite and a storage/ folder.
> — Reply "yes" if correct
> — Otherwise send me the full path to your Zotero data directory
2026-04-28 06:28:56 +00:00
2026-04-28 06:50:18 +00:00
If `NOT_FOUND` :
2026-04-28 06:28:56 +00:00
2026-04-28 07:01:31 +00:00
> Could not auto-detect Zotero data directory. Please send me the full path.
> (Should contain zotero.sqlite and storage/)
2026-04-28 06:50:18 +00:00
**Do not proceed without this path.**
2026-04-28 06:22:23 +00:00
**Q4: PaddleOCR API Key**
2026-04-28 06:50:18 +00:00
> PaperForge needs a PaddleOCR API Key for OCR. Do you have one?
> If not, sign up at https://paddleocr.baidu.com (free tier).
> If you skip now, OCR won't work until configured later. Skip?
2026-04-28 06:17:13 +00:00
2026-04-28 07:01:31 +00:00
**Q5: Directory Names**
2026-04-28 06:22:23 +00:00
2026-04-28 07:01:31 +00:00
Explain each directory and ask user to confirm or change, one by one:
2026-04-28 06:22:23 +00:00
2026-04-28 07:01:31 +00:00
| Parameter | Default | Purpose |
|-----------|---------|---------|
| System dir | `99_System` | PaperForge internal files (plugin, OCR results, export JSON) |
| Resources dir | `03_Resources` | Literature notes and state tracking |
| Literature dir | `Literature` | Formal literature note cards |
| Control dir | `LiteratureControl` | Per-paper state tracking (OCR/deep-reading status) |
| Base dir | `05_Bases` | Obsidian Base view files (tabular queue browser) |
2026-04-28 06:22:23 +00:00
2026-04-28 06:50:18 +00:00
Final vault structure:
2026-04-28 06:22:23 +00:00
```
< Vault > /
2026-04-28 06:50:18 +00:00
├── < system-dir > /
│ └── PaperForge/ ← OCR, exports, workers
├── < resources-dir > /
│ ├── < literature-dir > / ← formal notes
│ └── < control-dir > / ← state tracking
└── < base-dir > / ← Obsidian Base views
2026-04-28 06:22:23 +00:00
```
2026-04-28 07:01:31 +00:00
Ask:
> 1. System directory, default `99_System`. Keep or change?
> 2. Resources directory, default `03_Resources`?
> 3. Literature directory, default `Literature`?
> 4. Control directory, default `LiteratureControl`?
> 5. Base directory, default `05_Bases`?
2026-04-28 06:50:18 +00:00
Use defaults for any the user doesn't change.
2026-04-28 06:17:13 +00:00
---
2026-04-28 07:01:31 +00:00
### Step 1: Check Python version
2026-04-28 06:17:13 +00:00
```bash
python --version
```
2026-04-28 06:50:18 +00:00
- Python >= 3.10 → proceed to Step 2
- Python < 3.10 or missing → **STOP** .
2026-04-28 07:01:31 +00:00
> PaperForge requires Python 3.10+. Please install from https://python.org (check "Add Python to PATH"), then tell me when done.
2026-04-28 06:50:18 +00:00
**Wait for user before continuing.**
2026-04-28 06:17:13 +00:00
---
2026-04-28 07:01:31 +00:00
### Step 2: Install paperforge package
2026-04-28 06:17:13 +00:00
```bash
pip install git+https://github.com/LLLin000/PaperForge.git
```
2026-04-28 07:01:31 +00:00
- Success → "paperforge installed." Proceed to Step 3.
- Permission error → retry: `pip install --user git+https://github.com/LLLin000/PaperForge.git`
- Other errors → show the error to user, **STOP** .
2026-04-28 06:17:13 +00:00
---
2026-04-28 07:01:31 +00:00
### Step 3: Check Zotero
2026-04-28 06:17:13 +00:00
```bash
python -c "from paperforge.setup_wizard import EnvChecker; from pathlib import Path; c = EnvChecker(Path('< vault_path > ')); r = c.check_zotero(); print('OK' if r.passed else 'NOT_FOUND'); print(r.detail)"
```
2026-04-28 06:50:18 +00:00
- `OK` → proceed to Step 4
- `NOT_FOUND` → **STOP** .
2026-04-28 07:01:31 +00:00
> Zotero not found. Please install from https://zotero.org, then tell me when done.
2026-04-28 06:50:18 +00:00
**Wait for user before continuing.**
2026-04-28 06:17:13 +00:00
---
2026-04-28 07:01:31 +00:00
### Step 4: Check Better BibTeX plugin
2026-04-28 06:17:13 +00:00
```bash
python -c "from paperforge.setup_wizard import EnvChecker; from pathlib import Path; c = EnvChecker(Path('< vault_path > ')); r = c.check_bbt(); print('OK' if r.passed else 'NOT_FOUND'); print(r.detail)"
```
2026-04-28 06:50:18 +00:00
- `OK` → proceed to Step 5
- `NOT_FOUND` → **STOP** .
> Better BibTeX plugin not found. Please install:
> 1. Download: https://retorque.re/zotero-better-bibtex/
> 2. Zotero → Tools → Add-ons → gear icon → Install Add-on From File
> 3. Select the .xpi → restart Zotero
> Tell me when done.
**Wait for user before continuing.**
2026-04-28 06:17:13 +00:00
---
2026-04-28 07:01:31 +00:00
### Step 5: Create directories and deploy files
2026-04-28 06:17:13 +00:00
2026-04-28 07:01:31 +00:00
Assemble one command from all Step 0 values:
2026-04-28 06:17:13 +00:00
```bash
paperforge setup --headless \
--vault "< vault_path > " \
--agent "< agent_key > " \
2026-04-28 06:22:23 +00:00
--zotero-data "< zotero_data_dir > " \
--system-dir "< system_dir > " \
--resources-dir "< resources_dir > " \
--literature-dir "< literature_dir > " \
--control-dir "< control_dir > " \
--base-dir "< base_dir > " \
--paddleocr-key "< api_key > " \
2026-04-28 06:17:13 +00:00
--skip-checks
```
2026-04-28 07:01:31 +00:00
- Replace each `<...>` with the actual value from Step 0
- If user skipped PaddleOCR in Q4, remove `--paddleocr-key` line
- If any directory kept the default, use the default value
- `--skip-checks` because Steps 1-4 already verified everything
2026-04-28 06:17:13 +00:00
2026-04-28 07:01:31 +00:00
**Example (Windows, all defaults):**
2026-04-28 06:17:13 +00:00
```bash
2026-04-28 07:01:31 +00:00
paperforge setup --headless --vault "D:\Documents\MyVault" --agent opencode --zotero-data "C:\Users\name\Zotero" --system-dir "99_System" --resources-dir "03_Resources" --literature-dir "Literature" --control-dir "LiteratureControl" --base-dir "05_Bases" --paddleocr-key "sk-xxx" --skip-checks
2026-04-28 06:17:13 +00:00
```
2026-04-28 07:01:31 +00:00
**Expected output:**
2026-04-28 06:17:13 +00:00
```
[*] Phase 2: Creating directories... [OK] 10 directories ready
[*] Phase 4: Deploying files... [OK] worker scripts / skill files / ...
[*] Phase 5: Creating config files... [OK] .env / paperforge.json
[*] Phase 6: Registering CLI... [OK] paperforge CLI registered
[*] Phase 7: Verifying installation... [OK] All 12 checks passed
```
2026-04-28 07:01:31 +00:00
**Failure exit codes:**
2026-04-28 06:17:13 +00:00
2026-04-28 07:01:31 +00:00
| Exit code | Meaning | Action |
|-----------|---------|--------|
| 1 | Package root not found | Reinstall: `pip install --force-reinstall git+https://github.com/LLLin000/PaperForge.git` |
| 4 | Worker scripts missing | Same as above |
| 5 | Skill files missing | Same as above |
| 6 | File integrity check failed | Check disk space and write permissions on vault path |
2026-04-28 06:17:13 +00:00
---
2026-04-28 07:01:31 +00:00
### Step 6: Verify installation
2026-04-28 06:17:13 +00:00
```bash
paperforge status
```
2026-04-28 07:01:31 +00:00
If `paperforge` command not found, try:
2026-04-28 06:17:13 +00:00
```bash
python -m paperforge status
```
---
2026-04-28 07:01:31 +00:00
### Step 7: Tell user next steps
2026-04-28 06:50:18 +00:00
> Installation complete. Three things to do next:
>
> **1. Configure Zotero auto-export JSON (required)**
> This is PaperForge's data source. Sync won't work without it:
> - Open Zotero
> - File → Export Library → Format: Better BibTeX
> - Save to <system_dir>/PaperForge/exports/ in your vault
2026-04-28 07:01:31 +00:00
> - Must check "Keep Updated"
2026-04-28 06:50:18 +00:00
>
> **2. Enable PaperForge plugin in Obsidian**
> - Settings → Community Plugins → Installed → PaperForge → Enable
> - Ctrl+P, type "PaperForge"
>
> **3. If you skipped PaddleOCR Key**
> - Add to <system_dir>/PaperForge/.env:
> PADDLEOCR_API_TOKEN=<your key>
2026-04-28 06:17:13 +00:00
---
2026-04-28 07:01:31 +00:00
## Common Issues
2026-04-28 06:17:13 +00:00
2026-04-28 07:01:31 +00:00
### User stuck on a step
2026-04-28 06:17:13 +00:00
2026-04-28 07:01:31 +00:00
Go back to that step and re-check. Confirm user completed it before continuing.
2026-04-28 06:17:13 +00:00
2026-04-28 07:01:31 +00:00
### Vault path has spaces
2026-04-28 06:17:13 +00:00
2026-04-28 07:01:31 +00:00
Wrap in quotes: `--vault "D:\My Documents\MyVault"`
2026-04-28 06:17:13 +00:00
2026-04-28 07:01:31 +00:00
### pip permission error on macOS/Linux
2026-04-28 06:17:13 +00:00
2026-04-28 07:01:31 +00:00
Add `--user` :
2026-04-28 06:17:13 +00:00
```bash
pip install --user git+https://github.com/LLLin000/PaperForge.git
```
2026-04-28 07:01:31 +00:00
### User already has PaperForge (upgrade scenario)
2026-04-28 06:17:13 +00:00
2026-04-28 07:01:31 +00:00
Skip Steps 0-1. Run:
2026-04-28 06:17:13 +00:00
```bash
paperforge setup --headless --vault "< path > " --agent "< key > " --skip-checks
```