Logo de Opencode Handoff

Opencode Handoff

Communauté
luongnv89
opencode-handoff

Resume a limit-blocked OpenCode session in a fresh sandbox: same project and agent setup, no host OpenCode config/token/key, attached in a tmux panel. Don't use for one-shot sandbox tasks (opencode-sandbox), opencode.ai (opencode-runner), or Herdr.

Présentation

Éditeurluongnv89
Dépôtskills
Nom de la compétenceopencode-handoff
Étoiles
124
Forks
18
Fichiers inclus
2
LicenceMIT
Liens
  • Instructions en Markdown

    Un fichier SKILL.md que le modèle charge à la demande : il ne consomme donc des tokens que lorsqu’une demande correspond réellement à la compétence.

  • Compatible avec tous les LLM

    Les compétences IA sont en simple Markdown, et non en code propre à un fournisseur. Elles fonctionnent donc avec GPT, Claude, Gemini, Grok ou un modèle local.

  • 2 fichiers inclus

    Des scripts, des modèles de documents et des références que le modèle peut consulter pendant son travail. Les fichiers sont en lecture seule et ne sont jamais exécutés.

  • Open source

    Publiée par luongnv89 sur GitHub. Consultez les sources avant de l’installer.

Installation

Installez la compétence IA Opencode Handoff dans TypingMind pour l’utiliser avec n’importe quel LLM, ou ajoutez-la à un autre agent capable de lire SKILL.md.

1

Installer dans TypingMind

TypingMind installe une compétence directement depuis son dossier GitHub : l’application lit SKILL.md, regroupe les fichiers de ressources et enregistre le tout localement.

  1. Ouvrez l’application et accédez à Plugins → Compétences.
  2. Choisissez « Installer depuis GitHub ».
  3. Collez l’URL du dossier de la compétence indiquée ci-dessous, puis confirmez.
    https://github.com/luongnv89/skills/tree/main/skills/opencode-handoff
  4. Activez la compétence dans chaque discussion où vous souhaitez pouvoir l’utiliser.
Plugins → Compétences → Ajouter → Via URL GitHub, puis collez l’URL du dossier et appuyez sur Continuer.
2

Installer dans un autre agent

Tout agent capable de lire le format Agent Skills peut utiliser cette compétence : copiez le dossier dans le répertoire des compétences de cet agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/luongnv89/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/skills/opencode-handoff .claude/skills/opencode-handoff
Redémarrez Claude Code après la copie pour que la nouvelle compétence soit prise en compte.

Utilisez cette compétence dans TypingMind

Activez Opencode Handoff dans n’importe quelle discussion TypingMind et le modèle s’occupe du reste. Le nom et la description de la compétence figurent dans le prompt système. Dès qu’une demande correspond, le modèle charge lui-même l’intégralité des instructions : vous n’avez jamais à l’invoquer manuellement, et elle ne consomme aucun token tant qu’elle n’est pas utilisée.

Le modèle charge automatiquement Opencode Handoff dès qu’une demande correspond à cette compétence.

Compatible avec tous les modèles IA

Les compétences IA sont de simples instructions Markdown, et non du code propre à un fournisseur. Ainsi, Opencode Handoff n’est pas lié au modèle pour lequel cette compétence a été conçue. Installez-la une seule fois dans TypingMind et utilisez-la avec GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama ou un modèle local que vous exécutez vous-même, le tout avec vos propres clés API.

  • Chargée uniquement en cas de besoin

    Le prompt système ne contient que le nom et la description. Les instructions sont récupérées à la première demande correspondante : une compétence inutilisée ne coûte donc rien.

  • Changez de modèle en cours de discussion

    La compétence étant constituée d’instructions et non de code, elle reste fonctionnelle lorsque vous changez de modèle : le nouveau modèle lit le même fichier SKILL.md.

Instructions de la compétence

Voici le contenu de SKILL.md que le modèle charge. Lisez-le avant l’installation : une compétence contient des instructions que votre modèle suivra.

OpenCode Handoff

You hit the OpenCode usage limit mid-task. This skill gives you a new local OpenCode profile for the same project with the same agent setup, deliberately leaves the host's OpenCode config, token, and key behind, and opens it in a new tmux panel.

The credential exclusion is the point, not a side effect. Anonymous/free models may work without an account, and authentication is optional when the selected provider requires it. A fresh local profile does not guarantee a fresh provider, model, account, network, or service allowance.

This skill composes two others rather than reimplementing them:

ConcernOwned by
Container lifecycle, mounts, credentialsopencode-sandbox (run_opencode.sh)
Panel mechanicstmux-agent-comms (Phase 1 — create/discover)
Credential boundary + wiring the two togetherthis skill

When to Use

  • OpenCode reports a usage or rate limit and you want to keep going now
  • You want a second OpenCode session on the same project under a different account, without disturbing the host session
  • You want a disposable OpenCode environment that cannot spend the host account

Do not use it to run a one-shot task in a container (that is opencode-sandbox), to call opencode.ai's hosted models (opencode-runner), or to manage Herdr panes (herdr-agent).

