From 2b30e3cc3e63f755971a8a064f3567ab0adbc342 Mon Sep 17 00:00:00 2001 From: Levi Neely <141506390+lneely@users.noreply.github.com> Date: Sun, 17 May 2026 15:04:06 +0200 Subject: [PATCH] add orchestrator/worker agents; update cascade defaults to deepseek v4 --- agents/orchestrator.json | 24 +++++++++++++++++++ agents/worker.json | 20 ++++++++++++++++ doc/env.sample | 8 +++++++ prompts/agent-orchestrator.md | 43 +++++++++++++++++++++++++++++++++++ scripts/u/cascade | 8 +++---- tools/cascade | 7 +++--- 6 files changed, 103 insertions(+), 7 deletions(-) create mode 100644 agents/orchestrator.json create mode 100644 agents/worker.json create mode 100644 prompts/agent-orchestrator.md diff --git a/agents/orchestrator.json b/agents/orchestrator.json new file mode 100644 index 0000000..5fc2eae --- /dev/null +++ b/agents/orchestrator.json @@ -0,0 +1,24 @@ +{ + "prompt": [ + "$OLLIE/x/prime SYSTEM_PROMPT", + "$OLLIE/x/prime agent-orchestrator", + "$OLLIE/x/prime tools-file", + "$OLLIE/x/prime tools-cascade" + ], + "model": "deepseek/deepseek-v4-pro", + "maxSteps": 30, + "temperature": 0.3, + "maxTokens": 8192, + "allowExecutors": ["call_tool", "pipe"], + "allowTools": [ + "file_read", + "file_glob", + "file_grep", + "cascade" + ], + "hooks": { + "turnError": [ + "$OLLIE/x/freeloader $OLLIE_SESSION_ID" + ] + } +} diff --git a/agents/worker.json b/agents/worker.json new file mode 100644 index 0000000..dd970f8 --- /dev/null +++ b/agents/worker.json @@ -0,0 +1,20 @@ +{ + "prompt": [ + "$OLLIE/x/prime SYSTEM_PROMPT", + "$OLLIE/x/prime tools-file", + "$OLLIE/x/prime tools-lsp" + ], + "model": "deepseek/deepseek-v4-flash", + "maxSteps": 50, + "temperature": 0.5, + "maxTokens": 16384, + "allowExecutors": ["execute_code", "call_tool", "pipe"], + "trustedTools": [ + "execute_code" + ], + "hooks": { + "turnError": [ + "$OLLIE/x/freeloader $OLLIE_SESSION_ID" + ] + } +} diff --git a/doc/env.sample b/doc/env.sample index 8a7b100..ba123b7 100644 --- a/doc/env.sample +++ b/doc/env.sample @@ -49,3 +49,11 @@ # u/complete: backend and model for acme code completion (required by u/complete) #OLLIE_COMPLETE_BACKEND=ollama #OLLIE_COMPLETE_MODEL=qwen3:latest + +# cascade: planner (orchestrator) model for u/cascade script +#OLLIE_CASCADE_PLAN_BACKEND=openrouter +#OLLIE_CASCADE_PLAN_MODEL=deepseek/deepseek-v4-pro + +# cascade: worker model for spawned agents +#OLLIE_CASCADE_BACKEND=openrouter +#OLLIE_CASCADE_MODEL=deepseek/deepseek-v4-flash \ No newline at end of file diff --git a/prompts/agent-orchestrator.md b/prompts/agent-orchestrator.md new file mode 100644 index 0000000..b6aa09c --- /dev/null +++ b/prompts/agent-orchestrator.md @@ -0,0 +1,43 @@ +You are an orchestrator agent. You plan and delegate — you never implement. + +# Role + +- Decompose tasks into self-contained subtasks. +- Delegate each subtask to a worker via `cascade`. +- Read files for context. Never write or edit files yourself. +- Synthesize worker results into a coherent response. + +# Constraints + +- **No code generation.** You do not write, edit, or produce code. Workers do that. +- **No execute_code.** You cannot run shell commands or scripts directly. +- **Read-only filesystem.** You may use `file_read`, `file_glob`, and `file_grep` to gather context. That is all. +- **Delegation via cascade only.** Use `cascade` to dispatch work to workers. + +# Delegation protocol + +Delegate with `call_tool`: +``` +call_tool: calls=[{tool: "cascade", args: [""]}] +``` + +Parallel fan-out: +``` +call_tool: calls=[ + {tool: "cascade", args: [""]}, + {tool: "cascade", args: [""]} +] +``` + +# Writing good instructions + +Each cascade instruction must be **completely self-contained**. The worker has no context beyond what you provide. Include: +- Absolute file paths +- Exact expected behavior or output format +- Relevant code snippets or constraints the worker needs + +# After delegation + +- Do not wait or poll. End your turn after dispatching. +- Workers report back asynchronously via `[from=...]` messages. +- When results arrive, verify they satisfy the original task, then synthesize a final answer. diff --git a/scripts/u/cascade b/scripts/u/cascade index d3962a5..532037b 100755 --- a/scripts/u/cascade +++ b/scripts/u/cascade @@ -21,10 +21,10 @@ set -euo pipefail OLLIE="${OLLIE:-$HOME/mnt/ollie}" B="$OLLIE/s/b" -PB="${OLLIE_CASCADE_PLAN_BACKEND:-anthropic}" -PM="${OLLIE_CASCADE_PLAN_MODEL:-claude-sonnet-4-20250514}" -WB="${OLLIE_CASCADE_BACKEND:-ollama}" -WM="${OLLIE_CASCADE_MODEL:-qwen2.5-coder:14b}" +PB="${OLLIE_CASCADE_PLAN_BACKEND:-openrouter}" +PM="${OLLIE_CASCADE_PLAN_MODEL:-deepseek/deepseek-v4-pro}" +WB="${OLLIE_CASCADE_BACKEND:-openrouter}" +WM="${OLLIE_CASCADE_MODEL:-deepseek/deepseek-v4-flash}" die() { printf 'cascade: %s\n' "$*" >&2; exit 1; } diff --git a/tools/cascade b/tools/cascade index cb14b07..0f88ce7 100755 --- a/tools/cascade +++ b/tools/cascade @@ -5,8 +5,8 @@ set -euo pipefail OLLIE="${OLLIE:-$HOME/mnt/ollie}" -BACKEND="${OLLIE_CASCADE_BACKEND:-ollama}" -MODEL="${OLLIE_CASCADE_MODEL:-qwen2.5-coder:14b}" +BACKEND="${OLLIE_CASCADE_BACKEND:-openrouter}" +MODEL="${OLLIE_CASCADE_MODEL:-deepseek/deepseek-v4-flash}" die() { printf 'cascade: %s\n' "$*" >&2; exit 1; } @@ -21,7 +21,8 @@ id="${2:-cascade-$(date +%s%N)-$$-$(hostname -s)}" kv="name=${id} cwd=$(pwd) backend=${BACKEND} -model=${MODEL}" +model=${MODEL} +agent=worker" printf '%s\n' "$kv" > "$OLLIE/s/new" || die "failed to create session" B="$OLLIE/s/$id"