[PR #15977] feat(launch): add paperclip integration #77675

Open
opened 2026-05-05 10:21:03 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/15977
Author: @HKTITAN
Created: 5/5/2026
Status: 🔄 Open

Base: mainHead: add-paperclip-integration


📝 Commits (1)

  • 537c279 feat(launch): add paperclip integration

📊 Changes

3 files changed (+151 additions, -1 deletions)

View changed files

cmd/launch/paperclip.go (+87 -0)
cmd/launch/paperclip_test.go (+45 -0)
📝 cmd/launch/registry.go (+19 -1)

📄 Description

What this adds

A new first-class ollama launch paperclip integration alongside Codex / OpenCode / Droid / Claude / Pi / etc.

ollama launch paperclip                 # uses OLLAMA_HOST or localhost:11434
ollama launch paperclip --model qwen3:14b

Why

Paperclip (github.com/paperclipai/paperclip) is a control plane for AI-agent companies (multi-agent orchestration, runs, heartbeats, approvals). It just shipped a first-class ollama_local adapter (paperclipai/paperclip#5249) that drives Ollama's /api/chat directly with native tool calling — so the Paperclip side of this integration loop is already in place. This PR completes the loop on the Ollama side.

Files

  • cmd/launch/paperclip.goPaperclip{} runner + ensurePaperclipInstalled() helper. Modeled on codex.go (simple Runner that spawns a Node CLI). Reuses the existing ensureNpmInstalled() helper from pi.go and ConfirmPrompt() from selector_hooks.go. No Edit() phase needed because Paperclip's ollama_local adapter reads OLLAMA_HOST directly at runtime — the runner just needs to set the env on spawn.
  • cmd/launch/paperclip_test.go — covers String(), args() with and without extras, and host resolution.
  • cmd/launch/registry.go — registers paperclip (alias paperclipai) with Command: ["npm", "install", "-g", "paperclipai@latest"] and adds paperclip to launcherIntegrationOrder.

Behavior

Run(model, args):

  1. Verifies npm is on PATH (re-uses ensureNpmInstalled()).
  2. If paperclipai isn't installed, prompts via ConfirmPrompt and installs paperclipai@latest globally.
  3. Spawns paperclipai onboard --bind loopback -y --run with extra args appended, forwarding stdio.
  4. Sets in the child env:
    • OLLAMA_HOST (from os.Getenv("OLLAMA_HOST"), fallback http://localhost:11434)
    • PAPERCLIP_DEFAULT_ADAPTER=ollama_local
    • PAPERCLIP_DEFAULT_MODEL=<model> if --model was passed

The Paperclip ollama_local adapter reads OLLAMA_HOST and OLLAMA_API_KEY directly, so this works for both local Ollama and Ollama Cloud without further config.

Companion

Open questions / happy to iterate

  • The current approach uses a simple Runner-only pattern (no Editor). If maintainers prefer Paperclip also write a config file the way Droid / OpenCode do, happy to add Paths() / Edit() / Models() and write ~/.paperclip/... instead.
  • The --bind loopback -y --run flags assume the trusted-local-loopback quickstart. If maintainers prefer ollama launch paperclip defer to interactive onboarding (drop -y), I can change that.
  • Tested on a Windows host without a local Go toolchain, so build verification is via CI on this PR. paperclip.go is patterned closely on claude.go / codex.go and the test file uses only t.Setenv + reflect.DeepEqual.

cc — happy to address any review.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/15977 **Author:** [@HKTITAN](https://github.com/HKTITAN) **Created:** 5/5/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `add-paperclip-integration` --- ### 📝 Commits (1) - [`537c279`](https://github.com/ollama/ollama/commit/537c27906b94daba85627d65497227630f87da28) feat(launch): add paperclip integration ### 📊 Changes **3 files changed** (+151 additions, -1 deletions) <details> <summary>View changed files</summary> ➕ `cmd/launch/paperclip.go` (+87 -0) ➕ `cmd/launch/paperclip_test.go` (+45 -0) 📝 `cmd/launch/registry.go` (+19 -1) </details> ### 📄 Description ### What this adds A new first-class `ollama launch paperclip` integration alongside Codex / OpenCode / Droid / Claude / Pi / etc. ```sh ollama launch paperclip # uses OLLAMA_HOST or localhost:11434 ollama launch paperclip --model qwen3:14b ``` ### Why Paperclip ([github.com/paperclipai/paperclip](https://github.com/paperclipai/paperclip)) is a control plane for AI-agent companies (multi-agent orchestration, runs, heartbeats, approvals). It just shipped a first-class `ollama_local` adapter ([paperclipai/paperclip#5249](https://github.com/paperclipai/paperclip/pull/5249)) that drives Ollama's `/api/chat` directly with native tool calling — so the Paperclip side of this integration loop is already in place. This PR completes the loop on the Ollama side. ### Files - `cmd/launch/paperclip.go` — `Paperclip{}` runner + `ensurePaperclipInstalled()` helper. Modeled on `codex.go` (simple Runner that spawns a Node CLI). Reuses the existing `ensureNpmInstalled()` helper from `pi.go` and `ConfirmPrompt()` from `selector_hooks.go`. No `Edit()` phase needed because Paperclip's `ollama_local` adapter reads `OLLAMA_HOST` directly at runtime — the runner just needs to set the env on spawn. - `cmd/launch/paperclip_test.go` — covers `String()`, `args()` with and without extras, and host resolution. - `cmd/launch/registry.go` — registers `paperclip` (alias `paperclipai`) with `Command: ["npm", "install", "-g", "paperclipai@latest"]` and adds `paperclip` to `launcherIntegrationOrder`. ### Behavior `Run(model, args)`: 1. Verifies `npm` is on PATH (re-uses `ensureNpmInstalled()`). 2. If `paperclipai` isn't installed, prompts via `ConfirmPrompt` and installs `paperclipai@latest` globally. 3. Spawns `paperclipai onboard --bind loopback -y --run` with extra args appended, forwarding stdio. 4. Sets in the child env: - `OLLAMA_HOST` (from `os.Getenv("OLLAMA_HOST")`, fallback `http://localhost:11434`) - `PAPERCLIP_DEFAULT_ADAPTER=ollama_local` - `PAPERCLIP_DEFAULT_MODEL=<model>` if `--model` was passed The Paperclip `ollama_local` adapter reads `OLLAMA_HOST` and `OLLAMA_API_KEY` directly, so this works for both local Ollama and Ollama Cloud without further config. ### Companion - Tracking issue: [ollama/ollama#15976](https://github.com/ollama/ollama/issues/15976) - Paperclip PR (the `ollama_local` adapter, ready-for-review): [paperclipai/paperclip#5249](https://github.com/paperclipai/paperclip/pull/5249) ### Open questions / happy to iterate - The current approach uses a simple `Runner`-only pattern (no `Editor`). If maintainers prefer Paperclip also write a config file the way `Droid` / `OpenCode` do, happy to add `Paths()` / `Edit()` / `Models()` and write `~/.paperclip/...` instead. - The `--bind loopback -y --run` flags assume the trusted-local-loopback quickstart. If maintainers prefer `ollama launch paperclip` defer to interactive onboarding (drop `-y`), I can change that. - Tested on a Windows host without a local Go toolchain, so build verification is via CI on this PR. `paperclip.go` is patterned closely on `claude.go` / `codex.go` and the test file uses only `t.Setenv` + `reflect.DeepEqual`. cc — happy to address any review. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-05 10:21:03 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#77675