Skip to content

Desktop app that records your on-screen work session and uses the GitHub Copilot SDK to reconstruct it as an intent + ordered steps, then builds a reusable Skill or Automation for Microsoft Autopilots like Scout, Microsoft Copilot Cowork, or Copilot Studio.

Add: delete a recording from the library

adilei99661e04a427
diff --git a/common/ipc.ts b/common/ipc.ts
index b075d39..ffe6950 100644
--- a/common/ipc.ts
+++ b/common/ipc.ts
@@ -84,6 +84,11 @@ export interface MarkerResult {
error?: string;
}
+export interface DeleteSessionResult {
+ ok: boolean;
+ error?: string;
+}
+
export interface FfmpegInfo {
ok: boolean;
path: string | null;
@@ -129,6 +134,7 @@ export const IPC = {
cancelAnalysis: "analyze:cancel",
analyzeProgress: "analyze:progress",
listSessions: "sessions:list",
+ deleteSession: "sessions:delete",
openLibrary: "ui:open-library",
closeLibrary: "ui:close-library",
} as const;
@@ -159,6 +165,8 @@ export interface SkillRecorderApi {
onAnalyzeProgress(cb: (progress: AnalyzeProgress) => void): () => void;
/** All saved recordings, newest first, for the sessions library. */
listSessions(): Promise<SessionSummary[]>;
+ /** Permanently delete a saved recording and all its artifacts from disk. */
+ deleteSession(sessionId: string): Promise<DeleteSessionResult>;
/** Open (and focus) the Sessions library window, docked to the recorder. */
openLibrary(): Promise<void>;
/** Close the Sessions library window from within it. */
diff --git a/electron/describer/describer.ts b/electron/describer/describer.ts
index 627a79d..32fbeab 100644
--- a/electron/describer/describer.ts
+++ b/electron/describer/describer.ts
@@ -151,6 +151,19 @@ export class Describer {
if (live) await live.copilot.abort().catch(() => undefined);
}
+ /** True while an analyze/feedback turn is actively running for this session. */
+ isAnalyzing(sessionId: string): boolean {
+ return this.active.has(sessionId);
+ }
+
+ /**
+ * Drop any live agent conversation held for a session and forget it. Called
+ * before the session's files are deleted so no agent keeps its directory open.
+ */
+ async forget(sessionId: string): Promise<void> {
+ await this.disposeLive(sessionId);
+ }
+
/**
* Disconnect live sessions that aren't currently running — called when the
* library window closes, so idle agent conversations don't linger. The active
diff --git a/electron/ipc.ts b/electron/ipc.ts
index fe5faae..2a39e6f 100644
--- a/electron/ipc.ts
+++ b/electron/ipc.ts
@@ -2,14 +2,20 @@ import { ipcMain } from "electron";
import path from "node:path";
import { type CaptureConfig, type CaptureLevel, levelForConfig } from "../common/config";
-import type { AnalysisEditInput, AnalysisFeedbackInput, AnalyzeResult, CaptureState } from "../common/ipc";
+import type {
+ AnalysisEditInput,
+ AnalysisFeedbackInput,
+ AnalyzeResult,
+ CaptureState,
+ DeleteSessionResult,
+} from "../common/ipc";
import { IPC } from "../common/ipc";
import { Describer, loadPersistedAnalysis } from "./describer/describer";
import { runDoctor } from "./doctor";
import { createLogger } from "./logger";
import type { RecorderController } from "./recorder/controller";
import { isValidSessionId } from "./recorder/session-store";
-import { listSessions } from "./sessions";
+import { deleteSession, listSessions } from "./sessions";
import type { SettingsStore } from "./settings";
const log = createLogger("IPC");
@@ -115,5 +121,25 @@ export function registerIpc(
});
ipcMain.handle(IPC.listSessions, () => listSessions());
+
+ ipcMain.handle(IPC.deleteSession, async (_event, sessionId: string): Promise<DeleteSessionResult> => {
+ if (!isValidSessionId(sessionId)) return { ok: false, error: "Unknown session." };
+ if (recorder.status().sessionId === sessionId) {
+ return { ok: false, error: "You can't delete a recording while it's still in progress." };
+ }
+ if (describer.isAnalyzing(sessionId)) {
+ return { ok: false, error: "This recording is being analyzed. Cancel that first, then delete." };
+ }
+ try {
+ await describer.forget(sessionId); // release any idle agent holding the folder
+ await deleteSession(sessionId);
+ recorder.forgetSession(sessionId); // clear the "last completed" pointer if it was this one
+ return { ok: true };
+ } catch (err) {
+ const error = err instanceof Error ? err.message : String(err);
+ log.warn("delete failed:", error);
+ return { ok: false, error };
+ }
+ });
}
diff --git a/electron/preload.cjs b/electron/preload.cjs
index b2a0674..5f6c3f4 100644
--- a/electron/preload.cjs
+++ b/electron/preload.cjs
@@ -20,6 +20,7 @@ const IPC = {
cancelAnalysis: "analyze:cancel",
analyzeProgress: "analyze:progress",
listSessions: "sessions:list",
+ deleteSession: "sessions:delete",
openLibrary: "ui:open-library",
closeLibrary: "ui:close-library",
};
@@ -50,6 +51,7 @@ contextBridge.exposeInMainWorld("skillRecorder", {
return () => ipcRenderer.removeListener(IPC.analyzeProgress, listener);
},
listSessions: () => ipcRenderer.invoke(IPC.listSessions),
+ deleteSession: (sessionId) => ipcRenderer.invoke(IPC.deleteSession, sessionId),
openLibrary: () => ipcRenderer.invoke(IPC.openLibrary),
closeLibrary: () => ipcRenderer.invoke(IPC.closeLibrary),
});
diff --git a/electron/recorder/controller.ts b/electron/recorder/controller.ts
index c4f79b8..212cb91 100644
--- a/electron/recorder/controller.ts
+++ b/electron/recorder/controller.ts
@@ -72,6 +72,18 @@ export class RecorderController {
return this.lastCompleted?.dir ?? null;
}
+ /**
+ * Forget a session if it's the one being tracked as "last completed" — called
+ * after a session is deleted, so status()/analyze no longer point at a dir that
+ * no longer exists. No-op for any other id.
+ */
+ forgetSession(id: string): void {
+ if (this.lastCompleted?.id !== id) return;
+ this.lastCompleted = null;
+ this.lastProcessed = false;
+ this.emit();
+ }
+
status(): RecorderStatus {
return {
state: this.state,
diff --git a/electron/sessions.ts b/electron/sessions.ts
index fcad138..cd2615c 100644
--- a/electron/sessions.ts
+++ b/electron/sessions.ts
@@ -1,10 +1,10 @@
-import { access, readdir, readFile, stat } from "node:fs/promises";
+import { access, readdir, readFile, rm, stat } from "node:fs/promises";
import path from "node:path";
import { AnalysisSchema, type Analysis } from "../common/analysis";
import type { SessionSummary } from "../common/ipc";
import type { SessionMeta } from "../common/types";
-import { isValidSessionId, sessionsRoot } from "./recorder/session-store";
+import { isValidSessionId, sessionDir, sessionsRoot } from "./recorder/session-store";
/** True when `file` exists (non-throwing `fs.access`). */
async function exists(file: string): Promise<boolean> {
@@ -87,3 +87,14 @@ export async function listSessions(): Promise<SessionSummary[]> {
out.sort((a, b) => (b.startedAt ?? 0) - (a.startedAt ?? 0));
return out;
}
+
+/**
+ * Permanently remove a saved recording and every artifact under its directory
+ * (events, video, frames, analysis). The id is validated via {@link sessionDir},
+ * which throws on any unsafe segment, so this can never escape the sessions root.
+ * `force` makes an already-missing session a no-op rather than an error.
+ */
+export async function deleteSession(id: string): Promise<void> {
+ const dir = sessionDir(id); // throws on traversal / invalid id
+ await rm(dir, { recursive: true, force: true });
+}
diff --git a/src/App.css b/src/App.css
index 75d2136..4b3fcdc 100644
--- a/src/App.css
+++ b/src/App.css
@@ -691,6 +691,100 @@ button:focus-visible,
color: var(--faint);
}
+/* Per-row delete: a quiet trash affordance revealed on hover/focus, plus an
+ inline confirm that swaps in so deletion always takes a deliberate second tap. */
+.sess-row {
+ position: relative;
+}
+
+.sess-del {
+ position: absolute;
+ right: 7px;
+ bottom: 7px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 26px;
+ height: 26px;
+ padding: 0;
+ border-radius: 7px;
+ background: transparent;
+ color: var(--faint);
+ opacity: 0;
+ transition: opacity 0.12s ease, background 0.12s ease, color 0.12s ease;
+}
+
+.sess-row:hover .sess-del,
+.sess-del:focus-visible {
+ opacity: 1;
+}
+
+.sess-del:hover {
+ background: rgba(var(--rec-rgb), 0.12);
+ color: var(--rec);
+}
+
+.sess-confirm {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 8px;
+ background: var(--surface);
+ border: 1px solid var(--signal);
+ border-radius: 10px;
+ padding: 9px 11px;
+}
+
+.sess-confirm-text {
+ display: flex;
+ flex-direction: column;
+ gap: 1px;
+ min-width: 0;
+}
+
+.sess-confirm-title {
+ font-size: 12.5px;
+ font-weight: 600;
+ color: var(--text);
+}
+
+.sess-confirm-sub {
+ font-size: 11px;
+ color: var(--muted);
+}
+
+.sess-confirm-actions {
+ display: flex;
+ align-items: center;
+ gap: 4px;
+ flex: none;
+}
+
+.danger {
+ background: var(--rec);
+ color: var(--brand-fg);
+ font-size: 12px;
+ font-weight: 600;
+ padding: 6px 12px;
+}
+
+.danger:not(:disabled):hover {
+ background: hsl(6, 82%, 43%);
+}
+
+.sess-notice {
+ display: block;
+ width: calc(100% - 24px);
+ margin: 0 12px 8px;
+ padding: 8px 10px;
+ text-align: left;
+ font-size: 11.5px;
+ line-height: 1.35;
+ color: var(--brand-ink);
+ background: var(--signal-dim);
+ border-radius: 8px;
+}
+
.lib-detail {
flex: 1;
min-width: 0;
diff --git a/src/Library.tsx b/src/Library.tsx
index fa53c1d..e731f17 100644
--- a/src/Library.tsx
+++ b/src/Library.tsx
@@ -8,6 +8,7 @@ export function Library() {
const [sessions, setSessions] = useState<SessionSummary[]>([]);
const [selectedId, setSelectedId] = useState<string | null>(null);
const [loaded, setLoaded] = useState(false);
+ const [notice, setNotice] = useState<string | null>(null);
const loadSessions = useCallback(async () => {
const list = await window.skillRecorder.listSessions();
@@ -23,6 +24,25 @@ export function Library() {
});
}, [loadSessions]);
+ const deleteSession = useCallback(async (id: string) => {
+ setNotice(null);
+ const res = await window.skillRecorder.deleteSession(id);
+ if (!res.ok) {
+ setNotice(res.error ?? "Could not delete this recording.");
+ return;
+ }
+ setSessions((prev) => {
+ const idx = prev.findIndex((s) => s.id === id);
+ const next = prev.filter((s) => s.id !== id);
+ setSelectedId((cur) => {
+ if (cur !== id) return cur;
+ if (next.length === 0) return null;
+ return (next[idx] ?? next[next.length - 1]).id;
+ });
+ return next;
+ });
+ }, []);
+
const selected = sessions.find((s) => s.id === selectedId) ?? null;
return (
@@ -32,12 +52,18 @@ export function Library() {
<span className="eyebrow">Sessions</span>
<span className="pill">{sessions.length}</span>
</div>
+ {notice && (
+ <button className="sess-notice" onClick={() => setNotice(null)} title="Dismiss">
+ {notice}
+ </button>
+ )}
<div className="lib-list-scroll">
<SessionsList
sessions={sessions}
loaded={loaded}
selectedId={selectedId}
onSelect={setSelectedId}
+ onDelete={deleteSession}
/>
</div>
</aside>
@@ -62,44 +88,91 @@ function SessionsList({
loaded,
selectedId,
onSelect,
+ onDelete,
}: {
sessions: SessionSummary[];
loaded: boolean;
selectedId: string | null;
onSelect: (id: string) => void;
+ onDelete: (id: string) => void | Promise<void>;
}) {
+ const [confirmId, setConfirmId] = useState<string | null>(null);
+
if (sessions.length === 0) {
return <p className="sessions-empty">{loaded ? "No recordings yet." : "Loading…"}</p>;
}
return (
<ul className="sess-list">
- {sessions.map((s) => (
- <li key={s.id}>
- <button
- className={`sess ${s.id === selectedId ? "on" : ""}`}
- onClick={() => onSelect(s.id)}
- >
- <div className="sess-top">
- <span className="sess-when">{formatWhen(s.startedAt)}</span>
- {s.analysis?.approved ? (
- <span className="tag ok">approved</span>
- ) : s.analysis ? (
- <span className="tag an">analyzed</span>
- ) : !s.processed ? (
- <span className="tag warn">processing</span>
- ) : null}
- </div>
- <div className="sess-intent">
- {s.analysis?.title?.trim() || s.analysis?.intent || "Not analyzed yet"}
+ {sessions.map((s) =>
+ confirmId === s.id ? (
+ <li key={s.id}>
+ <div className="sess-confirm" role="alertdialog" aria-label="Confirm delete">
+ <div className="sess-confirm-text">
+ <span className="sess-confirm-title">Delete this recording?</span>
+ <span className="sess-confirm-sub">This cannot be undone.</span>
+ </div>
+ <div className="sess-confirm-actions">
+ <button className="linky" onClick={() => setConfirmId(null)}>
+ Cancel
+ </button>
+ <button
+ className="danger"
+ onClick={() => {
+ setConfirmId(null);
+ void onDelete(s.id);
+ }}
+ >
+ Delete
+ </button>
+ </div>
</div>
- <div className="sess-sub">
- {s.durationMs != null && <span>{formatDur(s.durationMs)}</span>}
- {s.analysis && <span>{s.analysis.stepCount} steps</span>}
- {s.hasVideo && <span>video</span>}
+ </li>
+ ) : (
+ <li key={s.id}>
+ <div className="sess-row">
+ <button
+ className={`sess ${s.id === selectedId ? "on" : ""}`}
+ onClick={() => onSelect(s.id)}
+ >
+ <div className="sess-top">
+ <span className="sess-when">{formatWhen(s.startedAt)}</span>
+ {s.analysis?.approved ? (
+ <span className="tag ok">approved</span>
+ ) : s.analysis ? (
+ <span className="tag an">analyzed</span>
+ ) : !s.processed ? (
+ <span className="tag warn">processing</span>
+ ) : null}
+ </div>
+ <div className="sess-intent">
+ {s.analysis?.title?.trim() || s.analysis?.intent || "Not analyzed yet"}
+ </div>
+ <div className="sess-sub">
+ {s.durationMs != null && <span>{formatDur(s.durationMs)}</span>}
+ {s.analysis && <span>{s.analysis.stepCount} steps</span>}
+ {s.hasVideo && <span>video</span>}
+ </div>
+ </button>
+ <button
+ className="sess-del"
+ aria-label={`Delete recording from ${formatWhen(s.startedAt)}`}
+ title="Delete recording"
+ onClick={() => setConfirmId(s.id)}
+ >
+ <svg width="15" height="15" viewBox="0 0 16 16" fill="none" aria-hidden>
+ <path
+ d="M3 4.5h10M6.4 4.5V3.3c0-.44.36-.8.8-.8h1.6c.44 0 .8.36.8.8v1.2M4.7 4.5l.5 8.2c.02.42.37.75.8.75h4c.42 0 .77-.33.8-.75l.5-8.2"
+ stroke="currentColor"
+ strokeWidth="1.2"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ />
+ </svg>
+ </button>
</div>
- </button>
- </li>
- ))}
+ </li>
+ ),
+ )}
</ul>
);
}