Skip to content

Session 2025-12-20: TMUX improvements + competitive analysis#5

Merged
khaliqgant merged 7 commits into
mainfrom
session/2025-12-20-tmux-improvements
Dec 20, 2025
Merged

Session 2025-12-20: TMUX improvements + competitive analysis#5
khaliqgant merged 7 commits into
mainfrom
session/2025-12-20-tmux-improvements

Conversation

@khaliqgant

Copy link
Copy Markdown
Member

Summary

Multi-agent coordination session implementing improvements from TMUX_IMPROVEMENTS.md and competitive analysis of mcp_agent_mail/swarm-mail.

Features Implemented

  • Configurable relay prefix (--prefix flag) with auto-detection for Gemini (>> instead of @relay:)
  • SQLite driver fallback to node:sqlite for Node 25+ compatibility (env: AGENT_RELAY_SQLITE_DRIVER)
  • Session discovery in agent-relay status - shows active relay tmux sessions
  • Message threading - ParsedCommand.thread field for grouping related messages
  • Activity state tracking - better injection timing based on idle detection
  • Exponential backoff - graceful daemon reconnection with retry delays

Bugs Fixed

  • agent-relay-mcl: Gemini agent messaging - prefix conflict with @ file references
  • agent-relay-2z1: ACK messages reliability
  • agent-relay-7tu: SQLite portability across Node versions

Documentation

  • Dashboard screenshot added to README
  • Inspiration section crediting mcp_agent_mail and swarm-tools/swarm-mail
  • Competitive analysis document

Tests

  • 216 tests passing
  • Added configurable prefix test suite (7 new tests)
  • Updated threading tests

What's Left To Do

P1 (Critical)

Issue Description
agent-relay-51u Outgoing messages truncated before delivery (investigation started)
agent-relay-j9z Message injection corrupts human input in progress
agent-relay-9uy Durable inbox state (unread/read/acked per recipient)
agent-relay-hgd Reliable delivery: resume/replay via cursor/checkpoint

P2 (High Value)

Issue Description
agent-relay-2uf Message threading support (70% complete - needs tests + wiring)
agent-relay-dd8 File reservation system with advisory locks
agent-relay-d07 Message metadata: subject/thread/importance/replyTo
agent-relay-68a Ask pattern: request/response messaging
agent-relay-oiw No per-agent inbox files created

P3-P4

Issue Description
agent-relay-1ek Agent registry for persistence across restarts
agent-relay-l99 Output filtering for cleaner logs (blocked by 1ek)

Session Stats

  • Tasks Closed: 9
  • New Tasks Created: 20
  • Total Issues: 51

Agents Involved

  • Coordinator (orchestration)
  • LeadDev (6nx, 5fa, 0uh, mcl, 2z1, 51u investigation)
  • CompetitiveAnalysis (2uf threading started, bug discovery)
  • SecondCompetitiveAnalysis (7tu sqlite fix, swarm-mail analysis, durability beads)

🤖 Generated with Claude Code

claude and others added 7 commits December 20, 2025 17:59
- DESIGN_V2.md: Comprehensive improvement plan covering storage,
  protocol simplification, reliability, and DX enhancements
- TMUX_IMPROVEMENTS.md: Focused analysis of tmux implementation
  with specific takeaways for better activity tracking, reconnection,
  and session discovery
New features for scaling beyond 2-3 agents:
- Agent groups (@relay:@backend sends to all backend agents)
- Terminal-based dashboard (agent-relay watch)
- Coordination patterns (coordinator, pipeline, pub/sub)
- Tmux layout helper for viewing multiple agents
- Message priority levels (urgent !, normal, low ?)
- Agent roles and permissions in teams.json
- Deep dive comparing our polling approach vs streaming alternative
- Analyze robustness: injection, parsing, session management
- Document Gemini @ symbol conflict with file references
- Propose configurable prefix alternatives (>>, /relay, relay::)
- Recommend auto-detection of best prefix per CLI type
…h it

Key insight: The problem isn't polling vs streaming - it's visibility.

Their advantages at scale:
- Browser dashboard = single pane of glass
- Activity state tracking (active/idle/typing)
- Persistent message inbox
- Agent discovery

Our solution (keep native terminal, add visibility):
- TUI dashboard (agent-relay watch) with blessed
- Daemon event stream for real-time updates
- Wrapper reports activity state
- CLI commands: agents, history, send
- Architecture: daemon becomes event hub, not just router
Analyzes whether the proposed TUI dashboard (blessed library) is the
right approach for scaling to 5-10 agents. Conclusion: it's over-
engineered. tmux already provides multi-window support.

Recommended simpler approach:
- agent-relay team start (multi-window tmux session)
- watch -n2 agent-relay agents (live updates, zero code)
- agent-relay attach <name> (quick attach helper)

This saves ~3 days of implementation and avoids a new dependency.
Replace ai-maestro-specific paths with generic alternatives:
- ~/.aimaestro/ → ~/.relay/
- send-aimaestro-message.sh → send-relay-message.sh

The doc now uses neutral "alternative approach" terminology.
Features:
- Configurable relay prefix (--prefix flag) with auto-detect for Gemini (>>)
- SQLite driver fallback to node:sqlite for Node 25+ compatibility
- Session discovery in `agent-relay status` command
- Message threading support (ParsedCommand.thread field)
- Activity state tracking for better injection timing
- Exponential backoff for daemon reconnection

Bugs fixed:
- Gemini agent messaging (mcl) - prefix conflict resolved
- ACK messages reliability (2z1)
- SQLite portability across Node versions (7tu)

Documentation:
- Added dashboard screenshot to README
- Added Inspiration section crediting mcp_agent_mail and swarm-tools
- Competitive analysis document for mcp_agent_mail

