pmp-gywd 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/LICENSE +27 -0
  2. package/README.md +567 -0
  3. package/bin/install.js +348 -0
  4. package/commands/gywd/add-phase.md +207 -0
  5. package/commands/gywd/anticipate.md +271 -0
  6. package/commands/gywd/bootstrap.md +336 -0
  7. package/commands/gywd/challenge.md +344 -0
  8. package/commands/gywd/check-drift.md +144 -0
  9. package/commands/gywd/complete-milestone.md +106 -0
  10. package/commands/gywd/consider-issues.md +202 -0
  11. package/commands/gywd/context.md +93 -0
  12. package/commands/gywd/create-roadmap.md +115 -0
  13. package/commands/gywd/deps.md +169 -0
  14. package/commands/gywd/digest.md +138 -0
  15. package/commands/gywd/discuss-milestone.md +47 -0
  16. package/commands/gywd/discuss-phase.md +60 -0
  17. package/commands/gywd/execute-plan.md +161 -0
  18. package/commands/gywd/extract-decisions.md +325 -0
  19. package/commands/gywd/health.md +150 -0
  20. package/commands/gywd/help.md +556 -0
  21. package/commands/gywd/history.md +278 -0
  22. package/commands/gywd/impact.md +317 -0
  23. package/commands/gywd/init.md +95 -0
  24. package/commands/gywd/insert-phase.md +227 -0
  25. package/commands/gywd/list-phase-assumptions.md +50 -0
  26. package/commands/gywd/map-codebase.md +84 -0
  27. package/commands/gywd/memory.md +159 -0
  28. package/commands/gywd/new-milestone.md +59 -0
  29. package/commands/gywd/new-project.md +315 -0
  30. package/commands/gywd/pause-work.md +123 -0
  31. package/commands/gywd/plan-fix.md +205 -0
  32. package/commands/gywd/plan-phase.md +93 -0
  33. package/commands/gywd/preview-plan.md +139 -0
  34. package/commands/gywd/profile.md +363 -0
  35. package/commands/gywd/progress.md +317 -0
  36. package/commands/gywd/remove-phase.md +338 -0
  37. package/commands/gywd/research-phase.md +91 -0
  38. package/commands/gywd/resume-work.md +40 -0
  39. package/commands/gywd/rollback.md +179 -0
  40. package/commands/gywd/status.md +42 -0
  41. package/commands/gywd/sync-github.md +234 -0
  42. package/commands/gywd/verify-work.md +71 -0
  43. package/commands/gywd/why.md +251 -0
  44. package/docs/COMMANDS.md +722 -0
  45. package/docs/CONTRIBUTING.md +342 -0
  46. package/docs/EXAMPLES.md +535 -0
  47. package/docs/GETTING-STARTED.md +262 -0
  48. package/docs/README.md +55 -0
  49. package/docs/RELEASING.md +159 -0
  50. package/get-your-work-done/core/agent-patterns.md +331 -0
  51. package/get-your-work-done/core/architecture.md +334 -0
  52. package/get-your-work-done/core/context-model-schema.json +154 -0
  53. package/get-your-work-done/core/decisions-schema.json +193 -0
  54. package/get-your-work-done/core/learning-state-schema.json +133 -0
  55. package/get-your-work-done/core/profile-schema.json +257 -0
  56. package/get-your-work-done/references/adaptive-decomposition.md +175 -0
  57. package/get-your-work-done/references/checkpoints.md +287 -0
  58. package/get-your-work-done/references/confidence-scoring.md +169 -0
  59. package/get-your-work-done/references/continuation-format.md +255 -0
  60. package/get-your-work-done/references/git-integration.md +254 -0
  61. package/get-your-work-done/references/plan-format.md +428 -0
  62. package/get-your-work-done/references/principles.md +157 -0
  63. package/get-your-work-done/references/questioning.md +162 -0
  64. package/get-your-work-done/references/research-pitfalls.md +215 -0
  65. package/get-your-work-done/references/scope-estimation.md +172 -0
  66. package/get-your-work-done/references/tdd.md +263 -0
  67. package/get-your-work-done/templates/codebase/architecture.md +255 -0
  68. package/get-your-work-done/templates/codebase/concerns.md +310 -0
  69. package/get-your-work-done/templates/codebase/conventions.md +307 -0
  70. package/get-your-work-done/templates/codebase/integrations.md +280 -0
  71. package/get-your-work-done/templates/codebase/stack.md +186 -0
  72. package/get-your-work-done/templates/codebase/structure.md +285 -0
  73. package/get-your-work-done/templates/codebase/testing.md +480 -0
  74. package/get-your-work-done/templates/config.json +18 -0
  75. package/get-your-work-done/templates/context.md +161 -0
  76. package/get-your-work-done/templates/continue-here.md +78 -0
  77. package/get-your-work-done/templates/discovery.md +146 -0
  78. package/get-your-work-done/templates/issues.md +32 -0
  79. package/get-your-work-done/templates/milestone-archive.md +123 -0
  80. package/get-your-work-done/templates/milestone-context.md +93 -0
  81. package/get-your-work-done/templates/milestone.md +115 -0
  82. package/get-your-work-done/templates/phase-prompt.md +303 -0
  83. package/get-your-work-done/templates/project.md +184 -0
  84. package/get-your-work-done/templates/research.md +529 -0
  85. package/get-your-work-done/templates/roadmap.md +196 -0
  86. package/get-your-work-done/templates/state.md +210 -0
  87. package/get-your-work-done/templates/summary.md +273 -0
  88. package/get-your-work-done/templates/uat-issues.md +143 -0
  89. package/get-your-work-done/workflows/complete-milestone.md +643 -0
  90. package/get-your-work-done/workflows/create-milestone.md +416 -0
  91. package/get-your-work-done/workflows/create-roadmap.md +481 -0
  92. package/get-your-work-done/workflows/discovery-phase.md +293 -0
  93. package/get-your-work-done/workflows/discuss-milestone.md +236 -0
  94. package/get-your-work-done/workflows/discuss-phase.md +247 -0
  95. package/get-your-work-done/workflows/execute-phase.md +1625 -0
  96. package/get-your-work-done/workflows/list-phase-assumptions.md +178 -0
  97. package/get-your-work-done/workflows/map-codebase.md +434 -0
  98. package/get-your-work-done/workflows/plan-phase.md +488 -0
  99. package/get-your-work-done/workflows/research-phase.md +436 -0
  100. package/get-your-work-done/workflows/resume-project.md +287 -0
  101. package/get-your-work-done/workflows/transition.md +580 -0
  102. package/get-your-work-done/workflows/verify-work.md +202 -0
  103. package/lib/automation/dependency-analyzer.js +635 -0
  104. package/lib/automation/doc-generator.js +643 -0
  105. package/lib/automation/index.js +42 -0
  106. package/lib/automation/test-generator.js +628 -0
  107. package/lib/context/context-analyzer.js +554 -0
  108. package/lib/context/context-cache.js +426 -0
  109. package/lib/context/context-predictor.js +622 -0
  110. package/lib/context/index.js +44 -0
  111. package/lib/memory/confidence-calibrator.js +484 -0
  112. package/lib/memory/feedback-collector.js +551 -0
  113. package/lib/memory/global-memory.js +465 -0
  114. package/lib/memory/index.js +75 -0
  115. package/lib/memory/pattern-aggregator.js +487 -0
  116. package/lib/memory/team-sync.js +501 -0
  117. package/lib/profile/index.js +24 -0
  118. package/lib/profile/pattern-learner.js +303 -0
  119. package/lib/profile/profile-manager.js +445 -0
  120. package/lib/questioning/index.js +49 -0
  121. package/lib/questioning/question-engine.js +311 -0
  122. package/lib/questioning/question-templates.js +315 -0
  123. package/lib/validators/command-validator.js +188 -0
  124. package/lib/validators/index.js +29 -0
  125. package/lib/validators/schema-validator.js +183 -0
  126. package/package.json +61 -0
