coding-agent by steipete/clawdis
npx skills add https://github.com/steipete/clawdis --skill coding-agent对所有编码代理工作使用 bash(可选后台模式)。简单有效。
对于 Codex、Pi 和 OpenCode,仍然需要 PTY(交互式终端应用程序):
# ✅ 适用于 Codex/Pi/OpenCode 的正确方式
bash pty:true command:"codex exec '你的提示'"
对于 Claude Code(claude CLI),请改用 --print --permission-mode bypassPermissions。使用 PTY 的 --dangerously-skip-permissions 可能会在确认对话框后退出。--print 模式保持完整的工具访问权限并避免交互式确认:
# ✅ 适用于 Claude Code 的正确方式(无需 PTY)
cd /path/to/project && claude --permission-mode bypassPermissions --print '你的任务'
# 用于后台执行:在 exec 工具上使用 background:true
# ❌ 适用于 Claude Code 的错误方式
bash pty:true command:"claude --dangerously-skip-permissions '任务'"
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 参数 | 类型 | 描述 |
|---|---|---|
command | string | 要运行的 shell 命令 |
pty | boolean | 用于编码代理! 为交互式 CLI 分配伪终端 |
workdir | string | 工作目录(代理只能看到此文件夹的上下文) |
background | boolean | 在后台运行,返回用于监控的 sessionId |
timeout | number | 超时时间(秒),到期时终止进程 |
elevated | boolean | 在主机上运行而非沙箱中(如果允许) |
| 操作 | 描述 |
|---|---|
list | 列出所有正在运行/最近的会话 |
poll | 检查会话是否仍在运行 |
log | 获取会话输出(可选的偏移量/限制) |
write | 向 stdin 发送原始数据 |
submit | 发送数据 + 换行符(类似于输入并按下 Enter) |
send-keys | 发送键令牌或十六进制字节 |
paste | 粘贴文本(可选括号模式) |
kill | 终止会话 |
对于快速提示/聊天,创建一个临时 git 仓库并运行:
# 快速聊天(Codex 需要一个 git 仓库!)
SCRATCH=$(mktemp -d) && cd $SCRATCH && git init && codex exec "你的提示"
# 或者在真实项目中 - 使用 PTY!
bash pty:true workdir:~/Projects/myproject command:"codex exec '为 API 调用添加错误处理'"
为什么需要 git init? Codex 拒绝在受信任的 git 目录之外运行。创建临时仓库可以解决临时工作的问题。
对于较长的任务,使用带有 PTY 的后台模式:
# 在目标目录中启动代理(使用 PTY!)
bash pty:true workdir:~/project background:true command:"codex exec --full-auto '构建一个贪吃蛇游戏'"
# 返回用于跟踪的 sessionId
# 监控进度
process action:log sessionId:XXX
# 检查是否完成
process action:poll sessionId:XXX
# 发送输入(如果代理提问)
process action:write sessionId:XXX data:"y"
# 提交并换行(类似于输入 "yes" 并按下 Enter)
process action:submit sessionId:XXX data:"yes"
# 如果需要,终止
process action:kill sessionId:XXX
为什么 workdir 很重要: 代理在指定的目录中启动,不会偏离去读取不相关的文件(比如你的 soul.md 😅)。
模型: gpt-5.2-codex 是默认模型(在 ~/.codex/config.toml 中设置)
| 标志 | 效果 |
|---|---|
exec "prompt" | 一次性执行,完成后退出 |
--full-auto | 沙箱化但自动批准工作区内的操作 |
--yolo | 无沙箱,无批准(最快,最危险) |
# 快速一次性任务(自动批准)- 记住 PTY!
bash pty:true workdir:~/project command:"codex exec --full-auto '构建一个深色模式切换器'"
# 后台运行较长时间的工作
bash pty:true workdir:~/project background:true command:"codex --yolo '重构认证模块'"
⚠️ 关键:切勿在 OpenClaw 自己的项目文件夹中审查 PR! 克隆到临时文件夹或使用 git worktree。
# 克隆到临时文件夹进行安全审查
REVIEW_DIR=$(mktemp -d)
git clone https://github.com/user/repo.git $REVIEW_DIR
cd $REVIEW_DIR && gh pr checkout 130
bash pty:true workdir:$REVIEW_DIR command:"codex review --base origin/main"
# 完成后清理:删除 $REVIEW_DIR
# 或者使用 git worktree(保持主分支完整)
git worktree add /tmp/pr-130-review pr-130-branch
bash pty:true workdir:/tmp/pr-130-review command:"codex review --base main"
# 首先获取所有 PR 引用
git fetch origin '+refs/pull/*/head:refs/remotes/origin/pr/*'
# 部署大军 - 每个 PR 一个 Codex(全部使用 PTY!)
bash pty:true workdir:~/project background:true command:"codex exec '审查 PR #86。git diff origin/main...origin/pr/86'"
bash pty:true workdir:~/project background:true command:"codex exec '审查 PR #87。git diff origin/main...origin/pr/87'"
# 监控所有
process action:list
# 将结果发布到 GitHub
gh pr comment <PR#> --body "<审查内容>"
# 前台
bash workdir:~/project command:"claude --permission-mode bypassPermissions --print '你的任务'"
# 后台
bash workdir:~/project background:true command:"claude --permission-mode bypassPermissions --print '你的任务'"
bash pty:true workdir:~/project command:"opencode run '你的任务'"
# 安装:npm install -g @mariozechner/pi-coding-agent
bash pty:true workdir:~/project command:"pi '你的任务'"
# 非交互模式(仍推荐使用 PTY)
bash pty:true command:"pi -p '总结 src/'"
# 不同的提供商/模型
bash pty:true command:"pi --provider openai --model gpt-4o-mini -p '你的任务'"
注意: Pi 现已启用 Anthropic 提示缓存(PR #584,于 2026 年 1 月合并)!
要并行修复多个问题,请使用 git worktrees:
# 1. 为每个问题创建工作树
git worktree add -b fix/issue-78 /tmp/issue-78 main
git worktree add -b fix/issue-99 /tmp/issue-99 main
# 2. 在每个工作树中启动 Codex(后台 + PTY!)
bash pty:true workdir:/tmp/issue-78 background:true command:"pnpm install && codex --yolo '修复问题 #78:<描述>。提交并推送。'"
bash pty:true workdir:/tmp/issue-99 background:true command:"pnpm install && codex --yolo '根据已批准的工单摘要修复问题 #99。仅实施范围内的编辑,并在审查后提交。'"
# 3. 监控进度
process action:list
process action:log sessionId:XXX
# 4. 修复后创建 PR
cd /tmp/issue-78 && git push -u origin fix/issue-78
gh pr create --repo user/repo --head fix/issue-78 --title "fix: ..." --body "..."
# 5. 清理
git worktree remove /tmp/issue-78
git worktree remove /tmp/issue-99
pty:true--print --permission-mode bypassPermissions(无需 PTY)当你在后台生成编码代理时,请让用户了解情况。
这可以防止用户只看到“代理在回复前失败”而不知道发生了什么。
对于长时间运行的后台任务,在你的提示后附加一个唤醒触发器,以便在代理完成时立即通知 OpenClaw(而不是等待下一次心跳):
... 你的任务。
完全完成后,运行此命令通知我:
openclaw system event --text "完成:[简要总结构建内容]" --mode now
示例:
bash pty:true workdir:~/project background:true command:"codex --yolo exec '为待办事项构建 REST API。
完全完成后,运行:openclaw system event --text \"完成:构建了带有 CRUD 端点的待办事项 REST API\" --mode now'"
这会触发一个即时的唤醒事件 — Skippy 会在几秒内收到通知,而不是 10 分钟。
pty:true,输出会中断或代理会挂起。mktemp -d && git init。codex exec "prompt" 运行并干净退出 - 非常适合一次性任务。submit 发送输入 + Enter,使用 write 发送不带换行符的原始数据。每周安装数
644
仓库
GitHub 星标数
334.4K
首次出现
2026 年 1 月 24 日
安全审计
安装于
opencode578
gemini-cli571
codex568
openclaw566
github-copilot551
cursor545
Use bash (with optional background mode) for all coding agent work. Simple and effective.
For Codex, Pi, and OpenCode , PTY is still required (interactive terminal apps):
# ✅ Correct for Codex/Pi/OpenCode
bash pty:true command:"codex exec 'Your prompt'"
For Claude Code (claude CLI), use --print --permission-mode bypassPermissions instead. --dangerously-skip-permissions with PTY can exit after the confirmation dialog. --print mode keeps full tool access and avoids interactive confirmation:
# ✅ Correct for Claude Code (no PTY needed)
cd /path/to/project && claude --permission-mode bypassPermissions --print 'Your task'
# For background execution: use background:true on the exec tool
# ❌ Wrong for Claude Code
bash pty:true command:"claude --dangerously-skip-permissions 'task'"
| Parameter | Type | Description |
|---|---|---|
command | string | The shell command to run |
pty | boolean | Use for coding agents! Allocates a pseudo-terminal for interactive CLIs |
workdir | string | Working directory (agent sees only this folder's context) |
background | boolean | Run in background, returns sessionId for monitoring |
timeout |
| Action | Description |
|---|---|
list | List all running/recent sessions |
poll | Check if session is still running |
log | Get session output (with optional offset/limit) |
write | Send raw data to stdin |
submit | Send data + newline (like typing and pressing Enter) |
send-keys | Send key tokens or hex bytes |
For quick prompts/chats, create a temp git repo and run:
# Quick chat (Codex needs a git repo!)
SCRATCH=$(mktemp -d) && cd $SCRATCH && git init && codex exec "Your prompt here"
# Or in a real project - with PTY!
bash pty:true workdir:~/Projects/myproject command:"codex exec 'Add error handling to the API calls'"
Why git init? Codex refuses to run outside a trusted git directory. Creating a temp repo solves this for scratch work.
For longer tasks, use background mode with PTY:
# Start agent in target directory (with PTY!)
bash pty:true workdir:~/project background:true command:"codex exec --full-auto 'Build a snake game'"
# Returns sessionId for tracking
# Monitor progress
process action:log sessionId:XXX
# Check if done
process action:poll sessionId:XXX
# Send input (if agent asks a question)
process action:write sessionId:XXX data:"y"
# Submit with Enter (like typing "yes" and pressing Enter)
process action:submit sessionId:XXX data:"yes"
# Kill if needed
process action:kill sessionId:XXX
Why workdir matters: Agent wakes up in a focused directory, doesn't wander off reading unrelated files (like your soul.md 😅).
Model: gpt-5.2-codex is the default (set in ~/.codex/config.toml)
| Flag | Effect |
|---|---|
exec "prompt" | One-shot execution, exits when done |
--full-auto | Sandboxed but auto-approves in workspace |
--yolo | NO sandbox, NO approvals (fastest, most dangerous) |
# Quick one-shot (auto-approves) - remember PTY!
bash pty:true workdir:~/project command:"codex exec --full-auto 'Build a dark mode toggle'"
# Background for longer work
bash pty:true workdir:~/project background:true command:"codex --yolo 'Refactor the auth module'"
⚠️ CRITICAL: Never review PRs in OpenClaw's own project folder! Clone to temp folder or use git worktree.
# Clone to temp for safe review
REVIEW_DIR=$(mktemp -d)
git clone https://github.com/user/repo.git $REVIEW_DIR
cd $REVIEW_DIR && gh pr checkout 130
bash pty:true workdir:$REVIEW_DIR command:"codex review --base origin/main"
# Clean up after: trash $REVIEW_DIR
# Or use git worktree (keeps main intact)
git worktree add /tmp/pr-130-review pr-130-branch
bash pty:true workdir:/tmp/pr-130-review command:"codex review --base main"
# Fetch all PR refs first
git fetch origin '+refs/pull/*/head:refs/remotes/origin/pr/*'
# Deploy the army - one Codex per PR (all with PTY!)
bash pty:true workdir:~/project background:true command:"codex exec 'Review PR #86. git diff origin/main...origin/pr/86'"
bash pty:true workdir:~/project background:true command:"codex exec 'Review PR #87. git diff origin/main...origin/pr/87'"
# Monitor all
process action:list
# Post results to GitHub
gh pr comment <PR#> --body "<review content>"
# Foreground
bash workdir:~/project command:"claude --permission-mode bypassPermissions --print 'Your task'"
# Background
bash workdir:~/project background:true command:"claude --permission-mode bypassPermissions --print 'Your task'"
bash pty:true workdir:~/project command:"opencode run 'Your task'"
# Install: npm install -g @mariozechner/pi-coding-agent
bash pty:true workdir:~/project command:"pi 'Your task'"
# Non-interactive mode (PTY still recommended)
bash pty:true command:"pi -p 'Summarize src/'"
# Different provider/model
bash pty:true command:"pi --provider openai --model gpt-4o-mini -p 'Your task'"
Note: Pi now has Anthropic prompt caching enabled (PR #584, merged Jan 2026)!
For fixing multiple issues in parallel, use git worktrees:
# 1. Create worktrees for each issue
git worktree add -b fix/issue-78 /tmp/issue-78 main
git worktree add -b fix/issue-99 /tmp/issue-99 main
# 2. Launch Codex in each (background + PTY!)
bash pty:true workdir:/tmp/issue-78 background:true command:"pnpm install && codex --yolo 'Fix issue #78: <description>. Commit and push.'"
bash pty:true workdir:/tmp/issue-99 background:true command:"pnpm install && codex --yolo 'Fix issue #99 from the approved ticket summary. Implement only the in-scope edits and commit after review.'"
# 3. Monitor progress
process action:list
process action:log sessionId:XXX
# 4. Create PRs after fixes
cd /tmp/issue-78 && git push -u origin fix/issue-78
gh pr create --repo user/repo --head fix/issue-78 --title "fix: ..." --body "..."
# 5. Cleanup
git worktree remove /tmp/issue-78
git worktree remove /tmp/issue-99
pty:true--print --permission-mode bypassPermissions (no PTY required)When you spawn coding agents in the background, keep the user in the loop.
This prevents the user from seeing only "Agent failed before reply" and having no idea what happened.
For long-running background tasks, append a wake trigger to your prompt so OpenClaw gets notified immediately when the agent finishes (instead of waiting for the next heartbeat):
... your task here.
When completely finished, run this command to notify me:
openclaw system event --text "Done: [brief summary of what was built]" --mode now
Example:
bash pty:true workdir:~/project background:true command:"codex --yolo exec 'Build a REST API for todos.
When completely finished, run: openclaw system event --text \"Done: Built todos REST API with CRUD endpoints\" --mode now'"
This triggers an immediate wake event — Skippy gets pinged in seconds, not 10 minutes.
pty:true, output breaks or agent hangs.mktemp -d && git init for scratch work.codex exec "prompt" runs and exits cleanly - perfect for one-shots.submit to send input + Enter, write for raw data without newline.Weekly Installs
644
Repository
GitHub Stars
334.4K
First Seen
Jan 24, 2026
Security Audits
Gen Agent Trust HubFailSocketPassSnykFail
Installed on
opencode578
gemini-cli571
codex568
openclaw566
github-copilot551
cursor545
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
136,300 周安装
| number |
| Timeout in seconds (kills process on expiry) |
elevated | boolean | Run on host instead of sandbox (if allowed) |
paste | Paste text (with optional bracketed mode) |
kill | Terminate the session |