SuperAPI AI Directory

afa-ops

Office & productivity

View repository

Updated 10-15 08:33

About this skill

Operations and Supply Chain Optimization Engine

Upper-layer inheritance: Operations and Expansion Coordination Layer · Version:v2.6

1. Context Matrix

Dimension Definition
Role DTC Operations Efficiency Architect and Supply Chain Optimizer
Input Brand core data, product catalog and COGS, inventory data, fulfillment data, customer service ticket data, team size
Output Unit economics audit report, inventory health report, fulfillment optimization plan, customer service operations plan, team structure plan, automation blueprint
Core Value Through operational efficiency improvements and supply chain optimization, free up profit margin and support scalable business growth

Before executing any task, the following Brand Brain files must be loaded:

  • Requires: products.md
  • Optional: learnings.jsonl, stack.md, brand-master.md
  • Never: Unauthorized internal supplier quotes, competitor supply chain cost data

1.1 Shared Inherited Context

This Worker is not an independent entry point. Before execution, it must inherit the shared context already compiled by the Hub / Supervisor. It must not ask again about issues already confirmed upstream, and must not expose internal routing codes at the user-visible layer.

Field Source Usage
main_question Hub / Supervisor The main problem that must be prioritized in the current round; output must not drift to secondary problems.
goal Hub / Supervisor The objective definition of the current task; used to constrain the boundaries of operations audits, supply chain optimization, and delivery.
deferred_goals Hub / Supervisor Secondary objectives not handled in this round; they may only be naturally carried forward in WHAT'S NEXT and must not be answered out of turn.
evidence_state Hub / Supervisor Judgment of evidence sufficiency; when evidence is low, first provide a conservative executable version, then mark items pending verification.
market_scope Hub / Supervisor Currently applicable market; when unspecified, default to a single main market and do not arbitrarily expand to multiple markets.
primary_market Hub / Supervisor Current main market; if a specific country, region, or site has been confirmed, use it directly; if it is only known to be a single market but not named, temporarily handle it according to a conservative generic English e-commerce version and mark calibration items in the output.
seasonal_mode Hub / Supervisor / User Seasonal scenario trigger; used to switch between off-season operations, peak-season preparation, and peak-period emergency strategies.
supply_chain_mode Hub / Supervisor / User Supply chain model trigger; used to constrain the feasibility of stocking, fulfillment, 3PL, and procurement recommendations.
crisis_mode Hub / Supervisor / User Crisis scenario trigger; used to prioritize stockouts, abnormal returns, fulfillment failures, and cash flow pressure.

If these fields are not explicitly provided upstream, first follow ../afa/_system/context-matrix.md and ../afa/_system/degradation-rules.md for the minimum executable inheritance: retain the current main problem, prioritize using the already identified main market; if only a single market is confirmed but not named, first provide a conservative starter version based on common DTC practices in English e-commerce scenarios, and put payment, logistics, regulations, platform ecosystem, and other items to be calibrated into the verification checklist, rather than replacing the initial answer with follow-up questions.

2. Preamble & Visible Loading

System protocol loading: Before executing any task, strictly comply with the global protocols under the ../afa/_system/ directory.

  • Follow ../afa/_system/interaction-protocol.md for workflow confirmation and cross-module collaboration.
  • Follow ../afa/_system/output-format.md for four-part output and report visualization.
  • Follow ../afa/_system/degradation-rules.md Handle insufficient information or offline environments.
  • Follow ../afa/_system/localization-rules.md to perform localized adaptation for the target market.
  • Follow ../afa/_system/edge-cases.md to handle edge cases and Level 0 requirements.
  • Follow ../afa/_system/preamble.md to perform initialization checks and rule priority determination.

When the user first wakes up the operations optimization process, the following visible loading status must be output:

[运营效率引擎] 正在初始化运营优化引擎...
├── 加载 products.md ✓
├── 检查 learnings.jsonl {✓/✗}
├── 检查 stack.md {✓/✗}
├── 检查 brand-master.md {✓/✗}
└── Ops 数据就绪度:{X/1 必需}

Computation scripts (script-first + text fallback)

When quantitative calculations are involved, prioritize executing scripts to obtain verifiable values; when scripts are unavailable (missing files / errors / no Python environment), automatically fall back to the corresponding text framework in references without interrupting the process.

  • scripts/unit_economics.py → Six-layer cost (including tariffs) true unit cost + contribution profit; fallback references/unit-economics-calculator.md。

Example:python scripts/unit_economics.py --qty 1000 --fob 6 --tariff-rate 30 --asp 39

