- fork_agent() now returns exit code instead of echoing status
- cmd_continue() returns exit code 2 when max agents reached
- cmd_continue() returns exit code 1 for general errors (instead of exit 1)
- ensure_worktree() returns exit code 2 for max agents condition
- Add EXITCODES.md documenting all exit codes
Closes#248
- Add KUGETSU_BASE_BRANCH env var (default: origin/main)
- Update check_task_completion() to use configurable base branch
- Update create_worktree() to use configurable base branch
Closes#165
- kugetsu: show only parent commands, not all subcommands inline
- kugetsu <command> help: show help for specific command
- kugetsu queue: show queue subcommands (list, stats, clear, enqueue)
- kugetsu queue-daemon: show daemon subcommands (start, stop, restart, status, logs)
- kugetsu env: show env subcommands (list, get, set, rm)
- kugetsu server: show server subcommands (list, add, remove, default, get)
Closes#244
- Extract conflict_check and delegator_section as conditional variables
- Single heredoc instead of duplicate blocks
- Resolve code duplication raised in PR comment
Dev agent should:
1. Check if PR has merge conflicts before asking for review
2. Read review comments and incorporate feedback
3. Understand review states: APPROVED = ready to merge, COMMENT = feedback to address
This prevents approving a PR that has conflicts, and ensures dev agents
respond to reviewer comments appropriately.
Previously when a user message was provided, cmd_continue would only
use the user message without the base agent workflow. Now both cases
build the full workflow and append the user message.
Changes:
- cmd_continue now always calls build_dev_agent_message even when
message is provided
- User message is appended at the end with 'Delegator's message:'
- Both with/without message cases now use the same workflow structure
Fixes#229
When worktree exists but session is missing, ensure_session was
incorrectly removing the worktree before recreating. This caused
issues when cmd_continue called ensure_worktree first (creating the
worktree) then ensure_session (which wrongly removed it).
The fix removes the block that removes worktree when session is missing.
If worktree exists, just create the session without touching the worktree.
Fixes#229
- Add ensure_worktree() - creates worktree if missing, returns status
- Add ensure_session() - creates session if missing, handles inconsistent states
- Add fork_agent() - extracted agent forking logic
- Refactor cmd_continue() to use ensure_* functions (idempotent)
- Make cmd_start() a thin wrapper calling cmd_continue()
- Simplify daemon to always call cmd_continue (no existence check)
This makes cmd_continue truly idempotent - it will:
- Continue existing session if it exists
- Create session and worktree if they don't exist
- Clean and recreate if state is inconsistent
Closes#168
The for loop was overwriting message each iteration, causing only
the last word to survive. Changed to accumulate all words with
proper spacing.
Fixes#225
Check notified_at timestamp in check_task_completion() and mark tasks
as error if they exceed TASK_TIMEOUT_HOURS (defaults to 1 hour).
When timeout is detected:
- Kill the task process (PID) if running
- Stop the opencode session if exists
- Mark queue item as error state
Fixes#166
Add clear distinction between Task Mode (delegate) and Conversation Mode
(answer directly).
- Add kugetsu start tool with params and when to use
- Add kugetsu continue tool with params and when to use
- Add guidance on how to choose between start vs continue
- Add examples for conversation mode responses
- Improve few-shot examples with mode identification
Fixes#220
cmd_delegate deletes the message file immediately after spawning the
background nohup process, causing a race condition where opencode run
may not have read the file yet.
Error: File not found: msg-ses_xxx.txt
Fix by removing rm -f "$msg_file", consistent with cmd_start and
cmd_continue which write to $worktree_path/.kugetsu-msg.txt and never
delete it. Orphaned msg files in $LOGS_DIR/ are harmless.
Fixes#210
The queue daemon crashes with 'set_debug_mode: command not found'
because cmd_continue() calls set_debug_mode(), but that function
was only defined in the main kugetsu script.
Instead of duplicating the function, move it to kugetsu-config.sh
which is always sourced before kugetsu-session.sh in all contexts.
Fixes#207