月額110ドルの自己改善パイプライン
著者が Claude と GitHub を活用し、手動介入を最小限にした自律型開発パイプライン「autoloop」を構築・運用した事例と、その具体的なコスト構成、設定方法、動作フローが詳細に報告されている。
キーポイント
低コストで高効率な自律開発パイプラインの構築
Claude Max と Sonnet を活用し、月間約$110のコストで、バックログのトリアージ、タスク分解、実装、テスト実行までを自動化するシステム「autoloop」が2週間連続稼働している。
シンプルかつ堅牢なアーキテクチャ設計
Kubernetes や複雑なオーケストレーションツールを使用せず、単一の TOML 設定ファイルと systemd タイマーのみで構成され、GitHub Issue から PR 作成までのフローを完全自動化している。
失敗時のリカバリーと人間による最終承認
テスト失敗時は最大3回の自動再試行を行い、それでも解決しない場合は「needs-human」ラベルで停止し、開発者はスマホから PR をレビュー・マージする役割に限定されている。
具体的なコスト内訳と運用実績
Claude API 利用料が約$100、VPS が約$10 で合計$110/月であり、2週間で27件のマージを達成し、失敗は1件のみという高い成功率を示している。
重要な引用
I got tired of implementing my own backlog manually using claude code on my laptop. So I set up a loop, let the system triage it, decompose it if it's too big, implement it, run the tests, and open a PR.
It's been running for 2 weeks: 27 merges, 1 failure, with $1.61 average per-issue.
If the issue is too large, it decomposes into sub-issues with dependency ordering and triages each one.
影響分析・編集コメントを表示
影響分析
この記事は、LLM を単なるコード生成ツールから、自律的な開発プロセス全体を担うエージェントへと進化させる具体的な実装例を示しており、開発ワークフローの変革における「簡素化」と「コスト効率」の重要性を浮き彫りにしています。複雑なオーケストレーションに依存しないアプローチは、多くの開発者がすぐに再現・適用可能なモデルであり、AI 駆動型ソフトウェア開発(AI-SDLC)の実用化への道筋を明確に示すものです。
編集コメント
複雑なインフラを排除し、LLM の能力を最大限に引き出すための「シンプルさ」の重要性が際立つ実践例です。特に、完全自動化への過度な依存を避け、人間による最終承認(PR マージ)を意図的に残した設計思想は、実運用における品質担保の観点から非常に示唆に富んでいます。
自分のバックログを手動で管理する作業に疲れたので、ラップトップ上で Claude Code を使って自分で実装するのはやめました。そこで、システムが自動でトリアージを行い、タスクが大きすぎれば分解し、実装を実行してテストを走らせ、PR を作成するというループを構築しました。マージ作業はスマホから行っています。
この仕組みは 2 週間稼働しており、これまでに 27 件のマージと 1 件の失敗を記録しています。平均コストは課題あたり約 1.61 ドルです。
2 週間経過した現在、数値はまだ変動する可能性があります。現在は引き続きデータを収集中ですが、システムが成熟するのを待って更新するよりも、今の時点でこの仕組みの概要を共有したいと考えました。なぜなら、このパターンはすでに十分に機能しているように見えるからです。
コスト
$100.00/月 Claude Max(5 回使用:トリアージおよび Claude Code CLI を介した実装)
$ 9.99/月 VPS(Hostinger、2 vCPU、8GB RAM、Ubuntu)
$ 0.00/月 GitHub
─────────
$109.99/月 合計
設定
このシステムは autoloop です。ループを設定する単一のファイルがあります。
autoloop.toml
repo = "your-org/your-repo"
triage_model = "sonnet"
impl_model = "claude-opus-4-6"
verify_cmd = "uv run pytest"
max_retries = 3
protected_paths = ["autoloop/", "autoloop.toml"]
systemd タイマーを 3 つ設定するだけです。Kubernetes も、オーケストレーションフレームワークも、複雑なキューサービスも使いません。
OnCalendar=*-*-* 00:00:00 UTC # トリアージ
OnCalendar=*-*-* 02:00:00 UTC # 実装
OnCalendar=*-*-* 04:00:00 UTC # チンジログ
イシューへの処理フロー
image
image
GitHub のイシューがキューに入ります。放置された場合の処理は以下の通りです。
トリアージ (Sonnet、約 0.10 ドル): 課題を読み込み、その妥当性を検証し、ストーリーポイントを算出、優先度を決定します。もし課題が大きすぎる場合は、依存関係の順序を考慮してサブタスクに分解し、それぞれを個別にトリアージします。すべてのピースが一度の通しでビルド可能になるまで再帰的に分割し、スマホでレビューできる程度の小さな PR を生成します。
実装 (Opus、約 1.50 ドル): 依存関係に基づき最優先の課題を選び出し、ブランチを作成。Claude に課題仕様とリポジトリの文脈を渡して実行し、テストとリンティングを実行。テストファイルが追加されたか確認した上で PR を作成します。
検証ゲート: テスト失敗やテストファイル未追加の場合は最大 3 回再試行し、エラー内容をフィードバックして次の試行の文脈として提供します。それでも全試行で失敗した場合、「人間の介入が必要」とラベル付けし、キューの次項目へ進みます。
私はスマホで待機中の PR をレビューし、マージします。これが私のループへの貢献です。PR マージを自動化できないか?可能です。しかし、あえて私がゲートキーパーとなるよう設計したのが、このアーキテクチャの意図です。
失敗した日
8 日目。Issue #40 は重複する課題でした。すでに実装済みである旨が記述されていたにもかかわらず、システムは変更を生成しようと 3 回試行しました。しかし変更点は見つからず、差分がないため検証に失敗。「人間の介入が必要」とラベル付けされ、キューの次項目へ進みました。
課題を確認し、失敗の理由を読み込みました。その上で課題をクローズしました。これは正しい判断です。人間であれば重複と気づいてクローズしますが、当時はシステム側がそれを理解することはできませんでした。単に有効な PR を生成できないという事実だけを知っていたのです。そのため、システムは自ら退避しました。
12 日目。Issue #159 が 3 つのサブ課題に分解されました。そのうち 2 つ目のサブ課題で生成された PR が、1 つ目の PR で導入したインポートパスを壊してしまい、マージ競合が発生しました。私は Claude Code のリモートセッション(VPS 上の tmux)からスマホで修正し、わずか 4 分で解決しました。
見えてきたパターン: 失敗するときは、ほぼ例外なく私の課題記述が曖昧だったか、ビルダーが持っていない前提の文脈が含まれていたからです。より良い課題記述が、より良い PR を生みます。このシステムは、従来のコードレビューよりも早く、私の不十分な仕様を露呈させてくれました。
安全を保証する制約
システムは自分自身を変更できません。
protected_paths = ["autoloop/", "autoloop.toml"]課題が protected_paths 内のファイルを対象とする場合、トリアージ(選別)プロセスで「人間の介入が必要」として処理されます。ビルダーは自らのロジックやパイプライン、設定ファイルに一切手を加えることができません。この安全チェックは、トリアージ段階(第一のゲート)と実装段階(セーフティネット)の両方で実行されています。
*自己改修なしでの自己改善*。システムが改善するのはあくまで*製品*そのものです。プロセス自体を改善することはできません。この境界線こそが、無人で運用しても安全だと私が考える理由です。
何を作ったか
Patina は、Python コードが約 7,200 行、テストコードが 9,200 行、そして MCP ツールが 31 個あります。
初期のアーキテクチャは対話形式で私が構築しました。基盤がしっかり固まると、その後は「autoloop」がバックログ処理を引き継ぎます。直近マージされた PR 40 件のうち、27 件は自律的に作成されたものです。
パイプライン自体のコード量は 3,500 行です。当初は Patina のリポジトリ内に埋め込まれていましたが、現在は スタンドアロンのパッケージとして独立 しています。これを使えば、他のリポジトリにもワンコマンドで適用可能です。
autoloop init --repo your-org/your-repo --verify-cmd "pytest"
autoloop triage
autoloop implementどこで機能し、どこで機能しないか
このアプローチがどこに適用可能か、正直にお話しします。
向いているケース:
ソロビルダー、小規模チーム、あるいは一人(または一つのチーム)がシステム全体の文脈を把握できるリポジトリ。24 時間以内に修正が間に合えばよい、クリティカルパスではないシステムです。
まだ向いていないケース:
規制の厳しい環境、複数チームで開発するコードベース、ロールバック機能が必要だが今回のセットアップでは提供されていない SLA(サービスレベルアグリーメント)を課された顧客向けプロダクションなどです。このパターンは規模に関係なく適用可能ですが、今回の実装は「ゲートキーパーとして人間が一人」であることを前提としています。
2 週間という期間で長期的な証明をするのは無理があります。3 ヶ月、6 ヶ月の時点でもう一度更新します。もし性能が低下すれば、その発見も共有します。私は単にこのパターンを提示しているだけで、「勝利宣言」をしたり、すべての実世界ユースケースを解決する万能なソリューションだと主張したりしているわけではありません。
学んだこと
ボトルネックはモデルでもインフラでもありません。重要なのは「課題の質」です。曖昧な課題から生まれるのは品質の低いプルリクエストですが、明確な受入基準とファイルパスのヒントを含む具体的な課題からは、最初のレビューで即座にマージされるような高品質なコードが生まれます。
1 年前ならこれを実現するにはチームが必要でしたが、今では単なる VPS と、課題を記述する文章力だけで十分です。
code: github.com/Sanctum-Origo-Systems/autoloop。次の投稿では、なぜ「観測者」と「構築者」が別々のインスタンスとして設計されているのかを解説します。
原文を表示
I got tired of implementing my own backlog manually using claude code on my laptop. So I set up a loop, let the system triage it, decompose it if it's too big, implement it, run the tests, and open a PR. I do the merge from my phone. It's been running for 2 weeks: 27 merges, 1 failure, with $1.61 average per-issue.
It's been running for 2 weeks. The number will likely change. Now I'm still actively collecting data. I'll update this post as the system matures. But the pattern seems to work well enough that I wanted to share it now rather than wait for a perfect dataset.
The cost
$100.00/month Claude Max 5x (triage + implementation via Claude Code CLI)
$ 9.99/month VPS (Hostinger, 2 vCPU, 8GB RAM, Ubuntu)
$ 0.00/month GitHub
─────────
$109.99/month TotalThe config
The system is autoloop. One file that configures the loop:
# autoloop.toml
repo = "your-org/your-repo"
triage_model = "sonnet"
impl_model = "claude-opus-4-6"
verify_cmd = "uv run pytest"
max_retries = 3
protected_paths = ["autoloop/", "autoloop.toml"]Three systemd timers. No Kubernetes. No orchestration framework. No fancy queue service.
OnCalendar=*-*-* 00:00:00 UTC # triage
OnCalendar=*-*-* 02:00:00 UTC # implement
OnCalendar=*-*-* 04:00:00 UTC # changelogWhat happens to an issue
A GitHub issue enters the queue. Unattended:
Triage (Sonnet, ~$0.10): Reads the issue, validates it, estimates the story points, and assigns priority. If the issue is too large, it decomposes into sub-issues with dependency ordering and triages each one. It recursively splits until every piece is buildable in one pass and generates a PR small enough for me to review on my phone.
Implement (Opus, ~$1.50): Picks the top ready issue with respect to dependency ordering, creates a branch, runs Claude with the issue spec and repo context, runs tests and lint, checks that test files were added, and opens a PR.
Verification gate: When tests fail or no test files were added, it retries up to 3 times, feeding the errors back to provide context for the next attempt. If all retries fail, it labels the issue needs-human and moves on.
I review queued PRs on my phone and merge. That's my contribution to the loop. Can PR merge be done automatically? Yes, but it's a deliberate architecture decision for me to be the PR gate.
When it breaks
Day 8. Issue #40 was a duplicate. It described the issue was already implemented. The system still tried 3 times to produce a change, found nothing to change, failed verification because there was no diff. It labeled the issue needs-human and moved on to the next item in the queue.
I looked at the issue and read the failure explanation. I closed it. It was the right outcome. A human looks at it, realizes it's a duplicate, closes it. The system couldn't know at the time. It just knew it couldn't produce a valid PR. So it got out of the way.
Day 12. Issue #159 got decomposed into 3 sub-issues. The second sub-issue produced a PR that broke an import path the first PR had introduced. Merge conflict. I fixed it from my phone in the Claude Code remote session (tmux on the VPS). It took me only 4 minutes.
The pattern: when it fails, it's almost always because my issue description was ambiguous or assumed context the builder didn't have. Better issues → better PRs. The system exposed my sloppy specs faster than any code review would.
The constraint that makes it safe
The system cannot modify itself.
protected_paths = ["autoloop/", "autoloop.toml"]If an issue targets files under protected_paths, triage routes it to needs-human. The builder never touches its own logic, pipeline, or configuration. This safety check is done at both triage (primary gate) and implementation (safety net).
*Self-improvement without self-modification.* It improves the *product*. It cannot improve the *process*. That boundary is what I believe makes it safe to run unattended.
What it built
Patina: 7,200 lines of Python, 9,200 lines of tests, 31 MCP tools.
I built the initial core architecture interactively. Once the foundation was solid, autoloop took over the backlog. Of the last 40 merged PRs, 27 were autonomous.
The pipeline itself is 3,500 lines. It was originally embedded in Patina's repo, then extracted into a standalone package that I can apply to my other repositories with one command:
autoloop init --repo your-org/your-repo --verify-cmd "pytest"
autoloop triage
autoloop implementWhere it works and where it doesn't
I want to be honest about where this applies.
This works for: solo builders, small teams, repos where one person or one team can hold full context. Non-critical-path systems where a 24-hour fix cycle is acceptable.
This doesn't work (yet) for: regulated environments, multi-team codebases, customer-facing production with SLAs that need rollback mechanisms this setup doesn't provide (yet). The pattern applies at any scale but this implementation assumes one human at the gate.
Two weeks isn't proof of anything long-term. I'll update this post again at 3 and 6 month mark. If it degrades, I'll share my findings. I'm just sharing the pattern, not declaring victory or claiming a solution that can fix all real world use cases.
What I learned
The bottleneck isn't the model or the infrastructure. It's the issue quality. Vague issues produce bad PRs. Specific issues with clear acceptance criteria and file path hints produce PRs that merge on first review.
A year ago this required a team. I'm simply amazed today it only requires a VPS and taste in writing issues.
code: github.com/Sanctum-Origo-Systems/autoloop. Next post: I'll explain why the observer and the builder are separate instances.
関連記事
今日のまとめ
AI日報で今日の重要ニュースをまとめ読み