Repository navigation
feat(hook): add Muse plugin integration with conservative policy guard - #4931
Open
superbiche wants to merge 1 commit into
Open
superbiche wants to merge 1 commit into
superbiche wants to merge 1 commit into
Conversation
📊 Automated PR Analysis
SummaryAdds a new agent integration for Muse Code, including Review Checklist
Linked issues: #4917 Analyzed automatically by wshm · This is an automated analysis, not a human review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add
rtk hook muse, a conservative approval-policy overlay, andrtk init --agent muse. Installed-plugin detection feedsinit --showand thehook-warning probe;
hook check --agent muse <cmd>is the rewrite dry-run.The hook accepts fixture
Bashand nativebashtool names, preservestool-input metadata and emits only Claude-shaped
hookSpecificOutputwithhookEventNameandupdatedInput. It never emits anallow decision or installs permission rules.
Measured Muse contract
Muse Code 1.4.14 (1.4.14-R7309.1):
updatedInput, exit 0rewrite_selectedpermissionDecision: allowdecision: blockwithout reason, exit 0Twenty-three native approval-policy cases established schema-2 strictness,
argv-prefix matching scoped to the exact session workspace root, global
exact-raw matching, deny precedence and per-stage compound-command approval.
Measured under
--approval-mode untrusted, contributor mode on, under Muse'sno-named-profile fallback and under an explicit
:ask-meprofile(
permissions.schema_version: 1). Both settings shapes are accepted.Other profiles,
on-requestand session profile overrides are unmeasured anddefer where detectable.
Policy boundary
RTK steps aside whenever any persisted Muse rule names either the original or
the rewritten command; it never arbitrates scope or effect. Prefix matching
checks every plain-word stage at every workspace root. Exact-raw matching checks
raw, trimmed and whitespace-normalised whole commands and all stages on both
sides. Stages that start with a wrapper RTK itself peels (
timeout,time,nice,nohup,stdbuf,env,sudo,command,exec,builtin,noglob,nocorrect,xargs, shells) defer when rules exist. This avoids relyingon unmeasured exact-raw compound/whitespace semantics or equating hook cwd with
session root. Missing policy and empty rule lists retain normal rewriting.
Malformed policies, unknown fields/rules/profiles and complex syntax with rules
present defer. Carriage returns always defer.
Muse strips XDG variables from hook subprocesses: the hook reads
$HOME/.config/muse. A shell dry-run with a differentXDG_CONFIG_HOMEtreatspolicy as unknown and passes through; custom XDG activation remains unqualified.
Installation
rtk init --agent musegenerates.rtk/muse-plugin;-ggenerates a userbundle. The Agent Plugins 1.0.0 bundle contains
.claude-plugin/plugin.jsonandhooks/hooks.json(PreToolUse/Bash,rtk hook muse, timeout 10 seconds).Init prints
muse plugins install <bundle> --scope project|userandmuse plugins approve rtk. RTK never invokes Muse or grants plugin trust.--show,--dry-run, and--uninstallcover the generated bundle; uninstallprints the separate Muse removal command and leaves installed copies alone.
Detection reports enabled installation, not capability approval. No awareness
rules are shipped because their consumption remains unqualified.
Test plan
plus review regressions for workspace roots, exact raw whitespace/compounds,
both settings shapes, XDG mismatch and shell boundaries.
bashhookfixtures: no policy, same-root and unrelated-root prefix rules, whole-compound
exact-raw rule, CR input, and no-policy compound.
muse execruns against Muse Code 1.4.14 with the generated bundleinstalled and approved in disposable homes. Six implementer runs established the native hook
envelope (
tool_name: "bash",cwd= session workspace root) and exposed a renderer that onlyaccepted the fixture's
Bash; that is fixed and the captured envelope is replayed in a regressiontest. Three runs on the round-2 binary (628c27c8; the renderer is unchanged since and
the comparator change only adds pass-throughs): with no policy the hook rewrites and Muse executes the
rewritten command; with a persisted
[git, status]allow (prefix) or a global exact-raw allow forgit status, the hook passes through and Muse runs the original under its ownallow:policydecision, so the user's verdict is preserved.
and unchanged Cargo.lock checked locally.
Closes #4917
@superbiche · user · drafted with GPT 6.1 Sol and Claude Fable 5.1, reviewed before posting; the voice and decisions are mine.