[Bug]: Windows: Claude Code backend receives only the first line of the assistant rule (spawned via cmd /c claude.cmd; also hits 8191-char limit)
Module
Agent Detection & Connection
Platform
Windows
AionUi Version
v2.2.2 (bundled aioncore 0.2.2)
Bug Description
On Windows, AionUi launches the Claude Code backend by resolving claude to the npm batch wrapper %APPDATA%\npm\claude.cmd and spawning it as cmd /d /c %APPDATA%\npm\claude.cmd <args>. claude.cmd forwards its arguments to claude.exe with %*.
This causes two defects:
- Arguments are cut at the first newline. The assistant rule is multi-line and is passed via
--append-system-prompt. The childclaude.exereceives only the first line of the rule; everything after it is silently dropped, including the rest of the prompt and all trailing arguments (--add-dirfor skills,--mcp-configfor MCP,--plugin-dir). No error is shown — the session starts normally, but without its instructions, skills, or MCP tools. - The 8,191-character
cmd.execommand-line limit applies. When the rule plus skills/MCP arguments exceed it, the session fails to start (we observedhandshake timeout/os error 232when creating a new team), while existing sessions keep working.
Environment: Windows 11 Education 10.0.26200 (x64), Claude Code 2.1.280 installed globally via npm (@anthropic-ai/claude-code).
Steps to Reproduce
- Windows, Claude Code installed with
npm install -g @anthropic-ai/claude-code(so%APPDATA%\npm\containsclaude,claude.cmd,claude.ps1, and noclaude.exe). - In AionUi, create an assistant on the Claude Code backend with a multi-line rule and at least one skill.
- Start a conversation with it (standalone or as a team member).
- Inspect the command lines of the spawned processes, e.g.
Get-CimInstance Win32_Process -Filter "Name='claude.exe'" | Select ProcessId,ParentProcessId,CommandLine, and compare with the parentcmd.exe. - Ask the assistant to quote the second paragraph of its rule — it cannot.
Expected Behavior
claude.exe receives the full multi-line system prompt and all --add-dir / --mcp-config / --plugin-dir arguments, and the launch is not subject to cmd.exe's 8,191-character limit.
Actual Behavior
The claude.exe command line ends inside --append-system-prompt, right after the first line of the rule. Measured on 7 concurrent sessions (parent cmd.exe → child claude.exe command-line length):
| Session | Parent cmd.exe |
Child claude.exe |
--add-dir |
--mcp-config |
|---|---|---|---|---|
| 1 | 2,012 | 335 | lost (0 of 7) | lost |
| 2 | 4,096 | 343 | lost | lost |
| 3 | 6,217 | 330 | lost | lost |
| 4 | 6,174 | 337 | lost | lost |
| 5 | 7,166 | 337 | lost | lost |
| 6 | 7,108 | 337 | lost | lost |
| 7 | 4,347 | 351 | lost | lost |
All 7 were cut at the first newline of --append-system-prompt. The parent cmd.exe command lines were complete.
%APPDATA%\npm\claude.cmd:
"%dp0%\node_modules\@anthropic-ai\claude-code\bin\claude.exe" %*Additional Context
Suggested fix
- Do not launch Claude Code through
claude.cmd. The npm package ships a native binary atnode_modules/@anthropic-ai/claude-code/bin/claude.exe; resolve to it and spawn it directly (nocmd.exe). This removes both the newline truncation and the 8,191 limit (theCreateProcesslimit is 32,767). - Longer term, pass the system prompt through a file instead of the command line — Claude Code supports
--append-system-prompt-file <path>— so prompt size and content never depend on shell quoting or command-line limits.
Workaround we are using
Create a hard link claude.exe next to claude.cmd (no admin rights needed):
mklink /H "%APPDATA%\npm\claude.exe" "%APPDATA%\npm\node_modules\@anthropic-ai\claude-code\bin\claude.exe"aioncore then resolves claude to claude.exe (.EXE precedes .CMD in PATHEXT) and spawns it directly. After this, new sessions are started directly by aioncore.exe with the full command line (e.g. 2,002 and 6,221 characters, --add-dir and --mcp-config present), and the assistants can quote their full rules. It only affects sessions started after the link is created.
Caveat: when Claude Code is upgraded, npm replaces the files under node_modules, and the hard link keeps pointing at the old binary, so AionUi silently runs the old version. The link has to be deleted and recreated after every upgrade — which is why a fix in AionUi would be much better.
Source: iOfficeAI/AionUi