Skip to content

feat: support multiple line custom prompts in mycoder.config.js #250

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,14 @@ export default {
temperature: 0.7,

// Custom settings
// customPrompt can be a string or an array of strings for multiple lines
customPrompt: '',
// Example of multiple line custom prompts:
// customPrompt: [
// 'Custom instruction line 1',
// 'Custom instruction line 2',
// 'Custom instruction line 3',
// ],
profile: false,
tokenCache: true,

Expand Down
7 changes: 7 additions & 0 deletions mycoder.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@ export default {
temperature: 0.7,

// Custom settings
// customPrompt can be a string or an array of strings for multiple lines
customPrompt: '',
// Example of multiple line custom prompts:
// customPrompt: [
// 'Custom instruction line 1',
// 'Custom instruction line 2',
// 'Custom instruction line 3',
// ],
profile: false,
tokenCache: true,
};
9 changes: 8 additions & 1 deletion packages/agent/src/core/toolAgent/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,13 @@ export function getDefaultSystemPrompt(toolContext: ToolContext): string {
'When you run into issues or unexpected results, take a step back and read the project documentation and configuration files and look at other source files in the project for examples of what works.',
'',
'Use sub-agents for parallel tasks, providing them with specific context they need rather than having them rediscover it.',
toolContext.customPrompt ? `\n\n${toolContext.customPrompt}` : '',
(() => {
if (!toolContext.customPrompt) return '';
if (typeof toolContext.customPrompt === 'string') {
return `\n\n${toolContext.customPrompt}`;
}
// It's an array of strings
return `\n\n${toolContext.customPrompt.join('\n')}`;
})(),
].join('\n');
}
2 changes: 1 addition & 1 deletion packages/agent/src/core/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export type ToolContext = {
pageFilter: pageFilter;
tokenTracker: TokenTracker;
githubMode: boolean;
customPrompt?: string;
customPrompt?: string | string[];
tokenCache?: boolean;
userPrompt?: boolean;
agentId?: string; // Unique identifier for the agent, used for background tool tracking
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/settings/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export type Config = {
model: string;
maxTokens: number;
temperature: number;
customPrompt: string;
customPrompt: string | string[];
profile: boolean;
tokenCache: boolean;
userPrompt: boolean;
Expand Down
Loading