sefirot-loop

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

sefirot とは

What is Sefirot

Sefirot は Claude Code 上のマルチエージェントオーケストレーションフレームワーク。3つのエージェント(Planner / Builder / Verifier)が Milestone 単位で設計→実装→検証のループを自動で回す。
  • Planner: 設計ドキュメントからタスクを分割し、Wave(並列実行単位)を割り当てる
  • Builder: 各タスクを独立した git worktree 内で並列実装する(最大8並列)
  • Verifier: Builder のブランチをマージし、テスト・リント・型チェックで検証する。失敗時は fix task を生成して再ループ
すべての状態は
milestones.json
(タスクディレクトリ内)と設計ドキュメント(Markdown)で管理される。エージェント間の直接通信はなく、これらのファイルを介して連携する。
エージェントが判断に迷った場合は
milestones.json
questions
配列に質問を書き込み、ループが一時停止する。このスキルがその質問をユーザーに仲介し、回答を設計ドキュメントに反映してループを再開する。
Sefirot is a multi-agent orchestration framework on Claude Code. Three agents (Planner / Builder / Verifier) automatically run the design→implementation→verification loop in Milestone units.
  • Planner: Splits tasks from design documents and assigns Waves (parallel execution units)
  • Builder: Implements each task in parallel within independent git worktrees (up to 8 parallel executions)
  • Verifier: Merges Builder branches and verifies them through tests, linting, and type checks. If verification fails, it generates a fix task and restarts the loop
All states are managed by
milestones.json
(in the task directory) and design documents (Markdown). There is no direct communication between agents; they collaborate via these files.
If an agent is unsure about a decision, it writes the question to the
questions
array in
milestones.json
and the loop pauses. This skill mediates that question to the user, reflects the answer in the design document, and restarts the loop.

前提チェック

Prerequisite Check

まず
sefirot
CLI がインストールされているか確認してください:
bash
command -v sefirot
インストールされていない場合は、以下のメッセージを返して終了してください:
sefirot
CLI がインストールされていません。以下のコマンドでインストールしてください:
bash
uv tool install git+https://github.com/agarichan/sefirot.git
First, check if the
sefirot
CLI is installed:
bash
command -v sefirot
If it is not installed, return the following message and exit:
The
sefirot
CLI is not installed. Please install it using the following command:
bash
uv tool install git+https://github.com/agarichan/sefirot.git

概要

Overview

sefirot のビルドループをバックグラウンドで実行し、エージェントからの質問があればユーザーに確認して回答を反映した上で再実行する。
Run the sefirot build loop in the background, and if there are questions from agents, confirm with the user, reflect the answers, and restart the loop.

手順

Steps

ステップ0: 対象タスクの確認

Step 0: Confirm Target Task

sefirot list --active
を実行して未完了タスクの一覧を確認する:
  • 見つからない場合: 以下を案内して終了する:
    未完了のタスクがありません。
    /plan
    で設計ドキュメントを作成し、
    /milestone
    で milestones.json を生成してください。
  • 1つだけ見つかった場合: そのまま使う。
  • 複数見つかった場合:
    sefirot list --active
    の結果を提示して AskUserQuestion でユーザーにどのタスクを実行するか確認する。
Run
sefirot list --active
to check the list of incomplete tasks:
  • If none found: Guide the user with the following and exit:
    There are no incomplete tasks. Create a design document with
    /plan
    and generate milestones.json with
    /milestone
    .
  • If only one found: Use it directly.
  • If multiple found: Present the results of
    sefirot list --active
    and ask the user which task to execute using the AskUserQuestion tool.

ステップ1: バックグラウンドでループ実行

Step 1: Run Loop in Background

Bash ツールの
run_in_background: true
を使ってバックグラウンドで起動する:
bash
sefirot loop --from-skill --task-dir <ステップ0で特定したタスクディレクトリ>
起動後、ユーザーに以下を伝える:
sefirot loop をバックグラウンドで開始しました。 完了時に通知します。実行中も自由に質問できます。
Use the Bash tool's
run_in_background: true
to start it in the background:
bash
sefirot loop --from-skill --task-dir <task directory identified in Step 0>
After starting, inform the user:
The sefirot loop has started in the background. You will be notified when it is completed. You can ask questions freely during execution.

ステップ2: ユーザーとの対話(ループ実行中)

Step 2: Interaction with User (During Loop Execution)

バックグラウンドタスクの完了通知が届くまで、ユーザーの入力を待つ。 ユーザーから質問や依頼があった場合は通常通り応答する。
典型的なリクエスト:
  • 「進捗は?」「状況教えて」 → TaskOutput でバックグラウンドプロセスの出力を読み、進捗を報告する。各エージェントの詳細ログは
    .sefirot/sessions/<タスク名>/
    配下にあるので、必要に応じてそちらも確認する
  • その他の質問 → 通常通り応答する
Wait for user input until the background task completion notification arrives. Respond normally if the user has questions or requests.
Typical requests:
  • "How's the progress?" "Tell me the status" → Read the output of the background process with TaskOutput and report the progress. Detailed logs for each agent are located under
    .sefirot/sessions/<task name>/
    , so check those if necessary.
  • Other questions → Respond normally.

ステップ3: 完了時の処理

Step 3: Post-Completion Processing

