Persist the repo status snapshot for faster resumability
Constraint: Future sessions benefit from a saved machine-readable snapshot, not just on-demand script output Rejected: Keep snapshot stdout-only | Makes handoff less durable and harder to automate across sessions Confidence: high Scope-risk: narrow Directive: Refresh .omx/latest_status_snapshot.json whenever the default docs, smoke paths, or next-step commands materially change Tested: /usr/local/miniconda3/bin/python scripts/status_snapshot.py --output .omx/latest_status_snapshot.json; JSON parse check for latest_commit and next_commands Not-tested: External automation consuming the saved snapshot over multiple sessions
Showing
4 changed files
with
43 additions
and
4 deletions
| ... | @@ -10,7 +10,7 @@ Use this checklist when a new session starts working on the repo. | ... | @@ -10,7 +10,7 @@ Use this checklist when a new session starts working on the repo. |
| 10 | ## 2. Verify repo health | 10 | ## 2. Verify repo health |
| 11 | ```bash | 11 | ```bash |
| 12 | git status --short | 12 | git status --short |
| 13 | /usr/local/miniconda3/bin/python scripts/status_snapshot.py | 13 | /usr/local/miniconda3/bin/python scripts/status_snapshot.py --output .omx/latest_status_snapshot.json |
| 14 | ``` | 14 | ``` |
| 15 | 15 | ||
| 16 | ## 3. Verify open-dataset tooling | 16 | ## 3. Verify open-dataset tooling | ... | ... |
| 1 | #!/usr/bin/env python3 | 1 | #!/usr/bin/env python3 |
| 2 | import argparse | ||
| 2 | import json | 3 | import json |
| 3 | import subprocess | 4 | import subprocess |
| 4 | from pathlib import Path | 5 | from pathlib import Path |
| ... | @@ -9,7 +10,8 @@ workspace_root = root.parent | ... | @@ -9,7 +10,8 @@ workspace_root = root.parent |
| 9 | def sh(cmd): | 10 | def sh(cmd): |
| 10 | return subprocess.check_output(cmd, shell=True, text=True).strip() | 11 | return subprocess.check_output(cmd, shell=True, text=True).strip() |
| 11 | 12 | ||
| 12 | snapshot = { | 13 | def build_snapshot(): |
| 14 | return { | ||
| 13 | 'latest_commit': sh('git log --oneline -n 1'), | 15 | 'latest_commit': sh('git log --oneline -n 1'), |
| 14 | 'docs': { | 16 | 'docs': { |
| 15 | 'readme': str((workspace_root / 'docs/README.md').resolve()), | 17 | 'readme': str((workspace_root / 'docs/README.md').resolve()), |
| ... | @@ -31,5 +33,22 @@ snapshot = { | ... | @@ -31,5 +33,22 @@ snapshot = { |
| 31 | 'inspect_jamendo': '/usr/local/miniconda3/bin/python src/data/external_adapters.py inspect-local mtg_jamendo data/raw/mtg_jamendo_audio --eval-ratio 0.2 --query-duration 8.0', | 33 | 'inspect_jamendo': '/usr/local/miniconda3/bin/python src/data/external_adapters.py inspect-local mtg_jamendo data/raw/mtg_jamendo_audio --eval-ratio 0.2 --query-duration 8.0', |
| 32 | 'smoke_jamendo': '/usr/local/miniconda3/bin/python src/data/external_adapters.py smoke-local mtg_jamendo data/raw/mtg_jamendo_audio --output-root data/external_smoke --eval-ratio 0.2 --query-duration 8.0 --train-epochs 1 --batch-size 2' | 34 | 'smoke_jamendo': '/usr/local/miniconda3/bin/python src/data/external_adapters.py smoke-local mtg_jamendo data/raw/mtg_jamendo_audio --output-root data/external_smoke --eval-ratio 0.2 --query-duration 8.0 --train-epochs 1 --batch-size 2' |
| 33 | } | 35 | } |
| 34 | } | 36 | } |
| 35 | print(json.dumps(snapshot, ensure_ascii=False, indent=2)) | 37 | |
| 38 | |||
| 39 | def main(): | ||
| 40 | parser = argparse.ArgumentParser() | ||
| 41 | parser.add_argument('--output', default=None) | ||
| 42 | args = parser.parse_args() | ||
| 43 | |||
| 44 | snapshot = build_snapshot() | ||
| 45 | text = json.dumps(snapshot, ensure_ascii=False, indent=2) | ||
| 46 | if args.output: | ||
| 47 | out = Path(args.output) | ||
| 48 | out.parent.mkdir(parents=True, exist_ok=True) | ||
| 49 | out.write_text(text) | ||
| 50 | print(text) | ||
| 51 | |||
| 52 | |||
| 53 | if __name__ == '__main__': | ||
| 54 | main() | ... | ... |
| ... | @@ -202,6 +202,25 @@ | ... | @@ -202,6 +202,25 @@ |
| 202 | - 新 session 现在不只靠静态文档,也可以直接读取当前仓库状态快照 | 202 | - 新 session 现在不只靠静态文档,也可以直接读取当前仓库状态快照 |
| 203 | - 持续开发交接更稳 | 203 | - 持续开发交接更稳 |
| 204 | 204 | ||
| 205 | ### Stage: 状态快照落盘 | ||
| 206 | |||
| 207 | 完成项: | ||
| 208 | - 扩展 [acr-engine/scripts/status_snapshot.py](../acr-engine/scripts/status_snapshot.py) | ||
| 209 | - 新增 `--output` | ||
| 210 | - 可直接写入 `.omx/latest_status_snapshot.json` | ||
| 211 | |||
| 212 | 验证结果: | ||
| 213 | - `/usr/local/miniconda3/bin/python scripts/status_snapshot.py --output .omx/latest_status_snapshot.json` 成功 | ||
| 214 | - 已验证: | ||
| 215 | - 文件存在 | ||
| 216 | - JSON 可解析 | ||
| 217 | - 包含 `latest_commit` | ||
| 218 | - 包含 `next_commands` | ||
| 219 | |||
| 220 | 结论: | ||
| 221 | - 新 session 现在可以直接读取最近一次状态快照文件 | ||
| 222 | - 交接信息更适合自动化和长期持续开发 | ||
| 223 | |||
| 205 | ### Stage: confused 定向优化 v6(sample-level weighting) | 224 | ### Stage: confused 定向优化 v6(sample-level weighting) |
| 206 | 225 | ||
| 207 | 完成项: | 226 | 完成项: | ... | ... |
| ... | @@ -276,6 +276,7 @@ | ... | @@ -276,6 +276,7 @@ |
| 276 | - [docs/session-handoff.md](./session-handoff.md) | 276 | - [docs/session-handoff.md](./session-handoff.md) |
| 277 | - [acr-engine/FIRST_RUN_CHECKLIST.md](../acr-engine/FIRST_RUN_CHECKLIST.md) | 277 | - [acr-engine/FIRST_RUN_CHECKLIST.md](../acr-engine/FIRST_RUN_CHECKLIST.md) |
| 278 | - 运行 [acr-engine/scripts/status_snapshot.py](../acr-engine/scripts/status_snapshot.py) | 278 | - 运行 [acr-engine/scripts/status_snapshot.py](../acr-engine/scripts/status_snapshot.py) |
| 279 | - 或直接查看最新落盘快照:`acr-engine/.omx/latest_status_snapshot.json` | ||
| 279 | 280 | ||
| 280 | 2. 检查真实数据是否已落位: | 281 | 2. 检查真实数据是否已落位: |
| 281 | - `acr-engine/data/raw/fma_small_audio/` | 282 | - `acr-engine/data/raw/fma_small_audio/` | ... | ... |
-
Please register or sign in to post a comment