AI 用法手册English

端到端流水线:一个小型内购功能从方案、双代理评审到云端构建

状态
已发布
规格版本
0.1.0
设计成熟度
draft
更新时间
2026-11-23
来源提交
51a5939868
对应配方
端到端流水线:一个小型内购功能从方案、双代理评审到云端构建

导出到你的 Agent

路径: e2e-tip-iap-ship-pipeline-spec/SKILL.md

预览
---
name: e2e-tip-iap-ship-pipeline-spec
description: "端到端流水线:一个小型内购功能从方案、双代理评审到云端构建的流水线设计规格(不可执行)。用户要按此设计搭建或评审流水线时使用。"
metadata:
  kind: "pipeline-design"
  status: "published"
  version: "0.1.0"
  source-commit: "5f7272be13826bec473d6f2e073c82a5a620f1d2"
---

# 端到端流水线:一个小型内购功能从方案、双代理评审到云端构建 — 流水线设计

- execution: prohibited
- 发布状态: published
- 规格版本: 0.1.0
- 设计成熟度: draft
- 来源提交: 5f7272be13826bec473d6f2e073c82a5a620f1d2

> 设计稿,未经运行验证,不可直接执行。仅在用户要求时参照;任何花钱、外发、合并发布或删除都要先问人。

## 目标

For a solo iOS developer: turn "add a voluntary tip" into a reviewed, compiling feature branch with every gate recorded, without submitting to the store.

## 阶段

- id: intake_decisions; kind: human; purpose: Owner states scope decisions: one voluntary tip tier, no feature unlock, iOS-native StoreKit 2 only, App Store Connect handled by the owner; gate: g_scope
- id: plan_write; kind: model; purpose: Writer agent drafts PLAN.md + TASKS.md (scope, prohibitions, test matrix, App Store Connect steps) and self-reviews; depends_on: intake_decisions; model: claude-sonnet-5-5 (example writer; Anthropic region restriction - not supported in mainland China/Hong Kong/Macau since 2026-11-12, verified 2026-11-23); gate: g_plan_checks
- id: plan_checks; kind: code; purpose: Static doc checks: whitespace diff check, every cited file path exists, store copy within length limit; depends_on: plan_write; gate: g_plan_checks
- id: plan_review; kind: model; purpose: Independent read-only review of the plan; verdict APPROVE or CHANGES with blocker/major/minor; max 3 rounds; depends_on: plan_checks; model: Codex CLI 0.171.0 (example reviewer; read-only); gate: g_plan_review
- id: plan_approval; kind: human; purpose: Owner reads the plan and approves or rejects; open decisions are answered here; depends_on: plan_review; gate: g_plan_human
- id: code_write; kind: model; purpose: Writer agent implements in the feature branch with tests; self-review before handoff; depends_on: plan_approval; model: claude-sonnet-5-5 (example writer; Anthropic region restriction - not supported in mainland China/Hong Kong/Macau since 2026-11-12, verified 2026-11-23); gate: g_code_tests
- id: code_checks; kind: code; purpose: Run analyzer, unit tests and project checks locally; record exit codes; depends_on: code_write; gate: g_code_tests
- id: code_review; kind: model; purpose: Independent read-only code review, max 3 rounds; every code change after approval re-enters review; depends_on: code_checks; model: Codex CLI 0.171.0 (example reviewer; read-only); gate: g_code_review
- id: push_and_cloud_build; kind: human; purpose: Owner authorizes pushing the feature branch (never main), then manually starts the macOS CI simulator build; monitor reports the result read-only; depends_on: code_review; gate: g_cloud_compile
- id: diff_signoff; kind: human; purpose: Owner reads the diff and decides merge; sandbox purchase test and store submission are separate later decisions; depends_on: push_and_cloud_build; gate: g_human_diff

## 闸门

- id: g_scope; type: human; check: Decisions D1..Dn written and answered before planning; pass_condition: every open decision has an owner answer; on_fail: block_and_review
- id: g_plan_checks; type: deterministic; check: diff --check clean; cited paths exist; store copy length within limit; pass_condition: all checks exit 0; on_fail: block_and_review
- id: g_plan_review; type: reviewer; check: independent read-only plan review; pass_condition: verdict APPROVE with 0 blocker and 0 major within <=3 rounds; on_fail: block_and_review
- id: g_plan_human; type: human; check: owner approves the plan; pass_condition: approval flag set with date; on_fail: block_and_review
- id: g_code_tests; type: deterministic; check: analyzer and unit tests; native tests that cannot run locally are marked BLOCKED_ENV, never PASS; pass_condition: analyzer exit 0 and tests exit 0; BLOCKED_ENV listed explicitly; on_fail: block_and_review
- id: g_code_review; type: reviewer; check: independent read-only code review; pass_condition: APPROVE with 0 blocker and 0 major within <=3 rounds; post-approval edits re-reviewed; on_fail: block_and_review
- id: g_cloud_compile; type: deterministic; check: native code compiles on the macOS CI simulator build; pass_condition: the native compile step succeeded for the exact reviewed commit; a failed, skipped or missing required step (including non-fatal steps that look green) blocks, not 'explained'; on_fail: block_and_review
- id: g_human_diff; type: human; check: owner reads the diff; pass_condition: merge or reject recorded; on_fail: block_and_review

## 人审点

- before_stage: plan_write; action: paid or external model call for this stage (writer, reviewer or fallback); bound to endpoint, payload class and a spend cap derived from budget.per_run; a different provider or model needs a new approval; approver: owner
- before_stage: plan_review; action: paid or external model call for this stage (writer, reviewer or fallback); bound to endpoint, payload class and a spend cap derived from budget.per_run; a different provider or model needs a new approval; approver: owner
- before_stage: code_write; action: paid or external model call for this stage (writer, reviewer or fallback); bound to endpoint, payload class and a spend cap derived from budget.per_run; a different provider or model needs a new approval; approver: owner
- before_stage: code_review; action: paid or external model call for this stage (writer, reviewer or fallback); bound to endpoint, payload class and a spend cap derived from budget.per_run; a different provider or model needs a new approval; approver: owner
- before_stage: push_and_cloud_build; action: push feature branch to remote (not main); start simulator workflow on that commit; approver: owner
- before_stage: diff_signoff; action: merge decision after reading diff; approver: owner

## 禁止事项

