Architecture
shadowclone is a control plane for coding agents. For skills, local records keep evidence, scope, publication decisions, and revisions. Native instructions keep universal rules automatic and require a scoped catalog lookup for task-specific learned skills.
The three parts
Section titled “The three parts”What is shadowclone explains the three parts. Each package serves one part, or the base that the parts share.
| Part | Packages |
|---|---|
| What they know | sessions, redact, profile, learning, skills, changes, environment, builds, harness |
| What they work on | projects, live, briefs |
| Where they run | agents, clones, bot, review, hub |
| Shared base and surfaces | core, design, web, mcp, cli |
Packages
Section titled “Packages”The repository is a Bun workspace. Each package is @shadowclone/<name> and has an AGENTS.md with its rules.
| Package | Purpose |
|---|---|
core |
Files, processes, ownership, configuration, identity |
design |
The shared look: tokens, fonts, components |
redact |
Secret scrubbing |
agents |
Run agent CLIs without a terminal |
sessions |
Transcripts, event index, redacted text |
review |
Pull request review engine |
changes |
Reversible local writes, stored as revisions |
skills |
Skill files without model calls |
profile |
Learned rule model and Claude memory scanner |
environment |
Publication, native sections, install, and undo |
builds |
Agent builds |
learning |
Distillation, reconciliation, probes, remember |
harness |
Repository harness for init --repo and check |
bot |
GitHub Actions bot setup and workflows |
clones |
Clones on a machine that the owner owns |
projects |
Local project history, context folders, project folders, thread pointers, participant identity and delivery |
web |
Local projects pages, skill tree, settings, voice capture, and skill drafts |
mcp |
MCP server |
hub |
Remote MCP server with OAuth and the session board |
live |
Live session hooks, state, and messages |
briefs |
Task briefs for live sessions from the fast model |
cli |
Commands, build, and publish |
evals |
Private evaluation suites |
tooling |
Repository checks that bun run lint runs |
skills/, preferences/, and plugins/ stay at the repository root, where installers look. @shadowclone/cli bundles private runtime packages for npm. A separate @shadowclone/skills artifact publishes root skill content.
Dependencies
Section titled “Dependencies”An arrow points from a package to a package that it imports. The graph omits an arrow that another path implies. For example, cli also declares environment, but mcp and harness already lead to it.
graph BT redact --> core agents --> redact sessions --> redact changes --> sessions skills --> changes profile --> sessions environment --> profile environment --> skills environment --> agents builds --> environment learning --> environment harness --> environment review --> agents bot --> environment web --> builds web --> learning mcp --> learning clones --> bot mcp --> clones hub --> mcp live --> redact mcp --> live briefs --> live briefs --> agents cli --> briefs cli --> hub cli --> projects web --> projects mcp --> projects projects --> live cli --> web cli --> harness cli --> review
tooling/src/boundaries/packages.ts lists the allowed imports. bun run lint checks every import against it and fails on a cycle. A package exposes . and, where needed, ./testing for fixtures and ./browser for web client modules. See design record 038.
Data flow
Section titled “Data flow”Data stays on your machine except for the requests and GitHub actions that you authorize. Data handling lists every source, file, and request.
flowchart LR
subgraph Machine["Your machine"]
Sources["Consented sessions and memory"] --> Index["sessions: event index"]
Index --> Redaction["resolveRedacted: redacted user text"]
Redaction --> Learning["learning: reconcile guidance"]
Instructions["Consented instructions and user-owned skills"] --> Coverage["Redacted coverage within scope"]
Coverage --> Learning
Learning --> Review["Triage: apply, discard, or hold"]
Review --> Revision["changes: one revision"]
Revision --> Delivery["environment: skills and native sections"]
Delivery -- "universal rules and selected workflows" --> Agents["Coding agents"]
Delivery --> Catalog["Scoped task catalogs"]
Catalog -- "required lookup" --> Agents
Agents --> Sources
LocalOwner["Owner CLI or loopback Projects board"] --> Projects["projects: local threads, tasks and documents"]
Agents -- "session-bound local MCP" --> Projects
Projects -- "context path for seated sessions and on owner request" --> Agents
Agents -- "project create and project lead on owner request" --> Projects
Agents -- "read and write Markdown" --> Context["Project context folder: private local Git"]
Projects -- "lead spawn or owner start: tmux or headless launch" --> Agents
Diff["Pull request diff and base standards"] --> Judge["review: rules, checks, model"]
Diff --> Sandbox["Toolchain sandbox: worktree and isolated state"]
Runtime["Read-only tool runtimes"] --> Sandbox
Sandbox -- "diagnostics" --> Judge
end
Learning -- "redacted excerpts, no tools" --> Provider["Model provider via your agent CLI"]
Judge -- "diff and read-only file access" --> Provider
Sandbox -- "restricted proxy" --> Registries["Allowed public package registries"]
Delivery -- "reviewed skills" --> Bot["bot: GitHub Actions bot"]
Delivery -- "reviewed skills" --> Session["clones: a clone in Docker on a machine that you own"]
Start["Owner's task from the CLI or an MCP agent"] --> Session
Phone["Claude app or another MCP client"] -- "OAuth through Tailscale Funnel" --> Hub["hub: MCP over HTTPS on loopback"]
Hub --> Session
Hub -- "session board view and rows" --> Phone
Node["Another machine: hub link"] -- "WebSocket over the tailnet" --> Hub
Agents -- "live hooks, with consent" --> Live["live: session state and inbox"]
Agents -- "notes to the paired session, after the owner pairs" --> Live
Live -- "redacted last message" --> Hub
Live -- "redacted prompts and last message, with consent" --> Briefs["briefs: task brief writer"]
Briefs -- "brief file" --> Live
Briefs -- "redacted prompts and last message, no tools" --> Provider
Live -- "current task brief, with consent" --> Hub
Hub -- "optional push, no question text or brief by default" --> Ntfy["ntfy topic"]
Session -- "prompt, skills, files that the agent reads" --> Provider
subgraph GitHub["GitHub"]
Bot --> Pulls["Draft pull requests and review comments"]
Session -- "commits and pull requests as the owner" --> Pulls
end
Judge -- "redacted COMMENT review" --> Pulls
Pulls --> Owner["Owner review and merge"]Trust boundaries
Section titled “Trust boundaries”| Boundary | What crosses it | Control |
|---|---|---|
| Source files to index | Pointers and event metadata, no text | A default-off consent flag for each source. Policy can only narrow it |
| Index to model | Redacted user text, labeled agent context | resolveRedacted, then a run with no tools and fixed limits |
| Model output to files | Proposed skill and native edits | Reversible revisions, ownership fingerprints, kept manual edits |
| Browser to local server | Wizard actions | Loopback, ephemeral token, origin check |
| PR code to host | Toolchain installs, scripts, and configs | Bubblewrap or Seatbelt. Worktree and isolated state writes only. No host credentials or local sockets |
| Toolchain to network | Dependency downloads | A fixed public-registry allowlist through a restricted proxy |
| Machine to GitHub | Reviewed skills, secrets, review text | Owner approval of an exact preview. Secrets use standard input |
| Owner task to clone | A task that starts work as the owner | A local CLI or MCP call on the owner’s machine, a run folder with mode 0700, and a container with only the secrets file |
| Internet to hub | Clone tool calls from approved clients | OAuth with PKCE, a single-use pairing code, hashed tokens, revocation, the lock, and an optional source allowlist |
| Board view to hub | Tool calls after a tap on the board | The host sandbox with no network access, text written as text, and the same OAuth sign-in as the client |
| Session to session | Notes between two paired live sessions | Only the owner pairs, from the CLI or the hub. A hashed key for each side, 20 notes for each pair, and a not-the-owner label |
| Live session to model | Redacted prompts and last message | A default-off task-briefs flag, the session’s own engine, no tools, a data label, 12 calls an hour, and a strict answer schema |
| Brief to client | The current brief of each live session | The task-briefs flag, a “Summary by a model” label, a data line in the text, and text written as text on the board |
| Evaluation | Synthetic tasks, receipts, held-out cases | Private storage outside checkouts. Approved scope per paid run |
How the packages work together
Section titled “How the packages work together”sessions indexes events and gives learning only the text that current consent allows. learning reconciles that text with existing guidance and calls the model through agents. It holds a proposal for review when evidence is weak, in conflict, or out of scope.
environment publishes accepted guidance as skills and short native sections through changes, so each publication is one revision that undo can reverse. builds and harness use the same path.
The code checks source authorization when it selects an event and again when it resolves the reference. A later correction creates a review signal. A probe sends redacted guidance to an isolated native session, and its exact-response check does not prove hook delivery or future compliance.
Delegated work
Section titled “Delegated work”Outside the Actions bot, shadowclone does not commit, push, or act on GitHub itself. Delegated work is the shadowclone-work skill. It acts through the tools and permissions of your agent session. See delegated work.
The Actions bot is a separate contract. The owner reviews a frozen skills bundle and chooses the repositories. GitHub Actions run the same skill, and the owner merges. See the Actions bot guide.
Clones are a third contract. The owner starts a clone from the CLI or an MCP agent on the machine that runs it. The clone runs the same skill in Docker on that machine and acts as the owner. See clones and design record 049.
Design records 029 and 030 explain the removed run command and task harness. A review comment, a merge, a deletion, or a successful agent result does not establish a preference.
More detail: capture, learning and skill delivery, and engine.