Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 112 additions & 0 deletions .bob/commands/bug-bounty-consolidate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
---
description: Consolidate 7 cluster bug reports into a validated, hallucination-filtered, ranked repair plan. Run after all 7 cluster-bug-hunt reports are complete.
argument-hint: runner (optional -- runner suffix, e.g. bob, qwen, jules, gemini. Defaults to bob)
---
# MISSION: Bug Bounty Consolidation -- V12 Photon Kernel
**Spec Ref**: docs/brain/bug_bounty_workflow.md
**Input**: docs/brain/bug_report_s1_[runner].md through bug_report_s7_[runner].md (all 7 must exist)
**Output**: docs/brain/cluster_bug_bounty_report_[runner].md
**Mode**: Plan mode -- READ ONLY. No src/ edits.

---

## STEP 1 -- INGEST ALL 7 REPORTS

Read the following files in order:
- docs/brain/bug_report_s1_[runner].md (S1: SIMA Core)
- docs/brain/bug_report_s2_[runner].md (S2: Execution Engine)
- docs/brain/bug_report_s3_[runner].md (S3: UI & Photon IO)
- docs/brain/bug_report_s4_[runner].md (S4: REAPER Defense)
- docs/brain/bug_report_s5_[runner].md (S5: Kernel State)
- docs/brain/bug_report_s6_[runner].md (S6: Signals & Entries)
- docs/brain/bug_report_s7_[runner].md (S7: Kernel Infrastructure)

If any file is missing: HALT and report to Director which clusters are incomplete.

---

## STEP 2 -- HALLUCINATION FILTER

For EVERY reported bug across all 7 reports:
1. Use jCodemunch `search_symbols` to verify the cited method exists
2. Use `get_file_content` to verify the cited code pattern matches actual src/
3. Use `find_references` to confirm the cited shared state is actually accessed

Disposition for each bug:
- VALIDATED: evidence confirmed in src/
- FILTERED: cited method/pattern does not match src/ reality
- UNCERTAIN: partially verifiable -- flag for Director review

Track and report the filter rate per cluster.

---

## STEP 3 -- CROSS-CLUSTER DEDUPLICATION

Identify bugs reported by multiple agents for the same root cause:
- Match on: same file + same method + same root cause mechanism
- Merge into single canonical entry
- List all clusters that reported it
- Elevate severity if blast radius spans 2+ clusters

---

## STEP 4 -- SEVERITY RANKING

Final ranking of all validated bugs:
- Critical: Data corruption, race conditions, use-after-free
- High: FSM state leaks, ghost order windows, O(N^2) hot paths, semaphore leaks
- Med: Missing null guards, incomplete resets, inefficient lookups
- Low: Style violations, minor inefficiencies

---

## STEP 5 -- OUTPUT

Write docs/brain/cluster_bug_bounty_report_[runner].md containing:

```
# V12 Cluster Bug Bounty Report
Generated: [date]

## Summary
Total bugs found (raw): [N]
Validated: [N] | Filtered (hallucinations): [N] | Uncertain (Director review): [N]
Critical: [N] | High: [N] | Med: [N] | Low: [N]

## Filter Rate by Cluster
| Cluster | Found | Validated | Filtered |
|---------|-------|-----------|----------|
| S1 SIMA | N | N | N |
...

## Validated Bug List (ranked by severity)
[full list in BUG-[S#]-[NNN] format]

## Recommended Repair Sequence
[cluster order based on Critical count and dependency graph]

## /epic-tdd Ticket Blocks
[copy-paste ready ticket for each validated bug]
```

---

## STEP 6 -- HANDOFF

Output:
```
[BUG-BOUNTY-CONSOLIDATION-COMPLETE]
Total validated: [N]
Filtered: [N]
Uncertain (needs Director review): [N]
Report: docs/brain/cluster_bug_bounty_report_[runner].md
Next: Director reviews report -> selects cluster -> /epic-tdd for repairs
```

---

## BANNED
- Any src/ edit -- BANNED
- Fixing bugs inline -- BANNED
- Marking a bug VALIDATED without jCodemunch verification -- BANNED
103 changes: 103 additions & 0 deletions .bob/commands/bug-bounty.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
---
description: Dispatch 7 parallel cluster agents for a focused bug hunt across all V12 src files. Consolidate, validate, and filter findings into a repair-ready report.
argument-hint: runner (optional -- runner suffix, e.g. bob, qwen, jules, gemini. Defaults to bob)
---
# MISSION: Bug Bounty -- V12 Photon Kernel 7-Cluster Parallel Hunt
**Spec Ref**: docs/brain/bug_bounty_workflow.md
**Protocol**: Read-only forensic hunt. NO src/ edits. Output feeds /epic-tdd for repairs.
**Prerequisite**: All 7 cluster test suites must be complete before running this command.

---

## STEP 1 -- ORCHESTRATOR: PARALLEL DISPATCH

Spawn 7 sub-agents simultaneously, one per cluster. Each agent MUST operate in Plan mode
(read-only for src/, write-access for docs/). Each receives ONLY its cluster's files as context.

### Agent Context Assignments

