Project Linking
Connect directories to Sessions projects for automatic rule loading.
The .sessions File
When you run sessions project <name>, a .sessions file is created in the current directory:
json
{
"project_id": "9ee565ec-7b83-4748-a78c-7bdd300485eb"
}
This file tells Sessions which project this directory belongs to. You can commit it to version control or add it to .gitignore - your choice.
How Rules Work
When Claude Code starts in a linked directory:
- The MCP server finds the
.sessionsfile (walks up the directory tree) - Loads global rules from your profile
- Loads project-specific rules for the linked project
- Both are provided to Claude as context
Directory Lookup
The .sessions file lookup walks up the directory tree. This means you can link a repository root and it works in all subdirectories.
Link at the root of your repository. All subdirectories will inherit the project context.
Example
~/myproject/ # .sessions file here
~/myproject/src/ # Rules load here too
~/myproject/src/api/ # And here
~/myproject/tests/ # And here