- Claude (Anthropic) region restriction / Claude 地区限制 - Anthropic does not support mainland China / Hong Kong / Macau since 2026-11-12 (不支持中国大陆、香港、澳门), verified 2026-11-23, see https://www.anthropic.com/legal/supported-regions
- 无凭据、私有数据或真实发送地址 / No credentials, private data or actual sending addresses
- 未获人审不得花钱、外发、合并发布或删除 / No spending, external sends, merge/release or deletion without human review
- Not for payment code: do not use the lowest-trust reviewer (Grok) as the only reviewer
- Never push main; never start the TestFlight/upload workflow without a fresh approval

## 预算

- per_run: 25
- per_month: 60
- max_tokens_per_run: 3000000
- max_wall_seconds_per_run: 172800
- on_exceed: pause_and_notify

## 完整规格 (YAML)

```yaml
# 填好的流水线规格(设计文档,不可运行)/ Filled pipeline spec (design only, not executable).
# 模板 / template: ../templates/pipeline.yaml  ·  配方 / recipe: ../../recipes/coding-agents/e2e-tip-iap-ship-pipeline.md
# 所有数值为估算或合成,见 cost_roi.evidence。/ All numbers are estimates or synthetic; see cost_roi.evidence.
schema_version: 0.1.0
document_kind: pipeline_design
execution: prohibited
status: draft
pipeline: 'Ship a small in-app purchase feature: plan -> dual review -> code -> cloud build'
owner: solo developer (owner) + coordinator agent
version: 0.1.0
goal: 'For a solo iOS developer: turn "add a voluntary tip" into a reviewed, compiling feature branch with every
  gate recorded, without submitting to the store.'
audience:
- developers
trigger:
  kind: manual
  description: Owner asks the coordinator to start a feature; later gates need the owner
  timezone: America/Los_Angeles
runs_per_month: 2
inputs:
- id: in_requirement
  source: owner request + repo working tree
  format: text/markdown
  schema_ref: scope decisions D1..Dn; no secrets
  examples:
  - stl2stp tip feature (2026-11-22..23, internal task folder, redacted)
output:
  format: git feature branch + review records
  schema_ref: branch diff; HANDOFF_VERDICT.md per round; CI build record
  destination: remote feature branch (not main), owner decides merge
  acceptance:
  - g_plan_checks
  - g_plan_review
  - g_plan_human
  - g_code_tests
  - g_code_review
  - g_cloud_compile
  - g_human_diff
pattern: workflow:evaluator
pattern_reason: Steps are known and sequential; the quality comes from an independent read-only evaluator per phase.
  A single prompt cannot compile Swift; a free-running multi-agent adds cost and ordering problems for code (single
  writer + read-only reviewer is this repo method's own recommendation).
stages:
- id: intake_decisions
  kind: human
  purpose: 'Owner states scope decisions: one voluntary tip tier, no feature unlock, iOS-native StoreKit 2 only,
    App Store Connect handled by the owner'
  depends_on: []
  input_refs:
  - in_requirement
  input_format: free text + examples of what is NOT wanted
  output_format: numbered decisions D1..Dn in the plan folder
  model: null
  tool_ref: null
  fallback:
    models: []
    when: not a model stage
    on_exhausted: pause_for_human
    recheck_gates: true
  est_tokens:
    in: null
    out: null
  cacheable_prefix: null
  batchable: null
  gate:
  - g_scope
  side_effects:
  - none
  cost: {}
- id: plan_write
  kind: model
  purpose: Writer agent drafts PLAN.md + TASKS.md (scope, prohibitions, test matrix, App Store Connect steps) and
    self-reviews
  depends_on:
  - intake_decisions
  input_refs:
  - intake_decisions
  - in_requirement
  input_format: decisions + repo facts read from the working tree
  output_format: PLAN.md, TASKS.md, STATE.md (markdown)
  model: claude-sonnet-5-5 (example writer; Anthropic region restriction - not supported in mainland China/Hong Kong/Macau since 2026-11-12, verified 2026-11-23)
  tool_ref: null
  fallback:
    models:
    - Codex CLI 0.171.0
    when: writer quota exhausted
    on_exhausted: pause_for_human
    recheck_gates: true
  est_tokens:
    in: 120000
    out: 30000
  cacheable_prefix: stable repo/process docs
  batchable: false
  gate:
  - g_plan_checks
  side_effects:
  - writes documents in a feature worktree only
  cost:
    expected_calls_per_run: 2
    in_price_per_mtok: 2.0
    out_price_per_mtok: 10.0
    price_source_url: https://platform.claude.com/docs/en/about-claude/pricing
    price_checked_on: null
    cacheable_prefix_tokens: 80000
    cache_hit_rate: 0.5
    cache_read_multiplier: 0.1
    cache_write_tokens: null
    cache_write_price: null
    batch_adopted: false
    batch_factor: 1
    off_peak_eligible: null
    off_peak_adopted: false
    off_peak_factor: 1
    discount_source: null
    retry_rate: 0.2
    included_in_existing_plan: true
- id: plan_checks
  kind: code
  purpose: 'Static doc checks: whitespace diff check, every cited file path exists, store copy within length limit'
  depends_on:
  - plan_write
  input_refs:
  - plan_write
  - in_requirement
  input_format: plan documents + repository paths cited (working tree)
  output_format: pass/fail list
  model: null
  tool_ref: 'git + shell script (versions: 未记录)'
  fallback:
    models: []
    when: not a model stage
    on_exhausted: pause_for_human
    recheck_gates: true
  est_tokens:
    in: null
    out: null
  cacheable_prefix: null
  batchable: null
  gate:
  - g_plan_checks
  side_effects:
  - none
  cost: {}
- id: plan_review
  kind: model
  purpose: Independent read-only review of the plan; verdict APPROVE or CHANGES with blocker/major/minor; max 3
    rounds
  depends_on:
  - plan_checks
  input_refs:
  - plan_write
  - plan_checks
  input_format: plan documents (plan_write) + check results (plan_checks) + diff identity
  output_format: HANDOFF_VERDICT.md
  model: Codex CLI 0.171.0 (example reviewer; read-only)
  tool_ref: null
  fallback:
    models: &id001
    - independent Claude session claude-sonnet-5-5 (not the writer session)
    - Grok (NOT for payment/IAP changes)
    when: reviewer quota exhausted (Codex was at 0 on 2026-11-23)
    on_exhausted: pause_for_human
    recheck_gates: true
  est_tokens:
    in: 90000
    out: 8000
  cacheable_prefix: plan documents
  batchable: false
  gate:
  - g_plan_review
  side_effects:
  - none (read-only)
  cost:
    expected_calls_per_run: 2
    in_price_per_mtok: 2.0
    out_price_per_mtok: 10.0
    price_source_url: https://platform.claude.com/docs/en/about-claude/pricing
    price_checked_on: null
    cacheable_prefix_tokens: 60000
    cache_hit_rate: 0.5
    cache_read_multiplier: 0.1
    cache_write_tokens: null
    cache_write_price: null
    batch_adopted: false
    batch_factor: 1
    off_peak_eligible: null
    off_peak_adopted: false
    off_peak_factor: 1
    discount_source: null
    retry_rate: 0.2
    included_in_existing_plan: true
- id: plan_approval
  kind: human
  purpose: Owner reads the plan and approves or rejects; open decisions are answered here
  depends_on:
  - plan_review
  input_refs:
  - plan_write
  - plan_review
  input_format: plan (plan_write) + verdict (plan_review)
  output_format: approval flag in STATE.md (role, date)
  model: null
  tool_ref: null
  fallback:
    models: []
    when: not a model stage
    on_exhausted: pause_for_human
    recheck_gates: true
  est_tokens:
    in: null
    out: null
  cacheable_prefix: null
  batchable: null
  gate:
  - g_plan_human
  side_effects:
  - none
  cost: {}
- id: code_write
  kind: model
  purpose: Writer agent implements in the feature branch with tests; self-review before handoff
  depends_on:
  - plan_approval
  input_refs:
  - plan_approval
  - plan_write
  - in_requirement
  input_format: approval flag (plan_approval) + approved plan documents (plan_write)
  output_format: code diff + tests
  model: claude-sonnet-5-5 (example writer; Anthropic region restriction - not supported in mainland China/Hong Kong/Macau since 2026-11-12, verified 2026-11-23)
  tool_ref: null
  fallback:
    models:
    - Codex CLI 0.171.0
    when: writer quota exhausted
    on_exhausted: pause_for_human
    recheck_gates: true
  est_tokens:
    in: 1500000
    out: 100000
  cacheable_prefix: repo context + plan
  batchable: false
  gate:
  - g_code_tests
  side_effects:
  - commits on a local feature branch
  cost:
    expected_calls_per_run: 1
    in_price_per_mtok: 2.0
    out_price_per_mtok: 10.0
    price_source_url: https://platform.claude.com/docs/en/about-claude/pricing
    price_checked_on: null
    cacheable_prefix_tokens: 1200000
    cache_hit_rate: 0.8
    cache_read_multiplier: 0.1
    cache_write_tokens: null
    cache_write_price: null
    batch_adopted: false
    batch_factor: 1
    off_peak_eligible: null
    off_peak_adopted: false
    off_peak_factor: 1
    discount_source: null
    retry_rate: 0.2
    included_in_existing_plan: true
- id: code_checks
  kind: code
  purpose: Run analyzer, unit tests and project checks locally; record exit codes
  depends_on:
  - code_write
  input_refs:
  - code_write
  input_format: working tree
  output_format: logs with exit codes
  model: null
  tool_ref: 'flutter analyze / flutter test / python checks (versions: 见 CI 文档)'
  fallback:
    models: []
    when: not a model stage
    on_exhausted: pause_for_human
    recheck_gates: true
  est_tokens:
    in: null
    out: null
  cacheable_prefix: null
  batchable: null
  gate:
  - g_code_tests
  side_effects:
  - none
  cost: {}
- id: code_review
  kind: model
  purpose: Independent read-only code review, max 3 rounds; every code change after approval re-enters review
  depends_on:
  - code_checks
  input_refs:
  - code_write
  - code_checks
  input_format: diff (code_write) + test logs with exit codes (code_checks)
  output_format: HANDOFF_VERDICT.md
  model: Codex CLI 0.171.0 (example reviewer; read-only)
  tool_ref: null
  fallback:
    models: *id001
    when: reviewer quota exhausted
    on_exhausted: pause_for_human
    recheck_gates: true
  est_tokens:
    in: 150000
    out: 8000
  cacheable_prefix: diff + plan
  batchable: false
  gate:
  - g_code_review
  side_effects:
  - none (read-only)
  cost:
    expected_calls_per_run: 2
    in_price_per_mtok: 2.0
    out_price_per_mtok: 10.0
    price_source_url: https://platform.claude.com/docs/en/about-claude/pricing
    price_checked_on: null
    cacheable_prefix_tokens: 100000
    cache_hit_rate: 0.5
    cache_read_multiplier: 0.1
    cache_write_tokens: null
    cache_write_price: null
    batch_adopted: false
    batch_factor: 1
    off_peak_eligible: null
    off_peak_adopted: false
    off_peak_factor: 1
    discount_source: null
    retry_rate: 0.2
    included_in_existing_plan: true
- id: push_and_cloud_build
  kind: human
  purpose: Owner authorizes pushing the feature branch (never main), then manually starts the macOS CI simulator
    build; monitor reports the result read-only
  depends_on:
  - code_review
  input_refs:
  - code_write
  - code_review
  input_format: branch name + commit (code_write) + APPROVE verdict (code_review)
  output_format: CI build link + step results
  model: null
  tool_ref: null
  fallback:
    models: []
    when: not a model stage
    on_exhausted: pause_for_human
    recheck_gates: true
  est_tokens:
    in: null
    out: null
  cacheable_prefix: null
  batchable: null
  gate:
  - g_cloud_compile
  side_effects:
  - feature branch on remote
  - CI minutes spent
  cost: {}
- id: diff_signoff
  kind: human
  purpose: Owner reads the diff and decides merge; sandbox purchase test and store submission are separate later
    decisions
  depends_on:
  - push_and_cloud_build
  input_refs:
  - code_write
  - code_review
  - push_and_cloud_build
  input_format: diff (code_write) + verdicts (code_review) + CI result (push_and_cloud_build)
  output_format: merge decision record
  model: null
  tool_ref: null
  fallback:
    models: []
    when: not a model stage
    on_exhausted: pause_for_human
    recheck_gates: true
  est_tokens:
    in: null
    out: null
  cacheable_prefix: null
  batchable: null
  gate:
  - g_human_diff
  side_effects:
  - merge (out of this run)
  cost: {}
scope:
  in_scope:
  - plan, review, code, local checks, simulator build on cloud CI
  - tracking of rounds and verdicts in files
  out_of_scope:
  - store submission and release
  - real sandbox / TestFlight purchase test (needs separate authorization; no record of it in the files read, 2026-11-23)
  - merging to main
  - pricing and tax/bank setup in the store console
prohibitions:
- Claude (Anthropic) region restriction / Claude 地区限制 - Anthropic does not support mainland China / Hong Kong / Macau since 2026-11-12 (不支持中国大陆、香港、澳门), verified 2026-11-23, see https://www.anthropic.com/legal/supported-regions
- 无凭据、私有数据或真实发送地址 / No credentials, private data or actual sending addresses
- 未获人审不得花钱、外发、合并发布或删除 / No spending, external sends, merge/release or deletion without human review
- 'Not for payment code: do not use the lowest-trust reviewer (Grok) as the only reviewer'
- Never push main; never start the TestFlight/upload workflow without a fresh approval
irreversible_action_policy:
  default: require_human_approval
  on_missing_or_denied: block
  approval_scope: exact_action_and_payload
human_checkpoints:
- before_stage: plan_write
  action: 'paid or external model call for this stage (writer, reviewer or fallback); bound to endpoint, payload class and a spend cap derived from budget.per_run; a different provider or model needs a new approval'
  approver: owner
  approval_record_ref: future owner approval note (redacted label) naming endpoint, payload class and spend cap; settings alone are not approval
- before_stage: plan_review
  action: 'paid or external model call for this stage (writer, reviewer or fallback); bound to endpoint, payload class and a spend cap derived from budget.per_run; a different provider or model needs a new approval'
  approver: owner
  approval_record_ref: future owner approval note (redacted label) naming endpoint, payload class and spend cap; settings alone are not approval
- before_stage: code_write
  action: 'paid or external model call for this stage (writer, reviewer or fallback); bound to endpoint, payload class and a spend cap derived from budget.per_run; a different provider or model needs a new approval'
  approver: owner
  approval_record_ref: future owner approval note (redacted label) naming endpoint, payload class and spend cap; settings alone are not approval
- before_stage: code_review
  action: 'paid or external model call for this stage (writer, reviewer or fallback); bound to endpoint, payload class and a spend cap derived from budget.per_run; a different provider or model needs a new approval'
  approver: owner
  approval_record_ref: future owner approval note (redacted label) naming endpoint, payload class and spend cap; settings alone are not approval
- before_stage: push_and_cloud_build
  action: push feature branch to remote (not main); start simulator workflow on that commit
  approver: owner
  approval_record_ref: chat approval + CI build registry row (redacted)
- before_stage: diff_signoff
  action: merge decision after reading diff
  approver: owner
  approval_record_ref: PR approval (not part of this run)
gates:
- id: g_scope
  type: human
  check: Decisions D1..Dn written and answered before planning
  pass_condition: every open decision has an owner answer
  evidence_ref: decisions list in STATE.md
  reviewer_model: null
  on_fail: block_and_review
- id: g_plan_checks
  type: deterministic
  check: diff --check clean; cited paths exist; store copy length within limit
  pass_condition: all checks exit 0
  evidence_ref: plan check log
  reviewer_model: null
  on_fail: block_and_review
- id: g_plan_review
  type: reviewer
  check: independent read-only plan review
  pass_condition: verdict APPROVE with 0 blocker and 0 major within <=3 rounds
  evidence_ref: HANDOFF_VERDICT per round
  reviewer_model: Codex CLI 0.171.0 (example reviewer; read-only)
  on_fail: block_and_review
- id: g_plan_human
  type: human
  check: owner approves the plan
  pass_condition: approval flag set with date
  evidence_ref: STATE.md approval line
  reviewer_model: null
  on_fail: block_and_review
- id: g_code_tests
  type: deterministic
  check: analyzer and unit tests; native tests that cannot run locally are marked BLOCKED_ENV, never PASS
  pass_condition: analyzer exit 0 and tests exit 0; BLOCKED_ENV listed explicitly
  evidence_ref: check logs
  reviewer_model: null
  on_fail: block_and_review
- id: g_code_review
  type: reviewer
  check: independent read-only code review
  pass_condition: APPROVE with 0 blocker and 0 major within <=3 rounds; post-approval edits re-reviewed
  evidence_ref: HANDOFF_VERDICT per round
  reviewer_model: Codex CLI 0.171.0 (example reviewer; read-only)
  on_fail: block_and_review
- id: g_cloud_compile
  type: deterministic
  check: native code compiles on the macOS CI simulator build
  pass_condition: the native compile step succeeded for the exact reviewed commit; a failed, skipped or missing required step (including non-fatal steps that look green) blocks, not 'explained'
  evidence_ref: CI build registry row
  reviewer_model: null
  on_fail: block_and_review
- id: g_human_diff
  type: human
  check: owner reads the diff
  pass_condition: merge or reject recorded
  evidence_ref: PR decision
  reviewer_model: null
  on_fail: block_and_review
reliability:
  retries: 1
  retryable_errors:
  - reviewer timeout
  - CI infra error
  - rate limit
  non_retryable_errors:
  - reviewer verdict CHANGES (handled by the loop, not retried)
  - quota exhausted (route per fallback)
  - budget exceeded
  backoff:
    strategy: exponential
    initial_seconds: 30
    max_seconds: 300
    respect_retry_after: true
  timeout_seconds: 7200
  max_agent_turns: 40
  idempotency_key: feature-slug + stage_id + commit sha
  deduplication: one review round = one record file; a repeated round never overwrites an earlier verdict
  checkpoint_resume: rounds archived per round; resume from last archived verdict and re-check git state first
  on_final_failure: stop_and_notify_human
  notify:
    events:
    - completed
    - failed
    - budget_exceeded
    - approval_required
    mechanism: hook
    recipient_role: owner
observability:
  trace: files in the task folder (STATE/verdicts) + CI build registry
  log_tokens_and_cost: true
  fields:
  - run_id
  - pipeline_version
  - stage_id
  - model_revision
  - prompt_skill_versions
  - token_usage
  - cost_currency_basis
  - latency_seconds
  - retry_count
  - gate_results
  - approval_ref
  - failure_class
  redaction: no raw secrets, accounts or private paths in published records
  retention_days: 90
  review_cadence: owner, after each feature (weekly at most)
budget:
  per_run: 25
  per_month: 60
  max_tokens_per_run: 3000000
  max_wall_seconds_per_run: 172800
  on_exceed: pause_and_notify
eval:
  golden_set: tip-iap-pipeline-gold-v0 (5 cases from real records, 2026-11-23)
  min_pass_rate: 0.8
  run_on:
  - prompt_change
  - model_change
  - skill_change
  - weekly
  pass_k: null
  result_ref: null
versioning:
  prompts: dual-agent-review kit templates (tools/dual-agent-review-kit, revision pinned by the target repo)
  skills: dual-agent-review skill
  implementation_ref: null
cost_roi:
  currency: USD
  calculation_scope: api_rough_estimate
  human_min_per_run: 960
  review_min_per_run: 120
  hourly_rate: 40
  build_hours: 8
  debug_token_cost: 20
  maintenance_h_per_month: 2
  cost_of_bad_output: 'medium: a payment bug costs refunds and review rejection; unverified native code is the main
    risk'
  subscription_roi_method: undecided
  evidence:
  - field: runs_per_month
    basis: estimated
    source: 'owner cadence guess: 1-3 mid-size features/month'
    checked_on: '2026-11-23'
    sample_size: null
  - field: human_min_per_run
    basis: estimated
    source: no-agent baseline 8-24 h; 16 h used; baseline NOT measured
    checked_on: '2026-11-23'
    sample_size: null
  - field: review_min_per_run
    basis: estimated
    source: 'owner gates: decisions, plan, diff, CI start; NOT timed'
    checked_on: '2026-11-23'
    sample_size: null
  - field: hourly_rate
    basis: synthetic
    source: placeholder; replace with your own rate
    checked_on: '2026-11-23'
    sample_size: null
  - field: stages[*].est_tokens
    basis: estimated
    source: order of magnitude from document sizes; no usage logs kept
    checked_on: '2026-11-23'
    sample_size: null
  - field: stages[*].cost.{in,out}_price_per_mtok
    basis: estimated
    source: secondary price aggregators seen 2026-11-23; official page NOT verified
    checked_on: '2026-11-23'
    sample_size: null
  - field: build_hours
    basis: estimated
    source: kit already exists; 8 h to adopt
    checked_on: '2026-11-23'
    sample_size: null
  - field: debug_token_cost
    basis: estimated
    source: order of 10 USD
    checked_on: '2026-11-23'
    sample_size: null
  - field: stages[*].cost.{expected_calls_per_run,retry_rate,cacheable_prefix_tokens,cache_hit_rate,cache_read_multiplier}
    basis: synthetic
    source: design assumptions; no usage logs, cache hit rate and retries NOT measured
    checked_on: '2026-11-23'
    sample_size: null
  - field: stages[*].cost.price_checked_on
    basis: estimated
    source: left null on purpose - prices came from secondary aggregators, official page not verified; verify and date before reuse
    checked_on: '2026-11-23'
    sample_size: null
  - field: stages[plan_review,code_review].cost.{in,out}_price_per_mtok
    basis: synthetic
    source: the Claude list price is used only as an API-price PROXY for the read-only reviewer (example Codex CLI is on a subscription, price not looked up); replace with the real provider price
    checked_on: '2026-11-23'
    sample_size: null
  results:
    cost_per_run: 5
    monthly_cost: 10
    monthly_net_benefit: 1000
    initial_cost: 340
    break_even_months: 0.35
    calculation_note: 'ESTIMATE ONLY. Order of magnitude: API-price proxy about 1-20 USD per feature; subscription
      use is not free. Result is dominated by the unmeasured human baseline.'
```

