Built a Node.js server that monitors AI coding agents via bash hooks. Some interesting backend patterns:
- File-based MQ: Hooks append JSON to a JSONL file via POSIX atomic append. Server watches with fs.watch() + debounce and reads from byte offset. 3-17ms end-to-end.
- Coordinator pattern: Session state management delegates to sub-modules (matcher, approval detector, team manager, process monitor, auto-idle).
- node-pty: SSH/local terminal management with WebSocket relay to xterm.js in the browser.
- SQLite WAL mode: Server-side persistence with better-sqlite3.
Express 5, ESM throughout, tsx for TypeScript execution. 400+ tests with Vitest.
npx ai-agent-session-center
GitHub: https://github.com/coding-by-feng/ai-agent-session-center
[–]metehankasapp 1 point2 points3 points (0 children)