Repository navigation
feat: self-checking /work — spec-diff verifier + scope-bound allowlist (#2) - #3
Merged
Merged
Conversation
#2) Adds a default profile `balanced+self-checking` that removes the dispatch-review gate as a blocking step and replaces it with two automated safeguards: - §4.5 scope-arm: `loom scope-arm <ISSUE>` writes a fire-scoped allowlist derived from the Linear issue's `## Scope` section. Tier 1 hooks read the marker and allow in-scope tool calls without prompting, while blocking out-of-scope writes with `scope-exceeded:<path>`. - §5.5 diff-verify: `loom diff-verify <ISSUE>` walks `git diff --name-only main...HEAD` against the allowlist + collateral rules before the PR opens. Out-of-scope files halt with `scope-exceeded`; feature branch persists for human triage. The existing dispatch-review gate stays available behind `profile: paranoid` for ambiguous fires. Global Tier 1 blocklist is unchanged — scope-allow only opens a window inside it. Closes #2. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
Implements issue #2: adds a default
balanced+self-checkingprofile that replaces the human dispatch-review gate with two automated safeguards.loom scope-arm <ISSUE>parses the Linear issue's## Scopesection (or**Files:**callout, or fenced ```files block) into a fire-scoped allowlist at~/.loom/fires/<ISSUE>/scope.json. Tier 1 hooks honor the allowlist: in-scope writes don't prompt, out-of-scope writes block with `scope-exceeded:`, and `bashAllow`-matching commands are pre-approved.loom diff-verify <ISSUE>walksgit diff --name-only main...HEADagainstscope.jsonplus hardcoded collateral rules (README in same workspace, barrelindex.ts, mirrored test files). Out-of-scope files exit6with the offending list; feature branch persists for human triage.The legacy dispatch-review gate stays available behind
pipeline.profile = paranoid. Global Tier 1 blocklist is unchanged — scope-allow only opens a window inside it (e.g. an in-scopeCLAUDE.mdis still blocked by the global rule).Profile split
balanced+self-checking(new default for self-checking flow)paranoidbalanced+paranoid-step-3(legacy default)balancedaggressiveNew files
packages/cli/src/spec-scope.ts—extractScope()parser (217 LOC)packages/cli/src/commands/scope-arm.ts— writes scope.json (63 LOC)packages/cli/src/commands/scope-disarm.ts— deletes scope.json (43 LOC)packages/cli/src/commands/diff-verify.ts— diff walker + collateral rules (206 LOC)packages/cli/tests/spec-scope.test.ts— 12 parser tests (157 LOC)packages/cli/tests/commands.scope.test.ts— 20 scope-arm/disarm/diff-verify tests (282 LOC)Modified files
packages/cli/src/hooks/predicates.ts—checkPathandcheckBashnow read scope.json (testable seam:scopeDirarg). New helpers:readActiveScope,matchesGlob. Global blocklist still wins above scope-allow.packages/cli/src/config/load.ts— adds'balanced+self-checking'to theLoomProfileunion andDEFAULT_BASH_ALLOWconstant.packages/cli/src/runtime-config.ts— same addition toProfileName+PROFILESmap (dispatch off, merge on).packages/cli/src/clients/git-cli.ts+src/probe.ts— addsdiffNamesAgainstMain()to theGitClientinterface.packages/cli/src/clients/linear-api.ts— addsgetIssueDescription(issueId)to theExtendedLinearClient.packages/cli/bin/loom.ts— wiresscope-arm,scope-disarm,diff-verifysubcommands. New exit code6forscope-exceeded.packages/cli/src/commands/index.ts+src/index.ts— exports.packages/cli/tests/{hooks,commands,probe,runtime-config,preflight.integration}.test.ts— mocks updated for the newGitClientmethod + new profile; 22 new scope-aware test cases inhooks.test.ts.skills/work/SKILL.md— §4 dispatch-review gated behindparanoid; new §4.5 scope-arm + §5.5 diff-verify; §7 cleanup runsscope-disarm.docs/dispatch-gate.md— rewritten around the profile matrix.README.md— flow ASCII updated; CLI reference table updated.Acceptance (per issue #2)
loom scope-arm <ISSUE>writes the fire marker;loom scope-disarmcleans it up (verified by smoke run + 8 unit tests).Writeto an in-scope path with scope.json armed → hook returnsok(verified bycheckPath — scope-aware additive allow > allows in-scope writes).Writeto an out-of-scope path → hook returnsscope-exceeded:<path>(verified byblocks out-of-scope writes).loom diff-verify <ISSUE>exits 0 on clean diff, exits 6 with JSON payload on out-of-scope (verified bydiff-verifytests + bin handler).npm run typecheck,npm test,npm run buildall green.global blocklist still wins for in-scope but globally-blocked paths).Test plan
npm run typecheck— cleannpm test— 199 passed (12 files: 10 existing + 2 new)npm run build— emitsdist/cleanlyloom scope-arm TEST-1 --from-description issue.mdwrites valid JSONloom scope-disarm TEST-1deletes the marker + parent dir/workon a small well-specced consumer-repo issue with the new default profile (deferred to post-merge — needs a real consumer repo + Linear issue)./workwith a deliberately out-of-scope file write; confirm halt at §5.5 withscope-exceeded.Closes #2.
🤖 Generated with Claude Code