Skip to content

Ghost monitor protocol update - #253

Draft
drussell23 wants to merge 1 commit into
mainfrom
cursor/ghost-monitor-protocol-update-1470
Draft

Ghost monitor protocol update#253
drussell23 wants to merge 1 commit into
mainfrom
cursor/ghost-monitor-protocol-update-1470

Conversation

@drussell23

@drussell23 drussell23 commented Jan 4, 2026

Copy link
Copy Markdown
Owner

Summary

Implements the core "Exile" and "Boomerang" protocols of the patent-pending "Ghost Monitor Protocol" architecture, enabling isolated window management for the agent on Display 2 while ensuring seamless user experience.

Changes Made

  • Created backend/neural_mesh/agents/yabai_window_manager.py to centralize window management logic.
  • Implemented the exile_window method (Exile Protocol) to move windows to Display 2 (Shadow Realm) and maximize them.
  • Implemented the boomerang_window method (Boomerang Protocol) to summon windows back to Display 1 and focus them.
  • Added ensure_shadow_realm to verify the presence of Display 2.
  • Integrated _convergence_lock for future "The Reaper" state convergence.

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📝 Documentation update
  • 🎨 Style/UI update (no functional changes)
  • ♻️ Code refactoring (no functional changes)
  • ⚡ Performance improvement
  • ✅ Test update
  • 🔧 Configuration change
  • 🔒 Security fix

Test Plan

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed
  • All tests passing

Testing Steps:

  1. Ensure yabai is installed and configured.
  2. Ensure at least two displays are active, with Display 2 designated as the "Ghost Display".
  3. Call YabaiWindowManager().exile_window(window_id) with a valid window ID. Verify the window moves to Display 2 and maximizes.
  4. Call YabaiWindowManager().boomerang_window(window_id) with the same window ID. Verify the window returns to Display 1 and gains focus.

Related Issues

Relates to the "SYSTEM UPDATE: PATENT-PENDING ARCHITECTURE" directive.

Screenshots (if applicable)

Deployment Notes

  • Database migrations required
  • Environment variables added/changed (updated .env.example)
  • Dependencies added/updated (relies on yabai being installed)
  • Configuration changes required
  • Infrastructure changes required

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published
  • I have updated the .env.example file if I added new environment variables
  • I have checked for security vulnerabilities in my changes
  • I have verified that no sensitive data is exposed

Additional Context

This PR establishes the foundational window management for the "Ghost Monitor Protocol". It strictly adheres to the "Single-Seat Concurrency" principle, ensuring JARVIS operations on Display 2 do not interrupt the human user. Display 2 is treated as a privileged, secure execution environment for the agent, with window movements orchestrated by the new YabaiWindowManager.


Reviewer Guidelines:

  • Check code quality and adherence to project standards
  • Verify test coverage is adequate
  • Ensure documentation is updated
  • Validate security considerations
  • Confirm no sensitive data is exposed

Open in Cursor Open in Web


Summary by cubic

Adds a Yabai-based window manager to isolate agent windows on Display 2 and bring them back on demand, keeping the user’s workspace uninterrupted.

  • New Features

    • New YabaiWindowManager (backend/neural_mesh/agents/yabai_window_manager.py).
    • exile_window(window_id): move and maximize a window on Display 2.
    • boomerang_window(window_id): return the window to Display 1 and focus it.
    • ensure_shadow_realm(): verifies a second display is available.
    • Tracks original window state and uses a convergence lock for future sync.
  • Dependencies

    • Requires yabai installed and at least two active displays.

Written for commit cf147fb. Summary will update on new commits.

Co-authored-by: djamesr23 <djamesr23@gmail.com>
@cursor

cursor Bot commented Jan 4, 2026

Copy link
Copy Markdown

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@github-actions

github-actions Bot commented Jan 4, 2026

Copy link
Copy Markdown

📊 PR Size Analysis

Size: S
Files Changed: 1
Lines Added: +163
Lines Deleted: -0
Total Changes: 163

Review Checklist

  • All tests passing
  • Code follows project style guidelines
  • Documentation updated if needed
  • No sensitive data exposed
  • Breaking changes documented

@github-actions

github-actions Bot commented Jan 4, 2026

Copy link
Copy Markdown

🚨 CI/CD Failure Detected

The PR Automation & Validation workflow failed for this PR.

Action Required

A tracking PR has been automatically created to help resolve this issue:
🔗 #254

Quick Links

Please review the analysis and implement the suggested fixes.


🤖 Auto-generated by JARVIS CI/CD Manager

@github-actions

github-actions Bot commented Jan 4, 2026

Copy link
Copy Markdown

🚨 CI/CD Failure Detected

The Environment Variable Validation workflow failed for this PR.

Action Required

A tracking PR has been automatically created to help resolve this issue:
🔗 #255

Quick Links

Please review the analysis and implement the suggested fixes.


🤖 Auto-generated by JARVIS CI/CD Manager

@github-actions

github-actions Bot commented Jan 4, 2026

Copy link
Copy Markdown

🚨 CI/CD Failure Detected

The Database Connection Validation workflow failed for this PR.

Action Required

A tracking PR has been automatically created to help resolve this issue:
🔗 #256

Quick Links

Please review the analysis and implement the suggested fixes.


🤖 Auto-generated by JARVIS CI/CD Manager

@github-actions

github-actions Bot commented Jan 4, 2026

Copy link
Copy Markdown

🚨 CI/CD Failure Detected

The Validate Configuration workflow failed for this PR.

Action Required

A tracking PR has been automatically created to help resolve this issue:
🔗 #257

Quick Links

Please review the analysis and implement the suggested fixes.


🤖 Auto-generated by JARVIS CI/CD Manager

import logging
import os
import json
from typing import Dict, List, Optional, Tuple, Any

Check notice

Code scanning / CodeQL

Unused import Note

Import of 'Any' is not used.

Copilot Autofix

AI 7 months ago

In general, to fix an unused import, you either remove the unused name from the import line or delete the entire import statement if none of the imported names are used. Here, several types from typing are used (Dict, List, Tuple, and likely Optional elsewhere), but Any is not. The best minimal fix that preserves all existing behavior is to remove Any from the import list while leaving the rest of the line unchanged.

Concretely, in backend/neural_mesh/agents/yabai_window_manager.py, on the import line currently reading from typing import Dict, List, Optional, Tuple, Any, remove Any so that it becomes from typing import Dict, List, Optional, Tuple. No other code, imports, methods, or definitions are required.

Suggested changeset 1
backend/neural_mesh/agents/yabai_window_manager.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/backend/neural_mesh/agents/yabai_window_manager.py b/backend/neural_mesh/agents/yabai_window_manager.py
--- a/backend/neural_mesh/agents/yabai_window_manager.py
+++ b/backend/neural_mesh/agents/yabai_window_manager.py
@@ -24,7 +24,7 @@
 import logging
 import os
 import json
-from typing import Dict, List, Optional, Tuple, Any
+from typing import Dict, List, Optional, Tuple
 from dataclasses import dataclass
 
 # Setup logging
EOF
@@ -24,7 +24,7 @@
import logging
import os
import json
from typing import Dict, List, Optional, Tuple, Any
from typing import Dict, List, Optional, Tuple
from dataclasses import dataclass

# Setup logging
Copilot is powered by AI and may make mistakes. Always verify output.
return False, None
try:
return True, json.loads(output)
except:

Check notice

Code scanning / CodeQL

Except block handles 'BaseException' Note

Except block directly handles BaseException.

Copilot Autofix

AI 7 months ago

In general, to fix this issue you should avoid bare except: clauses and avoid catching BaseException unless there is a very strong, explicitly documented reason. Instead, catch Exception or more specific exception types that you expect from the protected block.

For this specific case in backend/neural_mesh/agents/yabai_window_manager.py, the risky block is:

try:
    return True, json.loads(output)
except:
    return False, None

json.loads primarily raises json.JSONDecodeError (a subclass of ValueError, which itself is a subclass of Exception), not KeyboardInterrupt or SystemExit. The safest change without altering intended behavior is to catch Exception instead of using a bare except. This preserves the function’s contract of returning (False, None) on any ordinary decoding error, while allowing KeyboardInterrupt and SystemExit to propagate.

No new imports or extra helper functions are needed, since Exception is built-in and we already import json. The change is localized to the except line around 161.

Suggested changeset 1
backend/neural_mesh/agents/yabai_window_manager.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/backend/neural_mesh/agents/yabai_window_manager.py b/backend/neural_mesh/agents/yabai_window_manager.py
--- a/backend/neural_mesh/agents/yabai_window_manager.py
+++ b/backend/neural_mesh/agents/yabai_window_manager.py
@@ -158,6 +158,6 @@
             return False, None
         try:
             return True, json.loads(output)
-        except:
+        except Exception:
             return False, None
 
EOF
@@ -158,6 +158,6 @@
return False, None
try:
return True, json.loads(output)
except:
except Exception:
return False, None

Copilot is powered by AI and may make mistakes. Always verify output.
@github-actions

github-actions Bot commented Jan 4, 2026

Copy link
Copy Markdown

🤖 CI/CD Pipeline Results

Status: success
Branch: 253/merge
Commit: 6e9c40aec28fe0e213bb769095a6c711f085fb2e

Pipeline Stages

  • Code Quality: ❌
  • Build & Test: ❌
  • Architecture: ❌
  • Security Scan: ❌

View full workflow run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants