Closed-Loop CLI
mshale-loop v0.1.0 — the prediction-experiment-feedback CLI. Queries mshale-api for top protocol recommendations, manages multi-round optimization campaigns, and triggers model retraining when new outcome data arrives. State is stored locally at ~/.mshale/campaigns.json.
Loop Iteration
Recommend
Query mshale-api for the top N protocols for a given target cell state transition. Returns ranked ProtocolSpec JSON files.
Run
[Wet lab] Run the recommended protocols. Measure efficiency at the defined endpoint (e.g. MAP2+ at day 21).
Submit
Submit the measured efficiency back to mshale-api. Triggers Welford running mean update. Appends outcome to corpus.
Retrain
When ≥10 new outcomes are accumulated, mshale-model retraining is triggered automatically. New model artifact stored in S3.
Converge
Monitor C-index improvement across iterations. Alert when improvement < 0.01 over last 50 records — signals data-limited or architecture-limited regime.
Quickstart
pip install mshale-loop export MSHALE_API_BASE=https://api.mishale.bio export MSHALE_API_KEY=msk_... # Start a new optimization campaign mshale-loop campaign create \ --target "fibroblast → neuron" \ --species human \ --budget 10 # Get top 3 protocol recommendations mshale-loop recommend \ --campaign my-campaign \ --top 3 # Submit a wet-lab result mshale-loop submit \ --campaign my-campaign \ --spec protocol_rank1.json \ --efficiency 0.23 \ --metric MAP2_positive \ --confidence high # Check campaign status mshale-loop campaign show my-campaign # View C-index improvement history mshale-loop history --campaign my-campaign
CLI Reference
| Command | Description |
|---|---|
| mshale-loop recommend | Get top N protocol recommendations from mshale-api |
| mshale-loop submit | Submit a wet-lab outcome (efficiency + metric + confidence) |
| mshale-loop campaign create | Create a new optimization campaign with target + budget |
| mshale-loop campaign list | List all campaigns and their status |
| mshale-loop campaign show <id> | Show campaign detail: rounds, best efficiency, C-index history |
| mshale-loop status | Show API connection status and model version |
| mshale-loop history | View outcome submission history for a campaign |
| mshale-loop retrain | Manually trigger mshale-model retraining (usually automatic) |
Python API
from mshale_loop.campaign import create_campaign, get_campaign, record_result
from mshale_loop.client import MshaleClient
client = MshaleClient(
api_base="https://api.mishale.bio",
api_key="msk_...",
)
# Create campaign (stored at ~/.mshale/campaigns.json)
campaign = create_campaign(
name="fibroblast-neuron-q1",
target="fibroblast → neuron",
species="human",
budget=10,
)
# Get recommendations
recs = client.recommend(campaign_id=campaign.id, top_n=3)
for r in recs:
print(r.protocol_id, r.predicted_score)
# Record a wet-lab result
updated = record_result(
campaign_id=campaign.id,
protocol_id="prot_abc123",
efficiency=0.23,
metric="MAP2_positive",
)
print(f"Best efficiency so far: {updated.best_efficiency:.2f}")Convergence Monitoring
mshale-loop monitors C-index improvement after each retrain event. Two convergence signals:
Data-limited
Signal: C-index improvement < 0.01 over last 50 records
Action: Broaden the protocol search space. Add new domains or more papers to the extraction corpus.
Architecture-limited
Signal: C-index plateau with > 1,000 records
Action: Upgrade from XGBoost v0 to the PyTorch transformer (mshale-1 v1). Requires GPU infrastructure.