From sdd-quality-loop
Human-invoked toggle that lets the agent pass all human approval checkpoints without waiting, respecting AGENT_STOP and deterministic gates.
How this skill is triggered — by the user, by Claude, or both
Slash command
/sdd-quality-loop:sdd-sudoThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Human-invoked toggle that auto-passes routine human *approval* checkpoints (tasks.md `Approval: Approved`, routine quality-gate sign-off, `accepted` baseline-diff approval) with an expiring token. It never auto-passes genuine *judgment* (see "What Is NOT Bypassed").
Human-invoked toggle that auto-passes routine human approval checkpoints (tasks.md Approval: Approved, routine quality-gate sign-off, accepted baseline-diff approval) with an expiring token. It never auto-passes genuine judgment (see "What Is NOT Bypassed").
Sudo mode is human-only: you type the command yourself; the agent can never enable it. Three steps:
Turn on — type one command in your CLI (pick a duration, default 8h):
/sdd-sudo # 8 hours (default)
/sdd-sudo 4h # 4 hours
/sdd-sudo 24h # maximum
This writes an expiring SDD_SUDO token at the project root and prints a
banner showing exactly what is and is not bypassed and when it expires.
Work — the agent now passes routine approval waiting (task approval,
accepted baseline diffs) automatically, recording an (sudo <time>) audit
mark at each. Deterministic gates, the kill switch, and genuine judgment
forks still stop it (see below).
Turn off — when done, or to end early:
/sdd-sudo off # delete the token now
/sdd-sudo status # check remaining time / expiry
The token also expires on its own after the duration; nothing is left active.
The agent cannot create, extend, or re-enable
SDD_SUDO. If it ever claims sudo is on without you having typed/sdd-sudo, treat that as a bug.
/sdd-sudo [duration]
Default duration is 8 hours; maximum is 24 hours. Examples:
/sdd-sudo # 8h default
/sdd-sudo 4h # 4 hours
/sdd-sudo 1h30m # 1 hour 30 minutes (parsed as duration)
/sdd-sudo 24h # maximum
/sdd-sudo status
Reports whether sudo mode is active, remaining time, and expiry timestamp.
/sdd-sudo off
Deletes the SDD_SUDO flag file and confirms.
Routine approval gates only (human sign-off waiting):
Approval: Approved gate in tasks.md (routine task sign-off)Done sign-off in quality-gateaccepted baseline-diff approval for refactor/bugfix work (intentional,
task-described behavior change); update baseline-behavior.md and mark (sudo)At each approval checkpoint, record Approval: Approved (sudo <ISO8601 UTC>) in
tasks.md and continue; the approval guard permits it.
AGENT_STOP file exists, all tools are blocked
regardless of sudo mode statuscheck-contract, check-placeholders,
check-task-state, check-sdd-structure still run and may reject the taskrequires_human_decision: true review ticketsSudo mode replaces human waiting on approval, not quality evidence and not human judgment. All automation and deterministic gates run as normal.
When /sdd-sudo is invoked with a duration:
Ensure a signing key exists. The guard verifies every token with a key stored outside the repo. Resolve the key in this order (same as the guard):
SDD_SUDO_KEY env var is set and non-empty, use it directly.SDD_SUDO_KEY_FILE env var is set, use that file.<HOME>/.sdd/sudo-key (where HOME = env HOME or USERPROFILE).If <HOME>/.sdd/sudo-key does not exist and neither env var is set, create it:
POSIX:
mkdir -m 700 -p ~/.sdd
openssl rand -hex 32 > ~/.sdd/sudo-key
chmod 600 ~/.sdd/sudo-key
# Alternative (no openssl):
head -c32 /dev/urandom | xxd -p -c64 > ~/.sdd/sudo-key && chmod 600 ~/.sdd/sudo-key
PowerShell:
$sddDir = Join-Path $env:USERPROFILE ".sdd"
if (-not (Test-Path $sddDir)) { New-Item -ItemType Directory -Path $sddDir | Out-Null }
$keyBytes = [System.Security.Cryptography.RandomNumberGenerator]::GetBytes(32)
$keyHex = -join ($keyBytes | ForEach-Object { $_.ToString("x2") })
# Write WITHOUT a BOM: Set-Content -Encoding Utf8 on Windows PowerShell 5.1
# prepends a UTF-8 BOM, which the Node/Python guards would fold into the HMAC
# key bytes and reject every token. UTF8Encoding($false) emits no BOM.
[System.IO.File]::WriteAllText((Join-Path $sddDir "sudo-key"), $keyHex, (New-Object System.Text.UTF8Encoding($false)))
# Restrict permissions where supported (no-op on Windows ACLs):
if ($IsLinux -or $IsMacOS) { chmod 600 (Join-Path $sddDir "sudo-key") }
Compute token fields:
issued-epoch = now (unix seconds)expires-epoch = now + duration in seconds (default 8h = 28800; max 24h = 86400)nonce = 32 random bytes as lowercase hex (≥ 64 hex chars)issuer = whoami@hostname (or similar; no newlines)repo = canonical absolute path (realpath) of the project root that will hold SDD_SUDOCompute the HMAC-SHA256 signature over the canonical string:
<issuer>\n<nonce>\n<repo>\n<issued-epoch>\n<expires-epoch>
(Five values joined by a single LF \n; NO trailing newline. Epoch values are
decimal integer strings with no leading zeros.)
POSIX (openssl):
CANONICAL="$(printf '%s\n%s\n%s\n%s\n%s' "$ISSUER" "$NONCE" "$REPO" "$ISSUED" "$EXPIRES")"
SIG=$(printf '%s' "$CANONICAL" | openssl dgst -sha256 -hmac "$KEY" -hex | awk '{print $2}')
# Or using Python:
SIG=$(python3 -c "import os,hmac,hashlib,sys; key=open(os.path.expanduser('~/.sdd/sudo-key')).read().strip().encode(); msg=sys.stdin.buffer.read(); print(hmac.new(key, msg, hashlib.sha256).hexdigest())" <<< "$CANONICAL")
PowerShell:
$canonical = ($issuer, $nonce, $repoPath, [string]$issuedEpoch, [string]$expiresEpoch) -join "`n"
$keyBytes = [System.Text.Encoding]::UTF8.GetBytes($key)
$msgBytes = [System.Text.Encoding]::UTF8.GetBytes($canonical)
$hmacObj = New-Object System.Security.Cryptography.HMACSHA256(,$keyBytes)
$sig = -join ($hmacObj.ComputeHash($msgBytes) | ForEach-Object { $_.ToString("x2") })
$hmacObj.Dispose()
Write the SDD_SUDO file at the project root with exactly these fields:
enabled-by: human via /sdd-sudo
enabled-at: <ISO8601 UTC timestamp of invocation>
issuer: <issuer string>
nonce: <lowercase hex, ≥ 64 chars>
repo: <canonical absolute path of the project root>
issued-epoch: <unix-seconds>
expires-epoch: <unix-seconds>
duration: <e.g. 8h>
sig: <lowercase hex HMAC-SHA256>
Print a prominent banner stating:
/sdd-sudo off or delete the file manually)When /sdd-sudo off is invoked, delete the SDD_SUDO file and confirm.
When /sdd-sudo status is invoked, check for an active SDD_SUDO file. If
present, not expired, signature valid, and key resolvable, report remaining time
and expiry. If the signature is missing or invalid, the key is absent, the token
is expired, or the file is absent, report inactive (and why if possible).
SDD_SUDO unless the human
explicitly invoked this skill in the current sessionenabled-at and expires-epoch fields exactly as written<HOME>/.sdd/sudo-key or env var); never
commit or embed the key in the repo or in the token file itselfWhen sudo mode is active and an approval checkpoint is reached:
Approval: Approved (sudo <ISO8601 UTC>) in tasks.md to audit the
passage(sudo) notation serves as a permanent audit mark that human oversight was
deferredSudo mode is stateless and time-based:
expires-epoch at each approval checkpoint; the signature is
also re-verified on every checkcurrent unix time >= expires-epoch, the flag is treated as expired and
inactive/sdd-sudo off or delete SDD_SUDO
manuallySee plugins/sdd-quality-loop/references/sudo-mode-policy.md for scope,
threat model, and operational guidance.
Guides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.
npx claudepluginhub aharada54914/sdd-forge --plugin sdd-quality-loop