pi-skill-search 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/CHANGELOG.md +20 -0
- package/LICENSE +21 -0
- package/README.md +97 -0
- package/index.ts +163 -0
- package/package.json +48 -0
- package/skills/adaptyv/SKILL.md +92 -0
- package/skills/add-community-extension/SKILL.md +85 -0
- package/skills/aeon/SKILL.md +111 -0
- package/skills/ai-slop-cleaner/SKILL.md +118 -0
- package/skills/anndata/SKILL.md +83 -0
- package/skills/arboreto/SKILL.md +107 -0
- package/skills/ask/SKILL.md +55 -0
- package/skills/astropy/SKILL.md +30 -0
- package/skills/async-worker-recovery/SKILL.md +44 -0
- package/skills/autopilot/SKILL.md +63 -0
- package/skills/autoresearch/SKILL.md +64 -0
- package/skills/autoskill/SKILL.md +116 -0
- package/skills/babysit/SKILL.md +43 -0
- package/skills/benchling-integration/SKILL.md +106 -0
- package/skills/bgpt-paper-search/SKILL.md +67 -0
- package/skills/biopython/SKILL.md +29 -0
- package/skills/bioservices/SKILL.md +96 -0
- package/skills/brainstorming/SKILL.md +104 -0
- package/skills/cancel/SKILL.md +85 -0
- package/skills/ccg/SKILL.md +87 -0
- package/skills/celery-pipeline/SKILL.md +30 -0
- package/skills/cellxgene-census/SKILL.md +104 -0
- package/skills/child-pi-spawning/SKILL.md +85 -0
- package/skills/cirq/SKILL.md +113 -0
- package/skills/citation-management/SKILL.md +91 -0
- package/skills/clinical-decision-support/SKILL.md +117 -0
- package/skills/clinical-reports/SKILL.md +118 -0
- package/skills/clinical-trial/SKILL.md +28 -0
- package/skills/cobrapy/SKILL.md +116 -0
- package/skills/configure-notifications/SKILL.md +85 -0
- package/skills/consciousness-council/SKILL.md +120 -0
- package/skills/context-artifact-hygiene/SKILL.md +85 -0
- package/skills/context-mode-ops/SKILL.md +87 -0
- package/skills/dask/SKILL.md +85 -0
- package/skills/database-lookup/SKILL.md +118 -0
- package/skills/datamol/SKILL.md +108 -0
- package/skills/debug/SKILL.md +32 -0
- package/skills/deep-dive/SKILL.md +114 -0
- package/skills/deep-interview/SKILL.md +90 -0
- package/skills/deepchem/SKILL.md +117 -0
- package/skills/deepinit/SKILL.md +100 -0
- package/skills/deeptools/SKILL.md +118 -0
- package/skills/delegation-patterns/SKILL.md +56 -0
- package/skills/depmap/SKILL.md +94 -0
- package/skills/dhdna-profiler/SKILL.md +86 -0
- package/skills/diffdock/SKILL.md +101 -0
- package/skills/dispatching-parallel-agents/SKILL.md +119 -0
- package/skills/dnanexus-integration/SKILL.md +118 -0
- package/skills/do/SKILL.md +48 -0
- package/skills/docker-sandbox/SKILL.md +29 -0
- package/skills/docx/SKILL.md +119 -0
- package/skills/esm/SKILL.md +116 -0
- package/skills/etetoolkit/SKILL.md +103 -0
- package/skills/event-log-tracing/SKILL.md +85 -0
- package/skills/exa-search/SKILL.md +72 -0
- package/skills/executing-plans/SKILL.md +69 -0
- package/skills/exploratory-data-analysis/SKILL.md +118 -0
- package/skills/external-context/SKILL.md +80 -0
- package/skills/fastapi/SKILL.md +30 -0
- package/skills/finishing-a-development-branch/SKILL.md +106 -0
- package/skills/flowio/SKILL.md +114 -0
- package/skills/fluidsim/SKILL.md +108 -0
- package/skills/generate-image/SKILL.md +108 -0
- package/skills/geniml/SKILL.md +117 -0
- package/skills/geomaster/SKILL.md +109 -0
- package/skills/geopandas/SKILL.md +114 -0
- package/skills/get-available-resources/SKILL.md +100 -0
- package/skills/gget/SKILL.md +111 -0
- package/skills/ginkgo-cloud-lab/SKILL.md +52 -0
- package/skills/git-master/SKILL.md +85 -0
- package/skills/glycoengineering/SKILL.md +104 -0
- package/skills/gtars/SKILL.md +104 -0
- package/skills/hackernews-frontpage/SKILL.md +46 -0
- package/skills/histolab/SKILL.md +98 -0
- package/skills/how-it-works/SKILL.md +25 -0
- package/skills/hud/SKILL.md +86 -0
- package/skills/hugging-science/SKILL.md +93 -0
- package/skills/huggingface/SKILL.md +30 -0
- package/skills/hypogenic/SKILL.md +107 -0
- package/skills/hypothesis-generation/SKILL.md +118 -0
- package/skills/imaging-data-commons/SKILL.md +119 -0
- package/skills/infographics/SKILL.md +102 -0
- package/skills/iso-13485-certification/SKILL.md +114 -0
- package/skills/knowledge-agent/SKILL.md +83 -0
- package/skills/labarchive-integration/SKILL.md +98 -0
- package/skills/lamindb/SKILL.md +119 -0
- package/skills/landsat/SKILL.md +29 -0
- package/skills/latchbio-integration/SKILL.md +118 -0
- package/skills/latex-posters/SKILL.md +112 -0
- package/skills/learn-codebase/SKILL.md +24 -0
- package/skills/learner/SKILL.md +118 -0
- package/skills/literature-review/SKILL.md +118 -0
- package/skills/live-agent-lifecycle/SKILL.md +85 -0
- package/skills/mailbox-interactive/SKILL.md +85 -0
- package/skills/make-plan/SKILL.md +59 -0
- package/skills/markdown-mermaid-writing/SKILL.md +118 -0
- package/skills/market-research-reports/SKILL.md +119 -0
- package/skills/markitdown/SKILL.md +111 -0
- package/skills/markitdown-docs/SKILL.md +28 -0
- package/skills/matchms/SKILL.md +91 -0
- package/skills/matlab/SKILL.md +118 -0
- package/skills/matplotlib/SKILL.md +30 -0
- package/skills/mcp-setup/SKILL.md +84 -0
- package/skills/medchem/SKILL.md +109 -0
- package/skills/mem-search/SKILL.md +96 -0
- package/skills/modal/SKILL.md +104 -0
- package/skills/model-routing-context/SKILL.md +85 -0
- package/skills/molecular-dynamics/SKILL.md +116 -0
- package/skills/molfeat/SKILL.md +110 -0
- package/skills/multi-perspective-review/SKILL.md +85 -0
- package/skills/networkx/SKILL.md +111 -0
- package/skills/neurokit2/SKILL.md +114 -0
- package/skills/neuropixels-analysis/SKILL.md +112 -0
- package/skills/nilearn/SKILL.md +29 -0
- package/skills/observability-reliability/SKILL.md +43 -0
- package/skills/omc-doctor/SKILL.md +86 -0
- package/skills/omc-reference/SKILL.md +119 -0
- package/skills/omc-setup/SKILL.md +82 -0
- package/skills/omc-teams/SKILL.md +81 -0
- package/skills/omero-integration/SKILL.md +111 -0
- package/skills/open-notebook/SKILL.md +100 -0
- package/skills/openephys/SKILL.md +28 -0
- package/skills/opentrons-integration/SKILL.md +110 -0
- package/skills/optimize-for-gpu/SKILL.md +119 -0
- package/skills/orchestration/SKILL.md +85 -0
- package/skills/ownership-session-security/SKILL.md +43 -0
- package/skills/paper-lookup/SKILL.md +119 -0
- package/skills/paperzilla/SKILL.md +114 -0
- package/skills/parallel-web/SKILL.md +64 -0
- package/skills/pathfinder/SKILL.md +114 -0
- package/skills/pathml/SKILL.md +98 -0
- package/skills/pdf/SKILL.md +113 -0
- package/skills/peer-review/SKILL.md +119 -0
- package/skills/pennylane/SKILL.md +119 -0
- package/skills/phylogenetics/SKILL.md +102 -0
- package/skills/pi-extension-lifecycle/SKILL.md +41 -0
- package/skills/plan/SKILL.md +66 -0
- package/skills/polars/SKILL.md +114 -0
- package/skills/polars-bio/SKILL.md +84 -0
- package/skills/pptx/SKILL.md +118 -0
- package/skills/pptx-posters/SKILL.md +112 -0
- package/skills/primekg/SKILL.md +97 -0
- package/skills/project-session-manager/SKILL.md +85 -0
- package/skills/protocolsio-integration/SKILL.md +119 -0
- package/skills/pubmed-search/SKILL.md +29 -0
- package/skills/pufferlib/SKILL.md +103 -0
- package/skills/pydeseq2/SKILL.md +106 -0
- package/skills/pydicom/SKILL.md +115 -0
- package/skills/pyhealth/SKILL.md +117 -0
- package/skills/pylabrobot/SKILL.md +100 -0
- package/skills/pymatgen/SKILL.md +28 -0
- package/skills/pymc/SKILL.md +108 -0
- package/skills/pymoo/SKILL.md +90 -0
- package/skills/pyopenms/SKILL.md +119 -0
- package/skills/pysam/SKILL.md +118 -0
- package/skills/pyspark/SKILL.md +30 -0
- package/skills/pytdc/SKILL.md +102 -0
- package/skills/pytorch/SKILL.md +31 -0
- package/skills/pytorch-lightning/SKILL.md +119 -0
- package/skills/pyzotero/SKILL.md +104 -0
- package/skills/qiskit/SKILL.md +119 -0
- package/skills/qutip/SKILL.md +111 -0
- package/skills/ralph/SKILL.md +23 -0
- package/skills/ralplan/SKILL.md +105 -0
- package/skills/rdflib/SKILL.md +29 -0
- package/skills/rdkit/SKILL.md +30 -0
- package/skills/read-only-explorer/SKILL.md +85 -0
- package/skills/receiving-code-review/SKILL.md +103 -0
- package/skills/release/SKILL.md +117 -0
- package/skills/remember/SKILL.md +39 -0
- package/skills/requesting-code-review/SKILL.md +85 -0
- package/skills/requirements-to-task-packet/SKILL.md +65 -0
- package/skills/research-grants/SKILL.md +118 -0
- package/skills/research-lookup/SKILL.md +117 -0
- package/skills/research-reproducibility/SKILL.md +28 -0
- package/skills/resource-discovery-config/SKILL.md +43 -0
- package/skills/rowan/SKILL.md +100 -0
- package/skills/runtime-state-reader/SKILL.md +46 -0
- package/skills/safe-bash/SKILL.md +85 -0
- package/skills/scanpy/SKILL.md +32 -0
- package/skills/scholar-evaluation/SKILL.md +115 -0
- package/skills/scientific-brainstorming/SKILL.md +118 -0
- package/skills/scientific-critical-thinking/SKILL.md +119 -0
- package/skills/scientific-schematics/SKILL.md +116 -0
- package/skills/scientific-slides/SKILL.md +117 -0
- package/skills/scientific-visualization/SKILL.md +109 -0
- package/skills/scientific-writing/SKILL.md +119 -0
- package/skills/scikit-bio/SKILL.md +92 -0
- package/skills/scikit-learn/SKILL.md +99 -0
- package/skills/scikit-survival/SKILL.md +110 -0
- package/skills/sciomc/SKILL.md +86 -0
- package/skills/scvelo/SKILL.md +106 -0
- package/skills/scvi-tools/SKILL.md +114 -0
- package/skills/seaborn/SKILL.md +97 -0
- package/skills/secure-agent-orchestration-review/SKILL.md +47 -0
- package/skills/self-improve/SKILL.md +119 -0
- package/skills/semantic-compression/SKILL.md +62 -0
- package/skills/setup/SKILL.md +42 -0
- package/skills/shap/SKILL.md +103 -0
- package/skills/simpy/SKILL.md +116 -0
- package/skills/skill/SKILL.md +117 -0
- package/skills/skill-search/SKILL.md +67 -0
- package/skills/skillify/SKILL.md +46 -0
- package/skills/smart-explore/SKILL.md +94 -0
- package/skills/sqlite-pandas/SKILL.md +30 -0
- package/skills/stable-baselines3/SKILL.md +86 -0
- package/skills/state-mutation-locking/SKILL.md +44 -0
- package/skills/statistical-analysis/SKILL.md +108 -0
- package/skills/statsmodels/SKILL.md +29 -0
- package/skills/subagent-driven-development/SKILL.md +89 -0
- package/skills/sympy/SKILL.md +115 -0
- package/skills/system-prompts/SKILL.md +116 -0
- package/skills/systematic-debugging/SKILL.md +119 -0
- package/skills/team/SKILL.md +85 -0
- package/skills/test-driven-development/SKILL.md +84 -0
- package/skills/tiledbvcf/SKILL.md +119 -0
- package/skills/timeline-report/SKILL.md +85 -0
- package/skills/timesfm-forecasting/SKILL.md +112 -0
- package/skills/torch-geometric/SKILL.md +118 -0
- package/skills/torchdrug/SKILL.md +118 -0
- package/skills/trace/SKILL.md +118 -0
- package/skills/transformers/SKILL.md +110 -0
- package/skills/treatment-plans/SKILL.md +119 -0
- package/skills/ui-render-performance/SKILL.md +41 -0
- package/skills/ultragoal/SKILL.md +63 -0
- package/skills/ultraqa/SKILL.md +85 -0
- package/skills/ultrawork/SKILL.md +20 -0
- package/skills/umap-learn/SKILL.md +119 -0
- package/skills/usfiscaldata/SKILL.md +118 -0
- package/skills/using-git-worktrees/SKILL.md +112 -0
- package/skills/using-superpowers/SKILL.md +85 -0
- package/skills/using-vetc/SKILL.md +92 -0
- package/skills/vaex/SKILL.md +111 -0
- package/skills/venue-templates/SKILL.md +113 -0
- package/skills/verification-before-completion/SKILL.md +88 -0
- package/skills/verification-before-done/SKILL.md +68 -0
- package/skills/verify/SKILL.md +33 -0
- package/skills/version-bump/SKILL.md +54 -0
- package/skills/vetc-analyze-ba/SKILL.md +117 -0
- package/skills/vetc-analyze-codebase/SKILL.md +118 -0
- package/skills/vetc-api-design/SKILL.md +103 -0
- package/skills/vetc-brainstorming/SKILL.md +116 -0
- package/skills/vetc-change-proposal/SKILL.md +111 -0
- package/skills/vetc-cicd/SKILL.md +113 -0
- package/skills/vetc-continuous-learning/SKILL.md +115 -0
- package/skills/vetc-deep-interview/SKILL.md +103 -0
- package/skills/vetc-docgen/SKILL.md +108 -0
- package/skills/vetc-frontend-patterns/SKILL.md +99 -0
- package/skills/vetc-iterative-retrieval/SKILL.md +110 -0
- package/skills/vetc-java-patterns/SKILL.md +113 -0
- package/skills/vetc-meta-skill-creator/SKILL.md +99 -0
- package/skills/vetc-oracle-patterns/SKILL.md +109 -0
- package/skills/vetc-performance-testing/SKILL.md +104 -0
- package/skills/vetc-pr-response/SKILL.md +106 -0
- package/skills/vetc-ralph/SKILL.md +108 -0
- package/skills/vetc-ralplan/SKILL.md +116 -0
- package/skills/vetc-receiving-review/SKILL.md +106 -0
- package/skills/vetc-reconcile-patterns/SKILL.md +117 -0
- package/skills/vetc-refactoring/SKILL.md +96 -0
- package/skills/vetc-runbook/SKILL.md +118 -0
- package/skills/vetc-sast/SKILL.md +118 -0
- package/skills/vetc-sdlc/SKILL.md +97 -0
- package/skills/vetc-security/SKILL.md +117 -0
- package/skills/vetc-spec-driven/SKILL.md +111 -0
- package/skills/vetc-spec-quality/SKILL.md +117 -0
- package/skills/vetc-systematic-debugging/SKILL.md +74 -0
- package/skills/vetc-tdd/SKILL.md +96 -0
- package/skills/vetc-thinking-pm/SKILL.md +110 -0
- package/skills/vetc-ui-visual-qa/SKILL.md +117 -0
- package/skills/vetc-verify/SKILL.md +101 -0
- package/skills/visual-verdict/SKILL.md +59 -0
- package/skills/what-if-oracle/SKILL.md +87 -0
- package/skills/widget-rendering/SKILL.md +85 -0
- package/skills/wiki/SKILL.md +69 -0
- package/skills/workspace-isolation/SKILL.md +85 -0
- package/skills/worktree-isolation/SKILL.md +85 -0
- package/skills/wowerpoint/SKILL.md +101 -0
- package/skills/writer-memory/SKILL.md +82 -0
- package/skills/writing-plans/SKILL.md +115 -0
- package/skills/writing-skills/SKILL.md +115 -0
- package/skills/xgboost/SKILL.md +29 -0
- package/skills/xgboost-ts/SKILL.md +28 -0
- package/skills/xlsx/SKILL.md +111 -0
- package/skills/zarr-python/SKILL.md +101 -0
- package/src/categories.ts +383 -0
- package/src/format.ts +104 -0
- package/src/indexer.ts +101 -0
- package/src/proactive.ts +51 -0
- package/src/scanner.ts +85 -0
- package/src/search.ts +89 -0
- package/src/strip.ts +29 -0
- package/src/synonyms.ts +83 -0
- package/src/text.ts +118 -0
- package/src/types.ts +64 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: scikit-survival
|
|
3
|
+
description: Comprehensive toolkit for survival analysis and time-to-event modeling in Python using scikit-survival. Use this skill when working with censored survival data, performing time-to-event analysis, fitting Cox models, Random Survival Forests, Gradient Boosting models, or Survival SVMs, evaluating survival predictions with concordance index or Brier score, handling competing risks, or implementing any survival analysis workflow with the scikit-survival library.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# scikit-survival: Survival Analysis in Python
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
scikit-survival is a Python library for survival analysis built on top of scikit-learn. It provides specialized tools for time-to-event analysis, handling the unique challenge of censored data where some observations are only partially known.
|
|
11
|
+
|
|
12
|
+
Survival analysis aims to establish connections between covariates and the time of an event, accounting for censored records (particularly right-censored data from studies where participants don't experience events during observation periods).
|
|
13
|
+
|
|
14
|
+
## When to Use This Skill
|
|
15
|
+
|
|
16
|
+
Use this skill when:
|
|
17
|
+
- Performing survival analysis or time-to-event modeling
|
|
18
|
+
- Working with censored data (right-censored, left-censored, or interval-censored)
|
|
19
|
+
- Fitting Cox proportional hazards models (standard or penalized)
|
|
20
|
+
- Building ensemble survival models (Random Survival Forests, Gradient Boosting)
|
|
21
|
+
- Training Survival Support Vector Machines
|
|
22
|
+
- Evaluating survival model performance (concordance index, Brier score, time-dependent AUC)
|
|
23
|
+
- Estimating Kaplan-Meier or Nelson-Aalen curves
|
|
24
|
+
- Analyzing competing risks
|
|
25
|
+
- Preprocessing survival data or handling missing values in survival datasets
|
|
26
|
+
- Conducting any analysis using the scikit-survival library
|
|
27
|
+
|
|
28
|
+
## Core Capabilities
|
|
29
|
+
|
|
30
|
+
### 1. Model Types and Selection
|
|
31
|
+
|
|
32
|
+
scikit-survival provides multiple model families, each suited for different scenarios:
|
|
33
|
+
|
|
34
|
+
#### Cox Proportional Hazards Models
|
|
35
|
+
**Use for**: Standard survival analysis with interpretable coefficients
|
|
36
|
+
- `CoxPHSurvivalAnalysis`: Basic Cox model
|
|
37
|
+
- `CoxnetSurvivalAnalysis`: Penalized Cox with elastic net for high-dimensional data
|
|
38
|
+
- `IPCRidge`: Ridge regression for accelerated failure time models
|
|
39
|
+
|
|
40
|
+
**See**: `(see docs)` for detailed guidance on Cox models, regularization, and interpretation
|
|
41
|
+
|
|
42
|
+
#### Ensemble Methods
|
|
43
|
+
**Use for**: High predictive performance with complex non-linear relationships
|
|
44
|
+
- `RandomSurvivalForest`: Robust, non-parametric ensemble method
|
|
45
|
+
|
|
46
|
+
### 2. Data Preparation and Preprocessing
|
|
47
|
+
|
|
48
|
+
Before modeling, properly prepare survival data:
|
|
49
|
+
|
|
50
|
+
#### Creating Survival Outcomes
|
|
51
|
+
```python
|
|
52
|
+
from sksurv.util import Surv
|
|
53
|
+
|
|
54
|
+
# From separate arrays
|
|
55
|
+
y = Surv.from_arrays(event=event_array, time=time_array)
|
|
56
|
+
|
|
57
|
+
# From DataFrame
|
|
58
|
+
y = Surv.from_dataframe('event', 'time', df)
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
#### Essential Preprocessing Steps
|
|
62
|
+
1. **Handle missing values**: Imputation strategies for features
|
|
63
|
+
2. **Encode categorical variables**: One-hot encoding or label encoding
|
|
64
|
+
3. **Standardize features**: Critical for SVMs and regularized Cox models
|
|
65
|
+
4. **Validate data quality**: Check for negative times, sufficient events per feature
|
|
66
|
+
5. **Train-test split**: Maintain similar censoring rates across splits
|
|
67
|
+
|
|
68
|
+
**See**: `(see docs)` for complete preprocessing workflows, data validation, and best practices
|
|
69
|
+
|
|
70
|
+
### 3. Model Evaluation
|
|
71
|
+
|
|
72
|
+
Proper evaluation is critical for survival models. Use appropriate metrics that account for censoring:
|
|
73
|
+
|
|
74
|
+
#### Concordance Index (C-index)
|
|
75
|
+
Primary metric for ranking/discrimination:
|
|
76
|
+
- **Harrell's C-index**: Use for low censoring (<40%)
|
|
77
|
+
- **Uno's C-index**: Use for moderate to high censoring (>40%) - more robust
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
from sksurv.metrics import concordance_index_censored, concordance_index_ipcw
|
|
81
|
+
|
|
82
|
+
# Harrell's C-index
|
|
83
|
+
c_harrell = concordance_index_censored(y_test['event'], y_test['time'], risk_scores)[0]
|
|
84
|
+
|
|
85
|
+
# Uno's C-index (recommended)
|
|
86
|
+
c_uno = concordance_index_ipcw(y_train, y_test, risk_scores)[0]
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
#### Time-Dependent AUC
|
|
90
|
+
Evaluate discrimination at specific time points:
|
|
91
|
+
|
|
92
|
+
```python
|
|
93
|
+
from sksurv.metrics import cumulative_dynamic_auc
|
|
94
|
+
|
|
95
|
+
times = [365, 730, 1095] # 1, 2, 3 years
|
|
96
|
+
auc, mean_auc = cumulative_dynamic_auc(y_train, y_test, risk_scores, times)
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
#### Brier Score
|
|
100
|
+
|
|
101
|
+
### 4. Competing Risks Analysis
|
|
102
|
+
|
|
103
|
+
Handle situations with multiple mutually exclusive event types:
|
|
104
|
+
|
|
105
|
+
```python
|
|
106
|
+
from sksurv.nonparametric import cumulative_incidence_competing_risks
|
|
107
|
+
|
|
108
|
+
# Estimate cumulative incidence for each event type
|
|
109
|
+
time_points, cif_event1, cif_event2 = cumulative_incidence_competing_risks(y)
|
|
110
|
+
```
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sciomc
|
|
3
|
+
description: Orchestrate parallel scientist agents for comprehensive analysis with AUTO mode
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Research Skill
|
|
7
|
+
|
|
8
|
+
Orchestrate parallel scientist agents for comprehensive research workflows with optional AUTO mode for fully autonomous execution.
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
Research is a multi-stage workflow that decomposes complex research goals into parallel investigations:
|
|
13
|
+
|
|
14
|
+
1. **Decomposition** - Break research goal into independent stages/hypotheses
|
|
15
|
+
2. **Execution** - Run parallel scientist agents on each stage
|
|
16
|
+
3. **Verification** - Cross-validate findings, check consistency
|
|
17
|
+
4. **Synthesis** - Aggregate results into comprehensive report
|
|
18
|
+
|
|
19
|
+
## Usage Examples
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
sciomc <goal> # Standard research with user checkpoints
|
|
23
|
+
sciomc AUTO: <goal> # Fully autonomous until complete
|
|
24
|
+
sciomc status # Check current research session status
|
|
25
|
+
sciomc resume # Resume interrupted research session
|
|
26
|
+
sciomc list # List all research sessions
|
|
27
|
+
sciomc report <session-id> # Generate report for session
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Quick Examples
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
sciomc What are the performance characteristics of different sorting algorithms?
|
|
34
|
+
sciomc AUTO: Analyze authentication patterns in this codebase
|
|
35
|
+
sciomc How does the error handling work across the API layer?
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Research Protocol
|
|
39
|
+
|
|
40
|
+
### Stage Decomposition Pattern
|
|
41
|
+
|
|
42
|
+
When given a research goal, decompose into 3-7 independent stages:
|
|
43
|
+
|
|
44
|
+
```markdown
|
|
45
|
+
## Research Decomposition
|
|
46
|
+
|
|
47
|
+
**Goal:** <original research goal>
|
|
48
|
+
|
|
49
|
+
### Stage 1: <stage-name>
|
|
50
|
+
- **Focus:** What this stage investigates
|
|
51
|
+
- **Hypothesis:** Expected finding (if applicable)
|
|
52
|
+
- **Scope:** Files/areas to examine
|
|
53
|
+
- **Tier:** LOW | MEDIUM | HIGH
|
|
54
|
+
|
|
55
|
+
### Stage 2: <stage-name>
|
|
56
|
+
...
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Parallel Scientist Invocation
|
|
60
|
+
|
|
61
|
+
Fire independent stages in parallel via Task tool:
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
// Stage 1 - Simple data gathering
|
|
65
|
+
Task(subagent_type="oh-my-claudecode:scientist", model="haiku", prompt="[RESEARCH_STAGE:1] Investigate...")
|
|
66
|
+
|
|
67
|
+
// Stage 2 - Standard analysis
|
|
68
|
+
Task(subagent_type="oh-my-claudecode:scientist", model="sonnet", prompt="[RESEARCH_STAGE:2] Analyze...")
|
|
69
|
+
|
|
70
|
+
// Stage 3 - Complex reasoning
|
|
71
|
+
Task(subagent_type="oh-my-claudecode:scientist", model="opus", prompt="[RESEARCH_STAGE:3] Deep analysis of...")
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Smart Model Routing
|
|
75
|
+
|
|
76
|
+
**CRITICAL: Always pass `model` parameter explicitly!**
|
|
77
|
+
|
|
78
|
+
| Task Complexity | Agent | Model | Use For |
|
|
79
|
+
|-----------------|-------|-------|---------|
|
|
80
|
+
| Data gathering | `scientist` (model=haiku) | haiku | File enumeration, pattern counting, simple lookups |
|
|
81
|
+
| Standard analysis | `scientist` | sonnet | Code analysis, pattern detection, documentation review |
|
|
82
|
+
| Complex reasoning | `scientist` | opus | Architecture analysis, cross-cutting concerns, hypothesis validation |
|
|
83
|
+
|
|
84
|
+
### Routing Decision Guide
|
|
85
|
+
|
|
86
|
+
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: scvelo
|
|
3
|
+
description: RNA velocity analysis with scVelo. Estimate cell state transitions from unspliced/spliced mRNA dynamics, infer trajectory directions, compute latent time, and identify driver genes in single-cell RNA-seq data. Complements Scanpy/scVI-tools for trajectory inference.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# scVelo — RNA Velocity Analysis
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
scVelo is the leading Python package for RNA velocity analysis in single-cell RNA-seq data. It infers cell state transitions by modeling the kinetics of mRNA splicing — using the ratio of unspliced (pre-mRNA) to spliced (mature mRNA) abundances to determine whether a gene is being upregulated or downregulated in each cell. This allows reconstruction of developmental trajectories and identification of cell fate decisions without requiring time-course data.
|
|
11
|
+
|
|
12
|
+
**Installation:** `pip install scvelo`
|
|
13
|
+
|
|
14
|
+
**Key resources:**
|
|
15
|
+
- Documentation: https://scvelo.readthedocs.io/
|
|
16
|
+
- GitHub: https://github.com/theislab/scvelo
|
|
17
|
+
- Paper: Bergen et al. (2020) Nature Biotechnology. PMID: 32747759
|
|
18
|
+
|
|
19
|
+
## When to Use This Skill
|
|
20
|
+
|
|
21
|
+
Use scVelo when:
|
|
22
|
+
|
|
23
|
+
- **Trajectory inference from snapshot data**: Determine which direction cells are differentiating
|
|
24
|
+
- **Cell fate prediction**: Identify progenitor cells and their downstream fates
|
|
25
|
+
- **Driver gene identification**: Find genes whose dynamics best explain observed trajectories
|
|
26
|
+
- **Developmental biology**: Model hematopoiesis, neurogenesis, epithelial-to-mesenchymal transitions
|
|
27
|
+
- **Latent time estimation**: Order cells along a pseudotime derived from splicing dynamics
|
|
28
|
+
- **Complement to Scanpy**: Add directional information to UMAP embeddings
|
|
29
|
+
|
|
30
|
+
## Prerequisites
|
|
31
|
+
|
|
32
|
+
scVelo requires count matrices for both **unspliced** and **spliced** RNA. These are generated by:
|
|
33
|
+
1. **STARsolo** or **kallisto|bustools** with `lamanno` mode
|
|
34
|
+
2. **velocyto** CLI: `velocyto run10x` / `velocyto run`
|
|
35
|
+
3. **alevin-fry** / **simpleaf** with spliced/unspliced output
|
|
36
|
+
|
|
37
|
+
Data is stored in an `AnnData` object with `layers["spliced"]` and `layers["unspliced"]`.
|
|
38
|
+
|
|
39
|
+
## Standard RNA Velocity Workflow
|
|
40
|
+
|
|
41
|
+
### 1. Setup and Data Loading
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
import scvelo as scv
|
|
45
|
+
import scanpy as sc
|
|
46
|
+
import numpy as np
|
|
47
|
+
import matplotlib.pyplot as plt
|
|
48
|
+
|
|
49
|
+
# Configure settings
|
|
50
|
+
scv.settings.verbosity = 3 # Show computation steps
|
|
51
|
+
scv.settings.presenter_view = True
|
|
52
|
+
scv.settings.set_figure_params('scvelo')
|
|
53
|
+
|
|
54
|
+
# Load data (AnnData with spliced/unspliced layers)
|
|
55
|
+
# Option A: Load from loom (velocyto output)
|
|
56
|
+
adata = scv.read("cellranger_output.loom", cache=True)
|
|
57
|
+
|
|
58
|
+
# Option B: Merge velocyto loom with Scanpy-processed AnnData
|
|
59
|
+
adata_processed = sc.read_h5ad("processed.h5ad") # Has UMAP, clusters
|
|
60
|
+
adata_velocity = scv.read("velocyto.loom")
|
|
61
|
+
adata = scv.utils.merge(adata_processed, adata_velocity)
|
|
62
|
+
|
|
63
|
+
# Verify layers
|
|
64
|
+
print(adata)
|
|
65
|
+
# obs × var: N × G
|
|
66
|
+
# layers: 'spliced', 'unspliced' (required)
|
|
67
|
+
# obsm['X_umap'] (required for visualization)
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### 2. Preprocessing
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
# Filter and normalize (follows Scanpy conventions)
|
|
74
|
+
scv.pp.filter_and_normalize(
|
|
75
|
+
adata,
|
|
76
|
+
min_shared_counts=20, # Minimum counts in spliced+unspliced
|
|
77
|
+
n_top_genes=2000 # Top highly variable genes
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
# Compute first and second order moments (means and variances)
|
|
81
|
+
# knn_connectivities must be computed first
|
|
82
|
+
sc.pp.neighbors(adata, n_neighbors=30, n_pcs=30)
|
|
83
|
+
scv.pp.moments(
|
|
84
|
+
adata,
|
|
85
|
+
n_pcs=30,
|
|
86
|
+
n_neighbors=30
|
|
87
|
+
)
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### 3. Velocity Estimation — Stochastic Model
|
|
91
|
+
|
|
92
|
+
The stochastic model is fast and suitable for exploratory analysis:
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
# Stochastic velocity (faster, less accurate)
|
|
96
|
+
scv.tl.velocity(adata, mode='stochastic')
|
|
97
|
+
scv.tl.velocity_graph(adata)
|
|
98
|
+
|
|
99
|
+
# Visualize
|
|
100
|
+
scv.pl.velocity_embedding_stream(
|
|
101
|
+
adata,
|
|
102
|
+
basis='umap',
|
|
103
|
+
color='leiden',
|
|
104
|
+
title="RNA Velocity (Stochastic)"
|
|
105
|
+
)
|
|
106
|
+
```
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: scvi-tools
|
|
3
|
+
description: Deep generative models for single-cell omics. Use when you need probabilistic batch correction (scVI), transfer learning, differential expression with uncertainty, or multi-modal integration (TOTALVI, MultiVI). Best for advanced modeling, batch effects, multimodal data. For standard analysis pipelines use scanpy.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# scvi-tools
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
scvi-tools is a comprehensive Python framework for probabilistic models in single-cell genomics. Built on PyTorch and PyTorch Lightning, it provides deep generative models using variational inference for analyzing diverse single-cell data modalities.
|
|
11
|
+
|
|
12
|
+
## When to Use This Skill
|
|
13
|
+
|
|
14
|
+
Use this skill when:
|
|
15
|
+
- Analyzing single-cell RNA-seq data (dimensionality reduction, batch correction, integration)
|
|
16
|
+
- Working with single-cell ATAC-seq or chromatin accessibility data
|
|
17
|
+
- Integrating multimodal data (CITE-seq, multiome, paired/unpaired datasets)
|
|
18
|
+
- Analyzing spatial transcriptomics data (deconvolution, spatial mapping)
|
|
19
|
+
- Performing differential expression analysis on single-cell data
|
|
20
|
+
- Conducting cell type annotation or transfer learning tasks
|
|
21
|
+
- Working with specialized single-cell modalities (methylation, cytometry, RNA velocity)
|
|
22
|
+
- Building custom probabilistic models for single-cell analysis
|
|
23
|
+
|
|
24
|
+
## Core Capabilities
|
|
25
|
+
|
|
26
|
+
scvi-tools provides models organized by data modality:
|
|
27
|
+
|
|
28
|
+
### 1. Single-Cell RNA-seq Analysis
|
|
29
|
+
Core models for expression analysis, batch correction, and integration. See `(see docs)` for:
|
|
30
|
+
- **scVI**: Unsupervised dimensionality reduction and batch correction
|
|
31
|
+
- **scANVI**: Semi-supervised cell type annotation and integration
|
|
32
|
+
- **AUTOZI**: Zero-inflation detection and modeling
|
|
33
|
+
- **VeloVI**: RNA velocity analysis
|
|
34
|
+
- **contrastiveVI**: Perturbation effect isolation
|
|
35
|
+
|
|
36
|
+
### 2. Chromatin Accessibility (ATAC-seq)
|
|
37
|
+
Models for analyzing single-cell chromatin data. See `(see docs)` for:
|
|
38
|
+
- **PeakVI**: Peak-based ATAC-seq analysis and integration
|
|
39
|
+
- **PoissonVI**: Quantitative fragment count modeling
|
|
40
|
+
- **scBasset**: Deep learning approach with motif analysis
|
|
41
|
+
|
|
42
|
+
### 3. Multimodal & Multi-omics Integration
|
|
43
|
+
Joint analysis of multiple data types. See `(see docs)` for:
|
|
44
|
+
- **totalVI**: CITE-seq protein and RNA joint modeling
|
|
45
|
+
- **MultiVI**: Paired and unpaired multi-omic integration
|
|
46
|
+
- **MrVI**: Multi-resolution cross-sample analysis
|
|
47
|
+
|
|
48
|
+
### 4. Spatial Transcriptomics
|
|
49
|
+
Spatially-resolved transcriptomics analysis. See `(see docs)` for:
|
|
50
|
+
- **DestVI**: Multi-resolution spatial deconvolution
|
|
51
|
+
- **Stereoscope**: Cell type deconvolution
|
|
52
|
+
- **Tangram**: Spatial mapping and integration
|
|
53
|
+
- **scVIVA**: Cell-environment relationship analysis
|
|
54
|
+
|
|
55
|
+
### 5. Specialized Modalities
|
|
56
|
+
Additional specialized analysis tools. See `(see docs)` for:
|
|
57
|
+
- **MethylVI/MethylANVI**: Single-cell methylation analysis
|
|
58
|
+
- **CytoVI**: Flow/mass cytometry batch correction
|
|
59
|
+
- **Solo**: Doublet detection
|
|
60
|
+
- **CellAssign**: Marker-based cell type annotation
|
|
61
|
+
|
|
62
|
+
## Typical Workflow
|
|
63
|
+
|
|
64
|
+
All scvi-tools models follow a consistent API pattern:
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
# 2. Register data with model (specify layers, covariates)
|
|
68
|
+
scvi.model.SCVI.setup_anndata(
|
|
69
|
+
adata,
|
|
70
|
+
layer="counts", # Use raw counts, not log-normalized
|
|
71
|
+
batch_key="batch",
|
|
72
|
+
categorical_covariate_keys=["donor"],
|
|
73
|
+
continuous_covariate_keys=["percent_mito"]
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
# 3. Create and train model
|
|
77
|
+
model = scvi.model.SCVI(adata)
|
|
78
|
+
model.train()
|
|
79
|
+
|
|
80
|
+
# 4. Extract latent representations and normalized values
|
|
81
|
+
latent = model.get_latent_representation()
|
|
82
|
+
normalized = model.get_normalized_expression(library_size=1e4)
|
|
83
|
+
|
|
84
|
+
# 5. Store in AnnData for downstream analysis
|
|
85
|
+
adata.obsm["X_scVI"] = latent
|
|
86
|
+
adata.layers["scvi_normalized"] = normalized
|
|
87
|
+
|
|
88
|
+
# 6. Downstream analysis with scanpy
|
|
89
|
+
sc.pp.neighbors(adata, use_rep="X_scVI")
|
|
90
|
+
sc.tl.umap(adata)
|
|
91
|
+
sc.tl.leiden(adata)
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**Key Design Principles:**
|
|
95
|
+
- **Raw counts required**: Models expect unnormalized count data for optimal performance
|
|
96
|
+
- **Unified API**: Consistent interface across all models (setup → train → extract)
|
|
97
|
+
- **AnnData-centric**: Seamless integration with the scanpy ecosystem
|
|
98
|
+
- **GPU acceleration**: Automatic utilization of available GPUs
|
|
99
|
+
- **Batch correction**: Handle technical variation through covariate registration
|
|
100
|
+
|
|
101
|
+
## Common Analysis Tasks
|
|
102
|
+
|
|
103
|
+
### Differential Expression
|
|
104
|
+
Probabilistic DE analysis using the learned generative models:
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
de_results = model.differential_expression(
|
|
108
|
+
groupby="cell_type",
|
|
109
|
+
group1="TypeA",
|
|
110
|
+
group2="TypeB",
|
|
111
|
+
mode="change", # Use composite hypothesis testing
|
|
112
|
+
delta=0.25 # Minimum effect size threshold
|
|
113
|
+
)
|
|
114
|
+
```
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: seaborn
|
|
3
|
+
description: Statistical visualization with pandas integration. Use for quick exploration of distributions, relationships, and categorical comparisons with attractive defaults. Best for box plots, violin plots, pair plots, heatmaps. Built on matplotlib. For interactive plots use plotly; for publication styling use scientific-visualization.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Seaborn Statistical Visualization
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Seaborn is a Python visualization library for creating publication-quality statistical graphics. Use this skill for dataset-oriented plotting, multivariate analysis, automatic statistical estimation, and complex multi-panel figures with minimal code.
|
|
11
|
+
|
|
12
|
+
## Design Philosophy
|
|
13
|
+
|
|
14
|
+
Seaborn follows these core principles:
|
|
15
|
+
|
|
16
|
+
1. **Dataset-oriented**: Work directly with DataFrames and named variables rather than abstract coordinates
|
|
17
|
+
2. **Semantic mapping**: Automatically translate data values into visual properties (colors, sizes, styles)
|
|
18
|
+
3. **Statistical awareness**: Built-in aggregation, error estimation, and confidence intervals
|
|
19
|
+
4. **Aesthetic defaults**: Publication-ready themes and color palettes out of the box
|
|
20
|
+
5. **Matplotlib integration**: Full compatibility with matplotlib customization when needed
|
|
21
|
+
|
|
22
|
+
## Quick Start
|
|
23
|
+
|
|
24
|
+
```python
|
|
25
|
+
import seaborn as sns
|
|
26
|
+
import matplotlib.pyplot as plt
|
|
27
|
+
import pandas as pd
|
|
28
|
+
|
|
29
|
+
# Load example dataset
|
|
30
|
+
df = sns.load_dataset('tips')
|
|
31
|
+
|
|
32
|
+
# Create a simple visualization
|
|
33
|
+
sns.scatterplot(data=df, x='total_bill', y='tip', hue='day')
|
|
34
|
+
plt.show()
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Core Plotting Interfaces
|
|
38
|
+
|
|
39
|
+
### Function Interface (Traditional)
|
|
40
|
+
|
|
41
|
+
The function interface provides specialized plotting functions organized by visualization type. Each category has **axes-level** functions (plot to single axes) and **figure-level** functions (manage entire figure with faceting).
|
|
42
|
+
|
|
43
|
+
**When to use:**
|
|
44
|
+
- Quick exploratory analysis
|
|
45
|
+
- Single-purpose visualizations
|
|
46
|
+
- When you need a specific plot type
|
|
47
|
+
|
|
48
|
+
### Objects Interface (Modern)
|
|
49
|
+
|
|
50
|
+
The `seaborn.objects` interface provides a declarative, composable API similar to ggplot2. Build visualizations by chaining methods to specify data mappings, marks, transformations, and scales.
|
|
51
|
+
|
|
52
|
+
**When to use:**
|
|
53
|
+
- Complex layered visualizations
|
|
54
|
+
- When you need fine-grained control over transformations
|
|
55
|
+
- Building custom plot types
|
|
56
|
+
- Programmatic plot generation
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
from seaborn import objects as so
|
|
60
|
+
|
|
61
|
+
# Declarative syntax
|
|
62
|
+
(
|
|
63
|
+
so.Plot(data=df, x='total_bill', y='tip')
|
|
64
|
+
.add(so.Dot(), color='day')
|
|
65
|
+
.add(so.Line(), so.PolyFit())
|
|
66
|
+
)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Plotting Functions by Category
|
|
70
|
+
|
|
71
|
+
### Relational Plots (Relationships Between Variables)
|
|
72
|
+
|
|
73
|
+
**Use for:** Exploring how two or more variables relate to each other
|
|
74
|
+
|
|
75
|
+
- `scatterplot()` - Display individual observations as points
|
|
76
|
+
- `lineplot()` - Show trends and changes (automatically aggregates and computes CI)
|
|
77
|
+
- `relplot()` - Figure-level interface with automatic faceting
|
|
78
|
+
|
|
79
|
+
**Key parameters:**
|
|
80
|
+
- `x`, `y` - Primary variables
|
|
81
|
+
- `hue` - Color encoding for additional categorical/continuous variable
|
|
82
|
+
- `size` - Point/line size encoding
|
|
83
|
+
- `style` - Marker/line style encoding
|
|
84
|
+
- `col`, `row` - Facet into multiple subplots (figure-level only)
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
# Scatter with multiple semantic mappings
|
|
88
|
+
sns.scatterplot(data=df, x='total_bill', y='tip',
|
|
89
|
+
hue='time', size='size', style='sex')
|
|
90
|
+
|
|
91
|
+
# Line plot with confidence intervals
|
|
92
|
+
sns.lineplot(data=timeseries, x='date', y='value', hue='category')
|
|
93
|
+
|
|
94
|
+
# Faceted relational plot
|
|
95
|
+
sns.relplot(data=df, x='total_bill', y='tip',
|
|
96
|
+
col='time', row='sex', hue='smoker', kind='scatter')
|
|
97
|
+
```
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: secure-agent-orchestration-review
|
|
3
|
+
description: Use when reviewing delegation, skill loading, tool access, worker prompts, artifacts, runtime config, state, ownership, or subprocess execution.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
# secure-agent-orchestration-review
|
|
8
|
+
|
|
9
|
+
Core principle: every delegated worker crosses trust boundaries. Safe orchestration requires contained paths, explicit ownership, scoped tools, non-invasive defaults, and prompt-injection resistance.
|
|
10
|
+
|
|
11
|
+
Distilled from detailed reads of security notice, insecure-defaults, sharp-edges, differential-review, guardrail, and skill quality patterns.
|
|
12
|
+
|
|
13
|
+
## Trust Boundaries
|
|
14
|
+
|
|
15
|
+
Review:
|
|
16
|
+
|
|
17
|
+
- parent session ↔ child Pi worker;
|
|
18
|
+
- user prompt ↔ generated task packet;
|
|
19
|
+
- project skills ↔ package skills;
|
|
20
|
+
- global config ↔ project config;
|
|
21
|
+
- artifacts/logs ↔ future prompts/UI;
|
|
22
|
+
- mailbox/respond/steer/cancel ↔ session ownership;
|
|
23
|
+
- external skills/docs ↔ prompt injection/tool poisoning;
|
|
24
|
+
- runtime env/CLI args ↔ provider/model behavior.
|
|
25
|
+
|
|
26
|
+
## Must-Check Findings
|
|
27
|
+
|
|
28
|
+
- Unsafe defaults: scaffold mode unexpectedly enabled, dangerous limits, missing depth guards, overbroad tools.
|
|
29
|
+
- Path containment: cwd override escape, symlink traversal, unsafe skill names, absolute path leakage.
|
|
30
|
+
- Prompt injection: untrusted output treated as instruction, skill metadata overtrusted, missing precedence text.
|
|
31
|
+
- Secrets: env/config/log/artifact/diagnostic leakage.
|
|
32
|
+
- Destructive commands: delete/prune/reset/force push without explicit confirmation.
|
|
33
|
+
- Ownership races: authorization checked outside lock, stale task/manifest written after re-read.
|
|
34
|
+
- Supply chain: external skill content imported without review, unknown tool requirements, hidden commands.
|
|
35
|
+
|
|
36
|
+
## Secure Defaults for pi-crew
|
|
37
|
+
|
|
38
|
+
- Real execution should be explicit and disable-able, but generated config must not accidentally block normal workflows.
|
|
39
|
+
- Project overrides should be contained to the project root.
|
|
40
|
+
- Missing/invalid config should fall back safely.
|
|
41
|
+
- Skills should be loaded by safe name and source-labeled without absolute path disclosure.
|
|
42
|
+
- Worker prompts should state instruction precedence and treat artifacts as data.
|
|
43
|
+
|
|
44
|
+
## Finding Format
|
|
45
|
+
|
|
46
|
+
Include severity, path/symbol, scenario, fix, and verification. Separate must-fix security issues from hardening suggestions.
|
|
47
|
+
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: self-improve
|
|
3
|
+
description: Autonomous evolutionary code improvement engine with tournament selection
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Self-Improvement Orchestrator
|
|
7
|
+
|
|
8
|
+
You are the **loop controller** for the self-improvement system. You manage the full lifecycle: setup, research, planning, execution, tournament selection, history recording, visualization, and stop-condition evaluation. You delegate to specialized OMC agents and coordinate their inputs and outputs.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Autonomous Execution Policy
|
|
13
|
+
|
|
14
|
+
**NEVER stop or pause to ask the user during the improvement loop.** Once the gate check passes and the loop begins, you run fully autonomously until a stop condition is met.
|
|
15
|
+
|
|
16
|
+
- **Do not ask for confirmation** between iterations or between steps within an iteration.
|
|
17
|
+
- **Do not summarize and wait** — execute the next step immediately.
|
|
18
|
+
- **On agent failure**: retry once, then skip that agent and continue with remaining agents. Log the failure in iteration history.
|
|
19
|
+
- **On all plans rejected**: log it, continue to the next iteration automatically.
|
|
20
|
+
- **On all executors failing**: log it, continue to the next iteration automatically.
|
|
21
|
+
- **On benchmark errors**: log the error, mark the executor as failed, continue with other executors.
|
|
22
|
+
- **The only things that stop the loop** are the stop conditions in Step 11.
|
|
23
|
+
- **Trust boundary**: The loop runs benchmark commands as-is inside the target repo. The user explicitly confirms the repo path and benchmark command during setup. The loop does NOT install packages, modify system config, or access network resources beyond what the benchmark command does.
|
|
24
|
+
- **Sealed files**: validate.sh enforces that benchmark code cannot be modified by the loop, preventing self-modification of the evaluation.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## State Tracking
|
|
29
|
+
|
|
30
|
+
Self-improve artifacts live under a resolved root returned by `scripts/resolve-paths.mjs`.
|
|
31
|
+
|
|
32
|
+
- New runs default to `.omc/self-improve/topics/default/`.
|
|
33
|
+
- When the user provides a topic or slug, use `.omc/self-improve/topics/{topic_slug}/`.
|
|
34
|
+
- Legacy single-track state at `.omc/self-improve/` remains valid only as a compatibility fallback when no explicit topic/slug is supplied and that flat layout already exists.
|
|
35
|
+
|
|
36
|
+
Treat `<self-improve-root>/` below as that resolved root:
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
<self-improve-root>/
|
|
40
|
+
├── config/ # User configuration
|
|
41
|
+
│ ├── settings.json # agents, benchmark, thresholds, sealed_files
|
|
42
|
+
│ ├── goal.md # Improvement objective + target metric
|
|
43
|
+
|
|
44
|
+
## Agent Mapping
|
|
45
|
+
|
|
46
|
+
All augmentations delivered via Task description context at spawn time. No modifications to existing agent .md files.
|
|
47
|
+
|
|
48
|
+
| Step | Role | OMC Agent | Model |
|
|
49
|
+
|------|------|-----------|-------|
|
|
50
|
+
| Research | Codebase analysis + hypothesis generation | general-purpose Agent | opus |
|
|
51
|
+
| Planning | Hypothesis → structured plan | oh-my-claudecode:planner | opus |
|
|
52
|
+
| Architecture Review | 6-point plan review | oh-my-claudecode:architect | opus |
|
|
53
|
+
| Critic Review | Harness rule enforcement | oh-my-claudecode:critic | opus |
|
|
54
|
+
| Execution | Implement plan + run benchmark | oh-my-claudecode:executor | opus |
|
|
55
|
+
| Git Operations | Atomic merge/tag/PR | oh-my-claudecode:git-master | sonnet |
|
|
56
|
+
| Goal Setup | Interactive interview | (directly in this skill) | N/A |
|
|
57
|
+
| Benchmark Setup | Create + validate benchmark | custom agent | opus |
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
## Inputs
|
|
61
|
+
|
|
62
|
+
Read these files at startup and at the beginning of each iteration:
|
|
63
|
+
|
|
64
|
+
| File | Purpose |
|
|
65
|
+
|---|---|
|
|
66
|
+
| `<self-improve-root>/config/settings.json` | User config: `number_of_agents`, `benchmark_command`, `benchmark_format`, `benchmark_direction`, `max_iterations`, `plateau_threshold`, `plateau_window`, `target_value`, `primary_metric`, `sealed_files`, `regression_threshold`, `circuit_breaker_threshold`, `target_branch`, `current_repo_url`, `fork_url`, `upstream_url`, `topic_slug` |
|
|
67
|
+
| `<self-improve-root>/state/agent-settings.json` | Runtime: `iterations`, `best_score`, `plateau_consecutive_count`, `circuit_breaker_count`, `status`, `goal_slug` (derived: lowercase underscore from goal objective, persisted for cross-session consistency) |
|
|
68
|
+
| `<self-improve-root>/state/iteration_state.json` | Per-iteration progress for resumability |
|
|
69
|
+
| `<self-improve-root>/config/goal.md` | Improvement objective, target metric, scope |
|
|
70
|
+
| `<self-improve-root>/config/harness.md` | Guardrail rules (H001, H002, H003) |
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Setup Phase
|
|
75
|
+
|
|
76
|
+
1. Check if target repo path exists. If not configured, ask user for the path to the repository to improve.
|
|
77
|
+
2. Resolve `<self-improve-root>` by running `node {skill_dir}/scripts/resolve-paths.mjs --project-root {repo_path} [--topic "..."] [--slug "..."] --ensure-dirs`.
|
|
78
|
+
3. Create the `<self-improve-root>/` directory structure by copying from `templates/` in this skill directory into the resolved `config/` root.
|
|
79
|
+
4. Read `<self-improve-root>/state/agent-settings.json`. Check `si_setting_goal`, `si_setting_benchmark`, `si_setting_harness`.
|
|
80
|
+
4. **Trust confirmation** (mandatory, cannot be skipped):
|
|
81
|
+
a. If `trust_confirmed` is already `true` in agent-settings.json, skip to step 5 (resume path).
|
|
82
|
+
b. Display the target repo path and ask user to confirm:
|
|
83
|
+
`"Self-improve will run benchmark commands inside {repo_path}. This executes arbitrary code in that repository. Confirm? [yes/no]"`
|
|
84
|
+
c. If user declines: abort setup and exit. Do NOT proceed.
|
|
85
|
+
d. Record consent: set `trust_confirmed: true` in agent-settings.json.
|
|
86
|
+
5. Persist `topic_slug` into `config/settings.json` when the resolved root is topic-scoped so future resumes stay on the same track.
|
|
87
|
+
6. If goal not set → read `si-goal-clarifier.md` from this skill directory and run the 4-dimension Socratic interview directly in this context (Objective, Metric, Target, Scope). Write result to `<self-improve-root>/config/goal.md`.
|
|
88
|
+
6. If benchmark not set → read `si-benchmark-builder.md` from this skill directory, spawn a custom Agent(model=opus) with its content as prompt. The agent surveys the repo, creates or wraps a benchmark, validates 3x, and records baseline.
|
|
89
|
+
|
|
90
|
+
## Git Strategy
|
|
91
|
+
|
|
92
|
+
All git operations happen inside the target repo, NOT in the OMC project root.
|
|
93
|
+
|
|
94
|
+
- **Improvement branch**: `improve/{goal_slug}` — accumulates winning changes only.
|
|
95
|
+
- **Experiment branches**: `experiment/round_{n}_executor_{id}` — short-lived, per executor.
|
|
96
|
+
- **Archive tags**: `archive/round_{n}_executor_{id}` — losing branches tagged before deletion.
|
|
97
|
+
- **Worktree setup** (SKILL.md creates before each executor):
|
|
98
|
+
```
|
|
99
|
+
git -C {repo_path} worktree add worktrees/round_{n}_executor_{id} -b experiment/round_{n}_executor_{id} improve/{goal_slug}
|
|
100
|
+
```
|
|
101
|
+
- **Winner merges** via `oh-my-claudecode:git-master`:
|
|
102
|
+
```
|
|
103
|
+
Merge experiment/round_{n}_executor_{winner_id} into improve/{goal_slug} with --no-ff
|
|
104
|
+
Message: "Iteration {n}: {hypothesis} (score: {before} → {after})"
|
|
105
|
+
|
|
106
|
+
## Improvement Loop
|
|
107
|
+
|
|
108
|
+
**Gate**: All settings must be true. Once the gate passes, execute continuously without stopping.
|
|
109
|
+
|
|
110
|
+
Update `state_write(mode='self-improve', active=true, status="running")`.
|
|
111
|
+
|
|
112
|
+
### Step 0 — Stale Worktree Cleanup (mandatory, runs every iteration)
|
|
113
|
+
|
|
114
|
+
**PREREQUISITE**: This step MUST run to completion before any other step, including resume logic. It is idempotent and safe to run multiple times.
|
|
115
|
+
|
|
116
|
+
1. List all worktrees in the target repo: `git -C {repo_path} worktree list`
|
|
117
|
+
2. For any worktree matching `worktrees/round_*` that does NOT belong to the current iteration: remove it with `git -C {repo_path} worktree remove {path} --force`
|
|
118
|
+
|
|
119
|
+
|