claude-tmux 1.0.8 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -15
- package/dist/index.js +11 -23
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -31,13 +31,12 @@ Add to your Claude Code MCP settings:
|
|
|
31
31
|
Launch a new Claude Code instance in a tmux session.
|
|
32
32
|
|
|
33
33
|
```
|
|
34
|
-
spawn(
|
|
34
|
+
spawn(name, prompt, workdir)
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
- `name`: Unique session name (e.g., 'refactor-auth', 'debug-api')
|
|
38
|
+
- `prompt`: Initial prompt to send to Claude
|
|
38
39
|
- `workdir`: Working directory for Claude to operate in
|
|
39
|
-
- `prompt`: Initial prompt to send to Claude on startup
|
|
40
|
-
- `dangerouslySkipPermissions`: Skip permission prompts for fully autonomous operation
|
|
41
40
|
|
|
42
41
|
### read
|
|
43
42
|
|
|
@@ -66,20 +65,14 @@ kill("task-name")
|
|
|
66
65
|
## Usage Pattern
|
|
67
66
|
|
|
68
67
|
```
|
|
69
|
-
spawn(
|
|
70
|
-
read(
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
For steering mid-task:
|
|
75
|
-
|
|
76
|
-
```
|
|
77
|
-
send("task-name", "do something else")
|
|
78
|
-
read("task-name") → waits for completion, returns output
|
|
68
|
+
spawn(name, prompt, workdir) → start session
|
|
69
|
+
read(name) → wait for completion, get output
|
|
70
|
+
send(name, text) → steer with follow-up
|
|
71
|
+
read(name) → wait for completion, get output
|
|
72
|
+
kill(name) → cleanup
|
|
79
73
|
```
|
|
80
74
|
|
|
81
75
|
## Tips
|
|
82
76
|
|
|
83
|
-
-
|
|
84
|
-
- User can attach manually: `tmux attach -t claude-<name>`
|
|
77
|
+
- Attach manually: `tmux attach -t claude-<name>`
|
|
85
78
|
- Always kill sessions when done to avoid orphaned processes
|
package/dist/index.js
CHANGED
|
@@ -85,7 +85,7 @@ async function waitForIdle(session) {
|
|
|
85
85
|
}
|
|
86
86
|
const server = new McpServer({
|
|
87
87
|
name: "claude-tmux",
|
|
88
|
-
version: "1.0.
|
|
88
|
+
version: "1.0.9",
|
|
89
89
|
}, {
|
|
90
90
|
instructions: `# claude-tmux: Autonomous Claude Agents
|
|
91
91
|
|
|
@@ -100,28 +100,22 @@ Spawn Claude Code instances in tmux sessions for long-running, independent tasks
|
|
|
100
100
|
## Pattern
|
|
101
101
|
|
|
102
102
|
\`\`\`
|
|
103
|
-
spawn(
|
|
104
|
-
read(
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
For steering mid-task:
|
|
109
|
-
\`\`\`
|
|
110
|
-
send("task-name", "do something else")
|
|
111
|
-
read("task-name") → waits for completion, returns output
|
|
103
|
+
spawn(name, prompt, workdir) → start session
|
|
104
|
+
read(name) → wait for completion, get output
|
|
105
|
+
send(name, text) → steer with follow-up
|
|
106
|
+
read(name) → wait for completion, get output
|
|
107
|
+
kill(name) → cleanup
|
|
112
108
|
\`\`\`
|
|
113
109
|
|
|
114
110
|
## Tips
|
|
115
|
-
- Use \`dangerouslySkipPermissions: true\` for fully autonomous operation
|
|
116
111
|
- User can attach manually: \`tmux attach -t claude-<name>\`
|
|
117
112
|
- Always kill sessions when done`,
|
|
118
113
|
});
|
|
119
114
|
server.tool("spawn", "Launch a new Claude Code instance in a tmux session. Creates an interactive session you can communicate with via send/read. The session runs until killed. Use for multi-turn conversations or tasks requiring steering.", {
|
|
120
115
|
name: z.string().min(1).max(50).describe("Unique session name (e.g., 'refactor-auth', 'debug-api')"),
|
|
116
|
+
prompt: z.string().describe("Initial prompt to send to Claude on startup"),
|
|
121
117
|
workdir: z.string().describe("Working directory for Claude to operate in"),
|
|
122
|
-
|
|
123
|
-
dangerouslySkipPermissions: z.boolean().optional().default(false).describe("Skip permission prompts for fully autonomous operation"),
|
|
124
|
-
}, async ({ name, workdir, prompt, dangerouslySkipPermissions }) => {
|
|
118
|
+
}, async ({ name, prompt, workdir }) => {
|
|
125
119
|
const session = sessionName(name);
|
|
126
120
|
runTmuxSafe(`kill-session -t "${session}"`);
|
|
127
121
|
try {
|
|
@@ -130,15 +124,9 @@ server.tool("spawn", "Launch a new Claude Code instance in a tmux session. Creat
|
|
|
130
124
|
catch (e) {
|
|
131
125
|
return { content: [{ type: "text", text: `Error: ${e.message}` }] };
|
|
132
126
|
}
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
writeFileSync(tempFile, prompt);
|
|
137
|
-
runTmux(`send-keys -t "${session}" 'claude ${flags}"$(cat ${tempFile})" && rm ${tempFile}' Enter`);
|
|
138
|
-
}
|
|
139
|
-
else {
|
|
140
|
-
runTmux(`send-keys -t "${session}" 'claude ${flags}' Enter`);
|
|
141
|
-
}
|
|
127
|
+
const tempFile = `/tmp/claude-prompt-${session}.txt`;
|
|
128
|
+
writeFileSync(tempFile, prompt);
|
|
129
|
+
runTmux(`send-keys -t "${session}" 'claude --dangerously-skip-permissions "$(cat ${tempFile})" && rm ${tempFile}' Enter`);
|
|
142
130
|
return { content: [{ type: "text", text: `Started ${session}` }] };
|
|
143
131
|
});
|
|
144
132
|
server.tool("read", "Wait for a Claude session to finish working and return the terminal output. You can continue other work while waiting.", {
|