Skip to content

Act mode: three-tier system prompts (frontier / mid / small) instead of compact-vs-full binary #225

Description

@Ayush7614

Problem

Act mode currently routes system prompts with a binary choice: full SYSTEM_PROMPT_ACT vs SYSTEM_PROMPT_ACT_COMPACT (via provider useCompactPrompt + compact/mid/full tool tiers).

TODOs.md §1 documents a deeper issue: small local models need more explicit guidance, not a shorter prompt. The compact prompt strips worked examples and nuance that small models rely on — while still paying the token cost of a large tool schema on mid/full tiers.

Evidence cited in TODOs: qwen3.6-27b trace re-downloading the same files because scratchpad/download state fell out of attention — compact prompt would have made this worse by removing SCRATCHPAD guidance.

Current mismatch:

User cohort What they need What they get
Frontier cloud (Sonnet, GPT-4o) Trimmed rules, trust planning Full ~7K prompt
Mid local (32B–70B) Rules + 1–2 examples per rule Full prompt
Small local (7B–27B) More examples + failure-mode reminders Often compact prompt (too thin) OR full prompt (token-heavy)

Tool tier (compact / mid / full) and prompt tier are orthogonal but today only loosely coupled via useCompactPrompt.

Proposed solution

Introduce three prompt tiers routed in _getActPrompt():

Tier Target models Prompt Approx size
frontier Sonnet, Opus, GPT-4o, Gemini Pro Trim examples, keep rules ~3K tokens
mid Llama 70B, Qwen 35B, GPT-4o-mini Full rules + selective examples ~5K tokens
small 7B–30B local (Ollama, llama.cpp, LM Studio) Full rules + more examples + imperative scaffolding ~6–7K tokens

Implementation sketch

  1. Provider config — replace or extend useCompactPrompt with promptTier: 'frontier' | 'mid' | 'small' (default heuristics: cloud flagship → frontier, OpenRouter mid → mid, local servers → small).
  2. New prompt bodies in tools.js (Chrome + Firefox):
    • SYSTEM_PROMPT_ACT_FRONTIER
    • Keep SYSTEM_PROMPT_ACT as mid default
    • SYSTEM_PROMPT_ACT_SMALL (expanded, not shrunk — per TODOs analysis)
  3. _getActPrompt() — route by promptTier, not binary compact flag.
  4. Settings (optional v1) — advanced dropdown “Prompt detail: Auto / Frontier / Mid / Small” overriding heuristic.
  5. Token budget guard — if promptTier === 'small' and contextWindow < 12k, warn in verbose mode or auto-compact tools to compact tier.

Verification

  • Re-run qwen3.6-27b / small-model scenario from TODOs — no re-download loop when scratchpad pins downloads
  • Frontier model still gets shorter prompt (token savings)
  • npm test — tier routing unit tests
  • Chrome + Firefox parity
  • LLM scenario spot-check on frozen harness (no regression on frontier cases)

Why this matters now

WebBrain is on the Chrome Web Store and Firefox AMO — many new users try local LLMs first. Small-model experience directly drives ratings and “doesn’t work” reports.

Scope

Medium–large (~400–600 lines across prompts + routing + tests + settings). Can be phased:

  • Phase 1: tier enum + routing + SYSTEM_PROMPT_ACT_SMALL authoring + tests
  • Phase 2: settings override + context-window coupling

Derived from maintainer engineering TODO §1. Happy to implement if assigned.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions