DEV Community

MartinDelophy
MartinDelophy

Posted on

Building a Safe Video-Editing Agent for DeepSeek Harness

Large language models can explain how a video should be edited. But safely editing a real project is a different problem.

If you ask an agent to “convert this project to 9:16, keep the captions, save a copy, and render an MP4,” the hard part is not understanding the sentence. The hard part is making sure the agent:

  • selects the correct project, track, and clips;
  • does not overwrite the original;
  • does not execute the same operation twice after a retry;
  • does not write from a stale project revision;
  • cannot read or write outside the approved workspace;
  • and verifies that the rendered video actually exists and is valid.

To explore this problem, I built and open-sourced dsh-timeline-studio-plugin, a community plugin that connects DeepSeek Harness to Timeline Studio’s deterministic .timeline command layer.

This is a community integration for Timeline Studio. It is not part of DeepSeek Harness core and is not an official DeepSeek project.

From a natural-language request to an editable Timeline Studio project

What the plugin does

The plugin is not another video editor UI. It is an automation bridge between an agent and the editor.

Timeline Studio remains responsible for the visual timeline, media processing, browser-local AI features, preview, and the final creative experience. dsh-timeline-studio-plugin exposes a small, deterministic tool surface that DeepSeek Harness can call.

The workflow looks like this:

Natural-language request
  ↓
DeepSeek Harness
  ↓
Read-only project inspection
  ↓
Structured edit plan
  ↓
Semantic diff
  ↓
Transactional apply to a new .timeline project
  ↓
Render and validate MP4
Enter fullscreen mode Exit fullscreen mode

The model decides what should happen. The command layer decides whether that operation is allowed and valid for the current project state.

What the user sees

The user first adds a local workspace containing a .timeline project and its media assets.

DeepSeek Harness workspace screen

A safe first prompt is deliberately read-only:

Inspect the Timeline Studio project in this workspace. Tell me its duration, aspect ratio, tracks, and media. Do not modify any files yet.

After reviewing the result, the user can continue with an editing request:

Change the project to 9:16. Show me the planned diff first. If it is valid, save it as a new project without overwriting the original, then render an MP4.

The plugin has no separate visual panel. Its work appears in Harness tool calls and in the resulting .timeline and MP4 files. Rich visual inspection and manual refinement still happen in Timeline Studio.

Seven tools, three responsibilities

The first version exposes seven model tools:

Tool Responsibility
timeline_studio_project_inspect Inspect revision, duration, ratio, tracks, media inventory, and warnings
timeline_studio_track_inspect List clips on a track in timeline order
timeline_studio_clip_inspect Inspect source mapping, timing, transforms, and relationships
timeline_studio_transcript_inspect Inspect captions, word timing, speakers, and audio links
timeline_studio_project_diff Validate an edit plan against the real command registry without writing
timeline_studio_project_apply Apply a validated plan transactionally
timeline_studio_project_render Render and validate an H.264/AAC MP4

Three capability groups: understand, edit safely, and deliver

Why the agent does not rewrite project JSON directly

The shortest implementation would be to send the entire project JSON to the model and ask it to return a modified copy.

That is also the least reliable approach.

Syntactically valid JSON can still be semantically invalid for the editor. The model might reference a deleted clip, place media on the wrong track, invent an unsupported property, or repeat an operation that was already committed.

Instead, the agent produces a structured edit plan:

{
  "schemaVersion": 1,
  "project": "/projects/input.timeline",
  "baseRevision": 0,
  "dryRun": false,
  "operations": [
    {
      "id": "set-ratio-001",
      "type": "project.set_ratio",
      "ratio": "9:16"
    }
  ],
  "output": {
    "project": "/projects/output.timeline"
  }
}
Enter fullscreen mode Exit fullscreen mode

The plan is checked against Timeline Studio’s real command registry before it is allowed to write anything.

Diff before apply

Every edit goes through two distinct stages:

timeline_studio_project_diff
  ↓ only after a successful diff
timeline_studio_project_apply
Enter fullscreen mode Exit fullscreen mode

The diff stage does not write the output project. It checks questions such as:

  • Does the command exist?
  • Are the arguments valid?
  • Does the target clip still exist?
  • Does baseRevision match the current project?
  • Has the operation ID already been used?
  • Do all input and output paths stay inside the approved roots?

A wrong chat response can be regenerated. A wrong local write can damage a user’s project. That is why the preview step is a required safety gate rather than an optional UX enhancement.

Making retries safe with revisions and operation IDs

Agent tool calls can be retried because of cancellations, process failures, network interruptions, or replanning.

The plugin uses two mechanisms to make those retries predictable.

Project revision

Inspection returns the current revision. The edit plan must include it as baseRevision. If the project has changed since inspection, a new write based on the stale revision is rejected.

Idempotent operation ID

Every operation has a stable ID. Resubmitting an ID that has already been applied becomes a no-op instead of adding the same clip or modification twice.

Together, these checks provide optimistic concurrency control and idempotent execution for agent-driven edits.

File access boundaries belong in code, not prompts

Video editing requires access to project files, source media, and render outputs. A system prompt saying “do not leave the workspace” is not a security boundary.

The plugin requires explicit allowedRoots configuration:

- name: 'dsh-timeline-studio-plugin'
  config:
    timelineStudioRoot: /absolute/path/web_player
    allowedRoots:
      - /absolute/path/projects
Enter fullscreen mode Exit fullscreen mode

Projects, plans, imported media, and output files must all resolve inside those roots. The implementation also blocks symbolic-link escapes.

This is a general rule I find useful for agent tooling: if a restriction can be enforced deterministically, enforce it in code instead of asking the model to remember it.

Installation

The currently verified environment is:

  • DeepSeek Harness 0.1.0-rc.6 Developer Preview
  • Node.js 22.20+ or 24+
  • a local Timeline Studio repository with dependencies installed
  • FFmpeg and ffprobe

Install the GitHub repository as a DSH Web-profile bundle:

dsh plugin --profile web add \
  "github:MartinDelophy/dsh-timeline-studio-plugin#main"
Enter fullscreen mode Exit fullscreen mode

Then start Harness with absolute paths for Timeline Studio and the project workspace:

TIMELINE_STUDIO_ROOT=/absolute/path/web_player \
TIMELINE_PROJECTS_ROOT=/absolute/path/projects \
dsh --profile web
Enter fullscreen mode Exit fullscreen mode

The bundle stays disabled when TIMELINE_STUDIO_ROOT is missing, so an incomplete installation does not break an existing Harness profile.

After restarting, open Settings → Plugins → Plugin list and search for timeline.

Timeline Studio plugin enabled and mounted in DeepSeek Harness

When the configuration is enabled and the Cordis status is mounted, the plugin is ready. Users do not call the mount identifier manually; they simply describe the editing task in a Harness conversation.

What was tested end to end

Registering tools is not enough. The project also exercises the real DeepSeek Harness and Cordis pipeline.

The verified path covers:

  • DSH bundle installation;
  • automatic Cordis mounting;
  • registration of all seven tools;
  • inspection of a real .timeline project;
  • confirmation that diff performs no project write;
  • revision and idempotency checks during apply;
  • allowedRoots and symbolic-link boundary enforcement;
  • cancellation propagation to the Timeline Studio subprocess;
  • reinspection of the generated project;
  • MP4 rendering and output validation.

The local checks are:

npm run check
TIMELINE_STUDIO_ROOT=/absolute/path/web_player npm run test:e2e
Enter fullscreen mode Exit fullscreen mode

DeepSeek Harness is still a Developer Preview, so breaking changes are possible. The plugin intentionally keeps the Harness adapter thin and leaves editing behavior in Timeline Studio. If the host interface changes, the integration layer can evolve without rewriting the editor’s command engine.

Why the editable project matters

Many AI video systems return only a final render. That works for one-shot generation, but it makes small follow-up changes expensive:

  • extend a shot by half a second;
  • correct one caption;
  • lower the music;
  • create a vertical variant;
  • or reuse the same project for another campaign.

This workflow returns both the video and an editable .timeline project. The agent can handle repetitive, structured, verifiable work, while the creator keeps control over the final cut.

Closing thoughts

The interesting part of an agent that edits video is not just whether the model understands editing vocabulary. The real engineering questions are:

  • What can the agent access?
  • Which project revision is it acting on?
  • Was the operation already executed?
  • Can the edit be previewed before writing?
  • Can the result be validated afterward?
  • Can a human continue editing the result?

dsh-timeline-studio-plugin is an open-source attempt to answer those questions with a small deterministic tool layer around a real editor.

Issues, feedback, and contributions are welcome.

Top comments (0)