feat(scribe): snippet recording nudge — reusing-code skill + MCP/SessionStart guidance
CI & Build / Python lint (push) Successful in 3s
CI & Build / integration (push) Successful in 31s
CI & Build / TypeScript typecheck (push) Successful in 33s
CI & Build / Python tests (push) Successful in 55s
CI & Build / Build & push image (push) Successful in 1m10s

Step 5 of the Drafter recall milestone (#227): teach agents the two
snippet reflexes — search recorded snippets before writing a new
helper/util/component, and record something reusable the moment it's
built — via the app's own instruction surfaces, not a Scribe rule
(project rule #119). All instance-agnostic (rule #115).

- plugin/skills/reusing-code/SKILL.md: new auto-surfacing process-skill
  covering both reflexes (recall-before-rebuild + record-when-reusable).
- src/scribe/mcp/server.py: a Snippets paragraph in the MCP _INSTRUCTIONS.
- plugin/hooks/scribe_static_context.md: a "reuse before rebuilding"
  bullet in the SessionStart static context.
- plugin/.claude-plugin/plugin.json: version 0.1.12 -> 0.1.13 in the same
  change so the autoUpdate marketplace ships it (the #1040 lesson);
  description skill list updated.
- plugin/README.md: trued the process-skill list to what actually ships.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pa2EsuB54BuWQ8GfJq9c7t
This commit is contained in:
2026-07-25 14:00:07 -04:00
parent 1942913366
commit 0ea3bff797
5 changed files with 68 additions and 4 deletions
+13
View File
@@ -209,6 +209,19 @@ get_process(name) and follow the returned prompt verbatim, including any
"clarify first" steps it contains. Author a new one with create_process(title,
body); edit with update_process.
Scribe also stores Snippets — reusable functions/components recorded once for
recall (note_type "snippet"): a name, language, signature, canonical location
(repo · path · symbol), a one-line "when to reach for it", and the code. They
are ordinary embedded notes, so a recorded snippet also surfaces through the
same search + proactive recall as everything else. Two reflexes: (1) before you
write a new helper/utility/component, search first (list_snippets(q=...) or
search) — reuse the prior art with get_snippet(id) instead of re-deriving a
one-off; (2) the moment you build or notice something reusable, record it with
create_snippet(name, code, when_to_use, language, signature, repo, path, symbol,
project_id, system_ids) so a later session is offered it. Make when_to_use sharp
— it becomes the title, which is what a recall menu shows. Edit an existing one
with update_snippet rather than recording a second copy.
When developing Scribe itself, honor its multi-user sharing ACL: scope every
read and mutation of user data by owner + shares — never assume a single
operator. "Works for one user" is not done.