跳到正文
Skillpedia
智能体33k · #8898

rex-claude

它能做什么

这项技能让你的智能体在 Rex 终端中运行其他 Claude Code 会话并进行协调。适合在 Rex 中同时运行多个 AI 会话,并希望由一个会话来驱动其他会话的人。

适用场景

  • ✓当你想在 Rex 面板或标签页中启动另一个 Claude Code 会话时。
  • ✓当你需要等待子会话完成,或等待其请求权限时。
  • ✓当你想让一个智能体读取或驱动另一个会话的屏幕的时候。

技能链接

https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/productivity/rex-claude/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/productivity/rex-claude/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请在 Rex 中于 backend 文件夹打开第二个 Claude Code 会话,把测试任务发给它,完成后告诉我。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体使用 Rex 内置的辅助脚本,在某个文件夹中启动 Claude,发送提示,并监控每个会话报告的状态,然后读取结果或关闭面板。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Drive Claude Code sessions in Rex

Rex is a terminal multiplexer from Superlogical. Its rex CLI opens panes, types into them and reads their screens. Claude Code reports its state to Rex through the Program Status Protocol (OSC 7501): idle, working, done, blocked (with kind=permission, question or auth) and error. This skill uses that state to know when a child session has finished or needs someone, instead of guessing from the screen.

The helper script scripts/rex-claude.sh wraps the steps. Build its path from the "Base directory for this skill" line that Claude Code gives you when it loads this skill: ~/.claude/skills/rex-claude for a user install, or .claude/skills/rex-claude inside the project for a project install. Run it with bash, so it works even if the installer dropped the executable bit. Every command needs REX_SESSION, so run them from a Bash call inside Rex.

RC="<base directory>/scripts/rex-claude.sh"
bash "$RC" help

Requirements: you are running inside a Rex terminal (REX_SESSION and REX_BLOCK are set), and claude and jq are on PATH. For general Rex usage (tabs, layouts, other programs) run rex skill show, or install Rex's own skill with rex skill setup.

Workflow

  1. Prepare the directory. The child starts in -d DIR and loads that directory's .claude/settings.json, plus the user's ~/.claude/settings.json (model, default permission mode, hooks). To test a setting without touching the user's files, put it in a throwaway project's .claude/settings.json, or pass -- --settings '<json>'.

  2. Launch.

    B=$(bash "$RC" launch -d "$DIR" -l my-task --trust -- --model sonnet)
    

    launch prints the new block ID. Save it, because every later command targets it. Arguments after -- go to claude, for example --permission-mode default, --settings, --add-dir or --model. By default it splits your pane to the right without taking focus. Use --split below, --ratio 30, or --tab NAME for a new tab, and --focus to move focus to the new pane.

  3. Send the prompt.

    bash "$RC" send "$B" 'Run the tests and fix the failing one. Write a summary to REPORT.md.'
    

    Newlines become spaces, because Return submits the prompt. For long instructions, write them to a file in the child's directory and send Read TASK.md and do what it says., or use send "$B" -f FILE. A prompt that starts with / runs a slash command, such as /exit.

  4. Wait for the turn.

    bash "$RC" wait "$B" --timeout 600
    

    The Bash tool's default timeout is 2 minutes. Run wait in the foreground only with a Bash timeout at least as long as --timeout. For anything longer, run it with run_in_background and continue when its notification arrives. wait only counts status reports made after the last send or keys, so the previous turn's done doesn't end it early.

    Exit Output Meaning
    0 done or idle The turn finished
    10 blocked permission approve Write: /path Waiting on a person: a permission prompt, a question or a login
    11 error … The session reported an error
    12 exited claude is no longer running in the pane
    124 timeout (state=working) Still running; wait again or look at the screen
  5. Handle blocked. Look at it with bash "$RC" screen "$B" 25. A permission prompt is the user's safety net, so follow the rules below before pressing anything. To approve once, press bash "$RC" keys "$B" enter while ❯ 1. Yes is selected, then wait again. To refuse, press bash "$RC" keys "$B" escape.

  6. Read the result. Prefer a file the child wrote (ask for REPORT.md in the prompt) over the screen. Claude Code draws on the alternate screen, which has no scrollback, so screen shows only what is visible right now. bash "$RC" status "$B" prints the state, the pending prompt's message, the session title and the working directory.

  7. Verify on disk. Check files, test output or git state yourself. Don't report the child's own summary as proof.

  8. Clean up. Leave the pane open when the user may want to read it. To end the session, send "$B" /exit (then wait returns 12), and close "$B" closes the pane.

bash "$RC" ls lists every Claude Code pane in this Rex session with its state, including panes the user opened themselves.

Rules

  • Drive only panes you launched, or a pane the user names. `l
常见问题

使用它需要什么?

你必须在 Rex 终端内运行,并且电脑上已安装 claude 和 jq。

它如何知道会话已完成?

Claude Code 会向 Rex 报告其状态,例如运行中、已完成或被阻塞,因此这项技能不必从屏幕上猜测。

它能处理权限提示吗?

可以。它能检测会话何时被权限提示阻塞,并处理工作区信任对话框。

详情

作者的原始描述

Open other Claude Code sessions in Rex terminal panes or tabs and drive them: launch claude in a directory, answer the workspace trust dialog, send prompts, wait for each turn by its reported status (working, done, blocked on a permission prompt), read the screen, press keys and close the pane. Use when running inside the Rex terminal (REX_SESSION is set, TERM_PROGRAM=rex) and the user wants to start, delegate to, test in, watch or control a second Claude Code session side by side, for example to test a setting or permission in a fresh session, run a task in parallel in another pane, or check

repo: davila7/claude-code-templates

热度

GitHub 星标
33k
排名
#8898
许可证
MIT
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能