规格原文

# 填好的流水线规格(设计文档,不可运行)/ Filled pipeline spec (design only, not executable).
# 模板 / template: ../templates/pipeline.yaml  ·  配方 / recipe: ../../recipes/coding-agents/e2e-tip-iap-ship-pipeline.md
# 所有数值为估算或合成,见 cost_roi.evidence。/ All numbers are estimates or synthetic; see cost_roi.evidence.
schema_version: 0.1.0
document_kind: pipeline_design
execution: prohibited
status: draft
pipeline: 'Ship a small in-app purchase feature: plan -> dual review -> code -> cloud build'
owner: solo developer (owner) + coordinator agent
version: 0.1.0
goal: 'For a solo iOS developer: turn "add a voluntary tip" into a reviewed, compiling feature branch with every
  gate recorded, without submitting to the store.'
audience:
- developers
trigger:
  kind: manual
  description: Owner asks the coordinator to start a feature; later gates need the owner
  timezone: America/Los_Angeles
runs_per_month: 2
inputs:
- id: in_requirement
  source: owner request + repo working tree
  format: text/markdown
  schema_ref: scope decisions D1..Dn; no secrets
  examples:
  - stl2stp tip feature (2026-11-22..23, internal task folder, redacted)
output:
  format: git feature branch + review records
  schema_ref: branch diff; HANDOFF_VERDICT.md per round; CI build record
  destination: remote feature branch (not main), owner decides merge
  acceptance:
  - g_plan_checks
  - g_plan_review
  - g_plan_human
  - g_code_tests
  - g_code_review
  - g_cloud_compile
  - g_human_diff
