Add fork-session lane, /kill command, and auto-routing#20
Open
1872-svg wants to merge 3 commits intomoazbuilds:masterfrom
Open
Add fork-session lane, /kill command, and auto-routing#201872-svg wants to merge 3 commits intomoazbuilds:masterfrom
1872-svg wants to merge 3 commits intomoazbuilds:masterfrom
Conversation
4 tasks
- /fork <prompt>: spawns a parallel lightweight watcher agent outside the main serial queue. Uses a dedicated system prompt that hard-denies long-running tasks (compilation, downloads, fuzzing) to keep it responsive for monitoring the main agent. - /kill: sends SIGTERM to the active claude subprocess immediately. - activeProc tracking in runClaudeOnce() enables kill to work from any handler without exposing the proc externally. - Fork agent is given the session JSONL path so it can peek at main agent progress mid-task.
When the main serial queue is processing a task, new incoming messages are automatically handled by the fork agent instead of queuing behind it. This makes fork behavior transparent — users just chat normally without needing to type /fork manually. - Add mainRunning flag + isMainBusy() export in runner.ts - telegram.ts checks isMainBusy() before dispatching and routes to runFork() if main is occupied
Hardcode FORK_MODEL to claude-haiku-4-5-20251001 — forks are meant to be fast watchers, not reasoning agents. Add explicit speed instructions to the system prompt: 1-3 sentences, no preamble, no over-analysis.
8bb7ab8 to
0f1f920
Compare
Fenrur
added a commit
to Fenrur/claudeclaw
that referenced
this pull request
Mar 13, 2026
… and /kill command From upstream PR moazbuilds#21 by 1872-svg (streaming + verbose) and PR moazbuilds#20 (fork agent). - Streaming output via editMessageText for real-time response display - /verbose command to show tool calls in Telegram - /fork command for parallel lightweight agent using Haiku - /kill command to terminate active agent - Auto-routing to fork when main agent is busy - Merged with additionalDirs (moazbuilds#13) and session corruption fix (moazbuilds#26) Co-Authored-By: 1872-svg <1872-svg@users.noreply.github.com>
justmaker
added a commit
to justmaker/claudeclaw
that referenced
this pull request
Mar 31, 2026
- 新增 tests/runner.test.ts(buildChildEnv、rate limit、security args、queue、timeout) - 新增 tests/config.test.ts(resolvePrompt、parseSettings、Discord snowflake、exclude windows) - 新增 tests/sessions.test.ts(session CRUD、turnCount、compactWarned、backup) - package.json 新增 test script - README 新增 Testing section(測試覆蓋範圍表格) - 全部 178 tests 通過
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/fork <prompt>spawns a parallel Claude session that doesn't touch the main session or queue. Useful for checking progress or asking quick questions while the main agent is running a long task./killcommand: Terminates the currently running Claude subprocess immediately.How it works
runner.tsexportskillActive(),isMainBusy(), andrunFork(). The fork agent runs with--output-format jsonin a separate subprocess, bypassing the serial queue used by the main session.In
telegram.ts,handleMessagechecksisMainBusy()before dispatching — busy → fork, idle → main session.Test plan
/fork what are you doing?— should get a fast response without interrupting the main task/killwhile a task is running — should terminate and confirm/killwith nothing running — should report "No active agent running"