From d64524c8509672f302420966de1eee5ed148d553 Mon Sep 17 00:00:00 2001 From: shokollm <270575765+shokollm@users.noreply.github.com> Date: Thu, 2 Apr 2026 03:31:56 +0000 Subject: [PATCH] feat(kugetsu): add verbosity markdown context approach --- skills/kugetsu/scripts/kugetsu | 66 +++++++++++++++++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) diff --git a/skills/kugetsu/scripts/kugetsu b/skills/kugetsu/scripts/kugetsu index eb0d1a2..4eef300 100755 --- a/skills/kugetsu/scripts/kugetsu +++ b/skills/kugetsu/scripts/kugetsu @@ -9,6 +9,7 @@ INDEX_FILE="$KUGETSU_DIR/index.json" NOTIFICATIONS_FILE="$KUGETSU_DIR/notifications.json" LOGS_DIR="$KUGETSU_DIR/logs" ENV_DIR="${ENV_DIR:-$KUGETSU_DIR/env}" +VERBOSITY_DIR="$KUGETSU_DIR/verbosity" MAX_CONCURRENT_AGENTS="${MAX_CONCURRENT_AGENTS:-3}" KUGETSU_VERBOSITY="${KUGETSU_VERBOSITY:-total}" @@ -546,6 +547,62 @@ cmd_status() { echo "ok" } +get_verbosity_context() { + local verbosity="${KUGETSU_VERBOSITY:-total}" + local verbosity_file="$VERBOSITY_DIR/${verbosity}.md" + + if [ -f "$verbosity_file" ]; then + cat "$verbosity_file" + else + echo "## Verbosity: $verbosity" + echo "Verbosity level: $verbosity" + fi +} + +init_verbosity_templates() { + mkdir -p "$VERBOSITY_DIR" + + if [ ! -f "$VERBOSITY_DIR/total.md" ]; then + cat > "$VERBOSITY_DIR/total.md" << 'EOF' +## Verbosity: Total + +You are operating in HIGH verbosity mode. Include ALL available context: +- Full command outputs and their results +- Detailed reasoning and thinking process +- All file changes with diffs when relevant +- Complete log excerpts +- Comprehensive status updates +- Ask clarifying questions when uncertain +EOF + fi + + if [ ! -f "$VERBOSITY_DIR/medium.md" ]; then + cat > "$VERBOSITY_DIR/medium.md" << 'EOF' +## Verbosity: Medium + +You are operating in MEDIUM verbosity mode. Provide balanced output: +- Standard command outputs and key results +- Moderate reasoning detail +- Important file changes summarized +- Relevant log excerpts (not full) +- Regular status updates +EOF + fi + + if [ ! -f "$VERBOSITY_DIR/quiet.md" ]; then + cat > "$VERBOSITY_DIR/quiet.md" << 'EOF' +## Verbosity: Quiet + +You are operating in QUIET/MINIMAL verbosity mode. Keep output minimal: +- Only essential information +- Brief status updates (1-2 sentences) +- Final decisions only +- Yes/No answers when appropriate +- Skip detailed explanations unless requested +EOF + fi +} + cmd_delegate() { local message="${1:-}" local verbosity="${KUGETSU_VERBOSITY:-total}" @@ -568,6 +625,13 @@ cmd_delegate() { local temp_dir="${KUGETSU_TEMP_DIR:-$HOME/.local/share/opencode/tool-output}" mkdir -p "$ENV_DIR" + init_verbosity_templates + + local verbosity_context=$(get_verbosity_context) + local full_message="${verbosity_context} + +${message}" + local env_sh="set -a; export KUGETSU_TEMP_DIR='$temp_dir'; export KUGETSU_VERBOSITY='$verbosity'; " if [ -f "$ENV_DIR/pm-agent.env" ]; then env_sh="${env_sh}source '$ENV_DIR/pm-agent.env'; " @@ -576,7 +640,7 @@ cmd_delegate() { fi env_sh="${env_sh}set +a; " - nohup sh -c "${env_sh}opencode run '$message' --continue --session '$pm_session' >> '$log_file' 2>&1" > /dev/null 2>&1 & + nohup sh -c "${env_sh}opencode run '$full_message' --continue --session '$pm_session' >> '$log_file' 2>&1" > /dev/null 2>&1 & disown echo "Delegated to PM agent (logged to $(basename "$log_file"))" echo "Verbosity: $verbosity"