claude-turing 4.7.0 → 4.8.1

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.
Files changed (172) hide show
  1. package/.claude-plugin/plugin.json +2 -2
  2. package/README.md +1 -1
  3. package/agents/ml-evaluator.md +4 -4
  4. package/agents/ml-researcher.md +2 -2
  5. package/bin/turing-init.sh +2 -2
  6. package/commands/ablate.md +3 -4
  7. package/commands/annotate.md +2 -3
  8. package/commands/archive.md +2 -3
  9. package/commands/audit.md +3 -4
  10. package/commands/baseline.md +3 -4
  11. package/commands/brief.md +5 -6
  12. package/commands/budget.md +3 -4
  13. package/commands/calibrate.md +3 -4
  14. package/commands/card.md +3 -4
  15. package/commands/changelog.md +2 -3
  16. package/commands/checkpoint.md +3 -4
  17. package/commands/cite.md +2 -3
  18. package/commands/compare.md +1 -2
  19. package/commands/counterfactual.md +2 -3
  20. package/commands/curriculum.md +3 -4
  21. package/commands/design.md +3 -4
  22. package/commands/diagnose.md +4 -5
  23. package/commands/diff.md +3 -4
  24. package/commands/distill.md +3 -4
  25. package/commands/doctor.md +2 -3
  26. package/commands/ensemble.md +3 -4
  27. package/commands/explore.md +4 -5
  28. package/commands/export.md +3 -4
  29. package/commands/feature.md +3 -4
  30. package/commands/flashback.md +2 -3
  31. package/commands/fork.md +3 -4
  32. package/commands/frontier.md +3 -4
  33. package/commands/init.md +5 -6
  34. package/commands/leak.md +3 -4
  35. package/commands/lit.md +3 -4
  36. package/commands/logbook.md +5 -6
  37. package/commands/merge.md +2 -3
  38. package/commands/mode.md +1 -2
  39. package/commands/onboard.md +2 -3
  40. package/commands/paper.md +3 -4
  41. package/commands/plan.md +2 -3
  42. package/commands/poster.md +3 -4
  43. package/commands/postmortem.md +2 -3
  44. package/commands/preflight.md +5 -6
  45. package/commands/present.md +2 -3
  46. package/commands/profile.md +3 -4
  47. package/commands/prune.md +2 -3
  48. package/commands/quantize.md +2 -3
  49. package/commands/queue.md +3 -4
  50. package/commands/registry.md +2 -3
  51. package/commands/regress.md +3 -4
  52. package/commands/replay.md +2 -3
  53. package/commands/report.md +3 -4
  54. package/commands/reproduce.md +3 -4
  55. package/commands/retry.md +3 -4
  56. package/commands/review.md +2 -3
  57. package/commands/rules/loop-protocol.md +11 -11
  58. package/commands/sanity.md +3 -4
  59. package/commands/scale.md +4 -5
  60. package/commands/search.md +2 -3
  61. package/commands/seed.md +3 -4
  62. package/commands/sensitivity.md +3 -4
  63. package/commands/share.md +2 -3
  64. package/commands/simulate.md +2 -3
  65. package/commands/status.md +1 -2
  66. package/commands/stitch.md +3 -4
  67. package/commands/suggest.md +5 -6
  68. package/commands/surgery.md +2 -3
  69. package/commands/sweep.md +8 -9
  70. package/commands/template.md +2 -3
  71. package/commands/train.md +5 -6
  72. package/commands/transfer.md +3 -4
  73. package/commands/trend.md +2 -3
  74. package/commands/try.md +4 -5
  75. package/commands/turing.md +3 -3
  76. package/commands/update.md +2 -3
  77. package/commands/validate.md +4 -5
  78. package/commands/warm.md +3 -4
  79. package/commands/watch.md +4 -5
  80. package/commands/whatif.md +2 -3
  81. package/commands/xray.md +3 -4
  82. package/config/commands.yaml +75 -75
  83. package/package.json +3 -2
  84. package/skills/turing/SKILL.md +3 -3
  85. package/skills/turing/ablate/SKILL.md +3 -4
  86. package/skills/turing/annotate/SKILL.md +2 -3
  87. package/skills/turing/archive/SKILL.md +2 -3
  88. package/skills/turing/audit/SKILL.md +3 -4
  89. package/skills/turing/baseline/SKILL.md +3 -4
  90. package/skills/turing/brief/SKILL.md +5 -6
  91. package/skills/turing/budget/SKILL.md +3 -4
  92. package/skills/turing/calibrate/SKILL.md +3 -4
  93. package/skills/turing/card/SKILL.md +3 -4
  94. package/skills/turing/changelog/SKILL.md +2 -3
  95. package/skills/turing/checkpoint/SKILL.md +3 -4
  96. package/skills/turing/cite/SKILL.md +2 -3
  97. package/skills/turing/compare/SKILL.md +1 -2
  98. package/skills/turing/counterfactual/SKILL.md +2 -3
  99. package/skills/turing/curriculum/SKILL.md +3 -4
  100. package/skills/turing/design/SKILL.md +3 -4
  101. package/skills/turing/diagnose/SKILL.md +4 -5
  102. package/skills/turing/diff/SKILL.md +3 -4
  103. package/skills/turing/distill/SKILL.md +3 -4
  104. package/skills/turing/doctor/SKILL.md +2 -3
  105. package/skills/turing/ensemble/SKILL.md +3 -4
  106. package/skills/turing/explore/SKILL.md +4 -5
  107. package/skills/turing/export/SKILL.md +3 -4
  108. package/skills/turing/feature/SKILL.md +3 -4
  109. package/skills/turing/flashback/SKILL.md +2 -3
  110. package/skills/turing/fork/SKILL.md +3 -4
  111. package/skills/turing/frontier/SKILL.md +3 -4
  112. package/skills/turing/init/SKILL.md +5 -6
  113. package/skills/turing/leak/SKILL.md +3 -4
  114. package/skills/turing/lit/SKILL.md +3 -4
  115. package/skills/turing/logbook/SKILL.md +5 -6
  116. package/skills/turing/merge/SKILL.md +2 -3
  117. package/skills/turing/mode/SKILL.md +1 -2
  118. package/skills/turing/onboard/SKILL.md +2 -3
  119. package/skills/turing/paper/SKILL.md +3 -4
  120. package/skills/turing/plan/SKILL.md +2 -3
  121. package/skills/turing/poster/SKILL.md +3 -4
  122. package/skills/turing/postmortem/SKILL.md +2 -3
  123. package/skills/turing/preflight/SKILL.md +5 -6
  124. package/skills/turing/present/SKILL.md +2 -3
  125. package/skills/turing/profile/SKILL.md +3 -4
  126. package/skills/turing/prune/SKILL.md +2 -3
  127. package/skills/turing/quantize/SKILL.md +2 -3
  128. package/skills/turing/queue/SKILL.md +3 -4
  129. package/skills/turing/registry/SKILL.md +2 -3
  130. package/skills/turing/regress/SKILL.md +3 -4
  131. package/skills/turing/replay/SKILL.md +2 -3
  132. package/skills/turing/report/SKILL.md +3 -4
  133. package/skills/turing/reproduce/SKILL.md +3 -4
  134. package/skills/turing/retry/SKILL.md +3 -4
  135. package/skills/turing/review/SKILL.md +2 -3
  136. package/skills/turing/rules/loop-protocol.md +11 -11
  137. package/skills/turing/sanity/SKILL.md +3 -4
  138. package/skills/turing/scale/SKILL.md +4 -5
  139. package/skills/turing/search/SKILL.md +2 -3
  140. package/skills/turing/seed/SKILL.md +3 -4
  141. package/skills/turing/sensitivity/SKILL.md +3 -4
  142. package/skills/turing/share/SKILL.md +2 -3
  143. package/skills/turing/simulate/SKILL.md +2 -3
  144. package/skills/turing/status/SKILL.md +1 -2
  145. package/skills/turing/stitch/SKILL.md +3 -4
  146. package/skills/turing/suggest/SKILL.md +5 -6
  147. package/skills/turing/surgery/SKILL.md +2 -3
  148. package/skills/turing/sweep/SKILL.md +8 -9
  149. package/skills/turing/template/SKILL.md +2 -3
  150. package/skills/turing/train/SKILL.md +5 -6
  151. package/skills/turing/transfer/SKILL.md +3 -4
  152. package/skills/turing/trend/SKILL.md +2 -3
  153. package/skills/turing/try/SKILL.md +4 -5
  154. package/skills/turing/update/SKILL.md +2 -3
  155. package/skills/turing/validate/SKILL.md +4 -5
  156. package/skills/turing/warm/SKILL.md +3 -4
  157. package/skills/turing/watch/SKILL.md +4 -5
  158. package/skills/turing/whatif/SKILL.md +2 -3
  159. package/skills/turing/xray/SKILL.md +3 -4
  160. package/src/command-registry.js +12 -0
  161. package/src/install.js +4 -3
  162. package/src/sync-commands-layout.js +149 -0
  163. package/src/sync-skills-layout.js +4 -133
  164. package/templates/README.md +5 -8
  165. package/templates/program.md +18 -18
  166. package/templates/pyproject.toml +10 -0
  167. package/templates/requirements.txt +4 -1
  168. package/templates/scripts/generate_onboarding.py +1 -1
  169. package/templates/scripts/post-train-hook.sh +7 -8
  170. package/templates/scripts/scaffold.py +24 -26
  171. package/templates/scripts/stop-hook.sh +2 -3
  172. package/templates/scripts/turing-run-python.sh +9 -0
