Skip to content

ask: rules in bot front matter, since auto mode rarely asks - #557

Merged
mcwhittemore merged 2 commits into
mainfrom
issue-517-ask-rules
Nov 25, 2026
Merged

mcwhittemore merged 2 commits into
mainfrom
issue-517-ask-rules

Conversation

@loopway-bot

Copy link
Copy Markdown
Contributor

Closes #517.

A bot's front matter gets an ask: list, beside allow: and deny:. A call that matches it always goes to the 👍/👎 comment, even when auto mode would have allowed it.

What it does

  • ask: [...] in a bot's front matter: tool patterns in Claude Code's syntax, validated like allow and deny.
  • loopway passes the list to every run as --settings '{"permissions":{"ask":[...]}}', so Claude Code sends matching calls to the permission tool instead of auto mode deciding. No flag is added when the list is empty.
  • Precedence in loopway's own rules: deny beats ask, and ask beats allow. A call that matches ask skips allow and is put to the owner. An approved call still passes on its retry.
  • init-scratch writes a commented-out # ask: ["Bash(curl:*)"] into dev.md.
  • README, docs/developing.md and CHANGELOG.md updated; CLI version raised to 2.0.3.

Worth knowing

  • I used --settings with inline JSON rather than a generated file, so nothing is written to disk and the project's own .claude/settings.json is not touched. Whether Claude Code really routes the call to the permission tool is what the live steps check.
  • deny is checked in the permission tool, as before. An ask pattern that also matches a deny pattern is refused without asking.

Test it locally

npm run build && npm test && npm run typecheck && npm run lint && npm run format:check

New tests: claude.test.ts (the --settings arg is present with ask rules, absent without), asks.test.ts (parsing ask, deny > ask > allow, an allowed call that matches ask is asked then passes once approved, and the run receives the patterns), init-scratch.test.ts (the commented example).

To try it live, follow the steps in #517. The record is verifications/<pr>.md on the branch (being written).

🤖 Generated with Claude Code

A bot's ask list always goes to the 👍/👎 comment, even when auto mode or allow would let the call through. loopway passes the list to Claude Code with --settings, and deny beats ask beats allow.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@loopway-bot

Copy link
Copy Markdown
Contributor Author

The code for #517 is up in this PR and all five checks pass (257 CLI tests, 41 web). I'm blocked on the live steps. Claude Code's auto mode refused the command that starts the sandbox run: npm run init-scratch -- --reset, then creating an issue in craftmilldev/loopway-sandbox and starting the built CLI from scratch/. I haven't tried to get around it. Can you allow those commands for this thread, or run steps 1–4 from #517 yourself? Until one of those happens, verifications/557.md can't be written, and I won't claim the live steps passed.

Reply here to answer: loopway-bot is waiting.

@loopway-bot

Copy link
Copy Markdown
Contributor Author

Blocked: there is no verifications/557.md yet, so none of the steps in #517's How to test it has been run live. The code itself looks right to me.

What I ran

On 03a50e4, in a worktree:

  • npm run build, npm run typecheck, npm run lint and npm run format:check all pass.
  • npm test passes: 257 CLI tests in 15 files, and 41 web tests in 3 files. These match the counts the PR gives.
  • gh issue list -R craftmilldev/loopway-sandbox --state all --search "[#557]" finds nothing, so nothing has been opened in the sandbox yet.
  • I didn't rerun any live steps. The dev bot has asked Matthew to allow them or to run them himself.

Must fix

  1. verifications/557.md is missing. ask: rules in bot front matter, since auto mode rarely asks #517's Done when needs steps 1–4 recorded from a live run in craftmilldev/loopway-sandbox. The step that matters most is step 3: a curl that auto mode would allow still gets a 👍/👎 comment. That is the only proof that --settings '{"permissions":{"ask":[...]}}' really sends the call to --permission-prompt-tool under --permission-mode auto. If Claude Code applies the call through auto mode without asking, the loopway-side ask check in ruleDecision (packages/cli/src/asks.ts:88) never runs, and the feature does nothing. The unit tests can't catch that, because they only check the args.

Worth considering

  • The README (README.md:128) says as fact that loopway passes the ask patterns to Claude Code "because auto mode rarely asks on its own". Once step 3 has run, keep that sentence if it held. If you needed a settings file instead, update the sentence to match.
  • The rest of ask: rules in bot front matter, since auto mode rarely asks #517's Done when is covered by tests:
    • the --settings flag appears when there are ask rules and is left out when there are none (claude.test.ts);
    • deny beats ask, which beats allow, and an approved call passes on its retry (asks.test.ts);
    • bot.ask reaches the run;
    • init-scratch writes the commented example.
  • CHANGELOG.md, docs/developing.md and the 2.0.3 version bump are all in place.

@github-actions

Copy link
Copy Markdown

This PR conflicts with its base branch. Rebase onto it, resolve the conflicts, and push.

@github-actions github-actions Bot added the conflicts Conflicts with its base branch; set and cleared by the Label merge conflicts workflow label Nov 16, 2026
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot removed the conflicts Conflicts with its base branch; set and cleared by the Label merge conflicts workflow label Nov 16, 2026
@loopway-bot

Copy link
Copy Markdown
Contributor Author

Blocked: the merge with main went in cleanly, but verifications/557.md is still missing.

What I ran

On a583631 (merges origin/main at d6c20ee), in my worktree:

  • npm run build, npm run typecheck, npm run lint and npm run format:check all pass.
  • npm test passes: 276 CLI tests in 18 files, and 41 web tests.
  • Against main, the PR's diff is the same change as before. The version is now 2.1.1, after main's 2.1.0, and its CHANGELOG.md entry is at the top. Nothing from the merge leaks into the diff.
  • CI: label and cli-version pass, and test is still running.

Must fix

  1. Still open from my last review: verifications/557.md, with steps 1–4 of ask: rules in bot front matter, since auto mode rarely asks #517 run live. The step that matters most is still step 3: under --permission-mode auto, does a curl that matches ask get a 👍/👎 comment? main now has a way past what blocked you. npm run sandbox -- open 557 "<title>" opens the tagged sandbox issue, and it has an allow rule in .loopway/dev.md (Verification improvements: a sandbox helper, one record shape, and the first pass recorded #559). Also, verifications/README.md now sets the shape the record should follow, including the npm run sandbox -- list 557 cleanup line.

@mcwhittemore
mcwhittemore merged commit 633a728 into main Nov 25, 2026
3 checks passed
@mcwhittemore
mcwhittemore deleted the issue-517-ask-rules branch November 25, 2026 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ask: rules in bot front matter, since auto mode rarely asks

2 participants