@booklib/core 2.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.
Files changed (374) hide show
  1. package/.cursor/rules/booklib-standards.mdc +40 -0
  2. package/.gemini/context.md +372 -0
  3. package/AGENTS.md +166 -0
  4. package/CHANGELOG.md +226 -0
  5. package/CLAUDE.md +81 -0
  6. package/CODE_OF_CONDUCT.md +31 -0
  7. package/CONTRIBUTING.md +304 -0
  8. package/LICENSE +21 -0
  9. package/PLAN.md +28 -0
  10. package/README.ja.md +198 -0
  11. package/README.ko.md +198 -0
  12. package/README.md +503 -0
  13. package/README.pt-BR.md +198 -0
  14. package/README.uk.md +241 -0
  15. package/README.zh-CN.md +198 -0
  16. package/SECURITY.md +9 -0
  17. package/agents/architecture-reviewer.md +136 -0
  18. package/agents/booklib-reviewer.md +90 -0
  19. package/agents/data-reviewer.md +107 -0
  20. package/agents/jvm-reviewer.md +146 -0
  21. package/agents/python-reviewer.md +128 -0
  22. package/agents/rust-reviewer.md +115 -0
  23. package/agents/ts-reviewer.md +110 -0
  24. package/agents/ui-reviewer.md +117 -0
  25. package/assets/logo.svg +36 -0
  26. package/bin/booklib-mcp.js +304 -0
  27. package/bin/booklib.js +1705 -0
  28. package/bin/skills.cjs +1292 -0
  29. package/booklib-router.mdc +36 -0
  30. package/booklib.config.json +19 -0
  31. package/commands/animation-at-work.md +10 -0
  32. package/commands/clean-code-reviewer.md +10 -0
  33. package/commands/data-intensive-patterns.md +10 -0
  34. package/commands/data-pipelines.md +10 -0
  35. package/commands/design-patterns.md +10 -0
  36. package/commands/domain-driven-design.md +10 -0
  37. package/commands/effective-java.md +10 -0
  38. package/commands/effective-kotlin.md +10 -0
  39. package/commands/effective-python.md +10 -0
  40. package/commands/effective-typescript.md +10 -0
  41. package/commands/kotlin-in-action.md +10 -0
  42. package/commands/lean-startup.md +10 -0
  43. package/commands/microservices-patterns.md +10 -0
  44. package/commands/programming-with-rust.md +10 -0
  45. package/commands/refactoring-ui.md +10 -0
  46. package/commands/rust-in-action.md +10 -0
  47. package/commands/skill-router.md +10 -0
  48. package/commands/spring-boot-in-action.md +10 -0
  49. package/commands/storytelling-with-data.md +10 -0
  50. package/commands/system-design-interview.md +10 -0
  51. package/commands/using-asyncio-python.md +10 -0
  52. package/commands/web-scraping-python.md +10 -0
  53. package/community/registry.json +1616 -0
  54. package/hooks/hooks.json +23 -0
  55. package/hooks/posttooluse-capture.mjs +67 -0
  56. package/hooks/suggest.js +153 -0
  57. package/lib/agent-behaviors.js +40 -0
  58. package/lib/agent-detector.js +96 -0
  59. package/lib/config-loader.js +39 -0
  60. package/lib/conflict-resolver.js +148 -0
  61. package/lib/context-builder.js +574 -0
  62. package/lib/discovery-engine.js +298 -0
  63. package/lib/doctor/hook-installer.js +83 -0
  64. package/lib/doctor/usage-tracker.js +87 -0
  65. package/lib/engine/ai-features.js +253 -0
  66. package/lib/engine/auditor.js +103 -0
  67. package/lib/engine/bm25-index.js +178 -0
  68. package/lib/engine/capture.js +120 -0
  69. package/lib/engine/corrections.js +198 -0
  70. package/lib/engine/doctor.js +195 -0
  71. package/lib/engine/graph-injector.js +137 -0
  72. package/lib/engine/graph.js +161 -0
  73. package/lib/engine/handoff.js +405 -0
  74. package/lib/engine/indexer.js +242 -0
  75. package/lib/engine/parser.js +53 -0
  76. package/lib/engine/query-expander.js +42 -0
  77. package/lib/engine/reranker.js +40 -0
  78. package/lib/engine/rrf.js +59 -0
  79. package/lib/engine/scanner.js +151 -0
  80. package/lib/engine/searcher.js +139 -0
  81. package/lib/engine/session-coordinator.js +306 -0
  82. package/lib/engine/session-manager.js +429 -0
  83. package/lib/engine/synthesizer.js +70 -0
  84. package/lib/installer.js +70 -0
  85. package/lib/instinct-block.js +33 -0
  86. package/lib/mcp-config-writer.js +88 -0
  87. package/lib/paths.js +57 -0
  88. package/lib/profiles/design.md +19 -0
  89. package/lib/profiles/general.md +16 -0
  90. package/lib/profiles/research-analysis.md +22 -0
  91. package/lib/profiles/software-development.md +23 -0
  92. package/lib/profiles/writing-content.md +19 -0
  93. package/lib/project-initializer.js +916 -0
  94. package/lib/registry/skills.js +102 -0
  95. package/lib/registry-searcher.js +99 -0
  96. package/lib/rules/rules-manager.js +169 -0
  97. package/lib/skill-fetcher.js +333 -0
  98. package/lib/well-known-builder.js +70 -0
  99. package/lib/wizard/index.js +404 -0
  100. package/lib/wizard/integration-detector.js +41 -0
  101. package/lib/wizard/project-detector.js +100 -0
  102. package/lib/wizard/prompt.js +156 -0
  103. package/lib/wizard/registry-embeddings.js +107 -0
  104. package/lib/wizard/skill-recommender.js +69 -0
  105. package/llms-full.txt +254 -0
  106. package/llms.txt +70 -0
  107. package/package.json +45 -0
  108. package/research-reports/2026-04-01-current-architecture.md +160 -0
  109. package/research-reports/IDEAS.md +93 -0
  110. package/rules/common/clean-code.md +42 -0
  111. package/rules/java/effective-java.md +42 -0
  112. package/rules/kotlin/effective-kotlin.md +37 -0
  113. package/rules/python/effective-python.md +38 -0
  114. package/rules/rust/rust.md +37 -0
  115. package/rules/typescript/effective-typescript.md +42 -0
  116. package/scripts/gen-llms-full.mjs +36 -0
  117. package/scripts/gen-og.mjs +142 -0
  118. package/scripts/validate-frontmatter.js +25 -0
  119. package/skills/animation-at-work/SKILL.md +270 -0
  120. package/skills/animation-at-work/assets/example_asset.txt +1 -0
  121. package/skills/animation-at-work/evals/evals.json +44 -0
  122. package/skills/animation-at-work/evals/results.json +13 -0
  123. package/skills/animation-at-work/examples/after.md +64 -0
  124. package/skills/animation-at-work/examples/before.md +35 -0
  125. package/skills/animation-at-work/references/api_reference.md +369 -0
  126. package/skills/animation-at-work/references/review-checklist.md +79 -0
  127. package/skills/animation-at-work/scripts/audit_animations.py +295 -0
  128. package/skills/animation-at-work/scripts/example.py +1 -0
  129. package/skills/clean-code-reviewer/SKILL.md +444 -0
  130. package/skills/clean-code-reviewer/audit.json +35 -0
  131. package/skills/clean-code-reviewer/evals/evals.json +185 -0
  132. package/skills/clean-code-reviewer/evals/results.json +13 -0
  133. package/skills/clean-code-reviewer/examples/after.md +48 -0
  134. package/skills/clean-code-reviewer/examples/before.md +33 -0
  135. package/skills/clean-code-reviewer/references/api_reference.md +158 -0
  136. package/skills/clean-code-reviewer/references/practices-catalog.md +282 -0
  137. package/skills/clean-code-reviewer/references/review-checklist.md +254 -0
  138. package/skills/clean-code-reviewer/scripts/pre-review.py +206 -0
  139. package/skills/data-intensive-patterns/SKILL.md +267 -0
  140. package/skills/data-intensive-patterns/assets/example_asset.txt +1 -0
  141. package/skills/data-intensive-patterns/evals/evals.json +54 -0
  142. package/skills/data-intensive-patterns/evals/results.json +13 -0
  143. package/skills/data-intensive-patterns/examples/after.md +61 -0
  144. package/skills/data-intensive-patterns/examples/before.md +38 -0
  145. package/skills/data-intensive-patterns/references/api_reference.md +34 -0
  146. package/skills/data-intensive-patterns/references/patterns-catalog.md +551 -0
  147. package/skills/data-intensive-patterns/references/review-checklist.md +193 -0
  148. package/skills/data-intensive-patterns/scripts/adr.py +213 -0
  149. package/skills/data-intensive-patterns/scripts/example.py +1 -0
  150. package/skills/data-pipelines/SKILL.md +259 -0
  151. package/skills/data-pipelines/assets/example_asset.txt +1 -0
  152. package/skills/data-pipelines/evals/evals.json +45 -0
  153. package/skills/data-pipelines/evals/results.json +13 -0
  154. package/skills/data-pipelines/examples/after.md +97 -0
  155. package/skills/data-pipelines/examples/before.md +37 -0
  156. package/skills/data-pipelines/references/api_reference.md +301 -0
  157. package/skills/data-pipelines/references/review-checklist.md +181 -0
  158. package/skills/data-pipelines/scripts/example.py +1 -0
  159. package/skills/data-pipelines/scripts/new_pipeline.py +444 -0
  160. package/skills/design-patterns/SKILL.md +271 -0
  161. package/skills/design-patterns/assets/example_asset.txt +1 -0
  162. package/skills/design-patterns/evals/evals.json +46 -0
  163. package/skills/design-patterns/evals/results.json +13 -0
  164. package/skills/design-patterns/examples/after.md +52 -0
  165. package/skills/design-patterns/examples/before.md +29 -0
  166. package/skills/design-patterns/references/api_reference.md +1 -0
  167. package/skills/design-patterns/references/patterns-catalog.md +726 -0
  168. package/skills/design-patterns/references/review-checklist.md +173 -0
  169. package/skills/design-patterns/scripts/example.py +1 -0
  170. package/skills/design-patterns/scripts/scaffold.py +807 -0
  171. package/skills/domain-driven-design/SKILL.md +142 -0
  172. package/skills/domain-driven-design/assets/example_asset.txt +1 -0
  173. package/skills/domain-driven-design/evals/evals.json +48 -0
  174. package/skills/domain-driven-design/evals/results.json +13 -0
  175. package/skills/domain-driven-design/examples/after.md +80 -0
  176. package/skills/domain-driven-design/examples/before.md +43 -0
  177. package/skills/domain-driven-design/references/api_reference.md +1 -0
  178. package/skills/domain-driven-design/references/patterns-catalog.md +545 -0
  179. package/skills/domain-driven-design/references/review-checklist.md +158 -0
  180. package/skills/domain-driven-design/scripts/example.py +1 -0
  181. package/skills/domain-driven-design/scripts/scaffold.py +421 -0
  182. package/skills/effective-java/SKILL.md +227 -0
  183. package/skills/effective-java/assets/example_asset.txt +1 -0
  184. package/skills/effective-java/evals/evals.json +46 -0
  185. package/skills/effective-java/evals/results.json +13 -0
  186. package/skills/effective-java/examples/after.md +83 -0
  187. package/skills/effective-java/examples/before.md +37 -0
  188. package/skills/effective-java/references/api_reference.md +1 -0
  189. package/skills/effective-java/references/items-catalog.md +955 -0
  190. package/skills/effective-java/references/review-checklist.md +216 -0
  191. package/skills/effective-java/scripts/checkstyle_setup.py +211 -0
  192. package/skills/effective-java/scripts/example.py +1 -0
  193. package/skills/effective-kotlin/SKILL.md +271 -0
  194. package/skills/effective-kotlin/assets/example_asset.txt +1 -0
  195. package/skills/effective-kotlin/audit.json +29 -0
  196. package/skills/effective-kotlin/evals/evals.json +45 -0
  197. package/skills/effective-kotlin/evals/results.json +13 -0
  198. package/skills/effective-kotlin/examples/after.md +36 -0
  199. package/skills/effective-kotlin/examples/before.md +38 -0
  200. package/skills/effective-kotlin/references/api_reference.md +1 -0
  201. package/skills/effective-kotlin/references/practices-catalog.md +1228 -0
  202. package/skills/effective-kotlin/references/review-checklist.md +126 -0
  203. package/skills/effective-kotlin/scripts/example.py +1 -0
  204. package/skills/effective-python/SKILL.md +441 -0
  205. package/skills/effective-python/evals/evals.json +44 -0
  206. package/skills/effective-python/evals/results.json +13 -0
  207. package/skills/effective-python/examples/after.md +56 -0
  208. package/skills/effective-python/examples/before.md +40 -0
  209. package/skills/effective-python/ref-01-pythonic-thinking.md +202 -0
  210. package/skills/effective-python/ref-02-lists-and-dicts.md +146 -0
  211. package/skills/effective-python/ref-03-functions.md +186 -0
  212. package/skills/effective-python/ref-04-comprehensions-generators.md +211 -0
  213. package/skills/effective-python/ref-05-classes-interfaces.md +188 -0
  214. package/skills/effective-python/ref-06-metaclasses-attributes.md +209 -0
  215. package/skills/effective-python/ref-07-concurrency.md +213 -0
  216. package/skills/effective-python/ref-08-robustness-performance.md +248 -0
  217. package/skills/effective-python/ref-09-testing-debugging.md +253 -0
  218. package/skills/effective-python/ref-10-collaboration.md +175 -0
  219. package/skills/effective-python/references/api_reference.md +218 -0
  220. package/skills/effective-python/references/practices-catalog.md +483 -0
  221. package/skills/effective-python/references/review-checklist.md +190 -0
  222. package/skills/effective-python/scripts/lint.py +173 -0
  223. package/skills/effective-typescript/SKILL.md +262 -0
  224. package/skills/effective-typescript/audit.json +29 -0
  225. package/skills/effective-typescript/evals/evals.json +37 -0
  226. package/skills/effective-typescript/evals/results.json +13 -0
  227. package/skills/effective-typescript/examples/after.md +70 -0
  228. package/skills/effective-typescript/examples/before.md +47 -0
  229. package/skills/effective-typescript/references/api_reference.md +118 -0
  230. package/skills/effective-typescript/references/practices-catalog.md +371 -0
  231. package/skills/effective-typescript/scripts/review.py +169 -0
  232. package/skills/kotlin-in-action/SKILL.md +261 -0
  233. package/skills/kotlin-in-action/assets/example_asset.txt +1 -0
  234. package/skills/kotlin-in-action/evals/evals.json +43 -0
  235. package/skills/kotlin-in-action/evals/results.json +13 -0
  236. package/skills/kotlin-in-action/examples/after.md +53 -0
  237. package/skills/kotlin-in-action/examples/before.md +39 -0
  238. package/skills/kotlin-in-action/references/api_reference.md +1 -0
  239. package/skills/kotlin-in-action/references/practices-catalog.md +436 -0
  240. package/skills/kotlin-in-action/references/review-checklist.md +204 -0
  241. package/skills/kotlin-in-action/scripts/example.py +1 -0
  242. package/skills/kotlin-in-action/scripts/setup_detekt.py +224 -0
  243. package/skills/lean-startup/SKILL.md +160 -0
  244. package/skills/lean-startup/assets/example_asset.txt +1 -0
  245. package/skills/lean-startup/evals/evals.json +43 -0
  246. package/skills/lean-startup/evals/results.json +13 -0
  247. package/skills/lean-startup/examples/after.md +80 -0
  248. package/skills/lean-startup/examples/before.md +34 -0
  249. package/skills/lean-startup/references/api_reference.md +319 -0
  250. package/skills/lean-startup/references/review-checklist.md +137 -0
  251. package/skills/lean-startup/scripts/example.py +1 -0
  252. package/skills/lean-startup/scripts/new_experiment.py +286 -0
  253. package/skills/microservices-patterns/SKILL.md +384 -0
  254. package/skills/microservices-patterns/evals/evals.json +45 -0
  255. package/skills/microservices-patterns/evals/results.json +13 -0
  256. package/skills/microservices-patterns/examples/after.md +69 -0
  257. package/skills/microservices-patterns/examples/before.md +40 -0
  258. package/skills/microservices-patterns/references/patterns-catalog.md +391 -0
  259. package/skills/microservices-patterns/references/review-checklist.md +169 -0
  260. package/skills/microservices-patterns/scripts/new_service.py +583 -0
  261. package/skills/programming-with-rust/SKILL.md +209 -0
  262. package/skills/programming-with-rust/evals/evals.json +37 -0
  263. package/skills/programming-with-rust/evals/results.json +13 -0
  264. package/skills/programming-with-rust/examples/after.md +107 -0
  265. package/skills/programming-with-rust/examples/before.md +59 -0
  266. package/skills/programming-with-rust/references/api_reference.md +152 -0
  267. package/skills/programming-with-rust/references/practices-catalog.md +335 -0
  268. package/skills/programming-with-rust/scripts/review.py +142 -0
  269. package/skills/refactoring-ui/SKILL.md +362 -0
  270. package/skills/refactoring-ui/assets/example_asset.txt +1 -0
  271. package/skills/refactoring-ui/evals/evals.json +45 -0
  272. package/skills/refactoring-ui/evals/results.json +13 -0
  273. package/skills/refactoring-ui/examples/after.md +85 -0
  274. package/skills/refactoring-ui/examples/before.md +58 -0
  275. package/skills/refactoring-ui/references/api_reference.md +355 -0
  276. package/skills/refactoring-ui/references/review-checklist.md +114 -0
  277. package/skills/refactoring-ui/scripts/audit_css.py +250 -0
  278. package/skills/refactoring-ui/scripts/example.py +1 -0
  279. package/skills/rust-in-action/SKILL.md +350 -0
  280. package/skills/rust-in-action/evals/evals.json +38 -0
  281. package/skills/rust-in-action/evals/results.json +13 -0
  282. package/skills/rust-in-action/examples/after.md +156 -0
  283. package/skills/rust-in-action/examples/before.md +56 -0
  284. package/skills/rust-in-action/references/practices-catalog.md +346 -0
  285. package/skills/rust-in-action/scripts/review.py +147 -0
  286. package/skills/skill-router/SKILL.md +186 -0
  287. package/skills/skill-router/evals/evals.json +38 -0
  288. package/skills/skill-router/evals/results.json +13 -0
  289. package/skills/skill-router/examples/after.md +63 -0
  290. package/skills/skill-router/examples/before.md +39 -0
  291. package/skills/skill-router/references/api_reference.md +24 -0
  292. package/skills/skill-router/references/routing-heuristics.md +89 -0
  293. package/skills/skill-router/references/skill-catalog.md +174 -0
  294. package/skills/skill-router/scripts/route.py +266 -0
  295. package/skills/spring-boot-in-action/SKILL.md +340 -0
  296. package/skills/spring-boot-in-action/evals/evals.json +39 -0
  297. package/skills/spring-boot-in-action/evals/results.json +13 -0
  298. package/skills/spring-boot-in-action/examples/after.md +185 -0
  299. package/skills/spring-boot-in-action/examples/before.md +84 -0
  300. package/skills/spring-boot-in-action/references/practices-catalog.md +403 -0
  301. package/skills/spring-boot-in-action/scripts/review.py +184 -0
  302. package/skills/storytelling-with-data/SKILL.md +241 -0
  303. package/skills/storytelling-with-data/assets/example_asset.txt +1 -0
  304. package/skills/storytelling-with-data/evals/evals.json +47 -0
  305. package/skills/storytelling-with-data/evals/results.json +13 -0
  306. package/skills/storytelling-with-data/examples/after.md +50 -0
  307. package/skills/storytelling-with-data/examples/before.md +33 -0
  308. package/skills/storytelling-with-data/references/api_reference.md +379 -0
  309. package/skills/storytelling-with-data/references/review-checklist.md +111 -0
  310. package/skills/storytelling-with-data/scripts/chart_review.py +301 -0
  311. package/skills/storytelling-with-data/scripts/example.py +1 -0
  312. package/skills/system-design-interview/SKILL.md +233 -0
  313. package/skills/system-design-interview/assets/example_asset.txt +1 -0
  314. package/skills/system-design-interview/evals/evals.json +46 -0
  315. package/skills/system-design-interview/evals/results.json +13 -0
  316. package/skills/system-design-interview/examples/after.md +94 -0
  317. package/skills/system-design-interview/examples/before.md +27 -0
  318. package/skills/system-design-interview/references/api_reference.md +582 -0
  319. package/skills/system-design-interview/references/review-checklist.md +201 -0
  320. package/skills/system-design-interview/scripts/example.py +1 -0
  321. package/skills/system-design-interview/scripts/new_design.py +421 -0
  322. package/skills/using-asyncio-python/SKILL.md +290 -0
  323. package/skills/using-asyncio-python/assets/example_asset.txt +1 -0
  324. package/skills/using-asyncio-python/evals/evals.json +43 -0
  325. package/skills/using-asyncio-python/evals/results.json +13 -0
  326. package/skills/using-asyncio-python/examples/after.md +68 -0
  327. package/skills/using-asyncio-python/examples/before.md +39 -0
  328. package/skills/using-asyncio-python/references/api_reference.md +267 -0
  329. package/skills/using-asyncio-python/references/review-checklist.md +149 -0
  330. package/skills/using-asyncio-python/scripts/check_blocking.py +270 -0
  331. package/skills/using-asyncio-python/scripts/example.py +1 -0
  332. package/skills/web-scraping-python/SKILL.md +280 -0
  333. package/skills/web-scraping-python/assets/example_asset.txt +1 -0
  334. package/skills/web-scraping-python/evals/evals.json +46 -0
  335. package/skills/web-scraping-python/evals/results.json +13 -0
  336. package/skills/web-scraping-python/examples/after.md +109 -0
  337. package/skills/web-scraping-python/examples/before.md +40 -0
  338. package/skills/web-scraping-python/references/api_reference.md +393 -0
  339. package/skills/web-scraping-python/references/review-checklist.md +163 -0
  340. package/skills/web-scraping-python/scripts/example.py +1 -0
  341. package/skills/web-scraping-python/scripts/new_scraper.py +231 -0
  342. package/skills/writing-plans/audit.json +34 -0
  343. package/tests/agent-detector.test.js +83 -0
  344. package/tests/corrections.test.js +245 -0
  345. package/tests/doctor/hook-installer.test.js +72 -0
  346. package/tests/doctor/usage-tracker.test.js +140 -0
  347. package/tests/engine/benchmark-eval.test.js +31 -0
  348. package/tests/engine/bm25-index.test.js +85 -0
  349. package/tests/engine/capture-command.test.js +35 -0
  350. package/tests/engine/capture.test.js +17 -0
  351. package/tests/engine/graph-augmented-search.test.js +107 -0
  352. package/tests/engine/graph-injector.test.js +44 -0
  353. package/tests/engine/graph.test.js +216 -0
  354. package/tests/engine/hybrid-searcher.test.js +74 -0
  355. package/tests/engine/indexer-bm25.test.js +37 -0
  356. package/tests/engine/mcp-tools.test.js +73 -0
  357. package/tests/engine/project-initializer-mcp.test.js +99 -0
  358. package/tests/engine/query-expander.test.js +36 -0
  359. package/tests/engine/reranker.test.js +51 -0
  360. package/tests/engine/rrf.test.js +49 -0
  361. package/tests/engine/srag-prefix.test.js +47 -0
  362. package/tests/instinct-block.test.js +23 -0
  363. package/tests/mcp-config-writer.test.js +60 -0
  364. package/tests/project-initializer-new-agents.test.js +48 -0
  365. package/tests/rules/rules-manager.test.js +230 -0
  366. package/tests/well-known-builder.test.js +40 -0
  367. package/tests/wizard/integration-detector.test.js +31 -0
  368. package/tests/wizard/project-detector.test.js +51 -0
  369. package/tests/wizard/prompt-session.test.js +61 -0
  370. package/tests/wizard/prompt.test.js +16 -0
  371. package/tests/wizard/registry-embeddings.test.js +35 -0
  372. package/tests/wizard/skill-recommender.test.js +34 -0
  373. package/tests/wizard/slot-count.test.js +25 -0
  374. package/vercel.json +21 -0