| Agent | Cluster | Files |
|:------|:--------|:------|
| Agent-S1 | SIMA Core | V12_002.SIMA.*.cs (7 files) |
| Agent-S2 | Execution Engine | V12_002.Orders.*.cs + Symmetry.*.cs + Trailing.*.cs (16 files) |
| Agent-S3 | UI & Photon IO | V12_002.UI.*.cs (16 files) |
| Agent-S4 | REAPER Defense | V12_002.REAPER.*.cs + Safety.*.cs (5 files) |
| Agent-S5 | Kernel State | V12_002.Lifecycle.cs + StickyState + Telemetry + StructuredLog + Properties (5 files) |
| Agent-S6 | Signals & Entries | V12_002.Entries.*.cs (7 files) |
| Agent-S7 | Kernel Infrastructure | V12_002.cs + Constants + LogicAudit + DrawingHelpers + AccountUpdate + BarUpdate + Atm + PureLogic + Data + PositionInfo + Entries.cs + SignalBroadcaster (11 files) |

### Per-Agent Hunt Instructions

Each agent MUST scan for:
1. Race conditions -- shared state without atomic guards
2. Use-after-free windows -- resource released before all references cleared
3. Re-entrancy floods -- callbacks triggered inside critical sections
4. Ghost order windows -- async ID registered before submission completes
5. FSM state leaks -- incomplete reset during cancel/error
6. Null ref hot paths -- property access before null check
7. O(N^2) nested loops -- fleet/account list iterations
8. Semaphore leaks -- missing finally blocks
9. lock() remnants -- any remaining banned patterns
10. Non-ASCII string literals -- compiler safety violations
11. Wildcard Logic & Architectural Anomalies -- Leverage your full, unconstrained reasoning capacity to identify any deep structural flaws, data corruption windows, or subtle logical bugs violating the V12 Platinum Standard (even if they fall completely outside this checklist).

Bug report format per finding:
```
BUG-[S#]-[NNN]
Title: [short description]
Severity: Critical / High / Med / Low
Location: [file].[method] (line range if known)
Root Cause: [exact mechanism]
Evidence: [pattern or code reference]
Test Impact: [which test type would catch this]
```

Output per agent: docs/brain/bug_report_s[N]_[runner].md (e.g. docs/brain/bug_report_s1_bob.md, docs/brain/bug_report_s1_qwen.md, docs/brain/bug_report_s1_jules.md, docs/brain/bug_report_s1_gemini.md. Defaults to _bob if runner is not provided).

---

## STEP 2 -- ORCHESTRATOR: CONSOLIDATION

After all 7 agents report, run the consolidation phase:

### 2a. Hallucination Filter
- Verify each cited file/method exists via jCodemunch `search_symbols`
- Verify cited evidence matches actual src/ content
- Discard unverifiable findings -- mark as [FILTERED: hallucination]
- Report filter rate to Director

### 2b. Cross-Cluster Deduplication
- Merge bugs with same root cause across clusters
- Elevate severity for cross-cluster blast radius findings

### 2c. Severity Ranking
Final ranked list: Critical -> High -> Med -> Low

### 2d. Output
Write docs/brain/cluster_bug_bounty_report.md with:
- Total validated bugs by severity
- Per-cluster breakdown table
- Hallucination filter count (transparency)
- Recommended repair sequence
- /epic-tdd ticket block for each validated bug (copy-paste ready)

---

## STEP 3 -- HANDOFF TO DIRECTOR

Output:
```
[BUG-BOUNTY-COMPLETE]
Total bugs found: [N]
Validated: [N] | Filtered (hallucinations): [N]
Critical: [N] | High: [N] | Med: [N] | Low: [N]
Report: docs/brain/cluster_bug_bounty_report.md
Next step: Director selects cluster -> /epic-tdd for repairs
```

---

## BANNED DURING THIS COMMAND
- Any src/ edit -- BANNED (this is forensic-only)
- Fixing bugs inline -- BANNED (all fixes go through /epic-tdd)
- Reporting a bug without verifiable evidence -- BANNED
164 changes: 164 additions & 0 deletions .bob/commands/epic-decouple.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
---
description: Full 5-run decoupling mission conductor. Runs all 5 epics in sequence, pausing only for plan approval (Gate 1), F5 compile (Gate 4), and PR merge confirmation between each run.
argument-hint: (no arguments required)
---
# EPIC DECOUPLE -- 5-RUN MISSION CONDUCTOR

**Mission:** V12 Universal OR Strategy -- Full Decoupling (All 5 Runs)
**Repo:** c:\WSGTA\universal-or-strategy
**Rules:** Load .bob/rules/dna.md before any action. All V12 DNA mandates apply.

---

## MISSION OVERVIEW

You are executing a 5-run sequential decoupling mission. You know all 5 runs upfront.
You auto-advance between phases within each run. Between runs, you pause only for:

1. Gate 1 -- Plan approval (once per run, at the start)
2. Gate 4 -- F5 in NinjaTrader (once per run, after self-audit passes)
3. PR merge -- Director confirms PR is merged before you start the next run

