dhurandhar 1.0.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 (54) hide show
  1. package/.dhurandhar-session-start.md +242 -0
  2. package/LICENSE +21 -0
  3. package/README.md +416 -0
  4. package/docs/ARCHITECTURE_V2.md +249 -0
  5. package/docs/DECISION_REGISTRY.md +357 -0
  6. package/docs/IMPLEMENTATION_PERSONAS.md +406 -0
  7. package/docs/PLUGGABLE_STRATEGIES.md +439 -0
  8. package/docs/SYSTEM_OBSERVER.md +433 -0
  9. package/docs/TEST_FIRST_AGILE.md +359 -0
  10. package/docs/architecture.md +279 -0
  11. package/docs/engineering-first-philosophy.md +263 -0
  12. package/docs/getting-started.md +218 -0
  13. package/docs/module-development.md +323 -0
  14. package/docs/strategy-example.md +299 -0
  15. package/docs/test-first-example.md +392 -0
  16. package/package.json +79 -0
  17. package/src/core/README.md +92 -0
  18. package/src/core/agent-instructions/backend-developer.md +412 -0
  19. package/src/core/agent-instructions/devops-engineer.md +372 -0
  20. package/src/core/agent-instructions/dhurandhar-council.md +547 -0
  21. package/src/core/agent-instructions/edge-case-hunter.md +322 -0
  22. package/src/core/agent-instructions/frontend-developer.md +494 -0
  23. package/src/core/agent-instructions/lead-system-architect.md +631 -0
  24. package/src/core/agent-instructions/system-observer.md +319 -0
  25. package/src/core/agent-instructions/test-architect.md +284 -0
  26. package/src/core/module.yaml +54 -0
  27. package/src/core/schemas/design-module-schema.yaml +995 -0
  28. package/src/core/schemas/system-design-map-schema.yaml +324 -0
  29. package/src/modules/example/README.md +130 -0
  30. package/src/modules/example/module.yaml +252 -0
  31. package/tools/cli/commands/audit.js +267 -0
  32. package/tools/cli/commands/config.js +113 -0
  33. package/tools/cli/commands/context.js +170 -0
  34. package/tools/cli/commands/decisions.js +398 -0
  35. package/tools/cli/commands/entity.js +218 -0
  36. package/tools/cli/commands/epic.js +125 -0
  37. package/tools/cli/commands/install.js +172 -0
  38. package/tools/cli/commands/module.js +109 -0
  39. package/tools/cli/commands/service.js +167 -0
  40. package/tools/cli/commands/story.js +225 -0
  41. package/tools/cli/commands/strategy.js +294 -0
  42. package/tools/cli/commands/test.js +277 -0
  43. package/tools/cli/commands/validate.js +107 -0
  44. package/tools/cli/dhurandhar.js +212 -0
  45. package/tools/lib/config-manager.js +170 -0
  46. package/tools/lib/filesystem.js +126 -0
  47. package/tools/lib/module-installer.js +61 -0
  48. package/tools/lib/module-manager.js +149 -0
  49. package/tools/lib/sdm-manager.js +982 -0
  50. package/tools/lib/test-engine.js +255 -0
  51. package/tools/lib/test-templates/api-client.template.js +100 -0
  52. package/tools/lib/test-templates/vitest.config.template.js +37 -0
  53. package/tools/lib/validators/config-validator.js +113 -0
  54. package/tools/lib/validators/module-validator.js +137 -0