Tests:
- 216 tests passing
- Added configurable prefix tests
- Updated threading tests

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@khaliqgant khaliqgant merged commit 3cb5896 into main Dec 20, 2025
6 checks passed
@khaliqgant khaliqgant deleted the session/2025-12-20-tmux-improvements branch December 20, 2025 21:11
khaliqgant added a commit that referenced this pull request Apr 1, 2026
template-resolver.ts: shell-escape interpolated variables (CRITICAL #1)
broker_tests.rs: uncomment and wire up 5 real tests (CRITICAL #2)
worker_tests.rs: uncomment and wire up 5 real tests (CRITICAL #3)
worker.rs: log bypass-flag injection, add .. path traversal rejection (CRITICAL #4, #7)
verification.ts: export stripInjectedTaskEcho, add path traversal guard (CRITICAL #5)
runner.ts: remove duplicate stripInjectedTaskEcho, add ENV_ALLOWLIST filtering (HIGH #17)
channel-messenger.ts: add secret scrubbing, hoist regex constants (MEDIUM #27, #28)
process-spawner.ts: add settled guard for race condition (MEDIUM #23)
step-executor.ts: add sideEffects to callback type, deprecate alias (HIGH #15, #16)
index.ts: export StepExecutor directly (MEDIUM #29)
workflows/refactor/*.ts: replace hardcoded paths, remove --no-verify (HIGH #8-11)
broker.rs: move is_pid_alive to canonical location (HIGH #14)
cost/tracker.ts: add restrictive file permissions (MEDIUM #30)
cost/pricing.ts: add last-verified date (MEDIUM #31)
verification.test.ts: 9 new tests for exported helpers (MEDIUM #32)

Co-Authored-By: My Senior Dev <dev@myseniordev.com>
khaliqgant added a commit that referenced this pull request Apr 6, 2026
…#675)

* refactor: TDD decomposition of runner.ts + main.rs with extracted modules

Extracted 5 modules from runner.ts (6,878 lines):
- verification.ts (143 lines)
- template-resolver.ts (87 lines)
- channel-messenger.ts (151 lines)
- step-executor.ts (571 lines)
- process-spawner.ts (96 lines)

Added characterization tests for all extracted modules.
Extracted broker.rs and worker.rs from main.rs.

Bug fixes:
- Restore stripInjectedTaskEcho in verification.ts
- Guard agent.release() against broker 400 race condition
- Fix run-summary-table test for new table format
- Export normalizeModel for correct pricing resolution
- Fix --wave argument parsing in run-refactor.ts
- ESM imports in all workflow files

* fix: address 10 review finding(s)

tracker.ts: resolveModel now uses normalizeModel for alias resolution (pre-existing fix verified)
run-refactor.ts: --wave parsing with proper validation (pre-existing fix verified)
step-executor.ts: signal-killed processes now correctly treated as failures
channel-messenger.ts: replaced ReDoS-vulnerable regex with iterative indexOf stripping
runner.ts: eliminated shell injection by using direct git spawn with argument arrays
process-spawner.ts: fixed SIGKILL fallback timer leak by storing and clearing reference

Co-Authored-By: My Senior Dev <dev@myseniordev.com>

* Revert "chore: gitignore .trajectories/ (automated run artifacts) (#676)" (#677)

This reverts commit 07a8dc0.

* refactor: TDD decomposition of runner.ts + main.rs with extracted modules

Extracted 5 modules from runner.ts (6,878 lines):
- verification.ts (143 lines)
- template-resolver.ts (87 lines)
- channel-messenger.ts (151 lines)
- step-executor.ts (571 lines)
- process-spawner.ts (96 lines)

Added characterization tests for all extracted modules.
Extracted broker.rs and worker.rs from main.rs.

Bug fixes:
- Restore stripInjectedTaskEcho in verification.ts
- Guard agent.release() against broker 400 race condition
- Fix run-summary-table test for new table format
- Export normalizeModel for correct pricing resolution
- Fix --wave argument parsing in run-refactor.ts
- ESM imports in all workflow files

* trajectories correction again

* pre commit is executable

* remove tracked workflows

* fix: address 36 review findings across Rust and TypeScript modules

template-resolver.ts: shell-escape interpolated variables (CRITICAL #1)
broker_tests.rs: uncomment and wire up 5 real tests (CRITICAL #2)
worker_tests.rs: uncomment and wire up 5 real tests (CRITICAL #3)
worker.rs: log bypass-flag injection, add .. path traversal rejection (CRITICAL #4, #7)
verification.ts: export stripInjectedTaskEcho, add path traversal guard (CRITICAL #5)
runner.ts: remove duplicate stripInjectedTaskEcho, add ENV_ALLOWLIST filtering (HIGH #17)
channel-messenger.ts: add secret scrubbing, hoist regex constants (MEDIUM #27, #28)
process-spawner.ts: add settled guard for race condition (MEDIUM #23)
step-executor.ts: add sideEffects to callback type, deprecate alias (HIGH #15, #16)
index.ts: export StepExecutor directly (MEDIUM #29)
workflows/refactor/*.ts: replace hardcoded paths, remove --no-verify (HIGH #8-11)
broker.rs: move is_pid_alive to canonical location (HIGH #14)
cost/tracker.ts: add restrictive file permissions (MEDIUM #30)
cost/pricing.ts: add last-verified date (MEDIUM #31)
verification.test.ts: 9 new tests for exported helpers (MEDIUM #32)

Co-Authored-By: My Senior Dev <dev@myseniordev.com>

* style: auto-format Rust code with cargo fmt

* minor clean

* fix: reinstate deleted workflow files into workflows/ci/

Moved fix-mcp-spawn.yaml, add-swift-sdk.ts, and cli-observability.ts
into workflows/ci/ to clearly distinguish them as CI test suite
workflows. Updated .gitignore to allow workflows/ci/ and workflows/refactor/.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: address remaining Devin review findings and fix failing test

- Fix tracker test: expect mode: 0o700 in mkdirSync assertion
- Use Object.hasOwn() instead of `in` operator to avoid prototype chain false positives
- Use Promise.allSettled to preserve partial output on process timeout
- Apply path containment check for absolute paths in checkFileExists

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: address new Devin review findings — StepExecutor name collision and cwd trailing slash

- Rename StepExecutor interface in runner.ts to RunnerStepExecutor to avoid
  shadowing the StepExecutor class export in the barrel index
- Normalize cwd with path.resolve() in checkFileExists to handle trailing slashes

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants