跳轉到

OMP 遠端 Coding Agent(5/5):手機通知與日常流程

摘要

Agent 做完事時,讓手機跳出通知。本篇用 OMP Extension 串接 ntfy,最後示範一天的完整操作流程。

資料基準:2026-09。執行前請以 omp --help、omp config list 與 omp models 核對目前版本支援的選項。

系列目錄
  1. 概念、架構與安裝
  2. 模型角色與日常 Coding
  3. Collab 遠端控制
  4. 設定、權限與安全
  5. 手機通知與日常流程
  6. 指令速查表(本機)
  7. 指令速查表(網頁)

1. Notification 的兩個層次

OMP 介面通知與手機推播分開設定:

A. OMP UI / Terminal Notification

例如 extension 可以:

ctx.ui.notify("Task complete", "info");

這主要作用於 OMP UI / Host terminal。

B. 真正的手機 Push Notification

如果想:

OMP 完成工作
↓
iPhone / Android 鎖屏通知

應另外接:

  • ntfy
  • Telegram Bot
  • Pushover
  • Discord Webhook
  • Slack Webhook

2. 手機 Push Notification 架構

完成任務後推送手機通知

手機 Push Notification 流程

圖 1:手機 Push Notification 流程

完成任務後的流程:

手機送出:
「幫我完成測試與 refactor」

↓

鎖手機

↓

私人筆電上的 OMP 繼續工作

↓

agent_end

↓

Push Service

↓

手機通知:
「OMP task completed」

3. OMP Extension

Extension 可以放:

~/.omp/agent/extensions/

例如:

~/.omp/agent/extensions/mobile-notify.ts

最小 Extension:

import type { ExtensionAPI } from "@oh-my-pi/pi-coding-agent";

export default function (pi: ExtensionAPI) {
  pi.on("session_start", async (_event, ctx) => {
    ctx.ui.notify("OMP extension loaded", "info");
  });
}

OMP Extension 可以註冊:

  • Session event
  • Agent event
  • Slash command
  • Tool
  • UI notification

4. ntfy 通知概念

例如:

curl \
  -d "OMP task completed" \
  https://ntfy.sh/YOUR_PRIVATE_TOPIC

Topic 名稱請視為 Secret。

不要放進公開 Repository。

可以使用環境變數:

export OMP_NTFY_TOPIC="your-private-topic"

Extension 再讀:

const topic = process.env.OMP_NTFY_TOPIC;

5. 手機通知 Extension 範例骨架

以下是概念範例,實際事件名稱與 API 應依目前 OMP Extension 文件核對:

import type { ExtensionAPI } from "@oh-my-pi/pi-coding-agent";

export default function mobileNotify(pi: ExtensionAPI) {
  pi.on("agent_end", async (_event, ctx) => {
    const topic = process.env.OMP_NTFY_TOPIC;

    if (!topic) {
      ctx.ui.notify("OMP_NTFY_TOPIC not configured", "warning");
      return;
    }

    try {
      await fetch(`https://ntfy.sh/${topic}`, {
        method: "POST",
        body: "OMP task completed",
      });

      ctx.ui.notify("Mobile notification sent", "info");
    } catch (error) {
      ctx.ui.notify("Failed to send mobile notification", "error");
    }
  });
}

可逐步加入:

  • Error notification
  • Waiting-for-input notification
  • Project name
  • Git branch
  • Task summary
  • Session link

6. 推薦日常 Workflow

早上

私人筆電:

cd ~/Projects/project-a
omp

啟用以下設定時:

collab:
  autoStart: control

啟動 OMP 時會自動建立 Collab Session。


換到其他電腦

其他電腦 Browser:

my.omp.sh

加入自己的 session。

輸入:

先查看目前 git status。

告訴我:
1. 現在 branch
2. 未 commit 修改
3. 最近完成到哪裡

不要修改任何檔案。

開始工作

繼續完成 user dashboard。

完成後:
1. 跑相關 tests
2. 檢查 lint
3. 顯示 git diff
4. 不要 push

中午離開電腦

手機打開同一個 session:

現在進度到哪?

需要批准 Shell:

Approve

完成後手機收到 Push Notification。


7. 延伸方向

需要時可擴充:

  1. 自動手機 Push Notification。
  2. 自訂 OMP Extension。
  3. 多 Project / 多 OMP Session。
  4. 自訂模型 Provider。
  5. smol / default / slow / plan 模型成本最佳化。
  6. 更嚴格的 Tool Approval Policy。
  7. Self-hosted Collab relay。
  8. 專案級 .omp/config.yml。
  9. 更完整的 AGENTS.md。
  10. GitHub PR / CI 整合。

上一篇:設定、權限與安全 · 指令總整理:速查表(本機)、速查表(網頁)

參考資料