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,141 @@
1
+ ---
2
+ name: code-archaeology
3
+ description: "Use when you need to review and understand old code, data, or analysis files."
4
+ allowed-tools: Bash(ls*), Bash(cp*), Bash(mkdir*), Bash(git*), Read, Write, Edit, Glob, Grep
5
+ argument-hint: [project-path]
6
+ ---
7
+
8
+ # Code Audit Skill
9
+
10
+ **CRITICAL RULE: Never delete data or code files.** Copy to legacy/, never move or delete originals.
11
+
12
+ > Systematically review and understand old code, data, and analysis files.
13
+
14
+ ## Purpose
15
+
16
+ Based on Scott Cunningham's workflow of reviving old projects - understanding what exists, documenting it, and making it safe to work with.
17
+
18
+ **For formal audits with cross-language replication and referee reports, use the Referee 2 agent (`.claude/agents/referee2-reviewer.md`).** This skill is for understanding and documenting existing code, not formal verification.
19
+
20
+ ## When to Use
21
+
22
+ - Returning to an old project after months/years
23
+ - Taking over code from a coauthor
24
+ - Before extending existing analysis
25
+ - R&R requiring you to revisit old work
26
+
27
+ ## When NOT to Use
28
+
29
+ - **Brand new projects** — use project-safety skill instead to set up structure
30
+ - **Formal code verification** — use the Referee 2 agent for cross-language replication
31
+ - **Quick code questions** — just ask directly, no need for full audit
32
+
33
+ ## Workflow
34
+
35
+ 1. **Explore the directory**:
36
+ - What files exist?
37
+ - What's the structure?
38
+ - When were things last modified?
39
+
40
+ 2. **Understand the pipeline**:
41
+ - What are the main scripts?
42
+ - What order do they run in?
43
+ - What data do they use?
44
+ - What outputs do they produce?
45
+
46
+ 3. **Document findings**:
47
+ - Create/update README.md
48
+ - Map data flows
49
+ - Note dependencies
50
+
51
+ 4. **Establish safety**:
52
+ - Create legacy/ folder
53
+ - Copy (don't move) originals
54
+ - Set up version control if not present
55
+
56
+ 5. **Create audit report**:
57
+ - What the code does
58
+ - Potential issues found
59
+ - Recommendations for cleanup
60
+
61
+ ## Safety Rules (from Scott Cunningham)
62
+
63
+ ```markdown
64
+ 1. Never delete data. Under no circumstances.
65
+ 2. Never delete programs. No do-files, no R scripts, nothing.
66
+ 3. Stay in this folder. Can go down, not up.
67
+ 4. Use a legacy folder. Move originals there for safekeeping.
68
+ 5. Copy, don't move. When reorganising, always copy from legacy.
69
+ ```
70
+
71
+ ## Prompt Template
72
+
73
+ ```
74
+ I'm returning to an old project after [TIME]. Please help me understand what's here.
75
+
76
+ 1. Explore the directory and tell me what you find
77
+ 2. Identify the main analysis scripts and their order
78
+ 3. Map the data pipeline (inputs → processing → outputs)
79
+ 4. Note any potential issues (missing files, unclear code, etc.)
80
+ 5. Create a README documenting everything
81
+
82
+ Before making ANY changes, create a legacy/ folder and copy everything there.
83
+ ```
84
+
85
+ ## Data Flow Mapping
86
+
87
+ Understand how data moves through the project:
88
+ - What raw data files exist?
89
+ - What cleaning/transformation scripts run?
90
+ - What intermediate files are created?
91
+ - What outputs are generated?
92
+
93
+ ## Compare Datasets (if multiple versions exist)
94
+
95
+ When you find multiple versions of the same data:
96
+ - Side-by-side comparison of key variables
97
+ - Identify where datasets diverge
98
+ - Visualize differences geographically/temporally
99
+ - Document which version to use going forward
100
+
101
+ ## Output Files
102
+
103
+ After a code audit, you should have:
104
+
105
+ ```
106
+ project/
107
+ ├── README.md ← Project overview (generated)
108
+ ├── AUDIT.md ← Audit findings and issues
109
+ ├── CLAUDE.md ← Safety rules for this project
110
+ ├── legacy/ ← Protected original files
111
+ ├── docs/
112
+ │ └── data_dictionary.md
113
+ └── output/
114
+ └── audit_deck.pdf ← Visual summary
115
+ ```
116
+
117
+ ## Questions to Answer
118
+
119
+ - [ ] What is the research question?
120
+ - [ ] What data is used?
121
+ - [ ] What is the identification strategy?
122
+ - [ ] What are the main results?
123
+ - [ ] Are results reproducible from the code?
124
+ - [ ] What assumptions are made?
125
+ - [ ] What are the known limitations?
126
+ - [ ] What would need to change to extend this?
127
+
128
+ ## Example Prompts
129
+
130
+ **Initial exploration:**
131
+ > "Read all the .do/.R/.py files in this project and create a summary of what each script does, including inputs and outputs."
132
+
133
+ **Data comparison:**
134
+ > "Compare dataset_v1.dta and dataset_v2.dta. Show me where they differ, with summary statistics and visualizations."
135
+
136
+ **Documentation:**
137
+ > "Create a README.md that documents this project's structure, data sources, and how to reproduce the main results."
138
+
139
+ ## Example Use
140
+
141
+ "Audit my Brexit replication project - I haven't touched it in 8 months. Tell me what's there, what state it's in, and what I need to do to pick it back up."
@@ -0,0 +1,265 @@
1
+ ---
2
+ name: code-review
3
+ description: "Use when you need a quality review of R or Python research scripts."
4
+ allowed-tools: Read, Glob, Grep
5
+ argument-hint: [script-path or project-path]
6
+ ---
7
+
8
+ # Research Code Review
9
+
10
+ **Report-only skill.** Never edit source files — produce `CODE-REVIEW-REPORT.md` only.
11
+
12
+ ## When to Use
13
+
14
+ - Before submitting a paper (check replication package quality)
15
+ - After writing analysis scripts and before sharing with coauthors
16
+ - When taking over someone else's research code
17
+ - As part of the Referee 2 agent's formal audit pipeline
18
+
19
+ ## When NOT to Use
20
+
21
+ - **Understanding old code** — use `/code-archaeology` first to map out what exists
22
+ - **Formal verification** — use the Referee 2 agent for cross-language replication
23
+ - **General software projects** — this is for research scripts, not applications
24
+
25
+ ## Workflow
26
+
27
+ 1. **Locate scripts**: Find all `.R`, `.py`, `.do`, `.jl` files in the project
28
+ 2. **Read each script** carefully
29
+ 3. **Score each category** (Pass / Fail / N/A)
30
+ 4. **Produce report**: Write `CODE-REVIEW-REPORT.md` in the project directory
31
+
32
+ ## 11 Review Categories
33
+
34
+ ### 1. Reproducibility
35
+
36
+ | Check | Pass Criteria |
37
+ |-------|--------------|
38
+ | Random seeds | `set.seed()` / `random.seed()` / `np.random.seed()` set before any stochastic operation |
39
+ | Relative paths | No hardcoded absolute paths (e.g., `/Users/username/...` or `C:\...`) |
40
+ | Working directory | Script does not `setwd()` / `os.chdir()` — uses project-relative paths |
41
+ | Session info | Script prints session info at end (`sessionInfo()` / `sys.version`) or documents environment |
42
+
43
+ ### 2. Script Structure
44
+
45
+ | Check | Pass Criteria |
46
+ |-------|--------------|
47
+ | Header | Script begins with comment block: purpose, author, date, inputs, outputs |
48
+ | Sections | Code organised into labelled sections (comments or `# ---- Section ----`) |
49
+ | Imports at top | All `library()` / `import` statements at the top of the file |
50
+ | Reasonable length | Single script < 500 lines; longer scripts should be split |
51
+
52
+ ### 3. Output Hygiene
53
+
54
+ | Check | Pass Criteria |
55
+ |-------|--------------|
56
+ | No print pollution | No stray `print()` / `cat()` / `message()` dumping to console |
57
+ | Outputs saved | Key results saved to files, not just printed |
58
+ | Clean console | Running the script does not produce walls of text |
59
+
60
+ ### 4. Function Quality
61
+
62
+ | Check | Pass Criteria |
63
+ |-------|--------------|
64
+ | Documentation | Functions have comments explaining purpose, inputs, outputs |
65
+ | Naming | Function names are descriptive verbs (`estimate_ate`, not `f1`) |
66
+ | Defaults | Reasonable defaults for optional parameters |
67
+ | No side effects | Functions don't modify global state |
68
+
69
+ ### 5. Domain Correctness
70
+
71
+ | Check | Pass Criteria |
72
+ |-------|--------------|
73
+ | Estimator matches paper | The estimator used matches what the paper claims |
74
+ | Weights | If weighted: weights sum to expected value, correct application |
75
+ | Standard errors | Clustering / HC / bootstrap matches paper specification |
76
+ | Sample restrictions | Filters match the paper's sample description |
77
+ | Variable construction | Variables constructed as described in the paper |
78
+
79
+ ### 6. Figure Quality
80
+
81
+ | Check | Pass Criteria |
82
+ |-------|--------------|
83
+ | Dimensions specified | Figure size set explicitly (not default) |
84
+ | Transparency/resolution | Appropriate for publication (300+ DPI for raster, vector preferred) |
85
+ | Saved to file | Figures saved with `ggsave()` / `plt.savefig()`, not just displayed |
86
+ | Labels | Axes labelled, legend present where needed, title informative |
87
+ | Colour | Colourblind-friendly palette; not relying on red/green distinction |
88
+
89
+ ### 7. Data Persistence
90
+
91
+ | Check | Pass Criteria |
92
+ |-------|--------------|
93
+ | Intermediate objects saved | Expensive computations saved (`saveRDS()` / `pickle.dump()` / `.parquet`) |
94
+ | Load before recompute | Script checks for saved objects before rerunning expensive operations |
95
+ | Output format | Final outputs in portable format (CSV, parquet — not just `.RData`) |
96
+
97
+ ### 8. Dependencies
98
+
99
+ | Check | Pass Criteria |
100
+ |-------|--------------|
101
+ | Declared at top | All `library()` / `import` at the start of the script |
102
+ | Versions documented | `renv.lock` / `requirements.txt` / `pyproject.toml` exists |
103
+ | No unnecessary packages | Each loaded package is actually used |
104
+ | Installation instructions | README or comment explains how to set up the environment |
105
+
106
+ ### 9. Python-Specific
107
+
108
+ *Score N/A if no Python files.*
109
+
110
+ | Check | Pass Criteria |
111
+ |-------|--------------|
112
+ | Type hints | Functions have type annotations for parameters and return values |
113
+ | Docstrings | Functions have docstrings (not just comments) |
114
+ | uv usage | Uses `uv` for environment management (per project conventions) |
115
+ | f-strings | Uses f-strings, not `.format()` or `%` formatting |
116
+
117
+ ### 10. R-Specific
118
+
119
+ *Score N/A if no R files.*
120
+
121
+ | Check | Pass Criteria |
122
+ |-------|--------------|
123
+ | tidyverse consistency | Doesn't mix base R and tidyverse for the same operation |
124
+ | Assignment operator | Uses `<-` not `=` for assignment |
125
+ | Boolean values | Uses `TRUE`/`FALSE`, not `T`/`F` |
126
+ | Pipe consistency | Uses one pipe style consistently (`%>%` or `|>`) |
127
+
128
+ ### 11. Cross-Language Verification
129
+
130
+ *Score N/A if the project has no numerical results or only uses one language.*
131
+
132
+ | Check | Pass Criteria |
133
+ |-------|--------------|
134
+ | Replication directory | `code/replication/` (or equivalent) exists with cross-language scripts |
135
+ | Two-language coverage | Key numerical results reproduced in a second language (e.g., R results verified in Python or vice versa) |
136
+ | Result comparison | Scripts compare outputs and report discrepancies (tolerance-based, not exact match) |
137
+ | Precision threshold | Numerical outputs compared to 6+ decimal places — discrepancies at lower precision indicate real bugs |
138
+ | Documentation | README or comments explain what is being replicated and acceptable tolerance |
139
+
140
+ #### Why Cross-Language Replication Works
141
+
142
+ Different languages produce different hallucination patterns when AI-assisted. An error in a Python implementation is unlikely to appear identically in R (or vice versa), making discrepancies easy to spot. This is the core insight from Scott Cunningham's Referee 2 protocol.
143
+
144
+ #### How to Set Up
145
+
146
+ 1. Create `code/replication/` with scripts that independently implement key numerical results in a second language
147
+ 2. Write a comparison script that loads outputs from both languages and reports discrepancies at 6+ decimal places
148
+ 3. Document what is being replicated, which results are covered, and the acceptable tolerance (e.g., 1e-6 for coefficients, 1e-4 for standard errors)
149
+
150
+ ## Confidence Filtering
151
+
152
+ - Only report issues where you are >80% confident they are genuine problems
153
+ - Consolidate similar findings (e.g., 5 instances of the same naming issue = 1 finding with count)
154
+ - For borderline cases, note uncertainty: "Possible issue (medium confidence): ..."
155
+ - Never pad the report with low-confidence observations to appear thorough
156
+
157
+ ## Scorecard
158
+
159
+ | # | Category | Result | Notes |
160
+ |---|----------|--------|-------|
161
+ | 1 | Reproducibility | Pass/Fail | |
162
+ | 2 | Script structure | Pass/Fail | |
163
+ | 3 | Output hygiene | Pass/Fail | |
164
+ | 4 | Function quality | Pass/Fail | |
165
+ | 5 | Domain correctness | Pass/Fail | |
166
+ | 6 | Figure quality | Pass/Fail | |
167
+ | 7 | Data persistence | Pass/Fail | |
168
+ | 8 | Dependencies | Pass/Fail | |
169
+ | 9 | Python-specific | Pass/Fail/N/A | |
170
+ | 10 | R-specific | Pass/Fail/N/A | |
171
+ | 11 | Cross-language verification | Pass/Fail/N/A | |
172
+
173
+ **Overall: X/11 Pass** (adjust denominator for N/A categories)
174
+
175
+ ## Quality Scoring
176
+
177
+ Apply numeric quality scoring using the shared framework and skill-specific rubric:
178
+
179
+ - **Framework:** [`../shared/quality-scoring.md`](../shared/quality-scoring.md) — severity tiers, thresholds, verdict rules
180
+ - **Rubric:** [`references/quality-rubric.md`](references/quality-rubric.md) — issue-to-deduction mappings for this skill
181
+
182
+ Start at 100, deduct per issue found, apply verdict. Insert the Score Block into the report after the scorecard.
183
+
184
+ ## Report Format
185
+
186
+ ```markdown
187
+ # Code Review Report
188
+
189
+ **Project:** [path]
190
+ **Date:** YYYY-MM-DD
191
+ **Scripts reviewed:** [list]
192
+ **Languages:** R / Python / Both
193
+
194
+ ## Scorecard
195
+
196
+ [Table above, filled in]
197
+
198
+ ## Detailed Findings
199
+
200
+ ### Category 1: Reproducibility
201
+ **Result: Pass/Fail**
202
+
203
+ [Specific findings with file:line references]
204
+
205
+ ### Category 2: Script Structure
206
+ ...
207
+
208
+ [Continue for all 11 categories]
209
+
210
+ ## Priority Fixes
211
+
212
+ 1. [Most important issue — what to fix first]
213
+ 2. [Second most important]
214
+ 3. [Third]
215
+
216
+ ## Quality Score
217
+
218
+ | Metric | Value |
219
+ |--------|-------|
220
+ | **Score** | XX / 100 |
221
+ | **Verdict** | Ship / Ship with notes / Revise / Revise (major) / Blocked |
222
+
223
+ ### Deductions
224
+
225
+ | # | Issue | Tier | Deduction | Category |
226
+ |---|-------|------|-----------|----------|
227
+ | 1 | [description] | [tier] | -X | [category] |
228
+ | | **Total deductions** | | **-XX** | |
229
+
230
+ ## Positive Observations
231
+
232
+ [Things done well — important for morale and learning]
233
+ ```
234
+
235
+ ## Council Mode (Optional)
236
+
237
+ For complex codebases or high-stakes replication packages, run the code review across multiple LLM providers. Different models have different strengths: some excel at spotting statistical errors, others at code structure or reproducibility issues.
238
+
239
+ **Trigger:** "Council code review" or "thorough code review"
240
+
241
+ **How it works:**
242
+ 1. Each model independently scores all 11 categories against the same scripts
243
+ 2. Cross-review: models evaluate each other's findings — catching false positives and missed issues
244
+ 3. Chairman synthesis: produces a single `CODE-REVIEW-REPORT.md` with the union of confirmed findings
245
+
246
+ **Invocation (CLI backend):**
247
+ ```bash
248
+ cd packages/cli-council
249
+ uv run python -m cli_council \
250
+ --prompt-file /tmp/code-review-prompt.txt \
251
+ --context-file /tmp/scripts-content.txt \
252
+ --output-md /tmp/code-review-council.md \
253
+ --chairman claude \
254
+ --timeout 180
255
+ ```
256
+
257
+ See `skills/shared/council-protocol.md` for the full orchestration protocol.
258
+
259
+ **Value:** Moderate to high — most valuable for domain correctness (Category 5) and cross-language verification (Category 11), where different models may catch different statistical or logical errors.
260
+
261
+ ## Cross-References
262
+
263
+ - **`/code-archaeology`** — For understanding unfamiliar code before reviewing it
264
+ - **Referee 2 agent** — For formal cross-language replication and verification (Category 11 flags the absence; Referee 2 does the actual replication)
265
+ - **`/proofread`** — For the paper that accompanies this code
@@ -0,0 +1,67 @@
1
+ # Quality Rubric: Code Review
2
+
3
+ > Scoring rubric for `/code-review`. 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
+ | Syntax error preventing script from running | -100 | Script is broken |
12
+ | Missing critical dependency with no install instructions | -100 | Cannot reproduce without guessing |
13
+
14
+ ### Critical (-15 to -25)
15
+
16
+ | Issue | Deduction | Notes |
17
+ |-------|-----------|-------|
18
+ | Numerical project missing cross-language replication scripts | -20 | Once per project — no independent verification of results |
19
+ | Hardcoded absolute path (`/Users/...`, `C:\...`) | -20 | Per unique path — breaks on any other machine |
20
+ | Domain correctness bug (wrong estimator, wrong sample restriction) | -20 | Per instance — produces wrong results |
21
+ | No random seed before stochastic operation | -15 | Per stochastic block — results not reproducible |
22
+ | `setwd()` / `os.chdir()` in script | -15 | Breaks portability |
23
+ | Weights applied incorrectly or not summing to expected value | -15 | Domain error |
24
+ | Standard errors don't match paper specification | -15 | Domain error |
25
+
26
+ ### Major (-5 to -14)
27
+
28
+ | Issue | Deduction | Notes |
29
+ |-------|-----------|-------|
30
+ | No script header (purpose, author, date, I/O) | -10 | Per script |
31
+ | No environment documentation (renv.lock, requirements.txt) | -10 | Once per project |
32
+ | Expensive computation not cached | -8 | Per operation |
33
+ | Function without documentation | -5 | Per function |
34
+ | Stray print/cat pollution | -5 | Per script with pollution |
35
+ | Script > 500 lines without splits | -5 | Per script |
36
+ | Loaded but unused package | -5 | Per package |
37
+ | Figures not saved to file (only displayed) | -5 | Per figure |
38
+
39
+ ### Minor (-1 to -4)
40
+
41
+ | Issue | Deduction | Notes |
42
+ |-------|-----------|-------|
43
+ | Non-descriptive function name (`f1`, `do_stuff`) | -3 | Per function |
44
+ | Missing type hints (Python) | -3 | Once per script, not per function |
45
+ | `=` instead of `<-` for assignment (R) | -2 | Once for the pattern |
46
+ | Mixed pipe styles (`%>%` and `|>`) | -2 | Once for the pattern |
47
+ | `T`/`F` instead of `TRUE`/`FALSE` (R) | -2 | Once for the pattern |
48
+ | Default figure dimensions (not explicitly set) | -2 | Per figure |
49
+ | Non-colourblind-friendly palette | -2 | Per figure |
50
+ | Final output in non-portable format (`.RData` only) | -3 | Per output |
51
+ | Missing session info at end of script | -1 | Per script |
52
+
53
+ ## Category Mapping
54
+
55
+ | Rubric category | SKILL.md check category |
56
+ |----------------|------------------------|
57
+ | Reproducibility | Category 1 |
58
+ | Script structure | Category 2 |
59
+ | Output hygiene | Category 3 |
60
+ | Function quality | Category 4 |
61
+ | Domain correctness | Category 5 |
62
+ | Figure quality | Category 6 |
63
+ | Data persistence | Category 7 |
64
+ | Dependencies | Category 8 |
65
+ | Python-specific | Category 9 |
66
+ | R-specific | Category 10 |
67
+ | Cross-language verification | Category 11 |
@@ -0,0 +1,208 @@
1
+ ---
2
+ name: consolidate-memory
3
+ description: "Use when you need to prune duplicates and merge overlapping entries in MEMORY.md files."
4
+ allowed-tools: Read, Write, Edit, Glob, Grep, AskUserQuestion
5
+ argument-hint: "[project-path or 'all' for global consolidation]"
6
+ ---
7
+
8
+ # Consolidate Memory
9
+
10
+ Periodic refinement of `MEMORY.md` files across projects. Prunes redundant entries, merges overlapping knowledge, generates higher-order abstractions from accumulated patterns, and removes stale or superseded entries.
11
+
12
+ Inspired by npcsh's knowledge graph sleep/dream cycles — memory consolidation applied to research project knowledge.
13
+
14
+ ## When to Use
15
+
16
+ - Monthly maintenance (pair with `/system-audit`)
17
+ - When a `MEMORY.md` exceeds 100 entries
18
+ - After completing a major project milestone (e.g., paper submission)
19
+ - When starting a new session and `MEMORY.md` feels cluttered
20
+ - When the same correction keeps appearing across multiple projects
21
+
22
+ ## When NOT to Use
23
+
24
+ - During active work sessions — consolidation is a maintenance task
25
+ - When `MEMORY.md` has fewer than 10 entries — not enough to consolidate
26
+ - Immediately after recording `[LEARN]` tags — let knowledge accumulate first
27
+
28
+ ## Modes
29
+
30
+ Ask the user which mode to run:
31
+
32
+ | Mode | Scope | What it does |
33
+ |------|-------|-------------|
34
+ | **Project** (default) | Single project's `MEMORY.md` + `.claude/state/personal-memory.md` | Consolidate both tiers |
35
+ | **Global** | All `MEMORY.md` + personal-memory files across projects + Task Management | Consolidate all, cross-pollinate shared patterns |
36
+
37
+ ## Workflow
38
+
39
+ ### Phase 1: Sleep (Consolidation)
40
+
41
+ Read the target `MEMORY.md` file(s) and `.claude/state/personal-memory.md` (if it exists) and perform:
42
+
43
+ #### 1.1 Duplicate Detection
44
+
45
+ Find entries that say the same thing in different words.
46
+
47
+ **Signals:**
48
+ - Same correction direction (wrong → right) with different phrasing
49
+ - Same file/variable referenced in multiple entries
50
+ - Entries from different dates that record the same learning
51
+
52
+ **Action:** Merge into a single entry, keeping the most precise wording. Note the merge in a comment: `<!-- merged from 2 entries -->`.
53
+
54
+ #### 1.2 Contradiction Resolution
55
+
56
+ Find entries that contradict each other (e.g., "use X" in one entry, "don't use X" in another).
57
+
58
+ **Signals:**
59
+ - Opposite correction directions for the same variable/convention
60
+ - Entries where a later one supersedes an earlier one
61
+
62
+ **Action:** Keep the most recent/correct entry. Flag contradictions for user review if the resolution isn't obvious.
63
+
64
+ #### 1.3 Staleness Detection
65
+
66
+ Find entries that are no longer relevant.
67
+
68
+ **Signals:**
69
+ - References to files, variables, or conventions that no longer exist in the project
70
+ - Entries about bugs that have been fixed
71
+ - Entries about tools or APIs that have changed
72
+ - Entries marked with dates older than 6 months with no recent reinforcement
73
+
74
+ **Action:** Mark as `[STALE?]` and present to user for confirmation before removing. Never auto-delete.
75
+
76
+ #### 1.4 Tier Routing Check
77
+
78
+ Check whether entries are in the correct tier (see `learn-tags` rule for the two-tier system).
79
+
80
+ **Promotion candidates** (personal-memory → MEMORY.md):
81
+ - Entries in `.claude/state/personal-memory.md` that would help a collaborator on a different machine
82
+ - Local workarounds that turned out to be general conventions
83
+ - Tool quirks that apply to all machines (not just this one)
84
+
85
+ **Demotion candidates** (MEMORY.md → personal-memory):
86
+ - Entries in `MEMORY.md` that reference local paths, machine-specific tool versions, or environment quirks
87
+ - Workarounds that only apply to this specific setup
88
+
89
+ **Action:** Present promotion/demotion suggestions to the user. Move entries only after explicit approval.
90
+
91
+ #### 1.5 Strengthening
92
+
93
+ Entries that have been independently confirmed multiple times are high-confidence knowledge.
94
+
95
+ **Signals:**
96
+ - Same pattern recorded from different sessions
97
+ - Corrections reinforced by compilation errors or test failures
98
+ - Conventions confirmed by supervisor feedback
99
+
100
+ **Action:** Move to the top of their section. Add `[CONFIRMED]` marker if supported by 3+ independent occurrences.
101
+
102
+ ### Phase 2: Dream (Abstraction)
103
+
104
+ Generate higher-order patterns from the accumulated entries.
105
+
106
+ #### 2.1 Cross-Entry Patterns
107
+
108
+ Look for patterns that span multiple entries:
109
+
110
+ - "Every time we work with X, we hit Y" → Record as a general rule
111
+ - "We always use convention A for project type B" → Record as a convention
112
+ - "Corrections in category C cluster around the same mistake" → Record the root cause
113
+
114
+ #### 2.2 Cross-Project Patterns (Global mode only)
115
+
116
+ When consolidating across all projects, look for knowledge that applies everywhere:
117
+
118
+ - Notation conventions used consistently across 3+ projects → Promote to global MEMORY.md
119
+ - The same code pitfall appearing in multiple projects → Record once with cross-references
120
+ - Citation corrections that apply to shared bibliography entries → Consolidate
121
+
122
+ #### 2.3 Abstraction Generation
123
+
124
+ For each pattern found, generate an abstraction:
125
+
126
+ ```markdown
127
+ ## Abstraction: [Name]
128
+
129
+ **Pattern:** [What keeps happening]
130
+ **Root cause:** [Why it happens]
131
+ **Prevention:** [How to avoid it in future]
132
+ **Evidence:** [Which entries support this]
133
+ ```
134
+
135
+ Present abstractions to the user. Only write the ones they approve.
136
+
137
+ ### Phase 3: Write
138
+
139
+ #### 3.1 Restructure
140
+
141
+ Rewrite `MEMORY.md` with:
142
+ 1. **Abstractions** at the top (new section: `## Patterns`)
143
+ 2. **Confirmed entries** next (high-confidence knowledge)
144
+ 3. **Regular entries** in their standard sections (Notation Registry, Citations, Key Decisions, Anti-Patterns, Code Pitfalls)
145
+ 4. **Stale entries removed** (only those confirmed by user)
146
+
147
+ If `.claude/state/personal-memory.md` exists, also rewrite it with consolidated machine-specific entries. Apply any user-approved promotions (move to MEMORY.md) and demotions (move from MEMORY.md to personal-memory).
148
+
149
+ #### 3.2 Diff Report
150
+
151
+ Before writing, show a summary:
152
+
153
+ ```markdown
154
+ ## Consolidation Summary
155
+
156
+ | Action | Count |
157
+ |--------|-------|
158
+ | Duplicates merged | X |
159
+ | Contradictions resolved | X |
160
+ | Stale entries flagged | X |
161
+ | Stale entries removed | X (user-confirmed) |
162
+ | Entries strengthened | X |
163
+ | Abstractions generated | X |
164
+ | Tier promotions (personal → generic) | X |
165
+ | Tier demotions (generic → personal) | X |
166
+ | Cross-project promotions | X (global mode) |
167
+
168
+ ### Entries Before: XX
169
+ ### Entries After: YY
170
+ ### Net reduction: ZZ
171
+ ```
172
+
173
+ #### 3.3 Confirmation
174
+
175
+ **Always show the full proposed MEMORY.md before writing.** Wait for explicit approval. The user may want to keep entries flagged as stale, adjust abstractions, or revert merges.
176
+
177
+ ## MEMORY.md Sections (Reference)
178
+
179
+ Standard sections from the `learn-tags` rule:
180
+
181
+ | Section | Columns |
182
+ |---------|---------|
183
+ | **Patterns** | Pattern / Root cause / Prevention / Evidence (NEW — added by this skill) |
184
+ | **Notation Registry** | Variable / Convention / Anti-pattern |
185
+ | **Estimand Registry** | What we estimate / Identification / Key assumptions |
186
+ | **Citations** | One-liner corrections |
187
+ | **Key Decisions** | Decision / Rationale / Date |
188
+ | **Anti-Patterns** | What went wrong / Correction |
189
+ | **Code Pitfalls** | Bug / Impact / Fix |
190
+
191
+ ## Global MEMORY.md Location
192
+
193
+ The Task Management MEMORY.md at the project root:
194
+ ```
195
+ $TM/MEMORY.md
196
+ ```
197
+
198
+ Also check the auto-memory directory (path varies by machine — glob for it):
199
+ ```
200
+ ~/.claude/projects/-Users-user-*Task-Management/memory/MEMORY.md
201
+ ```
202
+
203
+ ## Cross-References
204
+
205
+ - **`/system-audit`** — Run consolidation as part of periodic maintenance
206
+ - **`/learn`** — Creates the entries that this skill consolidates
207
+ - **`[LEARN]` tags** (rule) — The tagging system that feeds MEMORY.md
208
+ - **`/general-session-recap`** — May surface entries worth recording before consolidation