From c602ddd799d94bf3bbd35a57b98ad09e28df8ee9 Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Fri, 13 Mar 2026 05:27:58 +0000 Subject: fix: only write RAW_NARRATIVE.md when user explicitly provides project_dir MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously appendRawNarrative was called with the server's default workDir (os.Getwd()) when no project_dir was in the request, causing test runs and any elaboration without a project to pollute the repo's own RAW_NARRATIVE.md. The narrative is per-project human input — only write it when the caller explicitly specifies which project they're working in. Co-Authored-By: Claude Sonnet 4.6 --- internal/api/elaborate.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'internal/api/elaborate.go') diff --git a/internal/api/elaborate.go b/internal/api/elaborate.go index c6d08f4..5df772e 100644 --- a/internal/api/elaborate.go +++ b/internal/api/elaborate.go @@ -216,8 +216,12 @@ func (s *Server) handleElaborateTask(w http.ResponseWriter, r *http.Request) { workDir = input.ProjectDir } - // Append verbatim user input to RAW_NARRATIVE.md in the background (best effort). - go s.appendRawNarrative(workDir, input.Prompt) + // Append verbatim user input to RAW_NARRATIVE.md only when the user explicitly + // provided a project_dir — the narrative is per-project human input, not a + // server-level log. + if input.ProjectDir != "" { + go s.appendRawNarrative(workDir, input.Prompt) + } projectContext := readProjectContext(workDir) fullPrompt := input.Prompt -- cgit v1.2.3