You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(.agents): improve tmux session management with JSON output and robust parsing
- tmux-start.sh now outputs JSON: {status:"success",sessionName:"..."}
- Add proper JSON escaping for special chars (backslash, quote, newline, tab, cr)
- tmux-cli.sh parses JSON internally, returns plain session name for callers
- Simplify CLI agent handleSteps to parse plain text instead of JSON
- Add TmuxStartResult type for the JSON contract
- Fix stdout/stderr consistency: errors now go to stderr in both modes
- Remove conflicting manual tmux start instructions from system prompt
- Add skipPrepPhase config flag for agents that start sessions immediately
Copy file name to clipboardExpand all lines: .agents/lib/cli-agent-prompts.ts
+21-35Lines changed: 21 additions & 35 deletions
Original file line number
Diff line number
Diff line change
@@ -102,64 +102,44 @@ export function getSystemPrompt(config: CliAgentConfig): string {
102
102
103
103
return`You are an expert at using ${config.cliName} CLI via tmux for implementation work and code reviews. You have access to helper scripts that handle the complexities of tmux communication with TUI apps.
104
104
105
-
## ${config.cliName} Startup
105
+
## Session Management
106
106
107
-
To start ${config.cliName}, use the \`--command\` flag with permission bypass:
107
+
**A tmux session is started for you automatically.** The session name will be announced in an assistant message. Use that session name (stored in \`$SESSION\`) for all subsequent commands.
constmodeChecks=nonDefaultModes.map(m=>`- If \`mode\` is "${m}": follow **${modeNames[m]}** instructions`).join('\n')
293
273
294
-
return`Instructions:
274
+
constworkflowSection=config.skipPrepPhase
275
+
? `## Workflow
295
276
296
-
## Two-Phase Workflow
277
+
**A tmux session is started for you immediately.** An assistant message will announce the session name. **Do NOT start a new session** - use the one provided.`
278
+
: `## Two-Phase Workflow
297
279
298
280
This agent operates in two phases:
299
281
@@ -307,7 +289,11 @@ You have an opportunity to prepare before the CLI session starts. Use this time
307
289
After your preparation turn, a tmux session will be started automatically.
308
290
309
291
### Phase 2: CLI Execution
310
-
Once the session starts, an assistant message will announce the session name. **Do NOT start a new session** - use the one provided.
292
+
Once the session starts, an assistant message will announce the session name. **Do NOT start a new session** - use the one provided.`
293
+
294
+
return`Instructions:
295
+
296
+
${workflowSection}
311
297
312
298
Check the \`mode\` parameter to determine your operation:
0 commit comments