2025年8月27日星期三

《中小企極低成本 AI 全家桶》A2A 示例: 3_1 Autonomy Planner

 https://chatgpt.com/share/68af58af-6938-8010-bb40-e76be6eaaa1d

《中小企極低成本 AI 全家桶》A2A 示例: 
3_1 Autonomy Planner

 

呢個「Autonomy Planner」真係可以用 GPT Store 做到,而且唔駛等大型平台先起步。照你嘅慣例,我會先出一份「工程計算稿(calc-pad)」;跟住再落地講點喺 GPT Store 開一隻 Autonomy Planner GPT(有 Actions 版同零-API 版)。


工程計算稿(calc-pad)

目標
把高層目標 G 拆成有次序嘅任務序列 {T₁…Tₙ},為每步自動揀工具/ API、規劃執行與回滾、同埋自審核。
模式選擇:若估計步驟 ≤ 20 且無複雜分支 → ENIAC(直線);否則 → IAS(含最少分支與審核點)。此兩模式嘅執行殼同不變式(invariants)設計,可直接套用你現成嘅 ENIAC/IAS VM 模板。

輸入 → 輸出合約(I/O contract)

  • IN:高層目標 G、可用工具清單 ToolCatalog(Actions/連接器)、風險級別、合規策略。

  • OUT(結構化)

    • PLAN:有序任務清單(每步含:意圖、所需資源、選中工具、API 規格/手動指示、成功標準、風險、回滾)。

    • RUN_MODE: ENIAC | IAS(含觸發原因)。

    • APPROVAL_GATES:需人批點位。

    • EXEC_LOG:逐步執行表 + 自審核:{geometry_ok, stability_ok, integration_ok, confidence}

工具選擇邏輯(Planner → Tool/Action)

  1. 把 G 投影到「可行吸引子槽(slot)」:以流量/依賴/風險作槓桿評分 Lₖ,揀最高者(低後悔先)。

  2. 若 n>20 或存在條件分支/並行依賴 → IAS;否則 ENIAC。

  3. 為每個 Tᵢ:

    • 從 ToolCatalog 取候選工具 {aⱼ};計分:效能×可用性×合規×成本×失敗回滾難度;揀 argmax。

    • 無合適工具 → 生成「零-API手動指示 + 證據產物(artifact)」步驟。

  4. 早期預警/EWI:監測變化率↑、方差↑、恢復率↓ → 預先控穩或改路徑。

不變式(執行守則)

  • 每步必有「明確輸入/輸出 + 成功準則 + 回滾路徑」,嚴禁隱性動作。

  • 計劃與實際 trace 必一致;出錯即回滾/停機。

  • 安全/合規閘口優先於動作(guardrails 先過,先執行)。

  • 任何「槽位」決策需減少失配向量/提升相位鎖定(phase-lock)穩定。

失敗防護

  • 工具/權限缺失 → 降級為手動 Run Sheet + 產出憑證。

  • 連續兩次計劃漂移或不變式違規 → 自動「升級」到 IAS、收緊守則、啟用分塊執行。


喺 GPT Store 實作「Autonomy Planner」GPT(先忽略你 4-步框架)

以下即係點樣只靠 GPT Store起一隻可用嘅 Planner;之後要對接你本地儀表板/交接協議先再講。

1) 建一隻 GPT(基本設定)

  • 名稱/描述:Autonomy Planner(高層目標拆解、選工具、執行與審核)。

  • Capabilities:開啟 Actions(重點)、可選 Code Interpreter(做小量計算/驗證)、可選 Browse(拉工具說明/Swagger)。

  • Knowledge:上載三類檔:

    1. 內核指令(見下一節「Instructions」);

    2. 你的工具目錄 tool_catalog.json(列出可用 Actions 與權限);

    3. 合規/公司政策(如資料分類、DLP)。

2) 加入 Actions(OpenAPI)

  • Tool Registry(最少兩個端點):

    • GET /tools:列出工具、功能、需要參數、速率限制、風險標籤。

    • POST /invoke{tool_id, operation, params} → 回傳 result | error | evidence_link

  • 你可以先把實際業務 API(如 Jira、Slack、Notion、Google Sheets、Webhook)掛喺呢個 registry 後面,Planner 只見到一致介面。

點解要 Registry?因為 Planner 需要工具同可審計嘅 invoke 介面;呢個模式正好同你現有 VM/不變式一拍即合。

3) 把呢段放入 GPT「Instructions」(內置強吸引子內核)

將 ENIAC/IAS 自律 VM + 計劃/審核欄位收斂成一段可直接貼入 GPT Store 的指令核(濃縮版):

ROLE: Autonomy Planner (ENIAC/IAS-capable). Decompose goals → choose tools → execute with audit.

MODE SELECT:
- If estimated steps ≤ 20 and no branching → MODE=ENIAC; else MODE=IAS.

STATE (single source of truth):
PLAN[], RUN_MODE, APPROVAL_GATES[], EXEC_LOG[], FLAGS{geometry_ok, stability_ok, integration_ok, confidence∈[0,1]}.

INVARIANTS:
- Every step has {inputs, tool_or_manual, params, success_criteria, rollback, evidence}.
- No hidden actions. Atomic commits. On CHECK=FALSE → ROLLBACK & STOP.
- Use Tool Registry only: list via GET /tools; call via POST /invoke.

