start-vibing 4.4.3 → 4.4.5

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.
Files changed (26) hide show
  1. package/dist/cli.js +230 -56
  2. package/package.json +42 -42
  3. package/template/.claude/agents/research-query.md +128 -0
  4. package/template/.claude/agents/research-scout.md +124 -0
  5. package/template/.claude/agents/research-synthesize.md +139 -0
  6. package/template/.claude/agents/research-verify.md +84 -0
  7. package/template/.claude/commands/research.md +18 -0
  8. package/template/.claude/hooks/research-session-start.sh +4 -0
  9. package/template/.claude/settings.json +4 -0
  10. package/template/.claude/skills/research/SKILL.md +285 -0
  11. package/template/.claude/skills/research/references/domain-playbooks.md +604 -0
  12. package/template/.claude/skills/research/references/ontology-patterns.md +376 -0
  13. package/template/.claude/skills/research/references/research-methodology.md +794 -0
  14. package/template/.claude/skills/research/references/source-directory.md +280 -0
  15. package/template/.claude/skills/research/scripts/__pycache__/extract-claims.cpython-313.pyc +0 -0
  16. package/template/.claude/skills/research/scripts/check-cache.sh +129 -0
  17. package/template/.claude/skills/research/scripts/dedup-research.sh +80 -0
  18. package/template/.claude/skills/research/scripts/extract-claims.py +83 -0
  19. package/template/.claude/skills/research/scripts/update-index.sh +106 -0
  20. package/template/.claude/skills/research/scripts/verify-citations.sh +107 -0
  21. package/template/.claude/skills/research/templates/adr.md.tpl +66 -0
  22. package/template/.claude/skills/research/templates/index.md.tpl +25 -0
  23. package/template/.claude/skills/research/templates/moc.md.tpl +39 -0
  24. package/template/.claude/skills/research/templates/research-state.schema.json +64 -0
  25. package/template/.claude/skills/research/templates/research.md.tpl +117 -0
  26. package/template/.claude/agents/research-web.md +0 -164
