kernel
v0 · operations as code

Ops,
written
down.
— v0

kernel は、繰り返しの業務オペレーションを TypeScript で定義し、GitHub App と Discord bot から駆動するための一元 hub。

Runtime
Bun · TypeScript strict
Surface
GitHub App · Discord Bot · MCP
Engine
Claude Code (headless)
Hosting
Railway · GitHub Actions
github app: kernel-bot events: pr · issues · review comments discord: slash · mention · cron mcp: sentry · esa · backlog · context7 engine: claude code · max oauth
§01 — what

業務を コード に置き換える hub。

「人間が毎週繰り返している作業」を TypeScript の workflow として定義し、GitHub Actions・Railway・Discord・GitHub App から呼び出す。Python は使わず、Claude Code (Max OAuth) を実行エンジンに据える。

01

centralized
execution

実行ロジックを全部 kernel に置き、対象レポは外から checkout して書き換える。各レポに workflow を撒き散らさない。

02

typescript
only

workflow 実装言語は TS に統一。型で repo / cloud / SaaS の対応関係を表現する。

03

claude
max-driven

AI を使う step は Claude Code を OAuth で呼び、API 課金を介さず Max 枠で回す。

topology

                            ┌──────────────────────────┐
                            │      kernel repo           │
                            │  workflows · knowledge   │
                            └──────────────────────────┘
                              │              │
              checkout / commit           deploy
                              ▼              ▼
   ┌─────────────────────┐  ┌────────────────────────┐  ┌──────────────────┐
   │   target repos      │  │   github actions       │  │   railway          │
   │   (any org)         │  │   sentry-autofix · …   │  │   gateway+worker │
   └─────────────────────┘  └────────────────────────┘  └──────────────────┘
              ▲                          │                     │
              │                          │                     │
              │            app token (kernel-bot)          │
              │                          ▼                     ▼
              │           ┌───────────────────────────────────────────┐
              └───────────│   claude code (headless)                  │
                          │   + MCP (sentry · esa · backlog · …)      │
                          └───────────────────────────────────────────┘
                                           ▲
                                           │
                              ┌────────────┴────────────┐
                              │   discord                 │
                              │   slash · @mention · cron│
                              └─────────────────────────┘
§02 — github app

kernel-bot を あなたの org に入れる。

kernel-bot は kernel が他レポへ PR / Issue / Review コメントを書き込むための GitHub App。InterfaceX 以外の org にもインストールできる。target repo 側にコードは一切要らない。

permissions

  • Contents — read / write。target repo を clone して branch を push する。
  • Pull requests — read / write。修正 PR を起票する。
  • Issues — read / write。Discord から起票した Issue を書き込む。
  • Metadata — read。repo 情報の取得。

events (subscribed)

  • pull_request — PR の open / sync / close を gateway が受信。
  • pull_request_review_comment — レビュー指摘を拾って自動修正に流す。
  • issues — Issue label トリガで自動開発を起動。
  • installation — install / uninstall の追跡。

install in 4 steps

target repo オーナーが行う作業。

kernel-bot を install

kernel-bot App の install ページから対象 organization / repository を選ぶ。「All repositories」か「Only select」を選択。kernel-bot は read/write が必要な repo にだけ入れる。

Actions 設定で PR 作成を許可

App が PR を作れるよう、org または target repo の Settings → Actions → General で「Allow GitHub Actions to create and approve pull requests」を ON。

connect する surface を選ぶ

Sentry の autofix を回すなら Sentry token、社内 wiki を引かせるなら esa token、といった具合に MCP 越しに繋ぐ外部サービスを選定。kernel 側 secret に追加する。

動作確認

Discord から /sentry-fix-issue 等のスラッシュコマンドを発行、または kernel リポ側の workflow_dispatch を叩いて end-to-end を疎通。target repo 側に PR が立つ。

§03 — discord

chat-driven ops console.

kernel-bot-gateway が Discord に常駐し、スラッシュコマンド・メンション・cron で workflow を起動する。重い実行は worker service へ BullMQ で逃がす。

/sentry-fix-issue issue:<short-id>
Sentry の指定 issue を root cause まで遡って修正し、target repo に PR を立てる。symptom patch (try/catch で握り潰す等) は不許可。 → kernel-bot-worker が Sentry MCP + repo checkout + Claude Code headless で実行。
/issue repo:owner/repo title:… body:…
Discord から他レポに Issue を起票。kernel-bot App token で認証されるので、PAT を共有しなくて済む。 → Issue label をトリガに自動開発フローへ載せ替えできる。
@kernel-bot <自然文で依頼>
スレッドで bot に mention すると BullMQ ジョブとして enqueue。worker が Claude Code を headless で起動して結果をスレッドへ書き戻す。 → MCP 経由で社内 wiki やトラッカーを引いた回答が返る。
cron · daily-recap (00:00 JST)
過去 24h の commit / PR / review を GraphQL で集計し、Discord channel に Day-End Recap を投稿する。 → kernel リポの schedule workflow から発火。
cron · sentry-autofix (daily)
unresolved issue の頻度上位 1 件を pick → repo を逆引き → 自動修正 PR を生成。 → GitHub Actions schedule で発火。
§04 — mcp

