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,174 @@
|
|
|
1
|
+
# Paid API Safety Patterns
|
|
2
|
+
|
|
3
|
+
> Defensive conventions for any skill or code that spends money on external APIs. Reference this document when generating scripts that call OpenAI, Anthropic, or other metered services.
|
|
4
|
+
|
|
5
|
+
## Mandatory Safeguards
|
|
6
|
+
|
|
7
|
+
Every script that makes paid API calls **must** include all four:
|
|
8
|
+
|
|
9
|
+
| Safeguard | What it does | When it runs |
|
|
10
|
+
|-----------|-------------|--------------|
|
|
11
|
+
| **Cost estimation** | Calculate estimated cost from token counts and rates, display before proceeding | Before any API call |
|
|
12
|
+
| **`--dry-run` mode** | Simulate the full pipeline (file prep, chunking, validation) without submitting | On `--dry-run` flag |
|
|
13
|
+
| **Explicit confirmation** | Require the user to type `yes` (not just press Enter) after seeing the estimate | After cost display, before submission |
|
|
14
|
+
| **Call logging** | Record every API call with timestamp, endpoint, token count, and cost to a log file | On every call |
|
|
15
|
+
|
|
16
|
+
### Cost Estimation Pattern
|
|
17
|
+
|
|
18
|
+
```python
|
|
19
|
+
def estimate_cost(records, model, input_tpm, output_tpm):
|
|
20
|
+
"""Estimate cost BEFORE spending money."""
|
|
21
|
+
est_input_tokens = sum(len(r["content"]) // 4 for r in records) # rough: 1 token ~ 4 chars
|
|
22
|
+
est_output_tokens = len(records) * output_tpm # expected output per record
|
|
23
|
+
|
|
24
|
+
cost = (est_input_tokens / 1_000_000) * RATES[model]["input"] \
|
|
25
|
+
+ (est_output_tokens / 1_000_000) * RATES[model]["output"]
|
|
26
|
+
|
|
27
|
+
print(f"Records: {len(records):,}")
|
|
28
|
+
print(f"Est. input tokens: {est_input_tokens:,}")
|
|
29
|
+
print(f"Est. output tokens: {est_output_tokens:,}")
|
|
30
|
+
print(f"Model: {model}")
|
|
31
|
+
print(f"Estimated cost: ${cost:.2f}")
|
|
32
|
+
return cost
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Dry-Run Pattern
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
import argparse
|
|
39
|
+
|
|
40
|
+
parser = argparse.ArgumentParser()
|
|
41
|
+
parser.add_argument("--dry-run", action="store_true",
|
|
42
|
+
help="Show what would be submitted without calling the API")
|
|
43
|
+
args = parser.parse_args()
|
|
44
|
+
|
|
45
|
+
if args.dry_run:
|
|
46
|
+
print(f"[DRY RUN] Would submit {len(batches)} batches ({total_records:,} records)")
|
|
47
|
+
print(f"[DRY RUN] Estimated cost: ${estimated_cost:.2f}")
|
|
48
|
+
sys.exit(0)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Confirmation Pattern
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
def confirm_spend(estimated_cost):
|
|
55
|
+
"""Require explicit 'yes' before spending money."""
|
|
56
|
+
response = input(f"\nThis will cost approximately ${estimated_cost:.2f}. Type 'yes' to proceed: ")
|
|
57
|
+
if response.strip().lower() != "yes":
|
|
58
|
+
print("Aborted.")
|
|
59
|
+
sys.exit(0)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Recommended Safeguards (Batch/Bulk Operations)
|
|
63
|
+
|
|
64
|
+
For jobs processing 100+ records or costing more than $1:
|
|
65
|
+
|
|
66
|
+
| Safeguard | Details |
|
|
67
|
+
|-----------|---------|
|
|
68
|
+
| **Retry with backoff** | Start at 1s, double each retry, max 5 attempts. Respect `Retry-After` headers. |
|
|
69
|
+
| **Job ID tracking** | Write batch/job IDs to a tracking file (JSON or CSV) so status can be checked later. |
|
|
70
|
+
| **Chunking** | Split large jobs into chunks (e.g., 5,000-10,000 records per batch file). |
|
|
71
|
+
| **Resume capability** | Track completed chunks in a state file. On restart, skip already-completed work. |
|
|
72
|
+
|
|
73
|
+
### Retry Pattern
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
import time
|
|
77
|
+
|
|
78
|
+
def call_with_backoff(fn, *args, max_retries=5, base_delay=1.0):
|
|
79
|
+
"""Retry with exponential backoff."""
|
|
80
|
+
for attempt in range(max_retries):
|
|
81
|
+
try:
|
|
82
|
+
return fn(*args)
|
|
83
|
+
except (RateLimitError, APIConnectionError, ssl.SSLError) as e:
|
|
84
|
+
if attempt == max_retries - 1:
|
|
85
|
+
raise
|
|
86
|
+
delay = base_delay * (2 ** attempt)
|
|
87
|
+
print(f"[RETRY] Attempt {attempt + 1}/{max_retries} failed: {e}. "
|
|
88
|
+
f"Retrying in {delay:.0f}s...")
|
|
89
|
+
time.sleep(delay)
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Job Tracking Pattern
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
import json
|
|
96
|
+
from datetime import datetime
|
|
97
|
+
|
|
98
|
+
TRACKING_FILE = "batch_tracking.json"
|
|
99
|
+
|
|
100
|
+
def save_batch_id(batch_id, record_count, status="submitted"):
|
|
101
|
+
"""Save batch ID for later status checks."""
|
|
102
|
+
tracking = json.loads(Path(TRACKING_FILE).read_text()) if Path(TRACKING_FILE).exists() else []
|
|
103
|
+
tracking.append({
|
|
104
|
+
"batch_id": batch_id,
|
|
105
|
+
"records": record_count,
|
|
106
|
+
"status": status,
|
|
107
|
+
"submitted_at": datetime.now().isoformat()
|
|
108
|
+
})
|
|
109
|
+
Path(TRACKING_FILE).write_text(json.dumps(tracking, indent=2))
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Resume Pattern
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
STATE_FILE = "processing_state.json"
|
|
116
|
+
|
|
117
|
+
def get_completed_chunks():
|
|
118
|
+
"""Load set of already-completed chunk IDs."""
|
|
119
|
+
if Path(STATE_FILE).exists():
|
|
120
|
+
return set(json.loads(Path(STATE_FILE).read_text()).get("completed", []))
|
|
121
|
+
return set()
|
|
122
|
+
|
|
123
|
+
def mark_chunk_complete(chunk_id):
|
|
124
|
+
"""Record a chunk as done so it won't be re-processed."""
|
|
125
|
+
state = json.loads(Path(STATE_FILE).read_text()) if Path(STATE_FILE).exists() else {"completed": []}
|
|
126
|
+
state["completed"].append(chunk_id)
|
|
127
|
+
Path(STATE_FILE).write_text(json.dumps(state, indent=2))
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Cost Estimation Rates
|
|
131
|
+
|
|
132
|
+
Reference rates for common APIs. **Always verify current pricing before submitting large jobs.**
|
|
133
|
+
|
|
134
|
+
| Provider | Model | Input (per 1M tokens) | Output (per 1M tokens) | Notes |
|
|
135
|
+
|----------|-------|----------------------|------------------------|-------|
|
|
136
|
+
| OpenAI | gpt-4o | $2.50 | $10.00 | Batch API is 50% off |
|
|
137
|
+
| OpenAI | gpt-4o-mini | $0.15 | $0.60 | Batch API is 50% off |
|
|
138
|
+
| OpenAI | gpt-4.1 | $2.00 | $8.00 | Batch API is 50% off |
|
|
139
|
+
| OpenAI | gpt-4.1-mini | $0.40 | $1.60 | Batch API is 50% off |
|
|
140
|
+
| OpenAI | gpt-4.1-nano | $0.10 | $0.40 | Batch API is 50% off |
|
|
141
|
+
| Anthropic | claude-sonnet-4 | $3.00 | $15.00 | Batches: 50% off, prompt caching available |
|
|
142
|
+
| Anthropic | claude-haiku-3.5 | $0.80 | $4.00 | Batches: 50% off |
|
|
143
|
+
|
|
144
|
+
**Formula:** Always show the user the calculation, not just the result:
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
Cost = (input_tokens / 1M) x input_rate + (output_tokens / 1M) x output_rate
|
|
148
|
+
= (2,500,000 / 1M) x $2.50 + (500,000 / 1M) x $10.00
|
|
149
|
+
= $6.25 + $5.00
|
|
150
|
+
= $11.25
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Error Handling Checklist
|
|
154
|
+
|
|
155
|
+
| Failure mode | Required behaviour |
|
|
156
|
+
|-------------|-------------------|
|
|
157
|
+
| Network/SSL error | Retry with backoff (do not fail immediately) |
|
|
158
|
+
| Rate limit (429) | Respect `Retry-After` header, then retry |
|
|
159
|
+
| Partial batch failure | Log which batches succeeded vs. failed; save partial results |
|
|
160
|
+
| Auth error (401/403) | Fail immediately with clear message (do not retry) |
|
|
161
|
+
| Invalid input | Validate before submission, not after spending money |
|
|
162
|
+
| Interrupted run | State file enables resume from last completed chunk |
|
|
163
|
+
|
|
164
|
+
## When This Applies
|
|
165
|
+
|
|
166
|
+
- Any skill that generates code calling a metered API (OpenAI, Anthropic, Google, etc.)
|
|
167
|
+
- Batch processing scripts (Batch API, bulk embeddings, large-scale classification)
|
|
168
|
+
- One-off scripts that could accidentally run up a bill (e.g., processing an entire dataset)
|
|
169
|
+
|
|
170
|
+
## When to Skip
|
|
171
|
+
|
|
172
|
+
- Free-tier APIs or APIs with no per-call cost
|
|
173
|
+
- Local model inference (Ollama, vLLM, etc.)
|
|
174
|
+
- Single-call interactions where cost is negligible (< $0.01)
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Reference Colour Palettes
|
|
2
|
+
|
|
3
|
+
> Shared reference for `/beamer-deck` and `/quarto-deck`. Starting points drawn from Scott Cunningham's example decks. Always create an original palette.
|
|
4
|
+
|
|
5
|
+
## Professional (Deep Blues)
|
|
6
|
+
|
|
7
|
+
| Name | Hex | Use |
|
|
8
|
+
|------|-----|-----|
|
|
9
|
+
| Midnight | `#1A1A2E` | Headings |
|
|
10
|
+
| DeepBlue | `#16213E` | Body text |
|
|
11
|
+
| RoyalBlue | `#0F3460` | Secondary |
|
|
12
|
+
| Coral | `#E94560` | Accent |
|
|
13
|
+
| SoftGray | `#BDC3C7` | Muted elements |
|
|
14
|
+
| CloudWhite | `#FAFBFC` | Background |
|
|
15
|
+
|
|
16
|
+
### Beamer
|
|
17
|
+
```latex
|
|
18
|
+
\definecolor{Midnight}{HTML}{1A1A2E}
|
|
19
|
+
\definecolor{DeepBlue}{HTML}{16213E}
|
|
20
|
+
\definecolor{RoyalBlue}{HTML}{0F3460}
|
|
21
|
+
\definecolor{Coral}{HTML}{E94560}
|
|
22
|
+
\definecolor{SoftGray}{HTML}{BDC3C7}
|
|
23
|
+
\definecolor{CloudWhite}{HTML}{FAFBFC}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### CSS
|
|
27
|
+
```css
|
|
28
|
+
--r-background-color: #FAFBFC;
|
|
29
|
+
--r-main-color: #16213E;
|
|
30
|
+
--r-heading-color: #1A1A2E;
|
|
31
|
+
--r-link-color: #E94560;
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Energetic (Warm Tones)
|
|
35
|
+
|
|
36
|
+
| Name | Hex | Use |
|
|
37
|
+
|------|-----|-----|
|
|
38
|
+
| DarkSlate | `#2C3E50` | Headings, body |
|
|
39
|
+
| Crimson | `#C0392B` | Accent |
|
|
40
|
+
| Sunset | `#F39C12` | Highlights |
|
|
41
|
+
| Teal | `#1ABC9C` | Secondary |
|
|
42
|
+
| Lavender | `#9B59B6` | Tertiary |
|
|
43
|
+
| LightGray | `#ECF0F1` | Background |
|
|
44
|
+
|
|
45
|
+
### Beamer
|
|
46
|
+
```latex
|
|
47
|
+
\definecolor{DarkSlate}{HTML}{2C3E50}
|
|
48
|
+
\definecolor{Crimson}{HTML}{C0392B}
|
|
49
|
+
\definecolor{Sunset}{HTML}{F39C12}
|
|
50
|
+
\definecolor{Teal}{HTML}{1ABC9C}
|
|
51
|
+
\definecolor{Lavender}{HTML}{9B59B6}
|
|
52
|
+
\definecolor{LightGray}{HTML}{ECF0F1}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### CSS
|
|
56
|
+
```css
|
|
57
|
+
--r-background-color: #ECF0F1;
|
|
58
|
+
--r-main-color: #2C3E50;
|
|
59
|
+
--r-heading-color: #2C3E50;
|
|
60
|
+
--r-link-color: #C0392B;
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Academic (Muted Earth)
|
|
64
|
+
|
|
65
|
+
| Name | Hex | Use |
|
|
66
|
+
|------|-----|-----|
|
|
67
|
+
| NavyBlue | `#003366` | Headings |
|
|
68
|
+
| ForestGreen | `#2E7D32` | Secondary |
|
|
69
|
+
| BurntOrange | `#D84315` | Accent |
|
|
70
|
+
| WarmGray | `#757575` | Muted |
|
|
71
|
+
| Cream | `#FFF8E1` | Background |
|
|
72
|
+
| Charcoal | `#37474F` | Body text |
|
|
73
|
+
|
|
74
|
+
### Beamer
|
|
75
|
+
```latex
|
|
76
|
+
\definecolor{NavyBlue}{HTML}{003366}
|
|
77
|
+
\definecolor{ForestGreen}{HTML}{2E7D32}
|
|
78
|
+
\definecolor{BurntOrange}{HTML}{D84315}
|
|
79
|
+
\definecolor{WarmGray}{HTML}{757575}
|
|
80
|
+
\definecolor{Cream}{HTML}{FFF8E1}
|
|
81
|
+
\definecolor{Charcoal}{HTML}{37474F}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### CSS
|
|
85
|
+
```css
|
|
86
|
+
--r-background-color: #FFF8E1;
|
|
87
|
+
--r-main-color: #37474F;
|
|
88
|
+
--r-heading-color: #003366;
|
|
89
|
+
--r-link-color: #D84315;
|
|
90
|
+
```
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Progressive Disclosure for Skills
|
|
2
|
+
|
|
3
|
+
> Pattern for structuring large skills so that Claude reads only the sections it needs, rather than loading everything into context upfront.
|
|
4
|
+
|
|
5
|
+
## The Problem
|
|
6
|
+
|
|
7
|
+
When a skill is invoked, its full `SKILL.md` is loaded into context. For large skills (200+ lines), most of the content may be irrelevant to the specific task. This wastes tokens and can push sessions toward compression earlier than necessary. Anthropic's official recommendation is to keep SKILL.md under 500 lines; our stricter threshold (200 lines to trigger splitting) ensures leaner context usage.
|
|
8
|
+
|
|
9
|
+
## The Pattern
|
|
10
|
+
|
|
11
|
+
Split a skill into a **lean core** (the main `SKILL.md`) and **on-demand sections** (files in `references/`). The core contains workflow logic, decision points, and a section index. Reference files contain detailed instructions that Claude reads only when the workflow reaches that branch.
|
|
12
|
+
|
|
13
|
+
### Structure
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
skills/my-skill/
|
|
17
|
+
SKILL.md # Lean core: workflow + section index (< 100 lines ideal)
|
|
18
|
+
references/
|
|
19
|
+
phase-1-details.md # Detailed instructions for phase 1
|
|
20
|
+
phase-2-details.md # Detailed instructions for phase 2
|
|
21
|
+
edge-cases.md # Handling for uncommon scenarios
|
|
22
|
+
report-template.md # Output format template
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Section Index in SKILL.md
|
|
26
|
+
|
|
27
|
+
Include a section index that tells Claude what exists and when to read it:
|
|
28
|
+
|
|
29
|
+
```markdown
|
|
30
|
+
## Reference Sections
|
|
31
|
+
|
|
32
|
+
Read these **only when needed** — do not pre-load all of them.
|
|
33
|
+
|
|
34
|
+
| Section | When to read | File |
|
|
35
|
+
|---------|-------------|------|
|
|
36
|
+
| Phase 1 details | When starting Phase 1 | [`references/phase-1-details.md`](references/phase-1-details.md) |
|
|
37
|
+
| Phase 2 details | When starting Phase 2 | [`references/phase-2-details.md`](references/phase-2-details.md) |
|
|
38
|
+
| Edge cases | When encountering an unusual input | [`references/edge-cases.md`](references/edge-cases.md) |
|
|
39
|
+
| Report template | When writing the output report | [`references/report-template.md`](references/report-template.md) |
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### What Goes in the Core vs. References
|
|
43
|
+
|
|
44
|
+
**Keep in SKILL.md (always loaded):**
|
|
45
|
+
- YAML frontmatter (name, description, allowed-tools)
|
|
46
|
+
- When to use / when not to use
|
|
47
|
+
- High-level workflow (numbered phases)
|
|
48
|
+
- Decision logic (if X then do Y)
|
|
49
|
+
- Section index table
|
|
50
|
+
- Cross-references to other skills
|
|
51
|
+
|
|
52
|
+
**Move to references/ (loaded on demand):**
|
|
53
|
+
- Detailed instructions for individual phases (> 15 lines)
|
|
54
|
+
- Report/output templates
|
|
55
|
+
- Lookup tables, checklists, scoring rubrics
|
|
56
|
+
- Domain-specific knowledge (e.g., journal formatting rules)
|
|
57
|
+
- Edge case handling
|
|
58
|
+
- Examples and sample outputs
|
|
59
|
+
|
|
60
|
+
### Threshold Rule
|
|
61
|
+
|
|
62
|
+
Apply progressive disclosure when a skill meets **any** of:
|
|
63
|
+
- Total `SKILL.md` exceeds 200 lines
|
|
64
|
+
- Any single section exceeds 40 lines of reference material (not workflow logic)
|
|
65
|
+
- The skill has 3+ distinct phases where only 1-2 run in a typical invocation
|
|
66
|
+
- The skill serves multiple domains with domain-specific branches
|
|
67
|
+
|
|
68
|
+
### Skills Already Using This Pattern
|
|
69
|
+
|
|
70
|
+
These skills already follow progressive disclosure:
|
|
71
|
+
- `/bib-validate` — preprint check logic in `references/preprint-check.md`, report template in `references/report-template.md`
|
|
72
|
+
- `/code-review` — quality rubric in `references/quality-rubric.md`
|
|
73
|
+
- `/devils-advocate` — competing hypotheses framework in `references/competing-hypotheses.md`
|
|
74
|
+
|
|
75
|
+
### Reference Depth
|
|
76
|
+
|
|
77
|
+
Keep references **one level deep** from SKILL.md. All reference files should link directly from SKILL.md — never chain references (SKILL.md → file A → file B). Claude may partially read deeply nested files (e.g., `head -100`), resulting in incomplete information. Per [Anthropic's official best practices](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices).
|
|
78
|
+
|
|
79
|
+
### When NOT to Apply
|
|
80
|
+
|
|
81
|
+
- Skills under 100 lines — overhead isn't worth it
|
|
82
|
+
- Skills where every section is always needed (e.g., `/session-log`)
|
|
83
|
+
- Skills where the workflow is linear and every step always runs
|
|
84
|
+
|
|
85
|
+
## For Existing Skills
|
|
86
|
+
|
|
87
|
+
When refactoring an existing skill to use progressive disclosure:
|
|
88
|
+
1. Identify sections that are > 40 lines of reference material
|
|
89
|
+
2. Extract to `references/` with a descriptive filename
|
|
90
|
+
3. Replace in `SKILL.md` with a one-line summary + link
|
|
91
|
+
4. Add a section index table if one doesn't exist
|
|
92
|
+
5. Test by invoking the skill — verify Claude reads the right sections at the right time
|