@@ -0,0 +1,376 @@
1
+ # Ontology Patterns — Reference
2
+
3
+ > Practical, LLM-friendly ontology encoding for `/docs/research/`. SKOS-shaped, markdown-native, round-trippable through `extract-claims.py`.
4
+
5
+ ---
6
+
7
+ ## 1. Why SKOS Beats OWL for LLM-Consumed Docs
8
+
9
+ OWL (Web Ontology Language; W3C Rec 2012, <https://www.w3.org/TR/owl2-overview/>) gives you description-logic reasoning: subsumption, equivalence, disjointness, cardinality. The tax: every concept needs an IRI, every property needs a domain/range, every assertion is a triple, and serializations balloon.
10
+
11
+ SKOS (Simple Knowledge Organization System; W3C Rec 2009, <https://www.w3.org/TR/skos-reference/>) gives you the 80% case — concepts, broader/narrower/related, prefLabel/altLabel, scopeNote — at a fraction of the surface area. SKOS is _intentionally informal_ about logic; it expects retrieval, not inference.
12
+
13
+ **For LLM consumption (Claude reading research docs to ground future answers), SKOS wins on:**
14
+
15
+ | Dimension | OWL | SKOS |
16
+ | ----------------------------- | -------------------------------- | --------------------------------------- |
17
+ | Token cost per concept | High (axioms, IRIs, domains) | Low (label + a few links) |
18
+ | Looseness tolerated | Reasoner breaks on inconsistency | Retrieval still works on contradictions |
19
+ | Markdown round-trip | Hard (needs Turtle/RDF/XML) | Trivial (frontmatter + inline lines) |
20
+ | Author burden | High (must understand DL) | Low (broader/narrower/related) |
21
+ | Reasoning needed at read time | Often | Rarely |
22
+
23
+ The skill therefore uses SKOS-shaped semantics encoded directly in markdown, with a closed vocabulary of relationships extended slightly past stock SKOS to cover engineering/research needs.
24
+
25
+ ---
26
+
27
+ ## 2. Recommended Relationship Vocabulary
28
+
29
+ This is the **closed list** for `/docs/research/`. `extract-claims.py` recognizes exactly these verbs (case-insensitive, hyphenated). Anything else is a free-text sentence and is _not_ indexed as a relationship.
30
+
31
+ | Relation | Direction | Meaning | SKOS analogue |
32
+ | ---------------- | --------- | --------------------------------------- | ------------------- |
33
+ | `is-a` | A → B | A is a subtype/specialization of B | skos:broader |
34
+ | `has-a` | A → B | A includes/owns B as a part | (custom; mereology) |
35
+ | `composed-of` | A → B | A is built from multiple B (collection) | (custom) |
36
+ | `instance-of` | A → B | A is a concrete instance of category B | rdf:type |
37
+ | `depends-on` | A → B | A requires B to function | (custom) |
38
+ | `constrained-by` | A → B | A's behavior is bounded by rule/spec B | (custom) |
39
+ | `resolved-by` | A → B | Problem A is addressed by solution B | (custom) |
40
+ | `precedes` | A → B | A happens before B (temporal/causal) | (Allen `before`) |
41
+ | `equivalent-to` | A ↔ B | A and B refer to the same concept | skos:exactMatch |
42
+ | `related-to` | A — B | A and B are associated; no hierarchy | skos:related |
43
+ | `contradicts` | A — B | A and B make incompatible claims | (custom) |
44
+ | `extends` | A → B | A builds on B, adding capability | (custom) |
45
+ | `deprecated-by` | A → B | A is superseded by B | (custom) |
46
+
47
+ Notes:
48
+
49
+ - `is-a` is transitive: if `A is-a B` and `B is-a C`, the indexer materializes `A is-a C`. Use sparingly to avoid exploding the graph.
50
+ - `equivalent-to` is symmetric and merges concept neighborhoods at index time.
51
+ - `contradicts` is symmetric and is what the synthesis agent uses to populate the `## Disagreements` section.
52
+ - `related-to` is the catch-all. Prefer a typed verb if available — `related-to` is for when the connection is real but the type is ambiguous.
53
+
54
+ ---
55
+
56
+ ## 3. Encoding in Plain Markdown
57
+
58
+ Two valid encodings, both parsed by `extract-claims.py`:
59
+
60
+ ### 3.1 Frontmatter declaration (concepts list)
61
+
62
+ ```yaml
63
+ ---
64
+ title: React Data Fetching
65
+ concepts:
66
+ - server-components
67
+ - suspense
68
+ - streaming-ssr
69
+ - use-hook
70
+ - data-cache
71
+ ---
72
+ ```
73
+
74
+ Concepts in this list are local to the doc and are slugged (`kebab-case`, lowercased, ASCII). They become first-class nodes in the knowledge graph.
75
+
76
+ ### 3.2 Inline relationship lines
77
+
78
+ A line that matches the regex `^([A-Za-z0-9-]+)\s+(is-a|has-a|composed-of|instance-of|depends-on|constrained-by|resolved-by|precedes|equivalent-to|related-to|contradicts|extends|deprecated-by)\s+([A-Za-z0-9-]+)\s*(\.|$|—.*)$` is a relationship triple.
79
+
80
+ Examples:
81
+
82
+ ```
83
+ server-components is-a react-rendering-model.
84
+ suspense depends-on react-fiber.
85
+ use-hook extends react-hooks-api — adds promise unwrapping.
86
+ fetch-on-render deprecated-by render-as-you-fetch.
87
+ streaming-ssr related-to progressive-hydration.
88
+ ```
89
+
90
+ The trailing period is required so prose sentences that happen to mention these verbs are not falsely matched. The em-dash + free text after is allowed for short scope notes; the indexer ignores it for graph building but keeps it in the doc.
91
+
92
+ ### 3.3 Block form (when you have many relations to one concept)
93
+
94
+ ```
95
+ ## server-components
96
+
97
+ - is-a react-rendering-model.
98
+ - depends-on react-flight-protocol.
99
+ - composed-of rsc-payload, server-runtime, client-bridge.
100
+ - contradicts client-only-rendering — coexistence requires careful boundary design.
101
+ - related-to streaming-ssr.
102
+ ```
103
+
104
+ Lines starting with `- ` under an H2/H3 whose slug matches a frontmatter concept are auto-prefixed with that concept as the subject.
105
+
106
+ ---
107
+
108
+ ## 4. Concept Schemes — When and When Not
109
+
110
+ A **concept scheme** (skos:ConceptScheme) is a controlled vocabulary scoped to a project or topic family. Use one when:
111
+
112
+ - You have ≥ 3 docs in `/docs/research/` covering related topics.
113
+ - The same concept is referenced from multiple docs with potential label drift (e.g., "RSCs" vs "react-server-components" vs "Server Components").
114
+ - You need a single source of truth for `prefLabel` and `altLabel`.
115
+
116
+ Skip when:
117
+
118
+ - The topic is one-off (single doc, no expected follow-ups).
119
+ - The concepts are jargon-stable (HTTP status codes, ISO date formats — already canonicalized elsewhere).
120
+
121
+ When in use, the concept scheme lives at `/docs/research/_concepts.md`:
122
+
123
+ ```yaml
124
+ ---
125
+ title: Concept Scheme
126
+ type: skos:ConceptScheme
127
+ ---
128
+ ## react-server-components
129
+
130
+ - prefLabel: React Server Components
131
+ - altLabel: RSC, RSCs, Server Components
132
+ - definition: React components that render on the server and stream their output to the client; first stable in React 19.
133
+ - scopeNote: Distinct from SSR. Specific to React's Flight protocol.
134
+ - broader: react-rendering-models
135
+ - related: streaming-ssr, suspense
136
+ - source: https://react.dev/reference/rsc/server-components
137
+
138
+ ## suspense
139
+
140
+ - prefLabel: Suspense
141
+ - altLabel: React Suspense
142
+ - definition: ...
143
+ - broader: react-async-primitives
144
+ - related: react-server-components, use-hook
145
+ - source: https://react.dev/reference/react/Suspense
146
+ ```
147
+
148
+ Each doc in `/docs/research/` that references a concept by its slug inherits the labels and definition from the scheme. If a doc redefines `prefLabel` or `definition` for the same slug, the indexer flags **ontology drift** as a build error.
149
+
150
+ ---
151
+
152
+ ## 5. Wikilink Conventions
153
+
154
+ - `[[concept-slug]]` — outbound link to the concept's canonical doc (or to the scheme if no dedicated doc exists).
155
+ - `[[concept-slug|Display Text]]` — outbound with custom anchor text.
156
+ - Backlinks are auto-generated in `/docs/research/index.md#backlinks` by `build-ontology.py`.
157
+
158
+ Rules:
159
+
160
+ - Slugs are stable. Renaming a concept requires a migration entry in `/docs/research/_migrations.md` mapping old → new.
161
+ - Wikilinks may target a concept (`[[suspense]]`), a doc (`[[react-data-fetching]]`), or a scheme entry (`[[_concepts#suspense]]`).
162
+ - Markdown link syntax `[label](url)` is for _external_ sources only. Internal cross-references must be wikilinks so backlinks work.
163
+
164
+ ---
165
+
166
+ ## 6. Worked Example A — React Data Fetching
167
+
168
+ `/docs/research/react-data-fetching.md`:
169
+
170
+ ```yaml
171
+ ---
172
+ title: React Data Fetching (2026 state)
173
+ created: 2026-04-25
174
+ updated: 2026-04-25
175
+ freshness: fresh
176
+ concepts:
177
+ - server-components
178
+ - suspense
179
+ - use-hook
180
+ - streaming-ssr
181
+ - render-as-you-fetch
182
+ - fetch-on-render
183
+ - data-cache
184
+ tags: [react, data-fetching, ssr]
185
+ ---
186
+ ```
187
+
188
+ Body, ontology slice:
189
+
190
+ ```
191
+ ## Concept relationships
192
+
193
+ - server-components is-a react-rendering-model.
194
+ - server-components depends-on react-flight-protocol.
195
+ - server-components composed-of rsc-payload, server-runtime, client-bridge.
196
+ - suspense is-a react-async-primitive.
197
+ - suspense depends-on react-fiber.
198
+ - use-hook extends react-hooks-api — promise unwrapping inside components.
199
+ - use-hook depends-on suspense.
200
+ - streaming-ssr is-a server-rendering-strategy.
201
+ - streaming-ssr related-to server-components.
202
+ - render-as-you-fetch is-a data-fetching-pattern.
203
+ - fetch-on-render is-a data-fetching-pattern.
204
+ - fetch-on-render deprecated-by render-as-you-fetch.
205
+ - data-cache constrained-by react-cache-api — request-scoped, not session-scoped.
206
+ ```
207
+
208
+ Findings using these concepts:
209
+
210
+ ```
211
+ ### Finding 1 — Server Components ship zero client JS by default
212
+
213
+ Claim: Server Components render exclusively on the server and emit a serialized payload that the client reconciles without shipping component code. [[server-components]] [[react-flight-protocol]]
214
+
215
+ > "Server Components have no interactivity ... they don't use state or effects. They render once, on the server."
216
+ > — React docs, "Server Components", accessed 2026-04-25.
217
+
218
+ URL: https://react.dev/reference/rsc/server-components
219
+ ACCESSED-AT: 2026-04-25T14:00Z
220
+ VERIFY-METHOD: HTTP 200 + quote-grep ✓
221
+ Confidence: High (primary source — React official docs)
222
+ ```
223
+
224
+ ---
225
+
226
+ ## 7. Worked Example B — OAuth 2.0 Authorization Code Flow
227
+
228
+ `/docs/research/oauth2-auth-code-flow.md`:
229
+
230
+ ```yaml
231
+ ---
232
+ title: OAuth 2.0 Authorization Code Flow with PKCE
233
+ created: 2026-04-25
234
+ updated: 2026-04-25
235
+ freshness: fresh
236
+ concepts:
237
+ - oauth2
238
+ - authorization-code-grant
239
+ - pkce
240
+ - access-token
241
+ - refresh-token
242
+ - id-token
243
+ - authorization-server
244
+ - resource-server
245
+ - client
246
+ tags: [oauth2, security, auth]
247
+ ---
248
+ ```
249
+
250
+ Ontology slice:
251
+
252
+ ```
253
+ ## Concept relationships
254
+
255
+ - oauth2 is-a authorization-framework.
256
+ - oauth2 constrained-by rfc-6749.
257
+ - authorization-code-grant is-a oauth2-grant-type.
258
+ - authorization-code-grant constrained-by rfc-6749-section-4-1.
259
+ - pkce extends authorization-code-grant — adds code_verifier/code_challenge.
260
+ - pkce constrained-by rfc-7636.
261
+ - pkce resolved-by code-interception-attack.
262
+ - access-token has-a expiration.
263
+ - refresh-token precedes access-token-renewal.
264
+ - id-token is-a jwt.
265
+ - id-token related-to oidc.
266
+ - id-token contradicts access-token — different audience and purpose.
267
+ - authorization-server depends-on client-registry.
268
+ - resource-server constrained-by access-token-validation.
269
+ - implicit-grant deprecated-by authorization-code-grant — see OAuth 2.1 draft.
270
+ ```
271
+
272
+ Three findings cross-linking the concepts:
273
+
274
+ ```
275
+ ### Finding 1 — PKCE is mandatory for public clients
276
+
277
+ Claim: RFC 7636 mandates PKCE for clients that cannot keep a secret (mobile, SPA), and OAuth 2.1 draft extends this to all clients. [[pkce]] [[authorization-code-grant]] [[client]]
278
+
279
+ > "All clients SHOULD use PKCE ... clients without a client secret MUST use PKCE."
280
+ > — draft-ietf-oauth-v2-1-11, accessed 2026-04-25.
281
+
282
+ URL: https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-11
283
+ ACCESSED-AT: 2026-04-25T14:05Z
284
+ VERIFY-METHOD: HTTP 200 + quote-grep ✓
285
+ Confidence: High
286
+
287
+ ### Finding 2 — Implicit grant should not be used in new systems
288
+
289
+ Claim: The implicit grant is removed from OAuth 2.1 and OWASP recommends authorization-code + PKCE in all cases. [[implicit-grant]] [[authorization-code-grant]] [[pkce]]
290
+
291
+ URL: https://oauth.net/2.1/
292
+ ACCESSED-AT: 2026-04-25T14:07Z
293
+ VERIFY-METHOD: HTTP 200 + quote-grep ✓
294
+ Confidence: High
295
+
296
+ ### Finding 3 — Refresh-token rotation mitigates token theft
297
+
298
+ Claim: Rotating refresh tokens on each use, combined with reuse-detection, allows the authorization server to invalidate a compromised session. [[refresh-token]] [[authorization-server]]
299
+
300
+ URL: https://datatracker.ietf.org/doc/html/rfc6819#section-5.2.2.3
301
+ ACCESSED-AT: 2026-04-25T14:10Z
302
+ VERIFY-METHOD: HTTP 200 + quote-grep ✓
303
+ Confidence: High
304
+ ```
305
+
306
+ ---
307
+
308
+ ## 8. Anti-Patterns
309
+
310
+ ### 8.1 Over-Typed Relationships
311
+
312
+ Defining a new relation verb for every nuance (`maintained-by`, `documented-by`, `tested-by`, `deployed-by`...). The closed vocabulary in §2 covers the cases that survive retrieval. New verbs must be added to `extract-claims.py` and `ontology-patterns.md` together — a pull-request, not a one-off.
313
+
314
+ ### 8.2 Premature OWL
315
+
316
+ Adding `owl:disjointWith`, cardinality restrictions, or property characteristics to concepts that no reasoner will ever consume. The marker is: are you running a Pellet/HermiT reasoner over `/docs/research/`? If no — keep it SKOS.
317
+
318
+ ### 8.3 Ontology Drift
319
+
320
+ Same concept slug given different `prefLabel`, `definition`, or `broader` in different docs. Detector: `build-ontology.py --check-drift`. Resolution: move the canonical definition to `_concepts.md` and reference it from each doc.
321
+
322
+ ### 8.4 Slug Instability
323
+
324
+ Renaming `react-server-components` to `rsc` in one doc, leaving the rest. Wikilinks break, backlinks vanish. Resolution: never rename in place; add an alias migration in `_migrations.md` and let the indexer rewrite gradually.
325
+
326
+ ### 8.5 Unencoded Hierarchy
327
+
328
+ Writing prose like "Suspense is one of React's async primitives" without the `is-a` line. The graph misses it; cross-doc retrieval misses it. The rule: if it is true and worth saying, it is worth a triple.
329
+
330
+ ### 8.6 Concept Sprawl
331
+
332
+ Creating concepts for every noun phrase. Concepts should be **reusable**: if a concept appears in only one doc and is unlikely to recur, leave it as prose. Threshold: a concept earns a slug when it has ≥ 2 expected docs or ≥ 3 expected relationships.
333
+
334
+ ### 8.7 Mixing English and Slug
335
+
336
+ ```
337
+ React-Server-Components is-a React rendering model. # WRONG
338
+ react-server-components is-a react-rendering-model. # RIGHT
339
+ ```
340
+
341
+ The extractor is case-insensitive on verbs but strict on identifiers (kebab-case, ASCII). Mixed prose breaks the round-trip.
342
+
343
+ ---
344
+
345
+ ## 9. The Round-Trip Rule
346
+
347
+ Every relationship encoded in markdown must survive: `markdown → extract-claims.py → triples.json → build-ontology.py → graph.ttl → render in /docs/research/index.md → human reads → wikilink click → back to markdown`.
348
+
349
+ **If `extract-claims.py` cannot parse a relationship line, it is wrong.** The script is the spec. To validate before commit:
350
+
351
+ ```
352
+ python .claude/skills/research/scripts/extract-claims.py docs/research/<topic>.md --strict
353
+ ```
354
+
355
+ Failures must be fixed before the doc is considered indexed. The script's exit code is a quality gate.
356
+
357
+ ---
358
+
359
+ ## 10. Quick Reference Card
360
+
361
+ ```
362
+ Encoding cheatsheet
363
+ -------------------
364
+ Concept declaration: frontmatter `concepts:` list, kebab-case slugs
365
+ Cross-doc reference: [[concept-slug]] wikilink
366
+ External source: [label](url) — only for off-site
367
+ Relationship: subject verb object. (one line, period required)
368
+ Verbs (closed set): is-a, has-a, composed-of, instance-of, depends-on,
369
+ constrained-by, resolved-by, precedes, equivalent-to,
370
+ related-to, contradicts, extends, deprecated-by
371
+ Concept scheme: /docs/research/_concepts.md (when ≥ 3 docs share concepts)
372
+ Drift detection: build-ontology.py --check-drift
373
+ Round-trip validation: extract-claims.py <file> --strict
374
+ ```
375
+
376
+ When in doubt: prefer `related-to` over inventing a verb, prefer prose over a fragile triple, prefer the scheme over redefining a concept inline.