package/llms.txt ADDED
@@ -0,0 +1,70 @@
1
+ # BookLib Skills
2
+
3
+ An open knowledge ecosystem for AI coding agents. Packages expert knowledge from canonical programming books as skills, with a discovery engine for community sources, semantic search, automatic context injection, and compatibility with Claude Code orchestrators (obra/superpowers, ruflo).
4
+
5
+ ## Two Layers
6
+
7
+ **Bundled library**: 22 skills from canonical books, pre-indexed, ready to use.
8
+ **Discovery ecosystem**: finds and fetches skills from GitHub repos, community registries, and npm packages (258+ discoverable).
9
+
10
+ ## Core Commands
11
+
12
+ - `booklib context "<task>"` — cross-skill context builder: searches all skills + knowledge graph, extracts relevant passages, compiles a sharp ready-to-use system prompt
13
+ - `booklib context "<task>" --file <path>` — also injects graph context for the file's owning component
14
+ - `booklib context "<task>" --prompt-only` — just the compiled prompt (pipe-friendly)
15
+ - `booklib search "<query>"` — semantic search over skill content + knowledge nodes
16
+ - `booklib fetch <skill>` — download and index a community skill
17
+ - `booklib setup` — fetch all trusted skills at once
18
+ - `booklib sync` — sync fetched skills to `~/.claude/skills/` for Skill tool / orchestrator access
19
+ - `booklib audit <skill> <file>` — systematic file review against a skill
20
+ - `booklib scan` — wisdom heatmap across the whole project
21
+ - `booklib profile <role>` — skills by agent role (architect, reviewer, security, tester, ...)
22
+ - `booklib swarm-config [trigger]` — skill map for swarm agent pipelines
23
+ - `booklib init [--orchestrator=obra|ruflo]` — scaffold context files for all AI tools
24
+ - `booklib save-state / resume / recover-auto` — session handoff between agents
25
+
26
+ ## Knowledge Graph Commands
27
+
28
+ - `booklib note "<title>"` — create a note node (opens $EDITOR or reads stdin)
29
+ - `booklib dictate` — type or dictate → AI structures + saves as a note
30
+ - `booklib dictate --raw` — type or dictate → saved verbatim, no AI processing
31
+ - `booklib save-chat --title "<title>"` — save current conversation as a knowledge node
32
+ - `booklib save-chat --summarize` — AI extracts key decisions + findings → clean note
33
+ - `booklib research "<topic>"` — create a research stub node
34
+ - `booklib component add <name> "<glob>"` — define a project component node with path patterns
35
+ - `booklib link <node1> <node2> --type <edge-type>` — add a typed edge between nodes
36
+ - `booklib nodes list` — list all knowledge nodes
37
+ - `booklib nodes show <id>` — view a specific node
38
+
39
+ ## Bundled Skills (22)
40
+
41
+ animation-at-work · clean-code-reviewer · data-intensive-patterns · data-pipelines · design-patterns · domain-driven-design · effective-java · effective-kotlin · effective-python · effective-typescript · kotlin-in-action · lean-startup · microservices-patterns · programming-with-rust · refactoring-ui · rust-in-action · skill-router · spring-boot-in-action · storytelling-with-data · system-design-interview · using-asyncio-python · web-scraping-python
42
+
43
+ ## Discovery Sources (booklib.config.json)
44
+
45
+ - `registry` — bundled skills
46
+ - `manifest` — JSON skill list at a URL or local path (community/registry.json ships 258 skills)
47
+ - `github-skills-dir` — any GitHub repo with a `skills/` subdirectory (obra/superpowers, ruflo included)
48
+ - `github-org` — all repos in a GitHub org
49
+ - `npm-scope` — all packages in an npm scope
50
+
51
+ ## Orchestrator Compatibility
52
+
53
+ After `booklib sync`, all fetched skills are available at `~/.claude/skills/<name>/SKILL.md`.
54
+ Works with obra/superpowers (`/plugin install superpowers`) and ruflo (`npm install -g ruflo`).
55
+
56
+ ## Activation Mechanisms
57
+
58
+ - **PreToolUse hook** — automatically injects relevant skill chunks when editing matching files (fine-grained)
59
+ - **Skill tool** — full skill dump on demand, used by orchestrator subagents (coarse)
60
+ - **Search** — semantic vector search returning the most relevant chunks
61
+
62
+ ## Technical
63
+
64
+ - Format: Markdown with XML tags (`<core_principles>`, `<anti_patterns>`, `<framework>`)
65
+ - Engine: local semantic RAG using `@xenova/transformers` + `vectra`
66
+ - Knowledge Graph: nodes as `.md` files with YAML frontmatter; edges as append-only JSONL
67
+ - Config: `booklib.config.json` (discovery sources), `.booklib/` (local state, gitignored)
68
+ - Runtime deps: `@xenova/transformers`, `vectra`, `gray-matter`, `@modelcontextprotocol/sdk`, `minimatch`
69
+
70
+ For full skill catalog, see [llms-full.txt](llms-full.txt).
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@booklib/core",
3
+ "version": "2.0.0",
4
+ "description": "Knowledge bookkeeping for AI agents — expert skills, hybrid search, knowledge graph, MCP tools",
5
+ "bin": {
6
+ "skills": "bin/skills.cjs",
7
+ "booklib": "bin/booklib.js",
8
+ "booklib-mcp": "bin/booklib-mcp.js"
9
+ },
10
+ "type": "module",
11
+ "keywords": [
12
+ "claude",
13
+ "claude-code",
14
+ "ai",
15
+ "skills",
16
+ "agent-skills",
17
+ "mcp",
18
+ "rag"
19
+ ],
20
+ "license": "MIT",
21
+ "homepage": "https://booklib-ai.github.io/booklib/",
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/booklib-ai/booklib.git"
25
+ },
26
+ "engines": {
27
+ "node": ">=18"
28
+ },
29
+ "dependencies": {
30
+ "@clack/prompts": "^1.2.0",
31
+ "@huggingface/transformers": "^3.4.0",
32
+ "@modelcontextprotocol/sdk": "^1.6.0",
33
+ "gray-matter": "^4.0.3",
34
+ "minimatch": "^10.2.4",
35
+ "vectra": "^0.12.3"
36
+ },
37
+ "devDependencies": {
38
+ "puppeteer": "^24.39.1"
39
+ },
40
+ "overrides": {
41
+ "encoding-sniffer": "1.0.2",
42
+ "global-agent": "4.1.3",
43
+ "openai": "6.33.0"
44
+ }
45
+ }
@@ -0,0 +1,160 @@
1
+ # BookLib — Value Map & Research Alignment
2
+ *April 1, 2026*
3
+
4
+ ---
5
+
6
+ ## What BookLib Is
7
+
8
+ A local knowledge engine that gives AI agents access to expert knowledge from real books and personal captured insights. It runs locally with zero cloud dependencies, integrates with 13 AI tools via MCP, and produces concise, research-backed context injection.
9
+
10
+ ---
11
+
12
+ ## Value Propositions — Research Validation
13
+
14
+ ### 1. Expert knowledge the model doesn't have
15
+
16
+ The model knows general programming but not "Item 7 of Effective Java" or "Clean Code Chapter 3: a function should do one thing." BookLib's 24 bundled skills are distilled from specific books — the agent applies them with citations.
17
+
18
+ **Research alignment:** The ETH Zurich AGENTS.md study (arxiv:2602.11988) validates that context files work — but only when they contain **non-inferable details** the model can't derive on its own. Book-specific principles (item numbers, author-specific frameworks, curated anti-patterns) are exactly this. Generic "write clean code" advice hurts performance; specific "apply the Rule of Three from Refactoring" helps it.
19
+
20
+ **Current status:** Implemented and validated. 24 skills with XML-tagged structure that separates core principles from examples from anti-patterns — enabling selective injection.
21
+
22
+ **Gap:** Skills should be audited for conciseness per the ETH Zurich finding. Oversized sections dilute the signal. A `--compact` mode (P1 in backlog) would return only high-signal tags.
23
+
24
+ ---
25
+
26
+ ### 2. Hybrid search
27
+
28
+ Natural language queries find the most relevant principles across all skills and personal knowledge.
29
+
30
+ **Research alignment:** The hybrid approach (BM25 + vector + reranking) is grounded in arxiv:2602.12430 which shows 40-60% precision improvement over dense-only baselines. The SRAG metadata prefix approach (arxiv:2603.26670) encodes domain separation directly into the vector space — a 30% QA improvement with p-value 2e-13. Both findings are implemented.
31
+
32
+ **Current status:** Fully implemented. Five-stage pipeline: query expansion → BM25 + vector search → Reciprocal Rank Fusion → cross-encoder reranking → results. SRAG prefixes active on all indexed chunks.
33
+
34
+ **Gap:** Embeddings are generated with `all-MiniLM-L6-v2` on Transformers.js v3. Upgrading to v4 (P1) gives ~4x speedup — same model, same results, faster runtime. Late chunking (arxiv:2409.04701, P2) would add another +24% retrieval improvement but requires a model swap and custom pooling.
35
+
36
+ ---
37
+
38
+ ### 3. Personal knowledge graph
39
+
40
+ Users capture their own insights — architecture decisions, discovered patterns, team conventions — and link them to book skills. These become searchable alongside expert knowledge.
41
+
42
+ **Research alignment:** The Codified Context paper (arxiv:2602.20478) formalizes exactly this pattern: "hot memory" (always-on skills), "domain agents" (reviewers), and "cold memory" (knowledge base). BookLib's knowledge graph is the cold memory layer. The KG²RAG paper (arxiv:2502.06864, NAACL 2025) shows that organizing search results by graph distance improves coherence — BookLib implements one-hop graph-augmented search.
43
+
44
+ **Current status:** Implemented. Nodes (markdown + frontmatter), edges (typed JSONL), graph-augmented search with `--graph` flag, `booklib capture` for intentional knowledge creation.
45
+
46
+ **Gap:** The graph is manually curated (by design — the Spec 3 decision was "no auto-ingestion"). Graph density depends on user engagement. The KG²RAG chunk expansion technique requires denser graphs than BookLib currently has — deferred until capture usage grows.
47
+
48
+ ---
49
+
50
+ ### 4. MCP integration
51
+
52
+ For 10 out of 13 supported tools, BookLib exposes 8 MCP tools that the agent can call directly. The agent discovers them via MCP protocol, no config file instructions needed for tool discovery.
53
+
54
+ **Research alignment:** MCP is the industry-standard protocol for agent-tool communication, adopted by Anthropic, OpenAI, Microsoft, Google, and others. BookLib's trigger-oriented tool descriptions ("Use WHEN the user says X" rather than "This tool does Y") align with the OpenDev lazy tool discovery pattern (arxiv:2603.05344) — agents should discover capabilities contextually, not load everything upfront.
55
+
56
+ **Current status:** Implemented. 8 tools, 10 tool configs, trigger-oriented descriptions. Config files contain a 5-10 line "instinct block" that tells the agent WHEN to use each tool — behavioral triggers, not content dumps.
57
+
58
+ **Gap:** The `instructions` field in the MCP `initialize` handshake could deliver project context automatically on connect — eliminating the need for config file instinct blocks entirely. Not yet implemented; needs per-client testing to verify support.
59
+
60
+ ---
61
+
62
+ ### 5. Concise config file generation
63
+
64
+ One `booklib init` generates 30-60 line config files per tool — profile template + skill table + behavioral triggers + reference links. The user owns the file; BookLib adds a small auto-generated section.
65
+
66
+ **Research alignment:** Directly implements the ETH Zurich finding. Previous BookLib versions generated 3,000-10,000 line config files by dumping raw skill content — exactly the pattern the study shows HURTS agent performance. The new architecture injects metadata only (skill names + descriptions + tags), delegates detail retrieval to MCP search.
67
+
68
+ **Current status:** Implemented. 5 activity-based profiles (software-development, writing, research, design, general). Config files include official documentation links for each tool so users know how to customize.
69
+
70
+ **Gap:** None significant. The architecture is research-aligned and tested.
71
+
72
+ ---
73
+
74
+ ### 6. Setup wizard
75
+
76
+ Interactive guided setup with project detection, skill recommendation, tool configuration, and health diagnostics.
77
+
78
+ **Research alignment:** Not directly research-driven — this is product UX. However, the recommendation engine uses the same hybrid search pipeline (Section 2), so skill recommendations benefit from the SRAG and retrieval improvements.
79
+
80
+ **Current status:** Implemented with `@clack/prompts` for modern CLI UX. Detects 13 agents including VS Code extensions. Offers cleanup when users have too many skills installed.
81
+
82
+ **Gap:** Recommendation quality depends on search index accuracy. With all skills scoring 100% (reranker saturation), differentiation relies on rank-based display scores — functional but not intuitive.
83
+
84
+ ---
85
+
86
+ ### 7. Doctor diagnostic + repair
87
+
88
+ Detects and fixes problems: too many skills, oversized config files, missing index, stale installs.
89
+
90
+ **Research alignment:** The ETH Zurich study's finding that oversized context hurts performance directly motivates the "oversized config files" diagnostic. The doctor can detect and cure the exact problem the research identifies.
91
+
92
+ **Current status:** Implemented. 6 diagnostic checks, `--cure` flag for auto-repair.
93
+
94
+ **Gap:** The "cure" for oversized config files depends on the new config assembler (Section 5) being the default path — which it now is.
95
+
96
+ ---
97
+
98
+ ### 8. Session management + multi-agent handoff
99
+
100
+ Agents save progress and hand off to other agents across sessions.
101
+
102
+ **Research alignment:** The Codified Context paper describes session continuity as essential for multi-agent workflows. BookLib's session system (save, resume, recover, merge, lineage) implements the "persistent memory across agent boundaries" pattern.
103
+
104
+ **Current status:** Implemented. 14 subcommands covering save/resume, multi-agent merge, lineage tracking, encrypted sessions.
105
+
106
+ **Gap:** Heavily featured but potentially over-engineered for current usage. No evidence of significant adoption of the advanced coordination features (merge, compare, lineage). May benefit from simplification.
107
+
108
+ ---
109
+
110
+ ## Honest Assessment
111
+
112
+ ### What's strong and research-backed
113
+ - **Hybrid search pipeline** — grounded in retrieval research, measurably better than vector-only
114
+ - **SRAG metadata prefixes** — validated technique, unique to BookLib in the CLI skill space
115
+ - **Concise config generation** — directly implements ETH Zurich findings (less = better)
116
+ - **MCP integration** — industry-standard protocol, broad tool coverage
117
+ - **Structured skill format** — XML tags enable selective disclosure, validated by research
118
+
119
+ ### What's functional but unvalidated
120
+ - **Knowledge graph** — works, but value depends on user engagement. No metrics on actual usage
121
+ - **Session management** — comprehensive but possibly over-built. Needs usage data
122
+ - **Setup wizard** — works but recommendations could be sharper
123
+ - **Doctor** — good diagnostics, limited auto-repair
124
+
125
+ ### What's claimed but not true
126
+ - **"Auto-injection via PreToolUse hook"** — not implemented. MCP replaces this for 10/13 tools. Should be removed from website and README.
127
+ - **"258+ discoverable skills"** — discovery engine exists but returns empty by default. No external sources configured.
128
+
129
+ ### What's missing (validated by research, not yet built)
130
+ - **Compact mode** — ETH Zurich says less context is better. We should support `--compact` output (P1)
131
+ - **Transformers.js v4** — free 4x speedup on indexing (P1)
132
+ - **Progressive disclosure** — deliver skills in layers, not all at once (P2)
133
+ - **MCP Server Cards** — ecosystem discoverability (P2)
134
+
135
+ ---
136
+
137
+ ## Research Sources Referenced
138
+
139
+ ### Peer-reviewed / high-confidence
140
+ | Paper | Source Quality | What it validates | Status |
141
+ |-------|--------------|-------------------|--------|
142
+ | arxiv:2602.11988 — ETH Zurich AGENTS.md study | **4/5** — ETH Zurich SRI Lab, rigorous methodology. Preprint, not yet peer-reviewed, but institution reputation is strong. | Less context = better agent performance | ✅ Implemented (config assembler) |
143
+ | arxiv:2502.06864 — KG²RAG (NAACL 2025) | **5/5** — Peer-reviewed at NAACL, top NLP venue | Graph-organized search results | ⚠️ Partially (one-hop only) |
144
+ | SIGIR 2025 — SEE Early Exit | **5/5** — Peer-reviewed at SIGIR, top IR venue | Early-exit cross-encoder reranking | ❌ Backlog (GPU requirement) |
145
+ | HuggingFace Transformers.js v4 | **5/5** — First-party release announcement | 4x embedding speedup | ❌ P1 backlog |
146
+
147
+ ### Established techniques (no specific paper needed)
148
+ | Technique | Status | Notes |
149
+ |-----------|--------|-------|
150
+ | BM25 + vector hybrid retrieval | ✅ Implemented | Standard IR practice, widely adopted |
151
+ | Reciprocal Rank Fusion | ✅ Implemented | Standard IR fusion technique |
152
+ | Cross-encoder reranking | ✅ Implemented | Standard re-ranking approach |
153
+
154
+ ### Preprints — use with caveats
155
+ | Paper | Source Quality | What it claims | Status | Caveat |
156
+ |-------|--------------|----------------|--------|--------|
157
+ | arxiv:2603.26670 — SRAG | **3/5** — Recent preprint, not peer-reviewed | Metadata prefixes improve retrieval 30% | ✅ Implemented | Promising but unverified by independent replication |
158
+ | arxiv:2602.20478 — Codified Context | **2/5** — Single author, single project, not peer-reviewed | Hot/cold memory + domain agents pattern | Architecturally aligned | Do NOT cite in user-facing materials. Fine for internal reference only |
159
+ | arxiv:2603.05344 — OpenDev | **3/5** — System description, not controlled experiment | Progressive/lazy tool discovery | Design pattern adopted | Describes architecture, doesn't prove it outperforms alternatives |
160
+ | arxiv:2409.04701 — Late Chunking | **4/5** — Jina AI research team, reproducible | Contextual embeddings +24% | ❌ P2 backlog | Real technique, complex implementation for BookLib's stack |
@@ -0,0 +1,93 @@
1
+ # BookLib — Validated Feature Ideas Backlog
2
+
3
+ > Auto-maintained by the daily research validator. Each idea has been reviewed against the actual source material, validated for feasibility, and mapped to a specific implementation path.
4
+
5
+ ## Status Legend
6
+ - 🆕 **New** — Just validated, not yet prioritized
7
+ - 🔥 **Hot** — High impact + low/medium effort, should be picked up soon
8
+ - 📋 **Backlog** — Validated and valuable, but not urgent
9
+ - ✅ **Done** — Implemented
10
+ - ❌ **Rejected** — Reviewed and decided against (with reason)
11
+
12
+ ---
13
+
14
+ ## Ideas
15
+
16
+ ### [2026-03-31] SRAG: Prepend structured metadata to chunks before embedding
17
+ **Status:** ✅ Done | **Source:** [arxiv:2603.26670](https://arxiv.org/abs/2603.26670) (preprint, not peer-reviewed) | **Priority:** P1 | **Spec:** 2
18
+ **Summary:** Prefix each chunk with `[skill:{name}] [type:{xml_tag}] [tags:{...}]` before embedding to encode domain separation into the vector space. Claims 30% QA improvement — promising but unverified by independent replication.
19
+ **Work estimate:** 1 day | **Files:** `lib/engine/indexer.js`, `lib/engine/parser.js`
20
+ **Acceptance criteria:**
21
+ - Chunk text prefixed with structured metadata before embedding
22
+ - `parseSkillFile()` passes metadata to indexer
23
+ - Cross-domain noise in search results is measurably reduced
24
+ - No new dependencies required
25
+ - Re-index command handles new format cleanly
26
+
27
+ ### [2026-03-31] MCP Server Cards: Add .well-known/mcp/server-card.json
28
+ **Status:** 🆕 New | **Source:** [MCP 2026 Roadmap](https://blog.modelcontextprotocol.io/posts/2026-mcp-roadmap/) + [SEP-1649](https://github.com/modelcontextprotocol/modelcontextprotocol/issues/1649) | **Priority:** P2 | **Spec:** 1
29
+ **Summary:** Generate an MCP Server Card alongside the existing .well-known/skills/ endpoint so BookLib's MCP server is discoverable by the entire MCP ecosystem.
30
+ **Work estimate:** 0.5 days | **Files:** CI pipeline, `docs/.well-known/`
31
+ **Acceptance criteria:**
32
+ - `booklib build-wellknown` also generates `server-card.json`
33
+ - Card follows the SEP-1649 draft format
34
+ - Hosted via GitHub Pages alongside existing skill index
35
+
36
+ ### [2026-03-31] Cite "Codified Context" paper in positioning materials
37
+ **Status:** ❌ Rejected | **Source:** [arxiv:2602.20478](https://arxiv.org/abs/2602.20478) (source quality 2/5 — single author, single project, not peer-reviewed) | **Priority:** — | **Spec:** —
38
+ **Summary:** ~~Reference the Codified Context paper to position BookLib.~~ **Rejected:** Source quality too low for user-facing citation. Single-author preprint on one project. The taxonomy is useful internally but should not be cited in README or marketing. Kept in internal research notes only.
39
+ **Work estimate:** 2 hours | **Files:** `README.md`, `benchmark/RESEARCH.md`
40
+ **Acceptance criteria:**
41
+ - README references the paper's terminology
42
+ - RESEARCH.md maps BookLib's architecture to the paper's taxonomy
43
+ - Framing says "aligns with" not "validated by" (single-author preprint)
44
+
45
+ ### [2026-03-31] Late Chunking: Contextual embeddings via long-context model
46
+ **Status:** 📋 Backlog | **Source:** [arxiv:2409.04701](https://arxiv.org/abs/2409.04701) | **Priority:** P2 | **Spec:** 2
47
+ **Summary:** Switch to jina-embeddings-v2-small-en (8192 tokens) and implement late chunking — embed full skill file first, then chunk. +24% retrieval improvement. Requires custom pooling in transformers.js and full re-index.
48
+ **Work estimate:** 3-5 days | **Files:** `lib/engine/indexer.js`, `lib/engine/searcher.js`
49
+ **Acceptance criteria:**
50
+ - Embedding model swapped to jina-embeddings-v2-small-en
51
+ - Token-level embeddings extracted before pooling
52
+ - Chunked mean pooling applied per skill section
53
+ - Full re-index migration path documented
54
+ - Benchmark shows improvement over baseline
55
+ **Note:** Implement after hybrid pipeline (Spec 2) is stable. Depends on custom transformers.js pooling — not a drop-in change.
56
+
57
+ ### [2026-04-01] Upgrade to Transformers.js v4 for ~4x embedding speedup
58
+ **Status:** 🔥 Hot | **Source:** [HuggingFace Blog](https://huggingface.co/blog/transformersjs-v4) | **Priority:** P1 | **Spec:** 2
59
+ **Summary:** Upgrade from @xenova/transformers v3 to @huggingface/transformers v4. ~4x speedup on BERT embeddings via optimized ONNX operators. Same model, same API, dramatically faster indexing. Package renamed, model ID updated, optional WebGPU for GPU users.
60
+ **Work estimate:** 0.5–1 day | **Files:** `package.json`, `lib/engine/indexer.js`, `lib/engine/searcher.js`
61
+ **Acceptance criteria:**
62
+ - Package updated to @huggingface/transformers v4
63
+ - Model ID updated to onnx-community/all-MiniLM-L6-v2-ONNX
64
+ - Identical index output (same embeddings, same search results)
65
+ - Measurable indexing speedup benchmarked
66
+ - All existing tests pass
67
+
68
+ ### [2026-04-01] Research-backed skill content guidelines + audit command
69
+ **Status:** 🔥 Hot | **Source:** [arxiv:2602.11988](https://arxiv.org/abs/2602.11988) (ETH Zurich SRI Lab) | **Priority:** P1 | **Spec:** Core + Spec 1
70
+ **Summary:** ETH Zurich study shows LLM-generated context files reduce agent success rates while increasing cost 20%+. Update skill authoring guidelines to recommend "non-inferable details only." Add `booklib audit` to flag oversized sections. Add `--compact` parser mode for minimal injection.
71
+ **Work estimate:** 0.5–1 day | **Files:** docs, `lib/engine/parser.js`, `bin/cli.js`
72
+ **Acceptance criteria:**
73
+ - Authoring docs cite study and recommend concise, non-inferable content
74
+ - `booklib audit` reports per-section token counts with threshold warnings
75
+ - `parser.js` supports --compact mode (core_principles + anti_patterns only)
76
+ - README positions BookLib's format as research-backed
77
+ **Note:** Reinforced by OpenDev paper (arxiv:2603.05344) which demonstrates progressive disclosure pattern. BookLib's XML tags are natural disclosure layers.
78
+
79
+ ### [2026-04-01] Progressive skill disclosure via --progressive flag
80
+ **Status:** 📋 Backlog | **Source:** [arxiv:2603.05344](https://arxiv.org/abs/2603.05344) (OpenDev) + [arxiv:2602.11988](https://arxiv.org/abs/2602.11988) (ETH Zurich) | **Priority:** P2 | **Spec:** 1
81
+ **Summary:** Add `booklib context --progressive` that outputs skills in layers (metadata → core_principles → full). Inspired by OpenDev's lazy tool discovery pattern, validated by ETH Zurich's finding that less context performs better. Uses BookLib's existing XML-tagged structure.
82
+ **Work estimate:** 1 day | **Files:** `lib/engine/parser.js`, `bin/cli.js`
83
+ **Acceptance criteria:**
84
+ - `--progressive` flag outputs three disclosure levels
85
+ - Hook injection can use compact mode for first injection, expand on demand
86
+ - No breaking changes to existing parsing
87
+ **Note:** Implement through existing BookLib mechanisms (--compact flag, parser modes) rather than non-standard MCP protocol extensions. MCP contract changes carry adoption risk.
88
+
89
+ ### [2026-04-01] SEE: Early-exit cross-encoder reranking
90
+ **Status:** 📋 Backlog | **Source:** [SIGIR 2025](https://dl.acm.org/doi/10.1145/3726302.3729962) | **Priority:** P3 | **Spec:** 2
91
+ **Summary:** Cross-encoder reranking with similarity-based early exit — terminate forward pass when intermediate layers already provide confident ranking. Peer-reviewed at SIGIR. But: PyTorch/GPU only, no ONNX path, and BookLib has no cross-encoder yet. Long-term backlog item.
92
+ **Work estimate:** 2-3 weeks (including prerequisite cross-encoder work) | **Files:** `lib/engine/reranker.js` (new), `lib/engine/searcher.js`
93
+ **Note:** Blocked on Spec 2 cross-encoder implementation. Current impl is PyTorch+GPU only — would need custom ONNX layer-by-layer export for transformers.js. Defer until hybrid pipeline is stable.
@@ -0,0 +1,42 @@
1
+ ---
2
+ description: Always-on Clean Code standards from Robert C. Martin. Apply to all code regardless of language.
3
+ ---
4
+
5
+ # Clean Code Standards
6
+
7
+ Apply these principles from *Clean Code* (Robert C. Martin) to all code you write or review.
8
+
9
+ ## Names
10
+
11
+ - Use intention-revealing names — if the name needs a comment to explain it, rename it
12
+ - Avoid abbreviations unless universally understood (`url`, `id`, `ctx` are fine; `mgr`, `proc` are not)
13
+ - Classes and types are nouns; methods and functions are verb phrases
14
+ - Avoid noise words that add no meaning: `Manager`, `Data`, `Info`, `Handler` in type names usually signal a missing concept
15
+ - Boolean variables and functions read as assertions: `isEnabled`, `hasPermission`, `canRetry`
16
+
17
+ ## Functions
18
+
19
+ - Functions do one thing; if you can extract a meaningful sub-function with a non-trivial name, the function does too much
20
+ - Keep functions short — aim for under 20 lines; over 40 is a smell
21
+ - Max 3 parameters; group related parameters into a value object when you need more
22
+ - Avoid boolean flag parameters — they signal the function does two things; split it
23
+ - No side effects in functions that return values
24
+
25
+ ## Comments
26
+
27
+ - Comments compensate for failure to express intent in code — prefer renaming over commenting
28
+ - Never commit commented-out code; use version control
29
+ - `// TODO:` is acceptable only when tracked in an issue; delete stale TODOs
30
+ - Document *why*, not *what* — the code shows what; the comment explains a non-obvious reason
31
+
32
+ ## Structure
33
+
34
+ - Group related code together; put high-level concepts at the top, details below
35
+ - Functions in a file should be ordered so callers appear before callees
36
+ - Avoid deep nesting — if `if`/`else` chains exceed 3 levels, extract or invert conditions
37
+
38
+ ## Error handling
39
+
40
+ - Prefer exceptions over error codes for exceptional conditions
41
+ - Handle errors at the appropriate abstraction level — don't catch and re-throw unless you add context
42
+ - Never swallow exceptions silently; at minimum log before ignoring
@@ -0,0 +1,42 @@
1
+ ---
2
+ description: Always-on Effective Java standards from Joshua Bloch. Apply when writing or reviewing Java code.
3
+ ---
4
+
5
+ # Effective Java Standards
6
+
7
+ Apply these principles from *Effective Java* (Joshua Bloch, 3rd edition) to all Java code.
8
+
9
+ ## Object creation
10
+
11
+ - Prefer static factory methods over constructors — they have names, can return subtypes, and can cache instances
12
+ - Use a builder when a constructor or factory would have more than 3 parameters
13
+ - Never create unnecessary objects; reuse `String` literals, prefer `Boolean.valueOf(x)` over `new Boolean(x)`
14
+
15
+ ## Classes and mutability
16
+
17
+ - Minimize mutability — all fields `private final` by default; add setters only when needed
18
+ - Favor composition over inheritance; explicitly document classes designed for extension or mark them `final`
19
+ - Override `@Override` on every method that overrides or implements; the annotation catches typos at compile time
20
+
21
+ ## Methods
22
+
23
+ - Validate parameters at entry; throw `IllegalArgumentException`, `NullPointerException`, or `IndexOutOfBoundsException` with a message
24
+ - Return empty collections or `Optional`, never `null`, from methods with a non-primitive return type
25
+ - Use `Optional` for return values that may be absent; don't use it for fields or parameters
26
+
27
+ ## Exceptions
28
+
29
+ - Use checked exceptions for recoverable conditions; unchecked (`RuntimeException`) for programming errors
30
+ - Prefer standard exceptions: `IllegalArgumentException`, `IllegalStateException`, `UnsupportedOperationException`, `NullPointerException`
31
+ - Don't swallow exceptions — at minimum log with context before ignoring; never `catch (Exception e) {}`
32
+
33
+ ## Generics and collections
34
+
35
+ - Use generic types and methods; avoid raw types (`List` → `List<E>`)
36
+ - Use bounded wildcards (`? extends T` for producers, `? super T` for consumers — PECS)
37
+ - Prefer `List` over arrays for type safety; use arrays only for performance-sensitive low-level code
38
+
39
+ ## Concurrency
40
+
41
+ - Synchronize all accesses to shared mutable state; prefer `java.util.concurrent` utilities over `synchronized`
42
+ - Prefer immutable objects and thread confinement over shared mutable state
@@ -0,0 +1,37 @@
1
+ ---
2
+ description: Always-on Effective Kotlin standards from Marcin Moskała. Apply when writing or reviewing Kotlin code.
3
+ ---
4
+
5
+ # Effective Kotlin Standards
6
+
7
+ Apply these principles from *Effective Kotlin* (Marcin Moskała, 2nd edition) to all Kotlin code.
8
+
9
+ ## Safety
10
+
11
+ - Prefer `val` over `var`; use `var` only when mutation is genuinely required
12
+ - Use nullable types explicitly (`T?`); avoid `!!` — narrow with `?.`, `?:`, `let`, or `checkNotNull()`
13
+ - Use `require()` for argument preconditions and `check()` for state preconditions at function entry
14
+
15
+ ## Functions
16
+
17
+ - Use named arguments when passing more than 2 parameters, especially when they share the same type
18
+ - Use default arguments instead of overloads for optional behavior
19
+ - Prefer extension functions over utility classes for domain operations on a type you own
20
+
21
+ ## Classes and design
22
+
23
+ - Use data classes for value objects — they get `equals`, `hashCode`, `copy`, and `toString` for free
24
+ - Prefer sealed classes over open hierarchies when the set of subtypes is finite and known
25
+ - Use `object` for singletons, `companion object` for factory methods and class-level constants
26
+
27
+ ## Collections
28
+
29
+ - Use functional operators (`map`, `filter`, `fold`, `groupBy`) over manual loops
30
+ - Prefer `Sequence` for large collections or multi-step pipelines — avoids intermediate lists
31
+ - Use `buildList { }` / `buildMap { }` instead of a mutable variable followed by `.toList()`
32
+
33
+ ## Coroutines
34
+
35
+ - Launch coroutines in a structured `CoroutineScope`; never use `GlobalScope` in production
36
+ - Use `withContext(Dispatchers.IO)` for blocking I/O; never block the main/UI thread
37
+ - Prefer `Flow` over callbacks for asynchronous streams; use `StateFlow` for observable state
@@ -0,0 +1,38 @@
1
+ ---
2
+ description: Always-on Effective Python standards from Brett Slatkin. Apply when writing or reviewing Python code.
3
+ ---
4
+
5
+ # Effective Python Standards
6
+
7
+ Apply these principles from *Effective Python* (Brett Slatkin, 3rd edition) to all Python code.
8
+
9
+ ## Pythonic style
10
+
11
+ - Use `enumerate()` over `range(len(...))` for indexed iteration
12
+ - Use f-strings for interpolation; avoid `%` formatting and `.format()`
13
+ - Prefer unpacking over indexing: `first, *rest = items` instead of `items[0]` and `items[1:]`
14
+ - Use `zip()` to iterate two sequences together; use `zip(strict=True)` when lengths must match
15
+
16
+ ## Data structures
17
+
18
+ - Use `list` for ordered mutable sequences, `tuple` for immutable positional data, `set` for membership tests
19
+ - Use `collections.defaultdict` or `Counter` instead of manual dict initialization
20
+ - Prefer `dataclasses` over plain dicts or namedtuples for structured data with methods
21
+
22
+ ## Functions
23
+
24
+ - Use keyword-only arguments (`def f(a, *, b)`) for optional parameters that benefit from names at the call site
25
+ - Never use mutable default arguments — use `None` and assign inside the function body
26
+ - Prefer generator expressions `(x for x in ...)` over list comprehensions when you don't need the full list in memory
27
+
28
+ ## Type annotations
29
+
30
+ - Annotate all public functions and class attributes
31
+ - Use `X | None` (Python 3.10+) or `Optional[X]` for nullable types; never return `None` silently from a typed function
32
+ - Avoid `Any` except at system boundaries (external APIs, deserialized JSON)
33
+
34
+ ## Error handling
35
+
36
+ - Catch specific exception types; never use bare `except:`
37
+ - Use `contextlib.suppress(ExceptionType)` for intentionally ignored exceptions — makes the intent explicit
38
+ - Use `__all__` in every module to declare its public API
@@ -0,0 +1,37 @@
1
+ ---
2
+ description: Always-on Rust standards from Programming with Rust and Rust in Action. Apply when writing or reviewing Rust code.
3
+ ---
4
+
5
+ # Rust Standards
6
+
7
+ Apply these principles from *Programming with Rust* (Donis Marshall) and *Rust in Action* (Tim McNamara) to all Rust code.
8
+
9
+ ## Ownership and borrowing
10
+
11
+ - Use owned values (`String`, `Vec<T>`) for data you own; borrow (`&str`, `&[T]`) when you only need to read
12
+ - Prefer passing `&T` or `&mut T` over cloning; clone only when ownership transfer is required
13
+ - Use `Rc<T>` for single-threaded shared ownership, `Arc<T>` for multi-threaded; use `RefCell<T>` / `Mutex<T>` for interior mutability
14
+
15
+ ## Error handling
16
+
17
+ - Return `Result<T, E>` from all fallible functions; propagate with `?`
18
+ - Use `thiserror` to define library errors with `#[derive(Error)]`; use `anyhow` for application-level error context
19
+ - Avoid `.unwrap()` in library code; use `.expect("clear message")` in application code where panicking is intentional
20
+
21
+ ## Types and traits
22
+
23
+ - Use `struct` for data, `enum` for variants with payloads, `trait` for shared behaviour
24
+ - Implement standard traits where appropriate: `Debug` always, `Display` for user-facing types, `Clone`, `PartialEq`, `Hash` as needed
25
+ - Use `impl Trait` in argument position for static dispatch; `Box<dyn Trait>` only when you need runtime dispatch
26
+
27
+ ## Idiomatic patterns
28
+
29
+ - Use `Iterator` adapters (`map`, `filter`, `flat_map`, `collect`) over manual loops — the compiler optimizes them equally
30
+ - Use `Option` methods (`map`, `unwrap_or`, `and_then`, `ok_or`) over `match` for simple transformations
31
+ - Use `if let` for single-variant matching; use `match` for exhaustive handling
32
+
33
+ ## Naming and style
34
+
35
+ - Types: `PascalCase`; functions, variables, modules: `snake_case`; constants and statics: `SCREAMING_SNAKE_CASE`
36
+ - Lifetime names: `'a`, `'b` for simple cases; descriptive names (`'arena`, `'cx`) for complex lifetimes
37
+ - Mark all public items in a library crate with doc comments (`///`)
@@ -0,0 +1,42 @@
1
+ ---
2
+ description: Always-on Effective TypeScript standards from Dan Vanderkam. Apply when writing or reviewing TypeScript or JavaScript code.
3
+ ---
4
+
5
+ # Effective TypeScript Standards
6
+
7
+ Apply these principles from *Effective TypeScript* (Dan Vanderkam, 2nd edition) to all TypeScript code.
8
+
9
+ ## Types
10
+
11
+ - Prefer union types over enums for simple sets of values: `type Direction = 'N' | 'S' | 'E' | 'W'`
12
+ - Use `interface` for extensible object shapes that others may augment; use `type` for unions, intersections, and computed types
13
+ - Avoid `any`; use `unknown` when the type is genuinely unknown, then narrow with guards before use
14
+ - Avoid type assertions (`as T`) — prefer type narrowing, overloads, or generics
15
+
16
+ ## Type inference
17
+
18
+ - Let TypeScript infer return types on internal functions; explicitly annotate public API return types
19
+ - Annotate a variable at declaration if it cannot be initialized immediately
20
+ - Use `as const` to preserve literal types; don't use it just to silence widening errors
21
+
22
+ ## Null safety
23
+
24
+ - Enable `strict` mode (which includes `strictNullChecks`) — treat every `T | undefined` as requiring explicit handling
25
+ - Use optional chaining `?.` and nullish coalescing `??` over `&&` and `||` chains
26
+ - Never use non-null assertion (`!`) — narrow instead
27
+
28
+ ## Structural typing
29
+
30
+ - TypeScript checks shapes, not nominal types — understand that duck typing applies
31
+ - Use discriminated unions with a `kind` or `type` literal field for exhaustive `switch` / narrowing
32
+ - Avoid class hierarchies for data shapes — prefer interfaces and composition
33
+
34
+ ## Generics
35
+
36
+ - Constrain generics to the minimum required: `<T extends string>` not `<T>`
37
+ - Use descriptive generic names for complex types (`<TItem, TKey>`) and single letters for simple transforms (`<T>`, `<K, V>`)
38
+
39
+ ## Functions
40
+
41
+ - Prefer function overloads over union parameter types to express the relationship between input and output
42
+ - Keep functions pure where possible; extract side effects to the call site