organize-ml-workspace
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseOrganize ML Workspace
组织ML工作区
Where things live, when to create a new file, what each file is
allowed to contain.
规定各类内容的存放位置、创建新文件的时机以及每个文件允许包含的内容。
Next-step pointers — where you go after this skill
下一步指引——掌握本技能后的后续操作
| You came here for… | → next |
|---|---|
| Bootstrap a fresh workspace | → |
| First experiment script | → |
| Add a new experiment iteration | → |
| Pipeline / evaluate / smoke-test content | → |
Always re-emit the Pre-flight checklist with evidence before
declaring the turn done.
| 你来到这里的目的… | → 下一步操作 |
|---|---|
| 搭建全新工作区 | → |
| 创建首个实验脚本 | → |
| 添加新的实验迭代 | → |
| 流水线/评估/冒烟测试相关内容 | → |
在宣布当前任务完成前,务必重新输出带有证据的预检清单。
Sibling skills — open just-in-time
关联技能——按需调用
Don't pre-read all nine at session start (paralysis). Open each
sibling SKILL.md when a step calls for it (e.g. open
before G-ENV-MGR; open
before handing off the design-note write). Emit this tracker once
per turn:
python-env-manageriterate-ml-experimentSibling skills (just-in-time):
- data-science-python-stack, python-env-manager, python-api,
python-code-style, iterate-ml-experiment, build-ml-pipeline,
evaluate-ml-pipeline, test-ml-pipeline, smoke-test-ml-pipeline不要在会话开始前预先阅读所有9项技能(避免决策瘫痪)。当步骤需要时再打开对应的SKILL.md文件(例如,在执行G-ENV-MGR前打开;在交付设计笔记编写任务前打开)。每次任务输出如下追踪信息:
python-env-manageriterate-ml-experiment关联技能(按需调用):
- data-science-python-stack, python-env-manager, python-api,
python-code-style, iterate-ml-experiment, build-ml-pipeline,
evaluate-ml-pipeline, test-ml-pipeline, smoke-test-ml-pipelineStop conditions — read before anything else
停止条件——执行任何操作前请先阅读
- Missing dependency. If raises, STOP. Invoke
import skorefor the install command. Do not droppython-env-managerin favor ofskore.Project/ pickles / "print metrics" — the workspace contract assumes a Project on disk.mlflow - Symbol from memory is forbidden. Any /
skore.Project/project.putsignature must come from askore.evaluatecall this turn.python-api - Existing layout wins — detect first. Run the Detection table before scaffolding. Don't rename, relocate, or "tidy up" existing folders.
- Notebooks are not silent. Existing files in the experiment folder → surface the convention shift and ask. Don't auto-convert.
.ipynb - Scratch is read-only against the skore Project. Probes under
may call
scratch/<ts>_<short>.py,project.get(...), walk an existing report. They MUST NOT callproject.summarize()orskore.evaluate(...). Whenproject.put(...)raisesproject.get(key), the fix is the lookup shape:KeyErroris by id, not byget. Usekey→summarize()→(key, id). Never substitute by re-runningget(id)+evaluate.put - Tabular library is asked, not assumed (G-TABULAR). Pandas
being importable via skore is not a pick. Invoke
for the structured ask. Free-text ("quick", "you pick") does NOT resolve. Persisted in JOURNAL.md Status
data-science-python-stack.Workspace decisions - Package name is asked, not inferred (G-PKG-NAME). Before any
/ manifest creation (including
pyproject.toml/pixi init/uv init), fire anpoetry initfor theAskUserQuestionimport name. Folder name in snake_case is the default. Manifest creation before G-PKG-NAME passes is forbidden — runningsrc/<pkg>/first creates ainitentry, and reading "name is in the manifest" back is circular. If a manifest exists, confirm via[project] name— continuity from a prior session is not continuity from a user decision.AskUserQuestion - Skore Project mode is asked, not assumed (G-SKORE-MODE).
Before any template instantiation containing
, fire an
skore.Project(...)forAskUserQuestion|local. Default proposal:hub. Hub triggers a follow-up for the workspace name (org/team on the hub — distinct from local-modelocal). Persists asworkspace=(+skore mode:when hub). Without it theskore hub workspace:substitution has no shape to fill. Details: →<SKORE_PROJECT_INIT>.references/g_skore_mode.md - Switching skore mode mid-project is forbidden by default.
Once recorded, do not silently change. A switch orphans every
existing report in the prior store — skore has no built-in
migration. Requires explicit confirmation surfacing the migration burden, then rewrite all
AskUserQuestionblocks. Procedure: →<SKORE_PROJECT_INIT>§ "Switching mid-project".references/g_skore_mode.md - Env manager is asked, not assumed (G-ENV-MGR). Hand off to
. Pixi on PATH is detection, not permission. Don't run
python-env-manager/pixi init/uv inituntil G-ENV-MGR has passed inpoetry init.python-env-manager - Harness "no clarifying questions" hints do NOT waive these gates. G-TABULAR, G-PKG-NAME, G-ENV-MGR, G-SKORE-MODE, python-api consultation, new-vs-edit decision are operating-contract gates. "Quick" / "go fast" never waives them.
- Post-hoc audit — required before ending the turn. Walk every pre-flight row; if any Evidence cell is unfilled, surface the non-compliance explicitly. Most common failure: "I scaffolded successfully so everything must be fine".
- 依赖缺失:若报错,立即停止。调用
import skore获取安装命令。不得用python-env-manager/pickles/"打印指标"替代mlflow——工作区约定默认磁盘上存在Project实例。skore.Project - 禁止使用内存中的符号:任何/
skore.Project/project.put的签名必须来自本次任务中的skore.evaluate调用。python-api - 现有布局优先——先检测:在搭建前先运行检测表。不得重命名、移动或"整理"现有文件夹。
- Notebook操作需告知用户:实验文件夹中存在文件时,需向用户说明约定变更并询问意见。不得自动转换格式。
.ipynb - Scratch目录对skore Project为只读:下的探测脚本可调用
scratch/<ts>_<short>.py、project.get(...)、遍历现有报告,但禁止调用project.summarize()或skore.evaluate(...)。当project.put(...)抛出project.get(key)时,需修正查找方式:KeyError是按id查找,而非按get。应使用key→ 获取summarize()→(key, id)。绝不能通过重新运行get(id)+evaluate来替代。put - 表格库需用户明确指定(G-TABULAR):skore可导入Pandas并不代表默认选用该库。需调用让用户明确选择。自由文本指令(如"快速选择"、"你选就行")无法作为选择依据。选择结果需记录在JOURNAL.md的
data-science-python-stack状态中。Workspace decisions - 包名需用户明确指定(G-PKG-NAME):在创建任何/清单文件(包括
pyproject.toml/pixi init/uv init)之前,需触发poetry init询问AskUserQuestion的导入名称。默认采用蛇形命名法的文件夹名称。禁止在G-PKG-NAME通过前创建清单——提前运行src/<pkg>/会生成init条目,后续读取该条目会形成循环依赖。若清单已存在,需通过[project] name确认——会话的连续性不代表用户已做出决策。AskUserQuestion - Skore Project模式需用户明确指定(G-SKORE-MODE):在实例化任何包含的模板之前,需触发
skore.Project(...)让用户选择AskUserQuestion|local模式。默认建议:hub。若选择hub模式,需进一步询问工作区名称(hub上的组织/团队——与本地模式的local不同)。选择结果需记录为workspace=(若为hub模式,还需记录skore mode:)。若无此信息,skore hub workspace:占位符无法填充详细内容。详情参考:→<SKORE_PROJECT_INIT>。references/g_skore_mode.md - 默认禁止中途切换skore模式:一旦记录模式,不得擅自更改。切换模式会导致先前存储中的所有报告失效——skore无内置迁移机制。切换前需触发明确告知用户迁移成本,然后重写所有
AskUserQuestion代码块。操作流程参考:→<SKORE_PROJECT_INIT>§ "中途切换模式"。references/g_skore_mode.md - 环境管理器需用户明确指定(G-ENV-MGR):移交至处理。PATH中存在Pixi仅为检测结果,不代表获得使用许可。需在
python-env-manager中完成G-ENV-MGR验证后,才能运行python-env-manager/pixi init/uv init。poetry init - Harness的"无需澄清问题"提示不能绕过这些验证步骤:G-TABULAR、G-PKG-NAME、G-ENV-MGR、G-SKORE-MODE、python-api查询、新建/编辑决策均为操作约定的必要验证步骤。"快速完成"/"加速"指令无法绕过这些步骤。
- 任务结束前需进行事后审计:检查预检清单的每一项;若任何证据栏为空,需明确指出不符合约定之处。最常见的错误:"我已成功搭建,所以一切没问题"。
Forbidden shortcuts
禁止使用的快捷方式
| Shortcut | Why it's wrong |
|---|---|
| Violates G-ENV-MGR (silent manager pick) AND G-PKG-NAME (name from folder via init side-effect). Circular: the agent created the manifest it now claims to read |
| Folder name = good name → skip the ask | Default value is fine; silent pick is not. G-PKG-NAME requires the structured ask even with folder as default |
| Transitive presence is not a pick. Violates G-TABULAR |
Scaffold every skeleton in one turn, incl. | Scaffold stops at empty |
Scaffold drops | Audit files placed by |
Forget | Four-way stem pairing breaks |
| Always re-confirm via G-PKG-NAME |
| Batch G-TABULAR + G-PKG-NAME + G-ENV-MGR + G-SKORE-MODE into prose recommendations | The gates take structured |
Skip G-SKORE-MODE because templates use | Templates carry the |
Pick | Project init fails at first |
Substitute | Install variant comes from G-SKORE-MODE's recorded answer. |
Silently change | Switching orphans existing reports. Always explicit |
Hub substitution but leaving | |
Local | Relative resolves against CWD; runs from other dirs write the store somewhere unexpected. Always absolute via |
Putting | |
Substituting | Audit must open the same Project. Byte-identical copy from the experiment file is the rule |
Hub workspace name contains | The |
| Lookup shape wrong ( |
| 快捷方式 | 错误原因 |
|---|---|
PATH中存在 | 违反G-ENV-MGR(擅自选择环境管理器)和G-PKG-NAME(通过init副作用从文件夹获取名称)。循环依赖:Agent创建了自己随后要读取的清单 |
| 文件夹名称可用 → 跳过询问用户 | 默认值可行,但擅自选择不可行。G-PKG-NAME要求即使默认使用文件夹名称,也需结构化询问用户 |
skore可导入 | 间接存在不代表用户选择了该库。违反G-TABULAR |
一次性搭建所有骨架,包括 | 搭建仅需创建空的 |
搭建工作区时创建 | 审计文件由 |
搭建布局时遗漏 | 破坏了四元组骨架配对规则 |
| 始终需通过G-PKG-NAME重新确认 |
| 将G-TABULAR + G-PKG-NAME + G-ENV-MGR + G-SKORE-MODE批量转换为建议性文本 | 这些验证步骤需要结构化的 |
因模板使用 | 模板包含 |
选择 | Project初始化会在首次 |
根据Agent猜测替换为 | 安装变体需根据G-SKORE-MODE记录的结果确定。 |
擅自更改 | 切换模式会导致现有报告失效。必须先触发 |
选择hub模式但保留 | |
本地模式使用相对路径 | 相对路径基于当前工作目录解析;从其他目录运行会将存储写入意外位置。始终通过 |
将 | hub模式下 |
独立替换 | 审计文件必须打开相同的Project。规则是直接复制实验文件中的对应代码块 |
Hub工作区名称包含 | |
| 查找方式错误( |
Pre-flight — emit before any code
预检——执行任何代码前输出
Each ticked box needs an Evidence line (format spec in
§ "Pre-flight evidence requirements"; see
also ).
iterate-ml-experimentpython-env-manager/references/preflight_evidence.mdPre-flight (organize-ml-workspace):
- [ ] `Workspace decisions` in `journal/JOURNAL.md` Status checked
for pre-recorded gates (tabular, env_manager, package, skore mode)
Evidence: lists each <gate>: <value | not recorded>
| "n/a — JOURNAL.md does not exist yet (truly fresh)"
- [ ] Tier 1 mandatory libs importable: sklearn, skrub, skore
Evidence: Write scratch/<ts>_check_tier1.py + `pixi run python …` output.
**Inline `python -c` is NOT evidence**.
- [ ] Layout detection done: <existing | fresh>
Evidence: ls/Glob on project root + matched signal from Detection
- [ ] G-TABULAR resolved: pandas | polars
Evidence: AskUserQuestion id=<id> via data-science-python-stack |
JOURNAL.md Status (Workspace decisions) | user quote turn N
- [ ] G-ENV-MGR resolved
Evidence: AskUserQuestion id=<id> via python-env-manager |
JOURNAL.md Status (Workspace decisions)
- [ ] G-PKG-NAME resolved: <name>
Evidence: AskUserQuestion id=<id>, answer=<name> |
JOURNAL.md Status (Workspace decisions) |
existing manifest's [project].name **confirmed via AskUserQuestion**
(reading the manifest alone is NOT sufficient)
- [ ] G-SKORE-MODE resolved: local | hub
Evidence: AskUserQuestion id=<id>, answer=<local|hub> |
JOURNAL.md Status (Workspace decisions) `skore mode:` row
If hub: also captures `skore hub workspace:` row.
- [ ] `pyproject.toml` present at root declaring `src/<pkg>/`;
editable install wired via `python-env-manager` § Editable workspace
Evidence: Read pyproject.toml (this turn) + manager's editable-install call
- [ ] python-api consulted for: Project, put, evaluate
Evidence: Read scratch/api/skore/<v>/{project_local,evaluate}.md
| Write of the same files (this turn)
| "n/a — symbols already in workspace cache"
- [ ] Decision: new experiment file vs edit existing
Evidence: AskUserQuestion id=<id> | user quote turn N |
"n/a — first experiment in a fresh workspace"
- [ ] `journal/` scaffolded with empty placeholder JOURNAL.md
Evidence: Write journal/JOURNAL.md (this turn) | "already exists"
- [ ] Pre-flight re-emitted with evidence before final message.
Evidence: this checklist appears in the end-of-turn summary.每个勾选的选项都需要一条证据(格式要求见 § "预检证据要求";另见)。
iterate-ml-experimentpython-env-manager/references/preflight_evidence.md预检(organize-ml-workspace):
- [ ] 检查`journal/JOURNAL.md`中的`Workspace decisions`状态,确认是否有预先记录的验证项(tabular、env_manager、package、skore mode)
证据:列出每个<验证项>: <值 | 未记录>
| "不适用——JOURNAL.md尚未创建(全新工作区)"
- [ ] 一级必备库可导入:sklearn, skrub, skore
证据:创建scratch/<ts>_check_tier1.py并执行`pixi run python …`,输出结果。
**直接运行`python -c`不能作为证据**。
- [ ] 已完成布局检测:<已有布局 | 全新布局>
证据:在项目根目录执行ls/Glob命令,匹配检测表中的信号
- [ ] G-TABULAR已确认:pandas | polars
证据:通过data-science-python-stack触发AskUserQuestion id=<id> |
JOURNAL.md状态(Workspace decisions) | 用户在第N轮的回复内容
- [ ] G-ENV-MGR已确认
证据:通过python-env-manager触发AskUserQuestion id=<id> |
JOURNAL.md状态(Workspace decisions)
- [ ] G-PKG-NAME已确认:<名称>
证据:触发AskUserQuestion id=<id>,回复=<名称> |
JOURNAL.md状态(Workspace decisions) |
现有清单中的[project].name **已通过AskUserQuestion确认**
(仅读取清单内容不足以作为证据)
- [ ] G-SKORE-MODE已确认:local | hub
证据:触发AskUserQuestion id=<id>,回复=<local|hub> |
JOURNAL.md状态(Workspace decisions)中的`skore mode:`条目
若为hub模式:还需记录`skore hub workspace:`条目。
- [ ] 项目根目录存在`pyproject.toml`,声明`src/<pkg>/`;
已通过`python-env-manager` § 可编辑工作区配置可编辑安装
证据:本次任务中读取pyproject.toml内容 + 环境管理器的可编辑安装命令
- [ ] 已查询python-api获取:Project, put, evaluate的签名
证据:读取scratch/api/skore/<v>/{project_local,evaluate}.md
| 本次任务中创建了上述文件
| "不适用——符号已在工作区缓存中"
- [ ] 已决定:创建新实验文件还是编辑现有文件
证据:触发AskUserQuestion id=<id> | 用户在第N轮的回复内容 |
"不适用——全新工作区的首个实验"
- [ ] 已搭建`journal/`目录并创建空的JOURNAL.md占位符
证据:本次任务中创建journal/JOURNAL.md | "已存在"
- [ ] 任务结束前重新输出带有证据的预检清单。
证据:本清单出现在任务结束总结中。Detection — existing workspace first
检测——优先适配现有工作区
| Signal | Meaning |
|---|---|
| Package declared installable — use this name; verify editable install via |
| Manager knows the project but package isn't installable — flag, offer to add |
| Package dir already chosen — keep it |
| Stale out-of-band |
| Experiment location chosen — keep it |
| Audit location chosen — keep it; body owned by |
| Journal location chosen — keep it |
| Report location chosen — keep it |
| Test location chosen — keep it |
| Prior tracker artifacts — leave alone; skore is canonical |
| User is on notebooks — surface the shift and ask; don't auto-switch |
Any signal present → glue to existing convention. No renames,
no relocates. None present → fresh scaffold (below).
→ next: G-PKG-NAME, then for G-ENV-MGR.
python-env-manager| 信号 | 含义 |
|---|---|
| 已声明包可安装——使用该名称;通过 |
| 环境管理器知晓项目但包不可安装——标记该问题,提议添加 |
根目录存在 | 已选择包目录——保留该目录 |
根目录或 | 过时的手动 |
存在 | 已选择实验存放位置——保留该位置 |
| 已选择审计存放位置——保留该位置;文件内容由 |
存在 | 已选择日志存放位置——保留该位置 |
存在 | 已选择报告存放位置——保留该位置 |
存在 | 已选择测试存放位置——保留该位置 |
根目录存在 | 存在旧的追踪器 artifacts——保留;skore为当前规范工具 |
实验文件夹中存在 | 用户正在使用Notebook——告知用户约定变更并询问意见;不得自动切换 |
匹配到任何信号→适配现有约定。不得重命名、移动文件夹。未匹配到任何信号→搭建全新布局(如下)。
→ 下一步:完成G-PKG-NAME,然后调用完成G-ENV-MGR。
python-env-managerDefault layout (fresh workspace)
默认布局(全新工作区)
project/
├── pyproject.toml # declares src/<pkg>/ as installable
├── <manager manifest> # pixi.toml / poetry / uv / hatch / environment.yml
├── src/<pkg>/
│ ├── __init__.py # exposes PROJECT_ROOT
│ ├── data.py # data loading, splits, split_kwargs
│ ├── features.py # transformers, encoders, feature fns
│ ├── pipeline.py # the learner declaration (skrub DataOps)
│ └── evaluate.py # ONLY: CV strategy + optional metric overrides
├── journal/
│ ├── JOURNAL.md # session-start log; index of experiments
│ └── 01_baseline.md # one `.md` per planned experiment
├── experiments/
│ └── 01_baseline.py # one `# %%` script per experiment
├── audit/
│ └── 01_baseline.py # body owned by audit-ml-pipeline (read-only)
├── tests/
│ └── smoke/ # body owned by smoke-test-ml-pipeline
├── overview/
│ └── summary.md # agent-authored narrative (iterate-ml-experiment § 4)
├── scratch/ # agent-only (gitignored entirely)
└── reports/ # skore Project lives hereThe package is installable. declares
; the manager installs in editable mode so
works from any CWD.
Wiring per-manager: § Editable workspace.
pyproject.tomlsrc/<pkg>/from <pkg>.pipeline import build_learnerpython-env-managerRuntime deps (sklearn, skrub, skore, tabular) live in the
manager's manifest, not in .
[project.dependencies]Deliberately absent: no (user-owned), no
(out of scope). Add later only on user request — don't pre-empt.
data/models/project/
├── pyproject.toml # 声明src/<pkg>/为可安装包
├── <环境管理器清单> # pixi.toml / poetry / uv / hatch / environment.yml
├── src/<pkg>/
│ ├── __init__.py # 暴露PROJECT_ROOT
│ ├── data.py # 数据加载、拆分、split_kwargs
│ ├── features.py # 转换器、编码器、特征函数
│ ├── pipeline.py # 学习器声明(skrub DataOps)
│ └── evaluate.py # 仅包含:CV策略 + 可选指标覆盖
├── journal/
│ ├── JOURNAL.md # 会话启动日志;实验索引
│ └── 01_baseline.md # 每个计划实验对应一个.md文件
├── experiments/
│ └── 01_baseline.py # 每个实验对应一个`# %%`脚本
├── audit/
│ └── 01_baseline.py # 文件内容由audit-ml-pipeline管理(只读)
├── tests/
│ └── smoke/ # 文件内容由smoke-test-ml-pipeline管理
├── overview/
│ └── summary.md # Agent编写的叙事摘要(iterate-ml-experiment § 4)
├── scratch/ # 仅Agent使用(完全被git忽略)
└── reports/ # skore Project存储位置包为可安装状态。声明;环境管理器以可编辑模式安装,因此可在任意工作目录下生效。各环境管理器的配置方式参考: § 可编辑工作区。
pyproject.tomlsrc/<pkg>/from <pkg>.pipeline import build_learnerpython-env-manager运行时依赖(sklearn, skrub, skore, 表格库)存放在环境管理器的清单中,而非。
[project.dependencies]刻意省略的目录:无目录(用户自主管理),无目录(超出范围)。仅在用户请求时添加——不得预先创建。
data/models/File-creation rules
文件创建规则
Design note first, then code
先写设计笔记,再编写代码
Before creating , the matching
must exist and have been validated by
the user. Design-note content is owned by ;
this skill only enforces the pairing.
experiments/NN_<short_name>.pyjournal/NN_<short_name>.mditerate-ml-experiment创建之前,必须存在对应的且已通过用户验证。设计笔记内容由负责;本技能仅强制两者的配对关系。
experiments/NN_<short_name>.pyjournal/NN_<short_name>.mditerate-ml-experimentFour-way stem pairing
四元组骨架配对
Every experiment is identified by in four places:
NN_<short_name>journal/NN_<short_name>.md (design note)
experiments/NN_<short_name>.py (script)
tests/smoke/test_NN_<short_name>.py (smoke test)
audit/NN_<short_name>.py (audit file — read-only)By the time the experiment flips to in JOURNAL.md AND its
summary is refreshed in , all four exist.
The design note is written first; the script lands on approval;
the smoke test body is filled by ; the
audit file is placed and executed by at § 4
record-outcome.
doneoverview/summary.mdsmoke-test-ml-pipelineaudit-ml-pipelineThe audit file is read-only against the workspace's skore
Project and data — see § Read-only contract.
audit-ml-pipeline每个实验通过标识,对应四个位置:
NN_<short_name>journal/NN_<short_name>.md (设计笔记)
experiments/NN_<short_name>.py (脚本)
tests/smoke/test_NN_<short_name>.py (冒烟测试)
audit/NN_<short_name>.py (审计文件——只读)当实验在JOURNAL.md中标记为且其摘要在中更新后,这四个文件必须全部存在。设计笔记先编写;脚本在通过审核后创建;冒烟测试内容由填充;审计文件由在§ 4记录结果时创建并执行。
doneoverview/summary.mdsmoke-test-ml-pipelineaudit-ml-pipeline审计文件对工作区的skore Project和数据为只读——详见 § 只读约定。
audit-ml-pipelineNew experiment → new file. Iterating → ask first.
新实验→新文件。迭代实验→先询问用户。
Default: new file. , . The
numeric prefix preserves iteration order under .
02_text_encoder.py03_grouped_cv.pylsWhen the user says "let's tweak experiment 02", do not assume.
Fire :
AskUserQuestionShould this be a new experiment file (e.g.) or an in-place edit of04_text_encoder_v2.py?02_text_encoder.py
In-place edits overwrite the prior result in the skore Project
if the same key is reused — flag this. In-place also requires
revisiting the matching smoke test
(→ ).
smoke-test-ml-pipeline默认规则:创建新文件。例如、。数字前缀可确保命令按迭代顺序显示文件。
02_text_encoder.py03_grouped_cv.pyls当用户说"我们调整一下实验02"时,不要擅自假设。需触发:
AskUserQuestion本次调整应创建新的实验文件(例如)还是就地编辑现有文件04_text_encoder_v2.py?02_text_encoder.py
就地编辑若重用相同key会覆盖skore Project中的先前结果——需向用户标记该风险。就地编辑还需重新检查对应的冒烟测试(→ )。
smoke-test-ml-pipelineDecision flow (13 steps — full version in references/scaffold_steps.md
)
references/scaffold_steps.md决策流程(13步——完整版本见references/scaffold_steps.md
)
references/scaffold_steps.md| # | Step | Owner |
|---|---|---|
| 1 | Read project root; Detection table matches → glue (stop). No match → continue | this skill |
| 2 | G-PKG-NAME structured ask. Record in | this skill |
| 2a | G-SKORE-MODE ask: local | hub (+ hub workspace name if hub). Determines |
| 3 | Drop | this skill → env-manager |
| 4 | Create | this skill |
| 5 | Create | this skill |
| 6 | Create empty | this skill |
| 6a | Create empty | this skill |
| 7 | Create | this skill |
| 8 | Create | this skill |
| 9 | Create empty | this skill |
| 10 | Create empty | this skill |
| 11 | Touch | this skill |
| 12 | Hand off to | this skill → python-code-style |
| 13 | Hand back to the relevant sibling ( | this skill → next caller |
→ next: § 0 (bootstrap) for the first
design note.
iterate-ml-experiment| 序号 | 步骤 | 负责技能 |
|---|---|---|
| 1 | 读取项目根目录;匹配检测表→适配现有布局(停止流程)。未匹配→继续 | 本技能 |
| 2 | G-PKG-NAME结构化询问。记录在 | 本技能 |
| 2a | G-SKORE-MODE询问:local | hub(若选择hub模式,需询问hub工作区名称)。决定 |
| 3 | 从 | 本技能 → 环境管理器 |
| 4 | 从 | 本技能 |
| 5 | 从 | 本技能 |
| 6 | 创建空的 | 本技能 |
| 6a | 创建空的 | 本技能 |
| 7 | 创建 | 本技能 |
| 8 | 从 | 本技能 |
| 9 | 创建空的 | 本技能 |
| 10 | 创建空的 | 本技能 |
| 11 | 创建 | 本技能 |
| 12 | 移交至 | 本技能 → python-code-style |
| 13 | 移交至对应的关联技能(例如,编写设计笔记移交至 | 本技能 → 后续调用方 |
→ 下一步: § 0(引导搭建)编写首个设计笔记。
iterate-ml-experimentFiles in src/<pkg>/
src/<pkg>/下的文件
Each has a narrow contract:
- — exposes
__init__.py(absolute, derived fromPROJECT_ROOT, not CWD). Modules needing project-relative paths import this constant. Requires editable install.__file__ - — loaders, materialization of
data.py,X, anyy(groups, time, …) at the X marker. Pipeline mechanics insplit_kwargs.build-ml-pipeline - — feature functions and transformers.
features.py - — the learner declaration (a
pipeline.py).SkrubLearnerexposesbuild_learnerso the experiment script can pass an absolute path fromdata_dir_preview=None.PROJECT_ROOT - — only the inputs to
evaluate.py: the cross-validator (skore.evaluate), optional metric overrides. Does NOT callsplitter = ..., does NOT open a Project, does NOT persist.skore.evaluate
每个文件都有明确的职责范围:
- —— 暴露
__init__.py(绝对路径,由PROJECT_ROOT派生,与当前工作目录无关)。需要项目相对路径的模块可导入该常量。需配置可编辑安装才能生效。__file__ - —— 数据加载器、
data.py和X的实例化、X标记处的任何y(分组、时间等)。流水线机制由split_kwargs负责。build-ml-pipeline - —— 特征函数和转换器。
features.py - —— 学习器声明(
pipeline.py)。SkrubLearner暴露build_learner,以便实验脚本可从data_dir_preview=None传递绝对路径。PROJECT_ROOT - —— 仅包含
evaluate.py的输入参数:交叉验证器(skore.evaluate)、可选指标覆盖。不得调用splitter = ...、不得打开Project、不得持久化数据。skore.evaluate
Experiment scripts — experiments/NN_*.py
experiments/NN_*.py实验脚本——experiments/NN_*.py
experiments/NN_*.py# %%.ipynbtemplates/experiment.py- Open / attach to the at
skore.Project(or hub).reports/ - Import the learner from and CV from
<pkg>.pipeline.<pkg>.evaluate - Call .
skore.evaluate(...) - Call .
project.put("<experiment-key>", report)
Confirm signatures via . Cross-validator choice is
.
python-apievaluate-ml-pipelineProject init substitution — the marker
in is replaced at scaffold time per the
recorded decision. Two forms (local vs hub),
side-by-side anatomy, audit-file copy rule:
→ .
<SKORE_PROJECT_INIT>templates/experiment.pyskore mode:references/g_skore_mode.mdExperiment scripts stay clean of agent-only .
Inspection lives in . One exception: a bare
expression — that's a notebook-display side effect.
print(...)scratch/reportExperiment key convention — the file's stem (e.g.
→ ). One file → one key → one
report.
01_baseline.py"01_baseline"使用单元格标记,而非格式。模板:。脚本功能:
# %%.ipynbtemplates/experiment.py- 打开/关联(或hub)中的
reports/。skore.Project - 从导入学习器,从
<pkg>.pipeline导入CV策略。<pkg>.evaluate - 调用。
skore.evaluate(...) - 调用。
project.put("<experiment-key>", report)
需通过确认签名。交叉验证器的选择由负责。
python-apievaluate-ml-pipelineProject初始化替换——中的标记会在搭建时根据记录的决策替换。两种形式(本地vs hub)、对比解析、审计文件复制规则参考:→ 。
templates/experiment.py<SKORE_PROJECT_INIT>skore mode:references/g_skore_mode.md实验脚本不得包含仅Agent使用的。调试内容需放在目录下。唯一例外:单独的表达式——这是Notebook的显示副作用。
print(...)scratch/report实验key约定——使用文件的主干名称(例如 → )。一个文件对应一个key对应一份报告。
01_baseline.py"01_baseline"Companion skills
关联技能
| Skill | Relationship |
|---|---|
| Owns |
| Body of |
| Body of |
| Layout of |
| Body of the smoke test once design note is approved |
| Body of |
| skore / skrub / sklearn signatures |
| Detection + install commands + bootstrap |
| What to install (Tier 1/2/3) |
| |
| 技能 | 关系 |
|---|---|
| 负责 |
| 负责 |
| 负责 |
| 负责 |
| 设计笔记通过审核后负责冒烟测试的内容 |
| 负责 |
| 负责skore/skrub/sklearn的签名查询 |
| 负责依赖检测 + 安装命令 + 工作区引导搭建 |
| 负责确定安装内容(一级/二级/三级依赖) |
| 负责 |
Templates
模板
- — copied per new experiment
templates/experiment.py - — placeholder at scaffold; rewritten by
templates/summary.md§ 4iterate-ml-experiment - — declares
templates/pyproject.tomlas installablesrc/<pkg>/ - — package init with
templates/src___init__.pyPROJECT_ROOT - /
templates/src_data.py/src_features.py/src_pipeline.py— one-time skeletonssrc_evaluate.py - — dropped at scaffold if none exists
templates/.gitignore
Copy, don't rewrite. Section names encode contracts.
- —— 每个新实验复制一份
templates/experiment.py - —— 搭建时创建占位符;由
templates/summary.md§ 4重写iterate-ml-experiment - —— 声明
templates/pyproject.toml为可安装包src/<pkg>/ - —— 包含
templates/src___init__.py的包初始化文件PROJECT_ROOT - /
templates/src_data.py/src_features.py/src_pipeline.py—— 一次性骨架文件src_evaluate.py - —— 搭建时若不存在则复制模板
templates/.gitignore
复制模板,不要重写。章节名称代表约定规则。
References (load on demand)
参考文档(按需加载)
- — full prose elaboration of the 13-step Decision flow with examples and rationale.
references/scaffold_steps.md - — the G-SKORE-MODE gate in detail: project init forms side-by-side, anatomy of the
references/g_skore_mode.mdsubstitution, switching mid-project, out-of-scope notes (MLflow mode, Skore Hub account creation).<SKORE_PROJECT_INIT>
- —— 13步决策流程的完整详细说明,包含示例和原理。
references/scaffold_steps.md - —— G-SKORE-MODE验证步骤的详细说明:Project初始化形式对比、
references/g_skore_mode.md替换解析、中途切换模式流程、超出范围说明(MLflow模式、Skore Hub账户创建)。<SKORE_PROJECT_INIT>