Skip to content
Agentmart
Submit a tool

worktree-agent-debug

Claude Dev Harness(spawn-agents / worktree / MCP stdio)で詰まったときのトラブルシュート。 「claude native binary not installed」「arm64」「x64」「Rosetta」「cd: No such file」…

Skill by inai17ibar

IndexedMIT
Write a review

Chalk Labs

Need help deploying worktree-agent-debug?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/inai17ibar-worktree-agent-debug

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Claude Dev Harness(spawn-agents / worktree / MCP stdio)で詰まったときのトラブルシュート。 「claude native binary not installed」「arm64」「x64」「Rosetta」「cd: No such file」 「stdout汚染」「console.log」「model not found」「404 not_found_error」「launchd」 「CLAUDE_MODEL」「モデル名」などのキーワードが出たら必ず参照すること。 harness が動かない・エージェントがクラッシュする・モデルエラーが出る場面で使う。

Use cases: agent-building

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/worktree-agent-debug

What's inside

Skill name
worktree-agent-debug
Description
Claude Dev Harness(spawn-agents / worktree / MCP stdio)で詰まったときのトラブルシュート。 「claude native binary not installed」「arm64」「x64」「Rosetta」「cd: No such file」 「stdout汚染」「console.log」「model not found」「404 not_found_error」「launchd」 「CLAUDE_MODEL」「モデル名」などのキーワードが出たら必ず参照すること。 harness が動かない・エージェントがクラッシュする・モデルエラーが出る場面で使う。
License
MIT
Instructions
253 lines in SKILL.md · view on GitHub

Agent Skills spec issues

  • body: contains an absolute path from the author's machine

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Harness / Worktree Agent デバッグ

実際に踏んだ3つの問題と、その根本原因・診断・修復・予防策。
「エラーメッセージから推測する」のではなく「正常状態を診断するコマンド」から入ること。

---

## 問題1: `claude native binary not installed` — arm64/x64 混在

### 症状

```
Error: claude native binary not installed.
[@anthropic-ai/claude-code postinstall] Native package "@anthropic-ai/claude-code-darwin-arm64" not found.
  You are running x64 Node under Rosetta 2 on Apple Silicon.
```

`npm i -g @anthropic-ai/claude-code` で再インストールしても直らない。

### 診断コマンド(まずこれ)

```bash
uname -m                              # → arm64 のはず
node -e "console.log(process.arch)"  # → ここが x64 なら問題
file $(which zsh)                     # → x86_64 が含まれていたら原因確定
file $(which node)                    # → 同上
```

`uname -m` が arm64 なのに `node` が x64 → 連鎖の始まりが `/usr/local/bin/zsh`(x64)。

### 根本原因

**「Rosettaが動いていた」のではなく「ユーザー空間のzshバイナリがx64だった」。**

```
/usr/local/bin/zsh  (x64 ← 昔のIntel Homebrew残骸)
  └→ node (x64、nvmがx64 zshの下でインストール)
      └→ npm install → x64バイナリのみダウンロード
          └→ arm64バイナリが存在しないので postinstall 失敗
```

PATHで `/usr/local/bin` が `/bin` より先にあると、x64版 zsh が優先される。
macOSデフォルトの `/bin/zsh` は arm64 だが、それより前のPATHエントリが勝ってしまう。

### 修復手順

```bash
# 1. arm64シェルに切り替えて再インストール
arch -arm64 zsh -c "nvm install --lts && npm i -g @anthropic-ai/claude-code"

# 2. 確認
node -e "console.log(process.arch)"  # → arm64

# 3. claude が使えるか
claude --version
```

### 予防策

```bash
# ~/.zshrc の PATH 設定を確認
# /usr/local/bin より /opt/homebrew/bin (arm64 Homebrew) を優先させる
echo $PATH | tr ':' '\n' | head -10
```

`/usr/local/bin/zsh` が `arm64` になっているか、または PATH から除外されていれば再発しない。
Intel時代のHomebrewが `/usr/local/` に残存している場合、nodeやzshの古いx64版を消すか、PATHの順序を直す。

---

## 問題2: stdout汚染 — bash関数の返り値がログで汚れる

### 症状

```
/usr/local/bin/spawn-agents: line 148: cd: HEAD is now at f6ec98c chore: add ...: No such file or directory
```

`cd` の引数に git のログメッセージが混入している。

### 根本原因

bash の **コマンド置換 `$(...)`** は、関数内の **stdout に出たすべての文字列** をキャプチャする。

```bash
# この書き方は create_worktree のstdout全部を worktree_path に入れる
worktree_path=$(create_worktree "$issue")
```

`create_worktree` 内に以下が混在していると壊れる:

```bash
log "✅ Worktree作成: ..."   # log() が echo を使っていると → stdout → キャプチャされる
git worktree add ...          # git 自体も stdout に "Preparing worktree..." を出す
echo "$path"                  # ← 本来キャプチャされるべき値
```

結果、`worktree_path` の中身がこうなる:

```
[09:42:24] 既存worktreeを削除: /Users/.../issue-1
Preparing worktree (new branch 'agent/issue-1-...')
HEAD is now at f6ec98c chore: ...
/Users/.../worktrees/<リポジトリ名>-issue-1     ← 本来の値はここだけのはず
```

### 修復パターン

```bash
# ❌ 壊れる
log() { echo "[$(date +%H:%M:%S)] $*"; }
create_worktree() {
  log "作成中..."
  git worktree add "$path" -b "$branch"
  echo "$path"
}

# ✅ 正しい
log() { echo "[$(date +%H:%M:%S)] $*" >&2; }   # 必ず >&2

From inai17ibar/claude-dev-harness, MIT.

More from inai17ibar/claude-dev-harness

Signals

Stars
0
Forks
0
Open issues
0
Last commit (this folder)
Sep 12, 2026 (1 month ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from inai17ibar

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get worktree-agent-debug running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying worktree-agent-debug?

CallGet help
Cite this page

worktree-agent-debug skill. Agent Mart. https://agentmart.dev/skills/inai17ibar-worktree-agent-debug (last updated 2026-10-24)