feat(sdk)\!: standardize enhanced system prompt across all sessions#367
feat(sdk)\!: standardize enhanced system prompt across all sessions#367lavaman131 merged 4 commits intomainfrom
Conversation
Add a shared enhanced prompt and wire it as the fallback system prompt in chat command, chat UI, and workflow graph nodes so all SDK sessions inherit consistent tool-use and engineering guidance. Assistant-model: gpt-5.3-codex
PR Review: feat(sdk): enforce enhanced system prompt across sessionsThanks for the PR! The idea of standardizing agent behavior with a shared system prompt is valuable. Here's my detailed review: Code Quality Issues1. Inconsistent System Prompt Override Behavior (Bug) There's a significant inconsistency in how the enhanced prompt is applied across the three modified files:
In Suggested fix for systemPrompt: userProvidedPrompt ?? ENHANCED_SYSTEM_PROMPT,2. Potential Double Application Since Test CoverageNo tests were added for this new functionality. Consider adding:
Example test skeleton: import { test, expect } from "bun:test";
import { ENHANCED_SYSTEM_PROMPT } from "../sdk/enhanced-system-prompt.ts";
test("ENHANCED_SYSTEM_PROMPT is defined and non-empty", () => {
expect(ENHANCED_SYSTEM_PROMPT).toBeDefined();
expect(ENHANCED_SYSTEM_PROMPT.length).toBeGreaterThan(0);
});
test("ENHANCED_SYSTEM_PROMPT contains required sections", () => {
expect(ENHANCED_SYSTEM_PROMPT).toContain("Tool Usage");
expect(ENHANCED_SYSTEM_PROMPT).toContain("Software Engineering Principles");
});Security ConsiderationsThe enhanced prompt correctly uses
PerformanceNo performance concerns - the prompt is a static string constant with minimal overhead. Best Practices FeedbackPositive:
Suggestions:
Summary
Recommendation: Request changes to fix the inconsistent override behavior in |
Rename session config from systemPrompt to additionalInstructions and append it through provider-native flows instead of overriding system prompts. This keeps default prompts for Claude, Copilot, and OpenCode while aligning workflow and sub-agent nodes with additive instruction behavior. Assistant-model: openai/gpt-5.3-codex
PR Review: feat(sdk)!: standardize enhanced system prompt across all sessionsSummaryThis PR introduces a centralized ✅ Strengths
|
| Component | Coverage |
|---|---|
| Claude client append mode | ✅ Covered (claude.test.ts:1203-1210) |
| Copilot client append mode | ✅ Covered (copilot.test.ts:78-123) |
| OpenCode instruction injection | ✅ Covered (opencode.events.test.ts:56-116) |
| OpenCode agent dispatch exclusion | ✅ Covered (opencode.events.test.ts:118-166) |
| Workflow agentNode | ✅ Covered (nodes.test.ts:128-180) |
| Chat command integration | ❌ Missing |
| Enhanced prompt content validation | ❌ Missing (would be nice but not critical) |
Verdict
Approve with minor suggestions. The architectural change is sound and well-implemented. The main recommendations are:
- Add a test for chat command → session config wiring
- Document migration path for users of
systemPromptin workflows - Consider making the enhanced prompt opt-out capable
Nice work standardizing the prompt injection approach across all three SDK clients! 🎯
Allow chat sessions to accept additional instructions while keeping the enhanced default prompt as the baseline so users can tailor behavior per run. Assistant-model: openai/gpt-5.3-codex
PR Review: feat(sdk)!: standardize enhanced system prompt across all sessionsSummaryThis PR introduces a centralized Code Quality & Best PracticesStrengths:
Suggestions:
Potential Issues
Performance Considerations
Security Concerns
Test CoverageGood coverage for:
Recommended additions:
Minor Nits
VerdictApprove with minor suggestions. This is a solid refactoring that standardizes agent behavior across SDKs. The breaking changes are well-documented, and test coverage is adequate. Address the return type inconsistency in |
PR Review: feat(sdk)!: standardize enhanced system prompt across all sessionsOverall AssessmentThis is a well-structured PR that standardizes agent behavior through a shared enhanced system prompt. The breaking change is clearly documented with a migration guide. ✅ Code Quality & Best PracticesStrengths:
Suggestions:
|
SUMMARY
This PR standardizes agent behavior by introducing a shared enhanced system prompt that is automatically applied to all SDK sessions (Claude, Copilot, OpenCode). The enhanced prompt enforces:
All custom instructions are now appended to this base prompt rather than replacing it, ensuring consistent guardrails across chat and workflow executions.
BREAKING CHANGES
API Rename: systemPrompt → additionalInstructions
The systemPrompt parameter has been renamed to additionalInstructions across all SDK clients and workflow configurations to better reflect its new append-only behavior.
Before:
After:
Behavior Change: Default Enhanced Prompt
All sessions now default to using ENHANCED_SYSTEM_PROMPT (defined in src/sdk/enhanced-system-prompt.ts), which includes:
Custom instructions are appended to this base prompt rather than replacing it.
CHANGES
Core:
SDK Clients:
CLI and Chat:
Workflows:
Testing:
MIGRATION GUIDE
For SDK users, rename the parameter:
const session = await client.createSession({ - systemPrompt: "Custom instructions" + additionalInstructions: "Custom instructions" });For workflow definitions:
graph<State>() .subagent({ id: "researcher", agent: "codebase-analyzer", task: "Analyze authentication flow", - systemPrompt: "Focus on security" + additionalInstructions: "Focus on security" })For CLI users:
IMPLEMENTATION DETAILS
The enhanced prompt is centralized in src/sdk/enhanced-system-prompt.ts and applied differently per SDK:
TESTING NOTES
IMPACT
This change ensures that all agent sessions—whether initiated through chat, workflows, or direct SDK usage—operate with consistent guardrails and best practices, improving code quality and reducing antipatterns across the board.