Repository navigation
Governance layer v1: per-profile permission matrix, HMAC audit, Claude gate (#262) - #1655
Conversation
Co-Authored-By: Claude Opus 5.5 <[email protected]>
#262) Co-Authored-By: Claude Opus 5.5 <[email protected]>
Per-profile policy (tool/bash/write/network rules, deny-wins) on Claude's can_use_tool and re-checked on the card answer, so an edited command is judged as what runs. Write paths canonicalize via realpath and fail closed. Every governed decision lands in an HMAC-chained JSONL audit under userData. Governed threads keep the CLI asking instead of sending Claude session rules that would bypass the matrix. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rofile (#262) One write instead of setProvider/setReasoningEffort/setPermissionMode, so the thread carries agentProfileId and its policy applies. The picker marks the thread's profile row selected. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s clear it (#262) Co-Authored-By: Claude Opus 5.5 <[email protected]>
#262) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…governance-macos-seatbelt-process-wrappe-f8ac1a
…rompts (#262) Also re-attach setWebSearch's doc comment that applyAgentProfile split off. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s-seatbelt-process-wrappe-f8ac1a
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5854d2789e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| function subcommands(command) { | ||
| return command | ||
| .split(/&&|\|\||[;|\n]/) |
There was a problem hiding this comment.
Recognize every shell command separator before allowing
For Bash allow rules, this splitter cannot enforce the stated “every subcommand” condition: normalizeCommand has already collapsed newlines to spaces, and this regex also omits the single & separator. Thus a rule allowing git status auto-allows both git status\nnpm publish and git status & npm publish, because each is treated as one string matching the allowed prefix, so the appended command runs without confirmation. Preserve shell separators during normalization and account for all command separators before accepting an allow match.
Useful? React with 👍 / 👎.
| await onSetReasoningEffort(entry.reasoningEffort, forked.id); | ||
| await onApplyAgentProfile(entry.id, forked.id); | ||
| } | ||
| if (planOnly) await onSetPermissionMode("plan", forked.id); |
There was a problem hiding this comment.
Keep the profile bound when forcing Best of N plan mode
When a user selects a profile and enables Plan only, the preceding onApplyAgentProfile stamps agentProfileId, but this call goes through threads:setPermissionMode, whose new leaveProfile logic immediately clears that ID. The fork's first Claude run therefore has no profile policy, so configured deny/block rules are not enforced. Apply the plan-mode override without treating it as a manual departure from the selected profile.
Useful? React with 👍 / 👎.
| try { | ||
| text = fs.readFileSync(logPath, "utf8"); | ||
| } catch { | ||
| return { ok: true, entries: 0 }; |
There was a problem hiding this comment.
Fail verification when an existing audit log disappears
After at least one audit entry has created the key, deleting or renaming governance-audit.jsonl makes readFileSync throw, but this catch reports ok: true with zero entries. The Advanced UI therefore labels a completely removed audit history as a valid chain, defeating the deletion detection promised by this feature. At minimum, distinguish a genuinely fresh installation from a missing log when the audit key already exists, and return failure for other read errors.
Useful? React with 👍 / 👎.
| services.setRoute(ctx.store, { threadId: input.threadId, route: null }); | ||
| const updated = services.applyAgentProfile(ctx.store, input); |
There was a problem hiding this comment.
Validate the profile before clearing the pending route
If the renderer submits a stale or deleted profile ID while the thread has a pending Auto route, this call saves route: null before applyAgentProfile validates the ID and throws. The failed operation therefore still mutates the thread, contrary to the API contract that an unknown profile is rejected before anything changes. Validate/apply the profile first, or perform the route clearing and profile update atomically.
Useful? React with 👍 / 👎.
The renderer dropped its own snap when it moved to applyAgentProfile. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolve against multi-folder projects (#514): the governance allow answers first; the granted-secondary-folder auto-allow no longer overrides a profile ask rule; folderGrant and guardrail.layer both ride PendingPermissionInfo. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… egress (#803) (#1656) * Seatbelt wrap for governed local CLIs: compiled writes, proxied egress (#803) On macOS, a local thread whose agent profile has write or network rules spawns its CLI (every provider) under sandbox-exec. Writes are denied outside the worktree, its git common dir (hooks excluded), tmp, /dev, CLI config homes and allow/ask write paths; deny/block write rules are carved back out. Network rules deny outbound IP except loopback and route HTTP(S)_PROXY through a host-filtering proxy that knows the thread from the proxy URL's userinfo. Every deny rule is tagged solenta:<threadId>, so a log-stream follower audits kernel denials as layer seatbelt and flags matrix-allow / Seatbelt-deny disagreements. Anything that cannot be canonicalized or compiled refuses the run instead of spawning unconfined. sandbox.js reports the wrap with the same predicate the runner uses. Co-Authored-By: Claude Opus 5.5 <[email protected]> * Seatbelt tests: keep Stores in tmp so exit flushes cannot litter $HOME (#803) Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Willem <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
Implements the governance layer v1 from
docs/superpowers/specs/2026-09-02-governance-layer-v1-design.md. #262 was closed when only the spec merged (23e8bd9), so none of this was on main. It's the prerequisite for #803 (Seatbelt), which follows as a stacked PR.What it does
AgentProfile.policyholdsdefaultAction(ask/allow) plus up to 40 rules. Each rule has a kind (tool/bash/write/network), a case-insensitive glob, and an action (block/deny/ask/allow). Every matching rule is collected and the most severe action decides.can_use_tool, after Orchestrator-owned guardrails: protected config, spawn-time hook packs, memory-write scanning #409. A deny is answered with no card and aGovernance blocked …transcript event. An allow is answered with no card. An ask shows the card with areason (layer / rule)strip.Blocked by policy (layer)). This applies to every Claude thread, so editing a command tosudo …can no longer slip past Orchestrator-owned guardrails: protected config, spawn-time hook packs, memory-write scanning #409.layer: normalize, and any evaluator exception is a visible deny.governance-audit.jsonlplus a0600key under userData;layer,decisionandactionHashare signed. Settings → Advanced shows the last 50 rows and a Verify chain button. Secrets are redacted before writing, even when guardrails are off.threads.applyAgentProfileapplies the full profile snapshot and stampsagentProfileId. Manual provider, effort or permission picks clear it. A fork copies it only while it stays on the profile's provider. Routing (Model routing: pick provider/model per task by complexity and cost #246), issue starts and Best of N go through the same path.· N rulessummary, Allow always hidden onprofile.ask, and the picker shows the applied profile.Deliberate deviations from the spec
npm publishmatchescd x && npm publish --tag y. Anallowmust cover every subcommand and never covers$(…)or backticks.actionHashfor the run and does not send ClaudeaddRules. A Claude session rule stopscan_use_toolfor that tool, which would silently bypass the matrix afterwards.Not covered (by design)
acceptEditsandbypassPermissionsskip the prompt, and so do allow lists in~/.claudeor.claude/settings.json. The profile form says this. Closing the gap is Governance: macOS Seatbelt process wrapper #803.Tests
governance.test.js(normalize, symlinks, ELOOP fail-closed, precedence),governance-audit.test.js(tampering),governance-runner.test.js(fake Claude seam),governance-store.test.js(heal, fork rule, IPC clear). Settings, permission card, composer and profile-row renderer tests are extended.CODER_*, node-only PATH):test:electron: 4825 pass, 0 fail.npm run typecheckandnpx vite buildare clean.Refs #262, unblocks #803.
🤖 Generated with Claude Code