@weldr/runr 0.4.0 → 0.7.3

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 (66) hide show
  1. package/CHANGELOG.md +166 -1
  2. package/README.md +124 -165
  3. package/dist/audit/classifier.js +331 -0
  4. package/dist/cli.js +570 -300
  5. package/dist/commands/audit.js +259 -0
  6. package/dist/commands/bundle.js +180 -0
  7. package/dist/commands/continue.js +276 -0
  8. package/dist/commands/doctor.js +430 -45
  9. package/dist/commands/hooks.js +352 -0
  10. package/dist/commands/init.js +368 -8
  11. package/dist/commands/intervene.js +109 -0
  12. package/dist/commands/meta.js +245 -0
  13. package/dist/commands/mode.js +157 -0
  14. package/dist/commands/orchestrate.js +29 -0
  15. package/dist/commands/packs.js +47 -0
  16. package/dist/commands/preflight.js +8 -5
  17. package/dist/commands/resume.js +421 -3
  18. package/dist/commands/run.js +63 -4
  19. package/dist/commands/status.js +47 -0
  20. package/dist/commands/submit.js +374 -0
  21. package/dist/config/schema.js +61 -1
  22. package/dist/diagnosis/analyzer.js +86 -1
  23. package/dist/diagnosis/formatter.js +3 -0
  24. package/dist/diagnosis/index.js +1 -0
  25. package/dist/diagnosis/stop-explainer.js +267 -0
  26. package/dist/diagnostics/stop-explainer.js +267 -0
  27. package/dist/guards/checkpoint.js +119 -0
  28. package/dist/journal/builder.js +36 -3
  29. package/dist/journal/renderer.js +19 -0
  30. package/dist/orchestrator/artifacts.js +17 -2
  31. package/dist/orchestrator/receipt.js +304 -0
  32. package/dist/output/stop-footer.js +185 -0
  33. package/dist/packs/actions.js +176 -0
  34. package/dist/packs/loader.js +200 -0
  35. package/dist/packs/renderer.js +46 -0
  36. package/dist/receipt/intervention.js +465 -0
  37. package/dist/receipt/writer.js +296 -0
  38. package/dist/redaction/redactor.js +95 -0
  39. package/dist/repo/context.js +147 -20
  40. package/dist/review/check-parser.js +211 -0
  41. package/dist/store/checkpoint-metadata.js +111 -0
  42. package/dist/store/run-store.js +21 -0
  43. package/dist/supervisor/runner.js +130 -10
  44. package/dist/tasks/task-metadata.js +74 -1
  45. package/dist/ux/brain.js +528 -0
  46. package/dist/ux/render.js +123 -0
  47. package/dist/ux/safe-commands.js +133 -0
  48. package/dist/ux/state.js +193 -0
  49. package/dist/ux/telemetry.js +110 -0
  50. package/package.json +3 -1
  51. package/packs/pr/pack.json +50 -0
  52. package/packs/pr/templates/AGENTS.md.tmpl +120 -0
  53. package/packs/pr/templates/CLAUDE.md.tmpl +101 -0
  54. package/packs/pr/templates/bundle.md.tmpl +27 -0
  55. package/packs/solo/pack.json +82 -0
  56. package/packs/solo/templates/AGENTS.md.tmpl +80 -0
  57. package/packs/solo/templates/CLAUDE.md.tmpl +126 -0
  58. package/packs/solo/templates/bundle.md.tmpl +27 -0
  59. package/packs/solo/templates/claude-cmd-bundle.md.tmpl +40 -0
  60. package/packs/solo/templates/claude-cmd-resume.md.tmpl +43 -0
  61. package/packs/solo/templates/claude-cmd-submit.md.tmpl +51 -0
  62. package/packs/solo/templates/claude-skill.md.tmpl +96 -0
  63. package/packs/trunk/pack.json +50 -0
  64. package/packs/trunk/templates/AGENTS.md.tmpl +87 -0
  65. package/packs/trunk/templates/CLAUDE.md.tmpl +126 -0
  66. package/packs/trunk/templates/bundle.md.tmpl +27 -0
