COSMICONESTRAND
Programm 1 von 5 · DarfProgram 1 of 5 · May

SWP

Scoped Work ProtocolScoped Work Protocol

Ein Auftrag und eine Quittung für das, was eine KI tut: du entscheidest, was sie darf, sie bleibt darin, und eine Quittung aus Fakten zeigt, was sie getan hat.A work order and a receipt for what an AI does: you decide what it may do, it stays inside, and a receipt made from facts shows what it did.

Version 0.1.0Spezifikation und UmsetzungSpecification and implementationPython, keine AbhängigkeitPython, no dependency
Das BildThe image

Auftrag und QuittungWork order and receipt

Wer einen Handwerker beauftragt, hat vorher einen Auftrag und nachher eine Quittung. Auftrag = was der Agent darf (Ziel, Dateien, Befehle, neue Nebenwirkungen, wann fertig), Unterschrift = ein Mensch genehmigt, Hausordnung = der Wächter stoppt alles ausserhalb, Quittung = aus Fakten, was geändert und was gestoppt wurde.When people hire a contractor, there is a work order before and a receipt after. Work order = what the agent may do (goal, files, commands, new side effects, done-when), signature = a person approves, site rules = the guard stops anything outside, receipt = made from facts, what changed and what was stopped.

Was es istWhat it is

Das «Darf» von COSMICThe "May" of COSMIC

SWP ist das «Darf» von COSMIC: Bevor ein KI-Agent arbeitet, liegt ein Auftrag in swp.orders.json mit Ziel, Dateien, die sich ändern dürfen (Glob-Muster), Befehlen, die laufen dürfen, erlaubten neuen Nebenwirkungen (SEP-Arten, Hosts, Personendaten) und den Befehlen, die «fertig» bedeuten. Ein Mensch genehmigt ihn mit swp approve im eigenen Terminal; der Agent kann nur vorschlagen, nie genehmigen, auch der MCP-Server bietet kein Genehmigen an. Während der Arbeit prüft ein Claude-Code-Hook jede Datei-Änderung und jeden Befehl gegen den offenen Auftrag, stoppt, was ausserhalb liegt, sagt dem Agenten warum und protokolliert den Versuch in .swp/. Zum Schluss schreibt swp close die Quittung aus Git-Diff seit der Genehmigung, Hook-Protokoll, SEP-Diff und den Ergebnissen der Fertig-Befehle, nie aus der Selbstauskunft des Agenten.SWP is the "may" of COSMIC: before an AI agent works, a work order sits in swp.orders.json with a goal, the files that may change (glob patterns), the commands that may run, the new side effects allowed (SEP kinds, hosts, personal data) and the commands that mean "done". A person approves it with swp approve in their own terminal; the agent can only propose, never approve, and the MCP server offers no approve tool. While the agent works, a Claude Code hook checks every file change and every command against the open order, stops what is outside, tells the agent why and logs the attempt in .swp/. At the end, swp close writes the receipt from the Git diff since approval, the hook's log, the SEP diff and the results of the done-when commands, never from the agent's own summary.

Was es kannWhat it does

Fähigkeiten, belegt im CodeCapabilities, backed by the code

Auftrag mit kleinstem RahmenWork order with the smallest scope

