Repository navigation
Expand file tree
/
Copy pathlogic_only.patch
More file actions
693 lines (693 loc) · 29 KB
/
Copy pathlogic_only.patch
File metadata and controls
693 lines (693 loc) · 29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
diff --git a/.github/workflows/opencode.yml b/.github/workflows/opencode.yml
new file mode 100644
index 0000000..bf5f7df
--- /dev/null
+++ b/.github/workflows/opencode.yml
@@ -0,0 +1,30 @@
+name: opencode-review
+
+on:
+ pull_request:
+ types: [opened, synchronize, reopened, ready_for_review]
+
+jobs:
+ review:
+ runs-on: ubuntu-latest
+ permissions:
+ id-token: write
+ contents: write
+ pull-requests: write
+ issues: write
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ - uses: anomalyco/opencode/github@latest
+ env:
+ ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ model: anthropic/claude-3-5-sonnet-latest
+ use_github_token: true
+ prompt: |
+ Review this pull request:
+ - Check for code quality issues
+ - Look for potential bugs
+ - Suggest improvements
diff --git a/.gitignore b/.gitignore
index babb2ac..c00a7f1 100644
Binary files a/.gitignore and b/.gitignore differ
diff --git a/AntigravityMobile b/AntigravityMobile
new file mode 160000
index 0000000..3ac39e3
--- /dev/null
+++ b/AntigravityMobile
@@ -0,0 +1 @@
+Subproject commit 3ac39e3fe73fc39e01254c2483dcdaa8c4e61858
diff --git a/docs/brain/implementation_plan.md b/docs/brain/implementation_plan.md
index 81114b8..f6fd30e 100644
--- a/docs/brain/implementation_plan.md
+++ b/docs/brain/implementation_plan.md
@@ -1,5 +1,4 @@
-# Implementation Plan: Build-984 Source Hardening
-**Version**: v1.0-b984 | **Author**: P3 ARCHITECT (Antigravity acting as Architect)
-**Date**: 2026-05-05 | **Branch**: build-984-source-hardening
-**Target File**: src/V12_002.Lifecycle.cs (ONLY -- no other files)
-**BUILD_TAG**: 1111.005-v28.0-b984
+# Implementation Plan: Phase 5 Distributed Pipeline
+**Version**: v1.0-b985 | **Author**: P3 ARCHITECT (Claude)
+**Date**: 2026-05-06 | **Branch**: phase-5-distributed-pipeline
+**BUILD_TAG**: 1111.006-v28.0-b984-complete
@@ -9,534 +8,3 @@
-## Mission
-
-Remediate 12 pre-existing source defects (F-01 to F-12) identified during Phase 4 Arena audit.
-All defects are in `src/V12_002.Lifecycle.cs`. Zero logic mutations. Guards, telemetry, ordering only.
-
----
-
-## Finding Catalogue
-
-| ID | Sev | Handler | Lines | Description |
-|:---|:---|:---|:---|:---|
-| F-01 | MED | Configure | 260-269 | Layout invariant throws InvalidOperationException -- crashes Configure cold |
-| F-02 | HIGH | DataLoaded | 345 | BarsArray[1] accessed without BarsArray.Count guard |
-| F-03 | LOW | Configure | 294-297 | AddDataSeries called AFTER throwing code -- ordering risk |
-| F-04 | LOW | DataLoaded | 341 | Silent ConfiguredTargetCount mutation -- no telemetry |
-| F-05 | MED | DataLoaded | 387-401 | _dataLoadedComplete set true BEFORE StickyState/IPC -- startup gate fires too early |
-| F-06 | LOW | DataLoaded | 371 | Stale "REPAIRED" banner hardcoded -- not BUILD_TAG-conditional |
-| F-07 | MED | Terminated | 462-469 | Dispatcher.InvokeAsync in Terminated has no _isTerminating guard inside lambda |
-| F-08 | MED | Terminated | 475 | CancelAllV12GtcOrders called AFTER _isTerminating=true but BEFORE DrainQueues -- ordering ambiguity |
-| F-09 | LOW | Terminated | 514-532 | Dict .Clear() called after CancelAllV12GtcOrders -- orders reference live dict during cancel |
-| F-10 | LOW | Realtime | 406-409 | Banner block uses non-ASCII box chars (pipe/dash) -- ASCII gate risk |
-| F-11 | LOW | ConnectionUpdate | 551 | EnableSIMA guard in ProcessOnConnectionStatusUpdate -- silent no-op when SIMA toggled off mid-session |
-| F-12 | LOW | MarketData | 581-593 | OnMarketData fires PublishUiSnapshot on every tick -- no rate gate |
-
----
-
-## Surgical Repairs
-
-### F-01: Layout Invariant -- Graceful Degradation (lines 260-269)
-
-**FIND**:
-```csharp
- // Static assert: Shadow must be the last 8 bytes of FleetDispatchSlot (ADR-016)
- {
- int _slotSize = System.Runtime.InteropServices.Marshal.SizeOf(typeof(FleetDispatchSlot));
- int _shadowOffset = System.Runtime.InteropServices.Marshal.OffsetOf(typeof(FleetDispatchSlot), "Shadow").ToInt32();
- if (_slotSize != 64 || _shadowOffset != 56)
- {
- throw new InvalidOperationException(string.Format(
- "FleetDispatchSlot layout invariant violated: size={0}, shadowOffset={1}; expected size=64, offset=56",
- _slotSize, _shadowOffset));
- }
- }
-```
-
-**REPLACE WITH**:
-```csharp
- // Static assert: Shadow must be the last 8 bytes of FleetDispatchSlot (ADR-016)
- // B984-F01: Degrade gracefully instead of crashing Configure cold.
- {
- int _slotSize = System.Runtime.InteropServices.Marshal.SizeOf(typeof(FleetDispatchSlot));
- int _shadowOffset = System.Runtime.InteropServices.Marshal.OffsetOf(typeof(FleetDispatchSlot), "Shadow").ToInt32();
- if (_slotSize != 64 || _shadowOffset != 56)
- {
- Print(string.Format("[PHOTON CRITICAL] FleetDispatchSlot layout invariant violated: size={0}, shadowOffset={1}; expected size=64, offset=56. Photon MMIO disabled.", _slotSize, _shadowOffset));
- _photonPool = null;
- _photonDispatchRing = null;
- }
- }
-```
-
----
-
-### F-03: AddDataSeries Ordering -- Move to Top of Configure (lines 294-297)
-
-**FIND** (the AddDataSeries block near line 294):
-```csharp
- // Add data series for MTF RMA Intelligence (Phase 9.2)
- AddDataSeries(BarsPeriodType.Minute, 5); // Index 1 (Primary for ATR)
- AddDataSeries(BarsPeriodType.Minute, 10); // Index 2
- AddDataSeries(BarsPeriodType.Minute, 15); // Index 3
-
- _configureComplete = true;
-```
-
-**REPLACE WITH** (remove block from here -- it moves to the top):
-```csharp
- _configureComplete = true;
-```
-
-**FIND** (first line of OnStateChangeConfigure body):
-```csharp
- private void OnStateChangeConfigure()
- {
- _configureComplete = false;
- _dataLoadedComplete = false;
-```
-
-**REPLACE WITH**:
-```csharp
- private void OnStateChangeConfigure()
- {
- _configureComplete = false;
- _dataLoadedComplete = false;
-
- // B984-F03: AddDataSeries FIRST -- NT8 requires early registration before any throwing code.
- // Index 1 = 5-min (ATR), Index 2 = 10-min, Index 3 = 15-min (MTF RMA Intelligence Phase 9.2)
- AddDataSeries(BarsPeriodType.Minute, 5);
- AddDataSeries(BarsPeriodType.Minute, 10);
- AddDataSeries(BarsPeriodType.Minute, 15);
-```
-
----
-
-### F-02: BarsArray Guard (line 345)
-
-**FIND**:
-```csharp
- // Initialize ATR indicator on 5-min bars (BarsArray[1])
- atrIndicator = this.ATR(BarsArray[1], RMAATRPeriod);
-```
-
-**REPLACE WITH**:
-```csharp
- // B984-F02: Guard BarsArray[1] -- only valid if AddDataSeries completed in Configure.
- if (BarsArray.Count >= 2)
- {
- atrIndicator = this.ATR(BarsArray[1], RMAATRPeriod);
- }
- else
- {
- Print("[CRITICAL] BarsArray[1] unavailable -- ATR will use primary series. Check AddDataSeries in Configure.");
- atrIndicator = this.ATR(RMAATRPeriod);
- }
-```
-
----
-
-### F-04: Silent Target Count Override -- Add Telemetry (line 341)
-
-**FIND**:
-```csharp
- activeTargetCount = Math.Max(1, Math.Min(5, loadedTargetCount));
- ConfiguredTargetCount = activeTargetCount;
-```
-
-**REPLACE WITH**:
-```csharp
- activeTargetCount = Math.Max(1, Math.Min(5, loadedTargetCount));
- // B984-F04: Log backward-compat override so users know why target count changed.
- Print(string.Format("[COMPAT] ConfiguredTargetCount was 0 -- auto-detected {0} targets from TargetValue fields.", activeTargetCount));
- ConfiguredTargetCount = activeTargetCount;
-```
-
----
-
-### F-05: Startup Gate Fires Too Early (lines 387-401)
-
-**FIND**:
-```csharp
- _dataLoadedComplete = true;
-
- // Build 1103: Initialize sticky state path + hydrate persisted config.
- // MUST run BEFORE StartIpcServer() so GET_LAYOUT serves last-synced state.
- _stickyStatePath = System.IO.Path.Combine(logsDir,
- string.Format("StickyState_{0}.v12state", symbol));
- bool stickyLoaded = LoadStickyState();
- if (stickyLoaded)
- Print("[STICKY] Persisted state hydrated -- GET_LAYOUT will serve last-synced config");
-
- // V12.2 HEADLESS SAFETY: Start core services even if ChartControl is null (for background execution)
- // [Build 932]: Start IPC in DataLoaded so Control Surface connects even if market is closed/offline.
- StartIpcServer();
- TouchStrategyHeartbeat();
- PublishUiSnapshot();
-```
-
-**REPLACE WITH**:
-```csharp
- // B984-F05: StickyState + IPC must complete BEFORE _dataLoadedComplete = true
- // so EnsureStartupReady() gate does not open until services are ready.
-
- // Build 1103: Initialize sticky state path + hydrate persisted config.
- // MUST run BEFORE StartIpcServer() so GET_LAYOUT serves last-synced state.
- _stickyStatePath = System.IO.Path.Combine(logsDir,
- string.Format("StickyState_{0}.v12state", symbol));
- bool stickyLoaded = LoadStickyState();
- if (stickyLoaded)
- Print("[STICKY] Persisted state hydrated -- GET_LAYOUT will serve last-synced config");
-
- // V12.2 HEADLESS SAFETY: Start core services even if ChartControl is null (for background execution)
- // [Build 932]: Start IPC in DataLoaded so Control Surface connects even if market is closed/offline.
- StartIpcServer();
- TouchStrategyHeartbeat();
- PublishUiSnapshot();
-
- _dataLoadedComplete = true;
-```
-
----
-
-### F-06: Hardcoded "REPAIRED" Banner -- Make Conditional (line 371)
-
-**FIND**:
-```csharp
- Print(string.Format("{0} REPAIRED: Definitive Chart-Click Fix + Logic Refresh", BUILD_TAG));
-```
-
-**REPLACE WITH**:
-```csharp
- // B984-F06: Banner removed -- was a one-time repair artifact, not a permanent log entry.
-```
-
----
-
-### F-07: Dispatcher Lambda Missing _isTerminating Guard in Terminated (lines 462-469)
-
-**FIND**:
-```csharp
- if (ChartControl != null)
- {
- ChartControl.Dispatcher.InvokeAsync(() =>
- {
- DetachHotkeys();
- DetachChartClickHandler();
- DestroyPanel();
- });
- }
-```
-
-**REPLACE WITH**:
-```csharp
- if (ChartControl != null)
- {
- ChartControl.Dispatcher.InvokeAsync(() =>
- {
- // B984-F07: _isTerminating guard ensures no re-entrant panel ops if invoked late.
- if (!_isTerminating) return;
- DetachHotkeys();
- DetachChartClickHandler();
- DestroyPanel();
- });
- }
-```
-
----
-
-### F-08 + F-09: Teardown Ordering -- Dicts BEFORE Cancel (lines 475, 514-532)
-
-The current order is:
-1. `_isTerminating = true`
-2. Dispatcher InvokeAsync (panel teardown)
-3. **CancelAllV12GtcOrders** -- references order dicts
-4. DrainQueues
-5. StopIpcServer
-6. ... more cleanup ...
-7. **Dict.Clear()** -- dicts cleared AFTER cancel
-
-F-08: CancelAllV12GtcOrders must run while dicts are fully populated.
-F-09: Dict.Clear() is correct AFTER cancel. No change needed to ordering for F-09 -- the ordering is already correct. The defect is actually F-08 being called while Dispatcher lambda may still be reading from dicts.
-
-**Fix for F-08**: Add a `Print` telemetry before cancel so the order is traceable:
-
-**FIND**:
-```csharp
- // [BUILD 948] GTC Cancel Sweep -- cancel all tracked/broker V12 orders before teardown.
- // Must run while dicts are still populated and accounts still subscribed.
- // force=false: soft terminate, protects brackets for open positions.
- CancelAllV12GtcOrders(false);
-```
-
-**REPLACE WITH**:
-```csharp
- // [BUILD 948] GTC Cancel Sweep -- cancel all tracked/broker V12 orders before teardown.
- // Must run while dicts are still populated and accounts still subscribed.
- // force=false: soft terminate, protects brackets for open positions.
- // B984-F08: Log entry count before sweep for post-mortem tracing.
- Print(string.Format("[SHUTDOWN] GTC sweep: cancelling {0} tracked + broker-scanned orders",
- (entryOrders?.Count ?? 0) + (stopOrders?.Count ?? 0)));
- CancelAllV12GtcOrders(false);
-```
-
----
-
-### F-10: Banner Box Chars -- ASCII Gate Compliance (lines 406-409)
-
-**FIND**:
-```csharp
- Print("+--------------------------------------------------------------+");
- Print("| [OK] BMad HARDENED DEPLOYMENT PROTOCOL ACTIVE |");
- Print(string.Format("| Build: {0,-10} | Sync: ONE SOURCE OF TRUTH |", BUILD_TAG));
- Print("+--------------------------------------------------------------+");
-```
-
-**REPLACE WITH**:
-```csharp
- // B984-F10: Replaced box-drawing chars with ASCII-safe dashes and brackets.
- Print("--------------------------------------------------------------");
- Print("[OK] BMad HARDENED DEPLOYMENT PROTOCOL ACTIVE");
- Print(string.Format("Build: {0} | Sync: ONE SOURCE OF TRUTH", BUILD_TAG));
- Print("--------------------------------------------------------------");
-```
-
----
-
-### F-11: ConnectionUpdate Silent No-Op -- Add Telemetry (line 551)
-
-**FIND**:
-```csharp
- if (!enableSima || strategyState != State.Realtime) return;
-```
-
-**REPLACE WITH**:
-```csharp
- // B984-F11: Log when guard exits early so operators know reconnect re-adoption was skipped.
- if (!enableSima || strategyState != State.Realtime)
- {
- if (status == ConnectionStatus.Connected)
- Print(string.Format("[BUILD 948] Reconnect skipped -- SIMA={0}, State={1}", enableSima, strategyState));
- return;
- }
-```
-
----
-
-### F-12: OnMarketData PublishUiSnapshot Rate Gate (lines 586-592)
-
-**FIND**:
-```csharp
- // Update last known price for real-time tracking
- lastKnownPrice = marketDataUpdate.Price;
- PublishUiSnapshot();
-
- // Process IPC commands immediately on every tick
- // This ensures Remote App buttons work even outside session time
- ProcessIpcCommands();
-```
-
-**REPLACE WITH**:
-```csharp
- // Update last known price for real-time tracking
- lastKnownPrice = marketDataUpdate.Price;
-
- // B984-F12: Rate-gate UI snapshot -- publish only every 5 ticks to reduce dispatcher pressure.
- _uiSnapshotTickCounter = (_uiSnapshotTickCounter + 1) % 5;
- if (_uiSnapshotTickCounter == 0)
- PublishUiSnapshot();
-
- // Process IPC commands immediately on every tick
- // This ensures Remote App buttons work even outside session time
- ProcessIpcCommands();
-```
-
-> **NOTE**: `_uiSnapshotTickCounter` requires a new `private int _uiSnapshotTickCounter;` field declaration
-> in `V12_002.Data.cs` or the existing fields partial file. Engineer must add this field.
-
----
-
-## BUILD_TAG Update
-
-**FIND** (in `V12_002.cs`):
-```csharp
-private const string BUILD_TAG = "1111.004-v28.0-pr75-repairs";
-```
-
-**REPLACE WITH**:
-```csharp
-private const string BUILD_TAG = "1111.005-v28.0-b984";
-```
-
----
-
-## Engineer Self-Audit Checklist (PowerShell)
-
-```powershell
-# Run from repo root after all edits
-
-# 1. Zero lock() calls
-$locks = Select-String -Path "src\*.cs" -Pattern "lock\s*\(" | Where-Object { $_ -notmatch "//.*lock" }
-if ($locks) { Write-Error "FAIL: lock() found"; $locks } else { Write-Host "PASS: No lock() calls" }
-
-# 2. Zero non-ASCII in string literals (simplified scan)
-$nonAscii = Select-String -Path "src\*.cs" -Pattern "[^\x00-\x7F]"
-if ($nonAscii) { Write-Error "FAIL: Non-ASCII chars found"; $nonAscii } else { Write-Host "PASS: ASCII-only" }
-
-# 3. Verify BarsArray guard exists
-$guard = Select-String -Path "src\V12_002.Lifecycle.cs" -Pattern "BarsArray.Count >= 2"
-if (-not $guard) { Write-Error "FAIL: F-02 guard missing" } else { Write-Host "PASS: F-02 guard present" }
-
-# 4. Verify AddDataSeries is before layout invariant check
-$addDs = (Select-String -Path "src\V12_002.Lifecycle.cs" -Pattern "AddDataSeries").LineNumber | Select-Object -First 1
-$layout = (Select-String -Path "src\V12_002.Lifecycle.cs" -Pattern "FleetDispatchSlot layout invariant").LineNumber | Select-Object -First 1
-if ($addDs -lt $layout) { Write-Host "PASS: F-03 ordering correct" } else { Write-Error "FAIL: F-03 AddDataSeries still after layout check" }
-
-# 5. Verify _dataLoadedComplete = true is after StartIpcServer
-$ipc = (Select-String -Path "src\V12_002.Lifecycle.cs" -Pattern "StartIpcServer").LineNumber | Select-Object -First 1
-$gate = (Select-String -Path "src\V12_002.Lifecycle.cs" -Pattern "_dataLoadedComplete = true").LineNumber | Select-Object -First 1
-if ($gate -gt $ipc) { Write-Host "PASS: F-05 gate ordering correct" } else { Write-Error "FAIL: F-05 gate still fires too early" }
-
-# 6. BUILD_TAG bump
-$tag = Select-String -Path "src\V12_002.cs" -Pattern "1111.005-v28.0-b984"
-if (-not $tag) { Write-Error "FAIL: BUILD_TAG not bumped" } else { Write-Host "PASS: BUILD_TAG = 1111.005-v28.0-b984" }
-
-Write-Host "Self-audit complete."
-```
-
----
-
-## Director's Handoff Block for Codex
-
-```
-MISSION: Build-984-SourceHardening -- P5 Engineering
-BUILD_TAG: 1111.004-v28.0-pr75-repairs -> 1111.005-v28.0-b984
-BRANCH: build-984-source-hardening
-REPO: https://github.com/mkalhitti-cloud/universal-or-strategy
-
-P3 ARCHITECT SIGN-OFF: COMPLETE
-All 12 Arena findings (F-01 to F-12) independently verified in live source.
-Surgical FIND/REPLACE blocks in docs/brain/implementation_plan.md are authoritative.
-
-=== PRIMARY TARGET ===
-FILE: src/V12_002.Lifecycle.cs (all 12 defect sites)
-SECONDARY: src/V12_002.cs (BUILD_TAG bump only)
-TERTIARY: src/V12_002.Data.cs (add _uiSnapshotTickCounter field for F-12)
-
-=== STEP SEQUENCE ===
-
-STEP 1 -- Read the full plan:
-docs/brain/implementation_plan.md
-
-STEP 2 -- Apply repairs IN THIS ORDER (ordering matters for F-03/F-05):
- 1. F-03: Move AddDataSeries to top of OnStateChangeConfigure (ordering fix first)
- 2. F-01: Replace layout invariant throw with graceful degradation + Print
- 3. F-02: Add BarsArray.Count guard around atrIndicator init
- 4. F-04: Add Print before ConfiguredTargetCount mutation
- 5. F-05: Move _dataLoadedComplete = true to AFTER StartIpcServer/StickyState
- 6. F-06: Remove hardcoded "REPAIRED" banner line
- 7. F-07: Add _isTerminating check inside Terminated dispatcher lambda
- 8. F-08: Add Print with order counts before CancelAllV12GtcOrders
- 9. F-09: No change needed (ordering is correct per re-analysis)
- 10. F-10: Replace box-drawing chars with ASCII-safe dashes
- 11. F-11: Add telemetry Print in ConnectionUpdate early-return path
- 12. F-12: Add _uiSnapshotTickCounter rate gate around PublishUiSnapshot
-
-STEP 3 -- Add field (F-12 dependency):
-In src/V12_002.Data.cs, add:
- private int _uiSnapshotTickCounter;
-
-STEP 4 -- Bump BUILD_TAG:
-In src/V12_002.cs:
- FIND: private const string BUILD_TAG = "1111.004-v28.0-pr75-repairs";
- REPLACE: private const string BUILD_TAG = "1111.005-v28.0-b984";
-
-STEP 5 -- Self-audit:
-Run the PowerShell checklist from docs/brain/implementation_plan.md.
-All 6 checks must PASS before handoff.
-
-STEP 6 -- Deploy:
- powershell -File .\deploy-sync.ps1
- Tell Director: press F5 in NinjaTrader. Verify banner shows "1111.005-v28.0-b984".
-
-STEP 7 -- Commit:
- git add src/V12_002.Lifecycle.cs src/V12_002.cs src/V12_002.Data.cs
- git commit -m "B984: Apply 12 source hardening repairs (F-01 to F-12)"
- git push
-```
-
----
-
-## Post-Production Refactor Roadmap
-
-After Build-984 merges to main (M3 complete), the following refactor sequence is planned.
-One PR per subgraph. Subgraphs with Complexity >= 50 are in scope.
-
-| Priority | Subgraph | Total Cmplx | Highest-Risk File | Recommended Approach |
-|:---|:---|:---|:---|:---|
-| 1 | **SIMA** | 669 | SIMA.Lifecycle.cs (262) | Extract SIMA state machine into discrete FSM transitions |
-| 2 | **Execution Engine** | 1627 | Orders.Callbacks.AccountOrders.cs (206) | Split callback chain; extract bracket FSM |
-| 3 | **UI & Photon IO** | 1646 | UI.Callbacks.cs (202) | Separate panel construction from event dispatch |
-| 4 | **REAPER Defense** | 437 | REAPER.Audit.cs (153) | Extract audit rules into table-driven evaluator |
-| 5 | **Kernel** | 315 | StickyState.cs (148) | Extract persistence layer |
-| 6 | **Signals** | 244 | Entries.Trend.cs (50) | Minor -- inline guards |
-
-**Excluded** (Cmplx < 50): Telemetry (35), Morpheus OS (3), Kernel Constants/Data/AccountUpdate.
-
-*Architect note*: Execution Engine (1627) and UI & Photon IO (1646) are the largest subgraphs.
-Recommend tackling SIMA first (669) as a warm-up since it is self-contained and its FSM pattern
-is already established. Execution Engine second because it has the most cross-file blast radius.
-
----
-
-*Plan authored by: P3 ARCHITECT (Antigravity in PLAN-ONLY mode)*
-*Protocol: V14 Alpha | Build-984 | 2026-05-05*
-
----
-
-## P3-CI: Workflow Hardening Suite (Build 984.1)
-
-**Status**: IMPLEMENTED | **Branch**: build-984-hardening
-
-Installed and configured 6 core GitHub Actions workflows to satisfy CI/CD security and repository hygiene requirements.
-
-### 1. Dependency Review (`dependency-review.yml`)
-- **Function**: Blocks PRs that introduce vulnerable dependencies or invalid licenses.
-- **Trigger**: `pull_request`
-
-### 2. OSV-Scanner (`osv-scanner.yml`)
-- **Function**: Scans project dependencies against Google's OSV vulnerability database.
-- **Trigger**: `push` to main/dev, `pull_request`, `schedule` (weekly).
-
-### 3. Codecov Reporting (`codecov.yml`)
-- **Function**: Uploads coverage reports to Codecov.io for visual PR feedback.
-- **Trigger**: `workflow_run` (after `dotnet-test.yml` completes).
-- **Target**: `./TestResults/coverage.opencover.xml`
-
-### 4. Markdown Link Check (`markdown-link-check.yml`)
-- **Function**: Validates internal and external links in `.md` files.
-- **Config**: `.github/mlc_config.json` (ignores local `file:///` artifacts).
-- **Trigger**: `push`, `pull_request`.
-
-### 5. Stale Bot (`stale.yml`)
-- **Function**: Automates management of inactive issues and PRs (60 days stale -> 7 days warning -> close).
-- **Trigger**: `schedule` (daily).
-
-### 6. Release Drafter (`release-drafter.yml`)
-- **Function**: Drafts release notes based on PR labels (mapped to V12 labels: `fix`, `enhancement`, `docs`, `maintenance`).
-- **Config**: `.github/release-drafter.yml`.
-- **Trigger**: `push` to main.
-
----
-
-## PR Intelligence Suite
-
-**Status**: COMPLETE | **Branch**: build-984-hardening
-
-### 1. Qwen PR Reviewer (`qwen-review.yml`)
-- **Function**: Automated code review and issue management via QwenLM.
-- **Trigger**: `pull_request` on `[main, dev, build-984-hardening]`.
-
-### 2. GLM OpenCode Reviewer (`glm-review.yml`)
-- **Function**: Automated code review via GLM OpenCode.
-- **Trigger**: `pull_request` on `[main, dev, build-984-hardening]`.
-
----
+## [UNDER CONSTRUCTION]
+Waiting for P3 Architect (Claude) to define the strategic design for Phase 5.
+Focus: Distributed Dispatchers, Lock-Free Primitives, Rithmic Integration.
diff --git a/docs/brain/task.md b/docs/brain/task.md
index 1adb8d8..f51e3cb 100644
--- a/docs/brain/task.md
+++ b/docs/brain/task.md
@@ -1,5 +1,4 @@
-# ADR-019 Sovereign Substrate Repair: Live Mission Dashboard
-
-**Protocol Version**: V14 Alpha (Full Lifecycle Coverage)
-**Target Build**: `1111.003-v28.0-adr019`
-**Blackboard Sync**: [nexus_a2a.json](file:///C:/WSGTA/universal-or-strategy/docs/brain/nexus_a2a.json)
+# Mission Dashboard: Phase 5 Distributed Pipeline
+**BUILD_TAG**: 1111.006-v28.0-b984-complete
+**Repo**: mkalhitti-cloud/universal-or-strategy
+**Branch**: phase-5-distributed-pipeline
@@ -13,7 +12,7 @@
-| **P1** | **Orchestrator** | Central Switchboard | ✅ **COMPLETE** (Dashboard Hardened) |
-| **P2** | **Forensics** | Logic Trace & Evidence | ✅ **COMPLETE** |
-| **P3** | **Architect** | Structural Design | ✅ **COMPLETE** (Workflow Synced) |
-| **P4** | **Adjudicator** | Red Team Arena Audit | ✅ **COMPLETE** (Dashboard Matrix) |
-| **P5** | **Engineer** | Surgical Implementation | ✅ **COMPLETE** (Sync Engine Live) |
-| **P6** | **Validator** | Logic & AMAL Vetting | ✅ **COMPLETE** (Pending NT8 F5 Compile) |
-| **P7** | **Sentinel** | GitHub / Security Audit | **COMPLETE** (Hook Repair Pending, Push Complete) |
+| **P1** | **Orchestrator** | Central Switchboard | ✅ **COMPLETE** (Intake & Branching) |
+| **P2** | **Forensics** | Logic Trace & Evidence | 🟡 **PENDING** |
+| **P3** | **Architect** | Structural Design | 🔵 **ACTIVE** (Claude) |
+| **P4** | **Adjudicator** | Red Team Arena Audit | ⚪ **WAITING** |
+| **P5** | **Engineer** | Surgical Implementation | ⚪ **WAITING** |
+| **P6** | **Validator** | AMAL Vetting | ⚪ **WAITING** |
+| **P7** | **Sentinel** | Infrastructure / Security | ⚪ **WAITING** |
@@ -23,17 +22,4 @@
-## 🛠️ Task Execution Log
-
-### [x] P1: ORCHESTRATION & INTAKE
-
-- [x] Extract 4 $battlezip files from Downloads
-- [x] Initial Forensic Synthesis (identified 7 Type 2 logic leaks)
-- [x] Protocol Hardening: Refactor Hierarchy (V14 Expansion)
-- [x] Agent Readiness: Enforce Morpheus gates and global gstack integration across all workflows
-- [x] **Dashboard Hardening**: Synchronized Battle Matrix and Mission Progress with Living Dashboard
-
-### [x] P2: FORENSIC AUDIT (CONSOLIDATED)
-
-- [x] Consolidate Goose findings + Arena findings
-- [x] Verify Site #5, #11-16 "Cleanup Bypass" proof of failure
-- [x] Audit path portability (deploy-sync.ps1 hardcoded repo paths)
-
-### [/] P3: ARCHITECTURAL DESIGN (CLAUDE)
+## 🎯 Current Objectives (M5-M9)
+- [ ] **Architecture**: Distributed Dispatcher Community Design (Option A)
+- [ ] **Foundation**: Lock-Free Ring Buffer Primitives (SPSC/MPMC) (Option C)
+- [ ] **Integration**: Rithmic Data Hub Adapter (Option B - Deferred/Conditional)
@@ -41,17 +27 @@
-- [x] Invoke `/architect_intake` with forensic brief
-- [x] Claude: Independent verification of 32 sites (Explore Agents)
-- [ ] Claude: Rewrite `implementation_plan.md` with A1/A2 patterns
-- [ ] Post-Design Peer Review sign-off
-
-### [ ] P4: ADJUDICATION GATE (ARENA)
-
-- [ ] Launch P4 Red Team Battle ($redteambattle)
-- [ ] Achieve 14/14 model consensus on new A1/A2 recipes
-- [ ] Verify Windows-native PowerShell matrix in Section F
-- [ ] P4 Audit Sign-Off memo
-
-### [ ] P5: SURGICAL ENGINEERING (CODEX)
-
-- [ ] Apply approved plan to `src/` (Surgical P5 edits)
-- [ ] Run `deploy-sync.ps1` (Hard-link restoration)
-- [ ] ASCII Gate & Lint passing check
+---
@@ -59,7 +29 @@
-### [x] P6: POST-SURGERY VALIDATION
-- [x] Task 1 DONE: Final Build Gate (`dotnet build "Linting.csproj" -nologo`)
-- [x] Task 2 DONE: Global lock audit and ctx.Sync / FollowerEntries audit
-- [x] Task 3 DONE: BUILD_TAG verification (`1111.003-v28.0-adr019`)
-- [x] AMAL waiver recorded: `docs/artifacts/audits/amal_waiver.md`
-- [x] Forensic sign-off agents: Aquinas (T2), Schrodinger (T3)
-- [x] Mission status: COMPLETE pending NT8 F5 compile
+## 🛠️ Task Execution Log
@@ -67,9 +31,6 @@
-### [ ] P7: SENTINEL (INFRASTRUCTURE)
-- [x] Configure **Sentry & LangSmith** (DSN active, LS project verified)
-- [x] Fix false positives in `audit_scan.ps1` (Comment exclusion + word boundaries)
-- [x] **CRITICAL FINDING**: 12 banned `lock()` statements in `src/` (Symmetry, SIMA)
-- [x] Organize **Droid Evidence Folder**: [droid_mission_01](file:///C:/WSGTA/universal-or-strategy/docs/telemetry/droid_mission_01/README.md)
-- [ ] Execute **GitHub Audit Team** check (label-sync, secrets)
-- [x] Remediate `lock()` violations (Replace with Actor Enqueue model)
-- [ ] Restore `install_hooks.ps1` and verify LFS gates
-- [ ] Close ADR-019 Mission Brief
+### [x] P1: ORCHESTRATION & INTAKE
+- [x] Initial Phase 5 branch creation (`phase-5-distributed-pipeline`)
+- [x] Clear `implementation_plan.md`
+- [x] Update `nexus_a2a.json`
+- [x] Establish Mission Dashboard (task.md)
+- [ ] Trigger `/architect_intake` (Claude)