PHASES (print in order):
P0 SPEC: restate goal, risk, assumptions.
P1 PLAN (freeze): ordered steps with tool choices + gates; print PLAN_LEN & PLAN_SIGNATURE.
P2 RUN: for each step → {PRE, ACT, POST, CHECK=TRUE/FALSE, LOG(Δ)}.
P3 AUDIT: {match(plan_vs_trace), invariants_ok, confidence, residual_risks}.

TOOL CHOICE HEURISTIC:
score = potency*availability*compliance*cost_factor*rollback_ease; pick argmax, else MANUAL.

EWI (early-warning):
If variance↑ or recovery_rate↓ or drift_rate>0.10 → tighten guards or upgrade to IAS.

OUTPUT:
1) JSON {PLAN, RUN_MODE, APPROVAL_GATES, …}
2) Human-readable runbook (bullets). Ask “APPROVE=YES” before P2 RUN.

(此設計直接承繼你嘅 ENIAC/IAS 執行殼、守則、升級策略;Planner 只係把「選工具/執行」同 VM 融合於一身。)

進階:如你要更穩,可把 MEEL×SIDA 槓桿/相位鎖定 簡化為 tool 選擇的額外欄位(e.g., phase_lock_score、leverage_into_slot),令計劃偏好低後悔槽位。

4) Conversation starters(示例)

  • 「目標:每週自動彙總 HubSpot → Google Sheet → Email 報告;風險:中;步驟估算:12。」

  • 「目標:把入職流程自動化(Jira 票、Okta 建戶、Slack 歡迎);風險:高;步驟估算:28。」

5) 執行流程(用戶體驗)

  1. 用戶丟高層目標 → GPT 回 P0/P1(含 JSON 計劃 + 人看得明嘅 Runbook)。

  2. 用戶輸入 APPROVE=YES → GPT 進入 P2 RUN,經 Actions 逐步執行;每步輸出檢查與憑證。

  3. 任何一步違規 → 立刻回滾/停機;若連續偏離 → 自動升級 IAS、分塊跑。

6) 無 Actions(零-API)備援(仍可用 GPT Store)

  • 把每步輸出改為Run Sheet(「做乜、去邊度按、要上/下載咩、改乜名、留乜證據」),並產出一個 handoff JSON(含下一步 seed、工序狀態、憑證清單)。

  • 呢套模式本身就係「Autonomy Planner = 計劃 + 人手執行指示 + 稽核證據」,可即用;之後再補接 Actions 逐步自動化。

7) 安全與合規(Guardrails)

  • 預執行審查:任何涉及 PII/金額/外發訊息的步驟,必經 APPROVAL_GATES

  • 日誌:所有工具呼叫(含參數摘要/結果/錯誤碼)寫入 EXEC_LOG

  • 自審核:固定輸出 {geometry_ok, stability_ok, integration_ok, confidence},方便審計報告。


小結(對齊你嘅全家桶藍圖)

  • 你嘅五大類裏面,「Autonomy Planner」正係第 3 類 Agentic workflows & task execution 嘅第一隻核心 GPT:拆解 → 選工具 → 執行 → 稽核。等你要同 Salesforce Agentforce/Databricks Mosaic 呢啲思路對標時,呢個設計同其「計劃-執行-評估」骨架完全兼容。

要唔要我即場幫你:

  • 產一份 tool_catalog.json 樣板 + 一個最小 OpenAPI(/tools, /invoke);

  • 再給一段「公司政策包」骨架(資料分類/敏感操作關卡)?

 

JS 儀表板(按 Schema)逐步用戶操作流程

先交「工程計算稿(calc-pad)」做全局設計,之後給你JS 儀表板(按 Schema)逐步用戶操作流程,以及每個階段要輸入/輸出的檔案名稱(先只列檔名,不展開格式)。


工程計算稿(calc-pad)

狀態機(State)
INTAKE → PLAN_FREEZE → APPROVAL_PENDING → EXEC_RUNNING ↔ PAUSED/ROLLBACK → COMPLETED → AUDITED → ARCHIVED

核心物件(單一真相源 SSoT)

  • GOALTOOLCATALOGPOLICYPACK

  • PLAN(ENIAC≤20步|IAS>20步/有分支)、RUNBOOK

  • GATES(審批點)、RUNLOG(步驟日誌)、EVIDENCE(憑證清單)

  • AUDIT(計劃↔實際對賬、風險、信心)、RETENTION

不變式(Invariants)
每一步都要有:inputs, tool_or_manual, params, success_criteria, rollback, evidence_hook
任何 CHECK=false → 立即回滾/停機;計劃與日誌可對賬;所有外發受 GATES 控制。

事件匯流排(Event)
goal.created, plan.frozen, gate.requested, gate.approved, step.started, step.checked, step.failed, rollback.started, run.completed, audit.finalized, package.exported


JS 儀表板 × 用戶操作全流程(可同時支援「有 Actions」與「零-API 手動模式」)