Ein Auftrag nennt Ziel, erlaubte Dateien (Glob-Muster wie billing/**), erlaubte Befehle (Muster, geprüft gegen jeden Teil einer Shell-Kette bei &&, ||, ;, |), erlaubte neue Nebenwirkungen (Arten, Hosts, Personendaten) und Fertig-Befehle. Mit requireOrder darf der Agent ohne genehmigten Auftrag nichts ändern.An order names a goal, the files that may change (glob patterns such as billing/**), the commands that may run (patterns checked against every part of a shell chain split at &&, ||, ;, |), the new side effects allowed (kinds, hosts, personal data) and done-when commands. With requireOrder, the agent may change nothing without an approved order.

Nur ein Mensch genehmigtOnly a person approves

swp approve verweigert sich in der Shell eines KI-Agenten (wenn CLAUDECODE gesetzt ist). Der MCP-Server bietet swp_order, swp_status, swp_propose und swp_delegate, aber kein Werkzeug zum Genehmigen. Das Repo nennt das ehrlich eine Bremsschwelle, kein Schloss; Schutz ist die Prüfung von swp.orders.json im Repository.swp approve refuses inside an AI agent's shell (when CLAUDECODE is set). The MCP server offers swp_order, swp_status, swp_propose and swp_delegate, but no tool to approve. The repo calls this a speed bump, not a lock; what protects the orders is review of swp.orders.json in the repository.

Wächter während der ArbeitGuard while working

Ein Claude-Code-PreToolUse-Hook (swp hook, Matcher Edit|Write|MultiEdit|NotebookEdit|Bash) prüft jede Änderung und jeden Befehl gegen den offenen Auftrag, stoppt Ausserhalb-Liegendes mit Begründung und schreibt den Versuch mit Auftrags-ID ins Log. Auftragsdatei und .swp/ sind auch vor Shell-Umwegen (sed -i, tee, cp, rm, Umleitungen) geschützt; ein unlesbares Hook-Ereignis stoppt (Exit 2).A Claude Code PreToolUse hook (swp hook, matcher Edit|Write|MultiEdit|NotebookEdit|Bash) checks every change and command against the open order, stops what is outside with a reason and logs the attempt with the order id. The orders file and .swp/ are also protected from shell detours (sed -i, tee, cp, rm, redirections); an unreadable hook event stops the call (exit 2).

Quittung aus FaktenReceipt from facts

swp close erzeugt die Quittung aus dem Git-Diff seit der Genehmigung (base-Commit), dem Hook-Log (Gestopptes), dem SEP-Diff (neue oder breitere Nebenwirkungen, je gegen den Auftrag beurteilt), den Exit-Codes der Fertig-Befehle und den seit der Genehmigung vorgeschlagenen SLP-Lektionen. Formate: Text, Markdown für Pull Requests, JSON für Werkzeuge; --preview zeigt sie ohne zu schliessen.swp close builds the receipt from the Git diff since approval (base commit), the hook log (what was stopped), the SEP diff (new or widened side effects, each judged against the order), the exit codes of the done-when commands and the SLP lessons proposed since approval. Formats: text, Markdown for pull requests, JSON for tools; --preview shows it without closing.

Delegation, nie breiterDelegation, never wider

swp delegate und MCP swp_delegate geben einem anderen Agenten einen Teil eines genehmigten Auftrags: Dateien, Befehle, Arten, Hosts und Personendaten nie weiter als beim Eltern-Auftrag, darum ohne neue Genehmigung. Jeder Agent arbeitet in seinem Teil (SWP_AGENT_NAME oder Agentenname des Hooks).swp delegate and MCP swp_delegate give another agent part of an approved order: files, commands, kinds, hosts and personal data never wider than the parent order, so no new approval is needed. Each agent works in its own part (SWP_AGENT_NAME or the hook's agent name).

Zweisprachig und ohne AbhängigkeitenBilingual and dependency-free

Alle Befehle sprechen Englisch und Deutsch. Python 3.10 oder neuer, dependencies = []; SEP ist optional und wird nur für die Beurteilung neuer Nebenwirkungen gebraucht.All commands speak English and German. Python 3.10 or newer, dependencies = []; SEP is optional and only needed to judge new side effects.

BefehleCommands

Die BefehlszeileThe command line

BefehlCommandWas passiertWhat happens
swp init [--require]Aufträge im Projekt einführen; mit --require darf der Agent ohne genehmigten Auftrag nichts ändern.Start using work orders in this project; with --require the agent may change nothing without an approved order.
swp propose --goal … --change … --run … --kind … --no-new-hosts --personal-data no --done …Einen Auftrag vorschlagen; er wartet auf einen Menschen (Agenten tun das über MCP swp_propose).Propose a work order; it waits for a person (agents do this through MCP swp_propose).
swp reviewZeigt, was auf eine Entscheidung wartet.Shows what waits for a decision.
swp approve IDEin Mensch genehmigt; in der Shell eines KI-Agenten verweigert.A person approves; refused inside an AI agent's shell.
swp delegate PARENT --to AGENT --goal …Gibt einem anderen Agenten einen Teil eines genehmigten Auftrags, nie breiter, darum ohne neue Genehmigung.Gives another agent part of an approved order, never wider, so no new approval.
swp cancel ID [--reason …]Bricht einen Auftrag ab.Cancels a work order.
swp statusDer offene Auftrag und was sich bisher geändert hat.The open order and what changed so far.
swp close [--format text|markdown|json] [--preview] [--no-checks]Schliesst den Auftrag und schreibt die Quittung; Markdown für Pull Requests, JSON für Werkzeuge.Closes the order and writes the receipt; Markdown for pull requests, JSON for tools.
swp hookDer Claude-Code-PreToolUse-Wächter: stoppt, was ausserhalb des Auftrags liegt.The Claude Code PreToolUse guard: stops what is outside the order.
swp mcpMCP-Server für Agenten: lesen (swp_order), prüfen (swp_status), vorschlagen (swp_propose), delegieren (swp_delegate); kein Genehmigen.MCP server for agents: read (swp_order), check (swp_status), propose (swp_propose), delegate (swp_delegate); no approval.

Erweiterungen:Extensions: Claude Code Hook MCP-Server

Wer entscheidetWho decides

Der Mensch, an einem klaren PunktA person, at a clear point

Du genehmigst oder brichst jeden Auftrag ab (swp approve, swp cancel), im eigenen Terminal, nie der Agent. Du legst mit --require fest, ob ohne Auftrag gar nichts geht. Du prüfst Änderungen an swp.orders.json im Review wie jede andere Datei, denn das ist laut Repo der eigentliche Schutz. Du liest die Quittung und entscheidest, was mit dem passiert, was ausserhalb lag.You approve or cancel every order (swp approve, swp cancel) in your own terminal, never the agent. You decide with --require whether nothing may happen without an order. You review changes to swp.orders.json like any other file, which the repo names as the real protection. You read the receipt and decide what happens with anything that was outside.

Im ZusammenspielIn concert

Was SWP mit den anderen verbindetWhat connects SWP with the others

SEP

Der Auftrag sagt, welche neuen Nebenwirkungen erlaubt sind (Arten, Hosts, Personendaten); SEP findet, was der Code seit der Genehmigung neu tut, und die Quittung beurteilt jeden Fund gegen den Auftrag. Ohne SEP sagt die Quittung, dass Nebenwirkungen nicht geprüft wurden.The order says which new side effects are allowed (kinds, hosts, personal data); SEP finds what the code newly does since approval, and the receipt judges each finding against the order. Without SEP the receipt says side effects were not checked.

SLP

Lektionen, die während eines Auftrags in den SLP-Ledger vorgeschlagen wurden, stehen in der Quittung (lessons), damit du siehst, was die KI aus dieser Arbeit behalten will.Lessons proposed to the SLP ledger during an order appear in the receipt (lessons), so you see what the AI wants to keep from this work.

SWELP

swelp init richtet SWP zusammen mit SEP und SLP ein (Auftragsdatei, ein Hook vor und nach jeder Änderung, MCP-Server), swelp hook pre lässt den Auftrag über jeden Tool-Aufruf entscheiden und swelp status zeigt unter «Darf» den offenen Auftrag.swelp init sets SWP up together with SEP and SLP (orders file, one hook before and after every change, MCP servers), swelp hook pre lets the order decide every tool call, and swelp status shows the open order under "May".

SWELPER

Im SWELPER ist jeder Auftrag ein GitHub Issue zur Steuerung und ein SWP-Auftrag im Worktree als erzwingbarer Vertrag; die Landung ist die SWP-Quittung, und swp delegate trägt Albans eine Entscheidung auf Stecker-Agenten weiter.In the SWELPER every order is a GitHub issue for steering and an SWP order in the worktree as the enforceable contract; the landing is the SWP receipt, and swp delegate carries one person's decision on to the worker agents.

Stand und GrenzenStatus and limits

Ehrlich, Stand November 2026Honestly, as of November 2026

Stand:Status: Paket scoped-work-protocol, Version 0.1.0, Spezifikation 0.1 als Entwurf, Reifegrad «Alpha». 18 Testfunktionen mit unittest, keine Laufzeit-Abhängigkeit. Lizenz: proprietär, Copyright 2026 Alban Hyseni, alle Rechte vorbehalten, 30 Tage Evaluation bei gewährtem Zugang (LICENSE, NOTICE). Installation heute: pip install git+https://github.com/BanioX/swelp, dann swp init oder swelp init; das Repo ist privat. Idee und Konzept: Alban Hyseni, 1. November 2026; Umsetzung zusammen mit Claude Code (NOTICE).Package scoped-work-protocol, version 0.1.0, specification 0.1 draft, development status "Alpha". 18 test functions with unittest, no runtime dependency. Licence: proprietary, copyright 2026 Alban Hyseni, all rights reserved, 30-day evaluation with granted access (LICENSE, NOTICE). Install today: pip install git+https://github.com/BanioX/swelp, then swp init or swelp init; the repository is private. Idea and concept: Alban Hyseni, 1 November 2026; implementation written together with Claude Code (NOTICE).

Grenzen:Limits: Der Wächter deckt nur die Werkzeuge des Agenten ab (Dateien ändern, Befehle ausführen); die Programme, die diese Befehle starten, sperrt er nicht ein, dafür ist die Sandbox des Agenten da. Dass swp approve sich im Agenten verweigert, ist eine Bremsschwelle, kein Schloss. Neue Nebenwirkungen werden nur beurteilt, wenn SEP installiert ist. Lesen begrenzt SWP nicht. Als Hook ist heute nur Claude Code belegt. Spezifikation ist Entwurf 0.1; das SWP-Paket steht auf 0.1.0, während das Dach schon 0.2.0 ist und delegate dort im Changelog steht. Geplant laut SWELPER-ADR-0001: SWP 0.2 mit Schema, Feldern deny, gates, ref und später Genehmigung per GitHub-Kommentar; das entscheidet Alban.The guard covers only the agent's own tools (editing files, running commands); it does not sandbox the programs those commands start, that is the agent's sandbox's job. Refusing approval inside an agent is a speed bump, not a lock. New side effects are judged only when SEP is installed. Reading is not limited by SWP. Only Claude Code is documented as a hook today. The specification is draft 0.1; the SWP package is 0.1.0 while the umbrella is 0.2.0 and delegate is listed in that changelog. Planned per SWELPER ADR-0001: SWP 0.2 with a schema, fields deny, gates, ref and later approval via GitHub comment; Alban decides.

LoslegenGet startedZurück zum ZusammenspielBack to how they fit