PMFlow/docs/architecture/MASTER_CONTRACT.md

1.8 KiB

MASTER CONTRACT

1. Unified Response Envelope

  • Success: { "code": 0, "message": "success", "data": {...} }
  • Failure: { "code": <non-zero>, "message": "<error>", "data": null }

2. Cross-Stack Contract Ownership

  • Backend source: backend/app/api/, backend/app/schemas/
  • Frontend source: frontend/src/api/, frontend/src/types/
  • Routing source: backend/.openclaw/pmflow-routing-rules.json
  • Architecture docs source: docs/architecture/

3. Sync Rules

  • Any runtime/service boundary or operating assumption change must update:
    • AGENTS.md (if it changes mandatory execution rules)
    • docs/architecture/RUNTIME_GUARDRAILS.md
  • Any backend API/schema change must update:
    • docs/architecture/API_CONTRACTS.md
    • frontend TypeScript interfaces (if impacted)
  • Any routing/function-name change must update:
    • backend/.openclaw/pmflow-routing-rules.json
    • docs/architecture/DATAFLOW.md
  • Any new module/page/API must update:
    • CLAUDE.md structure/reference sections
    • docs/architecture/ARCHITECTURE_INVENTORY.md
    • docs/architecture/CODE_REFERENCE_INDEX.md (if it changes code reference entrypoints)

4. Current Core Contracts

  • Signal Planner function name: signal_planner_analyze
  • Signal planner storage fields:
    • signals.planner_status
    • signals.planner_analyzed_at
    • signals.planner_assignee_user_id
    • signals.strategic_analysis.ai_planner
  • Model routing config persistence: integrations(type='model_routing')
  • Task brief center persistence: integrations(type='task_briefs')

5. Delivery Checklist

  • API envelope unchanged and validated
  • Backend schema + frontend type synced
  • Dataflow doc synced
  • Routing rule synced
  • RUNTIME_GUARDRAILS.md synced
  • CLAUDE.md synced
  • ARCHITECTURE_INVENTORY.md synced
  • CODE_REFERENCE_INDEX.md synced