S
Soham
@sohampal
How Swades Works?
1️⃣ Dynamic Decomposing When you issue a task, Swades classifies its
complexity. If it's high, it decomposes the prompt into independent
tasks, spawning parallel subagents running inside isolated git worktree
sandboxes. No overlap, no code pollution.
2️⃣ Automated Git Merging Once parallel subagents complete their code
changes, Swades gathers the patches and runs a 3-way merge engine to
merge changes back to main, automatically spawning resolution agents if
conflicts arise.
3️⃣ Desktop Control & Supervision Beyond terminal commands, Swades
features a native GNOME Wayland CUA (Computer Use Agent) for visual
browser/GUI automation, all supervised by a 24/7 "Director AI" loop that
reviews agent states and self-corrects until done.
Standard Mode runs a ReAct (Reasoning/Action) loop with real-time stream
parsing. At boot, it ingests .agent_index.json (a pre-indexed AST map
of classes and imports) to minimize workspace token overhead.
When writing files, it executes static syntax guardrails (matching
bracket pairs, running node --check or python linting) before writing to
disk. If validation fails, it pipes errors back to the context, forcing
the model to self-correct before executing terminal actions.
When task complexity is classified as HIGH, Orchestrated Mode triggers:
Sandboxing: Spawns concurrent tasks in separate git worktree workspaces
to prevent state pollution.
3-Way Merging: Merges patches using git apply --3way. If a merge
conflict is detected, it programmatically spawns a dedicated
merge-resolution agent.
Simulation: Spawns a final sandbox simulation thread (runSimulated) to
run test suites and verify workspace integration.
Designed for raw output speed and lower token overhead. It follows the
orchestrated workflow (complexity check -> subtask decomposition
-> parallel git worktrees -> 3-way merge) but bypasses the
post-merge simulation. Diffs are written directly to the real workspace
upon clean merge verification, serving as a fast, multi-file code
generator.
A state-machine supervisor loop. A worker agent executes the first phase
of the task. Upon completion, a secondary "Director" model inspects the
full git diff, files, and terminal execution logs.
The Director updates task.md, writes the prompt for the next phase, and
spawns a new worker session. This worker-director cycle loops
continuously until the Director verifies the target goal matches 100%.
Built for Wayland GUI environments where legacy X11 automation (like
xdotool) fails. A Python helper (cua_helper.py) communicates over OS
D-Bus interfaces using GLib variants to inject native keystrokes and
cursor clicks into the GNOME Shell.
It captures real-time screenshots for visual models, backed by strict
Click Recurrence Guardrails in JS that block duplicate coordinate
requests to break visual feedback loops.
By decoupling the CLI workspace, sandboxing parallel tasks in Git
worktrees, communicating via native D-Bus layers, and using a
Director-Worker supervisor hierarchy, Swades Agent handles everything
from localized edits to entire system architectures.
🔗 Explore the code: github.com/Electroiscoding/Swades-Agent
❤️ 1 likes
💬 0 comments
Replies
No replies yet.