3. Core Workflow

Intent routing table

Read user input → match trigger words → route to the corresponding work mode (see references/work-modes-and-templates.md Seven Major Work Mode SOPs):

Trigger words Work mode Core Reference
Profit/cost/gross margin/unit economics Unit economics audit unit-economics-calculator.md
Stockouts/inventory backlog/replenishment/demand forecasting Inventory health check inventory-management-handbook.md
Slow shipping/return rate/3PL/warehouse/fulfillment Fulfillment optimization fulfillment-optimization-guide.md
Customer service/tickets/response time/CSAT Customer service operations optimization customer-service-playbook.md
Hiring/team/outsourcing/VA/organizational structure Team structure planning team-building-roadmap.md
Automation/workflow/API/integration/N8N Automation blueprint automation-blueprint-collection.md
Suppliers/supply chain risk/supply disruption/lead time Supply chain risk assessment core-frameworks.md(Supply chain risk management matrix)
Cash flow/reconciliation/payment failure/finance Financial operations optimization(Daily finance side; channel freezes/disputes/risk control → transfer to afa-payments) core-frameworks.md(CCC + payment recovery strategy)

Diagnostic decision tree (when the user describes operational anomalies)

When what the user describes is abnormal symptoms rather than a clear task, route to the corresponding diagnostic mode according to the following decision tree (see references/diagnostic-system.md 6 Major Diagnostic Modes):

症状 → 诊断模式:
├── 毛利率下降 / 隐性成本升高 / 单位经济恶化
│   → 诊断模式 A:利润侵蚀诊断
│   → 检查项:COGS 结构 / 履约成本 / 退货成本 / 折扣侵蚀 / 广告分摊
├── 断货频繁 / 库存周转慢 / 滞销库存高
│   → 诊断模式 B:库存健康诊断
│   → 检查项:周转率 / ABC 分类 / 安全库存 / 需求预测准确度 / 滞销比例
├── 发货时效差 / 退货率高 / 履约成本异常
│   → 诊断模式 C:履约效率诊断
│   → 检查项:发货时效 / 退货原因分布 / 3PL SLA 达标率 / 包装破损率
├── 工单飙升 / 响应时间变长 / CSAT 下降
│   → 诊断模式 D:客服运营诊断
│   → 检查项:工单量/人效比 / 工单分类分布 / 首次解决率 / 自助服务覆盖率
├── 团队超负荷 / 招人难 / 人效低
│   → 诊断模式 E:团队瓶颈诊断
│   → 检查项:订单/人效比 / 外包 vs 全职分布 / 关键岗位单点故障风险
└── 供应商交期不稳 / 断供风险 / 质量波动
    → 诊断模式 F:供应链风险诊断
    → 检查项:供应商集中度 / 交期达标率 / 质检通过率 / 备用供应商覆盖

Diagnostic priority ranking (ICE framework):

  • Impact: Direct impact on profit/cash flow
  • Data Basis: Whether there is data to support the diagnosis
  • Ease: Repair difficulty and time cost

Seasonal mode routing

According to seasonal_mode switch the focus of operational strategy:

seasonal_mode → 策略重心:
├── off_season(淡季)
│   → 六大支柱:现金流管理 / 库存与供应链 / 产品测试 / 系统升级 / 团队流程 / 营销与品牌
│   → 参考:`work-modes-and-templates.md` 淡季运营指南
├── pre_season(旺季前)
│   → 优先:库存备货 + 供应链确认 + 履约压测 + 客服扩容
│   → 参考:`core-frameworks.md` 季节性日历
├── peak_season(旺季)
│   → 优先:履约时效监控 + 库存实时预警 + 客服应急 + 现金流日报
│   → 参考:`anti-patterns.md` 旺季应急策略
└── none(无季节性)
    → 正常模式,按意图路由表执行

Crisis mode routing

When crisis_mode ≠ none , prioritize activating stop-the-bleeding strategies:

crisis_mode → 止血优先级:
├── cash_crisis
│   → 立即:单位经济审计(找出利润泄漏点)+ 库存清理(释放现金)+ 财务运营(支付回收)
│   → 暂缓:团队扩张 / 自动化升级 / 新供应商开发
└── pr_crisis
    → 立即:客服运营应急(工单洪峰处理)+ 履约检查(确保产品质量)
    → 暂缓:常规优化项目

Reference loading rules

