feat(openspec): project directory tracking and automatic context loading (#595, #596)#734
Merged
Merged
Conversation
… automatic context loading Rewrite all OpenSpec artifacts (proposal, design, specs, tasks) to narrow scope from general-purpose CWD tracking to project directory tracking: - Replace `CurrentWorkingDirectory` with `ProjectDirectory` in WorkingContext - Add standalone `set_working_directory` tool (profile-managed, audience-gated) instead of `set_cwd` parameter on shell_execute - Drop shell CWD defaulting, file path resolution changes, cd detection, directory tree walker, and ToolExecutionContext.ToolWorkingDirectory - Project identity files loaded from project root (no walking) and injected as [project-instructions] EveryTurn context layer - Add session_dir to [session] block for agent visibility - Unified security gate: CWD validated at set-time against audience roots - 6 task groups, 21 tasks (down from 10 groups, 42 tasks) Implements #595, #596.
…context layer Move project identity file content from EveryTurn context layer (volatile tail, never cached) to system prompt at position [0] (cached prefix, stable across turns). This matches how the global AGENTS.md is loaded and gives prompt-cache stability — cache busts only on project switch, then re-stabilizes immediately. Changes: - D5 rewritten: extend SystemPromptAssembler.Assemble() instead of creating ProjectInstructionLayerProvider - SetSystemPrompt() re-runs on project directory change - No IContextLayerProvider, no Func<string?> accessor, no volatile tail - Tasks updated: group 4 is now system prompt assembly, not context layer
…file loading Sessions now track a mutable ProjectDirectory in WorkingContext that persists across crash/restart via protobuf (tag 2). When set, the project's identity file (.netclaw/AGENTS.md, CLAUDE.md, AGENTS.md, or CONTEXT.md — first match wins) is automatically loaded into the system prompt alongside global SOUL/AGENTS/TOOLING layers. New set_working_directory tool validates the target directory exists and is within the audience's allowed file access roots. Profile-managed so Public/Team audiences cannot use it by default. The session actor intercepts successful results (gated by Path.IsPathRooted) to update WorkingContext and re-assemble the system prompt. Also adds session_dir to the [session] context block so the agent knows its full session directory path without inferring from media_dir. ISystemPromptProvider.GetSystemPrompt() now accepts an optional projectDirectory parameter — the provider remains stateless, avoiding race conditions across concurrent session actors sharing the DI singleton. Implements openspec change: session-cwd-tracking
…abilities Patches GHSA-g94r-2vxg-569j (OpenTelemetry.Api), GHSA-mr8r-92fq-pj8p and GHSA-q834-8qmm-v933 (OpenTelemetry.Exporter.OpenTelemetryProtocol). Also pins OpenTelemetry.Api explicitly to override the transitive 1.9.0 pulled by Akka.Hosting.
…t vulnerabilities" This reverts commit b271a81.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
set_working_directorytool (profile-managed, audience-gated) for setting the active project directory[project-instructions]context layer loads project identity files (.netclaw/AGENTS.md,CLAUDE.md,AGENTS.md,CONTEXT.md) from the project root on every LLM callProjectDirectorypersisted inWorkingContext/SessionSnapshot— survives compaction, crash, and restart[session]block for agent visibilityOpenSpec Artifacts
Test plan
Implements #595, #596.