Skip to content

Add slash commands, an opt-in enforce hook, and user directives on top of the consolidated catalogue#57

Open
Regis-RCR wants to merge 1 commit into
syncable-dev:mainfrom
Regis-RCR:add-commands-hooks-directives
Open

Add slash commands, an opt-in enforce hook, and user directives on top of the consolidated catalogue#57
Regis-RCR wants to merge 1 commit into
syncable-dev:mainfrom
Regis-RCR:add-commands-hooks-directives

Conversation

@Regis-RCR

@Regis-RCR Regis-RCR commented Jul 15, 2026

Copy link
Copy Markdown

Your new consolidated catalogue already lands the skill consolidation from #51: umbrellas that route internally, descriptions that point at the graph instead of grep. This PR does not touch any of that. It adds the artifact classes the catalogue does not yet include, each sitting on top of your skills without changing them. Full gap analysis (what your release already covers vs what is open) and the activation-scoring numbers are in the write-up I shared.

What this PR adds

  • commands/ four slash commands (/mt-onboard, /mt-preflight, /mt-recall, /mt-impact), each a one-keystroke entry into a common workflow, self-locating its repo_id from the working directory so it runs with no manual edit.
  • hooks/ an OPT-IN PreToolUse hook that redirects recursive code-search (rg, grep -r, git grep, ugrep) to find_code/find_symbol in an indexed repo, plus an advisory Stop backstop. It fails open on daemon-down, an opt-out flag, or a path outside any indexed repo. It ships as hooks.json.example, NOT auto-registered: I flag it opt-in on purpose, since auto-registering it changes grep behavior for every user, the same silent-default concern I raised in memtrace install mutates user-global Claude Code config (~/.claude/) with no consent prompt, no documented mutation list, no opt-out, and a non-restoring uninstall #25. Rename it to hooks.json to enable.
  • Two directive docs (MEMTRACE.md, INSTALLABLE-DIRECTIVE.md): the "graph before grep" reflex, one as plugin-level guidance and one as a paste-into-CLAUDE.md block for users who want the reflex in their own context.

What this PR does NOT do

