Skip to content

feat: add multi-agent infrastructure support - #2

Closed
zachshallbetter wants to merge 2 commits into
waynedev9598:mainfrom
zachshallbetter:shared-infrastructure
Closed

zachshallbetter wants to merge 2 commits into
waynedev9598:mainfrom
zachshallbetter:shared-infrastructure

Conversation

@zachshallbetter

@zachshallbetter zachshallbetter commented Feb 3, 2026 •

Copy link
Copy Markdown

Add multi-agent infrastructure support to enable extensible agent adapters. I integrated the editors initially and then circled back to the system changes to reduce friction. If accepted, this this one of three PRs. The other two contain the Antigravity and Cursor implementation. (found on you Reddit, and have been testing Pixel Office, btw)

Infrastructure Changes

Type System: Added source field to core type definitions:

  • ParsedFilePath interface now includes source: string to identify the agent
  • WatcherSessionEvent includes optional source field for session discovery events
  • WatcherLineEvent includes optional source field for line events
  • SessionInfo and SessionStateEntry already track source for session management

Parser Architecture: Enhanced src/parser.ts to support source-based routing:

  • transformToPixelEvents() accepts source parameter to route to correct adapter
  • Graceful fallback: Unknown sources log warning and return empty array instead of crashing
  • Extensible adapter registry ready for multiple agents

Watcher Refactoring: Updated src/watcher.ts:

  • parseFilePath() now returns source field (defaults to 'claude-code')
  • Watcher events (session, line) include source for proper routing
  • Source detection ready for multiple directory structures

Event Handling: Updated src/index.ts:

  • handleNewLine() accepts source parameter and passes it to parser
  • Session registration includes source parameter
  • Source flows through the entire event pipeline

Benefits

  • Extensibility: Adding new agents only requires creating an adapter and registering it
  • Backward Compatibility: Claude Code continues to work exactly as before
  • Type Safety: TypeScript ensures source is properly tracked through the pipeline
  • Foundation: Enables future agent integrations (Cursor, Antigravity, etc.)

Follow-up Pull Requests

This PR establishes the foundation for multi-agent support. Two follow-up PRs will add specific agent implementations:

