| name | HOS-XRG-Loop |
| version | 2.0.0 |
| description | Self-Stabilizing Engineering System โ Extended Recursive Generation Loop with dynamic goal adjustment, value density control, and reality feedback loop |
| author | HOS Team |
| tags | ["engineering-loop","goal-management","value-density","self-stabilization","git-workflow"] |
| compatibility | ["claude-code","cursor","windsurf","github-copilot","trae-cn"] |
| license | MIT |
| metadata | {"category":"engineering-workflow","subCategory":"development-loop","risk-level":"low","confidence":0.9} |
HOS-XRG-Loop++ โ Skill Entry (v2.0)
Self-Stabilizing Engineering System โ Extended Recursive Generation Loop++ (Engineering-Stable Edition)
Core Philosophy: Upgrade from rule-driven to goal dynamic adjustment + value density control + reality feedback loop self-stabilizing engineering system.
1. System Architecture
โโโโโโโโโโโโโโโโโโโโโโ
โ Goal Tree Layer โ L0: Intent Layer
โ (ๅจๆ็ฎๆ ๆ ) โ
โโโโโโโโโโฌโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโ
โ Execution Engine โ L1: Execution Layer
โ (CVS Scoring) โ (Commit Value Score)
โโโโโโโโโโฌโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโ
โ Reality Validator โ L2: Reality Layer
โ (Execution Score) โ (็ฐๅฎๅ้ฆ้ญ็ฏ)
โโโโโโโโโโฌโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโ
โ Git Loop Controller โ ่ฟญไปฃๆงๅถๅจ
โโโโโโโโโโโโโโโโโโโโโโ
2. Core Concepts
L0: Intent Layer (ๅจๆ็ฎๆ ๆ )
Goals are no longer static โ they are a Goal Tree with weights that auto-adjust based on reality feedback:
root โ Top-level mission (immutable)
branches โ Goal branches with adjustable weights
- Weights auto-tune after each iteration based on Reality Score
L1: Execution Layer (ไปทๅผๅฏๅบฆๆงๅถ)
Every commit must pass CVS (Commit Value Score) evaluation:
CVS = Impact ร Clarity ร Reversibility รท Complexity
- Impact: Does it change system capability? Does it fix critical issues?
- Clarity: Can it be explained in one sentence? Clear input/output?
- Reversibility: Easy to rollback?
- Complexity Penalty: Introduces new abstraction layers? Increases dependencies?
CVS < threshold โ commit rejected
L2: Reality Layer (็ฐๅฎๅ้ฆๅฑ โ Core Upgrade)
After each commit, validate three things:
- Code execution results โ Does it run? Are errors decreasing?
- Usage behavior feedback โ Is it being called? Actually usable?
- Structural health โ Complexity increasing or decreasing? Coupling changes?
Reality Score continuously declining โ automatic rollback
3. Full Iteration Flow
1. Read Goal Tree โ Load current goal weights
2. Analyze Git State โ Analyze repo state and drift
3. Generate Candidate Patch โ Generate candidate changes
4. Compute CVS โ Value density scoring
5. If CVS < threshold โ Reject, regenerate
6. Apply Patch โ Execute changes
7. Run Reality Validator โ Reality validation
8. Update Goal Tree weight โ Goal weight self-adjustment
9. Check Complexity Debt โ Complexity debt check
10. Decide Next Iteration โ Continue or enter CLEAN MODE
4. Safety Mechanisms
| Mechanism | Description |
|---|
| Anti-Drift Preemption | Predict drift probability before commit, not post-detection |
| Goal Weight Auto-Adjust | Reality Score drives dynamic goal weight adjustment |
| Complexity Debt System | Each commit accumulates complexity debt; force CLEAN MODE when threshold exceeded |
| Reality Rollback | Reality Score continuously declining โ automatic rollback |
5. Directory Structure
HOS-XRG-Loop/
โโโ CLAUDE.md # Skill definition
โโโ SKILL.md # This file โ standardized skill entry
โโโ README.md # Project overview
โโโ xrg_loop++.sh # Main entry script
โโโ config/
โ โโโ goal_tree.yaml # Initial goal tree definition
โ โโโ settings.yaml # System config (thresholds, weights, etc.)
โโโ lib/
โ โโโ intent_layer.sh # L0: Goal tree management
โ โโโ execution_layer.sh # L1: CVS scoring
โ โโโ reality_layer.sh # L2: Reality validator
โ โโโ anti_drift_preempt.sh # Drift prevention engine
โ โโโ complexity_debt.sh # Complexity debt tracking
โ โโโ loop_controller.sh # Git iteration controller
โโโ state/
โโโ goal_weights.json # Current goal weights (real-time state)
โโโ complexity_debt.json # Complexity debt state
โโโ reality_history.json # Reality Score history
โโโ cvs_history.json # CVS scoring history
6. Usage
./xrg_loop++.sh
./xrg_loop++.sh --step
./xrg_loop++.sh --clean
./xrg_loop++.sh --status
./xrg_loop++.sh --cvs-history
./xrg_loop++.sh --rollback <commit-hash>