Do NOT ask for input at any other point. Report progress as you go.

**The 5 runs:**
```
Run 1: Fix CS0656 + StyleCop suppression brief: docs/brain/runs/run1-cs0656.md
Run 2: Decouple StickyState & IPC brief: docs/brain/runs/run2-stickystate.md
Run 3: Decouple REAPER Risk Engine brief: docs/brain/runs/run3-reaper.md
Run 4: Decouple SIMA Fleet Coordinator brief: docs/brain/runs/run4-sima.md
Run 5: Decouple Symmetry & Order + format brief: docs/brain/runs/run5-symmetry.md
```

Emit this banner at the start:
```
[EPIC-DECOUPLE] 5-run mission loaded. Starting Run 1 of 5.
Runs: CS0656 Fix -> StickyState -> REAPER -> SIMA Fleet -> Symmetry + Format
Human gates per run: Plan Approval + F5 + PR Merge = 3 touches x 5 runs = 15 total
```

---

## RUN EXECUTION TEMPLATE

For each run, execute these phases using the brief file for that run.
The brief file tells you WHAT. These phases tell you HOW.

### Phase 1: Forensics & Design
- Read the run's brief file in full
- If the brief specifies a skill file, read it before designing
- Use jcodemunch-mcp `plan_turn` then `search_symbols` to locate all target symbols
- Draft the surgical plan: what changes, which files, which invariants, what the struct/interface/service looks like
- Present the plan clearly

**[GATE 1 -- STOP]**
```
[RUN N GATE 1] Design complete. Review above plan.
Type APPROVED to execute, or give feedback for revision.
```
Wait for Director input. If feedback given, revise and re-present. Do not proceed until APPROVED.

### Phase 2: Surgical Implementation
- Implement exactly what was approved in Phase 1
- Use Python extractor script for any block > 50 lines (manual copy-paste BANNED for >50 lines)
- SURGICAL ONLY: touch nothing outside the files listed in the brief
- WHITESPACE MUTATION BANNED
- DIFF LIMIT: under 500 lines total (unless brief explicitly exempts a commit)

After implementation emit:
```
[RUN N IMPL-DONE] Implementation complete. Starting self-audit.
```

### Phase 3: Self-Audit
Run ALL of the following, report every result:
```
powershell -File .\deploy-sync.ps1
grep -r "lock(" src/
grep -Prn "[^\x00-\x7F]" src/
powershell -File .\scripts\build_readiness.ps1
dotnet test Testing.csproj
```
Run any verification extras specified in the brief file.
Run Snyk code scan on new and modified files. Fix any HIGH/CRITICAL issues, rescan until clean.

Report:
```
[RUN N AUDIT]
deploy-sync : PASS / FAIL
lock() audit : CLEAN / FAIL [file:line]
unicode audit : CLEAN / FAIL [file:line]
compilation : PASS / FAIL [errors]
unit tests : PASS / FAIL / PRE-EXISTING [count]
snyk : CLEAN / FIXED [what was fixed]
[brief extras]: PASS / FAIL
OVERALL : PASS / FAIL
```

If OVERALL FAIL on any non-pre-existing gate -- HALT. Report to Director. Do not proceed.

### Phase 4: Compiler Gate
**[GATE 4 -- STOP]**
```
[RUN N F5-GATE] All automated gates PASSED.
deploy-sync : PASS
lock() audit : CLEAN
compilation : PASS
tests : PASS / PRE-EXISTING [N]

ACTION REQUIRED: Press F5 in NinjaTrader IDE.
When you see the BUILD_TAG banner, type: F5 done [BUILD_TAG for this run]
```
Wait for Director input.

### Phase 5: Commit
After Director types "F5 done [BUILD_TAG]":
```
git add [files changed in this run]
git commit -m "[commit message from brief file]"
git diff --stat HEAD~1
```

Emit:
```
[RUN N COMPLETE]
Commit : [hash]
Diff : [stat]
PR desc: [one-line description for Director to use when opening the PR]
Pre-existing test failures: [list or NONE]
```

**[PR MERGE GATE -- STOP]**
```
[RUN N PR-GATE] Run N is committed.
Open PR with the description above.
When the PR is merged, type: PR merged Run N
```
Wait for Director input.

After Director types "PR merged Run N", emit:
```
[RUN N+1 STARTING] Advancing to Run N+1 of 5.
Branch: [branch name from next brief]
```
Then start Phase 1 for the next run immediately.

---

## MISSION COMPLETION

After Run 5 PR is merged, emit the final report:
```
[EPIC-DECOUPLE COMPLETE] All 5 runs finished.

Run 1 CS0656 Fix + StyleCop : DONE
Run 2 StickyStateService : DONE
Run 3 ReaperRiskService : DONE
Run 4 SimaFleetService : DONE
Run 5 SymmetryOrderService : DONE
dotnet format : DONE

dotnet test WITHOUT NinjaTrader : CONFIRMED (all 4 services)
F5 human gate : STILL REQUIRED (NinjaTrader compile)
Next milestone : /greploop via Greptile on mdasdispatch-hash fork
```
Loading
Loading