Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
feat(chat): a home for chats started without picking a folder
rubenluetke10-beep44c53f955f31
diff --git a/jarvis/agentic_ide/library.py b/jarvis/agentic_ide/library.pyindex e3aaeb0f50..d1eeaf48cc 100644--- a/jarvis/agentic_ide/library.py+++ b/jarvis/agentic_ide/library.py@@ -95,6 +95,13 @@ class Project:archived: bool = Falsecreated_at: float = 0.0last_opened_at: float = 0.0+ #: Is this the holder for chats started WITHOUT choosing a folder?+ #:+ #: There is exactly one of these per install (see :func:`ensure_scratch`).+ #: A coding agent always runs somewhere, so it still has a path — the home+ #: directory — but it is not a project somebody picked, and the sidebar+ #: lists its chats on their own rather than among the real projects.+ scratch: bool = Falsedef to_dict(self) -> dict[str, Any]:return asdict(self)@@ -254,6 +261,10 @@ def _load_projects() -> list[Project]:archived=bool(item.get("archived")),created_at=float(item.get("created_at") or 0.0),last_opened_at=float(item.get("last_opened_at") or 0.0),+ # Absent in every file written before scratch existed, which+ # reads as False — the correct answer for a folder somebody+ # opened on purpose.+ scratch=bool(item.get("scratch")),))return out@@ -321,6 +332,58 @@ def ensure_project(path: str | Path, *, name: str | None = None) -> Project:return created+#: What the one project-less holder is called on screen. English because every+#: artifact is (CLAUDE.md §1); it is a name, not a translated label.+SCRATCH_NAME = "Sessions"+++def scratch_root() -> Path:+ """Where a chat with no chosen folder runs.++ The home directory, because a coding agent always runs SOMEWHERE and this+ is the one folder that exists on every account, on every OS, without asking+ anybody anything. Deliberately not the repo, a temp directory, or the+ process's current folder: the first is not the user's, the second is+ erased under running agents, and the third is wherever the app happened to+ be started from.+ """+ return Path.home()+++def ensure_scratch() -> Project:+ """The single holder for chats started without choosing a folder.++ Idempotent like :func:`ensure_project` and derived the same way, so it+ survives a lost store. Existing rows are upgraded in place rather than+ duplicated: an install that opened its home folder as a normal project+ before this existed keeps that project and simply gains the flag.+ """+ resolved = str(scratch_root())+ pid = project_id_for(resolved)+ now = time.time()+ with _WRITE_LOCK:+ projects = _load_projects()+ for project in projects:+ if project.id == pid:+ project.last_opened_at = now+ if not project.scratch:+ project.scratch = True+ project.name = SCRATCH_NAME+ _save_projects(projects)+ return project+ created = Project(+ id=pid,+ path=resolved,+ name=SCRATCH_NAME,+ created_at=now,+ last_opened_at=now,+ scratch=True,+ )+ projects.append(created)+ _save_projects(projects)+ return created++def update_project(project_id: str,*,diff --git a/jarvis/ui/web/chat_library_routes.py b/jarvis/ui/web/chat_library_routes.pyindex 059eef52b4..f6c104acd1 100644--- a/jarvis/ui/web/chat_library_routes.py+++ b/jarvis/ui/web/chat_library_routes.py@@ -63,6 +63,9 @@ class ProjectOut(BaseModel):#: Is the folder reachable on this machine right now? Reported, never acted#: on — see the module docstring.exists: bool = True+ #: Is this the holder for chats started without choosing a folder? There is+ #: at most one, and the sidebar lists its chats apart from the projects.+ scratch: bool = False#: How many live chats it holds. The COUNT travels with the list; the chats#: themselves do not.chats: int = 0@@ -201,6 +204,22 @@ def open_project(body: OpenProjectIn) -> ProjectOut:return _project_out(project)+ "/projects/scratch",+ response_model=ProjectOut,+ summary="The holder for chats started without a folder",+)+def open_scratch() -> ProjectOut:+ """Idempotent: there is exactly one of these, and this is how it is reached.++ A chat still needs somewhere to run — a coding CLI is a process with a+ working directory — so this returns a real project rooted at the home+ folder. What makes it different is only that nobody picked it, which is why+ the sidebar lists its chats on their own instead of among the projects.+ """+ return _project_out(library.ensure_scratch())++@router.patch("/projects/{project_id}", response_model=ProjectOut, summary="Rename, pin or archive a project")diff --git a/jarvis/ui/web/frontend/src/lib/chatLibraryApi.ts b/jarvis/ui/web/frontend/src/lib/chatLibraryApi.tsindex 87b93eb3ec..21a4f60b4f 100644--- a/jarvis/ui/web/frontend/src/lib/chatLibraryApi.ts+++ b/jarvis/ui/web/frontend/src/lib/chatLibraryApi.ts@@ -25,6 +25,13 @@ export interface ChatProject {exists: boolean;/** How many live chats it holds. The count travels; the chats do not. */chats: number;+ /**+ * Is this the holder for chats started without picking a folder?+ *+ * At most one per install. Its chats are listed on their own rather than+ * among the projects, because nobody chose the folder they run in.+ */+ scratch: boolean;}export interface ChatRow {@@ -101,6 +108,16 @@ export async function openProject(path: string, name?: string): Promise<ChatProj});}+/**+ * The one holder for chats that were started without choosing a folder.+ *+ * Idempotent, so the caller does not have to know whether it exists yet: the+ * "new session" button asks for it every time and gets the same project back.+ */+export async function openScratchProject(): Promise<ChatProject> {+ return request<ChatProject>("/projects/scratch", { method: "POST" });+}+export async function patchProject(projectId: string,changes: Partial<Pick<ChatProject, "name" | "color" | "pinned" | "archived">>,