@@ -0,0 +1,249 @@
1
+ # Dhurandhar v2.0 Architecture
2
+
3
+ ## System Overview
4
+
5
+ ```
6
+ ┌─────────────────────────────────────────────────────────────────┐
7
+ │ ENGINEERING-FIRST LAYER │
8
+ │ Principle: Direct action, 3 questions max, no justifications │
9
+ └─────────────────────────┬───────────────────────────────────────┘
10
+
11
+ ┌─────────────────────────▼───────────────────────────────────────┐
12
+ │ CLI INTERFACE │
13
+ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
14
+ │ │ install │ │ service │ │ entity │ │ context │ │
15
+ │ │ (3 Qs) │ │ (direct) │ │ (direct) │ │(rehydrate)│ │
16
+ │ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │
17
+ └─────────────────────────┬───────────────────────────────────────┘
18
+
19
+ ┌─────────────────────────▼───────────────────────────────────────┐
20
+ │ CORE LIBRARIES │
21
+ │ ┌─────────────────┐ ┌─────────────────┐ │
22
+ │ │ SDM Manager │ │ Config Manager │ │
23
+ │ │ (persistence) │ │ (framework) │ │
24
+ │ └─────────────────┘ └─────────────────┘ │
25
+ │ ┌─────────────────┐ ┌─────────────────┐ │
26
+ │ │ Module Manager │ │ Validators │ │
27
+ │ └─────────────────┘ └─────────────────┘ │
28
+ └─────────────────────────┬───────────────────────────────────────┘
29
+
30
+ ┌─────────────────────────▼───────────────────────────────────────┐
31
+ │ PERSISTENT STATE (Project Root) │
32
+ │ ┌──────────────────────────────────────────────────┐ │
33
+ │ │ SYSTEM_DESIGN_MAP.yaml │ │
34
+ │ │ - Metadata (project, architecture) │ │
35
+ │ │ - Tech Stack (languages, frameworks, DBs) │ │
36
+ │ │ - User Types (roles, permissions, auth) │ │
37
+ │ │ - Entities (attributes, relationships) │ │
38
+ │ │ - Services (scope, stack, API, dependencies) │ │
39
+ │ │ - Communication (protocols, patterns) │ │
40
+ │ │ - Infrastructure (deployment, components) │ │
41
+ │ │ - Build Config (tools, CI/CD) │ │
42
+ │ └──────────────────────────────────────────────────┘ │
43
+ └──────────────────────────────────────────────────────────────────┘
44
+ ```
45
+
46
+ ## Data Flow
47
+
48
+ ### Service Addition Flow
49
+
50
+ ```
51
+ User: "dhurandhar service add 'auth: JWT auth'"
52
+
53
+
54
+ CLI (service.js)
55
+
56
+ ├─→ Parse quick spec: name="auth", scope="JWT auth"
57
+
58
+ ├─→ Check SDM for context
59
+ │ └─→ Primary language: Go
60
+ │ └─→ Existing services: 0
61
+
62
+ ├─→ Ask technical questions (max 3)
63
+ │ 1. Framework? → Echo (default for Go)
64
+ │ 2. Database? → PostgreSQL (default)
65
+
66
+ ├─→ Build service object
67
+ │ {
68
+ │ name: "auth",
69
+ │ scope: "JWT auth",
70
+ │ tech_stack: { language: Go, framework: Echo, db: PostgreSQL },
71
+ │ api: { type: rest, port: 8080 },
72
+ │ }
73
+
74
+ ├─→ SDMManager.addService()
75
+ │ ├─→ Load SYSTEM_DESIGN_MAP.yaml
76
+ │ ├─→ Add service to services[]
77
+ │ ├─→ Update tech_stack summary
78
+ │ ├─→ Save SYSTEM_DESIGN_MAP.yaml
79
+
80
+ └─→ Output: "✓ auth-service added: Go/Echo/PostgreSQL on port 8080"
81
+ ```
82
+
83
+ ### Context Rehydration Flow
84
+
85
+ ```
86
+ [New Session Starts]
87
+
88
+
89
+ Agent/Developer runs: "dhurandhar context"
90
+
91
+
92
+ CLI (context.js)
93
+
94
+ ├─→ SDMManager.getRehydrationContext()
95
+ │ └─→ Read SYSTEM_DESIGN_MAP.yaml
96
+
97
+ ├─→ Display architecture summary
98
+ │ - 3 services (Go/Echo/PostgreSQL)
99
+ │ - 5 entities
100
+ │ - Microservices architecture
101
+
102
+ └─→ Ready for work (0 rediscovery time)
103
+ ```
104
+
105
+ ## Schema Hierarchy
106
+
107
+ ```
108
+ ┌─────────────────────────────────────────────────────────────┐
109
+ │ design-module-schema.yaml (v2.0) │
110
+ │ Defines structure for design modules │
111
+ │ │
112
+ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
113
+ │ │ User Types │ │ Entities │ │ Services │ │
114
+ │ │ │ │ │ │ │ │
115
+ │ │ - role │ │ - name │ │ - name │ │
116
+ │ │ - permissions│ │ - attributes │ │ - scope │ │
117
+ │ │ - auth │ │ - relations │ │ - tech_stack │ │
118
+ │ └──────────────┘ └──────────────┘ └──────────────┘ │
119
+ └─────────────────────────────────────────────────────────────┘
120
+
121
+
122
+ ┌─────────────────────────────────────────────────────────────┐
123
+ │ system-design-map-schema.yaml │
124
+ │ Defines structure for persistent architecture state │
125
+ │ │
126
+ │ ┌─────────────────────────────────────────────────┐ │
127
+ │ │ metadata + tech_stack + user_types + │ │
128
+ │ │ entities + services + communication + │ │
129
+ │ │ infrastructure + build_config │ │
130
+ │ └─────────────────────────────────────────────────┘ │
131
+ └─────────────────────────────────────────────────────────────┘
132
+
133
+
134
+ ┌─────────────────────────────────────────────────────────────┐
135
+ │ SYSTEM_DESIGN_MAP.yaml (instance) │
136
+ │ Actual architecture state for a specific project │
137
+ └─────────────────────────────────────────────────────────────┘
138
+ ```
139
+
140
+ ## Agent Interaction Model
141
+
142
+ ```
143
+ ┌──────────────────────────────────────────────────────────┐
144
+ │ AI Agent (Claude/Augment/Cursor) │
145
+ │ │
146
+ │ On Session Start: │
147
+ │ 1. Read .dhurandhar-agent-config.md │
148
+ │ 2. Load SYSTEM_DESIGN_MAP.yaml │
149
+ │ 3. Parse architecture context │
150
+ │ 4. Ready (context rehydrated) │
151
+ └──────────────────┬───────────────────────────────────────┘
152
+
153
+
154
+ ┌──────────────────────────────────────────────────────────┐
155
+ │ User Request Handling │
156
+ │ │
157
+ │ User: "Add caching to user-service" │
158
+ │ │
159
+ │ Agent: │
160
+ │ ├─→ Check SDM: user-service exists │
161
+ │ ├─→ Check SDM: current stack is Go/Echo/PostgreSQL │
162
+ │ ├─→ Ask: "Cache: Redis or Memcached?" (Question 1/3) │
163
+ │ ├─→ User: "Redis" │
164
+ │ ├─→ Update SDM: Add Redis to infrastructure │
165
+ │ └─→ Confirm: "✓ Redis added to user-service" │
166
+ │ │
167
+ │ Total questions: 1 (well under 3-question limit) │
168
+ └──────────────────────────────────────────────────────────┘
169
+ ```
170
+
171
+ ## Anti-Pattern Prevention
172
+
173
+ ```
174
+ ┌────────────────────────────────────────────────────────────┐
175
+ │ BUSINESS-PROCESS HEAVY ❌ │
176
+ │ │
177
+ │ User: "Add auth service" │
178
+ │ Agent: "Why do you need authentication?" │
179
+ │ User: "For login" │
180
+ │ Agent: "What are your requirements?" │
181
+ │ User: "JWT tokens" │
182
+ │ Agent: "Have you considered OAuth2?" │
183
+ │ ... │
184
+ │ [15 minutes later] │
185
+ │ Agent: "OK, adding service..." │
186
+ │ │
187
+ │ Result: COGNITIVE FATIGUE ⚠ │
188
+ └────────────────────────────────────────────────────────────┘
189
+
190
+ ┌────────────────────────────────────────────────────────────┐
191
+ │ ENGINEERING-FIRST ✅ │
192
+ │ │
193
+ │ User: "Add auth service" │
194
+ │ Agent: [Checks SDM: primary language = Go] │
195
+ │ Agent: "Framework: Echo, Gin, or Fiber?" │
196
+ │ User: "Echo" │
197
+ │ Agent: "✓ auth-service added: Go/Echo/PostgreSQL:8080" │
198
+ │ │
199
+ │ Result: FAST & FOCUSED ✓ │
200
+ └────────────────────────────────────────────────────────────┘
201
+ ```
202
+
203
+ ## Comparison: v1.0 vs v2.0
204
+
205
+ ```
206
+ ┌─────────────────┬──────────────────┬──────────────────┐
207
+ │ Dimension │ v1.0 (Bmad) │ v2.0 (Eng-1st) │
208
+ ├─────────────────┼──────────────────┼──────────────────┤
209
+ │ Philosophy │ Modular skills │ Tech specs │
210
+ │ Interaction │ Exploratory │ Direct action │
211
+ │ Questions │ Unlimited │ Max 3 │
212
+ │ Context │ Lost b/w sessions│ Persistent (SDM) │
213
+ │ Focus │ Organization │ Implementation │
214
+ │ Speed │ Hours │ Minutes │
215
+ │ Cognitive load │ High │ Minimal │
216
+ └─────────────────┴──────────────────┴──────────────────┘
217
+ ```
218
+
219
+ ## Key Principles Enforced
220
+
221
+ 1. **Context Rehydration First**
222
+ - Always read SYSTEM_DESIGN_MAP.yaml before responding
223
+ - Load complete architecture state
224
+ - No rediscovery needed
225
+
226
+ 2. **Direct Action Over Discussion**
227
+ - User requests → immediate technical clarification
228
+ - No "why" questions
229
+ - No alternative exploration (unless requested)
230
+
231
+ 3. **Technical Specifications Only**
232
+ - Language, framework, database
233
+ - API type, ports, protocols
234
+ - Entity attributes, relationships
235
+ - Service dependencies
236
+
237
+ 4. **Three-Question Limit**
238
+ - Maximum 3 technical questions per component
239
+ - Use SDM context to minimize questions
240
+ - Auto-select sensible defaults
241
+
242
+ 5. **Brief Confirmations**
243
+ - One-line status updates
244
+ - No verbose explanations
245
+ - Implementation over discussion
246
+
247
+ ---
248
+
249
+ **Dhurandhar v2.0: Persistent Context + Direct Action = Zero Cognitive Fatigue**
@@ -0,0 +1,357 @@
1
+ # Technical Decision Registry
2
+
3
+ ## Overview
4
+
5
+ Dhurandhar v2.5 introduces the **Technical Decision Registry** - a Bmad-Method-inspired "stock of decisions" that eliminates cognitive fatigue by storing all technical conventions ONCE and applying them automatically everywhere.
6
+
7
+ ## Philosophy
8
+
9
+ ### Traditional Approach (Anti-Pattern)
10
+
11
+ ```
12
+ Developer 1: "Should classes be PascalCase or snake_case?"
13
+ Team: [30 minute debate]
14
+ Decision: "PascalCase"
15
+
16
+ [Two weeks later]
17
+
18
+ Developer 2: "Should classes be PascalCase or snake_case?"
19
+ Team: "Didn't we already decide this?"
20
+ Developer 2: "Where is it documented?"
21
+ Team: [Another 30 minute debate]
22
+
23
+ [Repeated for every basic convention]
24
+ ```
25
+
26
+ ### Dhurandhar Approach
27
+
28
+ ```
29
+ Lead System Architect: "Stock all decisions during install"
30
+
31
+ dhurandhar decisions --stock
32
+
33
+ ? Class naming: PascalCase
34
+ ? Function naming: camelCase
35
+ ? Database tables: snake_case
36
+ ? Error format: Standard envelope
37
+ ? Logging: Structured JSON
38
+
39
+ ✓ All decisions stocked
40
+
41
+ [Never asked again. Automatically applied to all code.]
42
+ ```
43
+
44
+ ## Decision Categories
45
+
46
+ ### 1. Naming Conventions
47
+
48
+ **Purpose**: Eliminate debates about case styles, file names, prefixes
49
+
50
+ **Decisions Stocked**:
51
+ ```yaml
52
+ naming_conventions:
53
+ case_styles:
54
+ classes: PascalCase # UserService, OrderController
55
+ functions: camelCase # getUserById, createOrder
56
+ variables: camelCase # userId, orderTotal
57
+ constants: SCREAMING_SNAKE_CASE # MAX_RETRIES, API_URL
58
+ database_tables: snake_case # users, order_items
59
+ database_columns: snake_case # user_id, created_at
60
+ api_endpoints: kebab-case # /api/v1/user-profiles
61
+
62
+ file_patterns:
63
+ components: "ComponentName.tsx"
64
+ services: "ServiceName.service.ts"
65
+ models: "ModelName.model.ts"
66
+ tests: "filename.test.ts"
67
+
68
+ prefixes_suffixes:
69
+ interfaces: "I" # IUserService
70
+ abstract_classes: "Abstract" # AbstractRepository
71
+ test_functions: "test_" # test_user_creation
72
+ private_methods: "_" # _validateInput
73
+ ```
74
+
75
+ **Auto-Applied**:
76
+ - Backend Developer generates class: `UserService` (PascalCase)
77
+ - Backend Developer generates table: `users` (snake_case)
78
+ - Frontend Developer generates endpoint call: `/api/v1/user-profiles` (kebab-case)
79
+
80
+ ### 2. Design Patterns
81
+
82
+ **Purpose**: Mandate architectural patterns as implementation constraints
83
+
84
+ **Decisions Stocked**:
85
+ ```yaml
86
+ design_patterns:
87
+ data_access: repository_pattern
88
+ service_layer: service_classes
89
+ dependency_injection: constructor_injection
90
+ validation: dto_validation
91
+ cqrs: false
92
+ event_sourcing: false
93
+ domain_driven_design: false
94
+
95
+ service_specific_patterns:
96
+ - service: order-service
97
+ pattern: CQRS
98
+ rationale: "High read/write volume requires separate models"
99
+ ```
100
+
101
+ **Auto-Applied**:
102
+ - Backend Developer MUST use Repository pattern for all data access
103
+ - Backend Developer MUST use constructor injection for dependencies
104
+ - order-service specifically MUST implement CQRS (separate read/write models)
105
+
106
+ ### 3. Error & Response Standards
107
+
108
+ **Purpose**: Standardize all API error responses and success envelopes
109
+
110
+ **Decisions Stocked**:
111
+ ```yaml
112
+ error_response_standards:
113
+ error_code_mapping:
114
+ validation_error: 400
115
+ authentication_error: 401
116
+ authorization_error: 403
117
+ not_found_error: 404
118
+ conflict_error: 409
119
+ internal_error: 500
120
+
121
+ response_envelope:
122
+ success_format: '{"data": {}, "meta": {"request_id": "", "timestamp": ""}}'
123
+ error_format: '{"error": {"code": "", "message": "", "details": []}, "meta": {"request_id": "", "timestamp": ""}}'
124
+ include_request_id: true
125
+ include_timestamp: true
126
+
127
+ error_detail_level: standard
128
+ ```
129
+
130
+ **Auto-Applied**:
131
+ - Backend Developer returns: `{"data": {...}, "meta": {"request_id": "abc123", "timestamp": "2024-01-15T10:30:00Z"}}`
132
+ - Backend Developer returns 400 for validation errors, 401 for auth errors, etc.
133
+ - Frontend Developer expects: `response.data` for success, `response.error` for errors
134
+
135
+ ### 4. Observability Standards
136
+
137
+ **Purpose**: Standardize logging, tracing, and metrics across all services
138
+
139
+ **Decisions Stocked**:
140
+ ```yaml
141
+ observability_standards:
142
+ logging:
143
+ levels: [DEBUG, INFO, WARN, ERROR]
144
+ structured_logging: true
145
+ mandatory_fields: [trace_id, correlation_id, service_name, timestamp, level]
146
+ sensitive_data_masking: true
147
+
148
+ tracing:
149
+ trace_id_header: X-Trace-ID
150
+ correlation_id_header: X-Correlation-ID
151
+ span_naming_format: "service.operation"
152
+
153
+ metrics:
154
+ naming_format: "service_name_metric_name_unit"
155
+ mandatory_labels: [service, environment, version]
156
+ latency_buckets: [0.01, 0.05, 0.1, 0.5, 1, 5, 10]
157
+ ```
158
+
159
+ **Auto-Applied**:
160
+ - Backend Developer logs: `{"trace_id": "...", "correlation_id": "...", "service_name": "order-service", "timestamp": "...", "level": "INFO", "message": "..."}`
161
+ - DevOps Engineer configures: `X-Trace-ID` and `X-Correlation-ID` headers in all services
162
+ - DevOps Engineer creates metrics: `order_service_requests_total`, `auth_service_latency_seconds`
163
+
164
+ ## CLI Commands
165
+
166
+ ### Stock All Decisions (Recommended - One-Time Setup)
167
+
168
+ ```bash
169
+ dhurandhar decisions --stock
170
+ ```
171
+
172
+ **Interactive Setup**:
173
+ ```
174
+ 📦 Stock All Technical Decisions
175
+
176
+ 1/4: Naming Conventions
177
+ ? Class naming style: PascalCase
178
+ ? Function naming style: camelCase
179
+ ? Database table naming: snake_case
180
+ ? API endpoint naming: kebab-case
181
+
182
+ 2/4: Design Patterns
183
+ ? Data access pattern: repository_pattern
184
+ ? Dependency injection: constructor_injection
185
+ ? Validation strategy: dto_validation
186
+
187
+ 3/4: Error Standards
188
+ ? Error response format: Standard Envelope
189
+ ? Include request_id: yes
190
+ ? Include timestamp: yes
191
+
192
+ 4/4: Observability Standards
193
+ ? Structured JSON logging: yes
194
+ ? Trace ID header: X-Trace-ID
195
+ ? Correlation ID header: X-Correlation-ID
196
+
197
+ ✓ All decisions stocked
198
+
199
+ These standards will be:
200
+ - Automatically applied to all new code
201
+ - Enforced by drift detection
202
+ - Used as constraints by implementation personas
203
+ ```
204
+
205
+ ### Show Registered Decisions
206
+
207
+ ```bash
208
+ dhurandhar decisions --show
209
+ ```
210
+
211
+ **Output**:
212
+ ```
213
+ 📋 Technical Decision Registry
214
+
215
+ Naming Conventions:
216
+ Case Styles:
217
+ classes: PascalCase
218
+ functions: camelCase
219
+ database_tables: snake_case
220
+ api_endpoints: kebab-case
221
+ File Patterns:
222
+ components: ComponentName.tsx
223
+ services: ServiceName.service.ts
224
+
225
+ Design Patterns:
226
+ data_access: repository_pattern
227
+ dependency_injection: constructor_injection
228
+ validation: dto_validation
229
+
230
+ Error Response Standards:
231
+ HTTP Status Mapping:
232
+ validation_error: 400
233
+ authentication_error: 401
234
+ not_found_error: 404
235
+ Response Envelope:
236
+ Success: {"data": {}, "meta": {...}}
237
+ Error: {"error": {...}, "meta": {...}}
238
+
239
+ Observability Standards:
240
+ Logging:
241
+ Structured: yes
242
+ Mandatory Fields: trace_id, correlation_id, service_name
243
+ Tracing:
244
+ Trace ID Header: X-Trace-ID
245
+ ```
246
+
247
+ ### Set Individual Decision Category
248
+
249
+ ```bash
250
+ dhurandhar decisions --set naming
251
+ dhurandhar decisions --set patterns
252
+ dhurandhar decisions --set errors
253
+ dhurandhar decisions --set observability
254
+ ```
255
+
256
+ ## Integration with Workflow
257
+
258
+ ### During Install
259
+
260
+ ```bash
261
+ dhurandhar install
262
+
263
+ ? Project identifier: my-platform
264
+ ? Architecture: microservices
265
+ ? Primary language: go
266
+
267
+ ? Stock technical decisions now? yes
268
+
269
+ [Runs: dhurandhar decisions --stock]
270
+
271
+ ✓ Framework installed
272
+ ✓ Decisions stocked
273
+ ```
274
+
275
+ ### During Service Add
276
+
277
+ ```bash
278
+ dhurandhar service add "user: User management"
279
+
280
+ [Reads decision_registry]
281
+ → classes: PascalCase
282
+ → data_access: repository_pattern
283
+ → error_envelope: {"data": {}, "meta": {}}
284
+
285
+ [Generates service with constraints]
286
+ ✓ user-service added
287
+ ✓ Decision constraints applied:
288
+ - Classes: PascalCase (UserService, UserRepository)
289
+ - Pattern: Repository pattern enforced
290
+ - Errors: Standard envelope format
291
+
292
+ [Delegates to Backend Developer with IMMUTABLE constraints]
293
+ ```
294
+
295
+ ### Implementation Layer Receives Constraints
296
+
297
+ **Backend Developer**:
298
+ ```yaml
299
+ # Received from decision_registry (IMMUTABLE)
300
+ constraints:
301
+ naming:
302
+ classes: PascalCase
303
+ functions: camelCase
304
+ patterns:
305
+ data_access: repository_pattern
306
+ dependency_injection: constructor_injection
307
+ errors:
308
+ envelope: '{"data": {}, "meta": {}}'
309
+ logging:
310
+ mandatory_fields: [trace_id, service_name, timestamp]
311
+ ```
312
+
313
+ **Backend Developer MUST**:
314
+ - Name classes: `UserService`, `OrderRepository` (PascalCase)
315
+ - Implement Repository pattern: `UserRepository.findById()`
316
+ - Use constructor injection: `constructor(userRepo: UserRepository)`
317
+ - Return errors: `{"error": {...}, "meta": {...}}`
318
+ - Log with: `{trace_id, service_name, timestamp, ...}`
319
+
320
+ **NO DEVIATION. These are architectural constraints.**
321
+
322
+ ## Benefits
323
+
324
+ ### 1. Zero Repeated Decisions
325
+
326
+ **Before**: Every developer asks "PascalCase or snake_case?" (50+ times/project)
327
+ **After**: Asked once during `decisions --stock`, never again
328
+
329
+ ### 2. Immediate Onboarding
330
+
331
+ New developer:
332
+ ```bash
333
+ dhurandhar decisions --show
334
+ ```
335
+ "Ah, we use PascalCase for classes, Repository pattern for data access, standard error envelope. Got it."
336
+
337
+ ### 3. Automatic Enforcement
338
+
339
+ System Observer detects:
340
+ ```
341
+ Code: class user_service (snake_case)
342
+ Decision: classes = PascalCase
343
+
344
+ Violation: user_service should be UserService
345
+ ```
346
+
347
+ ### 4. Implementation Consistency
348
+
349
+ All Backend Developers use same patterns.
350
+ All APIs use same error format.
351
+ All logs have same structure.
352
+
353
+ **100% consistency across codebase.**
354
+
355
+ ---
356
+
357
+ **Dhurandhar v2.5: Stock Decisions Once, Apply Everywhere**