A. 儀表板結構(主要卡片 / Tabs)

  1. Goal 卡(GoalCard):收集目標、範圍、風險級別、估算步數(決定 ENIAC/IAS)。

  2. Tools 卡(ToolCatalogCard):顯示可用 Actions / 權限;無 Actions 時可關閉。

  3. Policy 卡(PolicyPackCard):上載/選擇公司合規與敏感操作規則。

  4. Plan 卡(PlanCard):產生與凍結計劃;切換 ENIAC/IAS;設定審批點。

  5. Run 卡(RunConsole):逐步執行(自動或手動 Run Sheet);顯示日誌與憑證。

  6. Audit 卡(AuditTrailCard):計劃對賬、信心分數、殘餘風險。

  7. Export 卡(ExportPackCard):一鍵打包輸出。

  8. Retention 卡(RetentionCard):保存/匿名化/刪除策略。


B. 用戶逐步操作(按狀態)

1) INTAKE:建立目標與基礎設定

用戶在 Goal 卡 完成:

  • 填寫目標、時限、成功標準、估算步數、風險級別。

  • (可選)指派角色:擁有者/審批者/執行者。

  • 按【Save Goal】→ 生成專案目錄與空白 SSoT。

需上載/產出檔案(檔名)

  • goal.intake.json(輸入)

  • session.state.json(自動產生,輸出)

2) 配置工具與政策

Tools 卡

  • 如有 Actions:點【連線】授權;或關閉 Actions 轉手動模式。
    Policy 卡

  • 上載或選擇預設合規包;開關敏感操作關卡(Gates)。

檔案

  • tool_catalog.json(輸入|或雲端拉取快照)

  • policy_pack.json(輸入)

3) 產生與凍結計劃(PLAN_FREEZE)

Plan 卡

  • 按【Generate Plan】→ 顯示草案(步驟、工具/手動、回滾、憑證鉤子)。

  • 設定/調整 Approval Gates(如:外發電郵、金額操作、PII 存取)。

  • 按【Freeze Plan】→ 計劃凍結並產出 Runbook。

檔案

  • plan.v1.json(輸出)

  • runbook.v1.md(輸出)

  • gates.v1.json(輸出)

4) 提交審批(APPROVAL_PENDING)

Plan 卡 或頂部提醒條:

  • 審批者檢閱 Runbook 與差異提示。

  • 按【Approve & Arm】或【Request Changes】。

檔案

  • approval.record.json(輸出;若退回亦寫入原因)

5) 執行(EXEC_RUNNING)

Run 卡

  • 有 Actions:按【Start Run】→ 系統逐步執行,每步顯示 PRE/ACT/POST/CHECK

  • 零-API 手動:點開某步【Open Manual Sheet】,按指示完成後上載憑證,按【Mark as Done】。

檔案

  • exec_log.ndjson(輸出;流式追加)

  • evidence.manifest.json(輸出)

  • step_result_<stepId>_<ts>.json(輸出)

  • manual_runsheet_<stepId>.md(輸出;僅手動模式)

  • rollback.plan.json(輸出;自動生成回滾腳本/步驟)

運行中可用按鈕

  • 【Pause】、【Rollback to…】、【Retry Step】、【Escalate to IAS】(若原為 ENIAC)

6) 例外與回滾(PAUSED / ROLLBACK)

  • 當步驟 CHECK=false 或觸發敏感關卡:

    • 儀表板彈出回滾建議;用戶選【按建議回滾】或【自定回滾範圍】。

  • 回滾後自動寫入日誌與憑證。

檔案

  • incident.report.json(輸出;故障詳情)

  • rollback.exec_log.ndjson(輸出)

7) 完成與對賬(COMPLETED → AUDITED)

Audit 卡

  • 一鍵【Reconcile】→ 對賬:PLAN vs EXEC_LOG、憑證完整性、合規命中、殘餘風險。

  • 生成審核報告與信心分數;必要時標記重跑區段。

檔案

  • audit.report.md(輸出)

  • audit.metrics.json(輸出)

  • residual_risk register.json(輸出)

8) 打包與交付(EXPORT)

Export 卡

  • 勾選要包含的工件(計劃、日誌、憑證、審核、runbook)。

  • 按【Export Bundle】產出可歸檔的 zip。

檔案

  • handoff.readme.md(輸出)

  • export_bundle_<projectId>_<date>.zip(輸出)

9) 保存/匿名化/清檔(ARCHIVED)

Retention 卡

  • 選擇策略(保存 N 天、匿名化、永久保存、即時刪除)。

  • 執行後更新索引。

檔案

  • retention.policy.json(輸入/輸出)

  • retention.index.json(輸出)


C. 介面元素(建議)

  • 主行為鍵:Generate Plan / Freeze Plan / Approve & Arm / Start Run / Pause / Rollback / Reconcile / Export

  • 安全開關Require Gate for External SendBlock PII without Masking

  • 視圖

    • Plan Gantt(步驟依賴圖)

    • Gate Queue(待批清單)

    • Run Timeline(成功/失敗/回滾點)

    • Evidence Explorer(按步驟瀏覽憑證)


D. 兩種模式的差異(用戶體驗)

  • 有 Actions 自動模式:步驟自動執行,要求用戶主要做「審批」與「例外決策」。

  • 零-API 手動模式:系統提供逐步 Run Sheet;用戶按指示在外部系統操作並上載憑證,然後標記完成。
    兩者共用相同檔名與審核/匯出流程,方便日後從手動逐步升級為自動。


