Skip to content

Support Caveman Mode#3264

Open
nourzakhama2003 wants to merge 1 commit intodyad-sh:mainfrom
nourzakhama2003:feature/suport-caveman-mode
Open

Support Caveman Mode#3264
nourzakhama2003 wants to merge 1 commit intodyad-sh:mainfrom
nourzakhama2003:feature/suport-caveman-mode

Conversation

@nourzakhama2003
Copy link
Copy Markdown
Collaborator

@nourzakhama2003 nourzakhama2003 commented Apr 23, 2026

closes #3255

Summary

This PR implements Caveman Mode, a new user setting that allows for significant token savings and faster response times by compressing AI responses. The feature injects specific instructions into the system prompt to force the AI into more terse and concise communication styles.

Users can select from four levels in Settings > AI Settings:

Off: Standard responses (default).
Lite: ~25% compression; professional but brief.
Full: ~50% compression; very terse, sentence fragments allowed.
Ultra: ~75% compression; maximum token saving (caveman-style).

implementation

Core Logic
src/prompts/system_prompt.ts: Defined strictly typed instruction sets for Lite, Full, and Ultra modes. Introduced a centralized injectCavemanPrompt helper to handle consistent injection across all system prompt construction paths.
src/ipc/handlers/chat_stream_handlers.ts: Integrated the setting into main chat streams and expanded support to special prompts like /security-review and Summarize.
src/lib/schemas.ts & src/main/settings.ts: Added cavemanMode to the user settings schema and default state.
UI & UX
src/components/CavemanModeSelector.tsx [NEW]: Extracted the selector into a modular component for better maintainability.
src/pages/settings.tsx: Cleaned up the settings page by using the new dedicated component.
src/i18n/locales/en/settings.json: Added full localization support for labels and compression level descriptions.
src/lib/settingsSearchIndex.ts: Integrated the new setting into global search with keywords: terse, concise, brief.

Testing

npm run e2e -- caveman_mode.spec.ts


image
Open in Devin Review
@wwwillchen
Copy link
Copy Markdown
Collaborator

@BugBot run

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 23, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 13 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.
devin-ai-integration[bot]

This comment was marked as resolved.

