Skip to content

Commit 7bfb48c

Browse files
Merge pull request #18 from Factory-AI/droid-control
2 parents 63df8b3 + 7085260 commit 7bfb48c

68 files changed

Lines changed: 13257 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.factory-plugin/marketplace.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@
2424
"source": "./plugins/core",
2525
"category": "core"
2626
},
27+
{
28+
"name": "droid-control",
29+
"description": "Terminal, browser, and computer automation for testing, demos, QA, and computer-use tasks",
30+
"source": "./plugins/droid-control",
31+
"category": "automation"
32+
},
2733
{
2834
"name": "autoresearch",
2935
"description": "Autonomous experiment loop for optimization research. Try an idea, measure it, keep what works, discard what doesn't, repeat. Works standalone or as a mission worker.",

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ Core skills for essential functionalities and integrations. Pre-installed by the
3232

3333
- `review` - Review code changes and identify high-confidence, actionable bugs. Includes systematic analysis patterns for null safety, async/await, security, concurrency, API contracts, and more. Used by both the CLI `/review` command and the CI action.
3434

35+
### droid-control
36+
37+
Terminal, browser, and computer automation for Droids. Record demos, verify behavior claims, and run QA flows.
38+
39+
**Commands:** `/demo`, `/verify`, `/qa-test`
40+
41+
**Skills:** `droid-control` (orchestrator), `tuistory`, `true-input`, `agent-browser`, `droid-cli`, `pty-capture`, `capture`, `compose`, `verify`, `showcase`
42+
43+
See [plugins/droid-control/README.md](plugins/droid-control/README.md) for details.
44+
3545
### security-engineer
3646

3747
Security review, threat modeling, and vulnerability validation skills.
@@ -56,6 +66,10 @@ Skills for continuous learning and improvement.
5666
- `frontend-design` - Build web apps, websites, HTML pages with good design
5767
- `browser-navigation` - Browser automation with agent-browser
5868

69+
### autoresearch
70+
71+
Autonomous experiment loop for optimization research. Try an idea, measure it, keep what works, discard what doesn't, repeat. Works standalone or as a mission worker.
72+
5973
## Plugin Structure
6074

6175
Each plugin follows the Factory plugin format:
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "droid-control",
3+
"description": "Terminal and browser automation for testing, demos, QA, and computer-use tasks",
4+
"version": "1.0.0"
5+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Architecture
2+
3+
## The problem
4+
5+
Put all driver knowledge, recording lifecycle, video rendering, and verification logic in one skill and two things happen. First, the droid loads 3000 tokens of Windows KVM docs to record a tuistory demo on Linux. Second, and this is the one that actually hurts, the droid gets all the information at once and has to figure out what's relevant *right now*. It makes worse decisions, skips steps it shouldn't, and invents steps it doesn't need to.
6+
7+
## UX for droids
8+
9+
Droids aren't exempt from information architecture. They have finite context, they get distracted by irrelevant detail, and they degrade under overload.
10+
11+
Every skill in this plugin is a surface the droid interacts with at a specific moment in a workflow: scoped to what it needs right now, actionable on first read, with an explicit handoff to the next surface. The same instincts that make a good CLI or a good API apply. Don't dump everything. Sequence the information. Make the next step obvious.
12+
13+
A command like `/demo` doesn't contain Remotion props or driver-specific logic. It parses intent, builds commitments, and tells the droid which skills to load. The droid never sees video rendering details while it's still planning what to record.
14+
15+
## Waterfall routing
16+
17+
Skills chain into each other without hardcoding. The orchestrator doesn't call skills or build a pipeline. It tells the droid which skills to load based on three independent lookups. Once loaded, each skill's exit is the next skill's entry:
18+
19+
```
20+
/demo parses intent, commits deliverables
21+
→ orchestrator routes to driver + stage + artifact skills
22+
→ capture launches the app, records, hands off clips + metadata
23+
→ compose receives clips, builds Remotion props, renders video
24+
→ verify checks the output against the original commitments
25+
```
26+
27+
No state machine or orchestration framework. Just documents whose outputs naturally feed into the next document's inputs. The droid follows the waterfall because each skill makes the next step obvious, not because something forces it to. Complex multi-stage workflows emerge from skill composition rather than control flow.
28+
29+
## Task delegation
30+
31+
Because each stage's inputs and outputs are explicit, mechanical work naturally decomposes into worker tasks. The parent agent retains planning and editorial control; workers execute exact commands and return file paths.
32+
33+
Capture workers for both branches run in parallel. They need tctl commands and worktree paths, not PR context. The render worker gets a props JSON and clip paths. It doesn't need to know what the PR does or why the demo matters. Verification stays with the parent because it requires the original commitments and judgment about whether the evidence holds up.
34+
35+
The skill boundaries are the delegation boundaries. You don't need a separate delegation framework because the decomposition into self-contained stages already defines what can be farmed out, what needs creative judgment, and what's too trivial to be worth the overhead.
36+
37+
## Orthogonal routing
38+
39+
The orchestrator makes three independent lookups:
40+
41+
- **Target**: what are you driving? (droid-cli, other TUI, web app, byte capture)
42+
- **Stage**: what does the workflow need? (capture, compose, verify)
43+
- **Artifact**: does compose need polish tools? (showcase)
44+
45+
These compose without cross-product explosion. 6 targets + 3 stages + 1 artifact route = 10 skills, not 18. Adding a new target means writing one skill and adding one row to the routing table. Every existing stage and artifact skill works with it immediately.
46+
47+
## Hybrid handoffs
48+
49+
Commands hand off to the compose stage with two sections: structured fields for mechanical decisions, natural language for creative ones.
50+
51+
Structured: layout, speed, preset, fidelity, effects tier. These have correct answers. A side-by-side layout is either `side-by-side` or it isn't.
52+
53+
Natural language: what the viewer should take away, which moments to hold, how to frame the story. These are editorial judgments that benefit from the droid's understanding of the PR context.
54+
55+
Two failure modes this prevents: over-specifying creative decisions up front (the droid produces rigid, paint-by-numbers output) and under-specifying mechanical params (the droid hallucinates presets and layouts). The effects tier is a concrete example. The command commits a single word ("utilitarian" or "full"), and compose makes specific, grounded choices after capture, when it has actual recordings to look at.
56+
57+
## Platform isolation
58+
59+
Platform-specific content lives in `platforms/` subdirs under the relevant skill. A droid on Linux loads `true-input/platforms/linux.md`. It never sees the Windows KVM or macOS QEMU docs. This is a routing decision, not a reading-comprehension test.

plugins/droid-control/NOTICES.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Third-Party Notices
2+
3+
This plugin depends on several third-party tools and libraries. They are not bundled -- each is installed separately by the user. Their respective licenses apply at the point of installation and use.
4+
5+
## Video rendering
6+
7+
- **[Remotion](https://www.remotion.dev/)** -- React-based video renderer used by the compose/showcase pipeline. Remotion is free for individuals, small teams (<=3 employees), and non-profits. Larger companies require a [company license](https://www.remotion.pro/). See the [full license terms](https://github.com/remotion-dev/remotion/blob/main/LICENSE.md).
8+
- **[React](https://react.dev/)** -- MIT License
9+
- **[Zod](https://zod.dev/)** -- MIT License
10+
11+
## Terminal automation
12+
13+
- **[tuistory](https://github.com/nicholasgasior/tuistory)** -- virtual PTY automation CLI
14+
- **[asciinema](https://asciinema.org/)** -- terminal session recorder (GPL-3.0)
15+
- **[agg](https://github.com/asciinema/agg)** -- asciinema GIF generator (Apache-2.0)
16+
17+
## Browser automation
18+
19+
- **[agent-browser](https://docs.factory.ai/)** -- Playwright-backed browser automation CLI
20+
21+
## System tools
22+
23+
- **[ffmpeg](https://ffmpeg.org/)** -- multimedia framework (LGPL-2.1+ / GPL-2.0+, depending on build configuration)
24+
- **[cage](https://github.com/cage-kiosk/cage)** -- Wayland kiosk compositor (MIT)
25+
- **[wtype](https://github.com/atx/wtype)** -- Wayland keystroke injection (MIT)

plugins/droid-control/README.md

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# droid-control
2+
3+
Terminal, browser, and computer automation plugin for Droids.
4+
5+
Droids can read and write code. This plugin enables them to *operate* it: launch apps, type commands, click buttons, record what happens, and produce polished video evidence of it. No human hands required (they don't have any).
6+
7+
## What you get
8+
9+
**Record a demo video from a PR:**
10+
11+
```
12+
/demo pr-1847
13+
```
14+
15+
Droid reads the PR, scripts the interactions that prove the change works, records both branches in parallel, and renders a side-by-side comparison video. Factory preset for cinematic warmth, macos preset for clean and utilitarian.
16+
17+
**Verify a behavior claim:**
18+
19+
```
20+
/verify "ESC cancels streaming in bash mode"
21+
```
22+
23+
Droid launches the app, attempts the claim, and reports what actually happened, with screenshots and text snapshots as evidence. If the claim is false, that's a valid finding, not a failure.
24+
25+
**Run a QA flow against a web app:**
26+
27+
```
28+
/qa-test https://app.example.com -- login, create a project, invite a member
29+
```
30+
31+
Droid drives the browser through the flow, captures each step, and reports pass/fail with annotated screenshots.
32+
33+
## Quick start
34+
35+
```bash
36+
# Register the Factory plugins marketplace (if not already added)
37+
droid plugin marketplace add https://github.com/Factory-AI/factory-plugins
38+
39+
# Install the plugin
40+
droid plugin install droid-control@factory-plugins --scope user
41+
42+
# Install Remotion dependencies (one-time, only needed for video rendering)
43+
# Find the plugin install path with: droid plugin list --scope user
44+
cd <plugin-path>/remotion && npm install
45+
```
46+
47+
Or use the `/plugins` UI: Browse tab, select droid-control, install.
48+
49+
Then open a Droid session and run `/demo`, `/verify`, or `/qa-test`.
50+
51+
## Commands
52+
53+
### `/demo`
54+
55+
Plans and records a demo video. Accepts a PR number, GitHub URL, or free-text description. Comparison PRs get side-by-side layout by default; new features get single-branch. Add "showcase" for cinematic polish, "keys" for keystroke overlay.
56+
57+
### `/verify`
58+
59+
Tests a specific behavior claim and reports findings with evidence. Frames the droid as an investigator. Anti-fabrication rules prevent staging evidence to match expected outcomes.
60+
61+
### `/qa-test`
62+
63+
Automated QA against terminal CLIs or web/Electron apps. Accepts a URL, CLI command, or app description with optional test steps after `--`.
64+
65+
## How it works
66+
67+
Three layers:
68+
69+
- **Orchestrator** -- routes each request through three independent lookups (target, stage, artifact) to determine which skills to load. ~93 lines.
70+
- **10 atom skills** -- self-contained background knowledge loaded on demand. Driver atoms (tuistory, true-input, agent-browser), target atoms (droid-cli, pty-capture), stage atoms (capture, compose, verify), and a polish atom (showcase).
71+
- **3 commands** -- thin intent declarations that parse arguments into commitments, then delegate to atoms via hybrid handoffs.
72+
73+
Every workflow flows through **capture → compose → verify**. Commands declare *what* to produce; atoms own *how*.
74+
75+
## Video rendering
76+
77+
The compose stage uses [Remotion](https://www.remotion.dev/) (React-based video renderer) for all compositing. 6 visual presets, automatic cinematic layers (warm backgrounds, floating particles, noise overlay, motion blur transitions), and effect-driven layers (spotlight, zoom, keystroke overlay, section headers).
78+
79+
The `render-showcase.sh` helper handles the full pipeline: `.cast` conversion via `agg`, clip staging, duration detection, Remotion render, and cleanup.
80+
81+
## Prerequisites
82+
83+
| Stage | Platform | Required |
84+
|---|---|---|
85+
| tuistory | All | `tuistory`, `asciinema`, `agg` |
86+
| true-input | Linux/Wayland | `cage`, `wtype`, Wayland terminal |
87+
| true-input | Windows (KVM) | `libvirt`, `qemu`, KVM VM with SSH |
88+
| true-input | macOS (QEMU) | `qemu`, `socat`, macOS VM with SSH |
89+
| agent-browser | All | `agent-browser` |
90+
| compose | All | `ffmpeg`, `ffprobe`, `agg` |
91+
| showcase | All | Node.js (>= 18), Chrome/Chromium |
92+
93+
```bash
94+
npm install -g tuistory # virtual PTY driver
95+
pip install asciinema # terminal recording
96+
cargo install --git https://github.com/asciinema/agg # .cast → .gif converter
97+
sudo apt-get install -y ffmpeg # video processing
98+
agent-browser install # browser automation (downloads Chromium)
99+
cd plugins/droid-control/remotion && npm install # Remotion (video rendering)
100+
```
101+
102+
Only install what you need for your use case. Terminal demos need tuistory, asciinema, agg, and ffmpeg. Web/Electron automation just needs agent-browser.

0 commit comments

Comments
 (0)