Skip to content

cat-mode-default applies on every prompt, with no regex guess - #502

Merged
mergify[bot] merged 8 commits into
mainfrom
plan/cat-mode-default-applies-on-every-prompt-with-no-regex-guess
Sep 13, 2026
Merged

cat-mode-default applies on every prompt, with no regex guess#502
mergify[bot] merged 8 commits into
mainfrom
plan/cat-mode-default-applies-on-every-prompt-with-no-regex-guess

Conversation

@EdbertChan

@EdbertChan EdbertChan commented Sep 12, 2026

Copy link
Copy Markdown
Owner

Summary

The default context now reaches every user prompt when enabled, including acknowledgements and short execution turns.

Previously, a word list and length check guessed which prompts counted as work, so short execution turns were skipped.

The hook now uses one fixed exception: a prompt containing the typed command receives no extra context.

The flag-off path remains silent, and the documentation describes the every-prompt behavior.

Review Claim

When enabled, every prompt receives the default context unless it already contains the typed command; disabled mode remains silent.

Review Lane

behavior

Review Unit

engine-runtime

Safety Invariant

The change is limited to one hook's decision rule, its entrypoint tests, and aligned documentation. The agent-tool companion, flag resolution, and injected text remain unchanged.

Slice Rationale

This is one review claim in one hook. The decision-rule and documentation changes stay together because the documentation records the shipped behavior.

Non-goals

  • No change to the agent-tool companion.
  • No change to flag resolution or injected text.
  • No corpus skill edits.

Architecture

Before

graph TD
    A["User prompt"] --> B["Meaning classifier"]
    B -->|"work prompt"| C["Default context"]
    B -->|"acknowledgement or short turn"| D["Silent"]
Loading

After

graph TD
    A["User prompt"] --> B["Typed /cat-mode present?"]
    B -->|"yes"| C["Silent"]
    B -->|"no, flag on"| D["Default context"]
    B -->|"no, flag off"| C
Loading

Test Plan

Test Plan
  • python3 scripts/check_hook_test_coverage.py engine/hooks/cat-mode-default
  • bash scripts/run_all_tests.sh
  • ! git grep -n -e is_work_prompt -e WORK_VERB -e MIN_WORK_LENGTH -- engine tests
  • bash scripts/scrub-handoff-artifacts.sh

Revert Plan

Revert Plan
  • Safe to revert? Yes.
  • Revert command: git revert <merge-sha>
  • Post-revert steps: Re-run the hook coverage gate and repository test suite.
  • Data migration? No.

Note

Medium Risk
Broadens when cat-mode context is injected on every user turn when the flag is on, which may change agent behavior on casual or meta prompts; scope is limited to one hook’s decision logic with tests updated accordingly.

Overview
When CATSTACK_CAT_MODE_DEFAULT=1, the cat-mode-default UserPromptSubmit hook now injects the cat-mode context on every user prompt instead of only prompts classified as “work” via length, acknowledgement lists, and work-verb regex.

The only skip rule left is a typed /cat-mode in the prompt (unchanged double-apply guard). Short replies like ok, bare slash commands, and brief execution turns now get the same default injection as long investigation prompts. Flag resolution, injected text, and the Agent PreToolUse companion are unchanged.

Implementation drops is_work_prompt and related heuristics from detect.py; tests and fixtures flip acknowledgement scenarios from silent to fires, add a prompt matrix, and docs (README, docs/ecosystem.md) describe the every-prompt behavior.

Reviewed by Cursor Bugbot for commit 9c44345. Bugbot is set up for automated code reviews on this repo. Configure here.

EdbertChan and others added 8 commits September 12, 2026 12:13
…t-mode-default injects on every prompt when the flag is on, except a prompt containing a typed /cat-mode, and the regex classifier is gone.

Review lane: behavior
Safety invariant: With the flag on, every prompt gets cat-mode unless it already contains `/cat-mode`; with the flag off, no prompt gets it; nothing guesses meaning with regex.
Effectiveness measurement: Entrypoint tests on six prompts with the flag on and off assert inject or silent for each.
Slice rationale: A single hook's decision rule, reviewable alone.
Architectural effect: cat-mode context reaches acknowledgement and short execution turns too; the Agent-tool companion is unchanged.
Goal: Remove ACKS, WORK_VERBS, WORK_VERB_RE, MIN_WORK_LENGTH and is_work_prompt, and update the tests.
Motivation: The regex skips execution turns like "yes do it".
Alternative considerations: A background llm-judge was rejected because its verdict arrives on the next prompt; a blocking judge was rejected because the user's standing rule is never block on the judge.
Implementation details: decide() returns the context whenever the flag is on, apart from a typed /cat-mode, which stays because a slash command is a fixed machine format.
Non-goals: No change to the Agent-tool companion (agent_updated_input, mentions_cat_mode), flag resolution, or the injected text; no corpus/ skill edits.
Layer: domain
Feature state: active
Files:
- engine/hooks/cat-mode-default/detect.py
- engine/hooks/cat-mode-default/tests/test_hooks.py
- engine/hooks/cat-mode-default/tests/fixtures/
Change types:
- engine/hooks/cat-mode-default/detect.py: modify
- engine/hooks/cat-mode-default/tests/test_hooks.py: modify
- engine/hooks/cat-mode-default/tests/fixtures/: modify
Acceptance criteria:
- `python3 -m unittest discover -s engine/hooks/cat-mode-default/tests -v` exits 0.
- `python3 scripts/check_hook_test_coverage.py engine/hooks/cat-mode-default` exits 0.
- `git grep -n -e is_work_prompt -e WORK_VERB -e MIN_WORK_LENGTH -- engine tests` prints nothing.

Exit code: 0
…gine/hooks/cat-mode-default/README.md and the docs/ecosystem.md row say cat-mode applies on every prompt when the flag is on.

Review lane: docs
Safety invariant: Only the two Markdown files change; no code, test, or config file is edited.
Effectiveness measurement: `git grep -n "work turns" -- docs engine/hooks/cat-mode-default` prints nothing after the change.
Slice rationale: Prose in its own commit so the code commit stays one claim.
Architectural effect: None; prose only.
Goal: Replace the work-prompt wording with the every-prompt rule.
Motivation: The README and ecosystem table would otherwise describe the old classifier.
Alternative considerations: Code comments were rejected; the repo forbids new comments.
Implementation details: Two Markdown edits.
Non-goals: No code, test, or config edits; nothing under corpus/.
Layer: docs
Feature state: active
Files:
- engine/hooks/cat-mode-default/README.md
- docs/ecosystem.md
Change types:
- engine/hooks/cat-mode-default/README.md: docs-only
- docs/ecosystem.md: docs-only
Acceptance criteria:
- `git grep -n "work turns" -- docs engine/hooks/cat-mode-default` prints nothing.

Exit code: 0
Invoker-Finalize-Id: 5442b6e5-293e-443f-84aa-52f0fe0d0135
…aim: The cat-mode-default tests, its coverage gate, and the repo suite pass, and no classifier symbol remains.

Review lane: proof
Safety invariant: Verification is read-only and does not alter any repository file.
Effectiveness measurement: The commands are the direct measurement.
Slice rationale: One focused proof before review.
Architectural effect: None; verification only.
Goal: Prove every-prompt injection and flag-off silence.
Motivation: Running the tests is the proof.
Alternative considerations: The full suite catches consumers of deleted symbols elsewhere.
Implementation details: Run the coverage gate, the suite (which discovers the hook tests), and the grep.
Non-goals: No mutations.
Layer: app_regression
Feature state: active
Acceptance criteria:
- Exits 0 only when all pass and the grep finds nothing.

Exit code: 0
Invoker-Finalize-Id: fdb51ec8-9875-493c-8a43-052107f958b5
…No ephemeral inter-task handoff files remain in the worktree before the merge gate.

Review lane: cleanup
Safety invariant: The scrub script only checks for known handoff artifact names and never touches source, tests, or other repository files.
Effectiveness measurement: The script exits non-zero if any handoff artifact remains.
Slice rationale: Required terminal scrub for every implementation workflow.
Architectural effect: None; hygiene only.
Goal: Leave the branch free of handoff artifacts.
Motivation: Handoff files must not reach the PR.
Alternative considerations: Manual cleanup was rejected as non-deterministic.
Implementation details: Run scripts/scrub-handoff-artifacts.sh.
Layer exception: allowed -- the terminal scrub must run after every task in the workflow, including the docs task.
Non-goals: No product edits.
Layer: app_regression
Feature state: active
Acceptance criteria:
- `bash scripts/scrub-handoff-artifacts.sh` exits 0.

Exit code: 0
Invoker-Finalize-Id: 03cb1c94-1cac-4310-af56-316f3d1707f6
…ad5e1628a-dff66f66 — Review claim: No ephemeral inter-task handoff files remain in the worktree before the merge gate.

Review lane: cleanup
Safety invariant: The scrub script only checks for known handoff artifact names and never touches source, tests, or other repository files.
Effectiveness measurement: The script exits non-zero if any handoff artifact remains.
Slice rationale: Required terminal scrub for every implementation workflow.
Architectural effect: None; hygiene only.
Goal: Leave the branch free of handoff artifacts.
Motivation: Handoff files must not reach the PR.
Alternative considerations: Manual cleanup was rejected as non-deterministic.
Implementation details: Run scripts/scrub-handoff-artifacts.sh.
Layer exception: allowed -- the terminal scrub must run after every task in the workflow, including the docs task.
Non-goals: No product edits.
Layer: app_regression
Feature state: active
Acceptance criteria:
- `bash scripts/scrub-handoff-artifacts.sh` exits 0.
@cursor

cursor Bot commented Sep 12, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_22dfa068-6cd0-4022-993e-4e0fcec21681)

@EdbertChan

Copy link
Copy Markdown
Owner Author

@Mergifyio queue

@mergify

mergify Bot commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

This pull request spent 5 minutes 33 seconds in the queue, including 4 minutes 32 seconds running CI.

Required conditions to merge
  • check-success = lint
  • check-success = test

@mergify mergify Bot added the queued label Sep 13, 2026
@mergify
mergify Bot merged commit c6d2ee0 into main Sep 13, 2026
4 checks passed
@mergify
mergify Bot deleted the plan/cat-mode-default-applies-on-every-prompt-with-no-regex-guess branch September 13, 2026 02:53
@mergify mergify Bot removed the queued label Sep 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant