شعار Opencode Handoff

Opencode Handoff

المجتمع
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.

نظرة عامة

الناشرluongnv89
المستودعskills
اسم المهارةopencode-handoff
النجوم
124
التفريعات
18
الملفات المرفقة
2
الترخيصMIT
الروابط
  • تعليمات بصيغة Markdown

    ملف SKILL.md يُحمّله النموذج عند الحاجة، فلا يستهلك توكنات إلا عندما يَرِد طلب ذو صلة فعلًا.

  • تعمل مع أي نموذج لغوي كبير

    مهارات الذكاء الاصطناعي مكتوبة بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا تعمل مع GPT أو Claude أو Gemini أو Grok أو نموذج محلي.

  • الملفات المرفقة: 2

    نصوص برمجية وقوالب ومراجع يمكن للنموذج قراءتها أثناء عمله. الملفات للقراءة فقط ولا تُنفّذ أبدًا.

  • مفتوحة المصدر

    نشرها luongnv89 على GitHub. اطّلع على المصدر قبل تثبيتها.

التثبيت

ثبّت مهارة الذكاء الاصطناعي Opencode Handoff في TypingMind لاستخدامها مع أي نموذج لغوي كبير، أو أضفها إلى وكيل ذكاء اصطناعي آخر يقرأ SKILL.md.

1

التثبيت في TypingMind

يُثبّت TypingMind المهارة مباشرةً من مجلدها على GitHub — فيقرأ SKILL.md، ويجمع ملفات الموارد في حزمة، ويحفظ النتيجة محليًا.

  1. افتح التطبيق وانتقل إلى الإضافات → المهارات.
  2. اختر «تثبيت من GitHub».
  3. الصق رابط مجلد المهارة الموضّح أدناه وأكّد التثبيت.
    https://github.com/luongnv89/skills/tree/main/skills/opencode-handoff
  4. فعّل المهارة في كل محادثة تريد إتاحتها فيها.
الإضافات → المهارات → إضافة مهارة → من رابط GitHub، ثم الصق رابط المجلد واضغط على «متابعة».
2

التثبيت في وكيل ذكاء اصطناعي آخر

يمكن لأي وكيل ذكاء اصطناعي يقرأ تنسيق Agent Skills استخدام هذه المهارة — انسخ المجلد إلى مجلد المهارات الخاص بذلك الوكيل.

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
أعد تشغيل Claude Code بعد النسخ ليتعرّف على المهارة الجديدة.

استخدمها في TypingMind

فعّل Opencode Handoff في أي محادثة على TypingMind وسيتولى النموذج الباقي. تتضمن مطالبة النظام اسمها ووصفها، وبمجرد ورود طلب ذي صلة، يُحمّل النموذج التعليمات الكاملة تلقائيًا — فلا تحتاج إلى استدعائها يدويًا، ولا تستهلك أي توكنات حتى تُستخدم فعليًا.

يُحمّل النموذج Opencode Handoff تلقائيًا بمجرد ورود طلب ذي صلة بها.

تعمل مع أي نموذج ذكاء اصطناعي

مهارات الذكاء الاصطناعي هي تعليمات بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا لا ترتبط Opencode Handoff بالنموذج الذي كُتبت له. ثبّتها مرة واحدة في TypingMind واستخدمها مع GPT-5 أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو نموذج محلي تشغّله بنفسك — كل ذلك باستخدام مفاتيح API الخاصة بك.

  • تُحمَّل عند الحاجة فقط

    تتضمن مطالبة النظام الاسم والوصف فقط. وتُجلب التعليمات عند أول طلب ذي صلة، لذا لا تترتب أي تكلفة على المهارة غير المستخدمة.

  • بدّل النماذج أثناء المحادثة

    لأن المهارة تعليمات وليست شيفرة، فإن تغيير النموذج لا يعطّلها — فالنموذج التالي يقرأ ملف SKILL.md نفسه.

تعليمات المهارة

هذا هو محتوى SKILL.md الذي يُحمّله النموذج. اقرأه قبل التثبيت — فالمهارة عبارة عن تعليمات سيتبعها نموذجك.

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

