flonat-research 0.1.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 (285) hide show
  1. package/.claude/agents/domain-reviewer.md +336 -0
  2. package/.claude/agents/fixer.md +226 -0
  3. package/.claude/agents/paper-critic.md +370 -0
  4. package/.claude/agents/peer-reviewer.md +289 -0
  5. package/.claude/agents/proposal-reviewer.md +215 -0
  6. package/.claude/agents/referee2-reviewer.md +367 -0
  7. package/.claude/agents/references/journal-referee-profiles.md +354 -0
  8. package/.claude/agents/references/paper-critic/council-personas.md +77 -0
  9. package/.claude/agents/references/paper-critic/council-prompts.md +198 -0
  10. package/.claude/agents/references/peer-reviewer/report-template.md +199 -0
  11. package/.claude/agents/references/peer-reviewer/sa-prompts.md +260 -0
  12. package/.claude/agents/references/peer-reviewer/security-scan.md +188 -0
  13. package/.claude/agents/references/proposal-reviewer/report-template.md +144 -0
  14. package/.claude/agents/references/proposal-reviewer/sa-prompts.md +149 -0
  15. package/.claude/agents/references/referee-config.md +114 -0
  16. package/.claude/agents/references/referee2-reviewer/audit-checklists.md +287 -0
  17. package/.claude/agents/references/referee2-reviewer/report-template.md +334 -0
  18. package/.claude/rules/design-before-results.md +52 -0
  19. package/.claude/rules/ignore-agents-md.md +17 -0
  20. package/.claude/rules/ignore-gemini-md.md +17 -0
  21. package/.claude/rules/lean-claude-md.md +45 -0
  22. package/.claude/rules/learn-tags.md +99 -0
  23. package/.claude/rules/overleaf-separation.md +67 -0
  24. package/.claude/rules/plan-first.md +175 -0
  25. package/.claude/rules/read-docs-first.md +50 -0
  26. package/.claude/rules/scope-discipline.md +28 -0
  27. package/.claude/settings.json +125 -0
  28. package/.context/current-focus.md +33 -0
  29. package/.context/preferences/priorities.md +36 -0
  30. package/.context/preferences/task-naming.md +28 -0
  31. package/.context/profile.md +29 -0
  32. package/.context/projects/_index.md +41 -0
  33. package/.context/projects/papers/nudge-exp.md +22 -0
  34. package/.context/projects/papers/uncertainty.md +31 -0
  35. package/.context/resources/claude-scientific-writer-review.md +48 -0
  36. package/.context/resources/cunningham-multi-analyst-agents.md +104 -0
  37. package/.context/resources/cunningham-multilang-code-audit.md +62 -0
  38. package/.context/resources/google-ai-co-scientist-review.md +72 -0
  39. package/.context/resources/karpathy-llm-council-review.md +58 -0
  40. package/.context/resources/multi-coder-reliability-protocol.md +175 -0
  41. package/.context/resources/pedro-santanna-takeaways.md +96 -0
  42. package/.context/resources/venue-rankings/abs_ajg_2024.csv +1823 -0
  43. package/.context/resources/venue-rankings/abs_ajg_2024_econ.csv +356 -0
  44. package/.context/resources/venue-rankings/cabs_4_4star_theory.csv +40 -0
  45. package/.context/resources/venue-rankings/core_2026.csv +801 -0
  46. package/.context/resources/venue-rankings.md +147 -0
  47. package/.context/workflows/README.md +69 -0
  48. package/.context/workflows/daily-review.md +91 -0
  49. package/.context/workflows/meeting-actions.md +108 -0
  50. package/.context/workflows/replication-protocol.md +155 -0
  51. package/.context/workflows/weekly-review.md +113 -0
  52. package/.mcp-server-biblio/formatters.py +158 -0
  53. package/.mcp-server-biblio/pyproject.toml +11 -0
  54. package/.mcp-server-biblio/server.py +678 -0
  55. package/.mcp-server-biblio/sources/__init__.py +14 -0
  56. package/.mcp-server-biblio/sources/base.py +73 -0
  57. package/.mcp-server-biblio/sources/formatters.py +83 -0
  58. package/.mcp-server-biblio/sources/models.py +22 -0
  59. package/.mcp-server-biblio/sources/multi_source.py +243 -0
  60. package/.mcp-server-biblio/sources/openalex_source.py +183 -0
  61. package/.mcp-server-biblio/sources/scopus_source.py +309 -0
  62. package/.mcp-server-biblio/sources/wos_source.py +508 -0
  63. package/.mcp-server-biblio/uv.lock +896 -0
  64. package/.scripts/README.md +161 -0
  65. package/.scripts/ai_pattern_density.py +446 -0
  66. package/.scripts/conf +445 -0
  67. package/.scripts/config.py +122 -0
  68. package/.scripts/count_inventory.py +275 -0
  69. package/.scripts/daily_digest.py +288 -0
  70. package/.scripts/done +177 -0
  71. package/.scripts/extract_meeting_actions.py +223 -0
  72. package/.scripts/focus +176 -0
  73. package/.scripts/generate-codex-agents-md.py +217 -0
  74. package/.scripts/inbox +194 -0
  75. package/.scripts/notion_helpers.py +325 -0
  76. package/.scripts/openalex/query_helpers.py +306 -0
  77. package/.scripts/papers +227 -0
  78. package/.scripts/query +223 -0
  79. package/.scripts/session-history.py +201 -0
  80. package/.scripts/skill-health.py +516 -0
  81. package/.scripts/skill-log-miner.py +273 -0
  82. package/.scripts/sync-to-codex.sh +252 -0
  83. package/.scripts/task +213 -0
  84. package/.scripts/tasks +190 -0
  85. package/.scripts/week +206 -0
  86. package/CLAUDE.md +197 -0
  87. package/LICENSE +21 -0
  88. package/MEMORY.md +38 -0
  89. package/README.md +269 -0
  90. package/docs/agents.md +44 -0
  91. package/docs/bibliography-setup.md +55 -0
  92. package/docs/council-mode.md +36 -0
  93. package/docs/getting-started.md +245 -0
  94. package/docs/hooks.md +38 -0
  95. package/docs/mcp-servers.md +82 -0
  96. package/docs/notion-setup.md +109 -0
  97. package/docs/rules.md +33 -0
  98. package/docs/scripts.md +303 -0
  99. package/docs/setup-overview/setup-overview.pdf +0 -0
  100. package/docs/skills.md +70 -0
  101. package/docs/system.md +159 -0
  102. package/hooks/block-destructive-git.sh +66 -0
  103. package/hooks/context-monitor.py +114 -0
  104. package/hooks/postcompact-restore.py +157 -0
  105. package/hooks/precompact-autosave.py +181 -0
  106. package/hooks/promise-checker.sh +124 -0
  107. package/hooks/protect-source-files.sh +81 -0
  108. package/hooks/resume-context-loader.sh +53 -0
  109. package/hooks/startup-context-loader.sh +102 -0
  110. package/package.json +51 -0
  111. package/packages/cli-council/.github/workflows/claude-code-review.yml +44 -0
  112. package/packages/cli-council/.github/workflows/claude.yml +50 -0
  113. package/packages/cli-council/README.md +100 -0
  114. package/packages/cli-council/pyproject.toml +43 -0
  115. package/packages/cli-council/src/cli_council/__init__.py +19 -0
  116. package/packages/cli-council/src/cli_council/__main__.py +185 -0
  117. package/packages/cli-council/src/cli_council/backends/__init__.py +8 -0
  118. package/packages/cli-council/src/cli_council/backends/base.py +81 -0
  119. package/packages/cli-council/src/cli_council/backends/claude.py +25 -0
  120. package/packages/cli-council/src/cli_council/backends/codex.py +27 -0
  121. package/packages/cli-council/src/cli_council/backends/gemini.py +26 -0
  122. package/packages/cli-council/src/cli_council/checkpoint.py +212 -0
  123. package/packages/cli-council/src/cli_council/config.py +51 -0
  124. package/packages/cli-council/src/cli_council/council.py +391 -0
  125. package/packages/cli-council/src/cli_council/models.py +46 -0
  126. package/packages/llm-council/.github/workflows/claude-code-review.yml +44 -0
  127. package/packages/llm-council/.github/workflows/claude.yml +50 -0
  128. package/packages/llm-council/README.md +453 -0
  129. package/packages/llm-council/pyproject.toml +42 -0
  130. package/packages/llm-council/src/llm_council/__init__.py +23 -0
  131. package/packages/llm-council/src/llm_council/__main__.py +259 -0
  132. package/packages/llm-council/src/llm_council/checkpoint.py +193 -0
  133. package/packages/llm-council/src/llm_council/client.py +253 -0
  134. package/packages/llm-council/src/llm_council/config.py +232 -0
  135. package/packages/llm-council/src/llm_council/council.py +482 -0
  136. package/packages/llm-council/src/llm_council/models.py +46 -0
  137. package/packages/mcp-bibliography/MEMORY.md +31 -0
  138. package/packages/mcp-bibliography/_app.py +226 -0
  139. package/packages/mcp-bibliography/formatters.py +158 -0
  140. package/packages/mcp-bibliography/log/2026-03-13-2100.md +35 -0
  141. package/packages/mcp-bibliography/pyproject.toml +15 -0
  142. package/packages/mcp-bibliography/run.sh +20 -0
  143. package/packages/mcp-bibliography/scholarly_formatters.py +83 -0
  144. package/packages/mcp-bibliography/server.py +1857 -0
  145. package/packages/mcp-bibliography/tools/__init__.py +28 -0
  146. package/packages/mcp-bibliography/tools/_registry.py +19 -0
  147. package/packages/mcp-bibliography/tools/altmetric.py +107 -0
  148. package/packages/mcp-bibliography/tools/core.py +92 -0
  149. package/packages/mcp-bibliography/tools/dblp.py +52 -0
  150. package/packages/mcp-bibliography/tools/openalex.py +296 -0
  151. package/packages/mcp-bibliography/tools/opencitations.py +102 -0
  152. package/packages/mcp-bibliography/tools/openreview.py +179 -0
  153. package/packages/mcp-bibliography/tools/orcid.py +131 -0
  154. package/packages/mcp-bibliography/tools/scholarly.py +575 -0
  155. package/packages/mcp-bibliography/tools/unpaywall.py +63 -0
  156. package/packages/mcp-bibliography/tools/zenodo.py +123 -0
  157. package/packages/mcp-bibliography/uv.lock +711 -0
  158. package/scripts/setup.sh +143 -0
  159. package/skills/beamer-deck/SKILL.md +199 -0
  160. package/skills/beamer-deck/references/quality-rubric.md +54 -0
  161. package/skills/beamer-deck/references/review-prompts.md +106 -0
  162. package/skills/bib-validate/SKILL.md +261 -0
  163. package/skills/bib-validate/references/council-mode.md +34 -0
  164. package/skills/bib-validate/references/deep-verify.md +79 -0
  165. package/skills/bib-validate/references/fix-mode.md +36 -0
  166. package/skills/bib-validate/references/openalex-verification.md +45 -0
  167. package/skills/bib-validate/references/preprint-check.md +31 -0
  168. package/skills/bib-validate/references/ref-manager-crossref.md +41 -0
  169. package/skills/bib-validate/references/report-template.md +82 -0
  170. package/skills/code-archaeology/SKILL.md +141 -0
  171. package/skills/code-review/SKILL.md +265 -0
  172. package/skills/code-review/references/quality-rubric.md +67 -0
  173. package/skills/consolidate-memory/SKILL.md +208 -0
  174. package/skills/context-status/SKILL.md +126 -0
  175. package/skills/creation-guard/SKILL.md +230 -0
  176. package/skills/devils-advocate/SKILL.md +130 -0
  177. package/skills/devils-advocate/references/competing-hypotheses.md +83 -0
  178. package/skills/init-project/SKILL.md +115 -0
  179. package/skills/init-project-course/references/memory-and-settings.md +92 -0
  180. package/skills/init-project-course/references/organise-templates.md +94 -0
  181. package/skills/init-project-course/skill.md +147 -0
  182. package/skills/init-project-light/skill.md +139 -0
  183. package/skills/init-project-research/SKILL.md +368 -0
  184. package/skills/init-project-research/references/atlas-pipeline-sync.md +70 -0
  185. package/skills/init-project-research/references/atlas-schema.md +81 -0
  186. package/skills/init-project-research/references/confirmation-report.md +39 -0
  187. package/skills/init-project-research/references/domain-profile-template.md +104 -0
  188. package/skills/init-project-research/references/interview-round3.md +34 -0
  189. package/skills/init-project-research/references/literature-discovery.md +43 -0
  190. package/skills/init-project-research/references/scaffold-details.md +197 -0
  191. package/skills/init-project-research/templates/field-calibration.md +60 -0
  192. package/skills/init-project-research/templates/pipeline-manifest.md +63 -0
  193. package/skills/init-project-research/templates/run-all.sh +116 -0
  194. package/skills/init-project-research/templates/seed-files.md +337 -0
  195. package/skills/insights-deck/SKILL.md +151 -0
  196. package/skills/interview-me/SKILL.md +157 -0
  197. package/skills/latex/SKILL.md +141 -0
  198. package/skills/latex/references/latex-configs.md +183 -0
  199. package/skills/latex-autofix/SKILL.md +230 -0
  200. package/skills/latex-autofix/references/known-errors.md +183 -0
  201. package/skills/latex-autofix/references/quality-rubric.md +50 -0
  202. package/skills/latex-health-check/SKILL.md +161 -0
  203. package/skills/learn/SKILL.md +220 -0
  204. package/skills/learn/scripts/validate_skill.py +265 -0
  205. package/skills/lessons-learned/SKILL.md +201 -0
  206. package/skills/literature/SKILL.md +335 -0
  207. package/skills/literature/references/agent-templates.md +393 -0
  208. package/skills/literature/references/bibliometric-apis.md +44 -0
  209. package/skills/literature/references/cli-council-search.md +79 -0
  210. package/skills/literature/references/openalex-api-guide.md +371 -0
  211. package/skills/literature/references/openalex-common-queries.md +381 -0
  212. package/skills/literature/references/openalex-workflows.md +248 -0
  213. package/skills/literature/references/reference-manager-sync.md +36 -0
  214. package/skills/literature/references/scopus-api-guide.md +208 -0
  215. package/skills/literature/references/wos-api-guide.md +308 -0
  216. package/skills/multi-perspective/SKILL.md +311 -0
  217. package/skills/multi-perspective/references/computational-many-analysts.md +77 -0
  218. package/skills/pipeline-manifest/SKILL.md +226 -0
  219. package/skills/pre-submission-report/SKILL.md +153 -0
  220. package/skills/process-reviews/SKILL.md +244 -0
  221. package/skills/process-reviews/references/rr-routing.md +101 -0
  222. package/skills/project-deck/SKILL.md +87 -0
  223. package/skills/project-safety/SKILL.md +135 -0
  224. package/skills/proofread/SKILL.md +254 -0
  225. package/skills/proofread/references/quality-rubric.md +104 -0
  226. package/skills/python-env/SKILL.md +57 -0
  227. package/skills/quarto-deck/SKILL.md +226 -0
  228. package/skills/quarto-deck/references/markdown-format.md +143 -0
  229. package/skills/quarto-deck/references/quality-rubric.md +54 -0
  230. package/skills/save-context/SKILL.md +174 -0
  231. package/skills/session-log/SKILL.md +98 -0
  232. package/skills/shared/concept-validation-gate.md +161 -0
  233. package/skills/shared/council-protocol.md +265 -0
  234. package/skills/shared/distribution-diagnostics.md +164 -0
  235. package/skills/shared/engagement-stratified-sampling.md +218 -0
  236. package/skills/shared/escalation-protocol.md +74 -0
  237. package/skills/shared/external-audit-protocol.md +205 -0
  238. package/skills/shared/intercoder-reliability.md +256 -0
  239. package/skills/shared/mcp-degradation.md +81 -0
  240. package/skills/shared/method-probing-questions.md +163 -0
  241. package/skills/shared/multi-language-conventions.md +143 -0
  242. package/skills/shared/paid-api-safety.md +174 -0
  243. package/skills/shared/palettes.md +90 -0
  244. package/skills/shared/progressive-disclosure.md +92 -0
  245. package/skills/shared/project-documentation-content.md +443 -0
  246. package/skills/shared/project-documentation-format.md +281 -0
  247. package/skills/shared/project-documentation.md +100 -0
  248. package/skills/shared/publication-output.md +138 -0
  249. package/skills/shared/quality-scoring.md +70 -0
  250. package/skills/shared/reference-resolution.md +77 -0
  251. package/skills/shared/research-quality-rubric.md +165 -0
  252. package/skills/shared/rhetoric-principles.md +54 -0
  253. package/skills/shared/skill-design-patterns.md +272 -0
  254. package/skills/shared/skill-index.md +240 -0
  255. package/skills/shared/system-documentation.md +334 -0
  256. package/skills/shared/tikz-rules.md +402 -0
  257. package/skills/shared/validation-tiers.md +121 -0
  258. package/skills/shared/venue-guides/README.md +46 -0
  259. package/skills/shared/venue-guides/cell_press_style.md +483 -0
  260. package/skills/shared/venue-guides/conferences_formatting.md +564 -0
  261. package/skills/shared/venue-guides/cs_conference_style.md +463 -0
  262. package/skills/shared/venue-guides/examples/cell_summary_example.md +247 -0
  263. package/skills/shared/venue-guides/examples/medical_structured_abstract.md +313 -0
  264. package/skills/shared/venue-guides/examples/nature_abstract_examples.md +213 -0
  265. package/skills/shared/venue-guides/examples/neurips_introduction_example.md +245 -0
  266. package/skills/shared/venue-guides/journals_formatting.md +486 -0
  267. package/skills/shared/venue-guides/medical_journal_styles.md +535 -0
  268. package/skills/shared/venue-guides/ml_conference_style.md +556 -0
  269. package/skills/shared/venue-guides/nature_science_style.md +405 -0
  270. package/skills/shared/venue-guides/reviewer_expectations.md +417 -0
  271. package/skills/shared/venue-guides/venue_writing_styles.md +321 -0
  272. package/skills/split-pdf/SKILL.md +172 -0
  273. package/skills/split-pdf/methodology.md +48 -0
  274. package/skills/sync-notion/SKILL.md +93 -0
  275. package/skills/system-audit/SKILL.md +157 -0
  276. package/skills/system-audit/references/sub-agent-prompts.md +294 -0
  277. package/skills/task-management/SKILL.md +131 -0
  278. package/skills/update-focus/SKILL.md +204 -0
  279. package/skills/update-project-doc/SKILL.md +194 -0
  280. package/skills/validate-bib/SKILL.md +242 -0
  281. package/skills/validate-bib/references/council-mode.md +34 -0
  282. package/skills/validate-bib/references/deep-verify.md +71 -0
  283. package/skills/validate-bib/references/openalex-verification.md +45 -0
  284. package/skills/validate-bib/references/preprint-check.md +31 -0
  285. package/skills/validate-bib/references/report-template.md +62 -0
