feat(mcp): let agents run checks on staged files only #1640
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.47) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.47 · 499 lines diff across 6 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.372
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #1640"
general
weight: 0.35
jdx
<!-- entire-trail-link-start -->
https://entire.io/gh/jdx/hk/trails/216
<!-- entire-trail-link-end -->
Stacked on #1600; this PR will retarget to
mainwhen that merges.What this adds
An agent using hk's MCP tools can now check just the files staged in the index, which is what a pre-commit hook would check, before it commits:
start_check,start_safe_checkandstart_safe_fixacceptstagedalongsideall(default),changedandunstaged. With filesstaged.txt(edit staged) andunstaged.txt(edit not staged),scope: "staged"runs steps onstaged.txtonly. The scope maps tohk --staged.Details
stagedruns without stashing, likechanged, so a staged file that also has unstaged edits is checked as it is in the working tree.HK_STASH_UNTRACKED=0only affectschangedandunstaged; untracked files are never staged, sostagedis unaffected. The docs say so.scopeJSON schema and tool description list the new value, and the rejection message for an unknown scope now listsstaged. The dashboard does not show scope, so it needed no change.docs/agents.mdand the sea shanty variantdocs/pirate/agents.md(restamped).Validation
cargo fmt --check,cargo clippy --all-targets -- -D warnings,cargo test mcp(26 passed).test/mcp_scope.batsdrives a realhk mcpover stdio: a staged-only check sees the staged edit and ignores an unstaged edit and an untracked file;unstagedstill skips the staged file. Ran 2/2okwith the default andHK_LIBGIT2=0. The nogit variant and CI were not run locally, and GNU parallel is not installed here, so I ranbatsdirectly rather than throughmise run test:bats.aube run pirate check agents.mdpasses.--stageddisabling stashing insrc/hook.rs; no test covers it.🤖 Generated with Claude Code
AI-assisted — Tool: Claude Code; model: anthropic/claude-sonnet-5-5; version: unavailable.
<!-- CURSOR_SUMMARY -->
---
<!-- /CURSOR_SUMMARY -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
Summary by CodeRabbit
New Features
MCP checks now support a
stagedscope to select files that have been added to the index.Staged checks inspect each selected file’s current working-tree contents, including any unstaged edits to that file.
changedandstagedchecks run without stashing changes.<!-- end of auto-generated comment: release notes by coderabbit.ai -->