pattern: workflow:evaluator
pattern_reason: Steps are known and sequential; the quality comes from an independent read-only evaluator per phase.
  A single prompt cannot compile Swift; a free-running multi-agent adds cost and ordering problems for code (single
  writer + read-only reviewer is this repo method's own recommendation).
stages:
- id: intake_decisions
  kind: human
  purpose: 'Owner states scope decisions: one voluntary tip tier, no feature unlock, iOS-native StoreKit 2 only,
    App Store Connect handled by the owner'
  depends_on: []
  input_refs:
  - in_requirement
  input_format: free text + examples of what is NOT wanted
  output_format: numbered decisions D1..Dn in the plan folder
  model: null
  tool_ref: null
  fallback:
    models: []
    when: not a model stage
    on_exhausted: pause_for_human
    recheck_gates: true
  est_tokens:
    in: null
    out: null
  cacheable_prefix: null
  batchable: null
  gate:
  - g_scope
  side_effects:
  - none
  cost: {}
- id: plan_write
  kind: model
  purpose: Writer agent drafts PLAN.md + TASKS.md (scope, prohibitions, test matrix, App Store Connect steps) and
    self-reviews
  depends_on:
  - intake_decisions
  input_refs:
  - intake_decisions
  - in_requirement
  input_format: decisions + repo facts read from the working tree
  output_format: PLAN.md, TASKS.md, STATE.md (markdown)
  model: claude-sonnet-5-5 (example writer; Anthropic region restriction - not supported in mainland China/Hong Kong/Macau since 2026-11-12, verified 2026-11-23)
  tool_ref: null
  fallback:
    models:
    - Codex CLI 0.171.0
    when: writer quota exhausted
    on_exhausted: pause_for_human
    recheck_gates: true
  est_tokens:
    in: 120000
    out: 30000
  cacheable_prefix: stable repo/process docs
  batchable: false
  gate:
  - g_plan_checks
  side_effects:
  - writes documents in a feature worktree only
  cost:
    expected_calls_per_run: 2
    in_price_per_mtok: 2.0
    out_price_per_mtok: 10.0
    price_source_url: https://platform.claude.com/docs/en/about-claude/pricing
    price_checked_on: null
    cacheable_prefix_tokens: 80000
    cache_hit_rate: 0.5
    cache_read_multiplier: 0.1
    cache_write_tokens: null
    cache_write_price: null
    batch_adopted: false
    batch_factor: 1
    off_peak_eligible: null
    off_peak_adopted: false
    off_peak_factor: 1
    discount_source: null
    retry_rate: 0.2
    included_in_existing_plan: true
- id: plan_checks
  kind: code
  purpose: 'Static doc checks: whitespace diff check, every cited file path exists, store copy within length limit'
  depends_on:
  - plan_write
  input_refs:
  - plan_write
  - in_requirement
  input_format: plan documents + repository paths cited (working tree)
  output_format: pass/fail list
  model: null
  tool_ref: 'git + shell script (versions: 未记录)'
  fallback:
    models: []
    when: not a model stage
    on_exhausted: pause_for_human
    recheck_gates: true
  est_tokens:
    in: null
    out: null
  cacheable_prefix: null
  batchable: null
  gate:
  - g_plan_checks
  side_effects:
  - none
  cost: {}
- id: plan_review
  kind: model
  purpose: Independent read-only review of the plan; verdict APPROVE or CHANGES with blocker/major/minor; max 3
    rounds
  depends_on:
  - plan_checks
  input_refs:
  - plan_write
  - plan_checks
  input_format: plan documents (plan_write) + check results (plan_checks) + diff identity
  output_format: HANDOFF_VERDICT.md
  model: Codex CLI 0.171.0 (example reviewer; read-only)
  tool_ref: null
  fallback:
    models: &id001
    - independent Claude session claude-sonnet-5-5 (not the writer session)
    - Grok (NOT for payment/IAP changes)
    when: reviewer quota exhausted (Codex was at 0 on 2026-11-23)
    on_exhausted: pause_for_human
    recheck_gates: true
  est_tokens:
    in: 90000
    out: 8000
  cacheable_prefix: plan documents
  batchable: false
  gate:
  - g_plan_review
  side_effects:
  - none (read-only)
  cost:
    expected_calls_per_run: 2
    in_price_per_mtok: 2.0
    out_price_per_mtok: 10.0
    price_source_url: https://platform.claude.com/docs/en/about-claude/pricing
    price_checked_on: null
    cacheable_prefix_tokens: 60000
    cache_hit_rate: 0.5
    cache_read_multiplier: 0.1
    cache_write_tokens: null
    cache_write_price: null
    batch_adopted: false
    batch_factor: 1
    off_peak_eligible: null
    off_peak_adopted: false
    off_peak_factor: 1
    discount_source: null
    retry_rate: 0.2
    included_in_existing_plan: true
- id: plan_approval
  kind: human
  purpose: Owner reads the plan and approves or rejects; open decisions are answered here
  depends_on:
  - plan_review
  input_refs:
  - plan_write
  - plan_review
  input_format: plan (plan_write) + verdict (plan_review)
  output_format: approval flag in STATE.md (role, date)
  model: null
  tool_ref: null
  fallback:
    models: []
    when: not a model stage
    on_exhausted: pause_for_human
    recheck_gates: true
  est_tokens:
    in: null
    out: null
  cacheable_prefix: null
  batchable: null
  gate:
  - g_plan_human
  side_effects:
  - none
  cost: {}
- id: code_write
  kind: model
  purpose: Writer agent implements in the feature branch with tests; self-review before handoff
  depends_on:
  - plan_approval
  input_refs:
  - plan_approval
  - plan_write
  - in_requirement
  input_format: approval flag (plan_approval) + approved plan documents (plan_write)
  output_format: code diff + tests
  model: claude-sonnet-5-5 (example writer; Anthropic region restriction - not supported in mainland China/Hong Kong/Macau since 2026-11-12, verified 2026-11-23)
  tool_ref: null
  fallback:
    models:
    - Codex CLI 0.171.0
    when: writer quota exhausted
    on_exhausted: pause_for_human
    recheck_gates: true
  est_tokens:
    in: 1500000
    out: 100000
  cacheable_prefix: repo context + plan
  batchable: false
  gate:
  - g_code_tests
  side_effects:
  - commits on a local feature branch
  cost:
    expected_calls_per_run: 1
    in_price_per_mtok: 2.0
    out_price_per_mtok: 10.0
    price_source_url: https://platform.claude.com/docs/en/about-claude/pricing
    price_checked_on: null
    cacheable_prefix_tokens: 1200000
    cache_hit_rate: 0.8
    cache_read_multiplier: 0.1
    cache_write_tokens: null
    cache_write_price: null
    batch_adopted: false
    batch_factor: 1
    off_peak_eligible: null
    off_peak_adopted: false
    off_peak_factor: 1
    discount_source: null
    retry_rate: 0.2
    included_in_existing_plan: true
- id: code_checks
  kind: code
  purpose: Run analyzer, unit tests and project checks locally; record exit codes
  depends_on:
  - code_write
  input_refs:
  - code_write
  input_format: working tree
  output_format: logs with exit codes
  model: null
  tool_ref: 'flutter analyze / flutter test / python checks (versions: 见 CI 文档)'
  fallback:
    models: []
    when: not a model stage
    on_exhausted: pause_for_human
    recheck_gates: true
  est_tokens:
    in: null
    out: null
  cacheable_prefix: null
  batchable: null
  gate:
  - g_code_tests
  side_effects:
  - none
  cost: {}
- id: code_review
  kind: model
  purpose: Independent read-only code review, max 3 rounds; every code change after approval re-enters review
  depends_on:
  - code_checks
  input_refs:
  - code_write
  - code_checks
  input_format: diff (code_write) + test logs with exit codes (code_checks)
  output_format: HANDOFF_VERDICT.md
  model: Codex CLI 0.171.0 (example reviewer; read-only)
  tool_ref: null
  fallback:
    models: *id001
    when: reviewer quota exhausted
    on_exhausted: pause_for_human
    recheck_gates: true
  est_tokens:
    in: 150000
    out: 8000
  cacheable_prefix: diff + plan
  batchable: false
  gate:
  - g_code_review
  side_effects:
  - none (read-only)
  cost:
    expected_calls_per_run: 2
    in_price_per_mtok: 2.0
    out_price_per_mtok: 10.0
    price_source_url: https://platform.claude.com/docs/en/about-claude/pricing
    price_checked_on: null
    cacheable_prefix_tokens: 100000
    cache_hit_rate: 0.5
    cache_read_multiplier: 0.1
    cache_write_tokens: null
    cache_write_price: null
    batch_adopted: false
    batch_factor: 1
    off_peak_eligible: null
    off_peak_adopted: false
    off_peak_factor: 1
    discount_source: null
    retry_rate: 0.2
    included_in_existing_plan: true
- id: push_and_cloud_build
  kind: human
  purpose: Owner authorizes pushing the feature branch (never main), then manually starts the macOS CI simulator
    build; monitor reports the result read-only
  depends_on:
  - code_review
  input_refs:
  - code_write
  - code_review
  input_format: branch name + commit (code_write) + APPROVE verdict (code_review)
  output_format: CI build link + step results
  model: null
  tool_ref: null
  fallback:
    models: []
    when: not a model stage
    on_exhausted: pause_for_human
    recheck_gates: true
  est_tokens:
    in: null
    out: null
  cacheable_prefix: null
  batchable: null
  gate:
  - g_cloud_compile
  side_effects:
  - feature branch on remote
  - CI minutes spent
  cost: {}
- id: diff_signoff
  kind: human
  purpose: Owner reads the diff and decides merge; sandbox purchase test and store submission are separate later
    decisions
  depends_on:
  - push_and_cloud_build
  input_refs:
  - code_write
  - code_review
  - push_and_cloud_build
  input_format: diff (code_write) + verdicts (code_review) + CI result (push_and_cloud_build)
  output_format: merge decision record
  model: null
  tool_ref: null
  fallback:
    models: []
    when: not a model stage
    on_exhausted: pause_for_human
    recheck_gates: true
  est_tokens:
    in: null
    out: null
  cacheable_prefix: null
  batchable: null
  gate:
  - g_human_diff
  side_effects:
  - merge (out of this run)
  cost: {}
scope:
  in_scope:
  - plan, review, code, local checks, simulator build on cloud CI
  - tracking of rounds and verdicts in files
  out_of_scope:
  - store submission and release
  - real sandbox / TestFlight purchase test (needs separate authorization; no record of it in the files read, 2026-11-23)
  - merging to main
  - pricing and tax/bank setup in the store console
prohibitions:
- Claude (Anthropic) region restriction / Claude 地区限制 - Anthropic does not support mainland China / Hong Kong / Macau since 2026-11-12 (不支持中国大陆、香港、澳门), verified 2026-11-23, see https://www.anthropic.com/legal/supported-regions
- 无凭据、私有数据或真实发送地址 / No credentials, private data or actual sending addresses
- 未获人审不得花钱、外发、合并发布或删除 / No spending, external sends, merge/release or deletion without human review
- 'Not for payment code: do not use the lowest-trust reviewer (Grok) as the only reviewer'
- Never push main; never start the TestFlight/upload workflow without a fresh approval
irreversible_action_policy:
  default: require_human_approval
  on_missing_or_denied: block
  approval_scope: exact_action_and_payload
human_checkpoints:
- before_stage: plan_write
  action: 'paid or external model call for this stage (writer, reviewer or fallback); bound to endpoint, payload class and a spend cap derived from budget.per_run; a different provider or model needs a new approval'
  approver: owner
  approval_record_ref: future owner approval note (redacted label) naming endpoint, payload class and spend cap; settings alone are not approval
- before_stage: plan_review
  action: 'paid or external model call for this stage (writer, reviewer or fallback); bound to endpoint, payload class and a spend cap derived from budget.per_run; a different provider or model needs a new approval'
  approver: owner
  approval_record_ref: future owner approval note (redacted label) naming endpoint, payload class and spend cap; settings alone are not approval
- before_stage: code_write
  action: 'paid or external model call for this stage (writer, reviewer or fallback); bound to endpoint, payload class and a spend cap derived from budget.per_run; a different provider or model needs a new approval'
  approver: owner
  approval_record_ref: future owner approval note (redacted label) naming endpoint, payload class and spend cap; settings alone are not approval
- before_stage: code_review
  action: 'paid or external model call for this stage (writer, reviewer or fallback); bound to endpoint, payload class and a spend cap derived from budget.per_run; a different provider or model needs a new approval'
  approver: owner
  approval_record_ref: future owner approval note (redacted label) naming endpoint, payload class and spend cap; settings alone are not approval
- before_stage: push_and_cloud_build
  action: push feature branch to remote (not main); start simulator workflow on that commit
  approver: owner
  approval_record_ref: chat approval + CI build registry row (redacted)
- before_stage: diff_signoff
  action: merge decision after reading diff
  approver: owner
  approval_record_ref: PR approval (not part of this run)
gates:
- id: g_scope
  type: human
  check: Decisions D1..Dn written and answered before planning
  pass_condition: every open decision has an owner answer
  evidence_ref: decisions list in STATE.md
  reviewer_model: null
  on_fail: block_and_review
- id: g_plan_checks
  type: deterministic
  check: diff --check clean; cited paths exist; store copy length within limit
  pass_condition: all checks exit 0
  evidence_ref: plan check log
  reviewer_model: null
  on_fail: block_and_review
- id: g_plan_review
  type: reviewer
  check: independent read-only plan review
  pass_condition: verdict APPROVE with 0 blocker and 0 major within <=3 rounds
  evidence_ref: HANDOFF_VERDICT per round
  reviewer_model: Codex CLI 0.171.0 (example reviewer; read-only)
  on_fail: block_and_review
- id: g_plan_human
  type: human
  check: owner approves the plan
  pass_condition: approval flag set with date
  evidence_ref: STATE.md approval line
  reviewer_model: null
  on_fail: block_and_review
- id: g_code_tests
  type: deterministic
  check: analyzer and unit tests; native tests that cannot run locally are marked BLOCKED_ENV, never PASS
  pass_condition: analyzer exit 0 and tests exit 0; BLOCKED_ENV listed explicitly
  evidence_ref: check logs
  reviewer_model: null
  on_fail: block_and_review
- id: g_code_review
  type: reviewer
  check: independent read-only code review
  pass_condition: APPROVE with 0 blocker and 0 major within <=3 rounds; post-approval edits re-reviewed
  evidence_ref: HANDOFF_VERDICT per round
  reviewer_model: Codex CLI 0.171.0 (example reviewer; read-only)
  on_fail: block_and_review
- id: g_cloud_compile
  type: deterministic
  check: native code compiles on the macOS CI simulator build
  pass_condition: the native compile step succeeded for the exact reviewed commit; a failed, skipped or missing required step (including non-fatal steps that look green) blocks, not 'explained'
  evidence_ref: CI build registry row
  reviewer_model: null
  on_fail: block_and_review
- id: g_human_diff
  type: human
  check: owner reads the diff
  pass_condition: merge or reject recorded
  evidence_ref: PR decision
  reviewer_model: null
  on_fail: block_and_review
reliability:
  retries: 1
  retryable_errors:
  - reviewer timeout
  - CI infra error
  - rate limit
  non_retryable_errors:
  - reviewer verdict CHANGES (handled by the loop, not retried)
  - quota exhausted (route per fallback)
  - budget exceeded
  backoff:
    strategy: exponential
    initial_seconds: 30
    max_seconds: 300
    respect_retry_after: true
  timeout_seconds: 7200
  max_agent_turns: 40
  idempotency_key: feature-slug + stage_id + commit sha
  deduplication: one review round = one record file; a repeated round never overwrites an earlier verdict
  checkpoint_resume: rounds archived per round; resume from last archived verdict and re-check git state first
  on_final_failure: stop_and_notify_human
  notify:
    events:
    - completed
    - failed
    - budget_exceeded
    - approval_required
    mechanism: hook
    recipient_role: owner
observability:
  trace: files in the task folder (STATE/verdicts) + CI build registry
  log_tokens_and_cost: true
  fields:
  - run_id
  - pipeline_version
  - stage_id
  - model_revision
  - prompt_skill_versions
  - token_usage
  - cost_currency_basis
  - latency_seconds
  - retry_count
  - gate_results
  - approval_ref
  - failure_class
  redaction: no raw secrets, accounts or private paths in published records
  retention_days: 90
  review_cadence: owner, after each feature (weekly at most)
budget:
  per_run: 25
  per_month: 60
  max_tokens_per_run: 3000000
  max_wall_seconds_per_run: 172800
  on_exceed: pause_and_notify
eval:
  golden_set: tip-iap-pipeline-gold-v0 (5 cases from real records, 2026-11-23)
  min_pass_rate: 0.8
  run_on:
  - prompt_change
  - model_change
  - skill_change
  - weekly
  pass_k: null
  result_ref: null
versioning:
  prompts: dual-agent-review kit templates (tools/dual-agent-review-kit, revision pinned by the target repo)
  skills: dual-agent-review skill
  implementation_ref: null
cost_roi:
  currency: USD
  calculation_scope: api_rough_estimate
  human_min_per_run: 960
  review_min_per_run: 120
  hourly_rate: 40
  build_hours: 8
  debug_token_cost: 20
  maintenance_h_per_month: 2
  cost_of_bad_output: 'medium: a payment bug costs refunds and review rejection; unverified native code is the main
    risk'
  subscription_roi_method: undecided
  evidence:
  - field: runs_per_month
    basis: estimated
    source: 'owner cadence guess: 1-3 mid-size features/month'
    checked_on: '2026-11-23'
    sample_size: null
  - field: human_min_per_run
    basis: estimated
    source: no-agent baseline 8-24 h; 16 h used; baseline NOT measured
    checked_on: '2026-11-23'
    sample_size: null
  - field: review_min_per_run
    basis: estimated
    source: 'owner gates: decisions, plan, diff, CI start; NOT timed'
    checked_on: '2026-11-23'
    sample_size: null
  - field: hourly_rate
    basis: synthetic
    source: placeholder; replace with your own rate
    checked_on: '2026-11-23'
    sample_size: null
  - field: stages[*].est_tokens
    basis: estimated
    source: order of magnitude from document sizes; no usage logs kept
    checked_on: '2026-11-23'
    sample_size: null
  - field: stages[*].cost.{in,out}_price_per_mtok
    basis: estimated
    source: secondary price aggregators seen 2026-11-23; official page NOT verified
    checked_on: '2026-11-23'
    sample_size: null
  - field: build_hours
    basis: estimated
    source: kit already exists; 8 h to adopt
    checked_on: '2026-11-23'
    sample_size: null
  - field: debug_token_cost
    basis: estimated
    source: order of 10 USD
    checked_on: '2026-11-23'
    sample_size: null
  - field: stages[*].cost.{expected_calls_per_run,retry_rate,cacheable_prefix_tokens,cache_hit_rate,cache_read_multiplier}
    basis: synthetic
    source: design assumptions; no usage logs, cache hit rate and retries NOT measured
    checked_on: '2026-11-23'
    sample_size: null
  - field: stages[*].cost.price_checked_on
    basis: estimated
    source: left null on purpose - prices came from secondary aggregators, official page not verified; verify and date before reuse
    checked_on: '2026-11-23'
    sample_size: null
  - field: stages[plan_review,code_review].cost.{in,out}_price_per_mtok
    basis: synthetic
    source: the Claude list price is used only as an API-price PROXY for the read-only reviewer (example Codex CLI is on a subscription, price not looked up); replace with the real provider price
    checked_on: '2026-11-23'
    sample_size: null
  results:
    cost_per_run: 5
    monthly_cost: 10
    monthly_net_benefit: 1000
    initial_cost: 340
    break_even_months: 0.35
    calculation_note: 'ESTIMATE ONLY. Order of magnitude: API-price proxy about 1-20 USD per feature; subscription
      use is not free. Result is dominated by the unmeasured human baseline.'