バックグラウンドタスクが完了したら、TaskOutput で出力を取得する。 出力の末尾に
[SEFIROT:ACTION]
行が含まれているので、そのアクション指示に従う:
  • [SEFIROT:ACTION] COMPLETE
    : 正常完了。ステップ5 に進む。
  • [SEFIROT:ACTION] QUESTIONS_PENDING
    : 質問が保留中。ステップ4 に進む。
  • [SEFIROT:ACTION] ERROR
    : エラー。
    [SEFIROT:MESSAGE]
    行のメッセージをユーザーに報告し、終了する。
  • [SEFIROT:ACTION]
    が見つからない場合
    : 予期しないクラッシュ。出力の末尾をユーザーに報告し、終了する。
When the background task is completed, retrieve the output with TaskOutput. The output ends with a
[SEFIROT:ACTION]
line; follow the action instructions:
  • [SEFIROT:ACTION] COMPLETE
    : Completed successfully. Proceed to Step 5.
  • [SEFIROT:ACTION] QUESTIONS_PENDING
    : Questions are pending. Proceed to Step 4.
  • [SEFIROT:ACTION] ERROR
    : Error. Report the message in the
    [SEFIROT:MESSAGE]
    line to the user and exit.
  • If
    [SEFIROT:ACTION]
    is not found
    : Unexpected crash. Report the end of the output to the user and exit.

ステップ4: 質問の処理

Step 4: Process Questions

エージェントからの質問が
milestones.json
$.questions
配列に格納されている。 milestones.json は
docs/tasks/<タスクディレクトリ>/milestones.json
に配置されている。
  1. milestones.json を読み、
    questions
    配列を取得する
  2. 各質問について:
    • 質問内容をユーザーに提示する。フォーマット:
      [質問 N/{total}] from {agent} (task: {task_id})
      {question}
    • AskUserQuestion ツールを使ってユーザーの回答を得る
    • 回答を関連する設計ドキュメントに反映する: a.
      milestones.json
      から該当タスクの所属する Milestone を特定する b. その Milestone の
      plan_doc
      フィールドから設計ドキュメントのパスを取得する。
      plan_doc
      がない場合(Planner からの質問等)は、
      milestones.json
      source
      フィールド(design.md)を使う c. 設計ドキュメント内の該当タスクのセクション(または末尾)に「追加指示」として回答を追記する:
      markdown
      #### 追加指示(ユーザー回答)
      - Q: {元の質問}
      - A: {ユーザーの回答}
  3. 全ての質問を処理したら、
    milestones.json
    questions
    配列を空にする(
    "questions": []
  4. 変更をコミットする:
    bash
    git add -A && git commit -m "chore: resolve agent questions"
  5. ステップ1 に戻り、再度バックグラウンドでループを実行する
Questions from agents are stored in the
$.questions
array of
milestones.json
. milestones.json is located at
docs/tasks/<task directory>/milestones.json
.
  1. Read milestones.json and retrieve the
    questions
    array
  2. For each question:
    • Present the question to the user in the following format:
      [Question N/{total}] from {agent} (task: {task_id})
      {question}
    • Use the AskUserQuestion tool to get the user's answer
    • Reflect the answer in the relevant design document: a. Identify the Milestone to which the corresponding task belongs from milestones.json b. Get the path of the design document from the
      plan_doc
      field of that Milestone. If there is no
      plan_doc
      field (e.g., questions from Planner), use the
      source
      field (design.md) in milestones.json c. Append the answer as "Additional Instructions" in the relevant task section (or at the end) of the design document:
      markdown
      #### Additional Instructions (User Answer)
      - Q: {original question}
      - A: {user's answer}
  3. After processing all questions, empty the
    questions
    array in milestones.json (set to
    "questions": []
    )
  4. Commit the changes:
    bash
    git add -A && git commit -m "chore: resolve agent questions"
  5. Return to Step 1 and run the loop in the background again.

ステップ5: 完了報告

Step 5: Completion Report

ループが正常完了したら、結果を報告する:
  1. milestones.json
    を読み、現在の状態を把握する
  2. 以下の情報を報告する:
    • 完了した Milestone とそのゴール
    • 完了したタスクの一覧
    • 次の未完了 Milestone があればその情報
    • 検証結果のサマリー
When the loop completes successfully, report the results:
  1. Read milestones.json to understand the current state
  2. Report the following information:
    • Completed Milestones and their goals
    • List of completed tasks
    • Information on the next incomplete Milestone, if any
    • Summary of verification results

注意事項

Notes

  • ループは必ずバックグラウンドで実行する。 フォアグラウンドで実行しない
  • ループ実行中もユーザーの入力を受け付け、進捗確認などに応答する
  • 質問が発生した場合のみユーザーの判断を求める
  • 質問への回答は設計ドキュメントに永続化されるため、再実行時にエージェントが参照できる
  • 1回のループで複数の質問が発生する場合がある。全て処理してから再実行すること
  • Always run the loop in the background. Do not run it in the foreground.
  • Accept user input during loop execution and respond to progress checks, etc.
  • Only ask for the user's judgment when questions arise.
  • Answers to questions are persisted in the design document, so agents can reference them during re-runs.
  • Multiple questions may arise in one loop. Process all of them before re-running.