Skip to content

refactor: エージェントハーネスの source を agent-config リポジトリへ分離する #314

Closed

Description

@furedea-agent

個人用のエージェントハーネスの source(agents/)を,新リポジトリ furedea/agent-config へ履歴ごと分離する.
Nix のない環境でも dotfiles を clone せずにハーネスを適用できるようにするためで,dotfiles は flake input として読むだけになる.
ADR-0016(dotfiles に source を置く)と ADR-0030(dotfiles の bootstrap スクリプト)を置き換える.

flowchart LR
  H["agent-harness<br/>(公開製品・エンジン)"] -->|flake input / release binary| C["agent-config<br/>(個人 source・bootstrap・tests)"]
  C -->|flake input: packages.default| D["dotfiles<br/>(マシン設定・herdr/moshi bundle)"]
  C -->|clone + bootstrap.sh| S["Nix のないサーバー"]
Loading
観点 変更前 変更後
source の置き場所 dotfiles/agents/ agent-config
Nix のないサーバー dotfiles を clone して scripts/agents/bootstrap_server.sh agent-config を clone して bootstrap
dotfiles での参照 cp -R ${../../agents} inputs.agent-config.packages.${system}.default
source のテスト dotfiles の CI agent-config の CI

受け入れ条件

  • furedea/agent-config に agents/ と tests/agents/ が履歴付きで入り,その CI で pytest と bats が通る
  • agent-config の flake が packages.default(shebang を patch した source)を出す
  • bootstrap スクリプトが agent-config 単体の clone から動き,bootstrap_server.bats が通る
  • dotfiles が agent-config を flake input として読み,darwin-rebuild 後の ~/.claude と ~/.codex が分離前と同じ内容になる
  • dotfiles から agents/,tests/agents/,scripts/agents/ が消え,CI の ruff と pytest の対象から外れる
  • 分離を記録する ADR があり,ADR-0016 と ADR-0030 が Superseded になる
  • guard_file.py の案内文と skill 内の dotfiles 前提のパスが新しい置き場所に合っている
スコープ・除外・前提

スコープ

  • 移すもの:agents/ 全体,tests/agents/,scripts/agents/bootstrap_server.sh,nix/home/default.nix の agentSource 相当,ハーネスの方針に関する ADR
  • dotfiles に残すもの:herdr と moshi の hook bundle 生成,programs.agent-harness の有効化,github.agentToken,.agents/hooks/rules/,パッケージ導入に関する ADR

除外

  • agent-harness(エンジン)への変更
  • Claude Code / Codex の plugin 化(agent-harness の描画を迂回するため採らない)
  • bootstrap の aarch64 / macOS 対応とダウンロードの hash 検証(別 Issue)

前提

  • agent-harness とのモノレポにはしない(agent-harness の ADR-0015 で個人設定を製品から分けた決定を維持する)
  • エンジンと source の境界は source レイアウト version 1 とする

関連

  • docs/adr/0016_own_personal_agent_source.md
  • docs/adr/0030_bootstrap_the_agent_harness_on_servers_without_nix.md
  • agent-harness docs/DESIGN.md(Why not ship a personal profile?)

Activity

  1. furedea-agent commented on Oct 24, 2026

    @furedea-agent
    ContributorAuthor

    実装計画

    完了:A は furedea/agent-config#2(main dd59634),B は #315(8e61ceb)で入り,switch 済み.残りの指摘は furedea/agent-config#3〜#5 で扱う.

    作業は 2 つのレーンに分けて,A → B の順に進める.B は A の main を flake input として読むので,A が main に入るまで B は始めない.
    レーン A は dotfiles のコミットを 1 つずつ正確に移すため,squash merge を使わない.PR で CI とレビューを通した後,ユーザーが ruleset を一時的に止めて head を main へ fast-forward push する.

    flowchart LR
      A0["A0: repo 作成<br/>(project-setup)"] --> A1["A1: 履歴付き取り込み<br/>(git filter-repo)"] --> A2["A2: flake・CI・bootstrap"] --> A3["A3: ADR 移動・新 ADR"] --> A5["A5: PR で CI・レビュー"] --> AM(("A fast-forward push"))
      AM --> B1["B1: flake input 化"] --> B2["B2: 移した物を削除・CI 整理"] --> B3["B3: ADR-0016/0030 Superseded"] --> BM(("B マージ"))
    
    Loading
    レーン リポジトリ ブランチ 触るファイル
    A furedea/agent-config feat/import-agent-source 新リポジトリ全体
    B furedea/dotfiles refactor/consume-agent-config flake.nix,flake.lock,nix/home/default.nix,nix/checks.nix,.github/workflows/ci.yml,agents/,tests/agents/,scripts/agents/,docs/adr/

    レーン A:agent-config

    • A0:furedea/agent-config を作る(public,template-python,標準設定・ruleset 適用済み)
    • A1:dotfiles の clone に git filter-repo をかけ,agents/,tests/agents/,scripts/agents/,対象 ADR の履歴を取り込む.配置は次のとおり
      • agents/ → agents/(source のまま)
      • tests/agents/ → tests/
      • scripts/agents/bootstrap_server.sh → scripts/bootstrap_server.sh
      • コミットは squash せず,作者・日付・メッセージを保つ.メッセージ中の #123 は --replace-message で furedea/dotfiles#123 に書き換える
      • 取り出した履歴はテンプレートの初期コミットの上に直線で並べる(merge コミットを作らない)
    • A2:flake(packages.default は今の agentSource と同じ patchShebangs 済み source,checks,devShell),pyproject.toml と uv.lock,CI(ruff・pytest・bats),lefthook を用意する.tests/runtime.py や conftest.py など dotfiles と共有しているテスト基盤は,必要な分だけ写す
    • A3:ハーネスの方針に関する ADR を分類して移し,「personal source を専用リポジトリに置く」ADR を新しく書く
    • A4:guard_file.py:48 の案内文と,nix-dotfiles・project-setup skill のパスを直す
    • A5:feat: import the personal agent source from dotfiles agent-config#2 を開き,CI(all-green)とレビューを通す(CI green 済み,レビュー指摘は agent-config#3〜chore(deps): update actions/checkout action to v6.1.0 #5 へ).マージボタンは使わない.ユーザーが ruleset を一時的に無効にし,git push origin feat/import-agent-source:main で fast-forward した後,ruleset を戻す.PR は自動で merged になる

    レーン B:dotfiles

    • B1:flake.nix に agent-config を input として足し(agent-harness は follows で共有),agentSource を agent-config.packages.${system}.default に置き換える
    • B2:agents/,tests/agents/,scripts/agents/ を消し,CI の ruff・pytest・bats の対象から外す.nix/checks.nix の参照を直す.ただし dotfiles 専用のテスト(agent_hook.bats,codex_notification.bats,test_verification_rule.py の extension 対応表テスト)は agent-config に移していないので dotfiles に残す
    • B3:ADR-0016 と ADR-0030 を Superseded にし,agent-config の ADR へリンクする.移した ADR は dotfiles 側に移動先を残す

    検証

    • 分離の前後で agent-harness install --source の出力ツリーを比べ,差分がないことを確かめる(パスの書き換えた箇所を除く)
    • A:agent-config の CI がすべて通る.別の HOME で scripts/bootstrap_server.sh を走らせ,agent-harness verify が通る
    • B:nix flake check と darwin-rebuild build が通り,~/.claude と ~/.codex の生成物が分離前と一致する
    前提と未決事項
    • git filter-repo は入っていないので,nix shell nixpkgs#git-filter-repo で使う
    • 移す ADR の線引き:source の方針(0023,0028,0029,0031〜0038 の候補)は agent-config へ,パッケージ導入(0003〜0009,0024〜0027)は dotfiles に残す.A3 で 1 本ずつ本文を読んで決める
    • ADR の番号は agent-config で 0001 から振り直し,元の番号を本文に残す
    • agent-harness の作業ツリーにある追跡外の profiles/furedea/ は,この Issue では扱わない
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions