Skip to content

fix(nix): prepend local usage rules to the automation CLI skills - #385

Merged
furedea merged 2 commits into
mainfrom
fix/automation-skill-usage-note
Nov 4, 2026
Merged

furedea merged 2 commits into
mainfrom
fix/automation-skill-usage-note

Conversation

@furedea-agent

@furedea-agent furedea-agent Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

概要

nix/home/default.nix で生成する agent-browser と agent-desktop の skill に,フロントマター直後へ短い ## Local rules 節を挿入した.上流の agent-browser ガイドは export AGENT_BROWSER_SESSION="$(agent-browser session id ...)" && ... のような複合コマンドを勧めるが,sandbox の excludedCommands(agent-browser *,agent-desktop *)と agent-config の hook は 1 回の Bash 呼び出しが単独の素のコマンドである場合だけ sandbox 外かつ確認なしで実行する.複合形は sandbox 内で走り,daemon が起動できず,さらに確認を求めていた.

  • 挿入は既存の runCommand 内で awk を使い,ノート本文は writeText のファイルに置いた.フロントマターは先頭のまま変更しないので,name: は 2 行目に残り既存の grep -qx 'name: ...' も成立する.
  • ノートの各記述は flake.lock が固定する agent-config 3f2d578 の ADR-0018,ADR-0019,agents/hooks/lib/automation_options.py,agents/hooks/rules/allowed_commands.json と照合した.
  • nix/checks.nix の automation-cli-skills を拡張し,フロントマター直後の最初の内容行が ## Local rules であること,1 呼び出し 1 コマンドの規則,--session <name>(browser)と --app <name>(desktop)を要求するようにした.
  • agent-browser session id の許可や agent-config の変更はしていない.

変更前後

項目 変更前 変更後
skill 冒頭 上流ガイドのみ(複合コマンドと AGENT_BROWSER_SESSION を推奨) フロントマター直後に ## Local rules
実行形 export ... && ... が sandbox 内で失敗し,確認も発生 1 Bash 呼び出しに素のコマンド 1 つ
browser のセッション分離 AGENT_BROWSER_SESSION,session id --session <name>
browser のファイル出力 記載なし 確認なしは screenshot と screenshot --full のみ
desktop 記載なし ウィンドウ対象コマンドは --app <name>,パス引数は worktree か $TMPDIR 内,未登録オプション・フォーカス先への入力・batch・launch は確認
check name 行と snapshot 例のみ確認 上記ノートの位置と要点も確認

検証

  • 拡張した automation-cli-skills check を実装前に実行し,失敗することを確認した(Red).
  • 実装後に同 check が成功(Green).生成された 2 つの SKILL.md を目視し,フロントマター直後にノートがあることを確認した.
  • nix flake check: all checks passed.
  • homeConfigurations."kaito@mbp" と "kaito@mba" の activationPackage,darwinConfigurations.mbp と mba の system をビルドして成功.
  • 共有 verify: passed(bats 9 passed).lefthook の pre-commit と commitlint も成功.
  • home-manager switch と darwin-rebuild switch は実行していない.

判断と残る弱点

  • ノートの「Claude Code では」という前提は sandbox の excludedCommands が Claude 固有であるため.Codex では確認を要する形は hook により拒否される(ADR-0018)が,短さを優先してノートには書いていない.
  • desktop のパス規則は ADR-0019 に合わせ「worktree かセッションの一時ディレクトリ($TMPDIR など)」とした.当初 $TMPDIR のみと書いたが,hook は $CLAUDE_TMPDIR なども許すという Codex レビューの P3 指摘を受けて修正した.
  • ノートは上流本文の矛盾する指示(export,session id,パス付き screenshot の例)を書き換えず,「以下の矛盾する指示より優先する」と明記する方式にした.

マージ後の手動手順

  1. home-manager switch(または darwin-rebuild switch)を実行する.
  2. 新しいセッションで agent-browser open https://example.com を再試行し,確認なしで動くことを確かめる.

Refs #377

🤖 Generated with Claude Code

furedea and others added 2 commits November 4, 2026 10:16
The upstream agent-browser guide tells agents to export a session ID and
chain commands, but the sandbox exclusion and the agent-config hooks accept
only one plain call per Bash command, so the chained form ran sandboxed,
where the daemon cannot start, and asked for approval.

Insert a short Local rules section right after each skill's frontmatter,
verified against the pinned agent-config (ADR-0018, ADR-0019,
automation_options.py), and extend the automation-cli-skills check to
require it.

Refs #377

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@furedea
furedea merged commit e491e80 into main Nov 4, 2026
12 checks passed
@furedea
furedea deleted the fix/automation-skill-usage-note branch November 4, 2026 01:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant