Skip to content

Editor: Polish, Ask the editor, and chapters with your Omarchy agent - #42

Draft
ryanrhughes wants to merge 16 commits into
agent-integrationfrom
editor-ai
Draft

ryanrhughes wants to merge 16 commits into
agent-integrationfrom
editor-ai

Conversation

@ryanrhughes

Copy link
Copy Markdown
Contributor

Stacked on #36 (agent-integration). Merge after it.

Brings the agent workflow into the editor: no terminal needed. It uses the coding agent picked in Omarchy (omarchy-default-agent).

Features

  • Polish (top bar, Ctrl+Shift+P): the agent tightens the recording with the omareel skill: trims, idle cuts and pauses, zooms, and keystrokes where shortcuts matter. Then it checks contact sheets.
  • Ask the editor…: free-text requests ("cut everything before I open the terminal", "make it under 60 seconds").
  • Write description: chapters, a title and a description in chapters.json. Chapters are stored at source times and mapped onto the edited timeline. They show as flags on the ruler, and "Copy YouTube description" produces the description text. A new set-chapters apply op writes them; describe shows them.
  • The drawer streams the agent's messages, its commands, each apply (with the new length), the contact sheets it viewed, and the cost. Stop ends the run.
  • Each apply lands through the live reload as one undo step. During a run the timeline is read-only ("The agent is editing… Stop to edit"), so nothing is lost to reloads.
  • CLI: omareel agent BUNDLE polish|chapters|ask TEXT… prints the run as JSON lines.
  • apply also takes the operations JSON directly as an argument (Claude Code refuses heredocs under a Bash(omareel …) rule).

Consent and containment. The agent is treated as untrusted: on-screen text and speech can carry prompt injection.

  • Nothing runs without a click. The first Polish or shortcut for an agent only opens the drawer. The drawer names the agent and what goes to its provider (timeline, transcript, frames), with a Start button. Consent is remembered per agent in ~/.config/omareel/agent.json, and "Ask first" revokes it.

  • Scope enforced by omareel itself: the runner sets OMAREEL_AGENT_SCOPE. Inside it, only these run:

    • describe, apply and transcribe on this bundle;
    • frame -o into the run's own scratch directory;
    • help.

    Everything else exits 126: record, export, edit, skill, agent, other bundles, outputs elsewhere, and apply ops naming files outside the bundle. Paths are compared after resolving symlinks and ... Claude's allow rules are narrowed to the same subcommands, and it runs with --permission-mode dontAsk.

  • Codex (experimental): runs with --ignore-user-config --ignore-rules, which drops the user's MCP servers. Network, web search and extra writable roots are off. Reads aren't restricted, and the UI says so.

  • No markup: every UI text showing agent-, transcript- or bundle-supplied strings is plain text. A test proves an <img src=http://…> chapter title makes no request.

  • Process lifetime:

    • Each command gets PR_SET_PDEATHSIG, so it dies with the editor or CLI.
    • At every end of a run (normal, timeout, Stop), processes carrying the run's scope are killed.
    • The 30-minute timeout is checked on every loop.
    • Each run gets its own scratch directory.
  • Chapters are written atomically with apply: temp file, then project.json, then rename. They can't be undone, and the drawer says so.

Tested

  • cargo test -p omareel_core (335 + 58 + 3). Offscreen ctest including agent_fake, which runs the real binary's describe, apply and frame and every scope refusal against tests/tools/fake-agent.py.
  • Stream parsing from a recorded Claude run, plus Codex events. Chapter mapping across cuts, speeds and inserts. Process-group and parent-death tests.
  • One real run: Claude Code with Haiku on a 30 s synthetic bundle ran describe, apply, a contact sheet and an image read in 7.7 s for $0.0036. A second run told to ls / and read /etc/hostname was refused.
  • An independent security review found nine issues, all fixed with tests:
    • rich-text URL fetch;
    • the whole CLI was allowed;
    • Codex's MCP servers, network and reads were open;
    • consent came after the run started;
    • the project could be stale;
    • stray processes survived;
    • chapters weren't atomic with apply;
    • runs shared a scratch directory;
    • the timeout could be bypassed.

Not verified

  • A real Codex run.
  • That --ignore-user-config drops MCP servers in a real session.
  • The live desktop (offscreen only).
  • Tool commands already running when the editor is SIGKILLed can finish.
  • A process that clears its environment escapes the sweep.

For you to judge

  • Model and limits: the agent's default model is used (OMAREEL_AGENT_MODEL overrides it). The timeout is 30 minutes, and there is no spending cap.
  • Codex config: ignoring the user's Codex config also ignores their model and provider choice there.
  • Wallpaper background: inside the scope, setting background.image to a wallpaper outside the bundle is refused.

🤖 Generated with Claude Code

ryanrhughes and others added 8 commits November 12, 2026 16:44
A bundle's chapters, title and description live in chapters.json, each chapter at a source
time so later cuts, speed changes and inserts move it with the video. A chapter whose start
was cut begins where the recording picks up again; one cut away entirely gives way to the
next. Chapters::youtube_description makes the text to paste into YouTube: the first chapter at
00:00 and chapters under ten seconds left out.

omareel apply's set-chapters writes the file (at, title per chapter, in either timeline, plus
title and description), only once the whole run applied and project.json is saved; a dry run
writes nothing. describe lists the chapters with their output times.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Polish (Ctrl+Shift+P), "Ask the editor…" and Write description run the agent chosen in
Omarchy (~/.config/omarchy/defaults/agent) once, headless, in the bundle's directory, with the
omareel skill and an instruction. It edits through omareel apply, so each change lands in the
editor through the live reload as one undo step. A drawer over the side panel shows which
agent runs and that the timeline, transcript and frames go to its provider, before anything
runs; then its messages, commands, each apply, the frames it looked at, and the cost. Stop
kills the agent's process group and anything it started outside it. Chapters show as flags on
the ruler and copy as a YouTube description.

The runner is Qt-free (agent/runner.rs): an adapter per agent (Claude Code's stream-json with
--restricted, Bash limited to omareel and dontAsk; Codex's exec --json in its workspace-write
sandbox), a stream parser, and the run on transcript::job's process groups. Other agents get
a message saying which ones work. omareel agent BUNDLE polish|chapters|ask runs it from the
command line as JSON lines. apply takes the operations as its argument too, since Claude Code
refuses a heredoc under a Bash(omareel:*) rule.

Tests read a recorded Claude Code run and a refused command, Codex's events, a fake agent
(tests/tools/fake-agent.py, both streams) end to end in Rust and in ctest with the real
omareel, and Stop killing the group.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…areel

run_streaming went straight back to reading after each chunk, so a command that printed more
often than every 20 ms was never checked against its deadline or a cancel: an agent streaming
its events could run past the 30-minute limit. Every pass through the loop checks now.

Each command also gets PR_SET_PDEATHSIG (SIGKILL) before it starts, so it dies with the thread
that runs it, which waits for it, and with the editor or `omareel agent` when either is killed
(SIGKILL included), rather than running on with no timeout and nobody to stop it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Qt's Text and Label guess rich text by default, and rich text loads <img src=http://…> from the
network: a chapter title the agent wrote (from speech in the transcript, or text on screen)
made the editor fetch a URL of the agent's choosing. Every Text and Label that shows a string
from somewhere else now says Text.PlainText: chapter titles and descriptions, the agent's
messages, tooltips (chapter flags), captions and keystrokes, file and preset names, menus,
buttons and errors, in the editor, the launcher and the recording bar. Nothing in the app used
markup, so nothing else changes.

The test is in the next commits' test_editor case, which loads the drawer and a tooltip with an
<img> title and checks that no request is made and the markup shows as text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…at isn't

The agent reads content that can carry prompt injection (speech, text on screen), so it is
treated as untrusted.

Scope: Bash(omareel:*) allowed the whole CLI: export or frame -o anywhere, apply on another
bundle, record, skill install, nested agent runs. The runner now sets
OMAREEL_AGENT_SCOPE=<bundle>\n<scratch>, and omareel checks its own command line against it
first thing in main(), whichever omareel the agent finds (agent/scope.rs): only describe,
apply, frame -o into the scratch directory, and transcribe on that bundle, and help, run;
everything else is refused with a message and exit status 126. Paths are compared resolved
(symlinks, ..); frame refuses an output that is a symlink; apply reads an operations file only
from the bundle or scratch directory, and the files operations name (insert, music, a
background image set with set) must be there too. Claude's allow rules are narrowed to those
subcommands.

Codex: workspace-write still reads any file, and the person's config.toml kept their MCP
servers (a remote one here) and could turn network on. It runs with --ignore-user-config and
--ignore-rules now, and -c overrides for network access, writable roots and web search (a
mcp_servers={} override merges rather than clears, and naming a server after ignoring the
config fails, so MCP servers go with the config). The comments and USAGE now say what is
contained (writes, network) and what isn't (reads, its shell), and Codex is called
experimental (Adapter::experimental).

Processes: only Stop swept what left the agent's process group; a session leader survived a
normal end. Every end (finished, failed, timed out, stopped) now kills each process whose
environment carries the run's scope, which also finds daemons re-parented away from the agent
(PR_SET_CHILD_SUBREAPER would make the editor a parent of strangers' orphans it never reaps).
Runner::with_timeout tests the timeout.

Scratch: runs on one bundle shared a directory, and a second run removed the first's. Each run
gets its own (mkdtemp under ~/.cache/omareel/agent/), removed when its runner's next run starts
or the runner goes, so the drawer can still show the frames; a day-old one is cleaned up.

Chapters: set-chapters saved project.json first, so a chapters.json that couldn't be written
left the cuts saved and a retry applied them twice. chapters.json is written aside first (a
failure saves nothing), then project.json, then the chapters are moved into place.

Tests: each refusal (scope unit tests and the real binary in agent_fake), scoped apply, the
sweep after a normal end and a timeout (with a session leader and a daemon), unique scratch
directories, and a chapters.json that can't be written.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The previous commit staged them without their executable bits; agent_fake runs the fake agent
directly, so it needs them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Consent: the top bar's Polish and Ctrl+Shift+P started the agent on the first press, with the
disclosure appearing at the same moment or only in a tooltip. Now an agent the person hasn't
started before only opens the drawer: which agent runs, that it reads the timeline, the
transcript and frames of the video and sends them to its provider, a note for Codex that its
commands can read other files (experimental), and a Start button ("Start polishing"). Starting
remembers that agent (agent/consent.rs, ~/.config/omareel/agent.json), so later runs start
straight from the shortcut; the drawer's "Ask first" takes it back. AgentRunner refuses to
start an agent that wasn't allowed, whatever QML asks.

Stale project: the agent could start from a project.json older than what the editor showed.
The drawer saves (the project name too) before starting, and doesn't start if that fails.
While the agent runs, the editor is read-only (Editor.readOnly, Document::set_read_only): an
edit is undone as soon as it is made and leaves nothing to save, undo and redo do nothing,
and the agent's changes still come in through the reload. The timeline says "The agent is
editing… Stop to edit" with a Stop button; the side panel, edit shortcuts, split, insert,
crop, aspect, presets, undo, redo and renaming are off. All of it comes back when the run
ends or stops.

Undo: the drawer said each change is one undo step, but chapters.json isn't in the project's
history; it now says chapters and the description can't be undone.

Tests: test_editor loads the drawer and a tooltip with an <img src=http://…> title, message
and chapter (no request is made, all show as plain text; it fails with the request when a
Label lacks PlainText), the consent flow (Start runs and saves, the next Polish runs at once,
Ask first asks again), and Editor.readOnly; Rust tests for the read-only document and the
consent file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Until the agent is allowed, the drawer's Polish is bordered like Write description, so Start
is the one accent button.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ryanrhughes and others added 8 commits November 13, 2026 11:18
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…y config; YouTube limits

Fixes from the 0.6 review of #42:

- Inside an agent's scope, apply treated any new string naming an existing path as a file, so
  a label or caption saying "/usr/bin" was refused, while a file:// URL got through unresolved.
  It now checks the project's file fields (background image and wallpaper, inserted videos,
  music), with file:// URLs decoded.
- When agent.json couldn't be written, consent held "for this window" only until Start re-read
  the file and took it back, so Start always refused. The window keeps it now.
- Chapter titles and the YouTube title are capped at 100 characters and the description at
  5000, YouTube's limits, since they go to the clipboard as a description.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	CMakeLists.txt
#	crates/omareel_core/src/agent/apply.rs
#	crates/omareel_core/src/transcript/job.rs
#	src/ui/qml/ExportDialog.qml
… kept in the bundle

Merges #31's fix (a refused apply removes only its own copies; Applied carries them).

Found by the 0.6 adversarial review of #42: inside an agent's scope a background image in the
scratch directory was allowed, but the runner removes that directory when the run ends,
leaving the project pointing at nothing. apply copies such an image into media/ and points
the project there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant