hook: inject an orient briefing for plain-English tasks#462
Closed
rs545837 wants to merge 3 commits into
Closed
Conversation
The prompt-submit hook only fired when the prompt literally named an entity (snake_case/CamelCase/backtick) and resolved it by exact name — so it stayed silent on ordinary tasks like 'fix the empty blueprint name bug', which is exactly when injection would help most. Add a fallback: when no entity is named, run orient --pack (tight, 3 entities) on the whole prompt and inject that briefing. Fast on a cached repo (~0.05s, 2.5s hard cap), gated to coding/navigation intent (whole-word match so 'fundraise' doesn't trip 'raise'), silent on chat/meta.
There was a problem hiding this comment.
inspect review
Triage: 3 entities analyzed | 0 critical, 0 high, 1 medium, 2 low
Verdict: standard_review
Findings (0)
Reviewed by inspect | Entity-level triage found 0 high-risk changes
Full bodies stay limited to the top few so an injected agent isn't distracted, but the briefing now ends with a compact 'also relevant' index — the ranker's next ~12 candidates as name/type/file one-liners. When the top bodies miss the exact fix location, the index points at the right neighborhood so the agent jumps there instead of grepping blind, without paying full-body tokens for the tail. This is what lets the prompt-submit hook stay focused (3 bodies) yet still lead the agent to the fix on harder tasks where ranking alone doesn't nail it.
There was a problem hiding this comment.
inspect review
Triage: 4 entities analyzed | 0 critical, 0 high, 2 medium, 2 low
Verdict: standard_review
Findings (0)
Reviewed by inspect | Entity-level triage found 0 high-risk changes
Lead the briefing with the resolved structure, not just bodies. Before the code, print the ranked entities as a map annotated with each one's deterministic blast radius (dependent count, marked when high) and the intra-set call edges. This gives the model an attention prior — where a change ripples and how the entities connect — so it reasons WITH the graph instead of reconstructing it from linear text. Targets accuracy (edit knowing the blast radius, don't break unseen callers) as much as speed. Composes with the recall index: map -> focused bodies -> leads.
There was a problem hiding this comment.
inspect review
Triage: 4 entities analyzed | 0 critical, 0 high, 2 medium, 2 low
Verdict: standard_review
Findings (0)
Reviewed by inspect | Entity-level triage found 0 high-risk changes
Member
Author
|
Superseded by the orient removal (#463). That PR added the fuzzy hook fallback; we're removing all fuzzy retrieval instead. |
rs545837
added a commit
that referenced
this pull request
Jul 5, 2026
sem becomes **purely deterministic**. Removed: the `orient` command and its `--pack` briefing, the sem-core ranking (lexical scoring, IDF, recall net, structural priming), the `sem_entities query=` intent-search mode, and the resident server's `orient` socket op. **Why:** a 45-task validation (requests/flask/sphinx) showed orient's ~47% hit-rate could not be lifted by heuristics without causing regressions (0 gains, 5+ regressions on a graph-expansion + path-penalty attempt). Fuzzy ranking was the only non-deterministic thing in sem, and it was where all the complexity accreted. The deterministic commands never needed it. **Remaining surface:** `context` (entity + callers/callees), `impact` (blast radius), `diff`, `entities` (list by path, or `text=` for exact-substring search), `blame`, `log`. To find code whose name you don't know: text-search for a candidate, then `sem context` for the structure grep can't give. The prompt-submit hook keeps its deterministic exact-name prefetch. 745 lines deleted. Build clean, tests green (2 pre-existing `sem diff` cwd-resolution failures unrelated). Supersedes #462 (which added the fuzzy hook fallback this removes). Note: sem-cloud has a `repo_orient` endpoint that pins a published sem-core; it'll need the same removal when it bumps.
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.
The
sem hook prompt-submitUserPromptSubmit hook resolved only identifier-shaped tokens from the prompt by exact name — so it fired only when the user literally typed afunction_name, and stayed silent on ordinary tasks like "fix the bug where empty blueprint names don't raise an error", which is exactly when injecting the code would help most.Fix: when no entity is named, fall back to an
orient --packbriefing (tight, 3 entities) over the whole prompt, so the agent starts with the relevant code in context and skips the search. This is the 0-turn understanding path — measured at 9.4s vs 13.2s (−29%) when the code is pre-injected, vs the agent calling a tool (a turn) which was net slower.Verified locally:
fix the bug where empty blueprint names…,where is the code that builds the graph).explain the philosophy…,are we faster,…the fundraise— whole-word match so 'fundraise' doesn't trip 'raise').This is the 'last mile' that makes auto-injection actually fire on real tasks, built on the ranking fixes in #460/#461.