Paper ↔ Code Repository Companion (/code-bridge)
Most ML, robotics, bioinformatics, physics, and systems papers ship an official GitHub, GitLab, Hugging Face, Codeberg, or Bitbucket repository—yet papers frequently omit subtle implementation choices (gradient clipping, normalization placement, EMA decay, default epsilon values) or diverge from their released config.yaml, and the repository URL is often hidden inside a PDF hyperlink (\href{...}{Code}), a footnote, or a project page rather than in Zotero's URL/Extra/Abstract fields.
Prism's Paper ↔ Code Repository Companion (/code-bridge) bridges your Zotero PDF and the official codebase directly inside the sidebar chat card—with zero API keys required for public repositories.
![Interactive Code Bridge card inside Zotero showing the auto-detected Context Bar 'Code Repo' pill, repository badge with stars, license & 24h cache status, clickable 3-column Hyperparameter Audit KPIs (Discrepancies · Undocumented · Matches), 4 interactive tabs (Mappings · Hyperparam Audit · Code Explorer · Repro), verified [p. N] PDF jump, and clickable remote #L line links.](/Prism/images/code-bridge.png)
Local Only)
Whenever a paper matches your Local-Only Privacy Guardrail (e.g., unpublished, confidential, or a protected collection), Prism blocks both cloud LLM calls and outbound repository / project-page / registry discovery queries before anything leaves your machine. Inside the Privacy Blocked card, you can paste local Python/YAML code and audit 100% offline using your configured local LLM (e.g., Ollama or LM Studio).
1. Ways to Launch
2. Phase 1 — Official Repository Discovery & Caching
- Deep Multi-Layer Official-Repo Discovery: Prism searches in a strict local-first cascade:
- Local (100% offline, always runs): user-supplied URL, Zotero
URL/Extra/Abstract, Zotero child notes & linked URL attachments, PDF clickable hyperlink annotations (via PDF.jsgetAnnotations(), Reader.annotationLayer, and raw PDF/URI (...)& hex byte scanning—recovering links hidden behind[Code]orhere), and full PDF text (rejoining multi-column line-wrapped and kerning-spaced URLs across GitHub, GitLab (including subgroups), Hugging Face /hf.co, Codeberg, and Bitbucket). - Zero-key online fallback (only when local scan finds nothing and the paper is NOT privacy-protected): scrapes official project pages (e.g.,
*.github.io/...orProject page:links), queries Hugging Face Papers API & arXiv API (<arxiv:comment>), checks OpenAlex, and runs a strictly verified GitHub Repository Search by arXiv ID or distinctive title. Generic third-party library links (pytorch/pytorch,numpy/numpy,huggingface/transformers, etc.) are automatically filtered out unless the paper itself introduces that framework.
- Local (100% offline, always runs): user-supplied URL, Zotero
- Prioritized Multi-Platform Tree Indexing: Fetches the repository tree across GitHub, GitLab, Hugging Face, Codeberg, or Bitbucket with zero required API keys, prioritizing
README.md, dependency manifests (pyproject.toml,requirements.txt), hyperparameter configs (*.yaml,*.yml,*.json), and core algorithmic source files (model*,loss*,train*,attention*, etc.) under a strict token budget while skipping binary weights and lockfiles. - 24-Hour Local Disk Cache: Fetched snapshots are cached locally in
<ZoteroProfile>/prism-cache/code-bridge/for 24 hours (device-local, never synced). ClickRefresh Liveon any cached card to bypass the cache and pull fresh files.
3. Phase 2 — Interactive Code Bridge Card
Every /code-bridge run produces a persistent Code Bridge Card (synced conflict-free across devices via PaperChatStore) with a clickable 3-column Hyperparameter KPI strip (Discrepancies · Undocumented · Matches) and 4 interactive tabs:
- Mappings (
Equation & Algorithm ↔ Source): MapsEq. (3),Eq. (5),Algorithm 1, or architectural modules to verified line-numbered snippets highlighted offline via bundledhighlight.js. Every mapping pairs a clickable[p. N]PDF jump badge (verified against the real PDF text layer) with a clickable external GitHub / Hugging Face line link (path/to/file.py#L42-L88), implementation notes,Ask Follow-Up,Inspect File, andToy Reprohandoffs. - Hyperparam Audit (
Paper vs. Code): Combines Prism's deterministic YAML/JSON/Python config parser (handling scientific notation like1 × 10^{-4}vs.1e-4vs.0.0001with exact line numbers) and LLM synthesis to flagDiscrepancy(e.g., paper stateslr = 1e-4on[p. 6], whileconfigs/default.yaml#L14sets3e-4),Undocumentedcode settings (e.g.,grad_clip,ema_decay,label_smoothing), andMatches. - Code Explorer: Filter and browse every indexed repository file offline with line numbers, syntax highlighting,
Copy,Open, andAsk About File. - Repro (
Reproducibility Readiness): Summarizes reproducibility status (Ready/Partially Reproducible/Incomplete), estimated GPU/VRAM requirements, key dependencies, copyable entry commands, missing external artifacts (checkpoints/datasets), and top open GitHub Issues relevant to reproduction.
4. Optional GitHub Personal Access Token (PAT)
Public GitHub, GitLab, Hugging Face, Codeberg, and Bitbucket repositories work out of the box with zero API keys (GitHub allows 60 unauthenticated API requests per hour). If you audit many GitHub repositories or want to inspect private GitHub repos:
- Open Prism Settings → MCP & Web → Paper ↔ Code Companion (
/code-bridge). - Paste a read-only GitHub Personal Access Token (
ghp_…orgithub_pat_…) and click Save. - The token is encrypted locally in Zotero's OS Login Manager (
Services.logins)—it is never written to prefs, never synced, never included in settings backups, and never logged—raising your GitHub API rate limit to 5,000 requests/hour.