Skip to content

feat(opencode): unify session behavior prompt#142

Merged
Astro-Han merged 2 commits into
devfrom
codex/feat-i130-unified-prompt
Apr 22, 2026
Merged

feat(opencode): unify session behavior prompt#142
Astro-Han merged 2 commits into
devfrom
codex/feat-i130-unified-prompt

Conversation

@Astro-Han

@Astro-Han Astro-Han commented Apr 22, 2026

Copy link
Copy Markdown
Owner

Summary

  • Replace model-family session prompt routing with one PawWork-owned base behavior prompt.
  • Delete stale model-family behavior prompt files from packages/opencode/src/session/prompt.
  • Add focused tests for representative model IDs, OpenCode support identity exclusions, routing guard, and prompt-file inventory.

Why

Closes #130.

PawWork should behave consistently across model families. Model-specific prompt branches made behavior depend on string matching against model IDs and kept stale OpenCode-oriented behavior prompts around. This PR moves the default provider prompt path to one PawWork-owned behavior prompt and keeps model differences out of behavior instructions.

Related Issue

Closes #130

How To Verify

bun --cwd packages/opencode test test/session/system.test.ts --timeout 30000
bun --cwd packages/opencode typecheck

Also verified with static searches:

rg -n "prompt/(anthropic|beast|codex|copilot-gpt-5|default|gemini|gpt|kimi|pawwork-persona|plan-reminder-anthropic|trinity)\\.txt" packages/opencode/src packages/opencode/test packages/app/src
rg -n "model\\.api\\.id\\.includes|toLowerCase\\(\\)\\.includes\\(" packages/opencode/src/session/system.ts

Screenshots or Recordings

Not applicable. This is a prompt/runtime behavior change with no visible UI.

Checklist

  • I linked the related issue, or stated why there is no issue
  • This PR has type, scope, and priority labels, or I requested maintainer labeling
  • I listed the relevant verification steps, including tests when behavior changed
  • I manually checked visible UI or copy changes when needed, with screenshots or recordings
  • I considered macOS and Windows impact for desktop, packaging, updater, signing, paths, shell, or permissions changes
  • I called out docs, release notes, dependencies, permissions, credentials, deletion behavior, or generated/local file changes when relevant
  • I am targeting dev, and my PR title and commit messages use Conventional Commits in English

Summary by CodeRabbit

  • New Features

    • Introduced unified system prompt ("PawWork") providing consistent assistant behavior across all AI provider models.
  • Refactor

    • Consolidated provider-specific system prompts into a single standardized configuration, eliminating model-dependent behavioral variations.

@Astro-Han Astro-Han added enhancement New feature or request P2 Medium priority app Application behavior and product flows labels Apr 22, 2026
@coderabbitai

coderabbitai Bot commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@Astro-Han has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 5 minutes and 32 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 5 minutes and 32 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 11441a55-3f96-47a9-b397-58ebe967231d

📥 Commits

Reviewing files that changed from the base of the PR and between 0fd70db and 7ad26b8.

📒 Files selected for processing (14)
  • packages/opencode/src/session/prompt/anthropic.txt
  • packages/opencode/src/session/prompt/beast.txt
  • packages/opencode/src/session/prompt/codex.txt
  • packages/opencode/src/session/prompt/copilot-gpt-5.txt
  • packages/opencode/src/session/prompt/default.txt
  • packages/opencode/src/session/prompt/gemini.txt
  • packages/opencode/src/session/prompt/gpt.txt
  • packages/opencode/src/session/prompt/kimi.txt
  • packages/opencode/src/session/prompt/pawwork-persona.txt
  • packages/opencode/src/session/prompt/pawwork.txt
  • packages/opencode/src/session/prompt/plan-reminder-anthropic.txt
  • packages/opencode/src/session/prompt/trinity.txt
  • packages/opencode/src/session/system.ts
  • packages/opencode/test/session/system.test.ts
📝 Walkthrough

Walkthrough

The PR consolidates model-specific behavior prompts into a single unified PawWork base prompt used across all provider families. Model-dependent routing logic in system.ts is removed, and all previous provider-specific prompt files are deleted. Tests verify consistent prompt behavior across representative model families.

Changes

Cohort / File(s) Summary
Deleted model-specific prompts
packages/opencode/src/session/prompt/anthropic.txt, beast.txt, codex.txt, copilot-gpt-5.txt, default.txt, gemini.txt, gpt.txt, kimi.txt, trinity.txt, plan-reminder-anthropic.txt, pawwork-persona.txt
Removed 11 model-family and legacy behavior prompt files totaling 1,223 lines, including OpenCode CLI directives, provider-specific interaction rules, tool-use guidance, and agent behavior specifications.
Unified PawWork prompt
packages/opencode/src/session/prompt/pawwork.txt
Added new 43-line PawWork base behavior prompt defining consistent interaction mode across all models: understand-first by default, execute only on explicit user request, plus security and tooling constraints.
Simplified prompt routing
packages/opencode/src/session/system.ts
Removed model-family conditional logic from provider() function; now always returns [PROMPT_PAWWORK] regardless of input model, eliminating provider API ID checks that previously selected model-specific prompts.
Routing verification tests
packages/opencode/test/session/system.test.ts
Added 55 lines: tests asserting identical prompt output across representative model families (GPT, Gemini, Claude, Kimi, Trinity, GLM, Qwen), validation that composed output excludes OpenCode identity strings, and static assertions preventing reintroduction of model-family routing branches.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Poem

🐰 One prompt to guide them all, clear and bright,
No more switching prompts for every model type—
PawWork stands steady, the same across the board,
With "understand first" as the golden word,
The warren rejoices, our work now aligned! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat(opencode): unify session behavior prompt' clearly summarizes the main change: consolidating model-family behavior prompts into one unified PawWork prompt.
Description check ✅ Passed The description follows the template structure with Summary, Why, Related Issue, How To Verify, and a complete Checklist. All required sections are present and substantive.
Linked Issues check ✅ Passed The PR implements all key coding requirements: unified base behavior prompt [#130], model-independent routing logic, deletion of stale prompts, comprehensive tests for representative models and exclusions, and prompt inventory validation.
Out of Scope Changes check ✅ Passed All changes are directly aligned with #130 objectives: routing consolidation, stale prompt removal, new unified prompt creation, test additions, and no unrelated modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/feat-i130-unified-prompt

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request consolidates model-specific agent prompts into a single, unified "PawWork" persona and removes OpenCode-specific branding. The provider function in system.ts was simplified to return this unified prompt for all model families, and tests were updated to ensure consistent behavior and the removal of model-specific routing. Feedback suggests re-incorporating operational guidance regarding tool efficiency and parallelization, which was omitted during the consolidation and is important for optimizing agent performance.

Comment thread packages/opencode/src/session/prompt/pawwork.txt
@Astro-Han Astro-Han force-pushed the codex/feat-i130-unified-prompt branch from 0fd70db to 7ad26b8 Compare April 22, 2026 12:27
@Astro-Han Astro-Han merged commit b3b9f45 into dev Apr 22, 2026
21 checks passed
@Astro-Han Astro-Han deleted the codex/feat-i130-unified-prompt branch April 22, 2026 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app Application behavior and product flows enhancement New feature or request P2 Medium priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Remove model-specific behavior prompts

1 participant