Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

feat: keyboard shortcuts help modal (press ? to toggle)

Adam Eivy2c50abd589ff
diff --git a/PLAN.md b/PLAN.md
index 0d354dcb01..03ae5e773b 100644
--- a/PLAN.md
+++ b/PLAN.md
@@ -12,6 +12,7 @@ For project goals, see [GOALS.md](./GOALS.md). For completed work, see [DONE.md]
## Backlog
+- [x] **Keyboard Shortcuts Help Modal** — Press `?` to show all keyboard shortcuts; global overlay with section grouping, accessible dialog
- [ ] **God file decomposition** — Split cos.js, subAgentSpawner.js, digital-twin.js, routes/scaffold.js, routes/cos.js, client/api.js into focused modules; resolve circular dependency
- [ ] **Test coverage** — Critical gaps: cos.js, cosRunnerClient.js, agentActionExecutor.js (~29% service, ~12% route coverage)
- [ ] **M50 P9**: CoS Automation & Rules — Automated email classification, rule-based pre-filtering, email-to-task pipeline
diff --git a/client/src/components/KeyboardHelp.jsx b/client/src/components/KeyboardHelp.jsx
new file mode 100644
index 0000000000..4fa2f3de8a
--- /dev/null
+++ b/client/src/components/KeyboardHelp.jsx
@@ -0,0 +1,117 @@
+import { useEffect } from 'react';
+import { createPortal } from 'react-dom';
+import { Keyboard, X } from 'lucide-react';
+import { useKeyboardHelp } from '../hooks/useKeyboardHelp';
+
+const isMac = typeof navigator !== 'undefined' && navigator.platform?.includes('Mac');
+const mod = isMac ? '\u2318' : 'Ctrl';
+
+const SHORTCUT_SECTIONS = [
+ {
+ title: 'Global',
+ shortcuts: [
+ { keys: [`${mod}+K`], description: 'Open search' },
+ { keys: ['?'], description: 'Show keyboard shortcuts' },
+ { keys: ['Esc'], description: 'Close overlays' },
+ ],
+ },
+ {
+ title: 'Search (when open)',
+ shortcuts: [
+ { keys: ['\u2191', '\u2193'], description: 'Navigate results' },
+ { keys: ['Enter'], description: 'Go to selected result' },
+ { keys: ['Esc'], description: 'Close search' },
+ ],
+ },
+ {
+ title: 'CyberCity',
+ shortcuts: [
+ { keys: ['W', 'A', 'S', 'D'], description: 'Move around' },
+ { keys: ['Tab'], description: 'Toggle mode' },
+ { keys: ['E'], description: 'Interact with building' },
+ ],
+ },
+];
+
+function Kbd({ children }) {
+ return (
+ <kbd className="inline-flex items-center justify-center min-w-[24px] h-6 px-1.5 text-xs font-mono font-medium text-gray-300 bg-port-bg border border-port-border rounded shadow-sm">
+ {children}
+ </kbd>
+ );
+}
+
+export default function KeyboardHelp() {
+ const { open, setOpen } = useKeyboardHelp();
+
+ const close = () => setOpen(false);
+
+ // Lock body scroll when open
+ useEffect(() => {
+ document.body.style.overflow = open ? 'hidden' : '';
+ return () => { document.body.style.overflow = ''; };
+ }, [open]);
+
+ if (!open) return null;
+
+ const overlay = (
+ <div className="fixed inset-0 z-[9999] flex items-start justify-center pt-[10vh]">
+ {/* Backdrop */}
+ <div
+ className="absolute inset-0 bg-black/60"
+ onClick={close}
+ aria-hidden="true"
+ />
+
+ {/* Modal */}
+ <div role="dialog" aria-modal="true" aria-label="Keyboard shortcuts" className="relative w-full max-w-lg mx-4 bg-port-card rounded-xl border border-port-border shadow-2xl overflow-hidden">
+ {/* Header */}
+ <div className="flex items-center justify-between px-5 py-4 border-b border-port-border">
+ <div className="flex items-center gap-2.5">
+ <Keyboard size={18} className="text-port-accent" />
+ <h2 className="text-sm font-semibold text-white">Keyboard Shortcuts</h2>
+ </div>
+ <button
+ onClick={close}
+ className="p-1 text-gray-500 hover:text-white transition-colors rounded"
+ aria-label="Close keyboard shortcuts"
+ >
+ <X size={16} />
+ </button>
+ </div>
+
+ {/* Sections */}
+ <div className="max-h-[60vh] overflow-y-auto p-5 space-y-5">
+ {SHORTCUT_SECTIONS.map(section => (
+ <div key={section.title}>
+ <h3 className="text-xs font-medium text-gray-400 uppercase tracking-wide mb-2.5">
+ {section.title}
+ </h3>
+ <div className="space-y-2">
+ {section.shortcuts.map((shortcut, i) => (
+ <div key={i} className="flex items-center justify-between">
+ <span className="text-sm text-gray-300">{shortcut.description}</span>
+ <div className="flex items-center gap-1">
+ {shortcut.keys.map((key, j) => (
+ <Kbd key={j}>{key}</Kbd>
+ ))}
+ </div>
+ </div>
+ ))}
+ </div>
+ </div>
+ ))}
+ </div>
+
+ {/* Footer */}
+ <div className="px-5 py-3 border-t border-port-border">
+ <p className="text-xs text-gray-500 text-center">
+ Press <Kbd>?</Kbd> to toggle this dialog
+ </p>
+ </div>
+ </div>
+ </div>
+ );
+
+ return createPortal(overlay, document.body);
+}
diff --git a/client/src/components/Layout.jsx b/client/src/components/Layout.jsx
index 80148d9c07..1243359910 100644
--- a/client/src/components/Layout.jsx
+++ b/client/src/components/Layout.jsx
@@ -75,6 +75,7 @@ import { useUpdateChecker } from '../hooks/useUpdateChecker';
import NotificationDropdown from './NotificationDropdown';
import ThemeSwitcher from './ThemeSwitcher';
import CmdKSearch from './CmdKSearch';
+import KeyboardHelp from './KeyboardHelp';
import * as api from '../services/api';
import socket from '../services/socket';
@@ -676,6 +677,8 @@ export default function Layout() {
</div>
{/* Cmd+K search overlay — mounted in layout so it's available on every page */}
<CmdKSearch />
+ {/* Keyboard shortcuts help — press ? to toggle */}
+ <KeyboardHelp />
</div>
);
}
diff --git a/client/src/hooks/useKeyboardHelp.js b/client/src/hooks/useKeyboardHelp.js
new file mode 100644
index 0000000000..2325fe1eb9
--- /dev/null
+++ b/client/src/hooks/useKeyboardHelp.js
@@ -0,0 +1,26 @@
+import { useState, useEffect } from 'react';
+
+export function useKeyboardHelp() {
+ const [open, setOpen] = useState(false);
+
+ useEffect(() => {
+ const handler = (e) => {
+ // Don't trigger when typing in inputs/textareas/contenteditable
+ const tag = e.target.tagName;
+ if (tag === 'INPUT' || tag === 'TEXTAREA' || e.target.isContentEditable) return;
+ // Don't trigger with modifier keys
+ if (e.metaKey || e.ctrlKey || e.altKey) return;
+
+ if (e.key === '?' && !e.repeat) {
+ e.preventDefault();
+ setOpen(prev => !prev);
+ } else if (e.key === 'Escape') {
+ setOpen(false);
+ }
+ };
+ document.addEventListener('keydown', handler);
+ return () => document.removeEventListener('keydown', handler);
+ }, []);
+
+ return { open, setOpen };
+}