@@ -18,24 +18,23 @@ EXPERIMENT_LOG="${ML_DIR}/experiments/log.jsonl"
18
18
  if [[ -f "${ML_DIR}/run.log" ]]; then
19
19
  LOG_FILE="${ML_DIR}/run.log"
20
20
  elif [[ -f "run.log" ]]; then
21
- LOG_FILE="run.log"
21
+ LOG_FILE="$(pwd)/run.log"
22
22
  else
23
23
  echo "post-train-hook: No run.log found, skipping."
24
24
  exit 0
25
25
  fi
26
26
 
27
- # Activate venv and delegate to Python
28
27
  cd "$ML_DIR"
29
- source .venv/bin/activate 2>/dev/null || true
28
+ source "${SCRIPT_DIR}/turing-run-python.sh"
30
29
 
31
30
  # Parse metrics using the canonical parser
32
- PARSED=$(python3 scripts/parse_metrics.py "$LOG_FILE" --raw 2>/dev/null) || {
31
+ PARSED=$(run_python scripts/parse_metrics.py "$LOG_FILE" --raw 2>/dev/null) || {
33
32
  echo "post-train-hook: No metrics block found in run.log, skipping."
34
33
  exit 0
35
34
  }
36
35
 
37
36
  # Extract metrics and metadata via Python (avoids bash JSON construction)
38
- METRICS_JSON=$(python3 -c "
37
+ METRICS_JSON=$(run_python -c "
39
38
  import json, sys
40
39
  data = json.loads(sys.argv[1])
41
40
  metadata_keys = {'model_type', 'train_seconds'}
@@ -43,7 +42,7 @@ metrics = {k: v for k, v in data.items() if k not in metadata_keys}
43
42
  print(json.dumps(metrics))
44
43
  " "$PARSED")
45
44
 
46
- CONFIG_JSON=$(python3 -c "
45
+ CONFIG_JSON=$(run_python -c "
47
46
  import json, sys
48
47
  data = json.loads(sys.argv[1])
49
48
  metadata_keys = {'model_type', 'train_seconds'}
@@ -55,14 +54,14 @@ print(json.dumps(config))
55
54
  GIT_COMMIT=$(git rev-parse --short HEAD 2>/dev/null || echo "unknown")
56
55
 
57
56
  # Get next experiment ID
58
- NEXT_ID=$(python3 -c "
57
+ NEXT_ID=$(run_python -c "
59
58
  import sys; sys.path.insert(0, 'scripts')
60
59
  from log_experiment import get_next_experiment_id
61
60
  print(get_next_experiment_id('$EXPERIMENT_LOG'))
62
61
  ")
63
62
 
64
63
  # Log the experiment
65
- python3 scripts/log_experiment.py \
64
+ run_python scripts/log_experiment.py \
66
65
  "$EXPERIMENT_LOG" \
67
66
  "$NEXT_ID" \
68
67
  "kept" \
@@ -22,6 +22,7 @@ import argparse
22
22
  import json
23
23
  import os
24
24
  import re
25
+ import shlex
25
26
  import shutil
26
27
  import subprocess
27
28
  import sys
@@ -64,6 +65,7 @@ TEMPLATE_DIRS = {
64
65
  "sweep.py",
65
66
  "post-train-hook.sh",
66
67
  "stop-hook.sh",
68
+ "turing-run-python.sh",
67
69
  "check_convergence.py",
68
70
  "verify_placeholders.py",
69
71
  "manage_hypotheses.py",
@@ -220,6 +222,7 @@ DIRECTORIES_TO_CREATE = [
220
222
  SHELL_SCRIPTS = [
221
223
  "scripts/post-train-hook.sh",
222
224
  "scripts/stop-hook.sh",
225
+ "scripts/turing-run-python.sh",
223
226
  ]
224
227
 
225
228
 
@@ -289,7 +292,7 @@ def scaffold_project(
289
292
  templates_dir: Path to the templates/ directory.
290
293
  ml_dir: Target ML directory (relative to cwd).
291
294
  values: Dict mapping arg names to values for placeholder substitution.
292
- setup_venv: Whether to create and populate a Python venv.
295
+ setup_venv: Whether to create and populate the uv environment.
293
296
  setup_hooks: Whether to configure Claude Code hooks.
294
297
 
295
298
  Returns:
@@ -361,9 +364,9 @@ def scaffold_project(
361
364
  if setup_hooks:
362
365
  _setup_hooks(ml_dir)
363
366
 
364
- # Setup venv
367
+ # Setup Python environment
365
368
  if setup_venv:
366
- _setup_venv(target)
369
+ _setup_environment(target)
367
370
 
368
371
  return stats
369
372
 
@@ -390,16 +393,18 @@ def _setup_hooks(ml_dir: str) -> None:
390
393
 
391
394
  hooks = settings.get("hooks", {})
392
395
 
396
+ target = Path(ml_dir).resolve()
397
+
393
398
  # PostToolUse hook for auto-logging
394
399
  post_hooks = hooks.get("PostToolUse", [])
395
- post_hook_cmd = f"bash {ml_dir}/scripts/post-train-hook.sh"
400
+ post_hook_cmd = f"bash {shlex.quote(str(target / 'scripts' / 'post-train-hook.sh'))}"
396
401
  if not any(post_hook_cmd in str(h) for h in post_hooks):
397
402
  post_hooks.append(make_command_hook_group(post_hook_cmd, matcher="Bash"))
398
403
  hooks["PostToolUse"] = post_hooks
399
404
 
400
405
  # Stop hook for convergence
401
406
  stop_hooks = hooks.get("Stop", [])
402
- stop_hook_cmd = f"bash {ml_dir}/scripts/stop-hook.sh"
407
+ stop_hook_cmd = f"bash {shlex.quote(str(target / 'scripts' / 'stop-hook.sh'))}"
403
408
  if not any(stop_hook_cmd in str(h) for h in stop_hooks):
404
409
  stop_hooks.append(make_command_hook_group(stop_hook_cmd))
405
410
  hooks["Stop"] = stop_hooks
@@ -408,29 +413,22 @@ def _setup_hooks(ml_dir: str) -> None:
408
413
  settings_path.write_text(json.dumps(settings, indent=2))
409
414
 
410
415
 
411
- def _setup_venv(target: Path) -> None:
412
- """Create Python venv and install requirements."""
413
- venv_path = target / ".venv"
414
- if venv_path.exists():
415
- print(" Venv already exists, skipping creation.", file=sys.stderr)
416
+ def _setup_environment(target: Path) -> None:
417
+ """Create the uv-managed Python environment."""
418
+ if shutil.which("uv") is None:
419
+ print(" Warning: uv not found; run `uv sync` from the ML directory after installing uv.", file=sys.stderr)
416
420
  return
417
421
 
418
- print(" Creating virtual environment...", file=sys.stderr)
422
+ print(" Syncing uv environment...", file=sys.stderr)
419
423
  try:
420
424
  subprocess.run(
421
- [sys.executable, "-m", "venv", str(venv_path)],
422
- check=True, capture_output=True,
425
+ ["uv", "sync"],
426
+ cwd=target,
427
+ check=True,
428
+ capture_output=True,
423
429
  )
424
- pip = str(venv_path / "bin" / "pip")
425
- req = str(target / "requirements.txt")
426
- if Path(req).exists():
427
- print(" Installing requirements...", file=sys.stderr)
428
- subprocess.run(
429
- [pip, "install", "-r", req],
430
- check=True, capture_output=True,
431
- )
432
430
  except subprocess.CalledProcessError as e:
433
- print(f" Warning: venv setup failed: {e}", file=sys.stderr)
431
+ print(f" Warning: uv environment setup failed: {e}", file=sys.stderr)
434
432
 
435
433
 
436
434
  def verify_placeholders(ml_dir: str) -> list[tuple[str, int, str]]:
@@ -487,7 +485,7 @@ def main() -> None:
487
485
  parser.add_argument("--task-description", default=None)
488
486
  parser.add_argument("--ml-dir", default=None)
489
487
  parser.add_argument("--data-source", default=None)
490
- parser.add_argument("--no-venv", action="store_true", help="Skip venv creation")
488
+ parser.add_argument("--no-venv", action="store_true", help="Skip uv environment setup")
491
489
  parser.add_argument("--no-hooks", action="store_true", help="Skip hook configuration")
492
490
  parser.add_argument("--templates-dir", default=None, help="Override templates directory")
493
491
  args = parser.parse_args()
@@ -546,9 +544,9 @@ def main() -> None:
546
544
 
547
545
  print(f"\nNext steps:")
548
546
  print(f" 1. Add training data to {values['data_source']}")
549
- print(f" 2. cd {ml_dir} && source .venv/bin/activate")
550
- print(f" 3. python prepare.py")
551
- print(f" 4. /turing:train (or: python train.py > run.log 2>&1)")
547
+ print(f" 2. cd {ml_dir} && uv sync")
548
+ print(f" 3. uv run python prepare.py")
549
+ print(f" 4. /turing:train (or: uv run python train.py > run.log 2>&1)")
552
550
 
553
551
 
554
552
  if __name__ == "__main__":
@@ -25,10 +25,9 @@ if [[ ! -f "$EXPERIMENT_LOG" ]]; then
25
25
  exit 0
26
26
  fi
27
27
 
28
- # Activate venv and delegate to Python module
29
28
  cd "$ML_DIR"
30
- source .venv/bin/activate 2>/dev/null || true
29
+ source "${SCRIPT_DIR}/turing-run-python.sh"
31
30
 
32
- python3 scripts/check_convergence.py \
31
+ run_python scripts/check_convergence.py \
33
32
  --config "$CONFIG_FILE" \
34
33
  --log "$EXPERIMENT_LOG"
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env bash
2
+
3
+ run_python() {
4
+ if ! command -v uv >/dev/null 2>&1; then
5
+ echo "turing: uv is required. Install uv or run legacy environment setup manually." >&2
6
+ return 127
7
+ fi
8
+ uv run python "$@"
9
+ }