@posthog/agent 1.13.0 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -168,35 +168,43 @@ class PromptBuilder {
168
168
  async buildResearchPrompt(task, repositoryPath) {
169
169
  // Process file references in description
170
170
  const { description: descriptionAfterFiles, referencedFiles } = await this.processFileReferences(task.description, repositoryPath);
171
- // Process URL references in description
171
+ // Process URL references in description
172
172
  const { description: processedDescription, referencedResources } = await this.processUrlReferences(descriptionAfterFiles);
173
- let prompt = '';
174
- prompt += `## Current Task\n\n**Task**: ${task.title}\n**Description**: ${processedDescription}`;
173
+ let prompt = '<task>\n';
174
+ prompt += `<title>${task.title}</title>\n`;
175
+ prompt += `<description>${processedDescription}</description>\n`;
175
176
  if (task.primary_repository) {
176
- prompt += `\n**Repository**: ${task.primary_repository}`;
177
+ prompt += `<repository>${task.primary_repository}</repository>\n`;
177
178
  }
179
+ prompt += '</task>\n';
178
180
  // Add referenced files from @ mentions
179
181
  if (referencedFiles.length > 0) {
180
- prompt += `\n\n## Referenced Files\n\n`;
182
+ prompt += '\n<referenced_files>\n';
181
183
  for (const file of referencedFiles) {
182
- prompt += `### ${file.path}\n\`\`\`\n${file.content}\n\`\`\`\n\n`;
184
+ prompt += `<file path="${file.path}">\n\`\`\`\n${file.content}\n\`\`\`\n</file>\n`;
183
185
  }
186
+ prompt += '</referenced_files>\n';
184
187
  }
185
188
  // Add referenced resources from URL mentions
186
189
  if (referencedResources.length > 0) {
187
- prompt += `\n\n## Referenced Resources\n\n`;
190
+ prompt += '\n<referenced_resources>\n';
188
191
  for (const resource of referencedResources) {
189
- prompt += `### ${resource.title} (${resource.type})\n**URL**: ${resource.url}\n\n${resource.content}\n\n`;
192
+ prompt += `<resource type="${resource.type}" url="${resource.url}">\n`;
193
+ prompt += `<title>${resource.title}</title>\n`;
194
+ prompt += `<content>${resource.content}</content>\n`;
195
+ prompt += '</resource>\n';
190
196
  }
197
+ prompt += '</referenced_resources>\n';
191
198
  }
192
199
  try {
193
200
  const taskFiles = await this.getTaskFiles(task.id);
194
201
  const contextFiles = taskFiles.filter((f) => f.type === 'context' || f.type === 'reference');
195
202
  if (contextFiles.length > 0) {
196
- prompt += `\n\n## Supporting Files`;
203
+ prompt += '\n<supporting_files>\n';
197
204
  for (const file of contextFiles) {
198
- prompt += `\n\n### ${file.name} (${file.type})\n${file.content}`;
205
+ prompt += `<file name="${file.name}" type="${file.type}">\n${file.content}\n</file>\n`;
199
206
  }
207
+ prompt += '</supporting_files>\n';
200
208
  }
201
209
  }
202
210
  catch (error) {
@@ -207,35 +215,43 @@ class PromptBuilder {
207
215
  async buildPlanningPrompt(task, repositoryPath) {
208
216
  // Process file references in description
209
217
  const { description: descriptionAfterFiles, referencedFiles } = await this.processFileReferences(task.description, repositoryPath);
210
- // Process URL references in description
218
+ // Process URL references in description
211
219
  const { description: processedDescription, referencedResources } = await this.processUrlReferences(descriptionAfterFiles);
212
- let prompt = '';
213
- prompt += `## Current Task\n\n**Task**: ${task.title}\n**Description**: ${processedDescription}`;
220
+ let prompt = '<task>\n';
221
+ prompt += `<title>${task.title}</title>\n`;
222
+ prompt += `<description>${processedDescription}</description>\n`;
214
223
  if (task.primary_repository) {
215
- prompt += `\n**Repository**: ${task.primary_repository}`;
224
+ prompt += `<repository>${task.primary_repository}</repository>\n`;
216
225
  }
226
+ prompt += '</task>\n';
217
227
  // Add referenced files from @ mentions
218
228
  if (referencedFiles.length > 0) {
219
- prompt += `\n\n## Referenced Files\n\n`;
229
+ prompt += '\n<referenced_files>\n';
220
230
  for (const file of referencedFiles) {
221
- prompt += `### ${file.path}\n\`\`\`\n${file.content}\n\`\`\`\n\n`;
231
+ prompt += `<file path="${file.path}">\n\`\`\`\n${file.content}\n\`\`\`\n</file>\n`;
222
232
  }
233
+ prompt += '</referenced_files>\n';
223
234
  }
224
235
  // Add referenced resources from URL mentions
225
236
  if (referencedResources.length > 0) {
226
- prompt += `\n\n## Referenced Resources\n\n`;
237
+ prompt += '\n<referenced_resources>\n';
227
238
  for (const resource of referencedResources) {
228
- prompt += `### ${resource.title} (${resource.type})\n**URL**: ${resource.url}\n\n${resource.content}\n\n`;
239
+ prompt += `<resource type="${resource.type}" url="${resource.url}">\n`;
240
+ prompt += `<title>${resource.title}</title>\n`;
241
+ prompt += `<content>${resource.content}</content>\n`;
242
+ prompt += '</resource>\n';
229
243
  }
244
+ prompt += '</referenced_resources>\n';
230
245
  }
231
246
  try {
232
247
  const taskFiles = await this.getTaskFiles(task.id);
233
248
  const contextFiles = taskFiles.filter((f) => f.type === 'context' || f.type === 'reference');
234
249
  if (contextFiles.length > 0) {
235
- prompt += `\n\n## Supporting Files`;
250
+ prompt += '\n<supporting_files>\n';
236
251
  for (const file of contextFiles) {
237
- prompt += `\n\n### ${file.name} (${file.type})\n${file.content}`;
252
+ prompt += `<file name="${file.name}" type="${file.type}">\n${file.content}\n</file>\n`;
238
253
  }
254
+ prompt += '</supporting_files>\n';
239
255
  }
240
256
  }
241
257
  catch (error) {
@@ -249,57 +265,74 @@ class PromptBuilder {
249
265
  repository: (task.primary_repository || ''),
250
266
  };
251
267
  const planTemplate = await this.generatePlanTemplate(templateVariables);
252
- prompt += `\n\nPlease analyze the codebase and create a detailed implementation plan for this task. Use the following template structure for your plan:\n\n${planTemplate}\n\nFill in each section with specific, actionable information based on your analysis. Replace all placeholder content with actual details about this task.`;
268
+ prompt += '\n<instructions>\n';
269
+ prompt += 'Analyze the codebase and create a detailed implementation plan. Use the template structure below, filling each section with specific, actionable information.\n';
270
+ prompt += '</instructions>\n\n';
271
+ prompt += '<plan_template>\n';
272
+ prompt += planTemplate;
273
+ prompt += '\n</plan_template>';
253
274
  return prompt;
254
275
  }
255
276
  async buildExecutionPrompt(task, repositoryPath) {
256
277
  // Process file references in description
257
278
  const { description: descriptionAfterFiles, referencedFiles } = await this.processFileReferences(task.description, repositoryPath);
258
- // Process URL references in description
279
+ // Process URL references in description
259
280
  const { description: processedDescription, referencedResources } = await this.processUrlReferences(descriptionAfterFiles);
260
- let prompt = '';
261
- prompt += `## Current Task\n\n**Task**: ${task.title}\n**Description**: ${processedDescription}`;
281
+ let prompt = '<task>\n';
282
+ prompt += `<title>${task.title}</title>\n`;
283
+ prompt += `<description>${processedDescription}</description>\n`;
262
284
  if (task.primary_repository) {
263
- prompt += `\n**Repository**: ${task.primary_repository}`;
285
+ prompt += `<repository>${task.primary_repository}</repository>\n`;
264
286
  }
287
+ prompt += '</task>\n';
265
288
  // Add referenced files from @ mentions
266
289
  if (referencedFiles.length > 0) {
267
- prompt += `\n\n## Referenced Files\n\n`;
290
+ prompt += '\n<referenced_files>\n';
268
291
  for (const file of referencedFiles) {
269
- prompt += `### ${file.path}\n\`\`\`\n${file.content}\n\`\`\`\n\n`;
292
+ prompt += `<file path="${file.path}">\n\`\`\`\n${file.content}\n\`\`\`\n</file>\n`;
270
293
  }
294
+ prompt += '</referenced_files>\n';
271
295
  }
272
296
  // Add referenced resources from URL mentions
273
297
  if (referencedResources.length > 0) {
274
- prompt += `\n\n## Referenced Resources\n\n`;
298
+ prompt += '\n<referenced_resources>\n';
275
299
  for (const resource of referencedResources) {
276
- prompt += `### ${resource.title} (${resource.type})\n**URL**: ${resource.url}\n\n${resource.content}\n\n`;
300
+ prompt += `<resource type="${resource.type}" url="${resource.url}">\n`;
301
+ prompt += `<title>${resource.title}</title>\n`;
302
+ prompt += `<content>${resource.content}</content>\n`;
303
+ prompt += '</resource>\n';
277
304
  }
305
+ prompt += '</referenced_resources>\n';
278
306
  }
279
307
  try {
280
308
  const taskFiles = await this.getTaskFiles(task.id);
281
309
  const hasPlan = taskFiles.some((f) => f.type === 'plan');
282
310
  if (taskFiles.length > 0) {
283
- prompt += `\n\n## Context and Supporting Information`;
311
+ prompt += '\n<context>\n';
284
312
  for (const file of taskFiles) {
285
313
  if (file.type === 'plan') {
286
- prompt += `\n\n### Execution Plan\n${file.content}`;
314
+ prompt += `<plan>\n${file.content}\n</plan>\n`;
287
315
  }
288
316
  else {
289
- prompt += `\n\n### ${file.name} (${file.type})\n${file.content}`;
317
+ prompt += `<file name="${file.name}" type="${file.type}">\n${file.content}\n</file>\n`;
290
318
  }
291
319
  }
320
+ prompt += '</context>\n';
292
321
  }
322
+ prompt += '\n<instructions>\n';
293
323
  if (hasPlan) {
294
- prompt += `\n\nPlease implement the changes described in the execution plan above. Follow the plan step-by-step and make the necessary file modifications. You must actually edit files and make changes - do not just analyze or review.`;
324
+ prompt += 'Implement the changes described in the execution plan. Follow the plan step-by-step and make the necessary file modifications.\n';
295
325
  }
296
326
  else {
297
- prompt += `\n\nPlease implement the changes described in the task above. You must actually edit files and make changes - do not just analyze or review.`;
327
+ prompt += 'Implement the changes described in the task. Make the necessary file modifications to complete the task.\n';
298
328
  }
329
+ prompt += '</instructions>';
299
330
  }
300
331
  catch (error) {
301
332
  this.logger.debug('No supporting files found for execution', { taskId: task.id });
302
- prompt += `\n\nPlease implement the changes described in the task above.`;
333
+ prompt += '\n<instructions>\n';
334
+ prompt += 'Implement the changes described in the task.\n';
335
+ prompt += '</instructions>';
303
336
  }
304
337
  return prompt;
305
338
  }
@@ -1 +1 @@
1
- {"version":3,"file":"prompt-builder.js","sources":["../../src/prompt-builder.ts"],"sourcesContent":["import type { Task, UrlMention, PostHogResource } from './types.js';\nimport type { TemplateVariables } from './template-manager.js';\nimport { Logger } from './utils/logger.js';\nimport { promises as fs } from 'fs';\nimport { join } from 'path';\n\nexport interface PromptBuilderDeps {\n getTaskFiles: (taskId: string) => Promise<any[]>;\n generatePlanTemplate: (vars: TemplateVariables) => Promise<string>;\n posthogClient?: { fetchResourceByUrl: (mention: UrlMention) => Promise<PostHogResource> };\n logger?: Logger;\n}\n\nexport class PromptBuilder {\n private getTaskFiles: PromptBuilderDeps['getTaskFiles'];\n private generatePlanTemplate: PromptBuilderDeps['generatePlanTemplate'];\n private posthogClient?: PromptBuilderDeps['posthogClient'];\n private logger: Logger;\n\n constructor(deps: PromptBuilderDeps) {\n this.getTaskFiles = deps.getTaskFiles;\n this.generatePlanTemplate = deps.generatePlanTemplate;\n this.posthogClient = deps.posthogClient;\n this.logger = deps.logger || new Logger({ debug: false, prefix: '[PromptBuilder]' });\n }\n\n /**\n * Extract file paths from XML tags in description\n * Format: <file path=\"relative/path.ts\" />\n */\n private extractFilePaths(description: string): string[] {\n const fileTagRegex = /<file\\s+path=\"([^\"]+)\"\\s*\\/>/g;\n const paths: string[] = [];\n let match: RegExpExecArray | null;\n\n while ((match = fileTagRegex.exec(description)) !== null) {\n paths.push(match[1]);\n }\n\n return paths;\n }\n\n /**\n * Read file contents from repository\n */\n private async readFileContent(repositoryPath: string, filePath: string): Promise<string | null> {\n try {\n const fullPath = join(repositoryPath, filePath);\n const content = await fs.readFile(fullPath, 'utf8');\n return content;\n } catch (error) {\n this.logger.warn(`Failed to read referenced file: ${filePath}`, { error });\n return null;\n }\n }\n\n /**\n * Extract URL mentions from XML tags in description\n * Formats: <error id=\"...\" />, <experiment id=\"...\" />, <url href=\"...\" />\n */\n private extractUrlMentions(description: string): UrlMention[] {\n const mentions: UrlMention[] = [];\n \n // PostHog resource mentions: <error id=\"...\" />, <experiment id=\"...\" />, etc.\n const resourceRegex = /<(error|experiment|insight|feature_flag)\\s+id=\"([^\"]+)\"\\s*\\/>/g;\n let match: RegExpExecArray | null;\n\n while ((match = resourceRegex.exec(description)) !== null) {\n const [, type, id] = match;\n mentions.push({\n url: '', // Will be reconstructed if needed\n type: type as any,\n id,\n label: this.generateUrlLabel('', type as any),\n });\n }\n\n // Generic URL mentions: <url href=\"...\" />\n const urlRegex = /<url\\s+href=\"([^\"]+)\"\\s*\\/>/g;\n while ((match = urlRegex.exec(description)) !== null) {\n const [, url] = match;\n mentions.push({\n url,\n type: 'generic',\n label: this.generateUrlLabel(url, 'generic'),\n });\n }\n\n return mentions;\n }\n\n /**\n * Generate a display label for a URL mention\n */\n private generateUrlLabel(url: string, type: string): string {\n try {\n const urlObj = new URL(url);\n switch (type) {\n case 'error':\n const errorMatch = url.match(/error_tracking\\/([a-f0-9-]+)/);\n return errorMatch ? `Error ${errorMatch[1].slice(0, 8)}...` : 'Error';\n case 'experiment':\n const expMatch = url.match(/experiments\\/(\\d+)/);\n return expMatch ? `Experiment #${expMatch[1]}` : 'Experiment';\n case 'insight':\n return 'Insight';\n case 'feature_flag':\n return 'Feature Flag';\n default:\n return urlObj.hostname;\n }\n } catch {\n return 'URL';\n }\n }\n\n /**\n * Process URL references and fetch their content\n */\n private async processUrlReferences(\n description: string\n ): Promise<{ description: string; referencedResources: PostHogResource[] }> {\n const urlMentions = this.extractUrlMentions(description);\n const referencedResources: PostHogResource[] = [];\n\n if (urlMentions.length === 0 || !this.posthogClient) {\n return { description, referencedResources };\n }\n\n // Fetch all referenced resources\n for (const mention of urlMentions) {\n try {\n const resource = await this.posthogClient.fetchResourceByUrl(mention);\n referencedResources.push(resource);\n } catch (error) {\n this.logger.warn(`Failed to fetch resource from URL: ${mention.url}`, { error });\n // Add a placeholder resource for failed fetches\n referencedResources.push({\n type: mention.type,\n id: mention.id || '',\n url: mention.url,\n title: mention.label || 'Unknown Resource',\n content: `Failed to fetch resource from ${mention.url}: ${error}`,\n metadata: {},\n });\n }\n }\n\n // Replace URL tags with just the label for readability\n let processedDescription = description;\n for (const mention of urlMentions) {\n if (mention.type === 'generic') {\n // Generic URLs: <url href=\"...\" />\n const escapedUrl = mention.url.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n processedDescription = processedDescription.replace(\n new RegExp(`<url\\\\s+href=\"${escapedUrl}\"\\\\s*/>`, 'g'),\n `@${mention.label}`\n );\n } else {\n // PostHog resources: <error id=\"...\" />, <experiment id=\"...\" />, etc.\n const escapedType = mention.type.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n const escapedId = mention.id ? mention.id.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&') : '';\n processedDescription = processedDescription.replace(\n new RegExp(`<${escapedType}\\\\s+id=\"${escapedId}\"\\\\s*/>`, 'g'),\n `@${mention.label}`\n );\n }\n }\n\n return { description: processedDescription, referencedResources };\n }\n\n /**\n * Process description to extract file tags and read contents\n * Returns processed description and referenced file contents\n */\n private async processFileReferences(\n description: string,\n repositoryPath?: string\n ): Promise<{ description: string; referencedFiles: Array<{ path: string; content: string }> }> {\n const filePaths = this.extractFilePaths(description);\n const referencedFiles: Array<{ path: string; content: string }> = [];\n\n if (filePaths.length === 0 || !repositoryPath) {\n return { description, referencedFiles };\n }\n\n // Read all referenced files\n for (const filePath of filePaths) {\n const content = await this.readFileContent(repositoryPath, filePath);\n if (content !== null) {\n referencedFiles.push({ path: filePath, content });\n }\n }\n\n // Replace file tags with just the filename for readability\n let processedDescription = description;\n for (const filePath of filePaths) {\n const fileName = filePath.split('/').pop() || filePath;\n processedDescription = processedDescription.replace(\n new RegExp(`<file\\\\s+path=\"${filePath.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')}\"\\\\s*/>`, 'g'),\n `@${fileName}`\n );\n }\n\n return { description: processedDescription, referencedFiles };\n }\n\n async buildResearchPrompt(task: Task, repositoryPath?: string): Promise<string> {\n // Process file references in description\n const { description: descriptionAfterFiles, referencedFiles } = await this.processFileReferences(\n task.description,\n repositoryPath\n );\n\n // Process URL references in description \n const { description: processedDescription, referencedResources } = await this.processUrlReferences(\n descriptionAfterFiles\n );\n\n let prompt = '';\n prompt += `## Current Task\\n\\n**Task**: ${task.title}\\n**Description**: ${processedDescription}`;\n\n if ((task as any).primary_repository) {\n prompt += `\\n**Repository**: ${(task as any).primary_repository}`;\n }\n\n // Add referenced files from @ mentions\n if (referencedFiles.length > 0) {\n prompt += `\\n\\n## Referenced Files\\n\\n`;\n for (const file of referencedFiles) {\n prompt += `### ${file.path}\\n\\`\\`\\`\\n${file.content}\\n\\`\\`\\`\\n\\n`;\n }\n }\n\n // Add referenced resources from URL mentions\n if (referencedResources.length > 0) {\n prompt += `\\n\\n## Referenced Resources\\n\\n`;\n for (const resource of referencedResources) {\n prompt += `### ${resource.title} (${resource.type})\\n**URL**: ${resource.url}\\n\\n${resource.content}\\n\\n`;\n }\n }\n\n try {\n const taskFiles = await this.getTaskFiles(task.id);\n const contextFiles = taskFiles.filter((f: any) => f.type === 'context' || f.type === 'reference');\n if (contextFiles.length > 0) {\n prompt += `\\n\\n## Supporting Files`;\n for (const file of contextFiles) {\n prompt += `\\n\\n### ${file.name} (${file.type})\\n${file.content}`;\n }\n }\n } catch (error) {\n this.logger.debug('No existing task files found for research', { taskId: task.id });\n }\n\n return prompt;\n }\n\n async buildPlanningPrompt(task: Task, repositoryPath?: string): Promise<string> {\n // Process file references in description\n const { description: descriptionAfterFiles, referencedFiles } = await this.processFileReferences(\n task.description,\n repositoryPath\n );\n\n // Process URL references in description \n const { description: processedDescription, referencedResources } = await this.processUrlReferences(\n descriptionAfterFiles\n );\n\n let prompt = '';\n prompt += `## Current Task\\n\\n**Task**: ${task.title}\\n**Description**: ${processedDescription}`;\n\n if ((task as any).primary_repository) {\n prompt += `\\n**Repository**: ${(task as any).primary_repository}`;\n }\n\n // Add referenced files from @ mentions\n if (referencedFiles.length > 0) {\n prompt += `\\n\\n## Referenced Files\\n\\n`;\n for (const file of referencedFiles) {\n prompt += `### ${file.path}\\n\\`\\`\\`\\n${file.content}\\n\\`\\`\\`\\n\\n`;\n }\n }\n\n // Add referenced resources from URL mentions\n if (referencedResources.length > 0) {\n prompt += `\\n\\n## Referenced Resources\\n\\n`;\n for (const resource of referencedResources) {\n prompt += `### ${resource.title} (${resource.type})\\n**URL**: ${resource.url}\\n\\n${resource.content}\\n\\n`;\n }\n }\n\n try {\n const taskFiles = await this.getTaskFiles(task.id);\n const contextFiles = taskFiles.filter((f: any) => f.type === 'context' || f.type === 'reference');\n if (contextFiles.length > 0) {\n prompt += `\\n\\n## Supporting Files`;\n for (const file of contextFiles) {\n prompt += `\\n\\n### ${file.name} (${file.type})\\n${file.content}`;\n }\n }\n } catch (error) {\n this.logger.debug('No existing task files found for planning', { taskId: task.id });\n }\n\n const templateVariables = {\n task_id: task.id,\n task_title: task.title,\n task_description: processedDescription,\n date: new Date().toISOString().split('T')[0],\n repository: ((task as any).primary_repository || '') as string,\n };\n\n const planTemplate = await this.generatePlanTemplate(templateVariables);\n\n prompt += `\\n\\nPlease analyze the codebase and create a detailed implementation plan for this task. Use the following template structure for your plan:\\n\\n${planTemplate}\\n\\nFill in each section with specific, actionable information based on your analysis. Replace all placeholder content with actual details about this task.`;\n\n return prompt;\n }\n\n async buildExecutionPrompt(task: Task, repositoryPath?: string): Promise<string> {\n // Process file references in description\n const { description: descriptionAfterFiles, referencedFiles } = await this.processFileReferences(\n task.description,\n repositoryPath\n );\n\n // Process URL references in description \n const { description: processedDescription, referencedResources } = await this.processUrlReferences(\n descriptionAfterFiles\n );\n\n let prompt = '';\n prompt += `## Current Task\\n\\n**Task**: ${task.title}\\n**Description**: ${processedDescription}`;\n\n if ((task as any).primary_repository) {\n prompt += `\\n**Repository**: ${(task as any).primary_repository}`;\n }\n\n // Add referenced files from @ mentions\n if (referencedFiles.length > 0) {\n prompt += `\\n\\n## Referenced Files\\n\\n`;\n for (const file of referencedFiles) {\n prompt += `### ${file.path}\\n\\`\\`\\`\\n${file.content}\\n\\`\\`\\`\\n\\n`;\n }\n }\n\n // Add referenced resources from URL mentions\n if (referencedResources.length > 0) {\n prompt += `\\n\\n## Referenced Resources\\n\\n`;\n for (const resource of referencedResources) {\n prompt += `### ${resource.title} (${resource.type})\\n**URL**: ${resource.url}\\n\\n${resource.content}\\n\\n`;\n }\n }\n\n try {\n const taskFiles = await this.getTaskFiles(task.id);\n const hasPlan = taskFiles.some((f: any) => f.type === 'plan');\n if (taskFiles.length > 0) {\n prompt += `\\n\\n## Context and Supporting Information`;\n for (const file of taskFiles) {\n if (file.type === 'plan') {\n prompt += `\\n\\n### Execution Plan\\n${file.content}`;\n } else {\n prompt += `\\n\\n### ${file.name} (${file.type})\\n${file.content}`;\n }\n }\n }\n if (hasPlan) {\n prompt += `\\n\\nPlease implement the changes described in the execution plan above. Follow the plan step-by-step and make the necessary file modifications. You must actually edit files and make changes - do not just analyze or review.`;\n } else {\n prompt += `\\n\\nPlease implement the changes described in the task above. You must actually edit files and make changes - do not just analyze or review.`;\n }\n } catch (error) {\n this.logger.debug('No supporting files found for execution', { taskId: task.id });\n prompt += `\\n\\nPlease implement the changes described in the task above.`;\n }\n return prompt;\n }\n}\n\n\n"],"names":["fs"],"mappings":";;;;MAaa,aAAa,CAAA;AAChB,IAAA,YAAY;AACZ,IAAA,oBAAoB;AACpB,IAAA,aAAa;AACb,IAAA,MAAM;AAEd,IAAA,WAAA,CAAY,IAAuB,EAAA;AACjC,QAAA,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY;AACrC,QAAA,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC,oBAAoB;AACrD,QAAA,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa;QACvC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,IAAI,MAAM,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC;IACtF;AAEA;;;AAGG;AACK,IAAA,gBAAgB,CAAC,WAAmB,EAAA;QAC1C,MAAM,YAAY,GAAG,+BAA+B;QACpD,MAAM,KAAK,GAAa,EAAE;AAC1B,QAAA,IAAI,KAA6B;AAEjC,QAAA,OAAO,CAAC,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,IAAI,EAAE;YACxD,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACtB;AAEA,QAAA,OAAO,KAAK;IACd;AAEA;;AAEG;AACK,IAAA,MAAM,eAAe,CAAC,cAAsB,EAAE,QAAgB,EAAA;AACpE,QAAA,IAAI;YACF,MAAM,QAAQ,GAAG,IAAI,CAAC,cAAc,EAAE,QAAQ,CAAC;YAC/C,MAAM,OAAO,GAAG,MAAMA,QAAE,CAAC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MAAM,IAAI,CAAA,IAAA,EAAO,QAAQ,CAAC,KAAK,CAAA,EAAA,EAAK,QAAQ,CAAC,IAAI,CAAA,YAAA,EAAe,QAAQ,CAAC,GAAG,CAAA,IAAA,EAAO,QAAQ,CAAC,OAAO,MAAM;YAC3G;QACF;AAEA,QAAA,IAAI;YACF,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;AAClD,YAAA,MAAM,OAAO,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,CAAM,KAAK,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC;AAC7D,YAAA,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;gBACxB,MAAM,IAAI,2CAA2C;AACrD,gBAAA,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE;AAC5B,oBAAA,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,EAAE;AACxB,wBAAA,MAAM,IAAI,CAAA,wBAAA,EAA2B,IAAI,CAAC,OAAO,EAAE;oBACrD;yBAAO;AACL,wBAAA,MAAM,IAAI,CAAA,QAAA,EAAW,IAAI,CAAC,IAAI,CAAA,EAAA,EAAK,IAAI,CAAC,IAAI,CAAA,GAAA,EAAM,IAAI,CAAC,OAAO,EAAE;oBAClE;gBACF;YACF;YACA,IAAI,OAAO,EAAE;gBACX,MAAM,IAAI,gOAAgO;YAC5O;iBAAO;gBACL,MAAM,IAAI,8IAA8I;YAC1J;QACF;QAAE,OAAO,KAAK,EAAE;AACd,YAAA,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,yCAAyC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC;YACjF,MAAM,IAAI,+DAA+D;QAC3E;AACA,QAAA,OAAO,MAAM;IACf;AACD;;;;"}
1
+ {"version":3,"file":"prompt-builder.js","sources":["../../src/prompt-builder.ts"],"sourcesContent":["import type { Task, UrlMention, PostHogResource } from './types.js';\nimport type { TemplateVariables } from './template-manager.js';\nimport { Logger } from './utils/logger.js';\nimport { promises as fs } from 'fs';\nimport { join } from 'path';\n\nexport interface PromptBuilderDeps {\n getTaskFiles: (taskId: string) => Promise<any[]>;\n generatePlanTemplate: (vars: TemplateVariables) => Promise<string>;\n posthogClient?: { fetchResourceByUrl: (mention: UrlMention) => Promise<PostHogResource> };\n logger?: Logger;\n}\n\nexport class PromptBuilder {\n private getTaskFiles: PromptBuilderDeps['getTaskFiles'];\n private generatePlanTemplate: PromptBuilderDeps['generatePlanTemplate'];\n private posthogClient?: PromptBuilderDeps['posthogClient'];\n private logger: Logger;\n\n constructor(deps: PromptBuilderDeps) {\n this.getTaskFiles = deps.getTaskFiles;\n this.generatePlanTemplate = deps.generatePlanTemplate;\n this.posthogClient = deps.posthogClient;\n this.logger = deps.logger || new Logger({ debug: false, prefix: '[PromptBuilder]' });\n }\n\n /**\n * Extract file paths from XML tags in description\n * Format: <file path=\"relative/path.ts\" />\n */\n private extractFilePaths(description: string): string[] {\n const fileTagRegex = /<file\\s+path=\"([^\"]+)\"\\s*\\/>/g;\n const paths: string[] = [];\n let match: RegExpExecArray | null;\n\n while ((match = fileTagRegex.exec(description)) !== null) {\n paths.push(match[1]);\n }\n\n return paths;\n }\n\n /**\n * Read file contents from repository\n */\n private async readFileContent(repositoryPath: string, filePath: string): Promise<string | null> {\n try {\n const fullPath = join(repositoryPath, filePath);\n const content = await fs.readFile(fullPath, 'utf8');\n return content;\n } catch (error) {\n this.logger.warn(`Failed to read referenced file: ${filePath}`, { error });\n return null;\n }\n }\n\n /**\n * Extract URL mentions from XML tags in description\n * Formats: <error id=\"...\" />, <experiment id=\"...\" />, <url href=\"...\" />\n */\n private extractUrlMentions(description: string): UrlMention[] {\n const mentions: UrlMention[] = [];\n \n // PostHog resource mentions: <error id=\"...\" />, <experiment id=\"...\" />, etc.\n const resourceRegex = /<(error|experiment|insight|feature_flag)\\s+id=\"([^\"]+)\"\\s*\\/>/g;\n let match: RegExpExecArray | null;\n\n while ((match = resourceRegex.exec(description)) !== null) {\n const [, type, id] = match;\n mentions.push({\n url: '', // Will be reconstructed if needed\n type: type as any,\n id,\n label: this.generateUrlLabel('', type as any),\n });\n }\n\n // Generic URL mentions: <url href=\"...\" />\n const urlRegex = /<url\\s+href=\"([^\"]+)\"\\s*\\/>/g;\n while ((match = urlRegex.exec(description)) !== null) {\n const [, url] = match;\n mentions.push({\n url,\n type: 'generic',\n label: this.generateUrlLabel(url, 'generic'),\n });\n }\n\n return mentions;\n }\n\n /**\n * Generate a display label for a URL mention\n */\n private generateUrlLabel(url: string, type: string): string {\n try {\n const urlObj = new URL(url);\n switch (type) {\n case 'error':\n const errorMatch = url.match(/error_tracking\\/([a-f0-9-]+)/);\n return errorMatch ? `Error ${errorMatch[1].slice(0, 8)}...` : 'Error';\n case 'experiment':\n const expMatch = url.match(/experiments\\/(\\d+)/);\n return expMatch ? `Experiment #${expMatch[1]}` : 'Experiment';\n case 'insight':\n return 'Insight';\n case 'feature_flag':\n return 'Feature Flag';\n default:\n return urlObj.hostname;\n }\n } catch {\n return 'URL';\n }\n }\n\n /**\n * Process URL references and fetch their content\n */\n private async processUrlReferences(\n description: string\n ): Promise<{ description: string; referencedResources: PostHogResource[] }> {\n const urlMentions = this.extractUrlMentions(description);\n const referencedResources: PostHogResource[] = [];\n\n if (urlMentions.length === 0 || !this.posthogClient) {\n return { description, referencedResources };\n }\n\n // Fetch all referenced resources\n for (const mention of urlMentions) {\n try {\n const resource = await this.posthogClient.fetchResourceByUrl(mention);\n referencedResources.push(resource);\n } catch (error) {\n this.logger.warn(`Failed to fetch resource from URL: ${mention.url}`, { error });\n // Add a placeholder resource for failed fetches\n referencedResources.push({\n type: mention.type,\n id: mention.id || '',\n url: mention.url,\n title: mention.label || 'Unknown Resource',\n content: `Failed to fetch resource from ${mention.url}: ${error}`,\n metadata: {},\n });\n }\n }\n\n // Replace URL tags with just the label for readability\n let processedDescription = description;\n for (const mention of urlMentions) {\n if (mention.type === 'generic') {\n // Generic URLs: <url href=\"...\" />\n const escapedUrl = mention.url.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n processedDescription = processedDescription.replace(\n new RegExp(`<url\\\\s+href=\"${escapedUrl}\"\\\\s*/>`, 'g'),\n `@${mention.label}`\n );\n } else {\n // PostHog resources: <error id=\"...\" />, <experiment id=\"...\" />, etc.\n const escapedType = mention.type.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n const escapedId = mention.id ? mention.id.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&') : '';\n processedDescription = processedDescription.replace(\n new RegExp(`<${escapedType}\\\\s+id=\"${escapedId}\"\\\\s*/>`, 'g'),\n `@${mention.label}`\n );\n }\n }\n\n return { description: processedDescription, referencedResources };\n }\n\n /**\n * Process description to extract file tags and read contents\n * Returns processed description and referenced file contents\n */\n private async processFileReferences(\n description: string,\n repositoryPath?: string\n ): Promise<{ description: string; referencedFiles: Array<{ path: string; content: string }> }> {\n const filePaths = this.extractFilePaths(description);\n const referencedFiles: Array<{ path: string; content: string }> = [];\n\n if (filePaths.length === 0 || !repositoryPath) {\n return { description, referencedFiles };\n }\n\n // Read all referenced files\n for (const filePath of filePaths) {\n const content = await this.readFileContent(repositoryPath, filePath);\n if (content !== null) {\n referencedFiles.push({ path: filePath, content });\n }\n }\n\n // Replace file tags with just the filename for readability\n let processedDescription = description;\n for (const filePath of filePaths) {\n const fileName = filePath.split('/').pop() || filePath;\n processedDescription = processedDescription.replace(\n new RegExp(`<file\\\\s+path=\"${filePath.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')}\"\\\\s*/>`, 'g'),\n `@${fileName}`\n );\n }\n\n return { description: processedDescription, referencedFiles };\n }\n\n async buildResearchPrompt(task: Task, repositoryPath?: string): Promise<string> {\n // Process file references in description\n const { description: descriptionAfterFiles, referencedFiles } = await this.processFileReferences(\n task.description,\n repositoryPath\n );\n\n // Process URL references in description\n const { description: processedDescription, referencedResources } = await this.processUrlReferences(\n descriptionAfterFiles\n );\n\n let prompt = '<task>\\n';\n prompt += `<title>${task.title}</title>\\n`;\n prompt += `<description>${processedDescription}</description>\\n`;\n\n if ((task as any).primary_repository) {\n prompt += `<repository>${(task as any).primary_repository}</repository>\\n`;\n }\n prompt += '</task>\\n';\n\n // Add referenced files from @ mentions\n if (referencedFiles.length > 0) {\n prompt += '\\n<referenced_files>\\n';\n for (const file of referencedFiles) {\n prompt += `<file path=\"${file.path}\">\\n\\`\\`\\`\\n${file.content}\\n\\`\\`\\`\\n</file>\\n`;\n }\n prompt += '</referenced_files>\\n';\n }\n\n // Add referenced resources from URL mentions\n if (referencedResources.length > 0) {\n prompt += '\\n<referenced_resources>\\n';\n for (const resource of referencedResources) {\n prompt += `<resource type=\"${resource.type}\" url=\"${resource.url}\">\\n`;\n prompt += `<title>${resource.title}</title>\\n`;\n prompt += `<content>${resource.content}</content>\\n`;\n prompt += '</resource>\\n';\n }\n prompt += '</referenced_resources>\\n';\n }\n\n try {\n const taskFiles = await this.getTaskFiles(task.id);\n const contextFiles = taskFiles.filter((f: any) => f.type === 'context' || f.type === 'reference');\n if (contextFiles.length > 0) {\n prompt += '\\n<supporting_files>\\n';\n for (const file of contextFiles) {\n prompt += `<file name=\"${file.name}\" type=\"${file.type}\">\\n${file.content}\\n</file>\\n`;\n }\n prompt += '</supporting_files>\\n';\n }\n } catch (error) {\n this.logger.debug('No existing task files found for research', { taskId: task.id });\n }\n\n return prompt;\n }\n\n async buildPlanningPrompt(task: Task, repositoryPath?: string): Promise<string> {\n // Process file references in description\n const { description: descriptionAfterFiles, referencedFiles } = await this.processFileReferences(\n task.description,\n repositoryPath\n );\n\n // Process URL references in description\n const { description: processedDescription, referencedResources } = await this.processUrlReferences(\n descriptionAfterFiles\n );\n\n let prompt = '<task>\\n';\n prompt += `<title>${task.title}</title>\\n`;\n prompt += `<description>${processedDescription}</description>\\n`;\n\n if ((task as any).primary_repository) {\n prompt += `<repository>${(task as any).primary_repository}</repository>\\n`;\n }\n prompt += '</task>\\n';\n\n // Add referenced files from @ mentions\n if (referencedFiles.length > 0) {\n prompt += '\\n<referenced_files>\\n';\n for (const file of referencedFiles) {\n prompt += `<file path=\"${file.path}\">\\n\\`\\`\\`\\n${file.content}\\n\\`\\`\\`\\n</file>\\n`;\n }\n prompt += '</referenced_files>\\n';\n }\n\n // Add referenced resources from URL mentions\n if (referencedResources.length > 0) {\n prompt += '\\n<referenced_resources>\\n';\n for (const resource of referencedResources) {\n prompt += `<resource type=\"${resource.type}\" url=\"${resource.url}\">\\n`;\n prompt += `<title>${resource.title}</title>\\n`;\n prompt += `<content>${resource.content}</content>\\n`;\n prompt += '</resource>\\n';\n }\n prompt += '</referenced_resources>\\n';\n }\n\n try {\n const taskFiles = await this.getTaskFiles(task.id);\n const contextFiles = taskFiles.filter((f: any) => f.type === 'context' || f.type === 'reference');\n if (contextFiles.length > 0) {\n prompt += '\\n<supporting_files>\\n';\n for (const file of contextFiles) {\n prompt += `<file name=\"${file.name}\" type=\"${file.type}\">\\n${file.content}\\n</file>\\n`;\n }\n prompt += '</supporting_files>\\n';\n }\n } catch (error) {\n this.logger.debug('No existing task files found for planning', { taskId: task.id });\n }\n\n const templateVariables = {\n task_id: task.id,\n task_title: task.title,\n task_description: processedDescription,\n date: new Date().toISOString().split('T')[0],\n repository: ((task as any).primary_repository || '') as string,\n };\n\n const planTemplate = await this.generatePlanTemplate(templateVariables);\n\n prompt += '\\n<instructions>\\n';\n prompt += 'Analyze the codebase and create a detailed implementation plan. Use the template structure below, filling each section with specific, actionable information.\\n';\n prompt += '</instructions>\\n\\n';\n prompt += '<plan_template>\\n';\n prompt += planTemplate;\n prompt += '\\n</plan_template>';\n\n return prompt;\n }\n\n async buildExecutionPrompt(task: Task, repositoryPath?: string): Promise<string> {\n // Process file references in description\n const { description: descriptionAfterFiles, referencedFiles } = await this.processFileReferences(\n task.description,\n repositoryPath\n );\n\n // Process URL references in description\n const { description: processedDescription, referencedResources } = await this.processUrlReferences(\n descriptionAfterFiles\n );\n\n let prompt = '<task>\\n';\n prompt += `<title>${task.title}</title>\\n`;\n prompt += `<description>${processedDescription}</description>\\n`;\n\n if ((task as any).primary_repository) {\n prompt += `<repository>${(task as any).primary_repository}</repository>\\n`;\n }\n prompt += '</task>\\n';\n\n // Add referenced files from @ mentions\n if (referencedFiles.length > 0) {\n prompt += '\\n<referenced_files>\\n';\n for (const file of referencedFiles) {\n prompt += `<file path=\"${file.path}\">\\n\\`\\`\\`\\n${file.content}\\n\\`\\`\\`\\n</file>\\n`;\n }\n prompt += '</referenced_files>\\n';\n }\n\n // Add referenced resources from URL mentions\n if (referencedResources.length > 0) {\n prompt += '\\n<referenced_resources>\\n';\n for (const resource of referencedResources) {\n prompt += `<resource type=\"${resource.type}\" url=\"${resource.url}\">\\n`;\n prompt += `<title>${resource.title}</title>\\n`;\n prompt += `<content>${resource.content}</content>\\n`;\n prompt += '</resource>\\n';\n }\n prompt += '</referenced_resources>\\n';\n }\n\n try {\n const taskFiles = await this.getTaskFiles(task.id);\n const hasPlan = taskFiles.some((f: any) => f.type === 'plan');\n\n if (taskFiles.length > 0) {\n prompt += '\\n<context>\\n';\n for (const file of taskFiles) {\n if (file.type === 'plan') {\n prompt += `<plan>\\n${file.content}\\n</plan>\\n`;\n } else {\n prompt += `<file name=\"${file.name}\" type=\"${file.type}\">\\n${file.content}\\n</file>\\n`;\n }\n }\n prompt += '</context>\\n';\n }\n\n prompt += '\\n<instructions>\\n';\n if (hasPlan) {\n prompt += 'Implement the changes described in the execution plan. Follow the plan step-by-step and make the necessary file modifications.\\n';\n } else {\n prompt += 'Implement the changes described in the task. Make the necessary file modifications to complete the task.\\n';\n }\n prompt += '</instructions>';\n } catch (error) {\n this.logger.debug('No supporting files found for execution', { taskId: task.id });\n prompt += '\\n<instructions>\\n';\n prompt += 'Implement the changes described in the task.\\n';\n prompt += '</instructions>';\n }\n\n return prompt;\n }\n}\n\n\n"],"names":["fs"],"mappings":";;;;MAaa,aAAa,CAAA;AAChB,IAAA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I,CAAA,QAAA,EAAW,IAAI,CAAC,IAAI,CAAA,IAAA,EAAO,IAAI,CAAC,OAAO,aAAa;oBACxF;gBACF;gBACA,MAAM,IAAI,cAAc;YAC1B;YAEA,MAAM,IAAI,oBAAoB;YAC9B,IAAI,OAAO,EAAE;gBACX,MAAM,IAAI,kIAAkI;YAC9I;iBAAO;gBACL,MAAM,IAAI,4GAA4G;YACxH;YACA,MAAM,IAAI,iBAAiB;QAC7B;QAAE,OAAO,KAAK,EAAE;AACd,YAAA,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,yCAAyC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC;YACjF,MAAM,IAAI,oBAAoB;YAC9B,MAAM,IAAI,gDAAgD;YAC1D,MAAM,IAAI,iBAAiB;QAC7B;AAEA,QAAA,OAAO,MAAM;IACf;AACD;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@posthog/agent",
3
- "version": "1.13.0",
3
+ "version": "1.14.0",
4
4
  "description": "TypeScript agent framework wrapping Claude Agent SDK with Git-based task execution for PostHog",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -1,53 +1,38 @@
1
- export const EXECUTION_SYSTEM_PROMPT = `<context>
2
- You have access to the local repository files for fast read/write operations.
3
- You also have access to GitHub via the GitHub MCP server for additional repository operations.
4
- Work with local files for your main implementation, and use GitHub MCP for any additional repository queries.
5
- Commit changes to the repository regularly.
6
- </context>
7
-
8
- <role>
9
- PostHog AI Coding Agent — autonomously transform a ticket into a merge-ready pull request that follows existing project conventions.
1
+ export const EXECUTION_SYSTEM_PROMPT = `<role>
2
+ PostHog AI Execution Agent autonomously implement tasks as merge-ready code following project conventions.
10
3
  </role>
11
4
 
12
- <tools>
13
- Local file system (for main implementation work)
14
- PostHog MCP server (for PostHog operations)
15
- </tools>
5
+ <context>
6
+ You have access to local repository files and PostHog MCP server. Work primarily with local files for implementation. Commit changes regularly.
7
+ </context>
16
8
 
17
9
  <constraints>
18
- - Follow existing style and patterns you discover in the repo.
19
- - Try not to add new external dependencies, only if needed.
20
- - Implement structured logging and error handling; never log secrets.
21
- - Avoid destructive shell commands.
22
- - ALWAYS create appropriate .gitignore files to exclude build artifacts, dependencies, and temporary files.
10
+ - Follow existing code style, patterns, and conventions found in the repository
11
+ - Minimize new external dependencies only add when necessary
12
+ - Implement structured logging and error handling (never log secrets)
13
+ - Avoid destructive shell commands
14
+ - Create/update .gitignore to exclude build artifacts, dependencies, and temp files
23
15
  </constraints>
24
16
 
25
- <checklist>
26
- - Created or updated .gitignore file with appropriate exclusions
27
- - Created dependency files (requirements.txt, package.json, etc.) with exact versions
28
- - Added clear setup/installation instructions to README.md
29
- - Code compiles and tests pass.
30
- - Added or updated tests.
31
- - Captured meaningful events with PostHog SDK.
32
- - Wrapped new logic in an PostHog feature flag.
33
- - Updated docs, readme or type hints if needed.
34
- - Verified no build artifacts or dependencies are being committed
35
- </checklist>
36
-
37
17
  <approach>
38
- - first make a plan and create a todo list
39
- - execute the todo list one by one
40
- - test the changes
18
+ 1. Review the implementation plan if provided, or create your own todo list
19
+ 2. Execute changes step by step
20
+ 3. Test thoroughly and verify functionality
21
+ 4. Commit changes with clear messages
41
22
  </approach>
42
23
 
43
- <output_format>
44
- Once finished respond with a summary of changes made
45
- </output_format>
46
-
47
- <thinking>
48
- Use this area as a private scratch-pad for step-by-step reasoning; erase before final output.
49
- </thinking>
24
+ <checklist>
25
+ Before completing the task, verify:
26
+ - .gitignore includes build artifacts, node_modules, __pycache__, etc.
27
+ - Dependency files (package.json, requirements.txt) use exact versions
28
+ - Code compiles and tests pass
29
+ - Added or updated relevant tests
30
+ - Captured meaningful events with PostHog SDK where appropriate
31
+ - Wrapped new logic in PostHog feature flags where appropriate
32
+ - Updated documentation, README, or type hints as needed
33
+ - No build artifacts or dependencies are being committed
34
+ </checklist>
50
35
 
51
- <task>
52
- Complete the ticket in a thoughtful step by step manner. Plan thoroughly and make sure to add logging and error handling as well as cover edge cases.
53
- </task>`;
36
+ <output_format>
37
+ Provide a concise summary of changes made when finished.
38
+ </output_format>`;
@@ -1,66 +1,60 @@
1
- export const PLANNING_SYSTEM_PROMPT = `# PostHog AI Coding Agent - Planning Mode
2
-
3
- You are a PostHog AI Coding Agent operating in PLANNING mode.
4
-
5
- ## Your Role
6
-
7
- You are a specialized planning agent that analyzes codebases and creates detailed implementation plans for development tasks.
8
-
9
- ## Important Constraints
10
-
11
- - **Read-Only Mode**: You can only read files, search code, and analyze the codebase
12
- - **No Modifications**: You cannot make any changes, edits, or execute commands
13
- - **Research Focus**: Your goal is understanding and planning, not implementation
14
- - **Response Format**: Respond only with the markdown content above, no other text or formatting, no acknowledgement, no explanation, no nothing.
15
-
16
- ## Available Tools
17
-
18
- - File reading and exploration
19
- - Code search and analysis
20
- - Repository structure analysis
21
- - Documentation review
22
-
23
- ## Planning Process
24
-
25
- When given a task, follow this systematic approach:
26
-
27
- 1. **Codebase Analysis**
28
- - Explore the repository structure
29
- - Identify relevant files and components
30
- - Understand existing patterns and conventions
31
- - Review related code and dependencies
32
-
33
- 2. **Requirements Analysis**
34
- - Break down the task requirements
35
- - Identify technical constraints
36
- - Note any existing implementations to build upon
37
- - Consider edge cases and potential issues
38
-
39
- 3. **Implementation Planning**
40
- - Outline the step-by-step approach
41
- - Identify files that need to be created or modified
42
- - Plan the order of implementation
43
- - Note any dependencies or prerequisites
44
-
45
- 4. **Documentation**
46
- - Create a clear, actionable plan
47
- - Include specific file paths and changes needed
48
- - Note any testing requirements
49
- - Highlight potential risks or considerations
50
-
51
- ## Plan Output
52
-
53
- - **Summary**: Brief overview of the implementation approach
54
- - **Files to Create/Modify**: Specific paths and purposes
55
- - **Implementation Steps**: Ordered list of actions to take
56
- - **Considerations**: Dependencies, risks, and important notes
57
- - **Testing Strategy**: How to verify the implementation works
58
-
59
- ## Context Integration
60
-
61
- If supporting files are provided, incorporate them into your analysis:
62
- - **Context files**: Additional requirements or constraints
63
- - **Reference files**: Examples or documentation to follow
64
- - **Previous plans**: Build upon or refine existing planning work
65
-
66
- Your planning should be thorough enough that another agent in execution mode can implement the changes successfully.`;
1
+ export const PLANNING_SYSTEM_PROMPT = `<role>
2
+ PostHog AI Planning Agent — analyze codebases and create actionable implementation plans.
3
+ </role>
4
+
5
+ <constraints>
6
+ - Read-only: analyze files, search code, explore structure
7
+ - No modifications, edits, or command execution
8
+ - Output ONLY the plan markdown — no preamble, no acknowledgment, no meta-commentary
9
+ </constraints>
10
+
11
+ <objective>
12
+ Create a detailed, actionable implementation plan that an execution agent can follow to complete the task successfully.
13
+ </objective>
14
+
15
+ <process>
16
+ 1. Explore repository structure and identify relevant files/components
17
+ 2. Understand existing patterns, conventions, and dependencies
18
+ 3. Break down task requirements and identify technical constraints
19
+ 4. Define step-by-step implementation approach
20
+ 5. Specify files to modify/create with exact paths
21
+ 6. Identify testing requirements and potential risks
22
+ </process>
23
+
24
+ <output_format>
25
+ Output the plan DIRECTLY as markdown with NO preamble text. Do NOT say "I'll create a plan" or "Here's the plan" — just output the plan content.
26
+
27
+ Required sections (follow the template provided in the task prompt):
28
+ - Summary: Brief overview of approach
29
+ - Files to Create/Modify: Specific paths and purposes
30
+ - Implementation Steps: Ordered list of actions
31
+ - Testing Strategy: How to verify it works
32
+ - Considerations: Dependencies, risks, edge cases
33
+ </output_format>
34
+
35
+ <examples>
36
+ <bad_example>
37
+ "Sure! I'll create a detailed implementation plan for you to add authentication. Here's what we'll do..."
38
+ Reason: No preamble — output the plan directly
39
+ </bad_example>
40
+
41
+ <good_example>
42
+ "# Implementation Plan
43
+
44
+ ## Summary
45
+ Add JWT-based authentication to API endpoints using existing middleware pattern...
46
+
47
+ ## Files to Modify
48
+ - src/middleware/auth.ts: Add JWT verification
49
+ ..."
50
+ Reason: Direct plan output with no meta-commentary
51
+ </good_example>
52
+ </examples>
53
+
54
+ <context_integration>
55
+ If research findings, context files, or reference materials are provided:
56
+ - Incorporate research findings into your analysis
57
+ - Follow patterns and approaches identified in research
58
+ - Build upon or refine any existing planning work
59
+ - Reference specific files and components mentioned in context
60
+ </context_integration>`;