@@ -54,12 +54,11 @@ import { arePathsEqual, getReadablePath } from "../utils/path"
5454import { fixModelHtmlEscaping , removeInvalidChars } from "../utils/string"
5555import { AssistantMessageContent , parseAssistantMessage , ToolParamName , ToolUseName } from "./assistant-message"
5656import { constructNewFileContent } from "./assistant-message/diff"
57- import { HaiBuildContextOptions , HaiInstructionFile } from "../shared/customApi"
57+ import { HaiBuildContextOptions } from "../shared/customApi"
5858import { buildTreeString } from "../utils/customFs"
5959import { FindFilesToEditAgent } from "../integrations/code-prep/FindFilesToEditAgent"
6060import { CodeScanner } from "../integrations/security/code-scan"
6161import { ToolUse } from "./assistant-message"
62- import { readInstructionsFromFiles } from "../utils/instructions"
6362import { isCommandIncludedInSecretScanning , isSecretFile } from "../integrations/secret-scanning"
6463import { ClineIgnoreController , LOCK_TEXT_SYMBOL } from "./ignore/ClineIgnoreController"
6564import { parseMentions } from "./mentions"
@@ -80,7 +79,6 @@ export class Cline {
8079 api : ApiHandler
8180 private terminalManager : TerminalManager
8281 private urlContentFetcher : UrlContentFetcher
83- isCustomInstructionsEnabled : boolean
8482 browserSession : BrowserSession
8583 private didEditFile : boolean = false
8684 customInstructions ?: string
@@ -126,7 +124,6 @@ export class Cline {
126124 private apiConfiguration : ApiConfiguration
127125 private embeddingConfiguration : EmbeddingConfiguration
128126 private filesEditedByAI : Set < string > = new Set ( [ ] )
129- fileInstructions : HaiInstructionFile [ ] | undefined
130127 private didAutomaticallyRetryFailedApiRequest = false
131128
132129 constructor (
@@ -137,11 +134,9 @@ export class Cline {
137134 chatSettings : ChatSettings ,
138135 embeddingConfiguration : EmbeddingConfiguration ,
139136 customInstructions ?: string ,
140- fileInstructions ?: HaiInstructionFile [ ] ,
141137 task ?: string ,
142138 images ?: string [ ] ,
143139 historyItem ?: HistoryItem ,
144- isCustomInstructionsEnabled : boolean = true ,
145140 ) {
146141 this . clineIgnoreController = new ClineIgnoreController ( cwd )
147142 this . clineIgnoreController . initialize ( ) . catch ( ( error ) => {
@@ -154,8 +149,6 @@ export class Cline {
154149 this . browserSession = new BrowserSession ( provider . context , browserSettings )
155150 this . diffViewProvider = new DiffViewProvider ( cwd )
156151 this . customInstructions = customInstructions
157- this . isCustomInstructionsEnabled = isCustomInstructionsEnabled
158- this . fileInstructions = fileInstructions
159152 this . autoApprovalSettings = autoApprovalSettings
160153 this . browserSettings = browserSettings
161154 this . chatSettings = chatSettings
@@ -1289,10 +1282,7 @@ export class Cline {
12891282
12901283 const supportsCodeIndex = this . buildContextOptions ?. useIndex ?? false
12911284 let systemPrompt = await SYSTEM_PROMPT ( cwd , supportsComputerUse , supportsCodeIndex , mcpHub , this . browserSettings )
1292- let isCustomInstructionsEnabled = ( await this . providerRef . deref ( ) ?. customGetState ( "isCustomInstructionsEnabled" ) ) as any
1293- let settingsCustomInstructions = isCustomInstructionsEnabled ? this . customInstructions ?. trim ( ) : undefined
1294- let instructionStates = ( await this . providerRef . deref ( ) ?. customGetState ( "fileInstructions" ) ) as any
1295- let fileInstructions = await readInstructionsFromFiles ( instructionStates )
1285+ let settingsCustomInstructions = this . customInstructions ?. trim ( )
12961286
12971287 const clineRulesFilePath = path . resolve ( cwd , GlobalFileNames . clineRules )
12981288 let clineRulesFileInstructions : string | undefined
@@ -1313,14 +1303,9 @@ export class Cline {
13131303 clineIgnoreInstructions = `# .haiignore\n\n(The following is provided by a root-level .haiignore file where the user has specified files and directories that should not be accessed. When using list_files, you'll notice a ${ LOCK_TEXT_SYMBOL } next to files that are blocked. Attempting to access the file's contents e.g. through read_file will result in an error.)\n\n${ clineIgnoreContent } \n.haiignore`
13141304 }
13151305
1316- if ( settingsCustomInstructions || clineRulesFileInstructions || fileInstructions ) {
1306+ if ( settingsCustomInstructions || clineRulesFileInstructions ) {
13171307 // altering the system prompt mid-task will break the prompt cache, but in the grand scheme this will not change often so it's better to not pollute user messages with it the way we have to with <potentially relevant details>
1318- systemPrompt += addUserInstructions (
1319- settingsCustomInstructions ,
1320- clineRulesFileInstructions ,
1321- fileInstructions ,
1322- clineIgnoreInstructions ,
1323- )
1308+ systemPrompt += addUserInstructions ( settingsCustomInstructions , clineRulesFileInstructions , clineIgnoreInstructions )
13241309 }
13251310
13261311 // If the previous API request's total token usage is close to the context window, truncate the conversation history to free up space for the new request
0 commit comments