--- name: p6-ai-planner description: An internal Primavera-P6-style planning engine. Parses P6 XER files, runs a Critical Path Method (CPM) forward/backward pass to compute early/late dates, total float and the critical path, performs Monte Carlo schedule-risk analysis (P50/P80/P90 completion), basic resource leveling, owner-vs-internal (target vs baseline) schedule comparison and claims/delay (window) analysis. Use when a user provides an XER file, a list of activities with durations & relationships, or asks for CPM, float, critical path, schedule risk, P80 date, resource leveling, or delay analysis. ---
📅 p6-ai-planner — محرّك تخطيط بديل لـ Primavera P6
> بديل داخلي مبني بترسانتنا (بدلاً من ALICE/nPlan التجارية): XER parser + CPM + Monte Carlo + resource leveling + delay analysis.
> مرجع XER الإلزامي: /data/.openclaw/workspace/XER_BUILD_PROTOCOL.md (قبل بناء أي XER — schema 8.2.0, CP1252, CRLF).
---
🎯 القدرات (Capabilities)
1. XER Parser — يقرأ ملف P6 XER فعلياً (TASK, TASKPRED, PROJECT tables) ويستخرج الأنشطة والعلاقات والمدد. 2. CPM Engine — forward pass (ES/EF) + backward pass (LS/LF) + total float + free float + critical path. 3. Monte Carlo schedule risk — توزيع مثلثي/PERT لكل نشاط → P50/P80/P90 لتاريخ الإنجاز. 4. Resource Leveling — تسوية أولية (greedy) لمورد محدود السعة. 5. Owner vs Internal — مقارنة برنامجين (baseline vs target) وإبراز الانزياحات (slippage). 6. Claims / Delay (windows) analysis — تحليل نوافذ زمنية: as-planned vs as-built impact على الحرج.
> العلاقات المدعومة: FS, SS, FF, SF + lag.
---
🛠️ السكربت (Script)
scripts/p6_planner.py
الأوامر (Sub-commands)
bash
1) تحليل XER فعلي: CPM + critical path
python3 scripts/p6_planner.py cpm --xer project.xer2) CPM من JSON بسيط (للأنشطة بدون P6)
python3 scripts/p6_planner.py cpm --json activities.json3) Monte Carlo (P50/P80/P90)
python3 scripts/p6_planner.py risk --json activities.json --runs 10000 --variance 0.254) Resource leveling
python3 scripts/p6_planner.py level --json activities.json --capacity 10 --resource crew5) Owner vs Internal comparison
python3 scripts/p6_planner.py compare --baseline base.json --target tgt.json6) Demo (built-in 7-activity network — no input file needed)
python3 scripts/p6_planner.py demopython3 scripts/p6_planner.py --help
صيغة JSON للأنشطة (activities.json)
json
{
"activities": [
{"id": "A", "name": "Mobilize", "dur": 5, "preds": []},
{"id": "B", "name": "Excavate", "dur": 10, "preds": [{"id": "A", "type": "FS", "lag": 0}]},
{"id": "C", "name": "Foundation", "dur": 15, "preds": [{"id": "B", "type": "FS", "lag": 2}]}
]
}
---
📐 معادلات CPM (داخل code blocks — لا LaTeX)
Forward pass:
ES(act) = max over preds of ( EF(pred) + lag ) [FS]
EF(act) = ES(act) + dur(act)Backward pass:
LF(act) = min over succs of ( LS(succ) - lag ) [FS]
LS(act) = LF(act) - dur(act)
Total Float TF = LS - ES = LF - EF
Free Float FF = min(ES(succ)) - EF(act)
Critical path = activities with TF = 0
🔗 التكامل
- المدخل من
civil-methodology-engine(construction sequence) → CPM network. - المخرج إلى بناء XER عبر
XER_BUILD_PROTOCOL.md(لا تبنِ XER من الصفر). - تحليل التأخير يغذّي
claims-engineering.
⚠️ قواعد
- لا تبنِ XER من الصفر — انسخ template موثوق (BUILD_PROTOCOL).
- Monte Carlo: استخدم PERT (optimistic/most-likely/pessimistic) عند توفّر بيانات؛ وإلا variance افتراضي.