@@ -0,0 +1,331 @@
1
+ # GYWD v2.0 Agent Orchestration Patterns
2
+
3
+ ## Overview
4
+
5
+ The Agent Orchestrator manages multiple AI agents working together, including
6
+ adversarial agents that challenge assumptions and find flaws.
7
+
8
+ ## Agent Types
9
+
10
+ ### Planning Agents
11
+
12
+ ```yaml
13
+ Architect:
14
+ purpose: High-level system design
15
+ inputs:
16
+ - Requirements
17
+ - Constraints
18
+ - Existing architecture (if brownfield)
19
+ outputs:
20
+ - Component diagram
21
+ - Interface definitions
22
+ - Decision recommendations
23
+ style: Conservative, considers long-term implications
24
+
25
+ Implementer:
26
+ purpose: Detailed task breakdown
27
+ inputs:
28
+ - Architect's design
29
+ - Codebase context
30
+ - Developer profile
31
+ outputs:
32
+ - Task list with dependencies
33
+ - File change predictions
34
+ - Risk assessment per task
35
+ style: Practical, focused on executability
36
+
37
+ Estimator:
38
+ purpose: Complexity and risk assessment
39
+ inputs:
40
+ - Task list
41
+ - Historical data
42
+ - Codebase metrics
43
+ outputs:
44
+ - Complexity scores
45
+ - Risk factors
46
+ - Potential blockers
47
+ style: Data-driven, cautious
48
+ ```
49
+
50
+ ### Execution Agents
51
+
52
+ ```yaml
53
+ Coder:
54
+ purpose: Write implementation code
55
+ inputs:
56
+ - Task specification
57
+ - Relevant decisions
58
+ - Code context
59
+ - Developer profile (for style matching)
60
+ outputs:
61
+ - Code changes
62
+ - Inline documentation
63
+ - Test stubs
64
+ style: Matches developer preferences
65
+
66
+ Tester:
67
+ purpose: Generate and run tests
68
+ inputs:
69
+ - Code changes
70
+ - Test patterns from codebase
71
+ - Coverage requirements
72
+ outputs:
73
+ - Test files
74
+ - Coverage report
75
+ - Edge cases identified
76
+ style: Thorough, adversarial to code
77
+
78
+ Documenter:
79
+ purpose: Generate documentation
80
+ inputs:
81
+ - Code changes
82
+ - Decisions involved
83
+ - Existing doc style
84
+ outputs:
85
+ - API documentation
86
+ - Decision records
87
+ - README updates
88
+ style: Clear, matches existing conventions
89
+ ```
90
+
91
+ ### Review Agents (Adversarial)
92
+
93
+ ```yaml
94
+ Critic:
95
+ purpose: Find logical and design flaws
96
+ personality: Skeptical, detail-oriented
97
+ questions_asked:
98
+ - "What happens if this fails?"
99
+ - "Is this the simplest solution?"
100
+ - "Does this violate any existing decisions?"
101
+ output_style: Specific, actionable critiques
102
+
103
+ Devil's Advocate:
104
+ purpose: Argue for alternative approaches
105
+ personality: Contrarian, creative
106
+ questions_asked:
107
+ - "Why not do it this other way?"
108
+ - "What would [framework X] users do?"
109
+ - "Is there a third option we haven't considered?"
110
+ output_style: Alternative proposals with trade-offs
111
+
112
+ Red Team:
113
+ purpose: Security attack simulation
114
+ personality: Adversarial, security-focused
115
+ attack_vectors:
116
+ - Input validation bypass
117
+ - Authentication weaknesses
118
+ - Data exposure risks
119
+ - Injection vulnerabilities
120
+ output_style: Vulnerability reports with severity
121
+
122
+ Chaos:
123
+ purpose: Edge case and failure mode discovery
124
+ personality: Chaotic, thorough
125
+ scenarios_generated:
126
+ - Null/empty inputs
127
+ - Concurrent access
128
+ - Resource exhaustion
129
+ - Network failures
130
+ - Malformed data
131
+ output_style: Test scenarios with expected behavior
132
+
133
+ Skeptic:
134
+ purpose: Question assumptions and requirements
135
+ personality: Philosophical, questioning
136
+ questions_asked:
137
+ - "Do we actually need this?"
138
+ - "Is the requirement correct?"
139
+ - "What assumptions are we making?"
140
+ output_style: Assumption list with validation suggestions
141
+ ```
142
+
143
+ ## Orchestration Patterns
144
+
145
+ ### Sequential Pattern
146
+ ```
147
+ Use when: Tasks have clear dependencies
148
+ Flow: A → B → C
149
+ Example: Design → Implement → Test
150
+
151
+ ┌─────────┐ ┌─────────┐ ┌─────────┐
152
+ │Architect│ ──► │Implement│ ──► │ Tester │
153
+ └─────────┘ └─────────┘ └─────────┘
154
+ ```
155
+
156
+ ### Parallel Pattern
157
+ ```
158
+ Use when: Tasks are independent
159
+ Flow: A | B | C (concurrent)
160
+ Example: Multiple file changes in different modules
161
+
162
+ ┌─────────┐
163
+ │ Coder A │ ─┐
164
+ └─────────┘ │
165
+ │ ┌──────────┐
166
+ ┌─────────┐ ├─►│Synthesize│
167
+ │ Coder B │ ─┤ └──────────┘
168
+ └─────────┘ │
169
+
170
+ ┌─────────┐ │
171
+ │ Coder C │ ─┘
172
+ └─────────┘
173
+ ```
174
+
175
+ ### Adversarial Pattern
176
+ ```
177
+ Use when: Need to validate decisions/code quality
178
+ Flow: A vs B (competing proposals)
179
+ Example: Two approaches to the same problem
180
+
181
+ ┌─────────────┐ ┌─────────────┐
182
+ │ Approach A │ vs │ Approach B │
183
+ └──────┬──────┘ └──────┬──────┘
184
+ │ │
185
+ └──────────┬───────────┘
186
+
187
+ ┌─────────────┐
188
+ │ Compare │
189
+ │ & Select │
190
+ └─────────────┘
191
+ ```
192
+
193
+ ### Consensus Pattern
194
+ ```
195
+ Use when: Critical decisions need multiple perspectives
196
+ Flow: A + B + C → agreement
197
+ Example: Architecture decisions
198
+
199
+ ┌──────────┐ ┌──────────┐ ┌──────────┐
200
+ │ Security │ │ Perf │ │ UX │
201
+ │ Expert │ │ Expert │ │ Expert │
202
+ └────┬─────┘ └────┬─────┘ └────┬─────┘
203
+ │ │ │
204
+ └─────────────┼─────────────┘
205
+
206
+ ┌─────────────┐
207
+ │ Consensus │
208
+ │ Builder │
209
+ └─────────────┘
210
+ ```
211
+
212
+ ### Challenge Pattern
213
+ ```
214
+ Use when: Running /gywd:challenge
215
+ Flow: Proposal → Multiple adversarial attacks → Synthesis
216
+
217
+ ┌─────────┐
218
+ ┌─────►│ Critic │─────┐
219
+ │ └─────────┘ │
220
+ │ │
221
+ ┌──────────┐ │ ┌─────────┐ │ ┌──────────┐
222
+ │ Proposal │─┼─────►│ Devil's │─────┼─►│ Synthesis│
223
+ └──────────┘ │ │Advocate │ │ └──────────┘
224
+ │ └─────────┘ │
225
+ │ │
226
+ │ ┌─────────┐ │
227
+ ├─────►│Red Team │─────┤
228
+ │ └─────────┘ │
229
+ │ │
230
+ │ ┌─────────┐ │
231
+ └─────►│ Chaos │─────┘
232
+ └─────────┘
233
+ ```
234
+
235
+ ## Agent Communication Protocol
236
+
237
+ ### Message Format
238
+ ```json
239
+ {
240
+ "from": "agent_id",
241
+ "to": "agent_id | broadcast",
242
+ "type": "request | response | critique | proposal",
243
+ "priority": "low | medium | high | critical",
244
+ "payload": {
245
+ "content": "...",
246
+ "context_needed": ["file1", "decision2"],
247
+ "confidence": 0.85
248
+ },
249
+ "metadata": {
250
+ "timestamp": "...",
251
+ "in_response_to": "message_id",
252
+ "thread_id": "..."
253
+ }
254
+ }
255
+ ```
256
+
257
+ ### Conflict Resolution
258
+
259
+ When agents disagree:
260
+
261
+ 1. **Severity Assessment**: How critical is the disagreement?
262
+ 2. **Evidence Gathering**: What data supports each position?
263
+ 3. **Developer Profile Check**: What would the developer prefer?
264
+ 4. **Escalation**: If unresolved, present options to user
265
+
266
+ ```yaml
267
+ resolution_strategies:
268
+ low_severity:
269
+ - Use developer profile preference
270
+ - Default to simpler option
271
+
272
+ medium_severity:
273
+ - Present both options with trade-offs
274
+ - Recommend based on project decisions
275
+
276
+ high_severity:
277
+ - Require explicit user decision
278
+ - Document for future reference
279
+ ```
280
+
281
+ ## Integration with Core Systems
282
+
283
+ ### Decision Graph Integration
284
+ ```
285
+ - Agents query relevant decisions before work
286
+ - Agents propose new decisions from their work
287
+ - Decision conflicts trigger adversarial review
288
+ ```
289
+
290
+ ### Context Intelligence Integration
291
+ ```
292
+ - Orchestrator requests optimal context for each agent
293
+ - Agents report what context was useful
294
+ - Context predictions refined based on agent outcomes
295
+ ```
296
+
297
+ ### Learning System Integration
298
+ ```
299
+ - Agent outcomes recorded for learning
300
+ - Agent selections refined over time
301
+ - Agent personalities adapted to developer
302
+ ```
303
+
304
+ ## Performance Considerations
305
+
306
+ ### Token Budget Management
307
+ ```yaml
308
+ budget_allocation:
309
+ planning_agents: 20%
310
+ execution_agents: 50%
311
+ review_agents: 25%
312
+ synthesis: 5%
313
+
314
+ compression_triggers:
315
+ - Total exceeds 80% budget
316
+ - Individual agent exceeds allocation
317
+ - Redundant information detected
318
+ ```
319
+
320
+ ### Parallelization Strategy
321
+ ```yaml
322
+ parallel_when:
323
+ - Independent file changes
324
+ - Multiple review perspectives needed
325
+ - Exploration of alternatives
326
+
327
+ sequential_when:
328
+ - Output of one needed by another
329
+ - Consensus building required
330
+ - Critical path execution
331
+ ```
@@ -0,0 +1,334 @@
1
+ # GYWD v2.0 Core Architecture
2
+
3
+ ## The Unified System
4
+
5
+ v1.x was commands. v2.0 is intelligence.
6
+
7
+ ```
8
+ ┌─────────────────────────────────────────────────────────────────┐
9
+ │ GYWD v2.0 Core │
10
+ ├─────────────────────────────────────────────────────────────────┤
11
+ │ │
12
+ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
13
+ │ │ Decision │ │ Context │ │ Agent │ │
14
+ │ │ Graph │◄─┤ Intelligence│◄─┤Orchestrator │ │
15
+ │ │ Engine │ │ Engine │ │ │ │
16
+ │ └──────┬──────┘ └──────┬──────┘ └──────┬──────┘ │
17
+ │ │ │ │ │
18
+ │ └────────┬───────┴────────┬───────┘ │
19
+ │ │ │ │
20
+ │ ┌────────▼────────────────▼────────┐ │
21
+ │ │ Continuous Learning System │ │
22
+ │ └───────────────────────────────────┘ │
23
+ │ │ │
24
+ ├──────────────────────────┼──────────────────────────────────────┤
25
+ │ ▼ │
26
+ │ ┌──────────────────────────────────────────────────────────┐ │
27
+ │ │ Command Layer │ │
28
+ │ │ (extract-decisions, why, challenge, anticipate, etc.) │ │
29
+ │ └──────────────────────────────────────────────────────────┘ │
30
+ │ │
31
+ └─────────────────────────────────────────────────────────────────┘
32
+ ```
33
+
34
+ ## Core Components
35
+
36
+ ### 1. Decision Graph Engine
37
+
38
+ The central nervous system. Everything is a decision or derives from one.
39
+
40
+ ```yaml
41
+ responsibilities:
42
+ - Store all extracted decisions
43
+ - Maintain causal links between decisions
44
+ - Answer "why" queries in O(1)
45
+ - Detect decision conflicts
46
+ - Track decision confidence over time
47
+
48
+ data_structure:
49
+ nodes: Decision records
50
+ edges: Causal relationships (A led to B)
51
+ indexes:
52
+ - by_file: Decision[] per file path
53
+ - by_author: Decision[] per contributor
54
+ - by_time: Decision[] chronologically
55
+ - by_tag: Decision[] by category
56
+
57
+ operations:
58
+ - addDecision(decision) → id
59
+ - linkDecisions(parent, child, relationship)
60
+ - queryByFile(path) → Decision[]
61
+ - queryByTimeRange(start, end) → Decision[]
62
+ - findConflicts() → Conflict[]
63
+ - traceDecision(id) → DecisionChain
64
+ ```
65
+
66
+ ### 2. Context Intelligence Engine
67
+
68
+ Manages what the AI knows and why.
69
+
70
+ ```yaml
71
+ responsibilities:
72
+ - Determine optimal context for any task
73
+ - Predict needed context before it's requested
74
+ - Manage context budget (prevent overflow)
75
+ - Learn which context was useful vs. noise
76
+
77
+ subsystems:
78
+ context_selector:
79
+ - Analyzes current task
80
+ - Queries decision graph for relevant decisions
81
+ - Fetches related code patterns
82
+ - Assembles optimal context window
83
+
84
+ context_predictor:
85
+ - Monitors developer activity
86
+ - Predicts next likely needs
87
+ - Pre-fetches context in background
88
+ - Caches frequently-used patterns
89
+
90
+ context_optimizer:
91
+ - Tracks context usage effectiveness
92
+ - Compresses low-value context
93
+ - Expands high-value context
94
+ - Adapts to developer patterns
95
+ ```
96
+
97
+ ### 3. Agent Orchestrator
98
+
99
+ Coordinates multiple AI agents, including adversarial ones.
100
+
101
+ ```yaml
102
+ responsibilities:
103
+ - Spawn specialized agents for tasks
104
+ - Manage agent communication
105
+ - Synthesize multi-agent output
106
+ - Resolve agent conflicts
107
+ - Balance cooperation vs. adversarial review
108
+
109
+ agent_types:
110
+ planning_agents:
111
+ - Architect: High-level design
112
+ - Implementer: Detailed task breakdown
113
+ - Estimator: Complexity and risk assessment
114
+
115
+ execution_agents:
116
+ - Coder: Implementation
117
+ - Tester: Test generation
118
+ - Documenter: Documentation
119
+
120
+ review_agents:
121
+ - Critic: Find flaws
122
+ - Devil's Advocate: Argue alternatives
123
+ - Red Team: Security attacks
124
+ - Chaos: Edge cases
125
+
126
+ orchestration_patterns:
127
+ sequential: A → B → C (dependent tasks)
128
+ parallel: A | B | C (independent tasks)
129
+ adversarial: A vs B (competing proposals)
130
+ consensus: A + B + C → agreement
131
+ ```
132
+
133
+ ### 4. Continuous Learning System
134
+
135
+ Gets smarter with every interaction.
136
+
137
+ ```yaml
138
+ responsibilities:
139
+ - Learn from accepted/rejected suggestions
140
+ - Update developer profile
141
+ - Refine decision confidence scores
142
+ - Improve context predictions
143
+ - Adapt to project patterns
144
+
145
+ learning_signals:
146
+ explicit:
147
+ - User feedback ("this was helpful/not helpful")
148
+ - Accepted vs rejected suggestions
149
+ - Edited vs used-as-is output
150
+
151
+ implicit:
152
+ - Time spent on suggestions
153
+ - Follow-up actions after suggestion
154
+ - Patterns in what user searches for
155
+ - Code changes after AI interaction
156
+
157
+ feedback_loops:
158
+ - Decision extraction → user correction → improved extraction
159
+ - Context prediction → actual need → refined prediction
160
+ - Agent suggestion → user edit → better suggestions
161
+ - Profile inference → behavior observation → profile update
162
+ ```
163
+
164
+ ## Data Flow
165
+
166
+ ### On Project Start
167
+
168
+ ```
169
+ 1. User: /gywd:init or /gywd:new-project
170
+
171
+ 2. Decision Graph Engine: Extract decisions from history
172
+
173
+ 3. Context Intelligence: Build initial context model
174
+
175
+ 4. Learning System: Load/create developer profile
176
+
177
+ 5. Ready: Full project understanding loaded
178
+ ```
179
+
180
+ ### On Any Command
181
+
182
+ ```
183
+ 1. Command received
184
+
185
+ 2. Context Intelligence: Determine optimal context
186
+
187
+ 3. Decision Graph: Load relevant decisions
188
+
189
+ 4. Agent Orchestrator: Spawn appropriate agents
190
+
191
+ 5. Execute with full context awareness
192
+
193
+ 6. Learning System: Record outcomes
194
+ ```
195
+
196
+ ### On Code Change
197
+
198
+ ```
199
+ 1. File change detected
200
+
201
+ 2. Decision Graph: Update affected decisions
202
+
203
+ 3. Context Intelligence: Refresh predictions
204
+
205
+ 4. Learning System: Note patterns
206
+ ```
207
+
208
+ ## Integration Points
209
+
210
+ ### With Git
211
+
212
+ ```yaml
213
+ triggers:
214
+ - pre-commit: Validate against decisions
215
+ - post-commit: Extract new decisions
216
+ - post-merge: Reconcile decision conflicts
217
+
218
+ data_extraction:
219
+ - Commit messages → decisions
220
+ - PR descriptions → decisions
221
+ - Branch patterns → workflow learning
222
+ ```
223
+
224
+ ### With IDE/Editor
225
+
226
+ ```yaml
227
+ events:
228
+ - file_open: Pre-load relevant context
229
+ - cursor_move: Update active context
230
+ - save: Trigger decision extraction
231
+ - error: Load similar past errors
232
+
233
+ context_provision:
234
+ - Relevant decisions for current file
235
+ - Recent changes to related files
236
+ - Known issues in this area
237
+ ```
238
+
239
+ ### With Production
240
+
241
+ ```yaml
242
+ data_import:
243
+ - Error rates per file/function
244
+ - Performance metrics per endpoint
245
+ - Cost attribution per service
246
+ - Incident history per code area
247
+
248
+ context_enhancement:
249
+ - "This code handles 50K requests/day"
250
+ - "Last change here caused P1 incident"
251
+ - "This area costs $400/month in compute"
252
+ ```
253
+
254
+ ## File Structure
255
+
256
+ ```
257
+ .planning/
258
+ ├── core/ # v2.0 core data
259
+ │ ├── decisions.json # Decision graph
260
+ │ ├── context-model.json # Context intelligence state
261
+ │ ├── learning-state.json # Learning system state
262
+ │ └── agent-history.json # Agent interaction history
263
+
264
+ ├── profile/ # Developer digital twin
265
+ │ ├── cognitive.yaml # Thinking patterns
266
+ │ ├── expertise.yaml # Knowledge topology
267
+ │ ├── preferences.yaml # Style preferences
268
+ │ └── history.yaml # Interaction history
269
+
270
+ ├── codebase/ # Codebase understanding
271
+ │ ├── DECISIONS.md # Human-readable decisions
272
+ │ ├── decision-graph.json # Machine-readable graph
273
+ │ └── [existing maps] # Stack, architecture, etc.
274
+
275
+ └── [existing structure] # PROJECT.md, ROADMAP.md, etc.
276
+ ```
277
+
278
+ ## Initialization Sequence
279
+
280
+ ```python
281
+ def initialize_gywd_v2():
282
+ # 1. Load or create core data structures
283
+ decision_graph = DecisionGraph.load_or_create()
284
+ context_engine = ContextIntelligence.load_or_create()
285
+ learning_system = LearningSystem.load_or_create()
286
+ agent_orchestrator = AgentOrchestrator()
287
+
288
+ # 2. If new project, run initial extraction
289
+ if decision_graph.is_empty():
290
+ decisions = extract_decisions_from_history()
291
+ decision_graph.bulk_load(decisions)
292
+
293
+ # 3. Build initial context model
294
+ context_engine.initialize_from_decisions(decision_graph)
295
+
296
+ # 4. Load developer profile
297
+ profile = learning_system.load_profile()
298
+
299
+ # 5. Connect all systems
300
+ core = GYWDCore(
301
+ decisions=decision_graph,
302
+ context=context_engine,
303
+ learning=learning_system,
304
+ agents=agent_orchestrator
305
+ )
306
+
307
+ return core
308
+ ```
309
+
310
+ ## Command Integration
311
+
312
+ Every v1.x command now goes through the core:
313
+
314
+ ```python
315
+ # Before (v1.x): Direct execution
316
+ def execute_command(cmd, args):
317
+ return cmd.run(args)
318
+
319
+ # After (v2.0): Core-mediated execution
320
+ def execute_command(cmd, args):
321
+ # Get optimal context
322
+ context = core.context.get_context_for(cmd, args)
323
+
324
+ # Load relevant decisions
325
+ decisions = core.decisions.get_relevant(cmd, args)
326
+
327
+ # Execute with full awareness
328
+ result = cmd.run(args, context=context, decisions=decisions)
329
+
330
+ # Learn from execution
331
+ core.learning.record(cmd, args, result)
332
+
333
+ return result
334
+ ```