الملفات المرفقة

يقرأ النموذج هذه الملفات عند الحاجة أثناء تحميل المهارة. وهي متاحة للقراءة ولا تُنفّذ أبدًا.

الأسئلة الشائعة

ماذا تفعل مهارة الذكاء الاصطناعي 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.

لماذا تستخدم Opencode Handoff على TypingMind؟

لأنك تثبّتها مرة واحدة وتستخدمها مع أي نموذج. مهارة Opencode Handoff عبارة عن نص Markdown وليست شيفرة خاصة بمزود بعينه، لذا تعمل المهارة نفسها مع GPT-5 أو Claude أو Gemini أو Grok أو نموذج محلي، ويمكنك تبديل النموذج أثناء المحادثة دون تعطّل المهارة. يعمل TypingMind بمفاتيح API الخاصة بك، فتدفع للمزودين مباشرةً بدلًا من اشتراك لكل مقعد، وتبقى مهاراتك ومحادثاتك في مساحة التخزين الخاصة بك.

كيف أثبّت Opencode Handoff في TypingMind؟

افتح الإضافات → المهارات → التثبيت من GitHub في TypingMind والصق https://github.com/luongnv89/skills/tree/main/skills/opencode-handoff. يقرأ TypingMind ملف SKILL.md الخاص بها، ويجمع ملفاتها ويثبّتها كمهارة يمكنك تفعيلها لكل محادثة على حدة.

ما نماذج الذكاء الاصطناعي التي يمكنها استخدام Opencode Handoff؟

أي نموذج تربطه في TypingMind. مهارات الذكاء الاصطناعي عبارة عن تعليمات Markdown وليست شيفرة خاصة بمزود بعينه، لذا يمكن لكل من GPT وClaude وGemini وGrok والنماذج المحلية تحميل هذه المهارة عندما يتوافق الطلب معها.

كم نموذج ذكاء اصطناعي يمكنني استخدامه مع Opencode Handoff؟

أي عدد تريده. ما دام النموذج يدعم المهارات، يمكنك استخدام Opencode Handoff معه، سواء كان GPT أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو غيرها، وكل ذلك على TypingMind باستخدام مفاتيح API الخاصة بك.

هل مهارة الذكاء الاصطناعي Opencode Handoff مجانية؟

نعم. نشرها luongnv89 على GitHub بموجب ترخيص MIT. لا تدفع إلا لمزود الذكاء الاصطناعي الخاص بك مقابل التوكنات التي تستخدمها.

ما هي مهارات الذكاء الاصطناعي؟

مهارة الذكاء الاصطناعي حزمة تعليمات قابلة لإعادة الاستخدام تعلّم نموذج الذكاء الاصطناعي كيفية تنفيذ مهمة محددة. وتتبع تنسيق Agent Skills المفتوح: ملف SKILL.md يتضمن اسمًا ووصفًا، إلى جانب أي نصوص برمجية أو قوالب أو ملفات مرجعية قد يحتاج إليها النموذج. لا يقرأ النموذج التعليمات إلا عندما يتوافق طلبك مع المهارة، لذا لا تترتب على المهارة المثبتة أي تكلفة حتى تُستخدم.

كيف تختلف مهارات الذكاء الاصطناعي عن الإضافات أو موصلات MCP؟

تمنح الإضافة أو موصل MCP النموذج أدوات جديدة يمكنه استدعاؤها، وهي شيفرة تُنفَّذ في مكان ما وتُرجع نتيجة. أما مهارة الذكاء الاصطناعي فتزوّد النموذج بالمعرفة ومنهجية العمل: كيفية التعامل مع مهمة، والخطوات التي ينبغي اتباعها، وما ينبغي أن تكون عليه المخرجات الجيدة. المهارات عبارة عن نصوص Markdown، لذا لا تحتاج إلى خادم أو مفتاح API أو بيئة تشغيل، وتعمل مع أي نموذج.

عرض الكل

أنشئ مساحة عملك للذكاء الاصطناعي الآن

اشترك في نشرتنا البريدية لتصلك أخبار الميزات الجديدة والهدايا القادمة 👇