It does not modify your consolidated skills, does not re-run the merges you already shipped, and does not touch the MCP server-instruction block (the reorder is #55, server-side). The progressive-disclosure option and the three further "aggressive tier" merges (27 to 24) are described in the write-up as options, not applied here.

Happy to split this into one PR per component, or to drop any piece you would rather not carry. Thanks again for the tool.


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

Adds four /mt-* slash commands (onboard, preflight, recall, impact), an
opt-in PreToolUse enforce hook shipped as hooks.json.example (not
auto-registered), an advisory Stop backstop, and two directive docs. All
sit on top of the consolidated skills catalogue without changing any
skill. See the PR description for the full gap analysis.
Copilot AI review requested due to automatic review settings July 15, 2026 16:53
@blocksorg

blocksorg Bot commented Jul 15, 2026

Copy link
Copy Markdown

Mention Blocks like a regular teammate with your question or request:

@blocks review this pull request
@blocks make the following changes ...
@blocks create an issue from what was mentioned in the following comment ...
@blocks explain the following code ...
@blocks are there any security or performance concerns?

Run @blocks /help for more information.

Workspace settings | Disable this message

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the plugins/memtrace-skills plugin with additional user-facing artifacts on top of the existing consolidated skill catalogue: plugin-level directive docs, four /mt-* slash-command entrypoints, and an opt-in Claude Code hook example (PreToolUse gate + Stop backstop).

Changes:

  • Add MEMTRACE.md and INSTALLABLE-DIRECTIVE.md to document the “graph before grep” doctrine and provide a copy/paste directive for CLAUDE.md / rules-based setups.
  • Add four slash command definitions under plugins/memtrace-skills/commands/ (mt-onboard, mt-preflight, mt-recall, mt-impact).
  • Add an opt-in hook bundle under plugins/memtrace-skills/hooks/ (PreToolUse enforcement + Stop hook backstop) plus hooks.json.example.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
plugins/memtrace-skills/MEMTRACE.md Adds the plugin’s top-level doctrine and an intent-family map for skill routing
plugins/memtrace-skills/INSTALLABLE-DIRECTIVE.md Adds a portable directive block for users to paste into CLAUDE.md or rules loaders
plugins/memtrace-skills/hooks/memtrace-enforce-pretooluse.sh Adds a PreToolUse hook that denies recursive code search in indexed repos (opt-in)
plugins/memtrace-skills/hooks/memtrace-enforce-stop.sh Adds a Stop hook backstop to nudge graph/decision/history workflows (opt-in)
plugins/memtrace-skills/hooks/hooks.json.example Provides an example Claude Code hooks config wiring the new scripts
plugins/memtrace-skills/commands/mt-onboard.md Adds a slash command for graph-based repo onboarding / overview
plugins/memtrace-skills/commands/mt-preflight.md Adds a slash command for pre-edit symbol safety checks
plugins/memtrace-skills/commands/mt-recall.md Adds a slash command for decision-memory recall before refactors
plugins/memtrace-skills/commands/mt-impact.md Adds a slash command for blast-radius/impact analysis of a symbol

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +66 to +67
- MCP server-instructions: the always-injected form of reflex 1, leading with the
routing doctrine rather than a version banner (see `SERVER-INSTRUCTIONS.md`).
Comment on lines +63 to +65
This installable block is the always-in-context form of the same doctrine that
`MEMTRACE.md` states in full and that `SERVER-INSTRUCTIONS.md` injects via the MCP
server. Installing it is belt-and-suspenders: the hook enforces deterministically

| Family | When it fires | Entry |
|---|---|---|
| Discovery and structure | locate code, traverse a symbol's edges, map a repo, run graph algorithms, see the API surface | `memtrace-first` (router) then search / relationships / codebase-exploration / graph / api-topology |
| Family | When it fires | Entry |
|---|---|---|
| Discovery and structure | locate code, traverse a symbol's edges, map a repo, run graph algorithms, see the API surface | `memtrace-first` (router) then search / relationships / codebase-exploration / graph / api-topology |
| Pre-edit safety and impact | what breaks if I change this; a gate before editing one symbol; a risk-rated plan for a multi-symbol change | impact -> preflight -> change-impact-analysis (a ladder by scope) |
|---|---|---|
| Discovery and structure | locate code, traverse a symbol's edges, map a repo, run graph algorithms, see the API surface | `memtrace-first` (router) then search / relationships / codebase-exploration / graph / api-topology |
| Pre-edit safety and impact | what breaks if I change this; a gate before editing one symbol; a risk-rated plan for a multi-symbol change | impact -> preflight -> change-impact-analysis (a ladder by scope) |
| History and temporal | what changed over a range, one episode's diff, historical coupling, root-cause a failure, catch up at session start | evolution / episode-replay / cochange / incident-investigation / session-continuity / daily |
| History and temporal | what changed over a range, one episode's diff, historical coupling, root-cause a failure, catch up at session start | evolution / episode-replay / cochange / incident-investigation / session-continuity / daily |
| Decision memory | why does this exist, was this decided or banned, a symbol's lineage, whether a decision held, where it was implemented | `memtrace-decision-memory` (router over recall_decision / why_is_this_here / governing_contracts / verify_intent / get_arc) |
| Docs | how does Memtrace work, install or config, what a tool does, read a docs page | `memtrace-docs` (router over search_docs / ask_docs / read_doc) |
| Fleet coordination | more than one agent shares a repo and branch: declare intent, record edits, resolve a conflict | `memtrace-fleet` (concept) then the publish-intent / record-episode / resolve leaves |
| Decision memory | why does this exist, was this decided or banned, a symbol's lineage, whether a decision held, where it was implemented | `memtrace-decision-memory` (router over recall_decision / why_is_this_here / governing_contracts / verify_intent / get_arc) |
| Docs | how does Memtrace work, install or config, what a tool does, read a docs page | `memtrace-docs` (router over search_docs / ask_docs / read_doc) |
| Fleet coordination | more than one agent shares a repo and branch: declare intent, record edits, resolve a conflict | `memtrace-fleet` (concept) then the publish-intent / record-episode / resolve leaves |
| Code health and quality | dead code and complexity hotspots, a refactor plan, a GitHub PR review, empirical style norms | quality / refactoring-guide / code-review / style-fingerprint |
| Docs | how does Memtrace work, install or config, what a tool does, read a docs page | `memtrace-docs` (router over search_docs / ask_docs / read_doc) |
| Fleet coordination | more than one agent shares a repo and branch: declare intent, record edits, resolve a conflict | `memtrace-fleet` (concept) then the publish-intent / record-episode / resolve leaves |
| Code health and quality | dead code and complexity hotspots, a refactor plan, a GitHub PR review, empirical style norms | quality / refactoring-guide / code-review / style-fingerprint |
| Indexing and lifecycle | index a repo once, or watch it for live re-index | index / continuous-memory |
@Regis-RCR

Copy link
Copy Markdown
Author

What the consolidated catalogue already covers, and what is still open

I read the new consolidated catalogue (the published 27-skill set). It lands the core of what I raised in #51, and lands it well: decision-memory, docs, and the fleet entry are now umbrellas that route internally, and the descriptions already carry the "reach for the graph, not grep" instruction. So the skill consolidation itself is done, in your own voice. This note walks every artifact class in the proposal and marks what your release already covers versus what is still open, so nothing here re-proposes work you have already shipped.

Skills (already covered)

  • memtrace-decision-memory is an umbrella routing across recall_decision, why_is_this_here, governing_contracts, verify_intent, and get_arc.
  • memtrace-docs is an umbrella routing across ask_docs, search_docs, read_doc, disambiguated from the code graph.
  • memtrace-fleet-first absorbed the coordination concept: typed intents, conflict classes A/B/C, Class C resolution, and directive polling.
  • The overlapping descriptions were sharpened with explicit triggers and the anti-grep instruction ("zero results are not permission to grep").

That is the whole skill-consolidation half of the proposal, already in your release. Two skill-level items remain OPTIONAL, not gaps:

  • Progressive disclosure. Your umbrellas carry routing plus full depth in one SKILL.md body. An alternative could keep the body thin (just the router) and move each absorbed workflow into a references/ file loaded only when that branch fires, which would likely trim the always-loaded surface. A design choice, raised as an option.
  • Three further merges (27 to 24). Documented in the fuller write-up, deliberately not auto-applied: impact into preflight; session-continuity plus daily into a catch-up umbrella; codebase-exploration plus graph into an architecture umbrella. Each trades a precise per-tool activation for one fewer overlap. Your call, per-merge tradeoff in the write-up.

Commands (open: nothing shipped)

The catalogue has skills but no commands/. Four one-keystroke workflow entries sit on top of the skills without touching them:

  • /mt-onboard maps a repo (communities, central symbols, processes, service diagram).
  • /mt-preflight gates a single-symbol edit (impact, co-change, decisions, timeline).
  • /mt-recall recalls decision memory before a delete, refactor, or library re-pick.
  • /mt-impact computes blast radius for a planned change.

Each self-locates its repo_id from the working directory, so it runs with no manual edit.

Hooks (open: reflex is prose only)

Every umbrella now SAYS "do not grep, use the graph," but nothing enforces it. A deterministic PreToolUse hook can redirect recursive code-search (rg, grep -r, git grep, ugrep) to find_code/find_symbol in an indexed repo, with an advisory Stop backstop. I propose it OPT-IN, not an auto-default: forcing grep interception on every user is the kind of silent behavior change I flagged in #25, so it should be a documented opt-in the user turns on, not shipped active. It fails open on daemon-down, an opt-out flag, or a path outside any indexed repo.

Directives (open, partly filed)

The prose layer, four pieces:

  • Reorder the MCP server-instruction block (already filed as Reorder the MCP server-instruction block to lead with routing doctrine; the upgrade nag currently pushes the workflows past the truncation boundary #55). Lead with the routing doctrine (WHEN to reach for which tool) so it survives in-context truncation, and demote the version-nag to the tail. This is server-side, not a file in the plugin repo, so it stays an issue.
  • A top-level precursor directive (MEMTRACE.md): the one reflex plus a family map, the doctrinal "why and when" the skills and commands implement.
  • An installable user-side directive: a paste-into-CLAUDE.md block (or a ~/.claude/rules/ file) that carries the reflex into the user's own context, for when the MCP block is truncated or the user works outside the plugin's skills. User-opt-in.
  • A decision-memory workflow directive: promote "recall the rationale before you change it" to a first-class routed workflow, mirrored in the block and the umbrella.

Eval: how I scored activation quality

I scored each description on a 4-dimension manual rubric (specificity, completeness, trigger-term quality, distinctiveness / conflict-risk; 0 to 3 each, 12 max). This is a manual proxy, not an automated judge, so the load-bearing claim is the DELTA under one rubric and rater, not the absolute number.

  • Baseline (34 descriptions): 22 strong, 12 adequate, 0 weak; mean 86 percent.
  • The changed routing descriptions I proposed (17 of them): mean rose from 86 percent to 96 percent; 11 rose, 6 held (2 already at ceiling), 0 fell.
  • Biggest gains were exactly the entries that overlapped most: the discovery router (75 to 100 percent once it names its children in a NOT WHEN), the graph skill (67 to 100 percent once it draws a boundary against the overview skill), search and preflight in the +17 to +23 range.

The point for your release: your published descriptions already sit in that same strong band (the ones I read carry explicit triggers plus the anti-grep clause), which is the corroboration that the consolidation was the right move, not a critique of it. The rubric and the per-skill before/after are in the fuller write-up if useful.

How I checked nothing regresses

Every merge in the write-up is paired with a behavior-preservation row: one line per source skill tying each trigger to a clause in the surviving description, so no activation trigger is dropped. That table is the load-bearing part, and it is why the merges lose nothing.

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.

2 participants