-
Notifications
You must be signed in to change notification settings - Fork 0
Project Root
How core decides whether the current working directory has a project layer. The rule is deliberately narrow: project root is <cwd>/.stud/ only. There is no walk-up.
Project root resolution does not walk up the directory tree.
Starting a session in /a/b/c/:
- If
/a/b/c/.stud/exists → it is the project root. - If
/a/b/c/.stud/does not exist → there is no project layer, even if/a/b/.stud/exists.
This is a deliberate choice. Pros and cons are both loud.
flowchart LR
CWD[cwd] --> Check{cwd/.stud<br/>exists?}
Check -->|yes| Found[project root]
Check -->|no| None[no project layer]
| Reason | Consequence |
|---|---|
| Trust clarity | The user's choice to work in a directory with .stud/ is the signal. Walking up would silently activate code the user may not know about. |
| Predictability | "What loaded?" has a simple answer — what's in <cwd>/.stud/. |
| Monorepos | Different subprojects can have different .stud/. A user must cd into the one they mean. |
| Parent-hierarchy surprises | Avoids the "I'm in a subdir of a cloned repo I forgot had stud config" case. |
The walk-up design is rejected for v1. Users who want shared extensions across sibling projects put them in global scope (~/.stud/) or symlink.
flowchart TD
Start[session start] --> Cwd[read cwd]
Cwd --> Probe{".stud directory<br/>exists under cwd?"}
Probe -->|no| NoProj[no project layer;<br/>continue with bundled + global]
Probe -->|yes| Trust{project<br/>trusted?}
Trust -->|no| Prompt[project trust prompt]
Trust -->|yes| Discover[discover project extensions]
Prompt -->|granted| Discover
Prompt -->|declined| Skip[skip project layer]
The trust check happens after finding .stud/, not before. See Project Trust.
<cwd>/.stud/ must be a directory (not a file, not a symlink to a file). Symlinks to directories are followed.
A completely empty .stud/ directory still triggers the trust prompt (because an empty .stud/ can be populated later). Declining means the session ignores that directory for the session lifetime.
The session's working directory and the project root are usually the same. They are not required to be:
- A session may run in
/a/b/c/sub/with the project root at/a/b/c/.stud/— but no, because walk-up is disabled. In practice, the project root is<cwd>/.stud/or none. - The distinction matters for tools reading files: file-reading tools use the session's working directory. They do not walk up to find a project to anchor to.
cwd is canonicalized before the probe:
- Absolute path.
- Symlinks in the path resolved.
- Trailing separators stripped.
The canonical path is the key used in the Project Trust trust list. A second entry to the same project via a different path (e.g., through a symlink) still hits the same trust list entry.
Core does not create .stud/ on its own. If the user wants to add project extensions, they create the directory and populate it. On first re-entry, core prompts for trust.
There is no stud init command in v1 that creates a .stud/ and elevates trust. The user must act deliberately.
<cwd>/.stud/mcp.json and <cwd>/.stud/settings.json are project-scope inputs — only picked up when the project layer is trusted and active. See Configuration Scopes and MCP.
- Execution Model
- Message Loop
- Concurrency and Cancellation
- Error Model
- Event and Command Ordering
- Event Bus
- Command Model
- Interaction Protocol
- Hook Taxonomy
- Host API
- Extension Lifecycle
- Env Provider
- Prompt Registry
- Resource Registry
- Session Lifecycle
- Session Manifest
- Persistence and Recovery
- Stage Executions
- Subagent Sessions
- Contract Pattern
- Versioning and Compatibility
- Deprecation Policy
- Capability Negotiation
- Dependency Resolution
- Validation Pipeline
- Cardinality and Activation
- Extension State
- Conformance and Testing
- Providers
- Provider Params
- Tools
- Hooks
- UI
- Loggers
- State Machines
- SM Stage Lifecycle
- Stage Definitions
- Commands
- Session Store
- Context Providers
- Settings Shape
- Trust Model
- Project Trust
- Extension Isolation
- Extension Integrity
- LLM Context Isolation
- Secrets Hygiene
- Security Modes
- Tool Approvals
- MCP Trust
- Sandboxing
- Configuration Scopes
- Project Root
- Extension Discovery
- Extension Installation
- Extension Reloading
- Headless and Interactor
- Determinism and Ordering
- Launch Arguments
- Network Policy
- Platform Integration
Tools
UI
Session Stores
Loggers
Providers
Hooks
Context Providers
Commands
- First Run
- Default Chat
- Tool Call Cycle
- Hook Interception
- Guard Deny Reproposal
- State Machine Workflow
- SM Stage Retry
- Hot Model Switch
- Capability Mismatch Switch
- Session Resume
- Session Resume Drift
- Approval and Auth
- Interaction Timeout
- Headless Run
- Parallel Tool Approvals
- Subagent Delegation
- Scope Layering
- Project First-Run Trust
- Reload Mid-Turn
- Compaction Warning
- MCP Remote Tool Call
- MCP Prompt Consume
- MCP Resource Bind
- MCP Reconnect