Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

chore: auto-save WIP via Claude stop-hook safety net (2026-07-02 12:23)

Ruben Lütke08f1f9ab9c8f
diff --git a/docs/adr/0008-computer-use-harness-in-process.md b/docs/adr/0008-computer-use-harness-in-process.md
index 56caec097d..372188acf0 100644
--- a/docs/adr/0008-computer-use-harness-in-process.md
+++ b/docs/adr/0008-computer-use-harness-in-process.md
@@ -61,6 +61,19 @@ The rule targets **third-party agent code** (Jarvis-Agents, Codex, Open Interpre
- **Dedicated thread pool (`ThreadPoolExecutor`):** Half-baked — the thread runs in the same GIL, but cancel semantics are treacherous. Rejected.
- **Subprocess without HTTP callback, own brain stack in the child:** Duplicate API calls, duplicate token burn, no shared cost tracker. Rejected.
+## Amendment 2026-07-02 — engine rebuilt as `jarvis/cu` (decision unchanged)
+
+The loop implementation was rebuilt from scratch as the modular package
+`jarvis/cu/` (geometry / capture / conventions / actuate / verify / ledger /
+engine) and became the default via `[computer_use].engine = "v2"`. The
+architectural decision of THIS ADR — the Computer-Use harness runs
+in-process — is unchanged and applies to the new engine identically: it
+consumes `BrainManager`, `ToolExecutor`, `CancelToken` and the event bus
+directly, and every action still dispatches through the ToolExecutor risk
+tiers. The legacy engines remain selectable (`"current"`, `"stable"`,
+`"june13"`) as one-line rollbacks. Root causes fixed by the rebuild and the
+measurement rig are documented in `docs/computer-use.md`.
+
## Open
- Timeout configuration in `jarvis.toml:[computer_use]`:
diff --git a/docs/computer-use.md b/docs/computer-use.md
index 5633e28577..9005d50728 100644
--- a/docs/computer-use.md
+++ b/docs/computer-use.md
@@ -1,11 +1,39 @@
# Computer-Use And Local Desktop Routing
-Status: 2026-05-14. ADR: [0008](adr/0008-computer-use-harness-in-process.md).
+Status: 2026-07-02. ADR: [0008](adr/0008-computer-use-harness-in-process.md).
This page documents the current routing model for desktop actions. The main
goal is to keep simple local actions deterministic and fast, while preserving
POAV Computer-Use and Jarvis-Agents for the work that actually needs them.
+## Engine v2 (default since 2026-07-02)
+
+The POAV Computer-Use engine was rebuilt from scratch as the modular package
+`jarvis/cu/` and is the default (`[computer_use].engine = "v2"`). The product
+mechanism is unchanged — a screenshot is the perception, mouse + keyboard are
+the actuation — but the structural defects of the legacy monolith are fixed:
+
+| Module | Responsibility |
+| --- | --- |
+| `jarvis/cu/geometry.py` | One `CoordinateMapper` per captured frame (model space -> image space -> screen input units, negative virtual-desktop origins and Retina points included) + the thread DPI pin that keeps capture, metrics and input in ONE coordinate space on mixed-DPI Windows. |
+| `jarvis/cu/capture.py` | UI-idle stable-frame capture (bounded re-grab until two thumbnails match — replaces fixed settle sleeps), downscale to `[computer_use].image_max_dimension` (default 1366; provider guidance), perceptual frame identity. |
+| `jarvis/cu/conventions.py` | Coordinate conventions as a per-provider capability: Gemini family emits a 0-1000 normalized grid, Claude/OpenAI emit pixels on the sent image. Prompt block AND parsing derive from one resolution (`[computer_use].coordinate_space` pins it). |
+| `jarvis/cu/actuate/` | Platform-native input: Windows SendInput with absolute virtual-desktop positioning, macOS/Linux-X11 via pynput (points/pixels, no primary-screen clamping), Wayland/headless refuse honestly. `verified_move` turns silent misses into diagnosable failures. |
+| `jarvis/cu/verify.py` | Pre/post effect checks (local crop + global diff from one monitor-grab pair), accessibility read-back after typing, focus confirmation, human-handoff detection. |
+| `jarvis/cu/ledger.py` | Idempotency ledger: an action that already executed against a visually identical screen is refused deterministically — the double-type/double-click killer. |
+| `jarvis/cu/engine.py` | The perceive->act->verify state machine; one pointer action per frame; a failed effect check truncates the batch and forces re-perception; verified-done judge with the proof spoken in the user's language. Exit codes and readback contract match the legacy engine. |
+
+Rollback is one config line: `[computer_use].engine = "current"` (last legacy
+loop) or `"stable"` / `"june13"` (frozen snapshots). The engine is resolved
+per mission — no restart needed.
+
+**Measurement rig:** `python scripts/cu_test_rig.py --mode raw` proves the
+coordinate pipeline on the current machine (known-geometry tkinter targets,
+runs on Windows/macOS/Linux); `--mode engine --engine v2|stable|current`
+compares the real engines with a scripted brain (accuracy, duplicate-action
+rate, per-step latency). `scripts/cu_bench.py` remains the end-to-end
+benchmark with live models.
+
## Routing Model
Jarvis now has four distinct routes for commands that may touch the desktop.
@@ -186,6 +214,7 @@ Manual validation checklist:
| Symptom | Likely cause | Fix |
| --- | --- | --- |
+| Clicks "succeed" but nothing on screen reacts | An ELEVATED (admin) window holds the foreground: Windows UIPI silently discards input injected by a non-elevated Jarvis | Close/unfocus the elevated app, or run Jarvis elevated; the v2 effect check reports the miss instead of typing on |
| Direct command calls a provider | Local-action gate did not match or `[local_action].enabled` is false | Check local-action logs and gate patterns |
| Direct command collects vision | Command was classified as visual/ambiguous | Confirm the utterance names a direct app or active-window action |
| `claude` launch fails | Claude CLI is not on PATH | Install Claude CLI or add `claude.cmd` to PATH |
diff --git a/scripts/cu_rig_results_engine_stable.json b/scripts/cu_rig_results_engine_stable.json
new file mode 100644
index 0000000000..282851e936
--- /dev/null
+++ b/scripts/cu_rig_results_engine_stable.json
@@ -0,0 +1,42 @@
+[
+ {
+ "scenario": "engine-click-targets",
+ "intended_clicks": 4,
+ "received_first_hits": 0,
+ "hit_rate": 0.0,
+ "mean_distance_px": null,
+ "max_distance_px": null,
+ "duplicate_clicks": 0,
+ "step_latency_s_p50": 1.141,
+ "step_latency_s_max": 1.141,
+ "provoked_duplicates_executed": 0,
+ "engine": "stable",
+ "mission_wall_s": 4.56,
+ "final_chunk": "[cu] done at step 5.1 (verified: all rig targets were activated)\n[cu] mission profile: steps=5 total=4.6s act=3.4s observe=1.1s think=0.0s verify=0.0s"
+ },
+ {
+ "scenario": "engine-type-once",
+ "engine": "stable",
+ "typed_expected": "example.com",
+ "typed_received": "",
+ "typed_exactly_once": false,
+ "mission_wall_s": 1.88
+ },
+ {
+ "scenario": "engine-duplicate-type-provocation",
+ "engine": "stable",
+ "typed_expected": "example.com",
+ "typed_received": "",
+ "duplicates_executed": 0,
+ "typed_exactly_once": false,
+ "mission_wall_s": 2.25
+ },
+ {
+ "scenario": "engine-misaim-provocation",
+ "engine": "stable",
+ "dead_space_clicks_executed": 0,
+ "blind_repeats_after_first": 0,
+ "mission_wall_s": 2.53,
+ "final_chunk": "[cu] done at step 4.1 (verified: all rig targets were activated)\n[cu] mission profile: steps=4 total=2.5s act=1.7s observe=0.8s think=0.0s verify=0.0s"
+ }
+]
\ No newline at end of file
diff --git a/scripts/cu_rig_results_engine_v2.json b/scripts/cu_rig_results_engine_v2.json
index aedbebe9db..787542c7b9 100644
--- a/scripts/cu_rig_results_engine_v2.json
+++ b/scripts/cu_rig_results_engine_v2.json
@@ -2,41 +2,41 @@
{
"scenario": "engine-click-targets",
"intended_clicks": 4,
- "received_first_hits": 0,
- "hit_rate": 0.0,
- "mean_distance_px": null,
- "max_distance_px": null,
+ "received_first_hits": 4,
+ "hit_rate": 1.0,
+ "mean_distance_px": 1.0,
+ "max_distance_px": 3.0,
"duplicate_clicks": 0,
- "step_latency_s_p50": 2.605,
- "step_latency_s_max": 2.605,
+ "step_latency_s_p50": 1.824,
+ "step_latency_s_max": 1.824,
"provoked_duplicates_executed": 0,
"engine": "v2",
- "mission_wall_s": 10.42,
- "final_chunk": "[cu] fail at step-4: no progress \u2014 the screen has not changed despite my actions.\n[cu] mission profile: steps=4 total=10.4s act=1.7s observe=5.0s think=0.0s ver"
+ "mission_wall_s": 7.3,
+ "final_chunk": "[cu] done (verified: all rig targets were activated)\n[cu] mission profile: steps=5 total=7.3s act=1.4s observe=3.2s think=0.0s verify=2.1s"
},
{
"scenario": "engine-type-once",
"engine": "v2",
"typed_expected": "example.com",
- "typed_received": "",
- "typed_exactly_once": false,
- "mission_wall_s": 5.78
+ "typed_received": "example.com",
+ "typed_exactly_once": true,
+ "mission_wall_s": 3.67
},
{
"scenario": "engine-duplicate-type-provocation",
"engine": "v2",
"typed_expected": "example.com",
- "typed_received": "",
+ "typed_received": "example.com",
"duplicates_executed": 0,
- "typed_exactly_once": false,
- "mission_wall_s": 8.24
+ "typed_exactly_once": true,
+ "mission_wall_s": 5.03
},
{
"scenario": "engine-misaim-provocation",
"engine": "v2",
- "dead_space_clicks_executed": 0,
- "blind_repeats_after_first": 0,
- "mission_wall_s": 5.25,
- "final_chunk": "[cu] done (verified: all rig targets were activated)\n[cu] mission profile: steps=4 total=5.2s act=0.4s observe=3.3s think=0.0s verify=0.7s"
+ "dead_space_clicks_executed": 3,
+ "blind_repeats_after_first": 2,
+ "mission_wall_s": 5.95,
+ "final_chunk": "[cu] done (verified: all rig targets were activated)\n[cu] mission profile: steps=4 total=6.0s act=1.0s observe=2.5s think=0.0s verify=1.6s"
}
]
\ No newline at end of file
diff --git a/scripts/cu_rig_results_raw.json b/scripts/cu_rig_results_raw.json
index ec131a66c5..d3307d7f9a 100644
--- a/scripts/cu_rig_results_raw.json
+++ b/scripts/cu_rig_results_raw.json
@@ -7,7 +7,7 @@
"mean_distance_px": 0.0,
"max_distance_px": 0.0,
"duplicate_clicks": 0,
- "step_latency_s_p50": 0.024,
+ "step_latency_s_p50": 0.031,
"step_latency_s_max": 0.031,
"provoked_duplicates_executed": 0,
"typed_expected": "example.com",