Skip to content

Reimplement Claude Code adapter#39

Merged
codeaholicguy merged 4 commits intomainfrom
feature-reimpl-claude-code-adapter
Mar 12, 2026
Merged

Reimplement Claude Code adapter#39
codeaholicguy merged 4 commits intomainfrom
feature-reimpl-claude-code-adapter

Conversation

@codeaholicguy
Copy link
Owner

@codeaholicguy codeaholicguy commented Mar 10, 2026

Summary

  • Rewrites ClaudeCodeAdapter internals to follow the same structural patterns as CodexAdapter, process start time matching, bounded session scanning, and phased session-to-process matching
  • Adds process start time matching for accurate session pairing when multiple Claude processes share the same CWD
  • Replaces greedy any mode with tolerance-gated cwd -> missing-cwd -> parent-child matching phases to prevent cross-project session stealing
  • Removes history.jsonl dependency — summaries extracted directly from session JSONL with command tag parsing and noise filtering
  • Public API is unchanged

Key changes

Session matching (cwd -> missing-cwd -> parent-child):

  • cwd/missing-cwd modes defer assignment when the best candidate is outside the 2-minute start-time tolerance, allowing parent-child mode to find a better match (e.g., worktree sessions)
  • parent-child mode matches when process CWD equals, is a parent of, or is a child of session path, acts as a safety net for deferred matches
  • Within tolerance, candidates are ranked by recency (most recent activity) instead of smallest time difference

Session parsing:

  • sessionStart parsed from first JSONL entry, including snapshot.timestamp for file-history-snapshot entries
  • Metadata entry types (last-prompt, file-history-snapshot) excluded from lastEntryType tracking
  • sessions-index.json is optional, falls back to lastCwd from session content
  • Breadth-first bounded scanning ensures at least one session per project directory

Process detection:

  • isClaudeExecutable() checks executable basename (claude/claude.exe) instead of substring matching, prevents false positives from processes with "claude" in path arguments

Status & summary:

  • No age-based IDLE override, every listed agent is backed by a running process, so entry type is the correct status indicator
  • Process-only agents (no session file) show IDLE status with "Unknown" summary
  • Summary extracted from last user message with <command-message> tag parsing and skill expansion ARGUMENTS extraction

@codeaholicguy codeaholicguy merged commit d50bd9b into main Mar 12, 2026
1 check passed
@codeaholicguy codeaholicguy deleted the feature-reimpl-claude-code-adapter branch March 12, 2026 01:23
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