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.
- package/.claude/agents/domain-reviewer.md +336 -0
- package/.claude/agents/fixer.md +226 -0
- package/.claude/agents/paper-critic.md +370 -0
- package/.claude/agents/peer-reviewer.md +289 -0
- package/.claude/agents/proposal-reviewer.md +215 -0
- package/.claude/agents/referee2-reviewer.md +367 -0
- package/.claude/agents/references/journal-referee-profiles.md +354 -0
- package/.claude/agents/references/paper-critic/council-personas.md +77 -0
- package/.claude/agents/references/paper-critic/council-prompts.md +198 -0
- package/.claude/agents/references/peer-reviewer/report-template.md +199 -0
- package/.claude/agents/references/peer-reviewer/sa-prompts.md +260 -0
- package/.claude/agents/references/peer-reviewer/security-scan.md +188 -0
- package/.claude/agents/references/proposal-reviewer/report-template.md +144 -0
- package/.claude/agents/references/proposal-reviewer/sa-prompts.md +149 -0
- package/.claude/agents/references/referee-config.md +114 -0
- package/.claude/agents/references/referee2-reviewer/audit-checklists.md +287 -0
- package/.claude/agents/references/referee2-reviewer/report-template.md +334 -0
- package/.claude/rules/design-before-results.md +52 -0
- package/.claude/rules/ignore-agents-md.md +17 -0
- package/.claude/rules/ignore-gemini-md.md +17 -0
- package/.claude/rules/lean-claude-md.md +45 -0
- package/.claude/rules/learn-tags.md +99 -0
- package/.claude/rules/overleaf-separation.md +67 -0
- package/.claude/rules/plan-first.md +175 -0
- package/.claude/rules/read-docs-first.md +50 -0
- package/.claude/rules/scope-discipline.md +28 -0
- package/.claude/settings.json +125 -0
- package/.context/current-focus.md +33 -0
- package/.context/preferences/priorities.md +36 -0
- package/.context/preferences/task-naming.md +28 -0
- package/.context/profile.md +29 -0
- package/.context/projects/_index.md +41 -0
- package/.context/projects/papers/nudge-exp.md +22 -0
- package/.context/projects/papers/uncertainty.md +31 -0
- package/.context/resources/claude-scientific-writer-review.md +48 -0
- package/.context/resources/cunningham-multi-analyst-agents.md +104 -0
- package/.context/resources/cunningham-multilang-code-audit.md +62 -0
- package/.context/resources/google-ai-co-scientist-review.md +72 -0
- package/.context/resources/karpathy-llm-council-review.md +58 -0
- package/.context/resources/multi-coder-reliability-protocol.md +175 -0
- package/.context/resources/pedro-santanna-takeaways.md +96 -0
- package/.context/resources/venue-rankings/abs_ajg_2024.csv +1823 -0
- package/.context/resources/venue-rankings/abs_ajg_2024_econ.csv +356 -0
- package/.context/resources/venue-rankings/cabs_4_4star_theory.csv +40 -0
- package/.context/resources/venue-rankings/core_2026.csv +801 -0
- package/.context/resources/venue-rankings.md +147 -0
- package/.context/workflows/README.md +69 -0
- package/.context/workflows/daily-review.md +91 -0
- package/.context/workflows/meeting-actions.md +108 -0
- package/.context/workflows/replication-protocol.md +155 -0
- package/.context/workflows/weekly-review.md +113 -0
- package/.mcp-server-biblio/formatters.py +158 -0
- package/.mcp-server-biblio/pyproject.toml +11 -0
- package/.mcp-server-biblio/server.py +678 -0
- package/.mcp-server-biblio/sources/__init__.py +14 -0
- package/.mcp-server-biblio/sources/base.py +73 -0
- package/.mcp-server-biblio/sources/formatters.py +83 -0
- package/.mcp-server-biblio/sources/models.py +22 -0
- package/.mcp-server-biblio/sources/multi_source.py +243 -0
- package/.mcp-server-biblio/sources/openalex_source.py +183 -0
- package/.mcp-server-biblio/sources/scopus_source.py +309 -0
- package/.mcp-server-biblio/sources/wos_source.py +508 -0
- package/.mcp-server-biblio/uv.lock +896 -0
- package/.scripts/README.md +161 -0
- package/.scripts/ai_pattern_density.py +446 -0
- package/.scripts/conf +445 -0
- package/.scripts/config.py +122 -0
- package/.scripts/count_inventory.py +275 -0
- package/.scripts/daily_digest.py +288 -0
- package/.scripts/done +177 -0
- package/.scripts/extract_meeting_actions.py +223 -0
- package/.scripts/focus +176 -0
- package/.scripts/generate-codex-agents-md.py +217 -0
- package/.scripts/inbox +194 -0
- package/.scripts/notion_helpers.py +325 -0
- package/.scripts/openalex/query_helpers.py +306 -0
- package/.scripts/papers +227 -0
- package/.scripts/query +223 -0
- package/.scripts/session-history.py +201 -0
- package/.scripts/skill-health.py +516 -0
- package/.scripts/skill-log-miner.py +273 -0
- package/.scripts/sync-to-codex.sh +252 -0
- package/.scripts/task +213 -0
- package/.scripts/tasks +190 -0
- package/.scripts/week +206 -0
- package/CLAUDE.md +197 -0
- package/LICENSE +21 -0
- package/MEMORY.md +38 -0
- package/README.md +269 -0
- package/docs/agents.md +44 -0
- package/docs/bibliography-setup.md +55 -0
- package/docs/council-mode.md +36 -0
- package/docs/getting-started.md +245 -0
- package/docs/hooks.md +38 -0
- package/docs/mcp-servers.md +82 -0
- package/docs/notion-setup.md +109 -0
- package/docs/rules.md +33 -0
- package/docs/scripts.md +303 -0
- package/docs/setup-overview/setup-overview.pdf +0 -0
- package/docs/skills.md +70 -0
- package/docs/system.md +159 -0
- package/hooks/block-destructive-git.sh +66 -0
- package/hooks/context-monitor.py +114 -0
- package/hooks/postcompact-restore.py +157 -0
- package/hooks/precompact-autosave.py +181 -0
- package/hooks/promise-checker.sh +124 -0
- package/hooks/protect-source-files.sh +81 -0
- package/hooks/resume-context-loader.sh +53 -0
- package/hooks/startup-context-loader.sh +102 -0
- package/package.json +51 -0
- package/packages/cli-council/.github/workflows/claude-code-review.yml +44 -0
- package/packages/cli-council/.github/workflows/claude.yml +50 -0
- package/packages/cli-council/README.md +100 -0
- package/packages/cli-council/pyproject.toml +43 -0
- package/packages/cli-council/src/cli_council/__init__.py +19 -0
- package/packages/cli-council/src/cli_council/__main__.py +185 -0
- package/packages/cli-council/src/cli_council/backends/__init__.py +8 -0
- package/packages/cli-council/src/cli_council/backends/base.py +81 -0
- package/packages/cli-council/src/cli_council/backends/claude.py +25 -0
- package/packages/cli-council/src/cli_council/backends/codex.py +27 -0
- package/packages/cli-council/src/cli_council/backends/gemini.py +26 -0
- package/packages/cli-council/src/cli_council/checkpoint.py +212 -0
- package/packages/cli-council/src/cli_council/config.py +51 -0
- package/packages/cli-council/src/cli_council/council.py +391 -0
- package/packages/cli-council/src/cli_council/models.py +46 -0
- package/packages/llm-council/.github/workflows/claude-code-review.yml +44 -0
- package/packages/llm-council/.github/workflows/claude.yml +50 -0
- package/packages/llm-council/README.md +453 -0
- package/packages/llm-council/pyproject.toml +42 -0
- package/packages/llm-council/src/llm_council/__init__.py +23 -0
- package/packages/llm-council/src/llm_council/__main__.py +259 -0
- package/packages/llm-council/src/llm_council/checkpoint.py +193 -0
- package/packages/llm-council/src/llm_council/client.py +253 -0
- package/packages/llm-council/src/llm_council/config.py +232 -0
- package/packages/llm-council/src/llm_council/council.py +482 -0
- package/packages/llm-council/src/llm_council/models.py +46 -0
- package/packages/mcp-bibliography/MEMORY.md +31 -0
- package/packages/mcp-bibliography/_app.py +226 -0
- package/packages/mcp-bibliography/formatters.py +158 -0
- package/packages/mcp-bibliography/log/2026-03-13-2100.md +35 -0
- package/packages/mcp-bibliography/pyproject.toml +15 -0
- package/packages/mcp-bibliography/run.sh +20 -0
- package/packages/mcp-bibliography/scholarly_formatters.py +83 -0
- package/packages/mcp-bibliography/server.py +1857 -0
- package/packages/mcp-bibliography/tools/__init__.py +28 -0
- package/packages/mcp-bibliography/tools/_registry.py +19 -0
- package/packages/mcp-bibliography/tools/altmetric.py +107 -0
- package/packages/mcp-bibliography/tools/core.py +92 -0
- package/packages/mcp-bibliography/tools/dblp.py +52 -0
- package/packages/mcp-bibliography/tools/openalex.py +296 -0
- package/packages/mcp-bibliography/tools/opencitations.py +102 -0
- package/packages/mcp-bibliography/tools/openreview.py +179 -0
- package/packages/mcp-bibliography/tools/orcid.py +131 -0
- package/packages/mcp-bibliography/tools/scholarly.py +575 -0
- package/packages/mcp-bibliography/tools/unpaywall.py +63 -0
- package/packages/mcp-bibliography/tools/zenodo.py +123 -0
- package/packages/mcp-bibliography/uv.lock +711 -0
- package/scripts/setup.sh +143 -0
- package/skills/beamer-deck/SKILL.md +199 -0
- package/skills/beamer-deck/references/quality-rubric.md +54 -0
- package/skills/beamer-deck/references/review-prompts.md +106 -0
- package/skills/bib-validate/SKILL.md +261 -0
- package/skills/bib-validate/references/council-mode.md +34 -0
- package/skills/bib-validate/references/deep-verify.md +79 -0
- package/skills/bib-validate/references/fix-mode.md +36 -0
- package/skills/bib-validate/references/openalex-verification.md +45 -0
- package/skills/bib-validate/references/preprint-check.md +31 -0
- package/skills/bib-validate/references/ref-manager-crossref.md +41 -0
- package/skills/bib-validate/references/report-template.md +82 -0
- package/skills/code-archaeology/SKILL.md +141 -0
- package/skills/code-review/SKILL.md +265 -0
- package/skills/code-review/references/quality-rubric.md +67 -0
- package/skills/consolidate-memory/SKILL.md +208 -0
- package/skills/context-status/SKILL.md +126 -0
- package/skills/creation-guard/SKILL.md +230 -0
- package/skills/devils-advocate/SKILL.md +130 -0
- package/skills/devils-advocate/references/competing-hypotheses.md +83 -0
- package/skills/init-project/SKILL.md +115 -0
- package/skills/init-project-course/references/memory-and-settings.md +92 -0
- package/skills/init-project-course/references/organise-templates.md +94 -0
- package/skills/init-project-course/skill.md +147 -0
- package/skills/init-project-light/skill.md +139 -0
- package/skills/init-project-research/SKILL.md +368 -0
- package/skills/init-project-research/references/atlas-pipeline-sync.md +70 -0
- package/skills/init-project-research/references/atlas-schema.md +81 -0
- package/skills/init-project-research/references/confirmation-report.md +39 -0
- package/skills/init-project-research/references/domain-profile-template.md +104 -0
- package/skills/init-project-research/references/interview-round3.md +34 -0
- package/skills/init-project-research/references/literature-discovery.md +43 -0
- package/skills/init-project-research/references/scaffold-details.md +197 -0
- package/skills/init-project-research/templates/field-calibration.md +60 -0
- package/skills/init-project-research/templates/pipeline-manifest.md +63 -0
- package/skills/init-project-research/templates/run-all.sh +116 -0
- package/skills/init-project-research/templates/seed-files.md +337 -0
- package/skills/insights-deck/SKILL.md +151 -0
- package/skills/interview-me/SKILL.md +157 -0
- package/skills/latex/SKILL.md +141 -0
- package/skills/latex/references/latex-configs.md +183 -0
- package/skills/latex-autofix/SKILL.md +230 -0
- package/skills/latex-autofix/references/known-errors.md +183 -0
- package/skills/latex-autofix/references/quality-rubric.md +50 -0
- package/skills/latex-health-check/SKILL.md +161 -0
- package/skills/learn/SKILL.md +220 -0
- package/skills/learn/scripts/validate_skill.py +265 -0
- package/skills/lessons-learned/SKILL.md +201 -0
- package/skills/literature/SKILL.md +335 -0
- package/skills/literature/references/agent-templates.md +393 -0
- package/skills/literature/references/bibliometric-apis.md +44 -0
- package/skills/literature/references/cli-council-search.md +79 -0
- package/skills/literature/references/openalex-api-guide.md +371 -0
- package/skills/literature/references/openalex-common-queries.md +381 -0
- package/skills/literature/references/openalex-workflows.md +248 -0
- package/skills/literature/references/reference-manager-sync.md +36 -0
- package/skills/literature/references/scopus-api-guide.md +208 -0
- package/skills/literature/references/wos-api-guide.md +308 -0
- package/skills/multi-perspective/SKILL.md +311 -0
- package/skills/multi-perspective/references/computational-many-analysts.md +77 -0
- package/skills/pipeline-manifest/SKILL.md +226 -0
- package/skills/pre-submission-report/SKILL.md +153 -0
- package/skills/process-reviews/SKILL.md +244 -0
- package/skills/process-reviews/references/rr-routing.md +101 -0
- package/skills/project-deck/SKILL.md +87 -0
- package/skills/project-safety/SKILL.md +135 -0
- package/skills/proofread/SKILL.md +254 -0
- package/skills/proofread/references/quality-rubric.md +104 -0
- package/skills/python-env/SKILL.md +57 -0
- package/skills/quarto-deck/SKILL.md +226 -0
- package/skills/quarto-deck/references/markdown-format.md +143 -0
- package/skills/quarto-deck/references/quality-rubric.md +54 -0
- package/skills/save-context/SKILL.md +174 -0
- package/skills/session-log/SKILL.md +98 -0
- package/skills/shared/concept-validation-gate.md +161 -0
- package/skills/shared/council-protocol.md +265 -0
- package/skills/shared/distribution-diagnostics.md +164 -0
- package/skills/shared/engagement-stratified-sampling.md +218 -0
- package/skills/shared/escalation-protocol.md +74 -0
- package/skills/shared/external-audit-protocol.md +205 -0
- package/skills/shared/intercoder-reliability.md +256 -0
- package/skills/shared/mcp-degradation.md +81 -0
- package/skills/shared/method-probing-questions.md +163 -0
- package/skills/shared/multi-language-conventions.md +143 -0
- package/skills/shared/paid-api-safety.md +174 -0
- package/skills/shared/palettes.md +90 -0
- package/skills/shared/progressive-disclosure.md +92 -0
- package/skills/shared/project-documentation-content.md +443 -0
- package/skills/shared/project-documentation-format.md +281 -0
- package/skills/shared/project-documentation.md +100 -0
- package/skills/shared/publication-output.md +138 -0
- package/skills/shared/quality-scoring.md +70 -0
- package/skills/shared/reference-resolution.md +77 -0
- package/skills/shared/research-quality-rubric.md +165 -0
- package/skills/shared/rhetoric-principles.md +54 -0
- package/skills/shared/skill-design-patterns.md +272 -0
- package/skills/shared/skill-index.md +240 -0
- package/skills/shared/system-documentation.md +334 -0
- package/skills/shared/tikz-rules.md +402 -0
- package/skills/shared/validation-tiers.md +121 -0
- package/skills/shared/venue-guides/README.md +46 -0
- package/skills/shared/venue-guides/cell_press_style.md +483 -0
- package/skills/shared/venue-guides/conferences_formatting.md +564 -0
- package/skills/shared/venue-guides/cs_conference_style.md +463 -0
- package/skills/shared/venue-guides/examples/cell_summary_example.md +247 -0
- package/skills/shared/venue-guides/examples/medical_structured_abstract.md +313 -0
- package/skills/shared/venue-guides/examples/nature_abstract_examples.md +213 -0
- package/skills/shared/venue-guides/examples/neurips_introduction_example.md +245 -0
- package/skills/shared/venue-guides/journals_formatting.md +486 -0
- package/skills/shared/venue-guides/medical_journal_styles.md +535 -0
- package/skills/shared/venue-guides/ml_conference_style.md +556 -0
- package/skills/shared/venue-guides/nature_science_style.md +405 -0
- package/skills/shared/venue-guides/reviewer_expectations.md +417 -0
- package/skills/shared/venue-guides/venue_writing_styles.md +321 -0
- package/skills/split-pdf/SKILL.md +172 -0
- package/skills/split-pdf/methodology.md +48 -0
- package/skills/sync-notion/SKILL.md +93 -0
- package/skills/system-audit/SKILL.md +157 -0
- package/skills/system-audit/references/sub-agent-prompts.md +294 -0
- package/skills/task-management/SKILL.md +131 -0
- package/skills/update-focus/SKILL.md +204 -0
- package/skills/update-project-doc/SKILL.md +194 -0
- package/skills/validate-bib/SKILL.md +242 -0
- package/skills/validate-bib/references/council-mode.md +34 -0
- package/skills/validate-bib/references/deep-verify.md +71 -0
- package/skills/validate-bib/references/openalex-verification.md +45 -0
- package/skills/validate-bib/references/preprint-check.md +31 -0
- package/skills/validate-bib/references/report-template.md +62 -0
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
# Engagement-Stratified Sampling
|
|
2
|
+
|
|
3
|
+
> Shared reference for social media and digital trace research. Ensures representative sampling across the engagement distribution. Prevents viral-content bias. Adapted from CommDAAF (Xu 2026).
|
|
4
|
+
|
|
5
|
+
## Principle
|
|
6
|
+
|
|
7
|
+
**Convenience samples over-represent viral content.** Most social media datasets are skewed — a small fraction of posts drive most engagement. Sampling without stratification produces findings that describe viral content, not typical content. Engagement-stratified sampling ensures coverage across the full distribution.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Standard Engagement Tiers
|
|
12
|
+
|
|
13
|
+
| Tier | Percentile | Purpose | Typical content |
|
|
14
|
+
|------|------------|---------|-----------------|
|
|
15
|
+
| **Viral** | Top 5% | What makes content break out | Influencer posts, breakthrough moments |
|
|
16
|
+
| **High** | 75th–95th | Successful content | Engaged audiences, topical resonance |
|
|
17
|
+
| **Medium** | 25th–75th | Baseline performance | Typical posts, average engagement |
|
|
18
|
+
| **Low** | Bottom 25% | Why content fails / background noise | Low visibility, potential bot content |
|
|
19
|
+
| **Zero** | Engagement = 0 | No-spread baseline | Posts that never circulated |
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Engagement Metric Construction
|
|
24
|
+
|
|
25
|
+
### Standard composite (social media platforms)
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
import numpy as np
|
|
29
|
+
|
|
30
|
+
# Log-transform to handle skewness, +1 to handle zeros
|
|
31
|
+
data['engagement'] = (
|
|
32
|
+
np.log(data['retweet_count'] + 1) +
|
|
33
|
+
np.log(data['like_count'] + 1) +
|
|
34
|
+
np.log(data['quote_count'].fillna(0) + 1)
|
|
35
|
+
)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**Document any modification** to this formula. Platform-specific variants:
|
|
39
|
+
|
|
40
|
+
| Platform | Available metrics | Notes |
|
|
41
|
+
|----------|------------------|-------|
|
|
42
|
+
| X/Twitter | Retweets, likes, quotes, replies | Quote count often missing in older data |
|
|
43
|
+
| Reddit | Upvotes, comments, awards | Score = upvotes - downvotes |
|
|
44
|
+
| YouTube | Views, likes, comments | Views dominate; consider likes/views ratio |
|
|
45
|
+
| Bluesky | Likes, reposts, replies | Open API, no auth required |
|
|
46
|
+
| Instagram | Likes, comments, shares, saves | Shares/saves often not available |
|
|
47
|
+
|
|
48
|
+
### R equivalent
|
|
49
|
+
|
|
50
|
+
```r
|
|
51
|
+
data$engagement <- log(data$retweet_count + 1) +
|
|
52
|
+
log(data$like_count + 1) +
|
|
53
|
+
log(replace_na(data$quote_count, 0) + 1)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Stratified Sampling Implementation
|
|
59
|
+
|
|
60
|
+
### Python
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
def engagement_stratified_sample(data, engagement_col='engagement',
|
|
64
|
+
n_per_tier=100, seed=42):
|
|
65
|
+
"""Sample equally from each engagement tier."""
|
|
66
|
+
p95 = data[engagement_col].quantile(0.95)
|
|
67
|
+
p75 = data[engagement_col].quantile(0.75)
|
|
68
|
+
p25 = data[engagement_col].quantile(0.25)
|
|
69
|
+
|
|
70
|
+
def assign_tier(val):
|
|
71
|
+
if val >= p95: return 'viral'
|
|
72
|
+
elif val >= p75: return 'high'
|
|
73
|
+
elif val >= p25: return 'medium'
|
|
74
|
+
else: return 'low'
|
|
75
|
+
|
|
76
|
+
data = data.copy()
|
|
77
|
+
data['engagement_tier'] = data[engagement_col].apply(assign_tier)
|
|
78
|
+
|
|
79
|
+
sample = (data.groupby('engagement_tier')
|
|
80
|
+
.apply(lambda x: x.sample(min(len(x), n_per_tier),
|
|
81
|
+
random_state=seed))
|
|
82
|
+
.reset_index(drop=True))
|
|
83
|
+
|
|
84
|
+
return sample
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### R
|
|
88
|
+
|
|
89
|
+
```r
|
|
90
|
+
engagement_stratified_sample <- function(data, engagement_col = "engagement",
|
|
91
|
+
n_per_tier = 100, seed = 42) {
|
|
92
|
+
set.seed(seed)
|
|
93
|
+
q <- quantile(data[[engagement_col]], probs = c(0.25, 0.75, 0.95))
|
|
94
|
+
|
|
95
|
+
data$engagement_tier <- cut(data[[engagement_col]],
|
|
96
|
+
breaks = c(-Inf, q[1], q[2], q[3], Inf),
|
|
97
|
+
labels = c("low", "medium", "high", "viral"))
|
|
98
|
+
|
|
99
|
+
data %>%
|
|
100
|
+
group_by(engagement_tier) %>%
|
|
101
|
+
slice_sample(n = min(n(), n_per_tier)) %>%
|
|
102
|
+
ungroup()
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Multi-Criteria Sampling
|
|
109
|
+
|
|
110
|
+
When engagement is one of several strata:
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
def multi_criteria_sample(data, strata, total_n=500, seed=42):
|
|
114
|
+
"""
|
|
115
|
+
strata = {
|
|
116
|
+
'engagement_tier': {'allocation': 'equal'},
|
|
117
|
+
'language': {'allocation': 'proportional'},
|
|
118
|
+
'date': {'allocation': 'coverage'} # at least 1 per unique value
|
|
119
|
+
}
|
|
120
|
+
"""
|
|
121
|
+
# Implementation depends on specific constraints
|
|
122
|
+
# Key principle: engagement strata are equal, others proportional or coverage
|
|
123
|
+
pass
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
**Common multi-criteria designs:**
|
|
127
|
+
|
|
128
|
+
| Criterion | Allocation | Rationale |
|
|
129
|
+
|-----------|-----------|-----------|
|
|
130
|
+
| Engagement tier | Equal | Prevent viral bias |
|
|
131
|
+
| Language | Proportional | Reflect population distribution |
|
|
132
|
+
| Time period | Coverage (≥1 per day) | Prevent temporal blind spots |
|
|
133
|
+
| Account type | Proportional or capped | Prevent influencer domination |
|
|
134
|
+
| Verified status | Capped (≤30%) | Verified accounts are over-studied |
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## Power Analysis for Stratified Designs
|
|
139
|
+
|
|
140
|
+
| Design | Min n/group | Detects | Total for 4 tiers |
|
|
141
|
+
|--------|------------|---------|-------------------|
|
|
142
|
+
| 2-group comparison, d=0.5 | 64 | Medium effect | 128 |
|
|
143
|
+
| 2-group comparison, d=0.3 | 175 | Small effect | 350 |
|
|
144
|
+
| 7 frames × 4 tiers, d=0.3 | 50/cell | Small effect | 1,400 |
|
|
145
|
+
| Regression, 5 predictors | 100 total | Medium R² | 100 |
|
|
146
|
+
|
|
147
|
+
**Rule:** Calculate power before committing to sample size. Under-powered stratified samples are worse than well-powered random samples.
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Saturation Detection
|
|
152
|
+
|
|
153
|
+
For qualitative or exploratory coding:
|
|
154
|
+
|
|
155
|
+
```python
|
|
156
|
+
def check_saturation(coded_data, code_var='frame', window=50, threshold=0.05):
|
|
157
|
+
"""Check if last `window` items added < `threshold` proportion of new codes."""
|
|
158
|
+
all_codes = set()
|
|
159
|
+
new_code_positions = []
|
|
160
|
+
|
|
161
|
+
for i, item in enumerate(coded_data):
|
|
162
|
+
code = item[code_var]
|
|
163
|
+
if code not in all_codes:
|
|
164
|
+
all_codes.add(code)
|
|
165
|
+
new_code_positions.append(i)
|
|
166
|
+
|
|
167
|
+
if not new_code_positions:
|
|
168
|
+
return {'saturated': True, 'n': len(coded_data), 'last_new': 0}
|
|
169
|
+
|
|
170
|
+
last_new = new_code_positions[-1]
|
|
171
|
+
items_since = len(coded_data) - last_new
|
|
172
|
+
return {
|
|
173
|
+
'saturated': items_since >= window,
|
|
174
|
+
'n': len(coded_data),
|
|
175
|
+
'last_new': last_new,
|
|
176
|
+
'items_since_new': items_since
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
**Saturation guideline:** If the last 50 coded items produced no new codes/themes, consider stopping.
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## Integration
|
|
185
|
+
|
|
186
|
+
### In `/data-analysis` Phase 1
|
|
187
|
+
|
|
188
|
+
When data includes engagement metrics (likes, shares, retweets, etc.), automatically:
|
|
189
|
+
1. Compute composite engagement score
|
|
190
|
+
2. Assign tiers
|
|
191
|
+
3. Report tier distribution in EDA output
|
|
192
|
+
4. Flag if analysis sample is not engagement-stratified
|
|
193
|
+
|
|
194
|
+
### In `/experiment-design`
|
|
195
|
+
|
|
196
|
+
When designing content analysis studies:
|
|
197
|
+
1. Include engagement stratification in sampling plan
|
|
198
|
+
2. Calculate power per tier
|
|
199
|
+
3. Document tier boundaries in pre-analysis plan
|
|
200
|
+
|
|
201
|
+
### In review agents
|
|
202
|
+
|
|
203
|
+
Check whether social media studies:
|
|
204
|
+
- Report their sampling strategy
|
|
205
|
+
- Account for engagement distribution
|
|
206
|
+
- Avoid over-representing viral content
|
|
207
|
+
- Flag as Major if unstratified convenience sample is used for causal claims
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## Anti-Patterns
|
|
212
|
+
|
|
213
|
+
| Anti-Pattern | Problem | Fix |
|
|
214
|
+
|-------------|---------|-----|
|
|
215
|
+
| Sampling by keyword only | Over-represents viral posts with the keyword | Stratify by engagement after keyword filter |
|
|
216
|
+
| Using "top tweets" API endpoint | Only returns high-engagement content | Use full archive search, then stratify |
|
|
217
|
+
| Treating retweet count as continuous DV | Highly skewed, zero-inflated | Use engagement tiers as strata or log-transform |
|
|
218
|
+
| Equal allocation when one tier is tiny | Viral tier (5%) may have < n_per_tier items | Sample min(available, target), report actual n |
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Escalation Protocol: Methodological Pushback
|
|
2
|
+
|
|
3
|
+
> Shared protocol for review agents and skills. Defines how to push back when methodological answers are vague, designs are unsound, or critical details are missing. Adapted from CommScribe/CommDAAF (Xu 2026).
|
|
4
|
+
|
|
5
|
+
## Principle
|
|
6
|
+
|
|
7
|
+
**Helping produce invalid research helps no one.** Review agents have permission — and obligation — to escalate when methodology is inadequate. Escalation is not hostility; it's rigour.
|
|
8
|
+
|
|
9
|
+
## When to Escalate
|
|
10
|
+
|
|
11
|
+
- Research design lacks a specified estimand or identification strategy
|
|
12
|
+
- Analysis plan uses defaults without justification
|
|
13
|
+
- Causal claims lack a credible identification argument
|
|
14
|
+
- Sample or data limitations are hand-waved
|
|
15
|
+
- Robustness checks are missing or post-hoc
|
|
16
|
+
- Statistical methods are misapplied (e.g., TWFE with staggered treatment)
|
|
17
|
+
- Results interpretation overstates what the evidence supports
|
|
18
|
+
|
|
19
|
+
## The Four Levels
|
|
20
|
+
|
|
21
|
+
| Level | Trigger | Response | Tone |
|
|
22
|
+
|-------|---------|----------|------|
|
|
23
|
+
| **1. Probe** | Vague or missing detail | Ask a specific clarifying question. "What is the estimand?" / "How was K selected?" | Neutral, curious |
|
|
24
|
+
| **2. Explain stakes** | Still vague after probing | State why the detail matters. "Without this, the results are not interpretable because..." | Direct, educational |
|
|
25
|
+
| **3. Challenge** | Pushback or deflection | Name the specific threat to validity. "This design cannot distinguish X from Y. The coefficient captures both effects." | Firm, specific |
|
|
26
|
+
| **4. Flag and stop** | User insists on unsound approach | State clearly that the approach will produce invalid results. Mark the issue as a **Blocker** in the report. Do not proceed with the flawed analysis — offer alternatives instead. | Non-negotiable, constructive |
|
|
27
|
+
|
|
28
|
+
## Level 4: Flag and Offer Alternatives
|
|
29
|
+
|
|
30
|
+
Never just block — always offer a path forward. When an approach fails at Level 4:
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
BLOCKER: [What's wrong and why it invalidates results]
|
|
34
|
+
|
|
35
|
+
ALTERNATIVES:
|
|
36
|
+
1. [Modified design that addresses the threat]
|
|
37
|
+
2. [Narrower claim that the current design can support]
|
|
38
|
+
3. [Additional data or test that would resolve the issue]
|
|
39
|
+
4. [Descriptive analysis as honest fallback]
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## How Agents Use This
|
|
43
|
+
|
|
44
|
+
### In scored reviews (paper-critic, referee2-reviewer, domain-reviewer)
|
|
45
|
+
|
|
46
|
+
- Level 1-2 issues: flag in report, deduct per quality-scoring severity
|
|
47
|
+
- Level 3 issues: flag as **Critical** (-15 to -25)
|
|
48
|
+
- Level 4 issues: flag as **Blocker** (-100, automatic 0)
|
|
49
|
+
|
|
50
|
+
### In interactive work (causal-design, experiment-design, data-analysis)
|
|
51
|
+
|
|
52
|
+
- Start at Level 1 for any underspecified element
|
|
53
|
+
- Escalate through levels within the conversation
|
|
54
|
+
- At Level 4, refuse to run the analysis and present alternatives
|
|
55
|
+
- User can override with explicit acknowledgment: "I understand the limitation, proceed anyway" — in which case, proceed but add a prominently displayed caveat to any output
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
- Flag claims that exceed what the methodology supports (Level 2-3)
|
|
59
|
+
- Suggest hedging language that accurately reflects the evidence
|
|
60
|
+
|
|
61
|
+
## What This Is NOT
|
|
62
|
+
|
|
63
|
+
- **Not a licence to block all work.** Most research involves trade-offs. The protocol targets genuine threats to validity, not stylistic preferences or minor issues.
|
|
64
|
+
- **Not adversarial for its own sake.** Each escalation level includes a constructive element (question, explanation, challenge with specifics, alternatives).
|
|
65
|
+
- **Not a substitute for domain expertise.** When unsure whether something is methodologically unsound, say so: "I'm uncertain whether this is valid — here's my concern: [X]. Can you confirm?"
|
|
66
|
+
|
|
67
|
+
## Integration with Existing Rules
|
|
68
|
+
|
|
69
|
+
| Rule | How escalation interacts |
|
|
70
|
+
|------|------------------------|
|
|
71
|
+
| `design-before-results` | Level 1 probe: "Has the analysis plan been specified?" before running anything |
|
|
72
|
+
| `severity-gradient` | Escalation levels map to severity tiers; Phase Detection determines how strictly to apply them |
|
|
73
|
+
| `scope-discipline` | Escalation is in-scope when reviewing methodology; out-of-scope for unrelated issues |
|
|
74
|
+
| `no-hardcoded-results` | Level 2: explain why hard-coded results undermine reproducibility |
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
# External Audit Protocol
|
|
2
|
+
|
|
3
|
+
> Shared workflow for all `external-*-audit` skills. Each skill references this file and provides scope-specific configuration (CWD, checklist, report path).
|
|
4
|
+
|
|
5
|
+
## What This Is
|
|
6
|
+
|
|
7
|
+
Uses an external LLM CLI (Codex or Gemini) to get a **fresh, independent perspective** from a competing model on Claude Code infrastructure. This extends the agents-vs-skills principle: not just fresh Claude context, but an entirely different model reviewing the work.
|
|
8
|
+
|
|
9
|
+
**Key difference from `/system-audit`:** System audit uses Claude sub-agents for mechanical checks (counts, symlinks, broken links). External audits are **qualitative** — architecture coherence, design quality, redundancy, missing capabilities, improvement suggestions.
|
|
10
|
+
|
|
11
|
+
**Model selection:** Pass `--model codex` or `--model gemini` (default: gemini). Running both triangulates — different training and reasoning patterns produce more reliable findings than either alone.
|
|
12
|
+
|
|
13
|
+
## Model Commands
|
|
14
|
+
|
|
15
|
+
| Model | CLI | Execute command | Install |
|
|
16
|
+
|-------|-----|----------------|---------|
|
|
17
|
+
| Codex | `codex` | `codex exec --full-auto "{prompt}"` | `npm install -g @openai/codex` + `codex login` |
|
|
18
|
+
| Gemini | `gemini` | `gemini -p "{prompt}" --yolo` | `npm install -g @google/gemini-cli` |
|
|
19
|
+
|
|
20
|
+
## Pre-Flight
|
|
21
|
+
|
|
22
|
+
Before anything else:
|
|
23
|
+
|
|
24
|
+
1. **Verify the CLI is installed:**
|
|
25
|
+
```bash
|
|
26
|
+
which {model} && {model} --version
|
|
27
|
+
```
|
|
28
|
+
If not found, stop and tell the user with install instructions (see table above).
|
|
29
|
+
|
|
30
|
+
2. **Confirm the target directory exists** (CWD from the skill config).
|
|
31
|
+
|
|
32
|
+
3. **Check git status** in the target directory to establish a clean baseline:
|
|
33
|
+
```bash
|
|
34
|
+
cd <CWD> && git status --short
|
|
35
|
+
```
|
|
36
|
+
Note any pre-existing uncommitted changes so we can distinguish them from model modifications later.
|
|
37
|
+
|
|
38
|
+
## Phase 1: Generate Manifest
|
|
39
|
+
|
|
40
|
+
Claude generates a concise ecosystem manifest describing what the model will be auditing. This gives it the map before it explores the territory.
|
|
41
|
+
|
|
42
|
+
Write to `/tmp/external-audit-manifest-{scope}.md`:
|
|
43
|
+
|
|
44
|
+
```markdown
|
|
45
|
+
# Ecosystem Manifest: {scope}
|
|
46
|
+
|
|
47
|
+
## Root Directory
|
|
48
|
+
{absolute path}
|
|
49
|
+
|
|
50
|
+
## Key Paths
|
|
51
|
+
{list of important directories and files, relative to root}
|
|
52
|
+
|
|
53
|
+
## Counts
|
|
54
|
+
{relevant metrics: number of skills, hooks, files, etc.}
|
|
55
|
+
|
|
56
|
+
## Architecture Summary
|
|
57
|
+
{2-3 sentence description of how the system is organized}
|
|
58
|
+
|
|
59
|
+
## Tech Stack
|
|
60
|
+
{languages, frameworks, key dependencies}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Keep it under 200 lines.** The model needs context, not a full directory listing.
|
|
64
|
+
|
|
65
|
+
## Phase 2: Build Prompt
|
|
66
|
+
|
|
67
|
+
Combine the manifest with the skill-specific audit checklist into a single prompt file.
|
|
68
|
+
|
|
69
|
+
Write to `/tmp/external-audit-prompt-{scope}.md`:
|
|
70
|
+
|
|
71
|
+
```markdown
|
|
72
|
+
# External Audit: {scope}
|
|
73
|
+
|
|
74
|
+
## CRITICAL INSTRUCTIONS
|
|
75
|
+
|
|
76
|
+
You are conducting a **READ-ONLY architecture audit**. You must:
|
|
77
|
+
- **NEVER create, modify, or delete any files** — not even "cleanup" or "improvement" edits
|
|
78
|
+
- **NEVER run git commands that change state** (no commit, add, push, checkout, rm)
|
|
79
|
+
- **NEVER install packages or modify dependencies**
|
|
80
|
+
- **NEVER append to, rename, or reorganize existing files**
|
|
81
|
+
- Only read files and output your findings as markdown to stdout
|
|
82
|
+
- If you feel compelled to fix something, describe the fix in your output instead — do NOT apply it
|
|
83
|
+
|
|
84
|
+
## Ecosystem Manifest
|
|
85
|
+
|
|
86
|
+
{contents of manifest file}
|
|
87
|
+
|
|
88
|
+
## Audit Checklist
|
|
89
|
+
|
|
90
|
+
{contents of skill-specific references/audit-checklist.md}
|
|
91
|
+
|
|
92
|
+
## Output Format
|
|
93
|
+
|
|
94
|
+
Structure your response as a markdown report with these sections:
|
|
95
|
+
|
|
96
|
+
### Executive Summary
|
|
97
|
+
2-3 sentence overall assessment.
|
|
98
|
+
|
|
99
|
+
### Scored Sections
|
|
100
|
+
For each checklist category, provide:
|
|
101
|
+
- **Score:** A/B/C/D/F
|
|
102
|
+
- **Strengths:** What's done well
|
|
103
|
+
- **Issues:** Problems found (severity: Critical/Major/Minor)
|
|
104
|
+
- **Recommendations:** Specific, actionable improvements
|
|
105
|
+
|
|
106
|
+
### Architecture Diagram
|
|
107
|
+
If helpful, describe the system architecture in text form.
|
|
108
|
+
|
|
109
|
+
### Top 5 Recommendations
|
|
110
|
+
Prioritized list of the most impactful improvements, with effort estimates (Quick/Medium/Large).
|
|
111
|
+
|
|
112
|
+
### Fresh Eyes
|
|
113
|
+
Things that seem odd, redundant, or unnecessarily complex to someone seeing this for the first time. This is the most valuable section — it's what insiders miss.
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Phase 3: Execute
|
|
117
|
+
|
|
118
|
+
Run from the target CWD with a 10-minute timeout:
|
|
119
|
+
|
|
120
|
+
**Codex:**
|
|
121
|
+
```bash
|
|
122
|
+
cd <CWD> && timeout 600 codex exec --full-auto "$(cat /tmp/external-audit-prompt-{scope}.md)" 2>&1
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**Gemini:**
|
|
126
|
+
```bash
|
|
127
|
+
cd <CWD> && timeout 600 gemini -p "$(cat /tmp/external-audit-prompt-{scope}.md)" --yolo 2>&1
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
**Capture the full output** — both stdout and stderr.
|
|
131
|
+
|
|
132
|
+
**If the model fails or times out:**
|
|
133
|
+
- Log the error
|
|
134
|
+
- Report to the user: "{Model} execution failed: {error}. The prompt is saved at `/tmp/external-audit-prompt-{scope}.md` if you want to retry manually."
|
|
135
|
+
- Do not retry automatically
|
|
136
|
+
|
|
137
|
+
## Phase 4: Safety Check
|
|
138
|
+
|
|
139
|
+
> **Critical warning:** Both Codex and Gemini are agentic coding tools designed to make changes. Despite read-only instructions, they may create, modify, or delete files. Gemini has a documented tendency to do this. **Always assume the model touched something** and verify thoroughly. This check is not optional.
|
|
140
|
+
|
|
141
|
+
**Immediately after the model returns**, verify nothing was modified:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
cd <CWD> && git diff --stat
|
|
145
|
+
cd <CWD> && git status --short
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Run **both** commands — `git diff` catches modifications to tracked files, `git status` catches new untracked files or deletions. Compare against the baseline from pre-flight.
|
|
149
|
+
|
|
150
|
+
If there are **new changes not present before**:
|
|
151
|
+
|
|
152
|
+
1. **Alert the user immediately:** "{Model} modified files despite read-only instructions. Changed: {list}"
|
|
153
|
+
2. **Revert immediately:** `git checkout -- .` (for modifications/deletions). For new untracked files, list them and delete manually.
|
|
154
|
+
3. **Do not proceed** with report generation until the working tree matches the pre-flight baseline
|
|
155
|
+
4. **Note the violation** in the report header (replace "No files modified" with a description of what was changed and reverted)
|
|
156
|
+
|
|
157
|
+
## Phase 5: Write Report
|
|
158
|
+
|
|
159
|
+
Write the model output to the skill-specified report path (typically `audits/{model}-audit-{scope}-YYYY-MM-DD.md`).
|
|
160
|
+
|
|
161
|
+
Add a header:
|
|
162
|
+
|
|
163
|
+
```markdown
|
|
164
|
+
# {Model} Audit: {Scope Title} — YYYY-MM-DD
|
|
165
|
+
|
|
166
|
+
> Generated by {Model CLI description}.
|
|
167
|
+
> Read-only audit | No files modified.
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
{Model output}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## Phase 6: Present
|
|
175
|
+
|
|
176
|
+
Show the user:
|
|
177
|
+
|
|
178
|
+
1. **Executive summary** from the report
|
|
179
|
+
2. **Any Critical/Major issues** found
|
|
180
|
+
3. **Top 5 recommendations** with effort estimates
|
|
181
|
+
4. **Fresh Eyes section** — the outsider perspective
|
|
182
|
+
5. Link to the full report
|
|
183
|
+
|
|
184
|
+
Ask if he wants to address any findings now.
|
|
185
|
+
|
|
186
|
+
## Error Handling
|
|
187
|
+
|
|
188
|
+
| Situation | Action |
|
|
189
|
+
|-----------|--------|
|
|
190
|
+
| CLI not installed | Stop, show install instructions |
|
|
191
|
+
| Target directory doesn't exist | Stop, ask the user for correct path |
|
|
192
|
+
| Model times out (>10 min) | Save partial output if any, report failure |
|
|
193
|
+
| Model modifies files | Alert, offer revert, do not continue |
|
|
194
|
+
| Model returns empty output | Report failure, save prompt for manual retry |
|
|
195
|
+
| Git not initialized in target | Skip git safety checks, warn the user |
|
|
196
|
+
| Authentication error | Stop, tell the user to authenticate |
|
|
197
|
+
|
|
198
|
+
## Integration with Other Skills
|
|
199
|
+
|
|
200
|
+
| Skill | Relationship |
|
|
201
|
+
|-------|-------------|
|
|
202
|
+
| `/system-audit` | Mechanical checks (counts, symlinks) — complementary, not overlapping |
|
|
203
|
+
| `/audit-project-research` | Per-project structural audit — external audits are cross-cutting |
|
|
204
|
+
| `/lessons-learned` | Critical findings can feed into post-mortems |
|
|
205
|
+
| `/ideas` | Recommendations can be captured as improvement ideas |
|