@@ -0,0 +1,183 @@
1
+ # Known Error Patterns & Auto-Fixes
2
+
3
+ > Reference file for `/latex-autofix`. Each pattern maps a log signature to a fix.
4
+
5
+ ## 1. Missing package
6
+
7
+ **Log pattern:**
8
+ ```
9
+ ! LaTeX Error: File `<package>.sty' not found.
10
+ ```
11
+ or
12
+ ```
13
+ ! Undefined control sequence. ... \<command>
14
+ ```
15
+ where the undefined command belongs to a well-known package.
16
+
17
+ **Fix:** Add `\usepackage{<package>}` to the preamble (before `\begin{document}`). Place it after existing `\usepackage` lines. Common mappings:
18
+
19
+ | Command | Package |
20
+ |---------|---------|
21
+ | `\includegraphics` | `graphicx` |
22
+ | `\url`, `\href` | `hyperref` |
23
+ | `\toprule`, `\midrule`, `\bottomrule` | `booktabs` |
24
+ | `\multirow` | `multirow` |
25
+ | `\lstlisting` | `listings` |
26
+ | `\tikz`, `\begin{tikzpicture}` | `tikz` |
27
+ | `\xspace` | `xspace` |
28
+ | `\adjustbox` | `adjustbox` |
29
+ | `\subcaption`, `\subfigure` | `subcaption` |
30
+ | `\sisetup`, `\SI` | `siunitx` |
31
+ | `\algorithm` | `algorithm2e` or `algorithmicx` |
32
+
33
+ If the package is unclear, report it as unresolved rather than guessing.
34
+
35
+ ## 2. Font / symbol conflicts
36
+
37
+ **Log pattern:**
38
+ ```
39
+ Command \<name> already defined.
40
+ ```
41
+ Common case: `\Bbbk` conflict between `amssymb` and `newtxmath`.
42
+
43
+ **Fix:** Add a `\let` override **before** the conflicting package:
44
+
45
+ ```latex
46
+ % Fix font conflict: \Bbbk defined by both amssymb and newtxmath
47
+ \let\Bbbk\relax
48
+ ```
49
+
50
+ For the specific `amssymb` / `newtxmath` conflict, insert `\let\Bbbk\relax` between the two `\usepackage` lines. More generally:
51
+
52
+ - Read the error to identify which command is multiply defined
53
+ - Add `\let\<command>\relax` before the second package that defines it
54
+ - If multiple commands conflict, add a `\let` for each
55
+
56
+ ## 3. Undefined citation
57
+
58
+ **Log pattern:**
59
+ ```
60
+ LaTeX Warning: Citation `<key>' on page <n> undefined
61
+ ```
62
+ or (with biblatex/biber):
63
+ ```
64
+ Package biblatex Warning: ... Entry '<key>' ... not found
65
+ ```
66
+
67
+ **Fix:**
68
+ 1. Read the `.bib` file(s) identified in Phase 1.
69
+ 2. Search for the citation key. Check for:
70
+ - **Typo:** fuzzy-match against all keys in the `.bib` (e.g., `smith2020` vs `Smith2020`, `santanna2020` vs `santanna2020doubly`).
71
+ - **Missing entry:** the key genuinely doesn't exist in the `.bib`.
72
+ 3. If a close match is found, fix the `\cite{<key>}` in the `.tex` file.
73
+ 4. If no match exists, report as unresolved — do **not** fabricate bibliography entries.
74
+
75
+ ## 4. Missing image / file path
76
+
77
+ **Log pattern:**
78
+ ```
79
+ ! LaTeX Error: File `<path>' not found.
80
+ ```
81
+ or
82
+ ```
83
+ ! Package pdftex.def Error: File `<path>' not found
84
+ ```
85
+
86
+ **Fix:**
87
+ 1. Extract the filename from the error.
88
+ 2. Search the project directory recursively for a file with that name (using Glob).
89
+ 3. If found, update the `\includegraphics` (or `\input`, `\include`) path in the `.tex` file.
90
+ 4. If not found, report as unresolved.
91
+
92
+ ## 5. Stale auxiliary / cache files
93
+
94
+ **Log pattern:** Errors that reference corrupted `.aux`, `.bbl`, `.bcf`, `.toc`, or `.idx` files, or error messages like:
95
+ ```
96
+ I found no \bibstyle command
97
+ ```
98
+ ```
99
+ I found no \citation commands
100
+ ```
101
+ ```
102
+ \openout ... already open
103
+ ```
104
+ or when the same error persists after a seemingly correct fix.
105
+
106
+ **Fix:**
107
+ 1. Run `latexmk -C -outdir=out` in the project directory to clean all generated files.
108
+ 2. Delete `out/` contents if `latexmk -C` doesn't clear them.
109
+ 3. Restart the compile loop from Step 2a (this counts as one iteration).
110
+
111
+ ## 6. Beamer package conflicts (enumitem)
112
+
113
+ **Log pattern:**
114
+ ```
115
+ Option clash for package enumitem
116
+ ```
117
+ or
118
+ ```
119
+ Command \item already defined
120
+ ```
121
+ when using `enumitem` with beamer.
122
+
123
+ **Fix:** Beamer redefines `\item` internally, so enumitem often clashes. First check if enumitem is actually needed — if only used for basic lists, remove it (beamer handles lists natively). If enumitem features are required (custom labels, spacing), replace:
124
+
125
+ ```latex
126
+ % Before (conflicts with beamer):
127
+ \usepackage{enumitem}
128
+
129
+ % After:
130
+ \usepackage[shortlabels]{enumitem}
131
+ \setlist[itemize]{label=\textbullet}
132
+ ```
133
+
134
+ If the conflict is with a non-beamer class, the `shortlabels` option alone usually resolves it.
135
+
136
+ ## 7. xcolor option conflicts
137
+
138
+ **Log pattern:**
139
+ ```
140
+ Option clash for package xcolor
141
+ ```
142
+ or
143
+ ```
144
+ Undefined control sequence. \rowcolor
145
+ ```
146
+ (when `table` option is missing from xcolor).
147
+
148
+ **Fix:** xcolor must be loaded with all needed options **before** any package that loads it implicitly (e.g., `tikz`, `tcolorbox`, `beamer`). Two approaches:
149
+
150
+ ```latex
151
+ % Approach 1: Load xcolor early with all options
152
+ \usepackage[table,dvipsnames,svgnames]{xcolor}
153
+ % ... then load tikz, tcolorbox, etc.
154
+
155
+ % Approach 2: If another package loads xcolor first, use PassOptionsToPackage
156
+ \PassOptionsToPackage{table,dvipsnames,svgnames}{xcolor}
157
+ \documentclass{...}
158
+ ```
159
+
160
+ Common missing options: `table` (for `\rowcolor`, `\cellcolor`), `dvipsnames` (for named colours like `ForestGreen`), `svgnames` (for web colours).
161
+
162
+ ## 8. TikZ reserved key conflicts
163
+
164
+ **Log pattern:**
165
+ ```
166
+ I do not know the key '/tikz/<name>'
167
+ ```
168
+ or
169
+ ```
170
+ Package pgfkeys Error: I do not know the key '/tikz/<name>'
171
+ ```
172
+
173
+ **Fix:** TikZ reserves many common English words as keys. If a custom key name conflicts, rename it:
174
+
175
+ ```latex
176
+ % Before (conflicts — 'step' is a reserved TikZ key):
177
+ \tikzset{step/.style={...}}
178
+
179
+ % After:
180
+ \tikzset{mystep/.style={...}}
181
+ ```
182
+
183
+ Common reserved names that cause conflicts: `step`, `at`, `node`, `draw`, `fill`, `path`, `scale`, `shift`, `rotate`, `color`, `text`, `inner sep`, `outer sep`. Rename custom keys to avoid these (e.g., `stepsize`, `mynode`, `drawstyle`).
@@ -0,0 +1,50 @@
1
+ # Quality Rubric: LaTeX Auto-Fix
2
+
3
+ > Scoring rubric for `/latex-autofix`. Uses the shared framework in [`../../shared/quality-scoring.md`](../../shared/quality-scoring.md).
4
+
5
+ ## Deduction Table
6
+
7
+ ### Blocker (-100)
8
+
9
+ | Issue | Deduction | Notes |
10
+ |-------|-----------|-------|
11
+ | Compilation fails after 5 fix iterations | -100 | No PDF produced |
12
+ | PDF produced but with fatal rendering errors (blank pages, missing content) | -100 | Output is unusable |
13
+
14
+ ### Critical (-15 to -25)
15
+
16
+ | Issue | Deduction | Notes |
17
+ |-------|-----------|-------|
18
+ | Unresolved `\cite{}` — `??` or `[?]` in output | -15 | Per unique broken citation key |
19
+ | Unresolved `\ref{}` — `??` in output | -15 | Per unique broken reference |
20
+ | Auto-fix changed user intent (e.g., wrong citation key substituted) | -25 | Per instance — silent corruption |
21
+
22
+ ### Major (-5 to -14)
23
+
24
+ | Issue | Deduction | Notes |
25
+ |-------|-----------|-------|
26
+ | Overfull hbox > 10pt remaining | -5 | Per instance |
27
+ | Missing `.latexmkrc` or incorrect `$out_dir` config | -10 | Build hygiene failure |
28
+ | Stale auxiliary files causing warnings | -5 | Should have been caught by cache clean |
29
+ | Package added but not strictly necessary | -5 | Per unnecessary package |
30
+ | Cited keys in `.tex` not found in `.bib` (audit) | -8 | Per missing key |
31
+ | Unused keys in `.bib` (audit, >20% unused) | -5 | Once for the pattern |
32
+
33
+ ### Minor (-1 to -4)
34
+
35
+ | Issue | Deduction | Notes |
36
+ |-------|-----------|-------|
37
+ | Overfull hbox 1-10pt | -2 | Per instance |
38
+ | Underfull hbox/vbox warnings | -1 | Per instance |
39
+ | Font substitution warnings | -2 | Per unique substitution |
40
+ | Multiple compilation iterations needed (>2) | -1 | Per extra iteration beyond 2 |
41
+
42
+ ## Category Mapping
43
+
44
+ | Rubric category | Phase |
45
+ |----------------|-------|
46
+ | Pre-flight config | Phase 1 |
47
+ | Compilation errors | Phase 2 |
48
+ | Auto-fix quality | Phase 2 (fix accuracy) |
49
+ | Remaining warnings | Phase 3 |
50
+ | Citation audit | Phase 4 |
@@ -0,0 +1,161 @@
1
+ ---
2
+ name: latex-health-check
3
+ description: "Use when you need to compile all LaTeX projects and check cross-project consistency."
4
+ allowed_tools:
5
+ - Read
6
+ - Edit
7
+ - Write
8
+ - Glob
9
+ - Grep
10
+ - Bash(latexmk*)
11
+ - Bash(pdflatex*)
12
+ - Bash(biber*)
13
+ - Bash(bibtex*)
14
+ - Bash(ls*)
15
+ - Bash(mkdir*)
16
+ - Bash(cp*)
17
+ - Bash(ln*)
18
+ - Bash(wc*)
19
+ - Bash(readlink*)
20
+ argument-hint: "[project-path | 'all' | 'quick']"
21
+ ---
22
+
23
+ # LaTeX Health Check: Self-Healing Build Agent
24
+
25
+ > Compile all LaTeX projects, auto-fix known errors iteratively, and verify cross-project consistency (symlinks, shared bibliographies, Overleaf separation).
26
+
27
+ ## When to Use
28
+
29
+ - Periodically (weekly) to catch build rot before it becomes debugging sessions
30
+ - After major infrastructure changes (template updates, symlink reorganisation)
31
+ - Before submission season to verify all papers compile cleanly
32
+ - When the user says "check my LaTeX", "build health", "compile everything"
33
+
34
+ ## Modes
35
+
36
+ | Mode | Trigger | What it does |
37
+ |------|---------|-------------|
38
+ | **Single project** | Path argument | Compile + fix + verify one project |
39
+ | **All projects** | `all` argument | Discover and compile every LaTeX project |
40
+ | **Quick** | `quick` argument | Compile only, no fixes, report errors |
41
+
42
+ ## Phase 1: Discover LaTeX Projects
43
+
44
+ Find all directories containing a `\documentclass` in a .tex file:
45
+
46
+ Search locations (read from config, detect which exist):
47
+ - Research root from `~/.config/task-mgmt/research-root` (fallback: `~/Projects/`)
48
+ - `$TM/docs/`
49
+
50
+ For each discovered project, record:
51
+ - Project name (directory name)
52
+ - Main .tex file path
53
+ - Whether it has a `.latexmkrc`
54
+ - Whether it has an `out/` directory
55
+ - Whether it's inside a `paper/` subdirectory (Overleaf-linked)
56
+
57
+ ## Phase 2: Build Loop (per project)
58
+
59
+ For each project:
60
+
61
+ ### 2a. Pre-flight
62
+ - Check for `.latexmkrc` — create if missing (with `$out_dir = 'out'` and PDF copy-back)
63
+ - Create `out/` directory if missing
64
+
65
+ ### 2b. Compile
66
+ ```bash
67
+ cd <project-dir> && latexmk -interaction=nonstopmode <main.tex> 2>&1
68
+ ```
69
+
70
+ **Engine selection:** Do NOT hardcode `-pdf`. The project's `.latexmkrc` (created in 2a) controls the engine — it auto-detects xelatex via `fontspec`, or defaults to pdflatex. Passing `-pdf` overrides this and breaks xelatex/lualatex projects. Let latexmk read `.latexmkrc`.
71
+
72
+ ### 2c. Parse log
73
+ Extract from `out/*.log`:
74
+ - Error count (lines starting with `!`)
75
+ - Warning count (Overfull/Underfull hbox/vbox)
76
+ - Undefined citation count
77
+ - Missing package count
78
+
79
+ ### 2d. Auto-fix (up to 3 iterations)
80
+
81
+ For each error, apply the known fix from the database:
82
+
83
+ | Error pattern | Fix |
84
+ |--------------|-----|
85
+ | Missing package `X` | Add `\usepackage{X}` — but NEVER try `xltabular` or `ltablex` (use `longtable` instead) |
86
+ | Undefined citation `key` | Check .bib file exists and is referenced; check for typos via edit distance |
87
+ | Overfull hbox | Flag location and width — do NOT auto-fix (requires human judgment) |
88
+ | tcolorbox `=` or `,` in title | Wrap title in braces: `title={...}` |
89
+ | Font encoding warning | Add `\usepackage[T1]{fontenc}` if missing |
90
+ | Missing `\begin{document}` | Check for corrupted preamble |
91
+ | Broken symlink in `\input{}` or `\includegraphics{}` | Find the target and report |
92
+ | Build artifacts in source dir | Flag — offer to move to `out/` |
93
+
94
+ After each fix, recompile. Max 3 iterations per project.
95
+
96
+ **Why 3 iterations (not 5)?** `/latex-autofix` runs up to 5 iterations on a single project with deep error analysis. This skill trades depth for breadth — 3 iterations is enough to catch the common fleet-wide issues (missing packages, broken symlinks, stale cache) without spending excessive time on any one project. If a project still has errors after 3 iterations, mark it as ERROR and recommend running `/latex-autofix` on it directly for deeper diagnosis.
97
+
98
+ ### 2e. Record result
99
+ ```json
100
+ {
101
+ "project": "project-name",
102
+ "path": "/full/path",
103
+ "status": "OK | FIXED | ERROR",
104
+ "errors_initial": 3,
105
+ "errors_final": 0,
106
+ "fixes_applied": ["added fontenc", "fixed tcolorbox title"],
107
+ "warnings": 2,
108
+ "undefined_citations": 0
109
+ }
110
+ ```
111
+
112
+ ## Phase 3: Cross-Project Checks
113
+
114
+ After all projects are compiled:
115
+
116
+ 1. **Symlink integrity** — verify all symlinks in skills/, agents/, rules/, hooks/ resolve
117
+ 2. **Shared .bib consistency** — if multiple projects reference the same .bib file (e.g., via symlink), verify they're all pointing to the same version
118
+ 3. **Overleaf separation** — scan every `paper/` directory for forbidden file types (.py, .R, .csv, .ipynb, etc.)
119
+ 4. **Template consistency** — check if projects using the working paper template have diverged from the current template version
120
+
121
+ ## Phase 4: Report
122
+
123
+ Generate a summary report:
124
+
125
+ ```
126
+ LaTeX Health Check — YYYY-MM-DD
127
+
128
+ Projects scanned: N
129
+ Compiled OK: N (list)
130
+ Fixed and OK: N (list + fixes applied)
131
+ Still broken: N (list + remaining errors)
132
+ Skipped: N (list + reason)
133
+
134
+ Cross-project issues:
135
+ Broken symlinks: N
136
+ Overleaf violations: N
137
+ Template drift: N
138
+
139
+ Warnings (not auto-fixed):
140
+ Overfull hboxes: N across M projects
141
+ Underfull hboxes: N across M projects
142
+ ```
143
+
144
+ Print to stdout. If `--save` flag or 10+ projects scanned, also write to `log/latex-health/YYYY-MM-DD.md`.
145
+
146
+ ## What This Skill Does NOT Do
147
+
148
+ - Does NOT fix overfull/underfull boxes (requires human judgment on rewording)
149
+ - Does NOT modify paper content (only build configuration and missing packages)
150
+ - Does NOT push to git (compilation fixes should be reviewed first)
151
+ - Does NOT touch Overleaf-synced files without permission (per overleaf-separation rule)
152
+
153
+ ## Cross-References
154
+
155
+ | Skill | Relationship |
156
+ |-------|-------------|
157
+ | `/latex-autofix` | Single-project deep fix (5 iterations). This skill runs a lighter version (3 iterations) at fleet scale. For ERROR projects, recommend running `/latex-autofix` directly. |
158
+ | `/latex` | Manual compilation config and `.latexmkrc` reference — health-check creates `.latexmkrc` files using the conventions defined there. |
159
+ | `/audit-project-research` | Checks project structure (directories, files). This skill checks build health. |
160
+ | `/bib-validate` | Validates bibliography entries. This skill checks if citations compile. |
161
+ | `/latex-template` | Checks preamble alignment with the working paper template. Complementary: run after health-check to ensure preamble consistency. |
@@ -0,0 +1,220 @@
1
+ ---
2
+ name: learn
3
+ description: "Extract reusable knowledge from the current session into a persistent skill.\nUse when you discover something non-obvious, create a workaround, or develop\na multi-step workflow that future sessions would benefit from."
4
+ allowed_tools:
5
+ - Read
6
+ - Write
7
+ - Edit
8
+ - Glob
9
+ - Grep
10
+ - Bash(uv run python*)
11
+ - AskUserQuestion
12
+ ---
13
+
14
+ # Learn: Session Knowledge Extraction
15
+
16
+ Extract reusable workflows, workarounds, and multi-step procedures discovered during a session into persistent skills. Complementary to the `learn-tags` rule — while `[LEARN]` tags record one-liner corrections in MEMORY.md, `/learn` creates full skill definitions in `skills/`.
17
+
18
+ ## When to Use
19
+
20
+ - You discovered a non-obvious multi-step procedure
21
+ - You built a workaround for a recurring problem
22
+ - You developed a workflow that future sessions would benefit from
23
+ - the user says "save this as a skill", "learn this", or "remember how to do this"
24
+
25
+ ## Phase 1: Evaluate
26
+
27
+ Before creating anything, answer these 4 self-assessment questions:
28
+
29
+ 1. **Non-obvious?** Would a future session figure this out without help, or would it waste time rediscovering it?
30
+ 2. **Future benefit?** Will this come up again across sessions or projects?
31
+ 3. **Repeatable?** Is this a procedure that can be followed step-by-step, or was it a one-off?
32
+ 4. **Multi-step?** Does it involve 2+ non-trivial steps that benefit from being documented together?
33
+
34
+ **Decision rule:** If at least 3 of 4 answers are "yes", proceed to Phase 2. Otherwise, suggest recording as a `[LEARN]` tag in MEMORY.md instead (simpler, lower overhead).
35
+
36
+ If borderline, ask the user:
37
+ > "This seems useful but may not warrant a full skill. Should I create a skill or just add a [LEARN] tag to MEMORY.md?"
38
+
39
+ ## Phase 2: Creation Guard + Read Patterns
40
+
41
+ Run the **creation-guard** analysis (see [`skills/creation-guard/SKILL.md`](../creation-guard/SKILL.md)):
42
+
43
+ 1. Identify the proposal (name, type, purpose, key functions, keywords)
44
+ 2. Search existing skills and agents for overlap (skill-index scan + keyword grep)
45
+ 3. Analyse overlap and generate a recommendation:
46
+
47
+ | Recommendation | Criteria | Action |
48
+ |----------------|----------|--------|
49
+ | **PROCEED** | <20% overlap, genuinely new | Continue to Phase 3 |
50
+ | **EXTEND** | 50%+ overlap with one existing | Modify existing skill instead — stop here |
51
+ | **COMPOSE** | Multiple artifacts cover 80%+ | Create wrapper or document workflow — stop here |
52
+ | **ITERATE** | 20-50% overlap, needs refinement | Ask the user to clarify differentiation, then re-evaluate |
53
+ | **BLOCK** | Would create duplication | Do not create — stop here |
54
+
55
+ 4. Present the creation-guard analysis to the user and get explicit approval before proceeding
56
+ 5. **Read [`skills/shared/skill-design-patterns.md`](../shared/skill-design-patterns.md)** — choose the structural pattern that fits:
57
+ - **Workflow-based** — multi-step with phases and review gates
58
+ - **Task-based** — focused input/output with processing rules
59
+ - **Agent-delegation** — multiple subagents, each handling one concern
60
+ - **Reference-based** — augmenting with domain knowledge via `references/`
61
+
62
+ ## Phase 3: Design the Skill
63
+
64
+ Before writing, make three decisions:
65
+
66
+ **1. Choose the structural pattern** (from Phase 2). State it explicitly:
67
+ > "This is a [workflow/task/agent-delegation/reference]-based skill."
68
+
69
+ **2. Identify resources needed:**
70
+ - Does the skill need `scripts/` for deterministic operations?
71
+ - Does it need `references/` for detailed specs, rubrics, or large examples?
72
+ - Does it need to delegate to subagents?
73
+
74
+ **3. Draft the architecture** — for non-trivial skills, sketch the flow:
75
+ ```
76
+ Input → [Step A] → REVIEW GATE → [Step B] → Output
77
+ ```
78
+
79
+ ## Phase 4: Build the Skill
80
+
81
+ Write `skills/{name}/SKILL.md`:
82
+
83
+ ### Frontmatter
84
+
85
+ ```yaml
86
+ ---
87
+ name: {kebab-case-name}
88
+ description: "{What it does. Concrete task types. Use when...}"
89
+ allowed_tools:
90
+ - {minimum set of tools needed}
91
+ ---
92
+ ```
93
+
94
+ ### Body Structure
95
+
96
+ The body varies by pattern, but always includes these elements:
97
+
98
+ ```markdown
99
+ # {Skill Name}: {Short Description}
100
+
101
+ ## When to Use
102
+ [Activation conditions — natural language triggers and /command]
103
+
104
+ ## {Main Workflow / Processing Rules / Delegation Protocol}
105
+ [The core of the skill — structured per the chosen pattern]
106
+
107
+ ## {Anti-Patterns / Never Do These}
108
+ [What NOT to do — agents default to generic without constraints]
109
+
110
+ ## Output Format
111
+ [What the output looks like]
112
+
113
+ ## Verification
114
+ [How to confirm it worked]
115
+ ```
116
+
117
+ **Optional sections** (add when relevant):
118
+ - `## Defaults` — assumptions table to reduce friction
119
+ - `## Examples` — concrete before/after or good/bad snippets
120
+ - `## Notes` — edge cases, limitations
121
+
122
+ ### Solution Pattern (for debugging/workaround skills)
123
+
124
+ When the skill captures a fix, workaround, or debugging procedure, use this body structure:
125
+
126
+ ```markdown
127
+ # {Skill Name}: {Short Description}
128
+
129
+ ## Problem
130
+ [Specific error message or symptom. Quote the exact text users would see.]
131
+
132
+ ## Context / Triggers
133
+ [When this occurs — tool versions, file types, OS, configurations]
134
+
135
+ ## Solution
136
+ [Step-by-step fix. Imperative form.]
137
+
138
+ ## Verification
139
+ [How to confirm the fix worked]
140
+
141
+ ## Example
142
+ [Concrete before/after or input/output]
143
+
144
+ ## Notes
145
+ [Edge cases, alternative approaches, when this does NOT apply]
146
+ ```
147
+
148
+ ### Description Optimization
149
+
150
+ The `description:` field in frontmatter is what triggers skill discovery. Write it to match how a user would describe their problem:
151
+
152
+ - **Include specific error messages or symptoms** — "Fix `Package biblatex Error: File 'references.bib' not found`"
153
+ - **Include context markers** — file types, tools, situations where this applies
154
+ - **Include negative cases** — "Not for general proofreading (use /proofread instead)"
155
+ - **Use natural trigger phrases** — the exact words a user would type
156
+
157
+ ### Extraction Checklist
158
+
159
+ During skill creation, mentally verify each point before finalising:
160
+
161
+ 1. **Trigger coverage** — would a user find this skill from 3 different phrasings of the same problem?
162
+ 2. **Self-contained** — can the skill be followed without reading other files (except `references/`)?
163
+ 3. **Anti-patterns present** — at least 2 "don't do this" entries to prevent common mistakes?
164
+ 4. **Verification step** — does the skill tell you how to confirm it worked?
165
+ 5. **Scope bounded** — is it clear what this skill does NOT do?
166
+
167
+ ### Writing Rules
168
+
169
+ - **Imperative form.** "Parse the input" not "You should parse the input."
170
+ - **Be specific about what NOT to do.** Anti-pattern lists are highly effective.
171
+ - **Include concrete examples.** Show expected input/output pairs.
172
+ - **Keep SKILL.md under 300 lines.** Move detail to `references/`.
173
+ - **Every instruction must be actionable.** No throat-clearing.
174
+ - **Use tables for structured data.** Faster to parse than prose.
175
+
176
+ ### Naming Conventions
177
+
178
+ - **Directory and name:** `kebab-case`, descriptive, 2-4 words
179
+ - **Avoid generic names:** `fix-bug` is bad; `fix-overleaf-sync-conflict` is good
180
+ - **Match the trigger:** If the natural trigger is "compile my slides", the name should relate to slide compilation
181
+
182
+ ### Allowed Tools
183
+
184
+ Follow principle of least privilege:
185
+
186
+ | Skill type | Tools |
187
+ |-----------|-------|
188
+ | Report-only | `Read`, `Glob`, `Grep` |
189
+ | File-creating | + `Write`, `Edit` |
190
+ | Shell-needing | + specific `Bash(command*)` patterns |
191
+ | Interactive | + `AskUserQuestion` |
192
+ | Delegating | + `Task` |
193
+
194
+ ## Phase 5: Validate
195
+
196
+ Run the validation script on the new skill:
197
+
198
+ ```bash
199
+ uv run python skills/learn/scripts/validate_skill.py skills/{name}
200
+ ```
201
+
202
+ Fix all errors. Address warnings to improve quality. Use `--strict` to promote warnings to errors.
203
+
204
+ The validator checks: frontmatter validity, name format and directory match, description quality, body length, broken links, referenced directories, and placeholder text.
205
+
206
+ ## Phase 6: Deploy and Confirm
207
+
208
+ 1. Copy the skill to the deployed location (rsync won't run until next session start):
209
+ ```bash
210
+ cp -r skills/{name} ~/.claude/skills/{name}
211
+ ```
212
+ 2. Check that `~/.claude/skills/{name}/SKILL.md` exists
213
+ 3. Tell the user: "Created `/{name}` — [one-line summary]. It's available immediately in all projects."
214
+ 4. If the skill is substantial, suggest updating `docs/skills.md` with the new entry
215
+
216
+ ## What This Skill Does NOT Do
217
+
218
+ - **Does not replace `[LEARN]` tags** — one-liner corrections still go in MEMORY.md via the `learn-tags` rule
219
+ - **Does not create agents** — agents need separate context and persistent memory
220
+ - **Does not modify existing skills** — if an existing skill needs updating, do that directly