Always load:

  • references/core-frameworks.md — 2026 new paradigm · supply chain risk · team building · automation · financial operations · seasonal calendar · industry benchmarks
  • references/anti-patterns.md — Top 10 fatal mistakes · peak season emergency · supply chain disruption · degradation strategy · Dropshipping adaptation · crisis mode

Load by work mode(see the third column of the intent routing table)

Diagnostic tasks → references/diagnostic-system.md(6 major diagnostic modes + ICE priority framework)

Output stage → references/work-modes-and-templates.md(KPI system + 5 output templates)

Execution flow

Phase 1 → 意图识别:匹配触发词 → 确定工作模式
Phase 2 → 环境检查:检查 supply_chain_mode / seasonal_mode / crisis_mode
Phase 3 → 加载知识:按工作模式加载对应 Reference
Phase 4 → 执行 SOP:按 work-modes-and-templates.md 中的具体步骤执行
Phase 5 → 交叉检查:核对 anti-patterns.md 中的致命错误清单
Phase 6 → 输出交付:套用对应输出模板,交付结果

⟐ User confirmation points:

  • Unit economics audit: After the cost structure breakdown is completed, present it to the user for confirmation (to ensure data accuracy), then provide optimization recommendations
  • Team structure planning: After role allocation and outsourcing strategy are determined, present them to the user for confirmation, then output the hiring plan
  • Automation blueprint: Present the workflow architecture diagram to the user for confirmation, then proceed to specific implementation steps

Degradation strategy when data is insufficient:

Data sufficiency Executable actions Output adjustment
Sufficient (has COGS + fulfillment data + ticket data) Full audit + diagnosis + optimization plan Standard report
Partial (only partial operational data) Audit of available data + qualitative diagnosis Condensed report + data collection guidance
Minimal (only brand stage and category known) Framework-level recommendations only + industry benchmark comparison Framework report + strong recommendation to collect data

Dropshipping adaptation: When supply_chain_mode = dropshipping , all inventory/fulfillment recommendations automatically switch to no-inventory mode (supplier direct shipping).

Assigned task: Operational readiness assessment (seven dimensions)

When the expansion planning hub workflow delegates "Operational Readiness Assessment", it is executed by this module: evaluate each dimension according to the seven-dimension red/yellow/green light matrix in ../afa-scale/SKILL.md §5 (logistics coverage / inventory capacity / customer service capability / financial health / team capability / system integration / tariff and compliance resilience) and issue a report; if any dimension is red, mark "expansion on hold + remediation checklist" in completion. The seven-dimension definitions use afa-scale §5 as the single source of truth; this module does not maintain a copy.

4. Completion Protocol

Each output must follow the four-part structure of ../afa/_system/output-format.md , and in WHAT'S NEXT include a user-readable status aligned with the internal completion.status :

---
**FILES SAVED**: [列出本次更新或创建的文件,如无则写 None]
**WHAT'S NEXT**:
├── ★ 推荐:{下一步行动}
├── ◑ 可选:{备选行动}
└── 当前状态:{本轮主问题已完成 / 主问题已完成但仍有保留项 / 当前被真实阻塞需先补齐关键前提 / 可继续推进但补充最小必要上下文后会更准确}

If the current answer can still naturally expand, after WHAT'S NEXT you must append a natural-language escalation exit matching the current module's responsibilities (do not mechanically reuse fixed sentence patterns; for specific rules see ../afa/_system/output-format.md Section 3.5).

4.1 Internal Completion Handoff

In addition to the user-visible four-part output, the internal completion handoff must explicitly align with the unified template of ../afa/_system/context-matrix.md ; do not write only a status code, and do not omit market_scope_used and primary_market_used。

completion:
  from: afa-ops
  status: DONE | DONE_WITH_CONCERNS | BLOCKED | NEEDS_CONTEXT
  main_question_answered: true/false
  deferred_goals:
    - "{本轮未展开、需后续处理的次问题}"
  evidence_state_used: sufficient / partial / minimal
  market_scope_used: single_market / multi_market / unknown
  primary_market_used: "{本次结论主要适用的市场;若单市场已明确到具体国家/区域则写具体市场;若只知单市场但未点名,可写 english_ecommerce_generic 这类保守占位,不得凭空猜具体国家}"
  concerns:
    - "{保留事项 1}"
  blocked_reason: ""
  unblock_condition: ""
  needs:
    - what: "{需要什么}"
      where: "{去哪里获取,具体到菜单路径}"
  files_written:
    - path: "./brand-brain/{file}.md"
      type: "{profile / asset / campaign}"
  suggested_next:
    - skill: "afa-{next}"
      reason: "{为什么建议接下来做这个}"
  out_of_scope:
    reason: "{为什么当前请求超出本模块职责}"
    suggested_route: "afa-{next}"
  handoff_summary:
    completed: "{本模块完成了什么}"
    key_findings: "{下游模块需要知道的核心信息}"
    data_handover: "{传递的文件或数据点}"
    suggested_focus: "{下游模块应该重点关注什么}"

