diff --git a/navi/api/routes/admin.py b/navi/api/routes/admin.py index aae824b..feae6e2 100644 --- a/navi/api/routes/admin.py +++ b/navi/api/routes/admin.py @@ -333,22 +333,16 @@ "top_p": profile.top_p, "num_thread": profile.num_thread, "max_iterations": profile.max_iterations, - "planning_enabled": profile.planning_enabled, - "planning_mandatory": profile.planning_mandatory, "planning_phase1_enabled": profile.planning_phase1_enabled, - "planning_phase2_enabled": profile.planning_phase2_enabled, "planning_phase3_enabled": profile.planning_phase3_enabled, "think_enabled": profile.think_enabled, "iteration_budget_enabled": profile.iteration_budget_enabled, "goal_anchoring_enabled": profile.goal_anchoring_enabled, "goal_anchoring_interval": profile.goal_anchoring_interval, "scope_boundary_enabled": profile.scope_boundary_enabled, - "observe_skips_plan_enabled": profile.observe_skips_plan_enabled, "anti_stall_enabled": profile.anti_stall_enabled, "anti_stall_threshold": profile.anti_stall_threshold, "step_validation_enabled": profile.step_validation_enabled, - "adaptive_replan_enabled": profile.adaptive_replan_enabled, - "adaptive_long_step_threshold": profile.adaptive_long_step_threshold, "final_intercept_enabled": profile.final_intercept_enabled, "final_intercept_limit": profile.final_intercept_limit, "subagent_planning_enabled": profile.subagent_planning_enabled, diff --git a/navi/profiles/base.py b/navi/profiles/base.py index d245696..7f7340a 100644 --- a/navi/profiles/base.py +++ b/navi/profiles/base.py @@ -49,7 +49,6 @@ # Number of CPU threads for local inference. None = Ollama default (physical cores). # Cloud models ignore this option. num_thread: int | None = None - planning_enabled: bool = False # if True, run a planning LLM call before the main loop # Profile discoverability — used for system prompt injection and list_profiles tool. # short_description: 1-line summary shown in every system prompt to all profiles. @@ -78,19 +77,14 @@ iteration_budget_enabled: bool = True # ── Planning phases ─────────────────────────────────────────────────────── - # planning_mandatory: if True, the DIRECT shortcut is never offered to the - # model — planning always runs in full. If False, the model can output DIRECT - # to skip straight to execution (simple requests bypass planning). - # First-message planning is always forced regardless of this flag. - planning_mandatory: bool = False - + # Top-level planning is agent-invoked via the `plan` tool; sub-agents run + # the pipeline automatically before their tool loop. # Individual phase switches — allow disabling expensive phases for profiles # that don't need them. - # Phase 1: task analysis (TASK/GOAL/UNKNOWNS). Entry point for the pipeline. + # Phase 1: task analysis (TASK/GOAL/UNKNOWNS/COMPLEXITY). Entry point for + # the pipeline. Sub-agents may output DIRECT to skip planning for trivial + # subtasks. planning_phase1_enabled: bool = True - # Phase 2: structured review (Critic/Pragmatist/Detailer + Plan Adjustments). - # Adds 1 LLM call only when Phase 1 outputs REFLECT: yes. - planning_phase2_enabled: bool = False # Phase 3: structured execution plan (numbered steps with TOOL/AGENT/SELF). planning_phase3_enabled: bool = True @@ -105,29 +99,16 @@ # OFF = legacy "free flight" behavior (explore broadly, finish discovered work). scope_boundary_enabled: bool = False - # Observe vs act: when True, a Phase 1 analysis that classifies the request as - # MODE: observe (look/read/explain/inspect/list — no changes requested) skips - # Phase 2/3 — no multi-step execution plan, no auto-todo, no "execute step by - # step" prompt. The agent just gathers info with tools and answers. - # OFF = every non-trivial request gets a full execution plan. - observe_skips_plan_enabled: bool = False - # Detect when the model is looping without todo progress for # anti_stall_threshold iterations and inject a hard warning. anti_stall_enabled: bool = True anti_stall_threshold: int = 8 - # Adaptive re-plan "long step" nudge: when the current step stays in_progress - # for this many iterations without a todo status change, inject a message - # asking the model to split the step (earlier than the general anti-stall - # warning). 0 = disabled. Only fires when adaptive_replan_enabled is True. - adaptive_long_step_threshold: int = 4 - # Final-turn intercept: when the model ends a turn with bare text (no tool - # call) but the todo still has open steps, the anti-stall/adaptive nudges - # never fired — they live *inside* the tool-loop and a bare-text turn closes + # call) but the todo still has open steps, the anti-stall warning never + # fired — it lives *inside* the tool-loop and a bare-text turn closes # the run before post_turn runs. Instead of closing, inject a nudge and - # continue the loop so the model calls reflect/replan/todo or acts. Bounded + # continue the loop so the model calls reflect/plan/todo or acts. Bounded # by final_intercept_limit (after that, the run finalises as normal). # False = disabled. final_intercept_enabled: bool = True @@ -137,10 +118,6 @@ # "did the result actually satisfy the step goal?" Adds ~1 LLM call per step. step_validation_enabled: bool = False - # When a todo step is marked as failed, trigger a lightweight re-planning - # pass to adjust the remaining steps. Depends on step_validation. - adaptive_replan_enabled: bool = False - # Sub-agent configuration # subagent_system_prompt: injected as an additional system message for sub-agents, # after the profile's main system_prompt. Loaded from subagent_system_prompt.txt if present. diff --git a/navi/profiles/developer/config.json b/navi/profiles/developer/config.json index 3b9d9a6..ecd9b69 100644 --- a/navi/profiles/developer/config.json +++ b/navi/profiles/developer/config.json @@ -10,8 +10,9 @@ }, "llm_backend": "ollama", "model": [ - "gemma4:12b-it-qat-128k", + "glm-5.3-flash:cloud", "gemma4:31b-cloud", + "gemma4:12b-it-qat-128k", "qwen3.5:397b-cloud", "gemma4:26b-a4b-it-q4_K_M", "kimi-k2.6:cloud", @@ -19,7 +20,6 @@ ], "temperature": 0.35, "max_iterations": 100, - "planning_enabled": true, "subagent_planning_enabled": true, "think_enabled": true, "iteration_budget_enabled": true, @@ -27,12 +27,8 @@ "goal_anchoring_interval": 5, "anti_stall_enabled": true, "anti_stall_threshold": 8, - "observe_skips_plan_enabled": true, "step_validation_enabled": false, - "adaptive_replan_enabled": true, - "planning_mandatory": false, "planning_phase1_enabled": true, - "planning_phase2_enabled": true, "planning_phase3_enabled": true, "top_k": 40, "top_p": 0.88, @@ -43,7 +39,7 @@ "todo", "scratchpad", "reflect", - "replan", + "plan", "switch_profile", "list_profiles", "filesystem", diff --git a/navi/profiles/developer/system_prompt.txt b/navi/profiles/developer/system_prompt.txt index 0473d45..a07632f 100644 --- a/navi/profiles/developer/system_prompt.txt +++ b/navi/profiles/developer/system_prompt.txt @@ -41,7 +41,7 @@ ## Workflow 1. **Understand** — before writing anything, survey where the change lands: entry points, the module/function touched, and the conventions around it. If the project keeps notes or docs, read them first to orient (see the Documentation section below), then `grep`/`find` to locate symbols. Read the specific region you'll edit — not the whole project. Never assume structure. -2. **Plan** — for non-trivial act-tasks, the planner produces a structured plan and auto-populates a `todo`; execute it step by step (update `todo` as you go) instead of re-planning. For observe tasks (read/explain/inspect) no plan is generated — gather with tools and answer directly. +2. **Plan** — for non-trivial act-tasks, call the `plan` tool before executing: it produces a structured plan and auto-populates a `todo`; execute step by step (update `todo` as you go). If the tool flags the task as complex, present the plan briefly to the user and wait for their confirmation before executing. For observe tasks (read/explain/inspect) and trivial work, skip planning — gather with tools and answer/act directly. 3. **Implement** — write code. Follow the style and conventions already in the project. 4. **Test & verify** — after code changes, run the relevant tests or build (`terminal`/`code_exec`). If the project has a linter, run it on the changed files. If there are no tests, at least syntax-check (`python -m py_compile `) and exercise the affected code path. Never claim "done" without verification output in hand (record it in the `todo` `validation` when marking done). 5. **Report** — what was done, what was tested, any caveats. @@ -82,17 +82,16 @@ - **Sub-agent handoff** — before `spawn_agent`, write what the sub-agent needs (files, snippets, how to verify) into the `context_transfer` scratchpad section; it's injected into the sub-agent automatically. The sub-agent does NOT inherit your short-term memory. - **`schedule_recall`** — when a task may hit the iteration limit, or has a wait/poll cycle (build, deploy, log watch), schedule a recall with a self-instruction naming specific tools/files (future-you has the tools, not your memory). Use `immediate` to continue after the limit or offload heavy work headlessly; chain recalls for multi-phase work. Only one pending recall per session — `manage_recall cancel` before a new one. - **`reflect`** — before a genuinely complex plan or when stuck (repeated tool failures), call `reflect` to surface assumptions/gaps. It costs 3 LLM calls — use selectively, not on routine edits. -- **`replan`** — when the **structure** of the remaining plan is stale because of what you discovered mid-task (a step is unnecessary, the real problem differs from the assumed one, new constraints appeared — NOT because a step failed, that's `[Adaptive re-plan]`), call `replan` with a short `reason` (what changed) and optional `updated_goal`. It re-runs the planner over your current context + `todo` + `scratchpad` findings/errors and replaces the plan and `todo`. Distinguish from: `[Adaptive re-plan]` (a step failed — revise the `todo` inline, no planner call), a small `todo` edit (drop/merge/reorder 1-2 steps — edit inline, no planner call), and `reflect` (you're unsure what's wrong — surfaces assumptions, no plan change). Costs 1–3 LLM calls — use only when the remaining steps no longer fit as a whole. +- **`plan`** — call BEFORE starting execution of a non-trivial multi-step task (several files/systems, research, real risk): it decomposes the task into a structured plan with executors and auto-populates the `todo`. Re-plan: pass a short `reason` (what changed) and optional `updated_goal` when the **structure** of the remaining plan is stale mid-task (a step is unnecessary, the real problem differs from the assumed one, new constraints appeared). It re-runs the planner over your current context + `todo` + `scratchpad` findings/errors and replaces the plan and `todo`. Distinguish from: a failed step (revise the `todo` inline, no planner call), a small `todo` edit (drop/merge/reorder 1-2 steps — edit inline, no planner call), and `reflect` (you're unsure what's wrong — surfaces assumptions, no plan change). Costs 2 LLM calls — use selectively. - **`memory`** — global cross-project facts (prefs, environment); not a substitute for `scratchpad` (session) or `docs/` (project). ### System signals you'll see These are injected by the runtime, not free-form notes — recognise them and act accordingly: - `[Goal anchor]` — your original request + current `todo`, re-injected every few iterations. It uses the original request and your `todo` (not `scratchpad`), so keep `todo` updated to reflect real progress. - `[Anti-stall warning]` — you're repeating without progress; change approach, `reflect`, or mark the step failed and move on. -- `[Adaptive re-plan]` — a step just failed; before continuing, revise the plan with `todo` (replace remaining steps or mark failed/skipped with validation), then proceed with an approach that accounts for what went wrong. - `[Iteration N/M]` — budget counter. At `CRITICAL`, finish or produce a partial result now; don't start new subtasks. If the work can't fit, `schedule_recall` to continue. -On long tasks: re-read the latest user request, trust verified tool output over earlier assumptions, and when stuck — `reflect` or replan instead of repeating the same failing call. Your own thinking from earlier turns isn't re-injected — put conclusions in your content or `scratchpad`. After context compression the plan's per-step executor assignments are lost (only the summary + `todo` survive) — record them in `scratchpad` if you'll need them. +On long tasks: re-read the latest user request, trust verified tool output over earlier assumptions, and when stuck — `reflect` or re-plan with `plan` instead of repeating the same failing call. Your own thinking from earlier turns isn't re-injected — put conclusions in your content or `scratchpad`. After context compression the plan's per-step executor assignments are lost (only the summary + `todo` survive) — record them in `scratchpad` if you'll need them. --- diff --git a/navi/profiles/discuss/config.json b/navi/profiles/discuss/config.json index ce4248e..e3ed4bf 100644 --- a/navi/profiles/discuss/config.json +++ b/navi/profiles/discuss/config.json @@ -4,8 +4,8 @@ "description": "Creative partner for Q&A, brainstorming, and idea exploration. High creativity, free-form thinking.", "short_description": "Creative Q&A and idea discussion — best for open questions, brainstorming, and exploring concepts.", "model": [ - "gemma4:12b-it-qat-128k", "gemma4:31b-cloud", + "gemma4:12b-it-qat-128k", "qwen3.5:397b-cloud", "gemma4:26b-a4b-it-q4_K_M", "kimi-k2.6:cloud", @@ -13,10 +13,7 @@ ], "temperature": 0.65, "max_iterations": 30, - "planning_enabled": false, - "planning_mandatory": false, "planning_phase1_enabled": true, - "planning_phase2_enabled": false, "planning_phase3_enabled": false, "think_enabled": true, "iteration_budget_enabled": true, @@ -25,7 +22,6 @@ "anti_stall_enabled": true, "anti_stall_threshold": 5, "step_validation_enabled": false, - "adaptive_replan_enabled": false, "subagent_planning_enabled": false, "top_k": 80, "top_p": 0.95, diff --git a/navi/profiles/loader.py b/navi/profiles/loader.py index 6fcab3a..449fd35 100644 --- a/navi/profiles/loader.py +++ b/navi/profiles/loader.py @@ -59,10 +59,6 @@ else "" ) - # planning_phase2_enabled supersedes the old planning_reflect_enabled key. - # If only the old key is present, migrate its value transparently. - phase2_default = config.get("planning_reflect_enabled", False) - # New explicit tool config or legacy migration _tools_raw = config.get("tools") _tools = ToolConfig.model_validate(_tools_raw) if _tools_raw else ToolConfig() @@ -88,10 +84,7 @@ top_p=config.get("top_p", None), num_thread=config.get("num_thread", None), max_iterations=config.get("max_iterations", 20), - planning_enabled=config.get("planning_enabled", False), - planning_mandatory=config.get("planning_mandatory", False), planning_phase1_enabled=config.get("planning_phase1_enabled", True), - planning_phase2_enabled=config.get("planning_phase2_enabled", phase2_default), planning_phase3_enabled=config.get("planning_phase3_enabled", True), short_description=config.get("short_description", ""), full_description=config.get("full_description", {}), @@ -101,12 +94,9 @@ goal_anchoring_enabled=config.get("goal_anchoring_enabled", True), goal_anchoring_interval=config.get("goal_anchoring_interval", 5), scope_boundary_enabled=config.get("scope_boundary_enabled", False), - observe_skips_plan_enabled=config.get("observe_skips_plan_enabled", False), anti_stall_enabled=config.get("anti_stall_enabled", True), anti_stall_threshold=config.get("anti_stall_threshold", 8), step_validation_enabled=config.get("step_validation_enabled", False), - adaptive_replan_enabled=config.get("adaptive_replan_enabled", False), - adaptive_long_step_threshold=config.get("adaptive_long_step_threshold", 4), final_intercept_enabled=config.get("final_intercept_enabled", True), final_intercept_limit=config.get("final_intercept_limit", 2), subagent_planning_enabled=config.get("subagent_planning_enabled", False), @@ -148,22 +138,16 @@ "top_k": profile.top_k, "top_p": profile.top_p, "num_thread": profile.num_thread, - "planning_enabled": profile.planning_enabled, - "planning_mandatory": profile.planning_mandatory, "planning_phase1_enabled": profile.planning_phase1_enabled, - "planning_phase2_enabled": profile.planning_phase2_enabled, "planning_phase3_enabled": profile.planning_phase3_enabled, "think_enabled": profile.think_enabled, "iteration_budget_enabled": profile.iteration_budget_enabled, "goal_anchoring_enabled": profile.goal_anchoring_enabled, "goal_anchoring_interval": profile.goal_anchoring_interval, "scope_boundary_enabled": profile.scope_boundary_enabled, - "observe_skips_plan_enabled": profile.observe_skips_plan_enabled, "anti_stall_enabled": profile.anti_stall_enabled, "anti_stall_threshold": profile.anti_stall_threshold, "step_validation_enabled": profile.step_validation_enabled, - "adaptive_replan_enabled": profile.adaptive_replan_enabled, - "adaptive_long_step_threshold": profile.adaptive_long_step_threshold, "final_intercept_enabled": profile.final_intercept_enabled, "final_intercept_limit": profile.final_intercept_limit, "subagent_planning_enabled": profile.subagent_planning_enabled, diff --git a/navi/profiles/modeler_3d/config.json b/navi/profiles/modeler_3d/config.json index fb79e3a..88b1f50 100644 --- a/navi/profiles/modeler_3d/config.json +++ b/navi/profiles/modeler_3d/config.json @@ -10,6 +10,7 @@ }, "llm_backend": "ollama", "model": [ + "glm-5.3-flash:cloud", "gemma4:12b-it-qat-128k", "gemma4:31b-cloud", "qwen3.5:397b-cloud", @@ -19,10 +20,7 @@ ], "temperature": 0.35, "max_iterations": 70, - "planning_enabled": true, - "planning_mandatory": false, "planning_phase1_enabled": true, - "planning_phase2_enabled": false, "planning_phase3_enabled": true, "think_enabled": true, "iteration_budget_enabled": true, @@ -31,7 +29,6 @@ "anti_stall_enabled": true, "anti_stall_threshold": 6, "step_validation_enabled": true, - "adaptive_replan_enabled": true, "subagent_planning_enabled": false, "subagent_think_enabled": false, "top_k": 30, @@ -43,6 +40,7 @@ "todo", "scratchpad", "reflect", + "plan", "switch_profile", "list_profiles", "filesystem", diff --git a/navi/profiles/modeler_3d/system_prompt.txt b/navi/profiles/modeler_3d/system_prompt.txt index 6d2711b..080602c 100644 --- a/navi/profiles/modeler_3d/system_prompt.txt +++ b/navi/profiles/modeler_3d/system_prompt.txt @@ -275,6 +275,7 @@ - Always publish the final STL artifact before the final response when the task succeeds. - Name files descriptively: `bracket_20x40_m3.stl`, not `model.stl`. - Track progress with the `todo` tool. Do not write manual checkbox status lists in the final message. +- For a non-trivial multi-step request (multiple parts, research + modeling + publishing), call the `plan` tool before executing — it builds the execution plan and auto-populates the `todo`. For routine single-model tasks, the scratchpad `design_plan` workflow above is enough: skip `plan` and act. - Do not claim a task is complete until the corresponding tool result has verified it and `todo` has been updated. - Do not narrate future tool actions as a substitute for performing them. Execute the tool call first, then explain the result. - Do not claim the model is manifold or watertight unless a tool explicitly verified that exact property. This also applies to `todo.validation`, `scratchpad`, `preview_check`, and final responses. OpenSCAD compilation and preview images are useful checks, but they are not proof of manifoldness. diff --git a/navi/profiles/navi_code/config.json b/navi/profiles/navi_code/config.json index 93ec44c..432b35e 100644 --- a/navi/profiles/navi_code/config.json +++ b/navi/profiles/navi_code/config.json @@ -10,6 +10,7 @@ }, "llm_backend": "ollama", "model": [ + "glm-5.3-flash:cloud", "gemma4:31b-it-qat", "gemma4:26b-a4b-it-qat", "gemma4:12b-it-qat-128k", @@ -17,24 +18,18 @@ ], "temperature": 0.35, "max_iterations": 100, - "planning_enabled": true, "subagent_planning_enabled": true, "think_enabled": true, "iteration_budget_enabled": true, "goal_anchoring_enabled": true, "goal_anchoring_interval": 5, "scope_boundary_enabled": true, - "observe_skips_plan_enabled": true, "anti_stall_enabled": true, "anti_stall_threshold": 8, "step_validation_enabled": false, - "adaptive_replan_enabled": true, - "adaptive_long_step_threshold": 4, "final_intercept_enabled": true, "final_intercept_limit": 2, - "planning_mandatory": false, "planning_phase1_enabled": true, - "planning_phase2_enabled": true, "planning_phase3_enabled": true, "top_k": 40, "top_p": 0.88, @@ -48,7 +43,7 @@ "todo", "scratchpad", "reflect", - "replan", + "plan", "switch_profile", "list_profiles", "filesystem", diff --git a/navi/profiles/navi_code/system_prompt.txt b/navi/profiles/navi_code/system_prompt.txt index aa0a8c0..438ace0 100644 --- a/navi/profiles/navi_code/system_prompt.txt +++ b/navi/profiles/navi_code/system_prompt.txt @@ -41,7 +41,7 @@ ## Workflow 1. **Understand** — before writing anything, survey where the change lands: entry points, the module/function touched, and the conventions around it. If the project keeps notes or docs, read them first to orient (see the NAVI.md and Documentation sections below), then `grep`/`find` to locate symbols. Read the specific region you'll edit — not the whole project. Never assume structure. -2. **Plan** — for non-trivial act-tasks, the planner produces a structured plan and auto-populates a `todo`; execute it step by step (update `todo` as you go) instead of re-planning. For observe tasks (read/explain/inspect) no plan is generated — gather with tools and answer directly. +2. **Plan** — for non-trivial act-tasks, call the `plan` tool before executing: it produces a structured plan and auto-populates a `todo`; execute step by step (update `todo` as you go). If the tool flags the task as complex, present the plan briefly to the user and wait for their confirmation before executing. For observe tasks (read/explain/inspect) and trivial work, skip planning — gather with tools and answer/act directly. 3. **Implement** — write code. Follow the style and conventions already in the project. 4. **Test & verify** — after code changes, run the relevant tests or build (`terminal`/`code_exec`). If the project has a linter, run it on the changed files. If there are no tests, at least syntax-check (`python -m py_compile `) and exercise the affected code path. Never claim "done" without verification output in hand (record it in the `todo` `validation` when marking done). 5. **Report** — what was done, what was tested, any caveats. @@ -101,12 +101,12 @@ ## Working state & memory You run on a local model with aggressive context compression — old turns get summarised and details vanish. Keep durable state in the KV-backed tools, which survive compression and sub-agent handoff; don't rely on conversation memory alone. -- **`todo`** — for any non-trivial task, create a todo up front (one item per concrete step). Mark `in_progress`/`done` as you go; `done` requires a `validation` note (how you verified it) — the structural form of "never claim done without verification". When a new subtask surfaces mid-task (something the plan didn't anticipate but needs doing), add it with `todo add` right away — don't hold it in your head or wait for a replan. `add` appends steps and preserves existing progress (unlike `set`, which replaces the whole plan and resets statuses). +- **`todo`** — for any non-trivial task, create a todo up front (one item per concrete step). Mark `in_progress`/`done` as you go; `done` requires a `validation` note (how you verified it) — the structural form of "never claim done without verification". When a new subtask surfaces mid-task (something the plan didn't anticipate but needs doing), add it with `todo add` right away — don't hold it in your head or wait for a re-plan. `add` appends steps and preserves existing progress (unlike `set`, which replaces the whole plan and resets statuses). - **`scratchpad`** — working memory for facts found mid-task (file paths, errors, decisions). Use sections: `goal` (objective in one line), `findings`, `errors`, `artifacts`. Read `scratchpad` before your final report. - **Sub-agent handoff** — before `spawn_agent`, write what the sub-agent needs (files, snippets, how to verify) into the `context_transfer` scratchpad section; it's injected into the sub-agent automatically. The sub-agent does NOT inherit your short-term memory. - **`schedule_recall`** — when a task may hit the iteration limit, or has a wait/poll cycle (build, deploy, log watch), schedule a recall with a self-instruction naming specific tools/files (future-you has the tools, not your memory). Use `immediate` to continue after the limit or offload heavy work headlessly; chain recalls for multi-phase work. Only one pending recall per session — `manage_recall cancel` before a new one. - **`reflect`** — call it before a genuinely complex plan, or when you are stuck on one step: if you have made ~3 tool attempts on the same step without progress, call `reflect` IN THIS TURN (it is a tool call, not reasoning aloud) to surface wrong assumptions and get a fresh angle. Stopping to narrate "I'll try another approach" instead of calling `reflect` is the failure mode to avoid. It costs 3 LLM calls — use selectively, not on routine edits. -- **`replan`** — when the **structure** of the remaining plan is stale because of what you discovered mid-task (a step is unnecessary, the real problem differs from the assumed one, new constraints appeared — NOT because a step failed, which you handle by revising the `todo` inline), call `replan` with a short `reason` (what changed) and optional `updated_goal`. It re-runs the planner over your current context + `todo` + `scratchpad` findings/errors and replaces the plan and `todo`. Also call `replan` (with `updated_goal`/`reason`) when `reflect` showed the whole approach is dead — not one failed step, but the approach itself won't reach the goal. A single step failing is still a `todo` edit; a dead approach found via `reflect` is a `replan`. Distinguish from: `[Adaptive re-plan]` (a step failed — revise the `todo` inline, no planner call), a small `todo` edit (add 1–2 steps via `todo add` — no planner call; drop/merge/reorder via `set`, which resets statuses so re-apply them), and `reflect` (you're unsure what's wrong — surfaces assumptions, no plan change). Costs 1–3 LLM calls — use only when the remaining steps no longer fit as a whole. +- **`plan`** — call BEFORE starting execution of a non-trivial multi-step task (several files/systems, research, real risk): it decomposes the task into a structured plan with executors and auto-populates the `todo`. Re-plan: pass a short `reason` (what changed) and optional `updated_goal` when the **structure** of the remaining plan is stale mid-task (a step is unnecessary, the real problem differs from the assumed one, new constraints appeared — NOT because a step failed, which you handle by revising the `todo` inline). It re-runs the planner over your current context + `todo` + `scratchpad` findings/errors and replaces the plan and `todo`. Also call `plan` (with `updated_goal`/`reason`) when `reflect` showed the whole approach is dead — not one failed step, but the approach itself won't reach the goal. A single step failing is still a `todo` edit; a dead approach found via `reflect` is a re-plan. Distinguish from: a failed step (revise the `todo` inline, no planner call), a small `todo` edit (add 1–2 steps via `todo add` — no planner call; drop/merge/reorder via `set`, which resets statuses so re-apply them), and `reflect` (you're unsure what's wrong — surfaces assumptions, no plan change). Costs 2 LLM calls — use selectively. - **`memory`** — global cross-project facts (prefs, environment); not a substitute for `scratchpad` (session) or `docs/`/`NAVI.md` (project). ### System signals you'll see @@ -116,7 +116,7 @@ - `[Anti-stall warning]` — you're repeating without progress; change approach, `reflect`, or mark the step failed and move on. - `[Iteration N/M]` — budget counter. At `CRITICAL`, finish or produce a partial result now; don't start new subtasks. If the work can't fit, `schedule_recall` to continue. -On long tasks: re-read the latest user request, trust verified tool output over earlier assumptions, and when stuck — `reflect` or replan instead of repeating the same failing call. Your own thinking from earlier turns isn't re-injected — put conclusions in your content or `scratchpad`. After context compression the plan's per-step executor assignments are lost (only the summary + `todo` survive) — record them in `scratchpad` if you'll need them. +On long tasks: re-read the latest user request, trust verified tool output over earlier assumptions, and when stuck — `reflect` or re-plan with `plan` instead of repeating the same failing call. Your own thinking from earlier turns isn't re-injected — put conclusions in your content or `scratchpad`. After context compression the plan's per-step executor assignments are lost (only the summary + `todo` survive) — record them in `scratchpad` if you'll need them. --- diff --git a/navi/profiles/secretary/config.json b/navi/profiles/secretary/config.json index 77d7656..9f2b930 100644 --- a/navi/profiles/secretary/config.json +++ b/navi/profiles/secretary/config.json @@ -10,8 +10,8 @@ }, "llm_backend": "ollama", "model": [ - "gemma4:12b-it-qat-128k", "gemma4:31b-cloud", + "gemma4:12b-it-qat-128k", "qwen3.5:397b-cloud", "kimi-k2.6:cloud", "gemma4:26b-a4b-it-q4_K_M", @@ -19,7 +19,6 @@ ], "temperature": 0.45, "max_iterations": 70, - "planning_enabled": true, "subagent_planning_enabled": true, "think_enabled": true, "iteration_budget_enabled": true, @@ -28,10 +27,7 @@ "anti_stall_enabled": true, "anti_stall_threshold": 8, "step_validation_enabled": false, - "adaptive_replan_enabled": false, - "planning_mandatory": false, "planning_phase1_enabled": true, - "planning_phase2_enabled": true, "planning_phase3_enabled": true, "top_k": 50, "top_p": 0.9, @@ -42,6 +38,7 @@ "todo", "scratchpad", "reflect", + "plan", "switch_profile", "list_profiles", "filesystem", diff --git a/navi/profiles/secretary/system_prompt.txt b/navi/profiles/secretary/system_prompt.txt index 991c5bd..1bc1e3e 100644 --- a/navi/profiles/secretary/system_prompt.txt +++ b/navi/profiles/secretary/system_prompt.txt @@ -32,19 +32,18 @@ Delegation exists to keep your main context small. Delegate bounded subtasks that need 3+ tool calls and can be summarised independently; keep final synthesis and user-facing judgment inline. ### Execution flow for complex tasks -1. **Plan** — use the `todo` tool's set action to register milestones. Mirror the auto-generated plan exactly. +1. **Plan** — for a non-trivial multi-step task, call the `plan` tool first: it decomposes the task into a structured plan with executors and auto-populates the `todo`. If the tool flags the task as complex, present the plan briefly to the user and wait for their confirmation before executing. For simple questions or single-step tasks: skip planning, act immediately. 2. **Init scratchpad** — before the first tool call, create the sections you'll need: `findings`, `sources`, `drafts`, or whatever fits the task. Write a `goal` section first. 3. **Execute or delegate** each step. After each step, use the `todo` tool's update action to mark the current status. 4. **Before final answer** — read the `scratchpad` tool to review everything, then synthesise. -For simple questions or single-step tasks: skip todo and scratchpad, act immediately. ### Information gathering Before asking the user for facts, check available sources first: connected MCP knowledge servers exposed by the active profile, relevant `docs/` or `manuals/`, memory for personal user facts, files, web, or tool schemas. Use documentation as the project map instead of rereading the whole codebase. ### Plan → execution binding -The auto-generated plan assigns each step an executor (TOOL / AGENT / SELF): +The plan produced by the `plan` tool assigns each step an executor (TOOL / AGENT / SELF): - **TOOL** — make exactly that tool call directly. - **AGENT** — call `spawn_agent` for THIS STEP ONLY. One AGENT step = one spawn_agent call. If your plan has steps 2, 3, 4 all marked AGENT — you make three separate spawn_agent calls. diff --git a/navi/profiles/server_admin/config.json b/navi/profiles/server_admin/config.json index 5672f1f..efcb4b9 100644 --- a/navi/profiles/server_admin/config.json +++ b/navi/profiles/server_admin/config.json @@ -10,8 +10,8 @@ }, "llm_backend": "ollama", "model": [ - "gemma4:12b-it-qat-128k", "gemma4:31b-cloud", + "gemma4:12b-it-qat-128k", "qwen3.5:397b-cloud", "gemma4:26b-a4b-it-q4_K_M", "kimi-k2.6:cloud", @@ -19,7 +19,6 @@ ], "temperature": 0.25, "max_iterations": 100, - "planning_enabled": true, "subagent_planning_enabled": true, "think_enabled": true, "iteration_budget_enabled": true, @@ -28,10 +27,7 @@ "anti_stall_enabled": true, "anti_stall_threshold": 8, "step_validation_enabled": false, - "adaptive_replan_enabled": false, - "planning_mandatory": false, "planning_phase1_enabled": true, - "planning_phase2_enabled": true, "planning_phase3_enabled": true, "top_k": 30, "top_p": 0.8, @@ -42,6 +38,7 @@ "todo", "scratchpad", "reflect", + "plan", "switch_profile", "list_profiles", "filesystem", diff --git a/navi/profiles/server_admin/system_prompt.txt b/navi/profiles/server_admin/system_prompt.txt index ed06010..73c5d08 100644 --- a/navi/profiles/server_admin/system_prompt.txt +++ b/navi/profiles/server_admin/system_prompt.txt @@ -38,7 +38,7 @@ For infrastructure inventory, service topology, traffic routes, network layout, host roles, proxy mappings, and server/service relationships, use connected MCP knowledge servers when this profile exposes them. Do not store those facts in `memory`; memory is only for personal user facts and preferences. ### Execution flow -1. **Plan** — use the `todo` tool's set action with milestones. Assign executor to each: TOOL / AGENT / SELF. +1. **Plan** — for a non-trivial multi-step task, call the `plan` tool first: it decomposes the task into a structured plan with executors (TOOL / AGENT / SELF) and auto-populates the `todo`. If the tool flags the task as complex, present the plan briefly to the user and wait for their confirmation. For simple checks or single-step tasks: skip planning, act immediately. 2. **Init scratchpad** — sections: `status`, `logs`, `errors`, `hypothesis`, `actions`. 3. **Diagnose before acting** — gather data first, write hypothesis to scratchpad, then fix. Never jump to a fix without evidence. 4. **Execute or delegate** — follow plan assignments strictly. diff --git a/navi/profiles/tool_developer/config.json b/navi/profiles/tool_developer/config.json index 35cba73..691fbc6 100644 --- a/navi/profiles/tool_developer/config.json +++ b/navi/profiles/tool_developer/config.json @@ -10,8 +10,8 @@ }, "llm_backend": "ollama", "model": [ - "gemma4:12b-it-qat-128k", "gemma4:31b-cloud", + "gemma4:12b-it-qat-128k", "qwen3.5:397b-cloud", "gemma4:26b-a4b-it-q4_K_M", "kimi-k2.6:cloud", @@ -19,7 +19,6 @@ ], "temperature": 0.25, "max_iterations": 100, - "planning_enabled": true, "subagent_planning_enabled": true, "think_enabled": true, "iteration_budget_enabled": true, @@ -27,12 +26,8 @@ "goal_anchoring_interval": 5, "anti_stall_enabled": true, "anti_stall_threshold": 8, - "observe_skips_plan_enabled": true, "step_validation_enabled": false, - "adaptive_replan_enabled": true, - "planning_mandatory": false, "planning_phase1_enabled": true, - "planning_phase2_enabled": true, "planning_phase3_enabled": true, "top_k": 40, "top_p": 0.85, @@ -43,7 +38,7 @@ "todo", "scratchpad", "reflect", - "replan", + "plan", "switch_profile", "list_profiles", "filesystem", diff --git a/navi/profiles/tool_developer/system_prompt.txt b/navi/profiles/tool_developer/system_prompt.txt index 62007ed..a119623 100644 --- a/navi/profiles/tool_developer/system_prompt.txt +++ b/navi/profiles/tool_developer/system_prompt.txt @@ -200,17 +200,16 @@ - **Sub-agent handoff** — before `spawn_agent`, write what the sub-agent needs (server name, paths, tool specs, how to verify) into the `context_transfer` scratchpad section; it's injected into the sub-agent automatically. The sub-agent does NOT inherit your short-term memory. - **`schedule_recall`** — when a task may hit the iteration limit, or has a wait/poll cycle (build, deploy, log watch), schedule a recall with a self-instruction naming specific tools/files (future-you has the tools, not your memory). Use `immediate` to continue after the limit or offload heavy work headlessly; chain recalls for multi-phase work. Only one pending recall per session — `manage_recall cancel` before a new one. - **`reflect`** — before a genuinely complex plan or when stuck (repeated tool failures), call `reflect` to surface assumptions/gaps. It costs 3 LLM calls — use selectively, not on routine edits. -- **`replan`** — when the **structure** of the remaining plan is stale because of what you discovered mid-task (a step is unnecessary, the real problem differs from the assumed one, new constraints appeared — NOT because a step failed, that's `[Adaptive re-plan]`), call `replan` with a short `reason` (what changed) and optional `updated_goal`. It re-runs the planner over your current context + `todo` + `scratchpad` findings/errors and replaces the plan and `todo`. Distinguish from: `[Adaptive re-plan]` (a step failed — revise the `todo` inline, no planner call), a small `todo` edit (drop/merge/reorder 1-2 steps — edit inline, no planner call), and `reflect` (you're unsure what's wrong — surfaces assumptions, no plan change). Costs 1–3 LLM calls — use only when the remaining steps no longer fit as a whole. +- **`plan`** — call BEFORE starting execution of a non-trivial multi-step task (several files/systems, research, real risk): it decomposes the task into a structured plan with executors and auto-populates the `todo`. Re-plan: pass a short `reason` (what changed) and optional `updated_goal` when the **structure** of the remaining plan is stale mid-task. It re-runs the planner over your current context + `todo` + `scratchpad` findings/errors and replaces the plan and `todo`. Distinguish from: a failed step (revise the `todo` inline, no planner call), a small `todo` edit (drop/merge/reorder 1-2 steps — edit inline, no planner call), and `reflect` (you're unsure what's wrong — surfaces assumptions, no plan change). Costs 2 LLM calls — use selectively. - **`memory`** — global cross-project facts (prefs, environment); not a substitute for `scratchpad` (session) or `docs/` (project). ### System signals you'll see These are injected by the runtime, not free-form notes — recognise them and act accordingly: - `[Goal anchor]` — your original request + current `todo`, re-injected every few iterations. It uses the original request and your `todo` (not `scratchpad`), so keep `todo` updated to reflect real progress. - `[Anti-stall warning]` — you're repeating without progress; change approach, `reflect`, or mark the step failed and move on. -- `[Adaptive re-plan]` — a step just failed; before continuing, revise the plan with `todo` (replace remaining steps or mark failed/skipped with validation), then proceed with an approach that accounts for what went wrong. - `[Iteration N/M]` — budget counter. At `CRITICAL`, finish or produce a partial result now; don't start new subtasks. If the work can't fit, `schedule_recall` to continue. -On long tasks: re-read the latest user request and the intended server spec, trust verified tool output over earlier assumptions, and when stuck — `reflect` or replan instead of repeating the same failing call. Your own thinking from earlier turns isn't re-injected — put conclusions in your content or `scratchpad`. After context compression the plan's per-step executor assignments are lost (only the summary + `todo` survive) — record them in `scratchpad` if you'll need them. +On long tasks: re-read the latest user request and the intended server spec, trust verified tool output over earlier assumptions, and when stuck — `reflect` or re-plan with `plan` instead of repeating the same failing call. Your own thinking from earlier turns isn't re-injected — put conclusions in your content or `scratchpad`. After context compression the plan's per-step executor assignments are lost (only the summary + `todo` survive) — record them in `scratchpad` if you'll need them. --- diff --git a/tests/unit/profiles/test_base.py b/tests/unit/profiles/test_base.py index 03a5dd1..02088b0 100644 --- a/tests/unit/profiles/test_base.py +++ b/tests/unit/profiles/test_base.py @@ -48,8 +48,8 @@ enabled_tools=[], ) assert p.think_enabled is True - assert p.planning_enabled is False - assert p.planning_phase2_enabled is False + assert p.planning_phase1_enabled is True + assert p.planning_phase3_enabled is True assert p.iteration_budget_enabled is True assert p.anti_stall_enabled is True assert p.anti_stall_threshold == 8 @@ -91,4 +91,4 @@ enabled_tools=[], ) assert p.scope_boundary_enabled is False - assert p.observe_skips_plan_enabled is False + assert p.subagent_planning_enabled is False