Merge pull request #1131 from cx-alberto-simoes/feature/configurable-serena-folder-location

feat: add configurable project_serena_folder_location setting

Add a new `project_serena_folder_location` setting to `serena_config.yml` that allows configuring where the per-project `.serena` data folder (memories, caches) is stored, with `$projectDir` and `$projectFolderName` placeholder support (default: `$projectDir/.serena`, preserving current behavior).

Resolves #1123

Co-authored-by: Dominik Jain <dominik.jain@oraios-ai.de>
This commit is contained in:
Alberto SimõesandDominik Jain authored and Dominik Jain committed 2026-03-05 21:09:13 +01:00
1 parent 4353fd34dd
commit 58efe413e3
13 files changed
+418 -76

No files matched your search

+29
View File
@@ -173,6 +173,35 @@ For advanced users, Serena's configuration can be further customized.
The Serena user data directory (where configuration, language server files, logs, etc. are stored) defaults to `~/.serena`.
You can change this location by setting the `SERENA_HOME` environment variable to your desired path.
### Per-Project Serena Folder Location
By default, each project stores its Serena data (memories, caches, etc.) in a `.serena` folder inside the project root.
You can customize this location globally via the `project_serena_folder_location` setting in `serena_config.yml`.
The setting supports two placeholders:
| Placeholder | Description |
|----------------------|-------------------------------------------------|
| `$projectDir` | The absolute path to the project root directory |
| `$projectFolderName` | The name of the project folder |
**Examples:**
```yaml
# Default: data stored inside the project directory
project_serena_folder_location: "$projectDir/.serena"
# Central location: all project data under a shared directory
project_serena_folder_location: "/projects-metadata/$projectFolderName/.serena"
```
When a project is loaded, Serena uses the following fallback logic:
1. Check if a `.serena` folder exists at the configured path.
2. If not, check if one exists in the project root (default/legacy location).
3. If neither exists, create the folder at the configured path.
This ensures backward compatibility: existing projects that already have a `.serena` folder in the project root will continue to work, even after changing the `project_serena_folder_location` setting.
(ls-specific-settings)=
### Language Server-Specific Settings