@ericrisco/rsc 0.1.49 → 0.1.51

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.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: rag
3
- description: "Use when building grounded Q&A over your own documents — handbook, support tickets, PDFs, policies — and the answers must come only from the corpus with citations; when retrieval surfaces the right document but the answer is still wrong; when the model invents facts that are not in the sources; when you need to measure whether retrieval is any good; when the right document is found but the wrong passage is used. Triggers: 'build a bot that answers from our docs with citations', 'my RAG returns the right document but the answer is wrong', 'how do I stop the model hallucinating facts not in the corpus', 'context recall vs context precision', 'add contextual retrieval / prepend chunk context before embedding', 'hybrid search plus rerank pipeline', 'respuestas con citas sobre nuestros documentos', 'el bot s'inventa coses que no surten als documents'. NOT operating the vector store itself — collection schema, HNSW ef_search, quantization (that is vector-db)."
3
+ description: "Use when building grounded Q&A over your own corpus — chunk, retrieve hybrid, rerank, ground, cite chunk ids, refuse when the sources fall short — or when the right document is retrieved but the answer is still wrong, invented, or unmeasured. NOT operating the store itself — collection schema, HNSW ef_search, quantization (that is `vector-db`)."
4
4
  tags: [rag, retrieval-augmented-generation, chunking, hybrid-search, reranking, grounding, citations, faithfulness, contextual-retrieval]
5
5
  recommends: [vector-db, embeddings-search, document-processing, chatbot, agent-eval]
6
6
  origin: risco
@@ -8,15 +8,14 @@ origin: risco
8
8
 
9
9
  # rag — own the retrieve → rerank → ground → cite → refuse pipeline
10
10
 
11
- You own the **pipeline** that turns a corpus plus a question into a grounded, cited answer.
12
- You do **not** own the store underneath it (`../vector-db/SKILL.md`) nor the embedding and
13
- chunk-sizing science beside it (`embeddings-search`). Your job is the glue: chunk, optionally
14
- contextualize, index, retrieve hybrid, rerank, assemble a grounded prompt, cite the sources,
15
- and **refuse** when the context does not contain the answer.
11
+ You own the **pipeline** that turns a corpus plus a question into a grounded, cited answer: chunk,
12
+ optionally contextualize, index, retrieve hybrid, rerank, assemble a grounded prompt, cite the
13
+ sources, and **refuse** when the context does not contain the answer.
16
14
 
17
15
  You are judged by **retrieval quality and answer faithfulness**, not by raw vector math. If you
18
- find yourself tuning HNSW parameters, you wandered into `vector-db`. If you are comparing
19
- embedding models or chunk sizes, that is `embeddings-search`.
16
+ find yourself tuning HNSW parameters, you wandered into the store underneath you
17
+ (`../vector-db/SKILL.md`). If you are comparing embedding models or chunk sizes, that is the
18
+ science beside you (`embeddings-search`).
20
19
 
21
20
  ## The pipeline, and where each stage hands off
22
21
 
@@ -25,19 +24,21 @@ delegate to a sibling skill rather than living here.
25
24
 
26
25
  | Stage | What you do | Hands off to |
27
26
  |---|---|---|
28
- | Ingest | Get clean text out of PDFs/DOCX/HTML/OCR | `../document-processing/SKILL.md` |
29
- | Chunk | Heading/semantic-aware splits with overlap, stable ids | chunk-size science → `embeddings-search` |
27
+ | Ingest | Get clean text out of PDFs/DOCX/HTML/OCR | you assume text exists → `../document-processing/SKILL.md` |
28
+ | Chunk | Heading/semantic-aware splits with overlap, stable ids | model, dims + chunk-size science → `embeddings-search` |
30
29
  | Contextualize | Prepend an LLM-written context blurb per chunk (optional) | stays here |
