Repository navigation
Route restated existing rules to already-covered, not automate-me - #1324
Merged
Conversation
Reflect was writing a new preference whenever someone reminded the agent of a skill it had already skipped. Add lesson_route.py so that signal stays an intervention for ordering, and the lesson bucket is already-covered unless no skill states the preference yet. Co-authored-by: Cursor <cursoragent@cursor.com> Change-Id: Ibb2d3e90a7cf01987aeb14b71e9413d7cec536c3
Bugbot couldn't run - usage limit reachedBugbot 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: b3cc23cd-c8bc-42eb-a6c2-02dcb6c09638) |
Contributor
|
Queued — the merge queue status continues in this comment ↓. |
The boundary-parser allow mark stays, and the comment checker treats that mark as a machine directive so the two gates agree. Co-authored-by: Cursor <cursoragent@cursor.com> Change-Id: I0a048d4d387df53de81d2638521a5198de499b36
11 tasks done
Owner
Author
|
This pull request is part of a Mergify stack:
|
…son-route-already-covered/drop-lesson-router-comments-failed-comment-gate--0a048d4d Drop the lesson-router comments that failed the comment gate.
Bugbot couldn't run - usage limit reachedBugbot 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: 7e3d7ee2-2373-4ccc-9aea-a0c190c5cecb) |
Owner
Author
|
@Mergifyio queue |
Contributor
Merge Queue Status
This pull request spent 1 hour 59 seconds in the queue, including 59 minutes 58 seconds running CI. Required conditions to merge
|
15 tasks done
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
Reflect turns a chat into lasting lessons for later agents. Before this change, when a person reminded the agent of a rule it had already skipped, Reflect treated that reminder as a new personal preference to capture. The real lesson was that the rule already existed and was not followed. This change adds a small router that picks the lesson bucket before any preference skill is invoked: a restated existing rule is rejected as already covered, and only a true preference with no home becomes preference capture.
Review Claim
A restated existing rule is rejected as already covered and does not open a preference capture; a preference with no existing skill still routes to preference capture.
Review Lane
behavior
Review Unit
engine-runtime
Safety Invariant
Does not change live hooks at install time beyond phrase text for the restated-rule judge; lesson routing is a reflect-step script and skill prose. No merge. No production deploy. Assumptions: Safety Invariant unconfirmed by the user in chat; proceeding with this text.
Slice Rationale
Single claim: the lesson bucket for a restated existing rule. Mechanism, phrase on_hit, skill prose, and tests land together so the gate cannot be skipped by prose alone.
Non-goals
Architecture
Before
After
Measured
Command:
git show origin/main:engine/hooks/llm-judge/phrases/restated-rule.json | python3 -c 'import json,sys; print(json.load(sys.stdin)["on_hit"])'restated-rule: the person had to restate a rule or skill that already exists. Count it as an intervention; a restated rule the agent should already follow is automate-me evidence.restated-rule: the person had to restate a rule or skill that already exists. Count it as an intervention signal that orders the reflect pass. Default lesson bucket is already-covered (execution miss on an existing skill) via engine/skills/reflect/scripts/lesson_route.py — do not invent a new preference or call automate-me for this hit alone.Command:
python3 engine/skills/reflect/scripts/lesson_route.py --from-transcript engine/skills/reflect/scripts/tests/fixtures/restated_rule/fires.jsonlfatal: path 'engine/skills/reflect/scripts/lesson_route.py' exists on disk, but not in 'origin/main'(fromgit cat-file -e origin/main:engine/skills/reflect/scripts/lesson_route.py; exit 128)already-covered/action: reject/do not route to automate-meCommand:
python3 -m unittest engine.skills.reflect.scripts.tests.test_lesson_routenone: router and its tests are part of this slice; merge-base has no module to importRan 10 tests/OKTest Plan
Test Plan
python3 engine/skills/reflect/scripts/lesson_route.py --from-transcript engine/skills/reflect/scripts/tests/fixtures/restated_rule/fires.jsonl→already-coveredautomate-meskill-not-usedpython3 -m unittest engine.skills.reflect.scripts.tests.test_lesson_route→ 10 OKfires.jsonland assertalready-covered--commit-only/ Review Unitengine-runtimeRevert Plan
Revert Plan
Revert the two commits on this branch. Restores prior restated-rule phrase text and removes the lesson router; Reflect again treats restated rules as preference-capture evidence.
Note
Medium Risk
Changes reflect workflow routing and judge phrase guidance; behavior is gated by tests and script output, but mis-routing could skip legitimate preferences or accept wrong lessons if heuristics misfire.
Overview
Adds
lesson_route.pyso reflect synthesis picks a lesson bucket before Accepted orautomate-merouting. Restated existing rules, admitted skips, and skill text that already covers the quote map toalready-covered(Rejected), not new preference capture.intervention-must-automateand frustration signals still order the reflect pass; they no longer imply anautomate-merow by themselves. Reflect skill prose,cost-audit.md, and the Frustration lens now require running the router; only bucketautomate-meinvokes the preference sibling.The
restated-rulellm-judge phraseon_hittext is updated to point atalready-coveredandlesson_route.pyinstead of “automate-me evidence.”The no-comments hook allows trailing
text-match-decision-warn:directives so router regex lines stay compliant. Tests and therestated_rule/fires.jsonlfixture assert transcript routing →already-covered.Reviewed by Cursor Bugbot for commit cfbdf1a. Bugbot is set up for automated code reviews on this repo. Configure here.