Conversation
Complexity Assessment for Issue #797Quick Scan Results:
Key FindingsRoot Cause: Linux kernel 128KB per-argument limit on execve() — the Approved Approach (from owner comment): Render agents to worktree subfolder (like Swarm mode does), use Files Affected:
Estimated Changes:
Cross-Cutting Changes Detected: YES
Architectural Signals Triggered: YES
Risk Assessment: MEDIUM-HIGH
Assessment SummaryComplexity: CROSS-CUTTING CHANGES + ARCHITECTURAL SIGNALS TRIGGERED This appears deceptively simple (4 files, ~250-350 LOC) but involves critical architectural coordination:
Complexity AssessmentClassification: COMPLEX Metrics:
Reasoning: Cross-cutting changes through the agent/MCP loading pipeline combined with architectural signals (uncertain upstream flag support, new file-based agent pattern) trigger COMPLEX classification despite moderate file and LOC counts. The fix requires coordinating multiple system layers and integration points that extend beyond simple file modifications. |
Analysis: Issue #797 - E2BIG when launching Claude on LinuxExecutive SummaryThe Questions and Key Decisions
HIGH/CRITICAL Risks
Impact Summary
Complete Technical Reference (click to expand for implementation details)Problem Space ResearchProblem UnderstandingLinux kernel enforces a ~128KB per-argument limit on Architectural ContextThe agent loading pipeline spans three layers:
Claude Code supports auto-discovery of agents from Edge Cases Identified
Codebase Research FindingsAffected Area: CLI argument constructionEntry Point: Dependencies:
Affected Area: Agent loading and formattingEntry Point: This method simply returns the agents object as-is. The heavy lifting is in
Affected Area: Swarm mode agent rendering (PATTERN TO FOLLOW)Entry Point: This method renders agents to For the non-swarm fix, agents need to be rendered with frontmatter so Claude Code auto-discovers them as proper subagents. Affected Area: System prompt passingEntry Point: The Affected Area: MCP config passingEntry Point: Swarm mode already writes MCP config to files via Similar Patterns Found
Agent File Format for Auto-DiscoveryClaude Code auto-discovers agents from ---
name: agent-name
description: When Claude should delegate to this subagent
tools: Read, Glob, Grep, Bash
model: sonnet
color: orange
---
System prompt body here...The
Architectural Flow AnalysisData Flow: agents (current, broken on Linux)Entry Point: Flow Path:
Affected Interfaces (all must be updated):
Data Flow: agents (proposed, file-based)Entry Point: Flow Path:
Data Flow: systemPrompt (proactive fix)Entry Point: Flow Path:
Proposed: Write to temp file, pass via Affected Files
Integration Points
Medium Severity Risks
|
Implementation Plan for Issue #797SummaryThe Questions and Key Decisions
High-Level Execution Phases
Quick Stats
Complete Implementation Guide (click to expand for step-by-step details)Automated Test Cases to CreateTest File:
|
Implementation Plan for Issue #797 (Revised)SummaryThe Questions and Key Decisions
High-Level Execution Phases
Quick Stats
Potential Risks (HIGH/CRITICAL only)
Complete Implementation Guide (click to expand for step-by-step details)Automated Test Cases to CreateTest File:
|
Implementation Progress
|
Code Review Fixes - Implementation
ETA: ~10 minutes |
On Linux, the --agents JSON (~215KB) exceeds the ~128KB per-argument kernel limit. On Windows, the ~32KB total command line limit is even tighter. Platform-specific strategy: - macOS: unchanged (inline --agents and --append-system-prompt) - Linux: render agents to .claude/agents/ for auto-discovery, keep system prompt inline (80KB < 128KB limit) - Windows: render agents to .claude/agents/, use SessionStart hook plugin via --plugin-dir for system prompt injection with /clear as initial prompt trigger Changes: - AgentManager.renderAgentsToDisk(): writes agent .md files with YAML frontmatter for Claude Code auto-discovery - system-prompt-writer: new utility for platform-specific system prompt delivery (inline on macOS/Linux, SessionStart hook on Windows) - claude.ts: add pluginDir option for --plugin-dir flag - ignite.ts: platform-gated agent rendering and system prompt handling in both executeInternal() and executeSwarmMode() Fixes #797
c4161f0 to
a797cac
Compare
Implementation CompleteSummaryRender agents to disk on non-Darwin platforms to avoid E2BIG error. macOS is completely unchanged. Linux renders agents to Changes Made
Validation Results
Detailed Changes by File (click to expand)src/lib/AgentManager.ts (+36 lines)Changes: Added
src/utils/system-prompt-writer.ts (NEW, ~80 lines)Changes: New platform-specific system prompt utility
src/utils/claude.ts (+10 lines)Changes: Added
src/commands/ignite.ts (+90/-28 lines)Changes: Platform-gated agent and system prompt handling
Test files (+453 lines)
|
Fixes #797
E2BIG when launching Claude on Linux — --agents JSON exceeds 128KB per-argument kernel limit
Description
il spinfails withspawn E2BIGon Linux when launching Claude because the total command-line arguments toclaudeexceed the kernel'sARG_MAXlimit (2MB on Linux).The
launchClaude()function insrc/utils/claude.tspasses the system prompt, MCP configs, agents JSON, and allowed tools list as CLI arguments via--append-system-prompt,--mcp-config,--agents, and--allowed-tools. When the system prompt is large (which is common with iloom's template system), the combined argument + environment size exceedsexecve()'s limit.Reproduction
il start <issue-number>oril spinfrom a worktreespawn E2BIGerror when Claude is launchedThis reproduces regardless of terminal backend (tested with tmux and direct invocation).
Root Cause
Linux
execve()enforcesARG_MAX(typically 2MB) as the combined limit for arguments + environment. The system prompt alone can be very large, and combined with MCP configs, agents JSON, and tool lists, the total easily exceeds this limit.On macOS,
ARG_MAXis 1MB but the effective limit isstack_size/4which is typically much larger (~16MB), so this issue may not manifest there.Possible Solutions
--append-system-prompt-file <path>(if Claude CLI supports it) instead of inlineEnvironment
ARG_MAX: 2097152Related
This PR was created automatically by iloom.