31
- | Index | Embed + write dense vectors and a BM25/keyword index | the store → `../vector-db/SKILL.md` |
30
+ | Index | Embed + write dense vectors and a BM25/keyword index | you upsert, it owns the knobs → `../vector-db/SKILL.md` |
32
31
  | Retrieve | Hybrid dense + BM25, fuse with RRF, top ~150 | hybrid query mechanics → `../vector-db/SKILL.md` |
33
32
  | Rerank | Cross-encoder over the 150, keep top ~20 | stays here |
34
33
  | Ground + cite | System prompt: answer only from context, cite chunk ids | stays here |
35
34
  | Refuse | Output "I don't have enough information" on weak context | stays here |
36
35
  | Evaluate | Faithfulness, answer relevancy, context precision/recall | general harness → `agent-eval` |
37
36
 
38
- Surfacing this answer inside a chat product (sessions, channels, UI) is `../chatbot/SKILL.md`;
39
- pulling schema-constrained fields out of text is `structured-extraction`. `rag` is the
40
- retrieval brain those products call.
37
+ Three neighbors are not stages at all. Surfacing this answer inside a chat product (sessions,
38
+ channels, UI) is `../chatbot/SKILL.md` — it calls you, not the reverse. A multi-step tool loop with
39
+ state, where retrieval is one tool among many, is `../building-agents/SKILL.md`. Pulling
40
+ schema-constrained fields out of text instead of a grounded prose answer is
41
+ `structured-extraction`. `rag` is the retrieval brain those products call.
41
42
 
42
43
  ## Retrieval is the bottleneck — measure recall before touching the prompt
43
44
 
@@ -87,8 +88,8 @@ def chunk_markdown(doc_id, text, target=800, overlap=120):
87
88
  return out
88
89
  ```
89
90
 
90
- For the deep "what window/overlap maximizes recall for *this* corpus" study, that is
91
- `embeddings-search`. Here you just need structurally sane chunks that keep their ids.
91
+ The "what window/overlap maximizes recall for *this* corpus" study is `embeddings-search`; here you
92
+ just need structurally sane chunks that keep their ids.
92
93
 
93
94
  ## Contextual retrieval — prepend context before you embed
94
95
 
@@ -107,7 +108,8 @@ document for search retrieval. Answer only with the context, nothing else.
107
108
  ```
108
109
 
109
110
  Embed `context + "\n" + chunk_text` (not the bare chunk). The full implementation — caching the
110
- document prompt, batching, the BM25 side — lives in `references/pipeline.md`.
111
+ document prompt, batching, the BM25 side, and a runnable retrieve → rerank → answer skeleton —
112
+ lives in `references/pipeline.md`.
111
113
 
112
114
  ## Hybrid retrieval + RRF + rerank
113
115
 
@@ -144,8 +146,8 @@ top = [candidates[r.index] for r in ranked.results] # each still carries chunk_
144
146
 
145
147
  Properly grounded RAG reduces hallucination rates by up to ~71%; poorly grounded pipelines still
146
148
  hallucinate in up to ~40% of responses *even with the right doc retrieved* (Confident AI / Maxim
147
- 2025, accessed 2026-06-02). The prompt must do three non-negotiable things: bind the answer to
148
- the context, force inline citations, and provide an explicit refusal path.
149
+ 2025, accessed 2026-06-02). The prompt must do three things: bind the answer to the context, force
150
+ inline citations, and provide an explicit refusal path.
149
151
 