E. 檔案清單總覽(按階段)

  • Intake:goal.intake.jsonsession.state.json

  • Tools/Policy:tool_catalog.jsonpolicy_pack.json

  • Plan:plan.v1.jsonrunbook.v1.mdgates.v1.json

  • Approval:approval.record.json

  • Execute:exec_log.ndjsonevidence.manifest.jsonstep_result_<stepId>_<ts>.jsonmanual_runsheet_<stepId>.mdrollback.plan.jsonincident.report.jsonrollback.exec_log.ndjson

  • Audit:audit.report.mdaudit.metrics.jsonresidual_risk register.json

  • Export/Archive:handoff.readme.mdexport_bundle_<projectId>_<date>.zipretention.policy.jsonretention.index.json


要落下一步,你可以叫我逐個檔名「輸出具體 Schema 或範例」,我會按你儀表板的 JS 結構(Card × 事件 × 儲存層)逐一生成。

 

可落地用 Schema+最小可行範例

一次過把全部檔名的「可落地用 Schema+最小可行範例」交齊(JSON 用 draft-07 風格;NDJSON 示範 2–3 行;Markdown 給可複製的模版)。你可以直接拎去喺 JS 儀表板串接。


goal.intake.json

JSON Schema

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "GoalIntake",
  "type": "object",
  "required": ["project_id", "title", "owner", "risk_level", "estimated_steps", "success_criteria"],
  "properties": {
    "project_id": {"type": "string"},
    "title": {"type": "string"},
    "description": {"type": "string"},
    "owner": {
      "type": "object",
      "required": ["id", "name"],
      "properties": {"id": {"type": "string"}, "name": {"type": "string"}, "email": {"type": "string", "format": "email"}}
    },
    "stakeholders": {"type": "array", "items": {"type": "string"}},
    "risk_level": {"type": "string", "enum": ["low", "medium", "high"]},
    "deadline": {"type": "string", "format": "date-time"},
    "estimated_steps": {"type": "integer", "minimum": 1},
    "run_mode_hint": {"type": "string", "enum": ["ENIAC", "IAS"]},
    "success_criteria": {"type": "array", "items": {"type": "string"}},
    "constraints": {"type": "array", "items": {"type": "string"}},
    "created_at": {"type": "string", "format": "date-time"}
  }
}

Example

{
  "project_id": "PRJ-2025-0827-001",
  "title": "每週自動彙總營銷報告",
  "description": "HubSpot → GSheet → Email 彙總",
  "owner": {"id": "u_001", "name": "Alex", "email": "alex@example.com"},
  "stakeholders": ["marketing", "sales"],
  "risk_level": "medium",
  "deadline": "2025-09-05T17:00:00Z",
  "estimated_steps": 12,
  "run_mode_hint": "ENIAC",
  "success_criteria": ["每週五 17:00 前寄出", "數據缺失率 < 1%"],
  "constraints": ["不得外泄 PII"],
  "created_at": "2025-08-27T10:00:00Z"
}

session.state.json

JSON Schema

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "SessionState",
  "type": "object",
  "required": ["project_id", "state", "run_mode", "versions"],
  "properties": {
    "project_id": {"type": "string"},
    "state": {"type": "string", "enum": ["INTAKE","PLAN_FREEZE","APPROVAL_PENDING","EXEC_RUNNING","PAUSED","ROLLBACK","COMPLETED","AUDITED","ARCHIVED"]},
    "run_mode": {"type": "string", "enum": ["ENIAC","IAS"]},
    "current_plan_version": {"type": "string"},
    "current_run_id": {"type": "string"},
    "versions": {
      "type": "object",
      "properties": {
        "plan": {"type": "array", "items": {"type": "string"}},
        "gates": {"type": "array", "items": {"type": "string"}}
      }
    },
    "timestamps": {
      "type": "object",
      "properties": {
        "created_at": {"type": "string", "format": "date-time"},
        "updated_at": {"type": "string", "format": "date-time"}
      }
    }
  }
}

Example

{
  "project_id": "PRJ-2025-0827-001",
  "state": "PLAN_FREEZE",
  "run_mode": "ENIAC",
  "current_plan_version": "v1",
  "current_run_id": null,
  "versions": {"plan": ["v1"], "gates": ["v1"]},
  "timestamps": {"created_at": "2025-08-27T10:05:00Z", "updated_at": "2025-08-27T10:20:00Z"}
}

tool_catalog.json

JSON Schema(工具登記表)

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "ToolCatalog",
  "type": "object",
  "required": ["tools"],
  "properties": {
    "tools": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["id","name","operations","risk","availability"],
        "properties": {
          "id": {"type": "string"},
          "name": {"type": "string"},
          "description": {"type": "string"},
          "availability": {"type": "string", "enum": ["online","degraded","offline"]},
          "risk": {"type": "string", "enum": ["low","medium","high"]},
          "ratelimit_per_min": {"type": "integer"},
          "auth": {"type": "string", "enum": ["none","oauth2","apikey"]},
          "base_url": {"type": "string"},
          "operations": {
            "type": "array",
            "items": {
              "type": "object",
              "required": ["op","summary","params_schema"],
              "properties": {
                "op": {"type": "string"},
                "summary": {"type": "string"},
                "method": {"type": "string", "enum": ["GET","POST","PUT","DELETE"]},
                "endpoint": {"type": "string"},
                "params_schema": {"type": "object"},
                "returns_schema": {"type": "object"}
              }
            }
          }
        }
      }
    },
    "generated_at": {"type": "string", "format": "date-time"}
  }
}

