فهرست منبع

feat: add CLAUDE.md memory file support to Claude prompt #12

- Added readMemoryFile() method to read CLAUDE.md from project root
- Modified buildPrompt() to include CLAUDE.md content in prompt context
- Ensures Claude always has project-specific guidelines and architecture knowledge
- Memory file content is automatically included if CLAUDE.md exists

This enhancement ensures Claude has full context about:
- Project architecture and patterns
- Development guidelines
- Configuration instructions
- Issue handling requirements

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Claude 9 ماه پیش
والد
کامیت
e73d928298
1فایلهای تغییر یافته به همراه26 افزوده شده و 1 حذف شده
  1. 26 1
      client/src/claude-client.ts

+ 26 - 1
client/src/claude-client.ts

@@ -3,7 +3,7 @@
  */
 
 import { query } from '@anthropic-ai/claude-agent-sdk';
-import { writeFileSync } from 'fs';
+import { writeFileSync, readFileSync, existsSync } from 'fs';
 import { join } from 'path';
 import { ClaudeClientConfig, IssueData, IssueHandlerResult } from './types.js';
 import { Config } from './config.js';
@@ -15,6 +15,25 @@ export class ClaudeClient {
     this.config = config;
   }
 
+  /**
+   * Read the CLAUDE.md memory file if it exists
+   */
+  private readMemoryFile(): string {
+    const memoryFilePath = join(this.config.workingDirectory, 'CLAUDE.md');
+
+    if (existsSync(memoryFilePath)) {
+      try {
+        const content = readFileSync(memoryFilePath, 'utf-8');
+        return content;
+      } catch (error) {
+        console.warn(`Warning: Could not read CLAUDE.md: ${error}`);
+        return '';
+      }
+    }
+
+    return '';
+  }
+
   /**
    * Build the prompt for Claude based on issue data
    */
@@ -23,7 +42,13 @@ export class ClaudeClient {
       ? `A new comment by ${issue.pusher}:\n${issue.commentBody}\n\n`
       : '';
 
+    const memoryContent = this.readMemoryFile();
+    const memorySection = memoryContent
+      ? `\n=== PROJECT MEMORY (CLAUDE.md) ===\n\nThe following is the project memory file that contains important context about this repository.\nYou MUST read and understand this information as it contains project-specific guidelines, architecture details, and development patterns.\n\n${memoryContent}\n\n`
+      : '';
+
     return `IMPORTANT: Issue #${issue.number} was assigned in repository ${issue.owner}/${issue.repo}.
+${memorySection}
 
 
 === MANDATORY FIRST STEPS - READ ALL MESSAGES ===