Aller au contenu

PD-52 — Décomposition Multi-Agents

Story : PD-52 — Setup connexion Ethereum L2 (Polygon/Arbitrum) Date : 2026-02-12 Étape : 6a — Décomposition Total tâches : 25 Total code contracts : 29


1. Mapping Agents → LLM

Agent LLM Mode Usage
agent-developer Claude (claude -p) Factuel (0.1) Implémentation code TypeScript
agent-qa-unit Claude (claude -p) Factuel (0.1) Tests unitaires Jest
agent-qa-integration Claude (claude -p) Factuel (0.1) Tests E2E testnet
agent-qa-security Claude (claude -p) Factuel (0.1) Audit secrets

2. Séquençage des tâches

Phase 1 : Fondations (T-01 à T-04)

# Tâche Agent Code Contract Fichiers Dépendances
T-01 Configuration module + constants agent-developer CC-52-01, CC-52-20 blockchain.module.ts, blockchain.config.ts -
T-02 Interface et types agent-developer CC-52-05, CC-52-25, CC-52-26 custody.interface.ts, dto/*.ts T-01
T-03 Codes d'erreur agent-developer CC-52-02 constants/error-codes.ts T-01
T-04 Chain IDs + guard testnet agent-developer CC-52-03, CC-52-23 constants/chain-ids.ts, validators/chain-id.guard.ts T-01

Phase 2 : RPC Provider (T-05 à T-07)

# Tâche Agent Code Contract Fichiers Dépendances
T-05 RpcProviderService + failover agent-developer CC-52-04 providers/rpc-provider.service.ts T-01, T-03
T-06 Health check RPC agent-developer CC-52-21 providers/rpc-health.service.ts T-05
T-07 Tests unitaires RPC agent-qa-unit CC-52-15 tests/providers/rpc-provider.service.spec.ts T-05, T-06

Phase 3 : Custody (T-08 à T-12)

# Tâche Agent Code Contract Fichiers Dépendances
T-08 Interface CustodyStrategy agent-developer CC-52-05 custody/custody.interface.ts T-02
T-09 S2 KMS Strategy agent-developer CC-52-06 custody/strategies/s2-kms.strategy.ts T-08
T-10 S1 HSM Strategy (stub) agent-developer CC-52-27 custody/strategies/s1-hsm.strategy.ts T-08
T-11 S3 Hybrid Strategy (stub) agent-developer CC-52-28 custody/strategies/s3-hybrid.strategy.ts T-08
T-12 CustodyService orchestrateur agent-developer CC-52-07, CC-52-22 custody/custody.service.ts, custody/custody.guard.ts T-09, T-10, T-11

Phase 4 : Wallet & Transaction (T-13 à T-17)

# Tâche Agent Code Contract Fichiers Dépendances
T-13 WalletService (sign EIP-191) agent-developer CC-52-08, CC-52-24 wallet/wallet.service.ts, wallet/wallet.validator.ts T-12
T-14 PayloadValidator agent-developer CC-52-09 validators/payload.validator.ts T-03
T-15 GasEstimatorService agent-developer CC-52-10 transaction/gas-estimator.service.ts T-05
T-16 TransactionService agent-developer CC-52-11 transaction/transaction.service.ts T-13, T-14, T-15
T-17 ConfirmationTracker agent-developer CC-52-12 transaction/confirmation.tracker.ts T-05, T-16

Phase 5 : Health & Observability (T-18 à T-19)

# Tâche Agent Code Contract Fichiers Dépendances
T-18 BlockchainHealthService agent-developer CC-52-13 health/blockchain-health.service.ts T-05, T-12, T-13
T-19 BlockchainHealthController agent-developer CC-52-14 health/blockchain-health.controller.ts T-18

Phase 6 : Tests & Audit (T-20 à T-25)

# Tâche Agent Code Contract Fichiers Dépendances
T-20 Tests unitaires custody agent-qa-unit CC-52-16 tests/custody/custody.service.spec.ts T-12
T-21 Tests unitaires wallet/tx agent-qa-unit CC-52-17, CC-52-18 tests/wallet/.spec.ts, tests/transaction/.spec.ts T-13, T-16, T-17
T-22 Tests intégration testnet agent-qa-integration CC-52-19 tests/integration/blockchain.e2e.spec.ts T-16, T-17
T-23 Tests health endpoint agent-qa-integration - tests/health/blockchain-health.controller.spec.ts T-19
T-24 Audit de secrets agent-qa-security CC-52-29 scripts/audit-secrets.sh, .gitleaks.toml T-20, T-21
T-25 Rapport de couverture agent-qa-unit - coverage/lcov-report/index.html T-20, T-21

3. Résumé par agent

Agent Tâches Total
agent-developer T-01, T-02, T-03, T-04, T-05, T-06, T-08, T-09, T-10, T-11, T-12, T-13, T-14, T-15, T-16, T-17, T-18, T-19 18
agent-qa-unit T-07, T-20, T-21, T-25 4
agent-qa-integration T-22, T-23 2
agent-qa-security T-24 1

4. Ordre d'exécution (séquentiel)

L'exécution suit l'ordre strict des dépendances :

Phase 1: T-01 → T-02 → T-03 → T-04
Phase 2: T-05 → T-06 → T-07
Phase 3: T-08 → T-09 → T-10 → T-11 → T-12
Phase 4: T-13 → T-14 → T-15 → T-16 → T-17
Phase 5: T-18 → T-19
Phase 6: T-20 → T-21 → T-22 → T-23 → T-24 → T-25

5. Arborescence des fichiers à produire

src/modules/blockchain/
├── blockchain.module.ts              # T-01 (CC-52-20)
├── blockchain.config.ts              # T-01 (CC-52-01)
├── constants/
│   ├── chain-ids.ts                  # T-04 (CC-52-03)
│   └── error-codes.ts                # T-03 (CC-52-02)
├── providers/
│   ├── rpc-provider.service.ts       # T-05 (CC-52-04)
│   └── rpc-health.service.ts         # T-06 (CC-52-21)
├── custody/
│   ├── custody.service.ts            # T-12 (CC-52-07)
│   ├── custody.interface.ts          # T-08 (CC-52-05)
│   ├── custody.guard.ts              # T-12 (CC-52-22)
│   └── strategies/
│       ├── s1-hsm.strategy.ts        # T-10 (CC-52-27)
│       ├── s2-kms.strategy.ts        # T-09 (CC-52-06)
│       └── s3-hybrid.strategy.ts     # T-11 (CC-52-28)
├── wallet/
│   ├── wallet.service.ts             # T-13 (CC-52-08)
│   └── wallet.validator.ts           # T-13 (CC-52-24)
├── validators/
│   ├── payload.validator.ts          # T-14 (CC-52-09)
│   └── chain-id.guard.ts             # T-04 (CC-52-23)
├── transaction/
│   ├── transaction.service.ts        # T-16 (CC-52-11)
│   ├── gas-estimator.service.ts      # T-15 (CC-52-10)
│   └── confirmation.tracker.ts       # T-17 (CC-52-12)
├── health/
│   ├── blockchain-health.service.ts  # T-18 (CC-52-13)
│   └── blockchain-health.controller.ts # T-19 (CC-52-14)
├── dto/
│   ├── transaction.dto.ts            # T-02 (CC-52-25)
│   └── health.dto.ts                 # T-02 (CC-52-26)
└── __tests__/
    ├── providers/
    │   └── rpc-provider.service.spec.ts  # T-07 (CC-52-15)
    ├── custody/
    │   └── custody.service.spec.ts       # T-20 (CC-52-16)
    ├── wallet/
    │   └── wallet.service.spec.ts        # T-21 (CC-52-17)
    ├── transaction/
    │   └── transaction.service.spec.ts   # T-21 (CC-52-18)
    ├── integration/
    │   └── blockchain.e2e.spec.ts        # T-22 (CC-52-19)
    └── health/
        └── blockchain-health.controller.spec.ts # T-23

scripts/
└── audit-secrets.sh                  # T-24 (CC-52-29)

.gitleaks.toml                        # T-24 (configuration)

6. Instructions pour les agents

agent-developer

Pour chaque tâche T-XX :

  1. Lire le code contract CC-52-YY correspondant
  2. Implémenter le code TypeScript conforme à l'interface
  3. Respecter les invariants listés
  4. Utiliser les codes d'erreur appropriés
  5. Ne jamais exposer de secret dans les logs

agent-qa-unit

  1. Utiliser Jest + ts-jest
  2. Mocker les dépendances externes (AWS KMS, ethers)
  3. Couvrir les cas nominaux ET les cas d'erreur
  4. Viser couverture >= 80%

agent-qa-integration

  1. Utiliser les testnets Polygon Amoy (80002) et Arbitrum Sepolia (421614)
  2. Vérifier que les wallets sont fundés avant les tests
  3. Transactions réelles avec timeout adapté (30s)

agent-qa-security

  1. Configurer gitleaks pour scanner les patterns secrets
  2. Vérifier logs, env, git history
  3. Rapport JSON exploitable par CI/CD

7. Prochaine étape

Phase 6b : Exécution séquentielle des 25 tâches par les agents spécialisés.

Chaque tâche sera exécutée via claude -p avec le prompt complet incluant : - Code contract inline - Invariants applicables - Patterns architecturaux - Instructions de structure

Les commits seront effectués après chaque tâche avec le format :

feat(PD-52): {description}

Agent: {agent-name}
Task: {N}/25
Contract: {contract-id}

Co-Authored-By: {agent-name} <noreply@probatiovault.com>