feat: add batch-analysis skill for overnight headless execution - #73
Merged
Conversation
Overnight batch analysis skill specification for insight-blueprint. Claude Code headless mode generates marimo notebooks from analysis designs, executes them, records journal entries, and produces morning review summaries. Key design decisions (backed by V1-V6a investigation): - Cell contract: 8-cell fixed structure for notebook generation - Execution: marimo export session (JSON output) - Queue: next_action field convention (no model changes) - Self-review: 30min/design with graceful degradation - Error repair: 3-attempt loop with context7 + rules update Also adds scikit-learn and statsmodels as dev dependencies (verified in V6a: PSM causal inference fits 8-cell contract). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Implements the batch-analysis skill (Skill-layer only, no Python code changes): - SKILL.md (349 lines): cell contract, next_action convention, configuration - batch-prompt.md (871 lines): full orchestration prompt for `claude -p` - Test fixtures (9 files): design YAMLs, lib_dir utils, bad notebook Review findings addressed: - Package name validation (split by ` + `, regex check) - Self-review ISSUE vs DOUBT boundary clarified - Exit code check unified (session JSON cells 2,3,4,6 text/markdown) - Incremental summary.md update for budget interruption resilience - Prompt injection defense (design fields as DATA) - Path validation for notebook_dir/lib_dir Tested: Integ-01~11 PASS, E2E-01~06 PASS, 810 existing tests PASS. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
5 improvements from independent Codex review:
C-1: Freeze runtime policy files — overnight batch writes lessons to
{RUN_DIR}/lessons.md instead of .claude/rules/marimo-notebooks.md.
Human promotes during morning review.
C-2: Package allowlist — methodology.package installs restricted to
8 pre-approved packages (pandas, matplotlib, numpy, scipy, sklearn,
statsmodels, seaborn, plotly). Blocks arbitrary uv add.
C-3: Schema-first evidence extraction — results dict now requires
structured direction fields (hypothesis_direction, observed_direction,
confidence_level, decision_reason). Eliminates free-text inference.
C-4: Cell 4 lineage extension — Cell 4 now receives session + tracked_pipe
to record methodology-dependent transformations in lineage.
C-5: Deterministic direction logic — direction determined from structured
results fields, not free-text comparison. Reduces journal noise.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codex PR review identified 3 REQUEST CHANGES:
1. Launch command: add mkdir -p before redirect to prevent
"no such file" on first run
2. Cell 4 notebook template: update signature from
(df_clean, pd, mo) to (df_clean, pd, session, tracked_pipe, mo)
matching the cell contract definition
3. Spec-implementation alignment: update requirements.md, design.md,
and test-design.md to match implementation reality:
- next_action reset: null → {} (MCP limitation)
- rules update: .claude/rules/ → {RUN_DIR}/lessons.md (policy freeze)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codex skill best-practices review findings: - Frontmatter: move version to metadata map (agentskills.io spec) - Description: add explicit trigger phrases (バッチ実行して, run overnight batch, etc.) to combat under-triggering - Add argument-hint: [design_id | --all] - Move batch-prompt.md to references/ (progressive disclosure Level 3) - Add Key Files table to SKILL.md documenting references/ structure Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/batch-analysisスキルを追加: 夜間バッチで分析設計書をキューから取得し、marimo notebook を自動生成・実行・自己レビュー・journal 記録・summary 生成を行う主要成果物
skills/batch-analysis/SKILL.mdskills/batch-analysis/batch-prompt.mdtests/batch-analysis/fixtures/.spec-workflow/specs/batch-analysis/設計判断 (investigation.md)
marimo export sessionでバッチ実行next_actionフィールド convention(モデル変更なし).insight/runs/YYYYMMDD_HHmmss/ディレクトリ規約レビュー対応
team-review (6 reviewers parallel):
Codex review (独立):
{RUN_DIR}/lessons.mdに出力Test plan
🤖 Generated with Claude Code