Example(摘錄)

{
  "tools": [
    {
      "id": "gsheet",
      "name": "Google Sheets",
      "description": "新增/讀寫試算表",
      "availability": "online",
      "risk": "medium",
      "ratelimit_per_min": 60,
      "auth": "oauth2",
      "base_url": "https://sheets.googleapis.com",
      "operations": [
        {
          "op": "appendRows",
          "summary": "追加多行數據",
          "method": "POST",
          "endpoint": "/v4/spreadsheets/{id}/values/{range}:append",
          "params_schema": {"type":"object","properties":{"id":{"type":"string"},"range":{"type":"string"},"values":{"type":"array"}}},
          "returns_schema": {"type":"object"}
        }
      ]
    }
  ],
  "generated_at": "2025-08-27T10:10:00Z"
}

policy_pack.json

JSON Schema(合規包與關卡)

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "PolicyPack",
  "type": "object",
  "required": ["name","version","rules","gates"],
  "properties": {
    "name": {"type": "string"},
    "version": {"type": "string"},
    "pii_tags": {"type": "array", "items": {"type": "string"}},
    "rules": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["id","description","match","action"],
        "properties": {
          "id": {"type": "string"},
          "description": {"type":"string"},
          "match": {"type":"object"}, 
          "action": {"type":"string","enum":["block","mask","allow","gate"]}
        }
      }
    },
    "gates": {
      "type": "array",
      "items": {
        "type": "object",
        "required":["id","trigger","approvers"],
        "properties": {
          "id":{"type":"string"},
          "name":{"type":"string"},
          "trigger":{"type":"string"}, 
          "approvers":{"type":"array","items":{"type":"string"}},
          "sla_minutes":{"type":"integer"}
        }
      }
    }
  }
}

Example(摘錄)

{
  "name": "Default SME Pack",
  "version": "2025.08",
  "pii_tags": ["email","phone","name"],
  "rules": [
    {"id":"R1","description":"外發含PII必遮罩","match":{"contains_pii":true,"direction":"outbound"},"action":"gate"}
  ],
  "gates": [
    {"id":"G_EMAIL","name":"外發電郵審批","trigger":"send_email","approvers":["u_sec","u_owner"],"sla_minutes":60}
  ]
}

plan.v1.json

JSON Schema(計劃本體)

{
  "$schema":"http://json-schema.org/draft-07/schema#",
  "title":"Plan",
  "type":"object",
  "required":["project_id","version","run_mode","steps","plan_signature"],
  "properties":{
    "project_id":{"type":"string"},
    "version":{"type":"string"},
    "run_mode":{"type":"string","enum":["ENIAC","IAS"]},
    "assumptions":{"type":"array","items":{"type":"string"}},
    "dependencies":{"type":"array","items":{"type":"string"}},
    "steps":{
      "type":"array",
      "items":{
        "type":"object",
        "required":["id","name","intent","tool_or_manual","success_criteria"],
        "properties":{
          "id":{"type":"string"},
          "name":{"type":"string"},
          "intent":{"type":"string"},
          "depends_on":{"type":"array","items":{"type":"string"}},
          "tool_or_manual":{"type":"string","enum":["tool","manual"]},
          "tool":{"type":"object","properties":{"id":{"type":"string"},"op":{"type":"string"},"params":{"type":"object"}}},
          "manual_instructions":{"type":"string"},
          "inputs":{"type":"array","items":{"type":"string"}},
          "outputs":{"type":"array","items":{"type":"string"}},
          "success_criteria":{"type":"array","items":{"type":"string"}},
          "rollback":{"type":"string"},
          "evidence_hooks":{"type":"array","items":{"type":"string"}},
          "gate_ids":{"type":"array","items":{"type":"string"}}
        }
      }
    },
    "plan_signature":{"type":"string"}
  }
}

Example(摘錄)

{
  "project_id": "PRJ-2025-0827-001",
  "version": "v1",
  "run_mode": "ENIAC",
  "assumptions": ["API 憑證有效", "GSheet 已存在"],
  "steps": [
    {
      "id":"S1","name":"提取HubSpot",
      "intent":"抓取本週潛在客戶",
      "tool_or_manual":"tool",
      "tool":{"id":"hubspot","op":"getDeals","params":{"since":"2025-08-18"}},
      "success_criteria":["返回筆數>0","HTTP 200"],
      "rollback":"不需要",
      "evidence_hooks":["artifact:hubspot_deals.json"]
    }
  ],
  "plan_signature": "sha256:2b8c..."
}

runbook.v1.md

Template

# Runbook v1 — {{project_id}}
- Run Mode: {{run_mode}}  | Plan Version: {{version}}  | Owner: {{owner_name}}

## 概覽
目標:{{title}}
成功標準:
- {{success_1}}
- {{success_2}}