外部 SaaS は MCP 越し に。

workflow ごとに SDK を抱え込まず、Model Context Protocol の server を起動して Claude Code に渡す。各 integration は kernel/integrations/ 配下に config 生成 shell を持ち、複数 workflow で使い回す。

mcp/01

sentry

unresolved issue 検索、event / breadcrumbs 取得。autofix の入り口。read scope のみ。

  • search_issues
  • get_issue (event 含む)
mcp/02

esa

社内ナレッジ (記事 / カテゴリ / タグ) の read。Personal Access Token v2 を read scope で発行。

  • search_posts / get_post
  • get_categories / get_team_tags
mcp/03

backlog

issue / wiki / PR / document の read。write 系は allowedTools 側で外して安全側に倒す。

  • backlog_get_issue(s)
  • backlog_get_wiki / document
mcp/04

context7

ライブラリ / フレームワーク / CLI の最新ドキュメントを fetch。training cutoff のズレ対策。

mcp/05

railway

service / deployment / volume / variable の管理。kernel 自身の deploy 操作にも使う。

mcp/06

playwright

browser automation。UI 変更の動作確認、回帰スクリーンショット取得。

§05 — skills / commands

呼び出せる 道具棚

kernel 上の Claude Code には description trigger で on-demand load される skill が並ぶ。スラッシュ起動できるものと、文脈マッチで自動 load されるものが混在する。

operations

cmd
sentry-fix-issue
指定 Sentry issue を root cause 修正 → 自動 PR。
cron
daily-recap
過去 24h の GitHub 活動を Discord に投稿。
cmd
sync-knowledge
外部 provider から現状 fetch → repo metadata 更新。
cmd
ci-fix-loop
CI 失敗を読んで修正 commit を回す自動 loop。
cmd
offload-to-worker
ローカル Claude セッションを worker に委譲。
cmd
code-review
diff レビュー、severity タグ、PR コメント貼付。
cmd
security-review
pending diff のセキュリティ観点 review。
cmd
verify
PR の動作を実アプリ起動して確認。

knowledge

read
esa-knowledge
社内 wiki を引くべきタイミングと検索構文。
read
backlog-knowledge
案件トラッカーから issue / wiki / PR 取得。
build
frourio-framework
Fastify + aspida + zod ベースの規約。
build
vercel-react-best-practices
React / Next.js の performance 指針。
build
web-design-guidelines
UI コードを web interface guidelines で監査。
build
frontend-design
distinctive な production-grade UI を作る。
infra
use-railway
Railway の project / service / deploy 操作。
meta
claude-api
Anthropic SDK / prompt caching の指針。

ads · campaign audit

audit
ads-audit
全 platform を subagent 並列で監査。
plan
ads-plan
業種別テンプレで媒体配分・予算設計。
platform
ads-google
Search / PMax / YouTube / Demand Gen 監査。
platform
ads-meta
Pixel / CAPI / 学習フェーズ・Advantage+ 評価。
platform
ads-linkedin
B2B 配信、Lead Gen Form、ABM 設計の評価。
platform
ads-tiktok
Spark / Smart+ / Shop、creative-first 評価。
platform
ads-microsoft
Bing import 検証、Copilot ads。
creative
ads-creative
format diversity / fatigue / spec compliance。
§06 — security

secret を repo に置かない

kernel は credential 管理を「git に乗せない」「scope は最小」「破壊操作は ask」の 3 原則で運用する。token 名や vault パスはここでは伏せ、運用方針だけ書く。

— 01

1Password vault が source of truth

ローカル実行時は op run 経由で env を注入し、.env 平文ファイルを作らない。

repo に置くのは .env.1password (vault item へのリファレンスのみ) で、実値は git に乗らない。

— 02

GitHub Actions は org secret

workflow が使う token は GitHub Actions の org / repo secret に置き、code には文字列を埋め込まない。

workflow からは secrets.* でしか参照されないため、log にも echo されない。

— 03

read scope を既定

esa / Backlog / Sentry など、read で済む token は read scope のみで発行。書き込みが要る workflow が出てから別 token を分離発行する。

— 04

AWS profile は inline 限定

シェル全体に AWS_PROFILE を export せず、コマンドごとに inline 指定。本番 profile での破壊操作は permission を ask に倒し、claude harness 側で都度確認する。

— 05

kernel-bot は repo 単位で許可

App は target repo に install されている範囲でしか書けない。install されていない repo へのアクセスは 404 で弾かれる。

— 06

Webhook は署名検証

外部 webhook (Messenger / GitHub) は受信時に署名検証してから処理。検証失敗は即棄却。