From 0edd7235cd861ef77d4ceb37a594ae65df52624b Mon Sep 17 00:00:00 2001
From: Clawd <ai@clawd.bot>
Date: Sat, 28 Feb 2026 15:35:00 -0800
Subject: Add session-specific artifacts, CLAUDE.md, and git worktree support

- Store artifacts in .claude-flow/sessions/{sessionId}/
- Each session now has isolated research.md and plan.md
- Concurrent sessions no longer conflict
- Add CLAUDE.md support for shared codebase documentation
- Add git worktree creation on session start
- Add git commit/status IPC handlers
- Update all artifact APIs to be session-specific
- Remove artifact clearing on new session (no longer needed)
---
 renderer/src/App.tsx | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

(limited to 'renderer/src/App.tsx')

diff --git a/renderer/src/App.tsx b/renderer/src/App.tsx
index 966b15c..c56f292 100644
--- a/renderer/src/App.tsx
+++ b/renderer/src/App.tsx
@@ -92,10 +92,10 @@ export function App() {
       // Load messages
       api.listMessages(selectedSession.id).then(setMessages);
 
-      // Load artifact
+      // Load session-specific artifact
       const filename =
         selectedSession.phase === "research" ? "research.md" : "plan.md";
-      api.readArtifact(selectedProject.path, filename).then((content) => {
+      api.readSessionArtifact(selectedProject.path, selectedSession.id, filename).then((content) => {
         const text = content || "";
         setDocumentContent(text);
         setOriginalContent(text);
@@ -122,10 +122,10 @@ export function App() {
           });
         }
         // Reload artifact after Claude updates it
-        if (selectedProject) {
+        if (selectedProject && selectedSession) {
           const filename =
             selectedSession.phase === "research" ? "research.md" : "plan.md";
-          api.readArtifact(selectedProject.path, filename).then((content) => {
+          api.readSessionArtifact(selectedProject.path, selectedSession.id, filename).then((content) => {
             const text = content || "";
             setDocumentContent(text);
             setOriginalContent(text);
@@ -193,10 +193,10 @@ export function App() {
     if (!selectedSession || !selectedProject) return;
     setError(null);
     try {
-      // Save user edits first
+      // Save user edits first (session-specific)
       const filename =
         selectedSession.phase === "research" ? "research.md" : "plan.md";
-      await api.writeArtifact(selectedProject.path, filename, documentContent);
+      await api.writeSessionArtifact(selectedProject.path, selectedSession.id, filename, documentContent);
       setOriginalContent(documentContent);
       setIsLoading(true);
       await api.triggerReview(selectedSession.id);
@@ -210,10 +210,10 @@ export function App() {
     if (!selectedSession || !selectedProject) return;
     setError(null);
     try {
-      // Save any pending edits
+      // Save any pending edits (session-specific)
       const filename =
         selectedSession.phase === "research" ? "research.md" : "plan.md";
-      await api.writeArtifact(selectedProject.path, filename, documentContent);
+      await api.writeSessionArtifact(selectedProject.path, selectedSession.id, filename, documentContent);
 
       const nextPhase = await api.advancePhase(selectedSession.id);
       if (nextPhase) {
@@ -250,9 +250,7 @@ export function App() {
     setMessages([]);
     setDocumentContent("");
     setOriginalContent("");
-    // Clear artifacts from previous sessions
-    await api.writeArtifact(selectedProject.path, "research.md", "");
-    await api.writeArtifact(selectedProject.path, "plan.md", "");
+    // Note: Each session has its own artifact directory, no need to clear
   };
 
   const handleDeleteProject = async (id: string) => {
-- 
cgit v1.2.3