Cursor Integration (PR #2)

  • Cursor adapter implementation (src/adapters/cursor.ts)
  • CLI support (--cursor-dir flag)
  • Auto-detection for ~/.cursor, ~/.config/cursor, and macOS Application Support
  • Directory resolution and watcher patterns

Antigravity Integration (PR #3)

  • Antigravity adapter implementation (src/adapters/antigravity.ts)
  • CLI support (--antigravity-dir flag)
  • Auto-detection for ~/.antigravity or ~/.config/antigravity
  • Directory resolution and watcher patterns

Verification

  • npm test passed (144 tests).
  • pnpm tsc --noEmit passes with no type errors.
  • Manual verification confirmed Claude Code functionality unchanged.

- Add source field to type definitions (ParsedFilePath, WatcherSessionEvent, WatcherLineEvent)
- Update watcher to detect and pass source through events
- Update index to route events by source parameter
- Foundation for extensible agent adapters (Cursor, Antigravity, etc.)
- Backward compatible with existing Claude Code functionality
omoyx pushed a commit to omoyx/PixelHQ-bridge that referenced this pull request Feb 7, 2026
Add full support for OpenAI Codex CLI as a second agent source alongside
Claude Code. The bridge now watches both ~/.claude/projects/ and
~/.codex/sessions/ for JSONL activity and routes events through
source-specific adapters.

Infrastructure (builds on PR waynedev9598#2 multi-agent pattern):
- Thread `source` field through watcher → parser → adapter pipeline
- Add `source` to ParsedFilePath, WatcherSessionEvent, WatcherLineEvent
- Route events to correct adapter based on source in parser

Codex adapter (src/adapters/codex.ts):
- Parse Codex rollout JSONL format (session_meta, response_item, etc.)
- Map all Codex tools (shell, apply_patch, read_file, grep_files,
  list_dir, plan, spawn_agent, web_search, etc.) to PixelEvent categories
- Privacy-safe: strips commands, file contents, paths, reasoning,
  prompts, and tool outputs — same guarantees as Claude Code adapter

Config & watcher:
- Auto-detect ~/.codex via CODEX_HOME env or --codex-dir flag
- Watch ~/.codex/sessions/**/*.jsonl with UUID extraction from
  rollout filenames
- Codex is optional — bridge works with Claude Code only, Codex only,
  or both

Tests: 55 new tests (199 total) covering all Codex response_item types,
tool mappings, privacy audit, edge cases, and parser integration.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@omoyx omoyx mentioned this pull request Feb 7, 2026
8 tasks done
omoyx added a commit to omoyx/PixelHQ-bridge that referenced this pull request Feb 7, 2026
Add full support for OpenAI Codex CLI as a second agent source alongside
Claude Code. The bridge now watches both ~/.claude/projects/ and
~/.codex/sessions/ for JSONL activity and routes events through
source-specific adapters.

Infrastructure (builds on PR waynedev9598#2 multi-agent pattern):
- Thread `source` field through watcher → parser → adapter pipeline
- Add `source` to ParsedFilePath, WatcherSessionEvent, WatcherLineEvent
- Route events to correct adapter based on source in parser

Codex adapter (src/adapters/codex.ts):
- Parse Codex rollout JSONL format (session_meta, response_item, etc.)
- Map all Codex tools (shell, apply_patch, read_file, grep_files,
  list_dir, plan, spawn_agent, web_search, etc.) to PixelEvent categories
- Privacy-safe: strips commands, file contents, paths, reasoning,
  prompts, and tool outputs — same guarantees as Claude Code adapter

Config & watcher:
- Auto-detect ~/.codex via CODEX_HOME env or --codex-dir flag
- Watch ~/.codex/sessions/**/*.jsonl with UUID extraction from
  rollout filenames
- Codex is optional — bridge works with Claude Code only, Codex only,
  or both

Tests: 55 new tests (199 total) covering all Codex response_item types,
tool mappings, privacy audit, edge cases, and parser integration.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
omoyx added a commit to omoyx/PixelHQ-bridge that referenced this pull request Feb 7, 2026
Add full support for OpenAI Codex CLI as a second agent source alongside
Claude Code. The bridge now watches both ~/.claude/projects/ and
~/.codex/sessions/ for JSONL activity and routes events through
source-specific adapters.

Infrastructure (builds on PR waynedev9598#2 multi-agent pattern):
- Thread `source` field through watcher → parser → adapter pipeline
- Add `source` to ParsedFilePath, WatcherSessionEvent, WatcherLineEvent
- Route events to correct adapter based on source in parser

Codex adapter (src/adapters/codex.ts):
- Parse Codex rollout JSONL format (session_meta, response_item, etc.)
- Map all Codex tools (shell, apply_patch, read_file, grep_files,
  list_dir, plan, spawn_agent, web_search, etc.) to PixelEvent categories
- Privacy-safe: strips commands, file contents, paths, reasoning,
  prompts, and tool outputs — same guarantees as Claude Code adapter

Config & watcher:
- Auto-detect ~/.codex via CODEX_HOME env or --codex-dir flag
- Watch ~/.codex/sessions/**/*.jsonl with UUID extraction from
  rollout filenames
- Codex is optional — bridge works with Claude Code only, Codex only,
  or both

Tests: 55 new tests (199 total) covering all Codex response_item types,
tool mappings, privacy audit, edge cases, and parser integration.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add .antigravityignore so Antigravity skips build/deps/media noise, and ensure matching heavy paths are covered in .gitignore.

Co-Authored-By: Warp <agent@warp.dev>
@zachshallbetter zachshallbetter closed this by deleting the head repository Oct 8, 2026
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.

1 participant