150
152
  ```text
151
153
  You answer ONLY using the information inside <context>. Do not use prior knowledge.
@@ -205,22 +207,3 @@ the RAG-specific metrics live here.
205
207
  | Embedding the query differently from the corpus | Query and chunks land in different spaces | Same model + same preprocessing both sides |
206
208
  | Dense-only, ignoring BM25/keyword | Misses exact codes/names/error strings | Hybrid dense + BM25 fused with RRF |
207
209
  | Tuning temperature to fix wrong answers | Generation is rarely the bottleneck | Measure context recall first |
208
-
209
- ## Wiring map
210
-
211
- - **Ingestion (file → text, OCR, tables):** `../document-processing/SKILL.md` — you assume text
212
- already exists; send raw PDFs/DOCX/scans there first.
213
- - **The store (collection, index, hybrid query, quantization):** `../vector-db/SKILL.md` — you
214
- call it to upsert and query; it owns the knobs.
215
- - **Embedding model + chunk-size science:** `embeddings-search` — picking the model, dims,
216
- cost, and the semantic-vs-fixed chunking experiments.
217
- - **Chat product surface (sessions, channels, UI):** `../chatbot/SKILL.md` — wraps the answer
218
- you return; it calls you, not the reverse.
219
- - **Multi-step tool/agent loop with state:** `../building-agents/SKILL.md` — when retrieval is
220
- one tool among many in a larger loop.
221
- - **General eval framework:** `agent-eval` — RAG-specific metrics are here; the harness is there.
222
- - **Schema-constrained field extraction:** `structured-extraction` — when the goal is fields,
223
- not a grounded prose answer.
224
-
225
- See `references/pipeline.md` for the full runnable retrieve → rerank → answer skeleton and
226
- `references/evaluation.md` for the metric formulas, thresholds, and CI gate.
@@ -4,6 +4,7 @@ description: "Always-on. Use whenever the current user turn would clearly benefi
4
4
  tags: [suggest, detect, install, meta, always-on]
5
5
  recommends: []
6
6
  profiles: [minimal, core, full]
7
+ origin: risco
7
8
  ---
8
9
 
9
10
  # rsc-suggest — the always-on layer
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: tauri
3
- description: "Use when building a lightweight cross-platform desktop (or v2 mobile) app with Tauri — a Rust core plus the OS-native WebView — wiring Rust commands and IPC, streaming data to the frontend, locking down the capabilities/permissions security model, or bundling and auto-updating tiny signed binaries. Triggers: 'build a Tauri app', 'expose a Rust command to my frontend', 'invoke from JS', 'tauri.conf.json', 'capabilities and permissions', 'stream download progress to the WebView', 'my command froze the UI', 'shrink my desktop binary vs Electron', 'set up the Tauri updater', 'crear una app d'escriptori lleugera amb Rust en lloc d'Electron', 'reducir el tamaño del binario de escritorio'. NOT a Chromium+Node desktop app that needs Node APIs in a main process (that is electron)."
3
+ description: "Use when building a lightweight cross-platform desktop (or v2 mobile) app with Tauri — a Rust core plus the OS-native WebView: Rust commands and IPC, streaming to the frontend, the default-deny capabilities/permissions ACL, bundling and signed auto-updates. NOT a Chromium+Node shell needing Node APIs in a main process (that is electron)."
4
4
  tags: [tauri, desktop, rust, cross-platform, ipc, webview]
5
5
  recommends: [rust, electron, react, secure-coding, github-actions]
6
6
  origin: risco
@@ -22,7 +22,8 @@ so the same Rust core can ship to mobile.
22
22
 
23
23
  This skill owns the **shell**: commands, IPC, the security ACL, the bundler, the updater.
24
24
  It does **not** own the Rust language itself (that is the `rust` skill), the web UI inside
25
- the window (the `react`/`nextjs` skills), or a Chromium+Node shell (`../electron/SKILL.md`).
25
+ the window (the `react`/`nextjs` skills), a Chromium+Node shell (`../electron/SKILL.md`), or
26
+ app-code hardening beyond the IPC boundary (`../secure-coding/SKILL.md`).
26
27
 
27
28
  ## Pick your starting shape
28
29
 
@@ -213,12 +214,6 @@ across three OSes is the `github-actions` skill's job; this skill defines what t
213
214
  | Copying a v1 `tauri.conf.json > allowlist` | That key does not exist in v2 | Use `capabilities/*.json` (ACL) |
214
215
  | Assuming bundled Chromium | It's the **OS** WebView (WebKit/WebView2) | Test rendering on each OS's engine; avoid Chromium-only CSS/JS |
215
216
 
216
- ## Pointers
217
-
218
- - `references/security.md` — capabilities/permissions/scope JSON, CSP recipes, isolation setup.
219
- - `references/bundling-distribution.md` — per-OS signing, updater keypair, sidecar, CI matrix.
220
- - Siblings: `../electron/SKILL.md` (the Chromium+Node alternative when you need a Node main
221
- process), `../secure-coding/SKILL.md` (app-code hardening). The `rust` skill owns the
222
- language; `react`/`nextjs` own the frontend UI; `github-actions` owns the release CI matrix.
223
- - `scripts/verify.sh` — advisory static lint over `src-tauri/` (capabilities present, registered
224
- commands exist, no v1 `allowlist`, fallible-looking commands return `Result`).
217
+ `scripts/verify.sh` is an advisory static lint over an `src-tauri/` tree that catches several of
218
+ these: capabilities present, registered commands exist, no v1 `allowlist`, fallible-looking
219
+ commands return `Result`.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: webhooks
3
- description: "Use when building the inbound side of a webhook — the HTTP endpoint that receives events a system pushes you, proves they are authentic, refuses to process the same one twice, and acks fast. Covers the mechanics every source shares: raw-body HMAC verification, ~5-min timestamp/replay window, idempotency on a stable event id, fast-ack-then-queue, retry/poison handling. Triggers: 'receive webhooks and process them safely', 'verify an incoming webhook signature', 'my signature verification fails even though the secret is correct', 'provider keeps retrying and we process the same event twice', 'handler times out under load, ack fast and queue', 'recibir webhooks entrantes', 'verificar la firma del webhook entrante', 'evitar procesar el mismo evento dos veces'. NOT the Stripe-Signature scheme (that is stripe), NOT email bounce/suppression hooks (that is email-connector), NOT outbound clients calling a third-party API (that is api-connector-builder), NOT what runs after the event lands (that is automation-flows)."
3
+ description: "Use when building the receiving end of a webhook — a provider-agnostic endpoint that proves pushed events are authentic and never processes one twice: raw-body HMAC, ~5-min replay window, idempotency on the event id, fast-ack-then-queue. NOT the Stripe-Signature scheme (that is stripe), NOT outbound clients you call (that is api-connector-builder)."
4
4
  tags: [webhooks, inbound-webhooks, hmac-verification, idempotency, signature-verification, queue, connectors]
5
5
  recommends: [stripe, email-connector, api-connector-builder, automation-flows, redis, secure-coding]
6
6
  profiles: []
@@ -13,14 +13,9 @@ You are building the side of a webhook that *receives*. Some external system
13
13
  pushes an HTTP POST at your endpoint; your job is to prove it is real, refuse to
14
14
  act on it twice, and answer fast. That is the whole mandate.
15
15
 
16
- This skill is provider-agnostic. It teaches the mechanics every webhook source
17
- shares, not any one vendor's event catalog. The deliverable is secret-safe
18
- server code plus minimal config: a handler that reads the **raw** request body
19
- for HMAC verification, compares signatures in **constant time**, rejects events
20
- outside a **timestamp tolerance**, **dedupes** on a stable event id, then
21
- **persists-or-enqueues before returning `2xx`**.
22
-
23
- It ends at "enqueued." What happens to the event afterward is a different job:
16
+ This skill is provider-agnostic — it teaches the mechanics every webhook source
17
+ shares, not any one vendor's event catalog — and it ends at "enqueued." What
18
+ happens to the event afterward is a different job:
24
19
 
25
20
  - The Stripe-specific scheme (`Stripe-Signature`, `t=,v1=`, `stripe listen`,
26
21
  the event model) → `../stripe/SKILL.md`.
@@ -29,8 +24,10 @@ It ends at "enqueued." What happens to the event afterward is a different job:
29
24
  - The *outbound* client that calls someone else's API → `api-connector-builder`.
30
25
  - Multi-step orchestration after the event lands → `automation-flows`.
31
26
  - Broker/queue tuning (BullMQ concurrency, DLQ ops) → `redis`.
27
+ - Constant-time compare, secret handling, supply-chain hygiene →
28
+ `../secure-coding/SKILL.md`.
32
29
 
33
- ## The pipeline — non-negotiable order
30
+ ## The pipeline
34
31
 
35
32
  These five stages run in exactly this order. Each one exists to protect the one
36
33
  after it; reorder them and you either trust forged data or waste work.
@@ -43,13 +40,9 @@ after it; reorder them and you either trust forged data or waste work.
43
40
  | 4 | **Dedupe** on the event id | At-least-once delivery means duplicates are normal. Mark it seen before doing work, not after. |
44
41
  | 5 | **Persist/enqueue → `2xx`** | Hand the event to durable storage, then ack. The ack means "I own this now." |
45
42
 
46
- Two facts make this order non-negotiable:
47
-
48
- - **Delivery is at-least-once, never exactly-once.** Every major provider
49
- retries on non-2xx or timeout, so duplicate deliveries are normal traffic.
50
- Idempotency is required, not a nice-to-have.
51
- - **The handler must be fast.** Heavy synchronous work inside it causes provider
52
- timeouts and a storm of retries. Verify, dedupe, enqueue, ack — then work.
43
+ **Delivery is at-least-once, never exactly-once.** Every major provider retries
44
+ on non-2xx or timeout, so duplicate deliveries are normal traffic and idempotency
45
+ is required, not a nice-to-have.
53
46
 
54
47
  ## Verify the signature
55
48
 
@@ -180,8 +173,10 @@ it?" check and both run. Let the UNIQUE constraint (or `NX`) be the lock.
180
173
 
181
174
  ## Fast-ack & queue
182
175
 
183
- Return `2xx` as soon as the event is durably stored or enqueued, then do the
184
- real work in a background worker. The status code is a contract with the sender:
176
+ Heavy synchronous work inside the handler causes provider timeouts and a storm
177
+ of retries. Return `2xx` as soon as the event is durably stored or enqueued,
178
+ then do the real work in a background worker. The status code is a contract with
179
+ the sender:
185
180
 
186
181
  | You return | Meaning to the provider | Use it when |
187
182
  |------------|-------------------------|-------------|
@@ -229,18 +224,6 @@ Capturing the raw body is framework-specific and is the usual culprit behind
229
224
 
230
225
  `scripts/verify.sh` is a read-only heuristic linter. Run it from the root of the
231
226
  project that contains your handler; it scans candidate files and prints
232
- PASS/WARN/FAIL for each invariant (raw-body verify, constant-time compare,
233
- timestamp check, secret-from-env, dedupe-on-event-id). It is advisory, not a
234
- compiler — a WARN means "I could not find evidence," which on a clean/empty tree
235
- is expected and exits `0`.
236
-
237
- ## Cross-references
238
-
239
- - Stripe's exact scheme and event model → `../stripe/SKILL.md`
240
- - Email bounce/complaint suppression webhooks → `../email-connector/SKILL.md`
241
- - The outbound API client (auth, pagination, retries you initiate) →
242
- `api-connector-builder`
243
- - Orchestrating what happens after the event lands → `automation-flows`
244
- - Queue/broker concurrency and DLQ operations → `redis`
245
- - Constant-time compare, secret handling, supply-chain hygiene →
246
- `../secure-coding/SKILL.md`
227
+ PASS/WARN/FAIL per invariant (raw-body verify, constant-time compare, timestamp
228
+ check, secret-from-env, dedupe-on-event-id). A WARN means "I could not find
229
+ evidence," which on a clean tree is expected and exits `0`.