-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Open
Description
Question
In https://github.com/sst/opencode/blob/v1.0.134/packages/opencode/src/session/system.ts#L49
I've noticed that the environment() function in system.ts fetches 200 files from the current git working directory. This means that when files are added or removed in the directory, this portion of the system environment prompt is likely to change, resulting in context invalidation and increased API costs.
Here are some optimization ideas I have:
Optional solutions:
-
Completely remove the section of the prompt. In my testing, most models are smart enough to use the
listtool to view directory files. -
Retrieve the file list from git committed files, which ensures this part of the prompt remains unchanged until the user commits to the git repository.
Metadata
Metadata
Assignees
Labels
No labels