gemini-code-assist[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@github-actions github-actions Bot added the needs-human:review-issue ai agent flagged an issue that requires human review label Apr 23, 2026
@dyad-assistant
Copy link
Copy Markdown
Contributor

🔍 Dyadbot Code Review Summary

Verdict: 🤔 NOT SURE - Potential issues

Reviewed by 3 independent agents: Correctness Expert, Code Health Expert, UX Wizard.

Issues Summary

Severity File Issue
🟡 MEDIUM e2e-tests/debug-screenshots/ Debug screenshots accidentally committed
🟡 MEDIUM src/prompts/system_prompt.ts:510 CAVEMAN_PROMPTS not typed against enum — future modes silently inject "undefined"
🟡 MEDIUM src/prompts/system_prompt.ts:574-606 Caveman injection pattern copy-pasted 3 times
🟡 MEDIUM src/pages/settings.tsx:510 Caveman Mode UI strings not internationalized
🟢 Low Priority Notes (5 items)
  • Only ultra mode tested - e2e-tests/caveman_mode.spec.ts — lite and full modes have no test coverage
  • Comment style - src/prompts/system_prompt.ts:509//caveman prompts missing space after //, inconsistent with file style
  • Search keywords - src/lib/settingsSearchIndex.ts:218 — missing likely search terms like 'compress', 'tokens', 'fast', 'response length'
  • cavemanOptions inside component - src/pages/settings.tsx:447 — constant array re-created on every render, could be module-scoped
  • Caveman mode applies to Ask mode - src/prompts/system_prompt.ts:602 — caveman compression applied to Ask mode may conflict with its existing restrictions or make explanations less clear
🚫 Dropped False Positives (5 items)
  • Non-null assertion on regex capture group - Dropped: The expect(dumpMatches.length).toBeGreaterThan(0) guard is sufficient, and the capture group is required by the regex pattern
  • Redundant if (\!value) return guard - Dropped: Common defensive pattern with Radix Select, harmless and doesn't hurt readability
  • Missing themePrompt comment in plan sub-agent - Dropped: Pre-existing code omission, not introduced by this PR
  • Label component inconsistency - Dropped: Both Label and label render identically, too minor to flag
  • Description tone inconsistency - Dropped: Subjective style preference, descriptions are clear and functional

Generated by Dyadbot multi-agent code review

dyad-assistant[bot]

This comment was marked as resolved.

@wwwillchen
Copy link
Copy Markdown
Collaborator

@BugBot run

@nourzakhama2003
Copy link
Copy Markdown
Collaborator Author

recheck

@wwwillchen
Copy link
Copy Markdown
Collaborator

@BugBot run

@wwwillchen
Copy link
Copy Markdown
Collaborator

@BugBot run

@wwwillchen
Copy link
Copy Markdown
Collaborator

@BugBot run

dyad-assistant[bot]

This comment was marked as resolved.

@dyad-assistant
Copy link
Copy Markdown
Contributor

🔍 Dyadbot Code Review Summary

Verdict: ✅ YES - Ready to merge

Reviewed by 3 independent agents: Correctness Expert, Code Health Expert, UX Wizard.

Issues Summary

Severity File Issue
🟡 MEDIUM src/prompts/system_prompt.ts:606 Caveman prompt injected before themePrompt in build/ask mode, but after in plan/local-agent mode
🟢 Low Priority Notes (5 items)
  • CavemanMode type duplicated in 3+ places - src/components/CavemanModeSelector.tsx:13, src/prompts/system_prompt.ts (twice) — derive from the Zod schema in schemas.ts instead
  • as any casts on i18n translation keys - src/components/CavemanModeSelector.tsx:75 — defeats typed i18n checking
  • Missing aria-describedby on dynamic description - src/components/CavemanModeSelector.tsx:57-84 — screen readers will not announce the contextual mode description
  • Default option not labeled "(default)" - src/components/CavemanModeSelector.tsx:23 — other selectors like ThinkingBudgetSelector label their default
  • Dropdown labels lack compression hints - items show only "Lite"/"Full"/"Ultra" with no indication of what each does until selected
🚫 Dropped False Positives (6 items)
  • Security review intent discards accumulated context - Dropped: Pre-existing behavior, not introduced by this PR
  • Summarize intent discards Supabase/Neon context - Dropped: Pre-existing behavior, likely intentional for summarize use case
  • Deprecated _AGENT_MODE_SYSTEM_PROMPT dead code - Dropped: Pre-existing dead code adjacent to new changes, not introduced by this PR
  • MCP agent path missing themePrompt - Dropped: Pre-existing omission, not introduced by this PR
  • Feature name "Caveman Mode" may confuse users - Dropped: Product naming decision, matches issue title and intentional branding
  • Missing i18n for zh-CN and pt-BR locales - Dropped: i18next fallback to English works, standard practice to translate later

Generated by Dyadbot multi-agent code review

@wwwillchen
Copy link
Copy Markdown
Collaborator

@BugBot run

@dyad-assistant
Copy link
Copy Markdown
Contributor

🔍 Dyadbot Code Review Summary

Verdict: ✅ YES - Ready to merge

Reviewed by 3 independent agents: Correctness Expert, Code Health Expert, UX Wizard.

Issues Summary

Severity File Issue
🟡 MEDIUM src/components/CavemanModeSelector.tsx:13 CavemanMode type duplicated across 4 files instead of derived from schema
🟢 Low Priority Notes (4 items)
  • as any casts on i18n keys - src/components/CavemanModeSelector.tsx:75,82t(option.labelKey as any) defeats typed i18n checking
  • Search keywords missing 'brief' - src/lib/settingsSearchIndex.ts:221 — PR description mentions 'brief' as a keyword but it's not in the array
  • Comment formatting - src/prompts/system_prompt.ts:509//caveman prompts missing space after //, inconsistent with file style
  • Dropdown labels lack compression hints - src/components/CavemanModeSelector.tsx:73-76 — options show only "Lite"/"Full"/"Ultra" with no indication of compression degree until selected
🚫 Dropped False Positives (9 items)
  • Summarize intent discards Supabase/Neon context - Dropped: Pre-existing behavior, not introduced by this PR
  • Caveman prompt prepend position may reduce effectiveness - Dropped: Deliberate design choice documented in code comment
  • Feature name "Caveman Mode" is opaque - Dropped: Product naming decision, matches issue support caveman / more compact output #3255 title and intentional branding
  • Label component type differs from sibling selectors - Dropped: Both <Label> and <label> render identically, too minor to flag
  • Falsy coercion || vs ?? for nullish default - Dropped: Functionally equivalent, cavemanMode value is always a string or undefined
  • currentOption fallback unreachable - Dropped: Defensive coding pattern, not an issue
  • Default option lacks "(default)" indicator - Dropped: Minor polish, not required for clarity
  • MCP build mode path missing themePrompt - Dropped: Pre-existing behavior, not introduced by this PR
  • Inconsistent description tone across levels - Dropped: Subjective style preference, descriptions are clear and functional

Generated by Dyadbot multi-agent code review

dyad-assistant[bot]

This comment was marked as resolved.

@wwwillchen
Copy link
Copy Markdown
Collaborator

@BugBot run

@dyad-assistant
Copy link
Copy Markdown
Contributor

🔍 Dyadbot Code Review Summary

Verdict: ✅ YES - Ready to merge

Reviewed by 3 independent agents: Correctness Expert, Code Health Expert, UX Wizard.

The latest commit addresses nearly all issues from prior reviews: CavemanModeSelector extracted to its own component, i18n support added, CavemanMode type centralized in schemas.ts, CAVEMAN_PROMPTS properly typed as Record, injection helper extracted to eliminate duplication, and special intents (security-review, summarize) now apply caveman mode.

Issues Summary

No new HIGH or MEDIUM issues found beyond what's already been commented on.

🟢 Low Priority Notes (5 items)
  • as any casts on i18n translation keys - src/components/CavemanModeSelector.tsx:74,81t(option.labelKey as any) defeats typed i18n checking. Mentioned in prior summaries; consider typing the keys properly
  • Unvalidated CavemanMode cast - src/components/CavemanModeSelector.tsx:47-49value as CavemanMode cast is safe in practice (Select constrains to known options) but bypasses runtime validation
  • Search keywords could be broader - src/lib/settingsSearchIndex.ts:221 — missing 'brief', 'token', 'compression' that users might search for
  • Comment formatting - src/prompts/system_prompt.ts:509//caveman prompts missing space after //, inconsistent with file style
  • Default option unlabeled - src/components/CavemanModeSelector.tsx:23 — "Off" option doesn't indicate "(default)" like other selectors (e.g., ThinkingBudgetSelector)
🚫 Dropped False Positives (7 items)
  • Security review intent discards caveman-injected prompt - Dropped: Pre-existing pattern where special intents replace the system prompt entirely. Caveman injection correctly follows this pattern by wrapping the replacement prompt.
  • Inconsistent caveman position relative to themePrompt - Dropped: Already commented on by prior review. Net effect is the same (caveman is always prepended first) regardless of code path.
  • E2E test race condition - Dropped: Already commented on by chatgpt-codex-connector[bot]. Test has been updated with waitFor and assertion guards.
  • Missing zh-CN/pt-BR translations - Dropped: i18next fallback to English works. Standard practice to translate later.
  • Feature name "Caveman Mode" may confuse users - Dropped: Product naming decision matching issue support caveman / more compact output #3255 title and intentional branding.
  • Deprecated _AGENT_MODE_SYSTEM_PROMPT still present - Dropped: Pre-existing dead code adjacent to new changes, not introduced by this PR.
  • Non-null assertion in test - Dropped: Guarded by expect(dumpMatches.length).toBeGreaterThan(0) on the preceding line.

Generated by Dyadbot multi-agent code review

@github-actions
Copy link
Copy Markdown
Contributor

🎭 Playwright Test Results

❌ Some tests failed

OS Passed Failed Flaky Skipped
🍎 macOS 435 3 5 138
🪟 Windows 438 8 8 138

Summary: 873 passed, 11 failed, 13 flaky, 276 skipped

Failed Tests

🍎 macOS

  • queued_message.spec.ts > editing queued message restores attachments and selected components
    • Error: expect(locator).toBeVisible() failed
  • queued_message.spec.ts > canceling queued message edit clears restored components
    • Error: expect(locator).toBeVisible() failed
  • visual_editing.spec.ts > swap image via URL
    • Error: expect(locator).toBeVisible() failed

🪟 Windows

  • chat_input.spec.ts > send button disabled during pending proposal - reject
    • Error: expect(locator).toBeVisible() failed
  • chat_tabs.spec.ts > right-click context menu: Close tabs to the right
    • Error: Timeout 30000ms exceeded while waiting on the predicate
  • edit_code.spec.ts > edit code edits the right file during rapid switches
    • Error: expect(received).toEqual(expected) // deep equality
  • git_collaboration.spec.ts > Git Collaboration > should create, switch, rename, merge, and delete branches
    • Error: expect(locator).toMatchAriaSnapshot(expected) failed
  • github.spec.ts > create and sync to new repo
    • Error: expect(locator).toHaveClass(expected) failed
  • github.spec.ts > create and sync to new repo - custom branch
    • TimeoutError: locator.click: Timeout 30000ms exceeded.
  • github.spec.ts > create and sync to existing repo
    • Error: expect(locator).toMatchAriaSnapshot(expected) failed
  • github.spec.ts > create and sync to existing repo - custom branch
    • Error: expect(locator).toMatchAriaSnapshot(expected) failed

📋 Re-run Failing Tests (macOS)

Copy and paste to re-run all failing spec files locally:

npm run e2e \
  e2e-tests/queued_message.spec.ts \
  e2e-tests/visual_editing.spec.ts

⚠️ Flaky Tests

🍎 macOS

  • context_limit_banner.spec.ts > context limit banner shows 'running out' when near context limit (passed after 1 retry)
  • context_manage.spec.ts > manage context - smart context (passed after 1 retry)
  • fix_error.spec.ts > fix error with AI (passed after 1 retry)
  • setup_flow.spec.ts > Setup Flow > setup banner shows correct state when node.js is installed (passed after 1 retry)
  • socket_firewall.spec.ts > build mode - blocked unsafe npm package shows the real socket verdict and preserves app files (passed after 2 retries)

🪟 Windows

  • app_screenshot.spec.ts > captures an app screenshot after the first generated commit (passed after 1 retry)
  • chat_tabs.spec.ts > clicking a tab switches to that chat (passed after 1 retry)
  • context_limit_banner.spec.ts > context limit banner shows 'running out' when near context limit (passed after 1 retry)
  • edit_code.spec.ts > edit code (passed after 1 retry)
  • github.spec.ts > should connect to GitHub using device flow (passed after 2 retries)
  • per_chat_input.spec.ts > input preserved when switching back and forth multiple times (passed after 1 retry)
  • setup_flow.spec.ts > Setup Flow > setup banner shows correct state when node.js is installed (passed after 1 retry)
  • setup_flow.spec.ts > Setup Flow > node.js install flow (passed after 2 retries)

📊 View full report

Copy link
Copy Markdown
Collaborator

@wwwillchen wwwillchen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @nourzakhama2003 - thanks for this PR. i pulled it down and played with this feature and I'm on the fence about this one because i don't think it'll actually save that much costs. most of the costs is input tokens + reasoning tokens and the actual output tokens this will save is not a ton.

could we wait to get more feedback from users (e.g. thumbs up on the issue) before proceeding with this? thank you

@nourzakhama2003
Copy link
Copy Markdown
Collaborator Author

hi @nourzakhama2003 - thanks for this PR. i pulled it down and played with this feature and I'm on the fence about this one because i don't think it'll actually save that much costs. most of the costs is input tokens + reasoning tokens and the actual output tokens this will save is not a ton.

could we wait to get more feedback from users (e.g. thumbs up on the issue) before proceeding with this? thank you

hi @wwwillchen thanks for taking the time to review and test it! That makes total sense — if the cost savings are minimal compared to input/reasoning tokens, I understand holding off. Happy to keep this as a draft or close it for now, and revisit if there's clear user demand. Let me know if you'd prefer me to close the PR or keep it open as a reference implementation. Thanks again for the feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-human:review-issue ai agent flagged an issue that requires human review

2 participants