Skip to content

๐Ÿ† AI-Human Collaborative SOP โ€” V2.0 Modular MDC Edition โ€‹

IMPORTANT

Core Principle: Let AI handle 90% of the labor (design, implementation, self-check, atomic commit), while the human handles 10% of the strategic decision-making (architectural alignment, plan approval, diff audit).


๐Ÿ—บ๏ธ The Engineering Pipeline โ€‹

mermaid
flowchart TD
    A[๐Ÿ‘ค Human: /r requirement] --> B[๐Ÿค– AI: Research Phase\nGate 200 active\nSource code READ-ONLY]
    B --> C{research_summary.md\nproduced?}
    C --> D[โธ๏ธ STOP: Show to Human]
    D --> E{Human replies '1'?}
    E -- No / Revise --> B
    E -- Yes --> F[๐Ÿค– AI: Planning Phase\nGate 300 active]
    F --> G[implementation_plan.md\ncontracts + atomic tasks]
    G --> H[โธ๏ธ STOP: Show to Human]
    H --> I{Human replies '1'?}
    I -- No / Revise --> F
    I -- Yes --> J[๐Ÿค– AI: Execute Step N.N\nGate 400 active]
    J --> K[Show Diff + Run tsc/lint]
    K --> L[โธ๏ธ STOP: Await Audit]
    L --> M{Human replies '1'?}
    M -- Fail twice --> N[git reset --hard\nReturn to /r]
    M -- Yes --> O[git commit atomic]
    O --> P{More steps?}
    P -- Yes --> J
    P -- No --> Q[/v Verification\nGate 500 active]
    Q --> R[โœ… All checks pass?]
    R -- No --> J
    R -- Yes --> S[/c Cleanup\nMerge / Deploy]

๐Ÿ›๏ธ 1. Engineering Execution Pyramid โ€‹

  1. Horizontal: Module Decoupling โ€” Phase 0 Contract Lock (write Stub interfaces first, verify via TSC, then implement logic).
  2. Vertical: Layer-by-Layer Progression โ€” Schema โ†’ Logic โ†’ Store โ†’ UI layers.
  3. Atomic Units โ€” Dual-Track Model:
    • Logic Change: โ‰ค 20 lines; OR one complete semantic unit (rationale must be stated before the diff).
    • UI/Markup Change: โ‰ค 100 lines AND โ‰ค 1 functional block (e.g., one Modal, one Form โ€” both conditions required).
    • Pure Refactor (no behavior change): Logic relaxed to โ‰ค 50 lines; requires refactor: commit prefix.
    • Type definitions / Interfaces / Config files: Exempt from line count limits, but must be committed separately โ€” never mixed with implementation.
    • Two-Strike Rule: Fail verification twice โ†’ git reset --hard โ†’ Return to /r phase with root cause analysis.

๐Ÿงฑ 2. Document-First & MDC Iron Lock โ€‹

Core Philosophy: Chat is only for triggers and confirmation. Documents and Module Rules are the real collaboration interface.

GateCommandMDC FileAI Permissions
Gate 0/r200-research-gate.mdcRead-Only. Output: research_summary.md
Gate 1/p300-planning-gate.mdcPlan-Only. Output: implementation_plan.md
Gate 2/e400-execution-iron-lock.mdcAtomic code changes + mandatory diffs
Gate 3/v500-verification-gate.mdcRun checks. Output: verification report

Interaction Lock (Gating Lock):

  1. Human reviews document and replies 1.
  2. AI cold-reloads the file via view_file to sync any offline edits.
  3. Before receiving 1, the next gate's rules are physically inactive.

๐Ÿ”ฑ 3. Git Protocol & Safeguards โ€‹

  1. Atomic Commitment: One atomic unit โ†’ one semantic commit (Conventional Commits: feat/fix/refactor/docs/chore).
  2. Change Isolation: Never mix logic changes with UI changes in the same commit.
  3. Conflict Circuit Breaker: If a Git conflict is detected, AI must STOP immediately and hand over to human.

Commit message format:

feat(scope): [what was added]
fix(scope): [what was fixed]
refactor(scope): [what was restructured]
docs(scope): [what documentation changed]
chore(scope): [maintenance, cleanup, config]

๐Ÿงน 4. Cleanup Protocol โ€‹

  • Timing: After task branch verification, BEFORE merging to main/dev.
  • Command: /c
  • Action: rm research_summary.md implementation_plan.md task.md walkthrough.md
  • Final commit: chore(cleanup): remove task artifacts

๐ŸŒ 5. Communication Protocol โ€‹

  • Language Sync: Match the user's language in all interactions. Default to the language of the first message.
  • Zero Placeholders: No TODO, FIXME, ..., or pseudocode in any committed file. Ever.

[Command Reference]: /r Research | /p Plan | /e [step] Execute | /f Flash | /d Debug | /v Verify | /c Clean | /gc Commit | /gp Push | /g Sync

Released under the MIT License.