Download plugins/ml-intern/skills/ml-intern-harness/scripts/turn_check.py from razvan/ml-intern-codex-plugin: direct link, hf CLI and curl.
- Browser
- Download file 2.2 kB
-
https://huggingface.co/razvan/ml-intern-codex-plugin/resolve/main/plugins/ml-intern/skills/ml-intern-harness/scripts/turn_check.py
- Command line
-
hf download hf://razvan/ml-intern-codex-plugin/plugins/ml-intern/skills/ml-intern-harness/scripts/turn_check.py
-
curl -L -o turn_check.py https://huggingface.co/razvan/ml-intern-codex-plugin/resolve/main/plugins/ml-intern/skills/ml-intern-harness/scripts/turn_check.py
2.2 kB
| #!/usr/bin/env python3 | |
| """Sentinel script: check if a user message should re-engage the ml-intern harness. | |
| This is a Codex-plugin workaround for the lack of persistent event hooks. | |
| The harness SKILL.md instructs Codex to run this before each response when | |
| harness mode is active. If the output is RE-ENGAGE, Codex stays in harness mode. | |
| If FREE, it may drop to generic behavior (unless the conversation history shows | |
| prior harness activity). | |
| """ | |
| from __future__ import annotations | |
| import sys | |
| # Keywords that strongly indicate ML / HF / research intent | |
| HARNESS_KEYWORDS = [ | |
| "train", "training", "fine-tune", "finetune", "fine tuning", "evaluation", | |
| "evaluate", "benchmark", "dataset", "datasets", "model", "models", | |
| "hugging face", "huggingface", "hf", "paper", "papers", "citation", | |
| "rag", "embedding", "embeddings", "diffusion", "lora", "dpo", "grpo", | |
| "sft", "trl", "transformers", "trackio", "peft", "accelerate", | |
| "sentence-transformers", "sentence transformer", "inference", "deploy", | |
| "space", "spaces", "job", "jobs", "gpu", "cuda", "oom", "batch size", | |
| "learning rate", "epoch", "epochs", "loss", "metric", "metrics", | |
| "accuracy", "f1", "bleu", "rouge", "perplexity", "kl divergence", | |
| "tokenizer", "tokenization", "config", "yaml", "jsonl", "push_to_hub", | |
| "hub_model_id", "smoke test", "preflight", "plan", "architecture", | |
| "design", "research", "recipe", "hyperparameter", "ablation", "sweep", | |
| "inspect", "validate", "schema", "split", "config", "parquet", | |
| "messages", "prompt", "completion", "chosen", "rejected", | |
| "go ahead", "do it", "now what", "continue", "next step", "proceed", | |
| "ship", "artifact", "artifact", "publish", "upload", "repo", | |
| ] | |
| def should_re_engage(message: str) -> bool: | |
| """Return True if the message should keep/re-engage harness mode.""" | |
| msg_lower = message.lower() | |
| for kw in HARNESS_KEYWORDS: | |
| if kw in msg_lower: | |
| return True | |
| return False | |
| def main() -> int: | |
| message = sys.argv[1] if len(sys.argv) > 1 else "" | |
| if should_re_engage(message): | |
| print("RE-ENGAGE") | |
| else: | |
| print("FREE") | |
| return 0 | |
| if __name__ == "__main__": | |
| sys.exit(main()) | |