@@ -0,0 +1,101 @@
1
+ # Claude Code Integration
2
+
3
+ This project uses Runr with Claude Code for agent tasks.
4
+
5
+ ## Quick Start
6
+
7
+ 1. Create feature branch: `git checkout -b feature/your-feature`
8
+ 2. Create task: `.runr/tasks/your-task.md`
9
+ 3. Run: `runr run --task .runr/tasks/your-task.md --worktree`
10
+ 4. Bundle: `runr bundle <run_id>`
11
+ 5. Create PR: `gh pr create --title "..." --body-file .runr/runs/<run_id>/bundle.md`
12
+
13
+ **PR workflow is the happy path.** Proof packets make reviews faster.
14
+
15
+ ## How Runr Works with Claude
16
+
17
+ Runr orchestrates Claude through a phase-gated workflow:
18
+
19
+ 1. **Plan**: Claude reads the task and plans implementation
20
+ 2. **Implement**: Worker executes the plan, making changes
21
+ 3. **Review**: Claude reviews changes against requirements
22
+ 4. **Verify**: Runr runs verification commands
23
+ 5. **Checkpoint**: If verified, create checkpoint with evidence
24
+
25
+ ## Configuration
26
+
27
+ See `.runr/runr.config.json` for:
28
+
29
+ - Worker configuration (Claude/Codex)
30
+ - Phase assignments
31
+ - Verification tiers
32
+ - Scope and file patterns
33
+
34
+ ## Determinism & Safety Are Sacred (Non-Negotiables)
35
+
36
+ These invariants are enforced by wrappers:
37
+
38
+ **P0-1 Determinism (bundle):**
39
+ - Same run_id → identical markdown output
40
+ - Quick check: `runr bundle <id> > /tmp/a && runr bundle <id> > /tmp/b && diff /tmp/a /tmp/b`
41
+
42
+ **P0-2 Dry-run safety (submit):**
43
+ - `submit --dry-run` changes **nothing**: no branch change, no file changes, no new timeline events
44
+ - Quick check: capture branch + status + timeline lines before/after
45
+
46
+ **P0-3 Recovery (submit):**
47
+ - Submit always restores starting branch, even on failure
48
+ - Quick check: run forced failure, confirm branch restored
49
+
50
+ **If anything violates P0 → stop and add regression test immediately.**
51
+
52
+ ## Concrete Commands (Copy-Paste)
53
+
54
+ **Bundle proof packet:**
55
+ ```bash
56
+ runr bundle <run_id> --output .runr/runs/<run_id>/bundle.md
57
+ ```
58
+
59
+ **Create PR with proof packet:**
60
+ ```bash
61
+ # Push feature branch
62
+ git push -u origin feature/your-feature
63
+
64
+ # Create PR with bundle as description
65
+ gh pr create --title "Feature: X" --body-file .runr/runs/<run_id>/bundle.md
66
+ ```
67
+
68
+ ## What To Do When Things Go Wrong
69
+
70
+ **PR conflicts:**
71
+ - Expect: Merge conflicts when PR is merged
72
+ - Check: GitHub PR conflict UI
73
+ - Resolve: Rebase feature branch on main, force push
74
+
75
+ **Validation fails:**
76
+ - Expect: Can't create verified checkpoint
77
+ - Check: Runr output for specific validation reason
78
+ - Resolve: Fix issues, re-run verification
79
+
80
+ **Any P0 violation:**
81
+ - Stop immediately
82
+ - Add regression test to prevent recurrence
83
+ - Escalate to project maintainers
84
+
85
+ ## Tips for Claude
86
+
87
+ - Always verify incrementally during implementation
88
+ - If verification fails, fix issues before review
89
+ - Keep changes focused on task requirements
90
+ - Use verification results to guide decisions
91
+
92
+ ## Workflow: PR
93
+
94
+ This project uses the **PR** pack:
95
+
96
+ - Integration branch: `{{integration_branch}}` (where PRs merge to)
97
+ - Feature branches: Create your own (e.g., `feature/add-x`)
98
+ - Requires verification: Yes
99
+ - Requires clean tree: Yes
100
+
101
+ Only verified checkpoints should be pushed to feature branches for PR review.
@@ -0,0 +1,27 @@
1
+ # Change Bundle: {{checkpoint_id}}
2
+
3
+ ## Summary
4
+
5
+ **Task**: {{task_name}}
6
+ **Checkpoint**: {{checkpoint_id}}
7
+ **Timestamp**: {{timestamp}}
8
+
9
+ ## Changes
10
+
11
+ {{changes_summary}}
12
+
13
+ ## Verification Evidence
14
+
15
+ {{verification_evidence}}
16
+
17
+ ## Review Notes
18
+
19
+ {{review_notes}}
20
+
21
+ ## Files Modified
22
+
23
+ {{files_modified}}
24
+
25
+ ---
26
+
27
+ Generated by Runr ({{pack_name}} workflow)
@@ -0,0 +1,82 @@
1
+ {
2
+ "pack_version": 1,
3
+ "name": "solo",
4
+ "display_name": "Solo Dev (dev → main, no PR)",
5
+ "description": "Fast local workflow with verified checkpoints, cherry-pick submit, and minimal docs.",
6
+ "defaults": {
7
+ "profile": "solo",
8
+ "integration_branch": "dev",
9
+ "release_branch": "main",
10
+ "submit_strategy": "cherry-pick",
11
+ "require_clean_tree": true,
12
+ "require_verification": true,
13
+ "protected_branches": ["main"]
14
+ },
15
+ "templates": {
16
+ "AGENTS.md": "templates/AGENTS.md.tmpl",
17
+ "CLAUDE.md": "templates/CLAUDE.md.tmpl",
18
+ "bundle.md": "templates/bundle.md.tmpl",
19
+ "claude-skill": "templates/claude-skill.md.tmpl",
20
+ "claude-cmd-bundle": "templates/claude-cmd-bundle.md.tmpl",
21
+ "claude-cmd-submit": "templates/claude-cmd-submit.md.tmpl",
22
+ "claude-cmd-resume": "templates/claude-cmd-resume.md.tmpl"
23
+ },
24
+ "init_actions": [
25
+ {
26
+ "type": "ensure_gitignore_entry",
27
+ "path": ".gitignore",
28
+ "line": ".runr/runs/"
29
+ },
30
+ {
31
+ "type": "ensure_gitignore_entry",
32
+ "path": ".gitignore",
33
+ "line": ".runr-worktrees/"
34
+ },
35
+ {
36
+ "type": "ensure_gitignore_entry",
37
+ "path": ".gitignore",
38
+ "line": ".runr/orchestrations/"
39
+ },
40
+ {
41
+ "type": "create_file_if_missing",
42
+ "path": "AGENTS.md",
43
+ "template": "AGENTS.md",
44
+ "mode": "0644"
45
+ },
46
+ {
47
+ "type": "create_file_if_missing",
48
+ "path": "CLAUDE.md",
49
+ "template": "CLAUDE.md",
50
+ "mode": "0644",
51
+ "when": { "flag": "with_claude" }
52
+ },
53
+ {
54
+ "type": "create_file_if_missing",
55
+ "path": ".claude/skills/runr-workflow/SKILL.md",
56
+ "template": "claude-skill",
57
+ "mode": "0644",
58
+ "when": { "flag": "with_claude" }
59
+ },
60
+ {
61
+ "type": "create_file_if_missing",
62
+ "path": ".claude/commands/runr-bundle.md",
63
+ "template": "claude-cmd-bundle",
64
+ "mode": "0644",
65
+ "when": { "flag": "with_claude" }
66
+ },
67
+ {
68
+ "type": "create_file_if_missing",
69
+ "path": ".claude/commands/runr-submit.md",
70
+ "template": "claude-cmd-submit",
71
+ "mode": "0644",
72
+ "when": { "flag": "with_claude" }
73
+ },
74
+ {
75
+ "type": "create_file_if_missing",
76
+ "path": ".claude/commands/runr-resume.md",
77
+ "template": "claude-cmd-resume",
78
+ "mode": "0644",
79
+ "when": { "flag": "with_claude" }
80
+ }
81
+ ]
82
+ }
@@ -0,0 +1,80 @@
1
+ # Agent Development Guide
2
+
3
+ ## Project: {{project_name}}
4
+
5
+ {{project_about}}
6
+
7
+ ## Workflow: Solo Dev (dev → main)
8
+
9
+ This project uses the **solo** workflow:
10
+
11
+ - **All work lands on `dev`** (or feature branches)
12
+ - Runr creates verified checkpoints with full test evidence
13
+ - Submit verified changes to `main` via: **bundle → dry-run → submit → (git push)**
14
+ - **Use wrappers, not manual steps**
15
+
16
+ **Key principle**: Only trustable, verified changes land on `main`.
17
+
18
+ ## Verification Requirements
19
+
20
+ All checkpoints must pass verification before submit:
21
+
22
+ {{verification_commands}}
23
+
24
+ ## Working with Runr
25
+
26
+ ### Create a verified checkpoint
27
+
28
+ ```bash
29
+ runr run --task .runr/tasks/my-task.md --worktree
30
+ ```
31
+
32
+ This creates a checkpoint with full verification evidence.
33
+
34
+ ### Submit verified changes to main
35
+
36
+ **Preferred (uses wrapper for safety):**
37
+ ```bash
38
+ ./scripts/dogfood-submit.sh <checkpoint-id> --to main
39
+ ```
40
+
41
+ **Manual (escape hatch only):**
42
+ ```bash
43
+ runr submit <checkpoint-id> --to main
44
+ ```
45
+
46
+ Both cherry-pick the verified checkpoint to `main` (requires clean tree + verification evidence).
47
+
48
+ ### View bundle/evidence
49
+
50
+ ```bash
51
+ runr bundle <checkpoint-id> --output /tmp/bundle-<checkpoint-id>.md
52
+ ```
53
+
54
+ Shows the complete change bundle with verification results.
55
+
56
+ ## Guidelines for Agents
57
+
58
+ 1. **Read first**: Always read files before modifying
59
+ 2. **Verify incrementally**: Don't wait until the end to verify
60
+ 3. **Keep changes focused**: Smaller checkpoints are easier to review and submit
61
+ 4. **Trust verification**: If verification passes, the change is trustable
62
+ 5. **Document decisions**: Update this file or task files with important context
63
+
64
+ ## Integration Safety Rules
65
+
66
+ **When to use wrapper vs manual:**
67
+ - **Wrapper (preferred):** If your project has a submit wrapper script, use it for automated safety checks
68
+ - **Manual (escape hatch):** Use `runr submit` directly for quick iterations or when no wrapper exists
69
+
70
+ **If any invariant breaks during submit:**
71
+ - Stop immediately
72
+ - Add regression test to prevent recurrence
73
+ - Fix the invariant violation before continuing
74
+
75
+ **Optional friction logging:**
76
+ - If something costs >2 minutes or happens twice, consider logging it for team discussion
77
+
78
+ ## Project Structure
79
+
80
+ See the existing codebase for structure. Runr automatically detects verification commands from your project setup.
@@ -0,0 +1,126 @@
1
+ # Claude Code Integration
2
+
3
+ This project uses Runr with Claude Code for agent tasks.
4
+
5
+ ## Quick Start
6
+
7
+ 1. Ensure Claude Code is installed and configured
8
+ 2. Create tasks in `.runr/tasks/`
9
+ 3. Run: `runr run --task .runr/tasks/your-task.md --worktree`
10
+ 4. Submit: `runr submit <run_id> --to {{integration_branch}}`
11
+
12
+ **Runr-native workflow is the happy path.** Manual cherry-pick is the escape hatch only.
13
+
14
+ **Tip:** If your project has a submit wrapper (e.g., `./scripts/submit-wrapper.sh`), use that instead for automated safety checks.
15
+
16
+ ## How Runr Works with Claude
17
+
18
+ Runr orchestrates Claude through a phase-gated workflow:
19
+
20
+ 1. **Plan**: Claude reads the task and plans implementation
21
+ 2. **Implement**: Worker executes the plan, making changes
22
+ 3. **Review**: Claude reviews changes against requirements
23
+ 4. **Verify**: Runr runs verification commands
24
+ 5. **Checkpoint**: If verified, create checkpoint with evidence
25
+
26
+ ## Configuration
27
+
28
+ See `.runr/runr.config.json` for:
29
+
30
+ - Worker configuration (Claude/Codex)
31
+ - Phase assignments
32
+ - Verification tiers
33
+ - Scope and file patterns
34
+
35
+ ## Determinism & Safety Are Sacred (Non-Negotiables)
36
+
37
+ These invariants are enforced by wrappers:
38
+
39
+ **P0-1 Determinism (bundle):**
40
+ - Same run_id → identical markdown output
41
+ - Quick check: `runr bundle <id> > /tmp/a && runr bundle <id> > /tmp/b && diff /tmp/a /tmp/b`
42
+
43
+ **P0-2 Dry-run safety (submit):**
44
+ - `submit --dry-run` changes **nothing**: no branch change, no file changes, no new timeline events
45
+ - Quick check: capture branch + status + timeline lines before/after
46
+
47
+ **P0-3 Recovery (submit):**
48
+ - Submit always restores starting branch, even on failure
49
+ - Quick check: run forced failure, confirm branch restored
50
+
51
+ **If anything violates P0 → stop and add regression test immediately.**
52
+
53
+ ## Concrete Commands (Copy-Paste)
54
+
55
+ **Bundle evidence:**
56
+ ```bash
57
+ runr bundle <run_id> --output /tmp/bundle-<run_id>.md
58
+ ```
59
+
60
+ **Submit to integration branch:**
61
+ ```bash
62
+ runr submit <run_id> --to {{integration_branch}}
63
+ ```
64
+
65
+ **Dry-run first (recommended):**
66
+ ```bash
67
+ runr submit <run_id> --to {{integration_branch}} --dry-run
68
+ ```
69
+
70
+ ## What To Do When Things Go Wrong
71
+
72
+ **Submit conflict:**
73
+ - Expect: `submit_conflict` event written + clean tree + branch restored
74
+ - Check: timeline.jsonl for conflicted files list
75
+ - Resolve: manual cherry-pick or rebase checkpoint
76
+
77
+ **Validation fails:**
78
+ - Expect: `submit_validation_failed` event written, **no git mutations**
79
+ - Check: error message for specific validation reason (dirty_tree, verification_missing, etc.)
80
+ - Resolve: fix validation issue, retry submit
81
+
82
+ **Any P0 violation:**
83
+ - Stop immediately
84
+ - Add regression test to prevent recurrence
85
+ - Escalate to project maintainers
86
+
87
+ ## Tips for Claude
88
+
89
+ - Always verify incrementally during implementation
90
+ - If verification fails, fix issues before review
91
+ - Keep changes focused on task requirements
92
+ - Use verification results to guide decisions
93
+
94
+ ## Meta-Agent Safety Contract
95
+
96
+ If you are a meta-agent driving Runr workflows, you MUST obey these rules:
97
+
98
+ **Rule 1: Never delete on dirty tree**
99
+ - Before any file deletion, check: `git status --porcelain`
100
+ - If output is non-empty, refuse deletion with: "Working tree has uncommitted changes. Commit or stash before deletion."
101
+
102
+ **Rule 2: Never delete outside `.runr/` without explicit file list**
103
+ - If asked to "clean up" or "remove files", respond: "I can only safely delete files within `.runr/` directory. For project files, provide explicit file list."
104
+ - Never assume what "cleanup" means
105
+
106
+ **Rule 3: Must end with bundle + dry-run**
107
+ - Every task execution must end with:
108
+ ```bash
109
+ runr bundle <run_id> --output /tmp/bundle-<run_id>.md
110
+ runr submit <run_id> --to {{integration_branch}} --dry-run
111
+ runr submit <run_id> --to {{integration_branch}}
112
+ ```
113
+ - Generate review artifact even if coding manually
114
+
115
+ **Violation of any rule = stop and ask user for clarification.**
116
+
117
+ ## Workflow: {{pack_name}}
118
+
119
+ This project uses the **{{pack_name}}** pack:
120
+
121
+ - Integration branch: `{{integration_branch}}`
122
+ - Release branch: `{{release_branch}}`
123
+ - Requires verification: Yes
124
+ - Requires clean tree: Yes
125
+
126
+ Only verified checkpoints can be submitted to production branches.
@@ -0,0 +1,27 @@
1
+ # Change Bundle: {{checkpoint_id}}
2
+
3
+ ## Summary
4
+
5
+ **Task**: {{task_name}}
6
+ **Checkpoint**: {{checkpoint_id}}
7
+ **Timestamp**: {{timestamp}}
8
+
9
+ ## Changes
10
+
11
+ {{changes_summary}}
12
+
13
+ ## Verification Evidence
14
+
15
+ {{verification_evidence}}
16
+
17
+ ## Review Notes
18
+
19
+ {{review_notes}}
20
+
21
+ ## Files Modified
22
+
23
+ {{files_modified}}
24
+
25
+ ---
26
+
27
+ Generated by Runr ({{pack_name}} workflow)
@@ -0,0 +1,40 @@
1
+ ---
2
+ description: Generate Runr evidence bundle for review
3
+ ---
4
+
5
+ # Bundle Evidence
6
+
7
+ Generates a deterministic Markdown evidence packet for a Runr run.
8
+
9
+ ## Usage
10
+
11
+ ```bash
12
+ runr bundle <run_id> --output /tmp/bundle-<run_id>.md
13
+ ```
14
+
15
+ ## What's in the bundle?
16
+
17
+ - Checkpoint metadata
18
+ - Milestone progression
19
+ - Verification evidence
20
+ - Diff statistics
21
+ - Timeline summary
22
+
23
+ ## When to use
24
+
25
+ - Before submitting verified work
26
+ - When debugging why verification failed
27
+ - When providing audit trail to team
28
+
29
+ ## Example
30
+
31
+ ```bash
32
+ # After a successful run
33
+ runr bundle abc123 --output /tmp/bundle-abc123.md
34
+
35
+ # Review the bundle
36
+ cat /tmp/bundle-abc123.md
37
+
38
+ # Then proceed to dry-run submit
39
+ runr submit abc123 --to {{integration_branch}} --dry-run
40
+ ```
@@ -0,0 +1,43 @@
1
+ ---
2
+ description: Resume Runr run from last checkpoint
3
+ ---
4
+
5
+ # Resume from Checkpoint
6
+
7
+ Continues a stopped run from its last verified checkpoint.
8
+
9
+ ## Usage
10
+
11
+ ```bash
12
+ runr resume <run_id>
13
+ ```
14
+
15
+ ## Options
16
+
17
+ - `--plan` - Show resume plan without executing
18
+ - `--force` - Resume despite environment fingerprint mismatch
19
+ - `--auto-stash` - Automatically stash uncommitted changes
20
+
21
+ ## When to use
22
+
23
+ - Verification failed and you fixed the issue
24
+ - Run hit time budget
25
+ - Run stopped due to scope violation
26
+ - Worker timed out or stalled
27
+
28
+ ## Preview before resuming
29
+
30
+ ```bash
31
+ # See what will happen without executing
32
+ runr resume <run_id> --plan
33
+ ```
34
+
35
+ ## Auto-resume mode
36
+
37
+ For transient failures (timeouts, stalls), you can use auto-resume:
38
+
39
+ ```bash
40
+ runr watch <run_id> --auto-resume --max-attempts 3
41
+ ```
42
+
43
+ This will automatically resume when the run stops, up to 3 times.
@@ -0,0 +1,51 @@
1
+ ---
2
+ description: Submit verified checkpoint to integration branch
3
+ ---
4
+
5
+ # Submit Verified Checkpoint
6
+
7
+ Cherry-picks a verified checkpoint to the integration branch.
8
+
9
+ ## Usage
10
+
11
+ **Always dry-run first:**
12
+ ```bash
13
+ runr submit <run_id> --to {{integration_branch}} --dry-run
14
+ ```
15
+
16
+ **Then submit:**
17
+ ```bash
18
+ runr submit <run_id> --to {{integration_branch}}
19
+ ```
20
+
21
+ **Optional: push to origin:**
22
+ ```bash
23
+ runr submit <run_id> --to {{integration_branch}} --push
24
+ ```
25
+
26
+ ## Requirements
27
+
28
+ - Checkpoint must exist
29
+ - Verification evidence must be present
30
+ - Working tree must be clean
31
+ - Target branch must exist
32
+
33
+ ## If it fails
34
+
35
+ Check the error:
36
+ - `dirty_tree` → commit or stash changes
37
+ - `verification_missing` → run wasn't verified
38
+ - `submit_conflict` → manual resolution needed
39
+ - `target_branch_missing` → create branch first
40
+
41
+ ## Recovery
42
+
43
+ If submit is interrupted, the command always restores your starting branch.
44
+ Check `git status` and retry.
45
+
46
+ ## Workflow
47
+
48
+ This project uses the **{{pack_name}}** workflow:
49
+ - Integration branch: `{{integration_branch}}`
50
+ - Release branch: `{{release_branch}}`
51
+ - Only verified checkpoints can be submitted
@@ -0,0 +1,96 @@
1
+ ---
2
+ name: runr-workflow
3
+ description: Safe, checkpointed Runr workflow - always verify and bundle before finish
4
+ ---
5
+
6
+ # Runr Workflow Skill
7
+
8
+ You are working in a repository using **Runr** for safe, verified agent work.
9
+
10
+ ## When to Use Runr (Decision Tree)
11
+
12
+ **REQUIRED - Use `runr run` for:**
13
+ - Any change to `src/**` (code changes)
14
+ - New features or modules
15
+ - Bug fixes
16
+ - Refactoring
17
+ - Anything that needs verification (build/tests)
18
+
19
+ **OPTIONAL - Direct editing acceptable for:**
20
+ - Documentation only (`docs/**`, `README.md`, `CHANGELOG.md`)
21
+ - Spec files and planning artifacts
22
+ - Config tweaks (`.runr/runr.config.json`)
23
+ - Task file creation (`.runr/tasks/*.md`)
24
+
25
+ **How to decide:** If it touches code that could break the build or tests, use Runr. If it's just words, direct edit is fine.
26
+
27
+ ## The Runr Loop (For Code Changes)
28
+
29
+ 1. **Create task file** → `.runr/tasks/your-task.md`
30
+ 2. **Run** → `runr run --task .runr/tasks/your-task.md --worktree`
31
+ 3. **Verify** → Runr handles build + tests automatically
32
+ 4. **Checkpoint** → Verified work saved as git commit
33
+ 5. **Bundle + Submit** → Evidence packet + integration
34
+
35
+ ## Commands You'll Use
36
+
37
+ - `runr run --task .runr/tasks/<name>.md --worktree` - Start task
38
+ - `runr status <run_id>` - Check progress
39
+ - `runr resume <run_id>` - Continue from checkpoint
40
+ - `runr bundle <run_id>` - Generate evidence packet
41
+ - `runr submit <run_id> --to {{integration_branch}} --dry-run` - Preview submit
42
+ - `runr submit <run_id> --to {{integration_branch}}` - Submit verified work
43
+
44
+ ## Safety Rules (CRITICAL - Never Violate)
45
+
46
+ ### Rule 1: Never delete on dirty tree
47
+ - Before any file deletion, run: `git status --porcelain`
48
+ - If output is non-empty: **REFUSE** with message:
49
+ "Working tree has uncommitted changes. Commit or stash before deletion."
50
+
51
+ ### Rule 2: Never delete outside `.runr/` without explicit file list
52
+ - If asked to "clean up" or "remove files", respond:
53
+ "I can only safely delete files within `.runr/` directory.
54
+ For project files, provide explicit file list."
55
+ - **Never assume** what "cleanup" means
56
+
57
+ ### Rule 3: Must end with bundle + dry-run
58
+ Every task must end with:
59
+ ```bash
60
+ runr bundle <run_id> --output /tmp/bundle.md
61
+ runr submit <run_id> --to {{integration_branch}} --dry-run
62
+ # Review dry-run output
63
+ runr submit <run_id> --to {{integration_branch}}
64
+ ```
65
+
66
+ ### Rule 4: Trust verification, not promises
67
+ - Verification passed = trustable change
68
+ - No verification = not trustable
69
+ - Never claim "tests passed" without evidence
70
+
71
+ ## When Things Go Wrong
72
+
73
+ ### Verification fails
74
+ 1. Read the error output carefully
75
+ 2. Fix the specific issue
76
+ 3. Re-verify
77
+ 4. Don't move to next milestone until verification passes
78
+
79
+ ### Scope violation
80
+ 1. Stop immediately
81
+ 2. Run `runr bundle <run_id>`
82
+ 3. Explain what file was outside scope
83
+ 4. Ask user to adjust scope or task
84
+
85
+ ### Submit conflict
86
+ 1. Expect `submit_conflict` event
87
+ 2. Check timeline.jsonl for conflicted files
88
+ 3. Inform user - they must resolve manually
89
+
90
+ ## Evidence Discipline
91
+
92
+ - Always paste command outputs, don't paraphrase
93
+ - If verification fails, show the error in full
94
+ - Bundle contains the audit trail - use it
95
+
96
+ **Violation of any safety rule = stop and ask user for clarification.**