@theglitchking/semantic-memory 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +71 -0
- package/.claude-plugin/plugin.json +34 -0
- package/CHANGELOG.md +233 -0
- package/LICENSE +21 -0
- package/README.md +91 -0
- package/bin/semantic-memory +2 -0
- package/bin/semantic-sidekick +2 -0
- package/commands/healthcheck.md +6 -0
- package/commands/mode.md +65 -0
- package/commands/normalize-config.md +6 -0
- package/commands/policy.md +16 -0
- package/commands/relink.md +6 -0
- package/commands/status.md +6 -0
- package/commands/update.md +6 -0
- package/commands/vault.md +21 -0
- package/dist/chunk-25EIQWXL.js +651 -0
- package/dist/chunk-25EIQWXL.js.map +1 -0
- package/dist/chunk-CAN2GWUG.js +88 -0
- package/dist/chunk-CAN2GWUG.js.map +1 -0
- package/dist/chunk-CXTRTCIK.js +762 -0
- package/dist/chunk-CXTRTCIK.js.map +1 -0
- package/dist/chunk-E2Z4J4MK.js +180 -0
- package/dist/chunk-E2Z4J4MK.js.map +1 -0
- package/dist/chunk-HODDRXJK.js +169 -0
- package/dist/chunk-HODDRXJK.js.map +1 -0
- package/dist/chunk-JPQHNG3R.js +147 -0
- package/dist/chunk-JPQHNG3R.js.map +1 -0
- package/dist/chunk-PZ5AY32C.js +10 -0
- package/dist/chunk-PZ5AY32C.js.map +1 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +505 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/core/embed-worker.d.ts +2 -0
- package/dist/core/embed-worker.js +121 -0
- package/dist/core/embed-worker.js.map +1 -0
- package/dist/core/index.d.ts +486 -0
- package/dist/core/index.js +62 -0
- package/dist/core/index.js.map +1 -0
- package/dist/indexer-KD6UTXZB.js +8 -0
- package/dist/indexer-KD6UTXZB.js.map +1 -0
- package/dist/lint-GMXQF4RW.js +11 -0
- package/dist/lint-GMXQF4RW.js.map +1 -0
- package/dist/log-LQXIJXIA.js +10 -0
- package/dist/log-LQXIJXIA.js.map +1 -0
- package/dist/mcp/server.d.ts +16 -0
- package/dist/mcp/server.js +4925 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/schema-F3RTY6SQ.js +12 -0
- package/dist/schema-F3RTY6SQ.js.map +1 -0
- package/dist/search-27WYAI24.js +202 -0
- package/dist/search-27WYAI24.js.map +1 -0
- package/docs/compat-matrix.md +127 -0
- package/docs/corpora-json.md +150 -0
- package/docs/regression-snapshot.md +122 -0
- package/docs/smart-middle-activation.md +97 -0
- package/hooks/hooks.json +39 -0
- package/hooks/reconcile.js +171 -0
- package/hooks/session-start.js +81 -0
- package/hooks/vault-context.js +503 -0
- package/package.json +97 -0
- package/scripts/link-skills.js +25 -0
- package/scripts/pre-commit-lint.sh +42 -0
- package/skills/outage-silence/SKILL.md +72 -0
- package/skills/research-mode/SKILL.md +84 -0
- package/skills/semantic-first/SKILL.md +117 -0
- package/skills/semantic-first/evals/evals.json +37 -0
- package/skills/semantic-first/references/vault-frontmatter.md +133 -0
- package/skills/vault-first/SKILL.md +100 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: outage-silence
|
|
3
|
+
description: Incident/outage mode skill for semantic-sidekick. Activates when the user signals an active production issue — prompts containing "down", "broken", "customers", "production", "rollback", "oncall", "paging", "alert", "incident", "5xx", "timeout", "cascading", or when the user pastes stack traces, error logs, alert timestamps, or terse operational requests ("what's the status of X?"). Preempts vault-first and research-mode — this is a hard-preempt mode. Suppresses all proactive vault activity (no auto-search, no auto-synthesis prompt, no capture cue chatter). Claude goes terse, action-oriented, and accepts that anything the user needs in the vault during an incident they will explicitly /vault for. On mode exit, a postmortem capture prompt is emitted — the one capture ritual that survives this mode. Does NOT activate on generic "bug" talk, planning for future resilience, or reading incident postmortems after the fact. Only actual in-flight incidents.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# outage-silence
|
|
7
|
+
|
|
8
|
+
**You are in outage-silence.** A customer-visible production issue is in flight. Everything optional is off. You are brief, operational, and help with what is being asked — nothing more.
|
|
9
|
+
|
|
10
|
+
## Mode entry (how you got here)
|
|
11
|
+
|
|
12
|
+
One of:
|
|
13
|
+
- **Explicit:** user ran `/mode outage-silence`.
|
|
14
|
+
- **Strong lexical signal:** "down", "broken", "customers", "production", "rollback", "oncall", "paging", "alert", "incident", a pasted stack trace, or a timestamp of the form `2026-04-21T15:32:00Z 5xx` / similar alert shape.
|
|
15
|
+
- **Escalating urgency signal:** user sends terse, imperative turns with no "please" or context-setting. The tone itself is a signal.
|
|
16
|
+
|
|
17
|
+
This mode has **asymmetric cost-of-error**: false-negative (failing to enter when you should) is very expensive (the vault fires during a fire, drowning the user in context). False-positive (entering when you shouldn't) is cheap (the user says "ok not actually an outage" and you exit). So enter on weaker signal than you would for research-mode.
|
|
18
|
+
|
|
19
|
+
## What changes from default behavior
|
|
20
|
+
|
|
21
|
+
### 1. No proactive vault activity
|
|
22
|
+
|
|
23
|
+
- **Do not** call `mcp__semantic-vault__search_hybrid` unless the user explicitly asks ("check the vault for X" / `/vault X`).
|
|
24
|
+
- **Do not** cite vault paths unless the user asks. The `<vault-context>` block from the hook is still there; mentally set it aside.
|
|
25
|
+
- **Do not** suggest filing anything. "Worth capturing this as a gotcha?" is a peace-time question.
|
|
26
|
+
- **Do not** emit capture-cue prompts mid-session. The Stop hook's capture-pending file is still accumulating, but you don't surface it.
|
|
27
|
+
|
|
28
|
+
### 2. Terse, operational responses
|
|
29
|
+
|
|
30
|
+
- Match the user's energy. If they're typing 4-word imperatives, match that register.
|
|
31
|
+
- Lead with the answer or action. No preamble.
|
|
32
|
+
- No long explanations. No hedging. If you don't know, say so in a sentence.
|
|
33
|
+
- Code snippets and commands are welcome; prose paragraphs are not.
|
|
34
|
+
|
|
35
|
+
### 3. Visible mode indicator
|
|
36
|
+
|
|
37
|
+
Prefix the first line of every response with `[outage]`. Users need to know you're in this mode so they can spot when you're still silent after the fire is out.
|
|
38
|
+
|
|
39
|
+
### 4. Explicit vault escape hatch
|
|
40
|
+
|
|
41
|
+
If the user types `/vault <query>` or explicitly asks ("search the vault for past keycloak outages"), call the vault tools — this mode suppresses *auto* vault use, not *explicit* use.
|
|
42
|
+
|
|
43
|
+
### 5. Mode-exit capture is mandatory
|
|
44
|
+
|
|
45
|
+
When `/mode vault-first` (or any other mode) is invoked AND the current mode is `outage-silence`, the transition capture prompt fires — this is handled by the Stop/mode-change hooks. The prompt asks you to draft a postmortem:
|
|
46
|
+
- Timeline of events as observed.
|
|
47
|
+
- Root cause as understood.
|
|
48
|
+
- Fix applied.
|
|
49
|
+
- Preventive actions to file as gotcha notes.
|
|
50
|
+
|
|
51
|
+
Do the draft. Offer it as a dry-run `synthesize_note` for the user to review before applying. This is the one synthesis that happens in/around outage-silence, and it's non-negotiable — if you don't capture, the next outage repeats the lesson.
|
|
52
|
+
|
|
53
|
+
## Interaction with hooks
|
|
54
|
+
|
|
55
|
+
- `SessionStart` preload still fires — ignore it unless the user brings it up.
|
|
56
|
+
- `UserPromptSubmit` injection still fires — ignore unless explicitly consulted.
|
|
57
|
+
- `Stop` hook transition-capture: on exit from outage-silence, the transition-capture path emits a postmortem-specific prompt (not the generic capture prompt). Respect it.
|
|
58
|
+
|
|
59
|
+
## Failure modes
|
|
60
|
+
|
|
61
|
+
- **Proactively searching the vault during an incident** — the explicit anti-goal. If you feel the pull to say "this is covered in X.md", suppress it unless the user asked.
|
|
62
|
+
- **Writing long explanations instead of short directives** — tone mismatch makes you feel like dead weight during a fire.
|
|
63
|
+
- **Skipping the postmortem on exit** — equivalent to the incident not happening for future-you.
|
|
64
|
+
- **Entering on weak signal ("my test is broken")** — not an outage. Stay in vault-first / research-mode.
|
|
65
|
+
- **Not exiting when the user says "ok it's fixed, what just happened?"** — that's your cue. Switch to `vault-first` mode visibly and draft the postmortem.
|
|
66
|
+
|
|
67
|
+
## What success looks like
|
|
68
|
+
|
|
69
|
+
- User: "5xx spiking, customers seeing errors". You: `[outage]` + a concrete first question ("which service?" / "any recent deploy?" / "any error in the logs you can paste?"). No vault mentions.
|
|
70
|
+
- User pastes stack trace. You: `[outage]` + terse diagnostic hypothesis + specific command to verify.
|
|
71
|
+
- Incident resolves. User: "ok fixed, it was the redis connection pool". You: `[outage]` + one-sentence acknowledgment + offer the postmortem draft (dry-run synthesize_note) before exiting mode.
|
|
72
|
+
- User: "ok exiting outage mode". You emit the postmortem draft, confirm with user, apply (or reject per user input), then behave as vault-first.
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: research-mode
|
|
3
|
+
description: Aggressive-vault mode skill for semantic-sidekick. Activates when the user signals an open-ended research or investigation session — prompts containing "I'm researching", "help me investigate", "look into", "do a deep dive on", "what's the best X for Y", "compare X and Y", "survey the landscape of", "how do other projects solve", or when the user pastes/introduces multiple external sources (URLs, papers, blog posts) in a short span. Unlike vault-first (which nudges toward the vault on project-scoped prose), research-mode treats every turn as vault-eligible and forces synthesis on transition out. Does NOT activate on short project operational questions ("how do we deploy") — those are vault-first territory. Does NOT activate during an active incident (outage-silence preempts). Strong signal beats weak signal; once entered, the mode sticks through topic shifts within the research arc and only exits on explicit /mode change, session end, or a hard topic break (e.g., user asks an unrelated operational question).
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# research-mode
|
|
7
|
+
|
|
8
|
+
**You are in research-mode.** The user is doing sustained investigation — not a one-off question. The vault is a *working surface*, not a reference: every turn produces or modifies durable artifacts, every source gets filed, every finding gets synthesized before the session closes.
|
|
9
|
+
|
|
10
|
+
## Mode entry (how you got here)
|
|
11
|
+
|
|
12
|
+
One of:
|
|
13
|
+
- **Explicit:** user ran `/mode research`.
|
|
14
|
+
- **Strong lexical signal:** user said "I'm researching", "let's investigate", "deep dive", "survey", "compare X and Y", "what's the best X for Y", "look into".
|
|
15
|
+
- **Sustained source introduction:** user pasted or linked ≥3 external URLs / papers / docs in the last few turns and is asking evaluative questions about them.
|
|
16
|
+
|
|
17
|
+
Weak single-word hints (e.g., "research" as a noun, "look") are insufficient — the mode is too behavior-altering to enter on ambient signal. If you're unsure whether this is research-mode vs vault-first, default to vault-first.
|
|
18
|
+
|
|
19
|
+
## What changes from default behavior
|
|
20
|
+
|
|
21
|
+
### 1. Every source becomes a filed note
|
|
22
|
+
|
|
23
|
+
Whenever the user introduces an external source you end up relying on — a URL they link, a paper they paste, a doc they point at — **file it via `mcp__semantic-vault__ingest_source`** with:
|
|
24
|
+
- `source.source_uri` — the link or path.
|
|
25
|
+
- `source.source_title` — the actual title from the source (don't make one up).
|
|
26
|
+
- `source.source_summary` — your paragraph-length distillation.
|
|
27
|
+
- `units` — one per distinct finding/claim you extract from the source.
|
|
28
|
+
|
|
29
|
+
The ingest call also writes a `log_event` automatically — session provenance is preserved.
|
|
30
|
+
|
|
31
|
+
Don't accumulate URLs in the chat and lose them at session end. That's the failure mode this mode exists to prevent.
|
|
32
|
+
|
|
33
|
+
### 2. Proactive vault checks every non-trivial turn
|
|
34
|
+
|
|
35
|
+
On each substantive user turn, before answering:
|
|
36
|
+
- Call `mcp__semantic-vault__search_hybrid` with the current topic focus.
|
|
37
|
+
- If prior research notes exist, read them in full via `read_note` and weave them into your answer — don't re-research ground you've already covered.
|
|
38
|
+
- Cite every note you used (paths at end of response).
|
|
39
|
+
|
|
40
|
+
The "is this already in the vault?" question runs automatically — not just on explicit user ask.
|
|
41
|
+
|
|
42
|
+
### 3. Synthesis is mandatory on mode exit
|
|
43
|
+
|
|
44
|
+
Before the session ends — or before `/mode` changes you away from research — you MUST produce a `synthesize_note` that:
|
|
45
|
+
- Names the overall topic.
|
|
46
|
+
- Summarizes the findings in your own words.
|
|
47
|
+
- Cites the source-notes created during the session (`derived_from`).
|
|
48
|
+
- Uses confidence=`high` only if you've read multiple corroborating sources, `medium` for single-source claims, `low` for speculation.
|
|
49
|
+
|
|
50
|
+
This is the highest-leverage moment in the whole system: 3 hours of research with no synthesis → findings evaporate. 3 hours of research + 30 seconds of synthesis → compounding knowledge.
|
|
51
|
+
|
|
52
|
+
If the Stop hook fires with a `<vault-capture-prompt>` block, treat it as a hard requirement — do the synthesis before closing, or explicitly reject individual items with reasoning ("that one was already in the vault" / "that was a dead end, not worth capturing").
|
|
53
|
+
|
|
54
|
+
### 4. Relevance decay, not time decay
|
|
55
|
+
|
|
56
|
+
The mode stays active across short topic shifts within the research arc ("X → Y as a related question" → stay in research). It exits on:
|
|
57
|
+
- Explicit `/mode vault-first` or `/mode outage-silence`.
|
|
58
|
+
- Session end (SessionStart resets to vault-first).
|
|
59
|
+
- A hard topic break — user pivots to an operational question about the current project ("ok now how do we deploy this?"). That's vault-first territory; acknowledge the mode shift visibly and exit.
|
|
60
|
+
|
|
61
|
+
Do not exit on short silences or tool-use lulls — 20 turns of reading-and-taking-notes is still research.
|
|
62
|
+
|
|
63
|
+
## Visible mode indicator
|
|
64
|
+
|
|
65
|
+
Prefix the first sentence of every research-mode response with `[research]`. Users should always be able to see which mode you're operating in so they can override if you've routed wrong.
|
|
66
|
+
|
|
67
|
+
## Interaction with hooks
|
|
68
|
+
|
|
69
|
+
- `SessionStart` preload still fires; treat it as seed context like in vault-first.
|
|
70
|
+
- `UserPromptSubmit` injection still fires; in research-mode, the hits more strongly influence which vault notes you read before answering.
|
|
71
|
+
- `Stop` hook: capture-pending cues accumulated during the session will include research findings; synthesize them before letting Stop close. If the Stop hook's `decision: "block"` fires, don't just emit one synthesize_note to appease it — address each pending item specifically.
|
|
72
|
+
|
|
73
|
+
## Failure modes
|
|
74
|
+
|
|
75
|
+
- **Answering without filing sources** — the single biggest failure. If you used a URL in your answer, it gets an `ingest_source` call. No exceptions.
|
|
76
|
+
- **Synthesizing at session end with thin provenance** — if `derived_from` on the synthesis-note is empty, you didn't file the sources. Back up, file them, then re-synthesize.
|
|
77
|
+
- **Staying in research-mode through an unrelated operational question** — exit visibly ("switching out of research-mode for this operational question") and answer from vault-first.
|
|
78
|
+
- **Entering research-mode on a single casual "research" mention** — too aggressive. Prefer vault-first when the signal is weak.
|
|
79
|
+
|
|
80
|
+
## What success looks like
|
|
81
|
+
|
|
82
|
+
- Multi-source compare ("what's the best vector DB for <100k docs?") → you search the vault for prior research, do web research as needed, call `ingest_source` per source, then `synthesize_note` before answering. The chat response is a pointer to the synthesis note, not the full answer.
|
|
83
|
+
- 2-hour investigation into a new topic → 1 synthesis note + 4-6 source notes in the vault, all linked. Next session's vault-first preload surfaces them automatically.
|
|
84
|
+
- User shifts to "ok now let's implement this" → you exit research-mode visibly and switch to operational/implementation behavior (with vault-first still nudging).
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: semantic-first
|
|
3
|
+
description: Route documentation lookups, internal procedure questions, repo architectural/vocabulary/convention questions, and research tasks through the semantic-sidekick and semantic-vault MCP servers BEFORE falling back to any other search strategy. Use this skill whenever the user asks how something works in this repo, what the convention is, where a procedure or guide lives, what the project calls something, why code is structured a certain way, OR asks any research question — comparative evaluations ("is there a better X"), tool/library/API recommendations ("what's the best X for Y"), best-of surveys, or any "look into X" / "research X" / "investigate X" phrasing. Also use for all research note-taking — findings go into .claude/.vault as markdown with structured frontmatter, not scattered across the conversation. Triggers on prose/conceptual questions about a codebase or domain, not on pure code-symbol lookups (those are Grep jobs). Ships with the semantic-sidekick plugin and probes MCP availability at runtime — the docs-lookup flow degrades gracefully when hit-em-with-the-docs is not installed, and the vault-research flow degrades gracefully when semantic-sidekick itself isn't wired up.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# semantic-first
|
|
7
|
+
|
|
8
|
+
Route documentation and research through the semantic-sidekick ecosystem before anything else.
|
|
9
|
+
|
|
10
|
+
## Why this skill exists
|
|
11
|
+
|
|
12
|
+
The semantic-sidekick plugin installs one or two MCP servers depending on what else is present:
|
|
13
|
+
|
|
14
|
+
- **`semantic-vault`** — semantic + keyword search and full read/write over `.claude/.vault/`, a research scratchpad that persists across sessions. Available whenever the semantic-sidekick plugin is installed.
|
|
15
|
+
- **`semantic-sidekick`** — the same engine pointed at a read-only docs index (by default `.documentation/`). Available only when the companion plugin `hit-em-with-the-docs` is also installed, since that's the plugin that owns the docs directory structure.
|
|
16
|
+
|
|
17
|
+
Without explicit routing, Claude's default reflex is to `Grep`/`Glob` the repo when the user asks a conceptual question, and to dump web-research findings straight into the chat where they're lost when the session ends. Both defaults waste the infrastructure the user set up. This skill corrects that.
|
|
18
|
+
|
|
19
|
+
## Two flows, gated independently
|
|
20
|
+
|
|
21
|
+
This skill has two flows, and they depend on different MCP servers. Probe each one independently — don't assume that if one works the other does, and don't no-op the whole skill just because half of it is unavailable.
|
|
22
|
+
|
|
23
|
+
| Flow | What it does | Depends on | Tool namespace |
|
|
24
|
+
|---|---|---|---|
|
|
25
|
+
| **A. Docs lookup** | Find how something works in this repo | `hit-em-with-the-docs` being installed | `mcp__semantic-sidekick__*` |
|
|
26
|
+
| **B. Research notes** | Capture findings to a persistent vault | `semantic-sidekick` being installed (which it is, since this skill ships with it — but the user can still have the MCP misconfigured) | `mcp__semantic-vault__*` |
|
|
27
|
+
|
|
28
|
+
## Flow A — documentation / procedure / repo-nuance lookups
|
|
29
|
+
|
|
30
|
+
**Triggers on prose questions about the current repo or project:**
|
|
31
|
+
|
|
32
|
+
- "How does this repo handle X?"
|
|
33
|
+
- "Where's the guide for Y?"
|
|
34
|
+
- "What's our process for Z?"
|
|
35
|
+
- "Why is this structured this way?"
|
|
36
|
+
- "What does this project call X?"
|
|
37
|
+
- "Is there a convention for Y?"
|
|
38
|
+
- "Is there a `<thing>` in this repo that does X?" — note this is **prose about whether a capability exists**, which semantic-sidekick answers well from design docs, even though a naive read would send it to Grep.
|
|
39
|
+
|
|
40
|
+
**Does NOT trigger on code-symbol lookups** like "where is function `parseAuth` defined" or "show me the `User` class" — those are `Grep`/`Glob` jobs. The line is *prose vs. symbol*: if the answer is a line or two of prose that would typically live in a design doc, README, or procedure, this flow applies. If the answer is a specific file path and line number that only exists in source code, it doesn't.
|
|
41
|
+
|
|
42
|
+
**When in doubt, try semantic-sidekick first anyway.** The cost of one extra `search_hybrid` call is tiny; the cost of grep-spelunking for something that's documented in plain English is several wasted minutes.
|
|
43
|
+
|
|
44
|
+
**Procedure:**
|
|
45
|
+
|
|
46
|
+
1. **Probe availability** once per task. Call `mcp__semantic-sidekick__get_stats` with no arguments. If the tool is not in the session, or `get_stats` errors, or the stats show an empty/missing index, drop to [Fallback: docs lookup](#fallback-docs-lookup) below. Otherwise the index is live and you can search it.
|
|
47
|
+
2. **Search with hybrid retrieval.** Use `mcp__semantic-sidekick__search_hybrid` with the user's question (or a condensed form of it) as the query. Hybrid search combines semantic embeddings with keyword matching and outperforms either individually for most real questions. Keep `top_k` modest (5–10); you can always widen if the first pass is thin.
|
|
48
|
+
3. **Read the top hits in full.** For each promising result, call `mcp__semantic-sidekick__read_note`. Do not answer from search snippets alone — snippets lose surrounding context and produce confident-sounding wrong answers. Reading 2–3 full notes is almost always cheaper than correcting a wrong answer later.
|
|
49
|
+
4. **Traverse the graph when the question is multi-part.** If a note references `[[wikilinks]]` or has `dependencies:` / `related:` frontmatter, use `mcp__semantic-sidekick__forwardlinks` / `backlinks` to follow the chain. This is especially valuable for questions like "how does X work end-to-end" or "what's the deploy process for each environment" — where the full answer is spread across linked notes.
|
|
50
|
+
5. **Answer from what you read, with filename citations.** Tell the user which notes you pulled the answer from so they can jump to the source. If the answer genuinely isn't in the index, say so explicitly — don't backfill with guesses or pivot silently to web search.
|
|
51
|
+
|
|
52
|
+
### Fallback: docs lookup
|
|
53
|
+
|
|
54
|
+
If step 1 indicates the `semantic-sidekick` MCP is unavailable (the `hit-em-with-the-docs` plugin isn't installed, the `.mcp.json` isn't wired up, or the index is empty), degrade:
|
|
55
|
+
|
|
56
|
+
- Tell the user, in one sentence, that the semantic docs index isn't available and you're falling back to direct file search. Visibility matters — it lets them fix the config and get the fast path back.
|
|
57
|
+
- Use `Glob` to enumerate `*.md` files in likely locations: `docs/`, `documentation/`, `.documentation/`, `README.md`, `CONTRIBUTING.md`, `.claude/`, and the repo root.
|
|
58
|
+
- Use `Grep` for keywords from the question across those files.
|
|
59
|
+
- If nothing promising turns up in markdown, *then* expand to `Grep` over source code as a last resort.
|
|
60
|
+
|
|
61
|
+
This is strictly worse than semantic search — but a visible fallback is much better than a silent one.
|
|
62
|
+
|
|
63
|
+
## Flow B — research tasks (internal or external)
|
|
64
|
+
|
|
65
|
+
**Triggers on evaluative, comparative, or exploratory questions:**
|
|
66
|
+
|
|
67
|
+
- "Is there a better X than Y?"
|
|
68
|
+
- "What's the best X for Y?"
|
|
69
|
+
- "Look into X."
|
|
70
|
+
- "Research Y."
|
|
71
|
+
- "Investigate how other projects solve Z."
|
|
72
|
+
- Any request that would naturally involve `WebSearch` / `WebFetch`.
|
|
73
|
+
|
|
74
|
+
**Also triggers on mixed questions** like "how does this repo use X, and is there a better alternative?" — handle the repo half via Flow A, then continue into Flow B for the alternatives half. The two flows compose naturally.
|
|
75
|
+
|
|
76
|
+
**Procedure:**
|
|
77
|
+
|
|
78
|
+
1. **If the question has a repo-context component, do Flow A first.** "How do we currently handle X" before "is there a better X" — you can't evaluate alternatives without understanding the current solution.
|
|
79
|
+
2. **Probe vault availability.** Call `mcp__semantic-vault__get_stats`. If it errors or the tool isn't present, drop to [Fallback: vault notes](#fallback-vault-notes). Otherwise the vault is live.
|
|
80
|
+
3. **Check the vault for prior research.** Call `mcp__semantic-vault__search_hybrid` with the topic. If past-you already investigated this, reuse the note — update it in place via `mcp__semantic-vault__update_note` rather than starting over. This is the main reason the vault exists.
|
|
81
|
+
4. **Do the actual research.** Use `WebSearch` / `WebFetch` / whatever tools are appropriate. Read multiple sources where you can — a single source is a single opinion.
|
|
82
|
+
5. **Write the findings to `.claude/.vault` as you go.** Use `mcp__semantic-vault__create_note` (or `update_note`). The full frontmatter format is in `references/vault-frontmatter.md` — read that file once per session before writing your first note.
|
|
83
|
+
6. **Link the note.** Use `[[wikilinks]]` to related notes in the body, and fill in `dependencies` / `related` / `supersedes` in the frontmatter so future sessions can traverse the graph. Unlinked notes are graveyards — they get written once and never found again.
|
|
84
|
+
7. **Answer the user from the note you just wrote.** The note is the canonical artifact; the chat response is a short summary with a pointer to the filename. The user's future self (or another session) can re-read the note; they can't re-read the chat.
|
|
85
|
+
|
|
86
|
+
### Fallback: vault notes
|
|
87
|
+
|
|
88
|
+
If step 2 indicates the `semantic-vault` MCP is unavailable but `.claude/.vault/` exists as a directory (or you can create it), use the `Write` tool directly — still follow the frontmatter format in `references/vault-frontmatter.md`. A session without the MCP server still has a filesystem; don't skip note-taking just because the semantic indexing won't happen. The index can be rebuilt later; lost notes can't.
|
|
89
|
+
|
|
90
|
+
If neither the MCP nor a filesystem `.claude/.vault/` directory is available *and* you can't create it (e.g., permission error), tell the user and put the findings directly in the chat as a clearly-marked "research findings" block — better than losing them entirely.
|
|
91
|
+
|
|
92
|
+
## The vault frontmatter is non-negotiable
|
|
93
|
+
|
|
94
|
+
Every `.md` file created in `.claude/.vault/` must start with YAML frontmatter. See `references/vault-frontmatter.md` for the full field reference and rationale. The short version is that the format is adapted from the 22-field docs frontmatter used elsewhere in the semantic-sidekick ecosystem, with the RAG-chunker fields dropped and two research-specific fields (`source`, `confidence`) added. A note without frontmatter won't index properly and becomes invisible to future searches — which defeats the whole point of writing it.
|
|
95
|
+
|
|
96
|
+
## Interaction with other Claude systems
|
|
97
|
+
|
|
98
|
+
- **The memory system** (`~/.claude/projects/**/memory/`) is for durable facts about the user and the project (who they are, what they prefer, what constraints are in play). It is NOT for research artifacts. Research goes in the vault; facts go in memory. When in doubt: *is this a body of findings on a specific topic?* → vault. *Is this a fact that would be useful to a completely different task?* → memory.
|
|
99
|
+
- **`Grep`/`Glob`** are for code-symbol lookups and as a Flow A fallback. Not the default for conceptual prose questions when semantic-sidekick is available.
|
|
100
|
+
- **`WebSearch`/`WebFetch`** are research *inputs* — their outputs should flow into vault notes, not into the conversation only. The chat response summarizes; the note preserves.
|
|
101
|
+
|
|
102
|
+
## What success looks like
|
|
103
|
+
|
|
104
|
+
- User asks "how does this repo handle auth?" → you call `search_hybrid`, read 2–3 notes, answer with filename citations. Tool call budget: 3–5. No `Grep`.
|
|
105
|
+
- User asks "what's the best CRM for small businesses?" → you search the vault for prior research (none), do web research, write `.claude/.vault/crm-smb-evaluation.md` with full frontmatter, answer from the note.
|
|
106
|
+
- User asks the same CRM question a week later → you find the existing note in the vault, skim it, either answer directly or update it with fresh findings and bump `last_updated`.
|
|
107
|
+
- User installs the skill in a repo without `hit-em-with-the-docs` → Flow A probe fails, you tell the user once, fall back to Glob/Grep for docs lookup. Flow B (vault) still works because `semantic-vault` is available.
|
|
108
|
+
- User's `.mcp.json` is broken entirely → both probes fail, you tell them, fall back to filesystem for both flows. You don't pretend everything's fine.
|
|
109
|
+
|
|
110
|
+
## What failure looks like
|
|
111
|
+
|
|
112
|
+
- Grep'ing the repo for a conceptual question when `mcp__semantic-sidekick__search_hybrid` is sitting right there.
|
|
113
|
+
- Writing research findings into the chat response and leaving no artifact on disk.
|
|
114
|
+
- Writing vault notes without frontmatter, or with ad-hoc frontmatter that won't index.
|
|
115
|
+
- Silently no-op'ing when an MCP server is missing instead of telling the user and falling back.
|
|
116
|
+
- Triggering on code-symbol lookups ("where is `parseAuth` defined") and wasting tool calls on semantic search for something `Grep` would answer in 100ms.
|
|
117
|
+
- Assuming both MCP servers travel together. They don't — the vault ships with this plugin, the docs index ships with `hit-em-with-the-docs`. Probe them separately.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"skill_name": "semantic-first",
|
|
3
|
+
"evals": [
|
|
4
|
+
{
|
|
5
|
+
"id": 1,
|
|
6
|
+
"name": "flow-a-capability-existence-user-delete",
|
|
7
|
+
"flow": "A",
|
|
8
|
+
"prompt": "Is there a user delete in this repo that deletes a user AND their data completely?",
|
|
9
|
+
"expected_output": "Ambiguous-on-purpose case: a naive read sends this to Grep for a delete symbol, but the answer (whether the capability exists and how it's designed) lives in prose in design docs. The skill should try mcp__semantic-sidekick__search_hybrid first and only fall through to code search if the docs don't answer it. Success = used semantic search first, cited specific note filenames, did not start with grep.",
|
|
10
|
+
"files": []
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"id": 2,
|
|
14
|
+
"name": "flow-a-multi-part-infra-question",
|
|
15
|
+
"flow": "A",
|
|
16
|
+
"prompt": "What kind of git method is being used, and how many environments and domains/subdomains are there in each environment, and what are they?",
|
|
17
|
+
"expected_output": "Multi-part factual question where the answer is spread across several docs (git workflow, environments, domains all documented separately). Skill should use search_hybrid, read multiple notes, and ideally traverse via forwardlinks/backlinks to link the pieces together. Should cite each note used. No grepping source code. Success = pulled from multiple notes, composed a complete multi-part answer, cited filenames.",
|
|
18
|
+
"files": []
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"id": 3,
|
|
22
|
+
"name": "flow-b-pure-external-research",
|
|
23
|
+
"flow": "B",
|
|
24
|
+
"prompt": "What's the best CRM platform for a small business team of 10?",
|
|
25
|
+
"expected_output": "Pure external research, no repo context. Skill should: (1) search the vault for prior research on CRM evaluation, (2) do web research via WebSearch/WebFetch, (3) write a new .md file to .claude/.vault/ with full frontmatter (all required fields from references/vault-frontmatter.md), (4) answer from the note with a filename pointer. Success = a file was created at .claude/.vault/<slug>.md, frontmatter has all required fields with sensible values, note body has actual research content (not a stub), chat response cites the note filename.",
|
|
26
|
+
"files": []
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"id": 4,
|
|
30
|
+
"name": "flow-b-mixed-composition",
|
|
31
|
+
"flow": "B",
|
|
32
|
+
"prompt": "We use HashiCorp Vault for secrets management in this repo — is there a better alternative we should consider?",
|
|
33
|
+
"expected_output": "Hardest test: requires composing Flow A (find how the repo currently uses HashiCorp Vault, cite docs) with Flow B (research alternatives via web search, write vault note). The skill should NOT pick one flow and drop the other. Success = (1) semantic-sidekick was searched for current usage and specific notes were cited, (2) web research was performed for alternatives, (3) a .md file was written to .claude/.vault/ with full frontmatter and source: mixed (since it combines docs-lookup and web-research), (4) final answer references both the repo's current setup and the researched alternatives with explicit confidence, (5) the vault note contains a 'what we currently do' section drawn from Flow A findings.",
|
|
34
|
+
"files": []
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# Vault note frontmatter — field reference
|
|
2
|
+
|
|
3
|
+
Every `.md` file written into `.claude/.vault/` must start with YAML frontmatter in this exact format. The schema is adapted from the 22-field docs frontmatter used by the semantic-sidekick ecosystem, with RAG-chunker fields removed (they're meaningless for scratchpad notes) and two research-specific fields added (`source`, `confidence`) because research artifacts need epistemic provenance.
|
|
4
|
+
|
|
5
|
+
## The template
|
|
6
|
+
|
|
7
|
+
Copy this and fill it in for every new note. Don't skip fields — if a field doesn't apply, use `null`, `[]`, or the default shown in the comment. Missing fields break graph traversal and semantic indexing.
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
---
|
|
11
|
+
title: "Note Title"
|
|
12
|
+
tier: research # research | investigation | scratch | finding | decision
|
|
13
|
+
topic: null # short kebab-case topic, e.g. "hashicorp-vault", "crm-evaluation", or null
|
|
14
|
+
domains: # free-form list; common values: security, backend, frontend, devops, infrastructure, product, tooling, ai
|
|
15
|
+
- security
|
|
16
|
+
audience: # who would find this note useful; free-form: self | team | all | <role>
|
|
17
|
+
- self
|
|
18
|
+
tags: # free-form keyword tags; used by search_hybrid
|
|
19
|
+
- secrets
|
|
20
|
+
- vault
|
|
21
|
+
status: active # active | superseded | draft | archived
|
|
22
|
+
last_updated: '2026-04-15' # ISO date, quoted string
|
|
23
|
+
source: web-research # web-research | docs-lookup | conversation | experimentation | mixed
|
|
24
|
+
complexity: low # low | medium | high — how hard the topic is to reason about
|
|
25
|
+
confidence: medium # low | medium | high — how much future-you should trust these notes
|
|
26
|
+
keywords: # precise search terms (more specific than tags)
|
|
27
|
+
- hashicorp-vault
|
|
28
|
+
- secret-management
|
|
29
|
+
dependencies: [] # notes that should be read first (filenames or [[wikilinks]])
|
|
30
|
+
related: [] # parallel/complementary notes
|
|
31
|
+
supersedes: [] # notes this replaces (old investigations that are now wrong)
|
|
32
|
+
summary: One-sentence description of what this note contains.
|
|
33
|
+
owner: self # self | team | <username>
|
|
34
|
+
---
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Field-by-field rationale
|
|
38
|
+
|
|
39
|
+
| Field | Purpose | Notes |
|
|
40
|
+
|---|---|---|
|
|
41
|
+
| `title` | Human-readable. Shows up in search results. | Be specific: "HashiCorp Vault vs Infisical comparison" beats "Secrets research". |
|
|
42
|
+
| `tier` | What kind of note this is. | `research` = multi-source investigation. `investigation` = debugging a specific problem. `scratch` = quick notes, low confidence. `finding` = a conclusion distilled from research. `decision` = an architectural choice and its rationale. |
|
|
43
|
+
| `topic` | A coarse grouping tag. | Kebab-case. `null` if the note doesn't cluster with others. |
|
|
44
|
+
| `domains` | Broad technical areas. | Free-form list. Multiple is fine. Used for filtering. |
|
|
45
|
+
| `audience` | Who benefits from reading this. | Default `[self]`. Use `[team]` or `[all]` only if the note is a finished artifact worth sharing. |
|
|
46
|
+
| `tags` | Free-form keywords. | These are the primary filter dimension in `search_hybrid`. Err on the side of more tags. |
|
|
47
|
+
| `status` | Is this note still valid? | `active` for current work. `superseded` when replaced by a newer investigation (fill `supersedes` on the new note). `draft` for in-progress. `archived` when deliberately retired. |
|
|
48
|
+
| `last_updated` | ISO date, quoted. | Bump this on every edit, even small ones. |
|
|
49
|
+
| `source` | Where the information came from. | `web-research` = Google/WebFetch. `docs-lookup` = pulled from semantic-sidekick. `conversation` = came from the user in chat. `experimentation` = ran something and observed results. `mixed` = combination. This is epistemic provenance and matters for re-reading later. |
|
|
50
|
+
| `complexity` | How hard is this topic. | Affects reading-time expectations and whether future-you should budget extra time. |
|
|
51
|
+
| `confidence` | How much to trust this note. | The single most valuable field for research notes. `low` confidence on a CRM recommendation after reading one blog post is useful information; pretending it's `high` is worse than not writing the note at all. |
|
|
52
|
+
| `keywords` | Precise search terms. | More specific than `tags` — actual names, product names, technical terms that exact-match searches will hit. |
|
|
53
|
+
| `dependencies` | Prerequisite notes. | `[[wikilinks]]` or filenames. Lets the graph traversal follow "what should I read first?". |
|
|
54
|
+
| `related` | Parallel notes. | Complementary topics, not prerequisites. |
|
|
55
|
+
| `supersedes` | Notes this replaces. | When you revisit a topic and the old note is now wrong, list it here and mark the old note's `status: superseded`. |
|
|
56
|
+
| `summary` | One sentence. | This is what shows up in search snippets — make it dense and informative. |
|
|
57
|
+
| `owner` | Who wrote it. | `self` by default. `team` for shared findings. `<username>` if you want to attribute. |
|
|
58
|
+
|
|
59
|
+
## What got dropped from the 22-field docs format, and why
|
|
60
|
+
|
|
61
|
+
The published-docs format includes these fields that are *not* in the vault format:
|
|
62
|
+
|
|
63
|
+
- `feature` → merged into `topic` and `tags`. Research notes rarely map to a single feature.
|
|
64
|
+
- `version` → research notes aren't versioned artifacts; they're snapshots in time.
|
|
65
|
+
- `size_kb`, `line_count`, `read_time_min` → auto-computed by the docs metadata generator for RAG chunking. Irrelevant for scratchpad notes.
|
|
66
|
+
- `load_priority` → used by published docs to hint load order; not meaningful for vault notes.
|
|
67
|
+
- `chunk_strategy` → RAG chunking hint; not used by the vault indexer in the same way.
|
|
68
|
+
|
|
69
|
+
If the user ever decides to promote a vault note to published docs, they'll need to add these fields back. Until then, they're noise.
|
|
70
|
+
|
|
71
|
+
## Two fields added to the vault format
|
|
72
|
+
|
|
73
|
+
- `source` — where the findings came from. Not in the docs format because published docs are the source of truth. Research notes aren't — knowing whether a conclusion is based on a blog post, a spec, or an experiment is critical for judging its weight later.
|
|
74
|
+
- `confidence` — how confident past-you was. Research notes lose value quickly if future-you can't tell whether the author was confident or speculating. A note that says "this library is the best choice" with `confidence: low` is actionable; one without confidence information is a trap.
|
|
75
|
+
|
|
76
|
+
## Example: fully filled-in note
|
|
77
|
+
|
|
78
|
+
```yaml
|
|
79
|
+
---
|
|
80
|
+
title: "HashiCorp Vault vs Infisical for SMB secret management"
|
|
81
|
+
tier: research
|
|
82
|
+
topic: secrets-management
|
|
83
|
+
domains:
|
|
84
|
+
- security
|
|
85
|
+
- devops
|
|
86
|
+
audience:
|
|
87
|
+
- self
|
|
88
|
+
- team
|
|
89
|
+
tags:
|
|
90
|
+
- secrets
|
|
91
|
+
- hashicorp-vault
|
|
92
|
+
- infisical
|
|
93
|
+
- comparison
|
|
94
|
+
status: active
|
|
95
|
+
last_updated: '2026-04-15'
|
|
96
|
+
source: mixed
|
|
97
|
+
complexity: medium
|
|
98
|
+
confidence: medium
|
|
99
|
+
keywords:
|
|
100
|
+
- hashicorp-vault
|
|
101
|
+
- infisical
|
|
102
|
+
- secret-management
|
|
103
|
+
- smb
|
|
104
|
+
dependencies: []
|
|
105
|
+
related:
|
|
106
|
+
- secrets-rotation-patterns.md
|
|
107
|
+
supersedes: []
|
|
108
|
+
summary: Comparison of HashiCorp Vault and Infisical for small-to-medium business secret management, with cost, ops overhead, and feature tradeoffs.
|
|
109
|
+
owner: self
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
# HashiCorp Vault vs Infisical for SMB secret management
|
|
113
|
+
|
|
114
|
+
## TL;DR
|
|
115
|
+
|
|
116
|
+
<one paragraph conclusion>
|
|
117
|
+
|
|
118
|
+
## What we currently do
|
|
119
|
+
|
|
120
|
+
<if Flow A surfaced this, summarize from semantic-sidekick findings and cite the docs>
|
|
121
|
+
|
|
122
|
+
## Options evaluated
|
|
123
|
+
|
|
124
|
+
### HashiCorp Vault
|
|
125
|
+
...
|
|
126
|
+
|
|
127
|
+
### Infisical
|
|
128
|
+
...
|
|
129
|
+
|
|
130
|
+
## Recommendation
|
|
131
|
+
|
|
132
|
+
<with explicit confidence level>
|
|
133
|
+
```
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: vault-first
|
|
3
|
+
description: Default mode skill for semantic-sidekick. Treats the markdown vault as present context, not retrievable-on-demand storage. Activates on any operational, architectural, or "how/why/where does this project…" question about the current project, product, or codebase — including prose questions like "how do we deploy", "what's our process for X", "why is Y structured this way", "where does Z live", "how does auth work here", "what are the conventions", operational runbook questions, and gotcha/known-issue lookups. Also activates when hooks have injected <vault-context> blocks into the conversation. Does NOT activate on pure code-symbol lookups ("where is function X defined" → Grep) or on research/evaluative questions about external tools ("is there a better X than Y" → semantic-first's research flow). Coexists with semantic-first — semantic-first handles routing between docs index + research vault; vault-first is the behavioral mode that actually uses them on every relevant prompt rather than waiting to be asked.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# vault-first
|
|
7
|
+
|
|
8
|
+
**Default mode.** The vault is present, not retrievable. Use it on every relevant prompt, cite what you find, and say it out loud when you didn't find anything.
|
|
9
|
+
|
|
10
|
+
## Why this skill exists
|
|
11
|
+
|
|
12
|
+
A 500-note vault that Claude only consults when explicitly asked is a liability — the knowledge creates false confidence ("we've documented that") while being silently bypassed. `semantic-first` routes lookups *when Claude decides to look*. `vault-first` is the decision layer: for any project-scoped prose question, Claude looks *by default*, before answering from memory or guessing.
|
|
13
|
+
|
|
14
|
+
This skill is one of three mode skills in the sidekick routing system (`vault-first`, `research-mode`, `outage-silence`). It is the default when none of the others apply.
|
|
15
|
+
|
|
16
|
+
## When you are in vault-first mode
|
|
17
|
+
|
|
18
|
+
You are in vault-first mode when:
|
|
19
|
+
|
|
20
|
+
- The user's question is about **this specific project, product, or codebase** and the answer would naturally live in a design doc, runbook, ADR, troubleshooting guide, or decision log.
|
|
21
|
+
- The user asks "how", "why", "where", or "what's our X" about anything project-scoped.
|
|
22
|
+
- A hook has injected a `<vault-context>` block into the conversation — that block is the result of a proactive search; treat it as presented context, not a reference dump.
|
|
23
|
+
- None of the other mode skills (`research-mode`, `outage-silence`) have fired.
|
|
24
|
+
|
|
25
|
+
## What vault-first mode changes about your behavior
|
|
26
|
+
|
|
27
|
+
### 1. Look at injected context first
|
|
28
|
+
|
|
29
|
+
If the conversation contains a `<vault-context>` block (from `SessionStart` preload or `UserPromptSubmit` search-on-prompt), read the listed note paths and snippets before you do anything else. The hook already did a hybrid search for you — the top hits are sitting in front of you. Do not re-run the same search.
|
|
30
|
+
|
|
31
|
+
If the injected context is enough to answer, answer from it and cite the note paths.
|
|
32
|
+
|
|
33
|
+
### 2. If injected context is thin or missing, search the vault yourself
|
|
34
|
+
|
|
35
|
+
Call `mcp__semantic-vault__search_hybrid` (or `search_text` for exact-match needs) with the user's question as the query. Read 2–3 promising hits in full via `mcp__semantic-vault__read_note` before answering. Do not answer from snippets alone — snippets lose context and produce confidently wrong answers.
|
|
36
|
+
|
|
37
|
+
### 3. Cite, or say "not in vault" — **only when the prompt is actually a vault lookup**
|
|
38
|
+
|
|
39
|
+
Read this carefully: the cite-or-deflect rule applies **only when the user asked a project-scoped prose question that a filed note could plausibly answer**. That's the narrow case. For everything else, **ignore the `<vault-context>` block silently** — the hook injects it unconditionally, but the rule does not.
|
|
40
|
+
|
|
41
|
+
**DO cite-or-deflect when:**
|
|
42
|
+
- User asks "how does X work here?", "what's our process for Y?", "where does Z live?", "why is this structured this way?"
|
|
43
|
+
- User asks an operational runbook / troubleshooting / gotcha question
|
|
44
|
+
- User asks a decision-history question ("why did we choose X?")
|
|
45
|
+
|
|
46
|
+
**DO NOT narrate "not in vault" when:**
|
|
47
|
+
- The user's prompt is a **meta-question about the tool** ("is semantic-vault the same as semantic-sidekick?", "should I install this somewhere?", "what command do I run?")
|
|
48
|
+
- The user is **debugging the plugin itself** ("/mcp shows only one server", "getting ERR_MODULE_NOT_FOUND")
|
|
49
|
+
- The user asks a **yes/no or status check** ("did that work?", "are you stuck?", "should I restart?")
|
|
50
|
+
- The user is **giving a directive** ("proceed", "fix it", "merge the PR")
|
|
51
|
+
- The user is asking about **Claude Code** itself, or about your capabilities generally
|
|
52
|
+
- The prompt is **conversational/social** ("thanks", "ok", "got it")
|
|
53
|
+
|
|
54
|
+
In all the "DO NOT" cases: the `<vault-context>` block is injected automatically by the UserPromptSubmit hook but is not relevant. Pretend it isn't there. Answer the user's actual question directly. Do not open your response with any variant of "not in vault" — that is noise, not honest deflection.
|
|
55
|
+
|
|
56
|
+
The cue for applying cite-or-deflect is the *shape of the user's question*, not the presence of a `<vault-context>` block.
|
|
57
|
+
|
|
58
|
+
**When you DO apply cite-or-deflect:**
|
|
59
|
+
- **Cite:** "…per `runbooks/deploy-staging.md` and `decisions/2026-03-auth-migration.md`." List the paths so the user can open them.
|
|
60
|
+
- **Deflect:** "This isn't in the vault. Nearest matches were `X.md` and `Y.md` but neither covers Z. Want me to [search the web / ask more / file a stub note]?"
|
|
61
|
+
|
|
62
|
+
Do not silently pivot to web search, do not guess from training data, and do not say "the vault has something like this" without naming files. If you haven't named a file, you haven't cited.
|
|
63
|
+
|
|
64
|
+
### 4. Offer to capture when you fill a gap
|
|
65
|
+
|
|
66
|
+
If you had to answer from outside the vault (web search, training knowledge, the user telling you something new), offer once to file a note: *"Worth capturing this in the vault as `gotchas/foo.md`?"* — then let the user decide. This is the ingest loop's entry point; don't force it, but don't skip it.
|
|
67
|
+
|
|
68
|
+
## Boundary conditions — when vault-first does NOT fire
|
|
69
|
+
|
|
70
|
+
- **Code-symbol lookups.** "Where is `parseAuth` defined?" → `Grep`. "Show me the `User` model." → `Glob`. If the answer is a file + line, the vault is the wrong tool.
|
|
71
|
+
- **Pure external research.** "What's the best vector DB for <100k docs?" → `semantic-first`'s Flow B (research vault + web).
|
|
72
|
+
- **Active incidents.** If the user mentions "down", "broken", "customers", "rollback", "oncall", an alert timestamp, or pasted error logs, `outage-silence` takes over. Stop auto-firing search. Wait for explicit `/vault` request.
|
|
73
|
+
- **Meta-questions about Claude, Claude Code, or this plugin itself.** "How do I use `/clear`?", "is semantic-vault the same as semantic-sidekick?", "should I reinstall?" → these aren't vault lookups. Answer directly, do not narrate "not in vault".
|
|
74
|
+
- **Tool/debug/status prompts.** "getting this error…", "did that work?", "are you stuck?", "what command do I run?" → operational meta. Not vault lookups.
|
|
75
|
+
- **Directives and conversational turns.** "proceed", "merge please", "thanks", "ok go" → just act/acknowledge. Do not deflect.
|
|
76
|
+
|
|
77
|
+
## Interaction with hooks
|
|
78
|
+
|
|
79
|
+
Two hooks participate in this mode:
|
|
80
|
+
|
|
81
|
+
- **`SessionStart` hook** — runs a hybrid search seeded from cwd and branch, injects the top-K hits as a `<vault-context>` block at session start. You should see it in your context when this skill first activates.
|
|
82
|
+
- **`UserPromptSubmit` hook** — runs a keyword search on each user prompt, fingerprinted against recent queries, and injects a `<vault-context>` block if the fingerprint is new. That is why you sometimes see injected hits and sometimes don't — the hook deliberately suppresses re-firing for near-identical prompts.
|
|
83
|
+
|
|
84
|
+
If you see `<vault-context source="sessionstart">` or `<vault-context source="prompt">` in your context, those are hook outputs. Treat them as the vault speaking first.
|
|
85
|
+
|
|
86
|
+
## What success looks like
|
|
87
|
+
|
|
88
|
+
- User asks "how do we handle MFA enforcement?" with no `vault-first` prior mention — you read the injected `<vault-context>` block, pull `features/authentication/mfa-enforcement-overview.md`, answer with citation. Tool budget: 1 read.
|
|
89
|
+
- User asks a project question where the hook injected nothing — you run `search_hybrid` yourself, read 2 hits, answer + cite. Tool budget: 2 reads + 1 search.
|
|
90
|
+
- User asks something genuinely not in the vault — you say "not in vault", name the nearest misses, offer to capture after the user gives you the answer.
|
|
91
|
+
- `outage-silence` fires — you go quiet on the vault, no proactive search, wait for `/vault`.
|
|
92
|
+
|
|
93
|
+
## What failure looks like
|
|
94
|
+
|
|
95
|
+
- Ignoring the `<vault-context>` block and running a fresh search anyway — wastes the preload work.
|
|
96
|
+
- Answering project questions from training data without citing the vault.
|
|
97
|
+
- Saying "the docs cover this" without naming the file.
|
|
98
|
+
- Silently falling back to `Grep` when the project question has an obvious prose answer in the vault.
|
|
99
|
+
- Firing vault-first during an outage and drowning the user in search context when they need terse operational help.
|
|
100
|
+
- **Opening responses with "not in vault" on non-lookup prompts** (meta-questions, debugging, directives, status checks). The `<vault-context>` block fires on every prompt because the hook is unconditional; the skill is the filter. If the prompt isn't a lookup, silently ignore the injected context. "Not in vault" should only appear when the user *asked* something and the vault *didn't answer it*.
|