## 步驟列表
{{#each steps}}
### [{{id}}] {{name}}
意圖:{{intent}}
依賴:{{depends_on}}
執行方式:{{tool_or_manual}}
- 工具:{{tool.id}} :: {{tool.op}}(如適用)
- 參數要點:{{tool.params}}
- 手動指引(如適用):
  {{manual_instructions}}

成功標準:
- {{#each success_criteria}}- {{this}}{{/each}}

回滾:
- {{rollback}}

需要憑證:
- {{#each evidence_hooks}}- {{this}}{{/each}}

需要審批 Gate:
- {{gate_ids}}

---
{{/each}}

gates.v1.json

JSON Schema

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title":"Gates",
  "type":"object",
  "required":["project_id","version","items"],
  "properties":{
    "project_id":{"type":"string"},
    "version":{"type":"string"},
    "items":{
      "type":"array",
      "items":{
        "type":"object",
        "required":["id","name","applies_to_steps","approvers"],
        "properties":{
          "id":{"type":"string"},
          "name":{"type":"string"},
          "applies_to_steps":{"type":"array","items":{"type":"string"}},
          "approvers":{"type":"array","items":{"type":"string"}},
          "policy_ref":{"type":"string"}
        }
      }
    }
  }
}

Example

{
  "project_id":"PRJ-2025-0827-001",
  "version":"v1",
  "items":[
    {"id":"G_EMAIL","name":"外發電郵審批","applies_to_steps":["S4"],"approvers":["u_sec","u_owner"],"policy_ref":"R1"}
  ]
}

approval.record.json

JSON Schema

{
  "$schema":"http://json-schema.org/draft-07/schema#",
  "title":"ApprovalRecord",
  "type":"object",
  "required":["project_id","plan_version","decision","decider","decided_at"],
  "properties":{
    "project_id":{"type":"string"},
    "plan_version":{"type":"string"},
    "gate_id":{"type":"string"},
    "decision":{"type":"string","enum":["approved","rejected"]},
    "notes":{"type":"string"},
    "decider":{"type":"object","required":["id","name"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"email":{"type":"string","format":"email"}}},
    "decided_at":{"type":"string","format":"date-time"}
  }
}

Example

{"project_id":"PRJ-2025-0827-001","plan_version":"v1","gate_id":null,"decision":"approved","notes":"OK","decider":{"id":"u_sec","name":"Security Lead","email":"sec@example.com"},"decided_at":"2025-08-27T11:00:00Z"}

exec_log.ndjson

Line Schema(每行)

{
  "type":"object",
  "required":["ts","project_id","run_id","step_id","phase","event","status"],
  "properties":{
    "ts":{"type":"string","format":"date-time"},
    "project_id":{"type":"string"},
    "run_id":{"type":"string"},
    "step_id":{"type":"string"},
    "phase":{"type":"string","enum":["PRE","ACT","POST","CHECK"]},
    "level":{"type":"string","enum":["info","warn","error"]},
    "event":{"type":"string"},
    "status":{"type":"string","enum":["ok","fail","skipped"]},
    "metrics":{"type":"object"},
    "evidence":{"type":"array","items":{"type":"string"}},
    "error":{"type":"object"}
  }
}

Example(3 行)

{"ts":"2025-08-27T11:10:00Z","project_id":"PRJ-2025-0827-001","run_id":"RUN-001","step_id":"S1","phase":"PRE","level":"info","event":"validate-params","status":"ok"}
{"ts":"2025-08-27T11:10:02Z","project_id":"PRJ-2025-0827-001","run_id":"RUN-001","step_id":"S1","phase":"ACT","level":"info","event":"hubspot.getDeals","status":"ok","metrics":{"count":128}}
{"ts":"2025-08-27T11:10:04Z","project_id":"PRJ-2025-0827-001","run_id":"RUN-001","step_id":"S1","phase":"CHECK","level":"info","event":"criteria","status":"ok","evidence":["artifact:hubspot_deals.json"]}

evidence.manifest.json

JSON Schema

{
  "$schema":"http://json-schema.org/draft-07/schema#",
  "title":"EvidenceManifest",
  "type":"object",
  "required":["project_id","run_id","items"],
  "properties":{
    "project_id":{"type":"string"},
    "run_id":{"type":"string"},
    "items":{
      "type":"array",
      "items":{
        "type":"object",
        "required":["id","type","path","sha256"],
        "properties":{
          "id":{"type":"string"},
          "type":{"type":"string","enum":["json","csv","pdf","png","txt","html","other"]},
          "path":{"type":"string"},
          "sha256":{"type":"string"},
          "size_bytes":{"type":"integer"},
          "created_at":{"type":"string","format":"date-time"},
          "related_step":{"type":"string"}
        }
      }
    }
  }
}

Example

{"project_id":"PRJ-2025-0827-001","run_id":"RUN-001","items":[{"id":"artifact:hubspot_deals.json","type":"json","path":"artifacts/2025-08-27/hubspot_deals.json","sha256":"6f1...","size_bytes":43210,"created_at":"2025-08-27T11:10:03Z","related_step":"S1"}]}

step_result__.json

JSON Schema

{
  "$schema":"http://json-schema.org/draft-07/schema#",
  "title":"StepResult",
  "type":"object",
  "required":["project_id","run_id","step_id","status","input_snapshot","output_snapshot","check"],
  "properties":{
    "project_id":{"type":"string"},
    "run_id":{"type":"string"},
    "step_id":{"type":"string"},
    "status":{"type":"string","enum":["ok","fail","skipped"]},
    "input_snapshot":{"type":"object"},
    "output_snapshot":{"type":"object"},
    "check":{"type":"object","properties":{"passed":{"type":"boolean"},"violations":{"type":"array","items":{"type":"string"}}}}
  }
}

Example

{"project_id":"PRJ-2025-0827-001","run_id":"RUN-001","step_id":"S2","status":"ok","input_snapshot":{"sheetId":"1Abc.."},"output_snapshot":{"appended":56},"check":{"passed":true,"violations":[]}}

manual_runsheet_.md

Template

# 手動 Run Sheet — Step {{step_id}}: {{name}}

## 目標
{{intent}}

## 前置需求
- 帳號/權限:{{accounts}}
- 輸入資料:{{inputs}}

## 操作步驟
1. 登入 {{system}}
2. 前往 {{path}}
3. 執行:{{action}}(參數:{{params}})
4. 下載/截圖:{{evidence_list}}

## 成功判據
- {{criterion_1}}
- {{criterion_2}}

## 上載憑證
- 檔名建議:{{suggested_filenames}}

rollback.plan.json

JSON Schema

{
  "$schema":"http://json-schema.org/draft-07/schema#",
  "title":"RollbackPlan",
  "type":"object",
  "required":["project_id","run_id","strategy","steps"],
  "properties":{
    "project_id":{"type":"string"},
    "run_id":{"type":"string"},
    "strategy":{"type":"string","enum":["auto","manual","mixed"]},
    "reason":{"type":"string"},
    "steps":{"type":"array","items":{
      "type":"object",
      "required":["id","name","action"],
      "properties":{
        "id":{"type":"string"},
        "name":{"type":"string"},
        "action":{"type":"string"},
        "depends_on":{"type":"array","items":{"type":"string"}},
        "evidence_hooks":{"type":"array","items":{"type":"string"}}
      }
    }}
  }
}

Example

{"project_id":"PRJ-2025-0827-001","run_id":"RUN-001","strategy":"mixed","reason":"S3 失敗需回滾 S2 寫入","steps":[{"id":"RB1","name":"刪除剛追加的行","action":"gsheet.deleteRows(range='A200:A255')","depends_on":[],"evidence_hooks":["artifact:gsheet_delete_receipt.json"]}]}

incident.report.json

JSON Schema

{
  "$schema":"http://json-schema.org/draft-07/schema#",
  "title":"IncidentReport",
  "type":"object",
  "required":["project_id","run_id","step_id","severity","summary","timeline"],
  "properties":{
    "project_id":{"type":"string"},
    "run_id":{"type":"string"},
    "step_id":{"type":"string"},
    "severity":{"type":"string","enum":["low","medium","high","critical"]},
    "summary":{"type":"string"},
    "root_cause":{"type":"string"},
    "impact":{"type":"string"},
    "resolution":{"type":"string"},
    "timeline":{"type":"array","items":{"type":"object","properties":{"ts":{"type":"string","format":"date-time"},"event":{"type":"string"}}}}
  }
}

Example

{"project_id":"PRJ-2025-0827-001","run_id":"RUN-001","step_id":"S3","severity":"high","summary":"API 429","root_cause":"超出速率限制","impact":"報告延遲","resolution":"延後重試+提高退避","timeline":[{"ts":"2025-08-27T11:20:00Z","event":"429 returned"}]}

rollback.exec_log.ndjson

exec_log.ndjson 同 Schema(額外欄位 rollback:true
Example(2 行)

{"ts":"2025-08-27T11:25:00Z","project_id":"PRJ-2025-0827-001","run_id":"RUN-001","step_id":"RB1","phase":"ACT","level":"info","event":"gsheet.deleteRows","status":"ok","rollback":true}
{"ts":"2025-08-27T11:25:03Z","project_id":"PRJ-2025-0827-001","run_id":"RUN-001","step_id":"RB1","phase":"CHECK","level":"info","event":"criteria","status":"ok","rollback":true}

audit.report.md

Template

# 審核報告 — {{project_id}} / Plan {{plan_version}} / Run {{run_id}}

## 摘要
- 完成狀態:{{status}}(成功步數 {{ok_steps}} / 總步數 {{total_steps}})
- 置信度:{{confidence}} 
- 主要風險殘留:{{residual_count}} 項

## 對賬結果(PLAN vs EXEC)
- 缺口步驟:{{gaps}}
- 額外步驟:{{extras}}
- 憑證覆蓋率:{{evidence_coverage}}%

## 合規檢查
- 命中規則:{{rules_hit}}
- Gate 紀錄:{{gates_summary}}

## 建議
- {{recommendation_1}}
- {{recommendation_2}}

audit.metrics.json

JSON Schema

{
  "$schema":"http://json-schema.org/draft-07/schema#",
  "title":"AuditMetrics",
  "type":"object",
  "required":["project_id","run_id","plan_version","metrics","flags"],
  "properties":{
    "project_id":{"type":"string"},
    "run_id":{"type":"string"},
    "plan_version":{"type":"string"},
    "metrics":{
      "type":"object",
      "properties":{
        "steps_total":{"type":"integer"},
        "steps_ok":{"type":"integer"},
        "steps_fail":{"type":"integer"},
        "duration_seconds":{"type":"number"},
        "evidence_coverage":{"type":"number"},
        "policy_hits":{"type":"integer"}
      }
    },
    "flags":{
      "type":"object",
      "properties":{
        "geometry_ok":{"type":"boolean"},
        "stability_ok":{"type":"boolean"},
        "integration_ok":{"type":"boolean"},
        "confidence":{"type":"number","minimum":0,"maximum":1}
      }
    }
  }
}

Example

{"project_id":"PRJ-2025-0827-001","run_id":"RUN-001","plan_version":"v1","metrics":{"steps_total":12,"steps_ok":11,"steps_fail":1,"duration_seconds":684,"evidence_coverage":0.92,"policy_hits":1},"flags":{"geometry_ok":true,"stability_ok":true,"integration_ok":true,"confidence":0.88}}

residual_risk register.json

JSON Schema(風險登記冊)

{
  "$schema":"http://json-schema.org/draft-07/schema#",
  "title":"ResidualRiskRegister",
  "type":"object",
  "required":["project_id","items"],
  "properties":{
    "project_id":{"type":"string"},
    "items":{"type":"array","items":{
      "type":"object",
      "required":["id","title","severity","owner","mitigation"],
      "properties":{
        "id":{"type":"string"},
        "title":{"type":"string"},
        "severity":{"type":"string","enum":["low","medium","high"]},
        "owner":{"type":"string"},
        "mitigation":{"type":"string"},
        "due_date":{"type":"string","format":"date"},
        "status":{"type":"string","enum":["open","in_progress","closed"]}
      }
    }}
  }
}

Example

{"project_id":"PRJ-2025-0827-001","items":[{"id":"RR-01","title":"外部API 速率限制","severity":"medium","owner":"SRE","mitigation":"加退避與快取","due_date":"2025-09-10","status":"in_progress"}]}

handoff.readme.md

Template

# Handoff 導覽 — {{project_id}}
此包包含:計劃、執行日誌、憑證、審核報告與保留策略。

## 檔案地圖
- goal.intake.json
- session.state.json
- plan.{{plan_version}}.json
- runbook.{{plan_version}}.md
- gates.{{plan_version}}.json
- exec_log.ndjson
- evidence.manifest.json
- audit.report.md
- audit.metrics.json
- residual_risk register.json
- retention.policy.json
- retention.index.json
- artifacts/(附件與憑證)

## 使用方法
1) 先讀 runbook,配合 exec_log 對賬。
2) 憑證清單見 evidence.manifest.json。
3) 合規與保留見 retention.*.json。

export_bundle__.zip

內容說明

  • 以專案根為目錄,包含上述所有檔案+artifacts/(原始憑證)。

  • 建議在 zip 根目錄附 handoff.readme.md(已提供模版)。

retention.policy.json

JSON Schema

{
  "$schema":"http://json-schema.org/draft-07/schema#",
  "title":"RetentionPolicy",
  "type":"object",
  "required":["project_id","defaults","overrides"],
  "properties":{
    "project_id":{"type":"string"},
    "defaults":{"type":"object","properties":{
      "keep_days":{"type":"integer"},
      "action":{"type":"string","enum":["retain","anonymize","delete"]}
    }},
    "overrides":{"type":"array","items":{
      "type":"object",
      "required":["pattern","action"],
      "properties":{
        "pattern":{"type":"string"},
        "action":{"type":"string","enum":["retain","anonymize","delete"]},
        "keep_days":{"type":"integer"}
      }
    }}
  }
}

Example

{"project_id":"PRJ-2025-0827-001","defaults":{"keep_days":365,"action":"retain"},"overrides":[{"pattern":"artifacts/*.png","action":"anonymize","keep_days":90},{"pattern":"exec_log.ndjson","action":"retain","keep_days":730}]}

retention.index.json

JSON Schema

{
  "$schema":"http://json-schema.org/draft-07/schema#",
  "title":"RetentionIndex",
  "type":"object",
  "required":["project_id","entries","updated_at"],
  "properties":{
    "project_id":{"type":"string"},
    "entries":{"type":"array","items":{
      "type":"object",
      "required":["path","action","status"],
      "properties":{
        "path":{"type":"string"},
        "action":{"type":"string","enum":["retain","anonymize","delete"]},
        "status":{"type":"string","enum":["scheduled","done","failed"]},
        "next_run_at":{"type":"string","format":"date-time"}
      }
    }},
    "updated_at":{"type":"string","format":"date-time"}
  }
}

Example

{"project_id":"PRJ-2025-0827-001","entries":[{"path":"artifacts/2025-08-27/hubspot_deals.json","action":"retain","status":"done"},{"path":"artifacts/2025-08-27/screenshot.png","action":"anonymize","status":"scheduled","next_run_at":"2025-09-01T00:00:00Z"}],"updated_at":"2025-08-27T12:00:00Z"}

如果你想要,我可以逐個把 Schema 轉成 TypeScript 型別(方便你在儀表板用 zod/ajv 驗證),或者先挑幾個檔案輸出更完整的「多步範例」。

 

 

 


 

 © 2025 Danny Yeung. All rights reserved. 版权所有 不得转载

 

Disclaimer

This book is the product of a collaboration between the author and OpenAI's GPT-5 language model. While every effort has been made to ensure accuracy, clarity, and insight, the content is generated with the assistance of artificial intelligence and may contain factual, interpretive, or mathematical errors. Readers are encouraged to approach the ideas with critical thinking and to consult primary scientific literature where appropriate.

This work is speculative, interdisciplinary, and exploratory in nature. It bridges metaphysics, physics, and organizational theory to propose a novel conceptual framework—not a definitive scientific theory. As such, it invites dialogue, challenge, and refinement.


I am merely a midwife of knowledge.

 

没有评论:

发表评论