1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
|
# Video transcript tool: design
Date: 2026-11-17. Status: proposed.
## Goal
Ask the assistant to transcribe a video, local or a public URL (YouTube,
social media, any page yt-dlp can read), and get the transcript as a
Markdown file in the assistant's output folder. The model sees the start
and the path; to summarize or question the whole text, the user attaches
the file.
Two parts: an output folder setting shared by the daemon, its tools and
the canvas, then the tool itself.
## Part 1: output folder setting
Today the canvas alone decides where written files go:
`$(xdg-user-dir DOCUMENTS)/Assistant`, falling back to
`~/Documents/Assistant` (`quickshell/desktop/assistant/Assistant.qml`).
Tools cannot see it.
### Daemon (`assistant.py`)
- `DEFAULTS["out_dir"] = ""`. Empty means `xdg-user-dir DOCUMENTS` +
`/Assistant`, and `~/Documents/Assistant` when that answers `$HOME`
(no documents folder set), the canvas's current rule. A set value must
be absolute, `~` expanded; anything else is refused at load like other
bad config values.
- Resolved once at startup into `CFG["out_dir"]`. Not created until
something writes there.
- `run_tool` adds `ASSISTANT_DIR=<out_dir>` to every tool's environment,
next to `CFG["env"]`.
- `hello` carries `out_dir`.
### Keystone (quickshell repo)
- `desktop/modules/assistant/AssistantPage.qml`: an "Output folder" text
field, `setKey("out_dir", quoted path)`, `null` when cleared. The
placeholder shows the XDG default. Applied at the daemon's next
restart, like every config key.
- `desktop/assistant/Assistant.qml`: `outDir` comes from `hello`; the
`xdg-user-dir` Process goes. One rule, in the daemon.
### Check
`--test`: default resolution, a configured value, a relative value
refused, `ASSISTANT_DIR` reaching a tool, `out_dir` in `hello`.
## Part 2: the tool
`examples/tools/video.toml` and `examples/tools/video.sh`, installed to
`~/.config/desktop-assistant/tools/`.
```toml
description = "Transcribe the speech in a video, a local file or a public URL (YouTube, social media, web pages). Writes the full transcript to a Markdown file and opens it. Returns the file's path and the start of the text only: you have NOT read the whole transcript, so to summarize or answer questions about it, ask the user to attach the file. Videos over 20 minutes are refused until the user agrees: tell them the length and that it takes a few minutes, then call again with long=1."
command = ["video.sh", "{source}", "{long}"]
cloud = ["hetzner"]
timeout = 1800
[params.source]
type = "string"
description = "Absolute path of a local video, from its file block or the user's words, or an http(s) URL."
[params.long]
type = "string"
description = "1 only after the user agreed to transcribe a video over 20 minutes; empty otherwise."
```
### Flow
1. **Source.** An absolute existing path is local; `http://` or
`https://` is a URL; anything else is an error. URLs are passed to
yt-dlp as one argv element after `--`, never to a shell.
2. **Length and title.** Local: `ffprobe` duration, title is the file
name. URL: `yt-dlp --print duration --print title --no-playlist`.
Over 20 minutes without `long=1`: print `long: <title>, <mm:ss>.
Ask the user before transcribing.` and exit 0, nothing written.
A source with no audio stream is an error.
3. **Subtitles first (URL only).** `yt-dlp --write-subs --sub-langs
'it.*,en.*' --sub-format vtt --skip-download`: if the uploader
provided subtitles, their text (cue timings and markup stripped) is
the transcript, in seconds. Auto-generated subtitles are not used:
their rolling cues repeat every line, and whisper turbo is better.
4. **Audio.** URL: `yt-dlp -f bestaudio --no-playlist -o` into a fresh
`mktemp -d` under `$XDG_RUNTIME_DIR`, removed on exit (trap). Local:
the file itself.
5. **Transcribe.** `whisper-cli -m
/data/voice-models/whisper/ggml-large-v3-turbo-q5_0.bin -ng -t 8 -l auto
-np -otxt -of <tmp>/t -f <audio>`. whisper reads through ffmpeg, so
any container works; beam 5 is its default.
- **CPU, no GPU** (`-ng`): no VRAM, so it can never push the loaded
model out of the Arc or fail beside it. Measured 2026-11-17 on the
9700X: a 120 s clip in 13.2 s wall (about 0.11x real time, so ~7 min
for an hour), ~1 GB RSS; a 10 s clip 10.6 s, mostly model load.
8 threads beat 16 (11.98 s on the 10 s clip).
- Not the daemon's Gemma `input_audio` path: capped at 60 s by the
ubatch, so long audio needs cutting at silences, which can still
drift language between pieces; it needs an audio-capable model
loaded and holds llama-server for the whole run.
6. **Write.** `$ASSISTANT_DIR/<slug>.md`, slug from the title (lowercase,
`[a-z0-9-]`, 60 chars max), `-2`, `-3`... if taken. Content:
```markdown
# <title>
Source: <path or URL>
Duration: <mm:ss>. Transcribed <date> with <whisper large-v3-turbo | uploader subtitles>.
<text, one paragraph per whisper segment line>
```
Opened with `xdg-open`, detached.
7. **Output.** Path line first, so `run_tool`'s 2000-character cap can
never cut it:
```
transcript: <path> (<N> words, <mm:ss>, <source of text>)
start, not the whole text:
<first ~1500 characters>
```
### Errors
One line, nothing written: bad source, private or unavailable video
(yt-dlp's last stderr line), no audio stream, whisper failure,
unwritable output folder. Login-only videos are not supported: no
cookies are passed.
### Daemon change: video attachments
`kind_of` returns `video` for `video/*` MIME types. `attach()` adds only
`--- video: <name> (<abs path>) ---`, like an image block without the
image: the model gets the path for the tool, nothing else. Chip kind
`video`; the canvas shows an unknown kind as a plain file chip (to check).
### Check
`video.sh --test`, like `test-clone.sh`: a generated 5 s clip (`ffmpeg
-f lavfi` sine plus `flite` or a stored speech sample from outside the
repo) as mp4 and mkv; a source with no audio; a relative path; the
20-minute refusal on a fake duration; slug collisions; the output
starting with the path line. URL steps against a `file://` source are
not possible with yt-dlp's generic extractor rules, so they are covered
by the live check only.
### Live check
Through a second daemon on a scratch socket, config and data dir, Gemma:
- A local video, it and en, "trascrivi questo video" with the file
attached and with the path typed.
- A YouTube video with uploader subtitles, one without, one over 20
minutes (refused, asked, then done).
- A public video from one social site.
- Then attach the written file and ask for a summary.
- Measure: wall time per minute of a real single-language video on the
CPU (the 120 s measurement was a repeated it/en sample, whose last
30 s window came out garbled from the mixed languages).
## Not doing
- Raising the 2000-character tool cap: the attach step covers it. Add a
per-tool `limit` key if the two steps get tedious.
- Auto-generated subtitles, cookies for login-only videos, playlists,
timestamps in the transcript, translation.
- Updating yt-dlp: packaging, `my-slackbuilds`.
|