Workspaces live on disk under the SDK's data directory. ragListWorkspaces() reads them back so we can see what's there. ragCloseWorkspace({ workspace, deleteOnClose }) tears one down.
The list comes back as an array of { name, open } objects, where the open flag tells us if the workspace is still loaded or already torn down. The loop prints one line per workspace:
for (const ws of workspaces) {
console.log(`▸ ${ws.name} (${ws.open ? "open" : "closed"})`);
}Closing a workspace is a single call. deleteOnClose: true drops the in-memory handle and wipes the on-disk folder. The call itself only needs the workspace name:
await ragCloseWorkspace({ workspace: "tech", deleteOnClose: true });If we pass deleteOnClose: false, the workspace files stay on disk but the in-memory handle is dropped. A workspace auto-closes when the process exits, so this call is for explicit cleanup during long-running sessions.
Note:
deleteOnCloseis the right name for "remove from disk." Passingfalseis the right call when you want to keep the data but release the in-memory handle.
ragListWorkspaces() call. Loop through and log each workspace's name and open status.ragCloseWorkspace({ workspace, deleteOnClose: true }) to remove the workspace from disk.$ Run your code to see results
$