Repo Sync Before Edits (mandatory)

The container edits the project tree through the /workspace mount, and it only sees what is on disk at docker run time. Sync before launching:

bash
branch="$(git -C "$PROJECT_DIR" rev-parse --abbrev-ref HEAD)"
git -C "$PROJECT_DIR" fetch origin && git -C "$PROJECT_DIR" pull --rebase origin "$branch"

If the tree is dirty: stash (-u), sync, pop. If origin is missing or the rebase conflicts, stop and ask the user — never rebase blind on a dirty tree.

Because the handoff container writes to the same working tree as the host session, decide with the user which session owns the tree before starting work in both.

What crosses into the container, and what does not

This is the whole design. Read references/credential-boundary.md before changing any mount.

Host pathIn containerWhy
the project dir/workspace (rw)the work itself, including its .agents/
~/.agents/root/.agents (ro)the global skill library
~/.config/opencode/skills/root/.config/opencode/skills (ro)skill wiring — see below
~/.ssh, ~/.config/gh, GH_TOKEN, ~/.gitconfigmounted (opt out)so git push / gh pr still work
~/.config/opencode (the rest)absentservice.json holds a password
~/.local/share/opencodeabsentauth.json holds opencode.key

~/.config/opencode/skills/<name> entries are relative symlinks (../../../.agents/skills/<name>). Mounting that one subdirectory at the same depth alongside ~/.agents makes them resolve inside the container with no rewriting, while everything else in ~/.config/opencode — including the credential — stays on the host.

Project-local .agents/ needs no special handling: it arrives with the project mount at the same relative path it occupies on the host, so OpenCode's project-local discovery behaves in the container exactly as it does outside.

Workflow

Step 1 — Confirm the project and sync

Resolve the project directory (default: the repo you are in) and run the Repo Sync above. Confirm the target with the user if it is not obvious.

Step 2 — Create the container and open the panel

One invocation does both. Call it by absolute path — the script lives next to this SKILL.md, not in the project:

bash
bash /path/to/opencode-handoff/scripts/handoff.sh --project /path/to/project

It resolves opencode-sandbox's run_opencode.sh from the sibling skill (then ~/.claude/skills, then ~/.agents/skills), verifies that script supports --no-opencode-config and --with-agents, and errors out if it does not — an older sandbox would silently mount the host credentials, which is the one failure this skill must never ship.

Options: --name / --session to override generated names, --image to pass a different image through (default: ghcr.io/luongnv89/devbox:latest), --no-ssh / --no-github to isolate the container from GitHub, --no-tmux to skip the panel and just print the attach command, and --sandbox-script to point at run_opencode.sh explicitly.

Step 3 — Verify the boundary held

handoff.sh checks this itself and refuses to hand over if the host's OpenCode config or data directory is bind-mounted, or if auth.json / service.json exists under any OpenCode config/data path in the container (/root, /home/*, and /workspace). Confirm you saw:

Credential boundary: OK (no OpenCode config, token, or key in the container).
Global agent setup: <N> skills under /root/.agents/skills.

A Warning: about /root/.agents/skills means the global setup did not mount — the session will work but without your skills. Fix ~/.agents on the host and recreate rather than proceeding.

Step 4 — Hand the panel to the user

Surface the printed session and attach command as a fenced block. OpenCode starts with a fresh local profile; start it directly for anonymous/free models, and log in only if the selected provider requires authentication:

bash
tmux attach-session -t <SESSION_NAME>
# then, inside the panel:
opencode2
# If authentication is required:
opencode2 auth login
# (older images may use `opencode` instead)

Never run tmux attach-session yourself from a non-TTY tool (tmux-agent-comms, Critical Rule). The session is created detached; attaching is the human's step.

Step 5 — Ask before removing the container

Default is keep, matching opencode-sandbox. The container holds the user's new session; removing it ends their work. Ask once, naming it:

Container <CONTAINER_NAME> is still running (tmux session <SESSION_NAME>). Remove it for cleanup?

  • Yes → docker rm -f "$CONTAINER_NAME", then tmux kill-session -t "$SESSION_NAME"
  • No / no answer → leave both, and repeat the attach command

Example

bash
bash ~/.claude/skills/opencode-handoff/scripts/handoff.sh \
  --project ~/code/my-app

Expected output: the sandbox reports opencode-config=0 agents=1, then Credential boundary: OK, Global agent setup: 74 skills, then SESSION_NAME=opencode-handoff-my-app-1788169556 with its tmux attach-session line. The user attaches and starts opencode2 with a fresh local profile, optionally logging in when the selected provider requires it (opencode is used on older images). The host session stays untouched; a provider-side rate limit may still apply.