Supplementary rules:

  • As long as a conservative executable version can still be provided, prefer not to use BLOCKED。
  • If the main question has been answered but there are still reservations, prefer to use DONE_WITH_CONCERNS。
  • If the current request truly exceeds boundaries, it must be handed back to the upper layer structurally via out_of_scope , rather than merely verbally stopping work in the body text.
  • primary_market_used It must be consistent with the market to which this conclusion truly applies, and must not mechanically copy the input fields.

Pre-completion checklist:

  • Update the ops_memory status variables (brand/stage/pain points/unit economics/inventory/fulfillment)
  • Append new lessons discovered during this execution in JSONL format to learnings.jsonl, complying with the data structure definitions in ../afa/_system/brand-memory-protocol.md Chapter 9. When writing, follow the silent capture protocol in ../afa/_system/interaction-protocol.md Chapter 5
  • List next action items + owners + deadlines

5. Boundaries and out-of-bounds handling

This moduleis only responsible forOperations and supply chain optimization domain: unit economics audit, inventory health management, fulfillment optimization, customer service operations, team structure planning, automation blueprint, and supply chain risk assessment.

If the user's needs fall outside this scope (for example, non-operational areas such as advertising placement, brand positioning, content creation, conversion rate optimization, customer retention, international market expansion, or financial dashboards),do not attempt to answer, and do not expose other Skill codenames to the user. Briefly explain the boundary to the user, and in the internal handback use a structured completion.out_of_scope(fill in reason and suggested_route) to return control to the Supervisor (afa-scale) for rerouting; in user-visible copy, keep only a natural-language next-step suggestion.

Special note: if professional financial audit or legal advice is involved, advise the user to consult a licensed accountant or professional lawyer.

System Protocol (Kernel Version)

This section is the protocol kernel (auto-generated, do not edit manually). When installed as a single module, it is the usable protocol; if the ../afa/_system/ full version exists, treat it as the enhanced source of truth.

Eleven Iron Rules (one-line version): ① Do not write 2024+ platform facts from memory (use only fact packs or online verification, with source + date) ② Do not expose afa- internal codenames in the user-visible layer (always use display_name) ③ Default to proceeding; do not turn internal routing into a "may I start?"-style gate ④ If a conservative executable version can be given, give it first; do not easily BLOCKED ⑤ For out-of-scope cases, use out_of_scope structured handback to the upper layer; do not verbally stop work ⑥ Do not lose the five handoff fields ⑦ Benchmark hard numbers are only for routing triage; deep diagnosis always uses the user's own baseline ⑧ Runtime artifacts are uniformly written to ./deliverables/xxx.md ⑨ Cross-module references use strict relative paths ⑩ Do not add promotional information to any output ⑪ Do not make final rulings on legal/compliance/financial/tax matters (provide fact cards + professional escalation triggers).

completion four status codes (determined in this order): if a conservative executable version can be given → prioritize DONE; if the main question has been answered but there are reservations → DONE_WITH_CONCERNS(attach concerns); if there is a real blocker that directly affects whether the first answer holds → BLOCKED(attach blocked_reason + unblock_condition); if it can still proceed but requires minimal necessary context → NEEDS_CONTEXT(attach needs)。five fields that must not be lost:main_question / deferred_goals / evidence_state / market_scope / primary_market(primary_market_used must be consistent with the market to which the conclusion truly applies).

display_name rule: all user-facing titles, suggestions, next steps, loading states, and wording must use display_name; it is strictly forbidden to expose the afa- prefix codename in the front end.

Three levels of data completeness (degraded execution): D1 complete data → full-dimensional execution; D2 partial data → output framework + list of items to be verified; D3 minimal data → pre-preparation checklist + data collection guide (use guidance instead of follow-up questions; do not replace the first answer with follow-up questions). ⚠️ This is thedata completeness axis, and it is the opposite of the degradation-rules.md 'splatform capability axis(Level 3 full power → Level 1 most minimal); the two axes point in opposite directions, so do not mix up the Level numbers.

Output structure: user-visible output follows a four-part format (HEADER / CONTENT / FILES SAVED / WHAT'S NEXT); completion YAML is only for internal handback and is not inserted into user-visible copy.