Acceptance Criteria

  • A container was created for the requested project, mounted at /workspace
  • /root/.agents/skills is populated and readlink -f /root/.config/opencode/skills/<any> resolves under it
  • Credential boundary: OK printed — no auth.json or service.json under any OpenCode config/data path in the container, and the host credential directories are not bind-mounted
  • A detached tmux session was created and its attach-session line was shown to the user; the skill never attached to it itself
  • Optional opencode2 auth login instructions were surfaced, not assumed
  • The container was not removed unless the user confirmed

Edge cases this skill accounts for: an opencode-sandbox older than v2.1.0 (hard error, never a silent credential mount); tmux absent (warn, print the docker exec line, still exit 0); a tmux session name collision (error, do not reuse someone else's panel); a missing ~/.agents (warn — the session works, the skills do not); a dirty host tree before sync (stash -u, sync, pop); two sessions writing one working tree (decide ownership before starting).

Step Completion Report

◆ OpenCode Handoff
··································································
  Repo sync:             √ pass (fetch + rebase) | — n/a (clean, read-only)
  Sandbox script:        √ found, supports --no-opencode-config
  Container:             √ <name> running
  Agent setup:           √ <N> global skills, project .agents present
  Credential boundary:   √ no opencode config/token/key | × LEAK <path>
  Panel:                 √ tmux <session> (detached) | — n/a (no tmux)
  Login surfaced:        √ optional opencode2 auth login shown to user
  Container:             √ kept (<name>) | √ removed (user confirmed)
  ____________________________
  Result:               PASS | FAIL

Fichiers inclus

Le modèle lit ces fichiers à la demande lorsque la compétence est chargée. Ils sont accessibles en lecture et ne sont jamais exécutés.

Foire aux questions

À quoi sert la compétence IA Opencode Handoff ?

Resume a limit-blocked OpenCode session in a fresh sandbox: same project and agent setup, no host OpenCode config/token/key, attached in a tmux panel. Don't use for one-shot sandbox tasks (opencode-sandbox), opencode.ai (opencode-runner), or Herdr.

Pourquoi utiliser Opencode Handoff sur TypingMind ?

Parce que vous l’installez une seule fois pour l’utiliser avec n’importe quel modèle. Opencode Handoff se compose de simples instructions en Markdown plutôt que de code propre à un fournisseur. La même compétence fonctionne donc avec GPT-5, Claude, Gemini, Grok ou un modèle local, et vous pouvez changer de modèle en cours de discussion sans perturber son fonctionnement. TypingMind utilise vos propres clés API : vous payez donc directement les fournisseurs plutôt qu’un abonnement par siège, et vos compétences et discussions restent dans votre propre espace de stockage.

Comment installer Opencode Handoff dans TypingMind ?

Dans TypingMind, ouvrez Plugins → Compétences → Installer depuis GitHub et collez https://github.com/luongnv89/skills/tree/main/skills/opencode-handoff. TypingMind lit le fichier SKILL.md, regroupe les fichiers associés et installe le tout sous forme de compétence que vous pouvez activer pour chaque discussion.

Quels modèles d’IA peuvent utiliser Opencode Handoff ?

N’importe quel modèle que vous connectez dans TypingMind. Les compétences IA sont de simples instructions en Markdown, et non du code propre à un fournisseur. GPT, Claude, Gemini, Grok et les modèles locaux peuvent donc tous charger cette compétence lorsqu’une demande lui correspond.

Combien de modèles d’IA puis-je utiliser avec Opencode Handoff ?

Autant que vous le souhaitez. Tant qu’un modèle prend en charge les compétences, vous pouvez utiliser Opencode Handoff avec lui : GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama et bien d’autres, le tout dans TypingMind avec vos propres clés API.

La compétence IA Opencode Handoff est-elle gratuite ?

Oui. Cette compétence est publiée sur GitHub par luongnv89 sous licence MIT. Vous ne payez que votre propre fournisseur d’IA pour les tokens utilisés.

Que sont les compétences IA ?

Une compétence IA est un ensemble d’instructions réutilisables qui apprend à un modèle d’IA à accomplir une tâche précise. Elle suit le format ouvert Agent Skills : un fichier SKILL.md contenant un nom et une description, ainsi que les éventuels scripts, modèles de documents ou fichiers de référence dont le modèle peut avoir besoin. Le modèle ne lit les instructions que lorsque votre demande correspond à la compétence. Une compétence installée ne coûte donc rien tant qu’elle n’est pas utilisée.

En quoi les compétences IA diffèrent-elles des plugins ou des serveurs MCP ?

Un plugin ou un serveur MCP fournit au modèle de nouveaux outils à appeler : du code qui s’exécute quelque part et renvoie un résultat. Une compétence IA lui apporte plutôt des connaissances et une méthode : comment aborder une tâche, quelles étapes suivre et à quoi ressemble un bon résultat. Les compétences sont de simples instructions en Markdown. Elles ne nécessitent donc ni serveur, ni clé API, ni environnement d’exécution, et fonctionnent avec n’importe quel modèle.

Tout voir

Créez votre propre espace IA dès maintenant

Abonnez-vous à notre newsletter pour être informé des nouvelles fonctionnalités et des prochains cadeaux à gagner 👇