@raquezha/norpiv 0.0.4 → 0.0.6

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.
package/README.md CHANGED
@@ -20,7 +20,7 @@ Auxiliary hygiene:
20
20
 
21
21
  | Command | Purpose | Input / Output Files |
22
22
  | :--- | :--- | :--- |
23
- | `/cleanup` | Declutter Git branches and completed task folders after work is merged/closed. | Prunes finished task folders & resets pointer when safe |
23
+ | `/post-merge-prune` | Delete stale local branches after a PR/MR is merged, prune remote refs, and clean completed task folders. | Post-merge branch cleanup plus safe task-folder cleanup |
24
24
 
25
25
  ---
26
26
 
@@ -51,7 +51,7 @@ Best for trying or handing off RPIV skills without installing the full `nothing`
51
51
 
52
52
  ```bash
53
53
  npx -y skills add raquezha/nothing --full-depth -g -a pi \
54
- -s triage frame grill-with-docs plan implement verify sync cleanup update-docs distill \
54
+ -s triage frame grill-with-docs plan implement verify sync post-merge-prune update-docs distill \
55
55
  -y
56
56
  ```
57
57
 
@@ -84,7 +84,7 @@ Targets:
84
84
 
85
85
  | Hat | Purpose |
86
86
  | :--- | :--- |
87
- | `pi --rpiv` | Full RPIV workflow. Loads triage, frame, grill-with-docs, plan, implement, verify, sync, cleanup, and update-docs. |
87
+ | `pi --rpiv` | Full RPIV workflow. Loads triage, frame, grill-with-docs, plan, implement, verify, sync, post-merge-prune, and update-docs. |
88
88
  | `pi --notes` | Conversation distiller. Saves useful thinking to Obsidian without RPIV ceremony. |
89
89
 
90
90
  ## 📝 Pre-RPIV note capture
@@ -152,7 +152,7 @@ Obsidian note → /triage → RPIV (only when ready to commit)
152
152
  ```text
153
153
  /verify
154
154
  /sync
155
- /cleanup
155
+ /post-merge-prune
156
156
  ```
157
157
 
158
158
  ## 🧭 Shared helper scripts
@@ -136,7 +136,7 @@ function writeCodexAdapter(root, names, sharedNames, opts) {
136
136
  const sharedLines = sharedNames.length
137
137
  ? `\nShared helpers:\n\n${sharedNames.map((name) => `- ${name}/`).join("\n")}\n`
138
138
  : "";
139
- const body = `# norpiv RPIV skills for Codex\n\nCodex does not currently auto-load Pi/Claude SKILL.md bundles from npm.\n\nUse these installed skill instructions as a portable RPIV workflow reference:\n\n${names.map((name) => `- ${name}/SKILL.md`).join("\n")}\n${sharedLines}\nCore lifecycle: triage frame grill-with-docs plan implement verify sync cleanup.\n\nIf your Codex environment supports AGENTS.md discovery, copy or reference this file from your project.\n`;
139
+ const body = `# norpiv RPIV skills for Codex\n\nCodex does not currently auto-load Pi/Claude SKILL.md bundles from npm.\n\nUse these installed skill instructions as a portable RPIV workflow reference:\n\n${names.map((name) => `- ${name}/SKILL.md`).join("\n")}\n${sharedLines}\nCore lifecycle: triage -> frame -> grill-with-docs -> plan -> implement -> verify -> sync -> post-merge-prune.\n\nIf your Codex environment supports AGENTS.md discovery, copy or reference this file from your project.\n`;
140
140
  log(opts, `write Codex adapter ${adapter}`);
141
141
  if (!opts.dryRun) fs.writeFileSync(adapter, body);
142
142
  }
package/distill/SKILL.md CHANGED
@@ -180,7 +180,7 @@ If writing fails, output the markdown to stdout so the user can copy it manually
180
180
  - Does not require `WORK.md`
181
181
  - Does not interact with `.workflow/` directory
182
182
  - Does not sync to Jira, GitHub, or GitLab
183
- - Does not run cleanup
183
+ - Does not run post-merge-prune
184
184
  - Does not require any existing task or ticket
185
185
 
186
186
  ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raquezha/norpiv",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "Bundled RPIV workflow skills for Pi, Claude, and Codex-style coding agents",
5
5
  "type": "commonjs",
6
6
  "bin": {
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "files": [
10
10
  "bin",
11
- "cleanup",
11
+ "post-merge-prune",
12
12
  "distill",
13
13
  "frame",
14
14
  "grill-with-docs",
@@ -44,7 +44,7 @@
44
44
  "verify",
45
45
  "sync",
46
46
  "update-docs",
47
- "cleanup",
47
+ "post-merge-prune",
48
48
  "distill"
49
49
  ]
50
50
  }
@@ -0,0 +1,55 @@
1
+ ---
2
+ name: post-merge-prune
3
+ description: "Post-merge branch cleanup only. Use after a PR/MR is merged and the local feature branch is stale: prune remote refs and delete local branches already merged into the target branch."
4
+ ---
5
+
6
+ # Skill: post-merge-prune
7
+
8
+ > [!IMPORTANT]
9
+ > **LLM INSTRUCTION**: This skill is a deliberate post-merge deletion tool. If the user invokes `post-merge-prune`, they want stale local branches removed after merge into the intended target branch. Do not offer a menu of options. Do not ask "Dry run or Execute?". Proceed directly.
10
+
11
+ Use this skill after a PR/MR has been merged into its intended branch, typically `main`, to remove stale remote-tracking refs and delete the matching local branches because the work is done.
12
+
13
+ ## Goal
14
+ - Switch to the intended target branch (`main` by default).
15
+ - Prune deleted remote branches.
16
+ - Delete local branches that are already merged into the target branch.
17
+ - Optionally remove matching workflow task folders.
18
+
19
+ ## Workflow
20
+
21
+ ### Step 1: Go to the target branch
22
+ - `git checkout main` (or the intended merge target)
23
+ - If the tree is dirty, stash first.
24
+
25
+ ### Step 2: Prune remote-tracking refs
26
+ - `git remote update origin --prune`
27
+ - This removes local refs for remote branches that were deleted after merge.
28
+
29
+ ### Step 3: Delete merged local branches
30
+ Iterate through local branches and delete the ones already merged into the target branch:
31
+ - Use `git branch -d <branch>` for normal merges.
32
+ - If `-d` refuses but `git log main..[branch]` is empty, the branch was squash-merged; use `git branch -D <branch>`.
33
+ - Never delete the active target branch.
34
+
35
+ ### Step 4: Optional workflow cleanup
36
+ If a deleted branch has a matching `.workflow/tasks/*` folder, remove it.
37
+ If `.workflow/active_task.json` points to a deleted task, clear it.
38
+
39
+ ### Step 5: Verify
40
+ - `git branch -a` should no longer show deleted refs.
41
+ - `git branch --merged main` should only show branches you intend to keep.
42
+ - `.workflow/tasks/` should not contain deleted tasks.
43
+
44
+ ## Guardrails
45
+ - **RESOLUTION OVER REPORTING**: If merge status is unclear, check `git branch --merged main` or `git log main..branch` and resolve it.
46
+ - **NO DRY RUNS BY DEFAULT**: Execute the cleanup unless the user explicitly asks for a preview.
47
+ - **SMART DELETE**: If a branch is squash-merged, delete it with `git branch -D` after confirming there are no unique commits left.
48
+ - **ACTIVE BRANCH PROTECTION**: Do not delete the current branch.
49
+ - **UNMERGED WORK**: If a branch has unique commits and no remote, ask once before force-deleting.
50
+
51
+ ## Output Contract
52
+ Return a concise report:
53
+ - **Cleaned**: deleted branches / task folders
54
+ - **Kept**: branches still in use
55
+ - **Working Branch**: the branch left checked out (should be `main`)
@@ -0,0 +1,27 @@
1
+ #!/bin/bash
2
+ # Deterministically grabs the active Pi model from the current session logs
3
+
4
+ # Format PWD to match Pi's session directory naming convention
5
+ SAFE_PWD=$(pwd | sed 's/\//-/g' | sed 's/^-/--/')
6
+ TARGET_DIR="$HOME/.pi/agent/sessions/${SAFE_PWD}--"
7
+
8
+ if [ -d "$TARGET_DIR" ]; then
9
+ LATEST_FILE=$(ls -t "$TARGET_DIR" | head -n 1 2>/dev/null)
10
+ if [ -n "$LATEST_FILE" ]; then
11
+ PROVIDER=$(cat "$TARGET_DIR/$LATEST_FILE" | grep -o '"provider":"[^"]*"' | tail -n 1 | cut -d'"' -f4)
12
+ MODEL=$(cat "$TARGET_DIR/$LATEST_FILE" | grep -o '"model":"[^"]*"' | tail -n 1 | cut -d'"' -f4)
13
+
14
+ if [ -n "$MODEL" ]; then
15
+ # If provider exists, prefix it, otherwise just return model
16
+ if [ -n "$PROVIDER" ]; then
17
+ echo "$PROVIDER:$MODEL"
18
+ else
19
+ echo "UnknownProvider:$MODEL"
20
+ fi
21
+ exit 0
22
+ fi
23
+ fi
24
+ fi
25
+
26
+ # Fallback if no active session log can be parsed
27
+ echo "UnknownAgent:UnknownModel"
@@ -42,6 +42,30 @@ reposcry_indexed_files() {
42
42
  reposcry stats 2>/dev/null | awk '/Files indexed:/ {print $3; exit}'
43
43
  }
44
44
 
45
+ # Quick health check for Pulse info
46
+ check_pulse() {
47
+ if ! command -v reposcry >/dev/null 2>&1; then
48
+ echo "PULSE: Missing (Not installed)"
49
+ return
50
+ fi
51
+ if [[ ! -d .reposcry ]]; then
52
+ echo "PULSE: Cold (No cache)"
53
+ return
54
+ fi
55
+ local files
56
+ files=$(reposcry_indexed_files || echo "0")
57
+ if [[ "$files" == "0" ]]; then
58
+ echo "PULSE: Cold (Zero files)"
59
+ else
60
+ echo "PULSE: Warm ($files files)"
61
+ fi
62
+ }
63
+
64
+ if [[ "${1:-}" == "--pulse" ]]; then
65
+ check_pulse
66
+ exit 0
67
+ fi
68
+
45
69
  ensure_reposcry_gitignore
46
70
  refuse_tracked_reposcry_cache
47
71
 
@@ -20,7 +20,15 @@ cd "$REPO_ROOT"
20
20
  "$SCRIPT_DIR/reposcry-bootstrap.sh" || true
21
21
 
22
22
  mkdir -p .reposcry
23
- BUDGET=${REPOSCRY_CONTEXT_BUDGET:-20000}
23
+
24
+ # Detect low-token modes (Caveman, etc.)
25
+ DEFAULT_BUDGET=20000
26
+ if [[ "${CAVEMAN_MODE:-off}" != "off" ]] || [[ "${LOW_TOKEN_MODE:-0}" == "1" ]]; then
27
+ DEFAULT_BUDGET=5000
28
+ echo "Low-token mode detected: reducing context budget to $DEFAULT_BUDGET"
29
+ fi
30
+
31
+ BUDGET=${REPOSCRY_CONTEXT_BUDGET:-$DEFAULT_BUDGET}
24
32
  OUTPUT_PATH=".reposcry/AI_CONTEXT.md"
25
33
 
26
34
  echo "Generating RepoScry task context at $OUTPUT_PATH..."
@@ -289,7 +289,7 @@ if [[ -n "$WORK_MD" && -f "$WORK_MD" ]]; then
289
289
  fi
290
290
 
291
291
  if [[ "$META_STATUS" =~ ^(done|archived)$ ]]; then
292
- warn "active pointer references a task with status=$META_STATUS; consider cleanup, archive handling, or reopening intentionally"
292
+ warn "active pointer references a task with status=$META_STATUS; consider post-merge-prune, archive handling, or reopening intentionally"
293
293
  fi
294
294
 
295
295
  echo
@@ -315,7 +315,7 @@ if [[ -n "$WORK_MD" && -f "$WORK_MD" ]]; then
315
315
  fi
316
316
  if [[ -n "$META_STATUS" && "$META_STATUS" =~ ^(done|archived)$ ]]; then
317
317
  echo " - Choose intentionally: $TRIAGE_HELPER ${TASK_SOURCE:-local} ${TASK_ID:-task} reopen"
318
- echo " - Or leave closed and run cleanup when appropriate."
318
+ echo " - Or leave closed and run post-merge-prune when appropriate."
319
319
  fi
320
320
  if [[ "$WARNINGS" -eq 0 && "$ERRORS" -eq 0 ]]; then
321
321
  echo " - No fixes suggested."
package/sync/SKILL.md CHANGED
@@ -128,4 +128,4 @@ Return a concise summary:
128
128
  - **Action**: no-op / updated existing status / created new status
129
129
  - **Reason**: marker found, body identical, marker missing, etc.
130
130
  - **Link**: remote comment/note URL if available
131
- - **Next step**: review, verify, cleanup, or continue implementation
131
+ - **Next step**: review, verify, post-merge-prune, or continue implementation
package/triage/SKILL.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: triage
3
- description: "Ingest or resume a tracked/local task in the RPIV workspace. Use when starting or returning to jira:, github:, gitlab:, or local: work and you need canonical WORK.md state without duplicating scaffold."
3
+ description: "Ingest or resume a tracked/local task in the RPIV workspace. Use when starting or returning to jira:, github:, gitlab:, or local: work and you need canonical WORK.md state without duplicating the scaffold."
4
4
  ---
5
5
 
6
6
  # Skill: triage
@@ -8,10 +8,10 @@ description: "Ingest or resume a tracked/local task in the RPIV workspace. Use w
8
8
  Start RPIV by creating, resuming, or explicitly reopening a task workspace.
9
9
 
10
10
  ## Guardrails
11
- - READ: user argument, `.workflow/active_task.json` when present, target `metadata.json`, and target `WORK.md` when resuming.
12
- - WRITE: `.workflow/tasks/[source-id]/WORK.md`, `.workflow/tasks/[source-id]/metadata.json`, `.workflow/active_task.json`; optional `.reposcry/` cache files only when RepoScry is installed.
11
+ - READ: user argument, `.workflow/active_task.json` if present, target `metadata.json`, and target `WORK.md` if resuming.
12
+ - WRITE: `.workflow/tasks/[source-id]/WORK.md`, `.workflow/tasks/[source-id]/metadata.json`, `.workflow/active_task.json`; optional `.reposcry/` cache files only if RepoScry is installed.
13
13
  - On **create**, initialize required guarded sections only if absent: `[BRIEF]`, `[GRILL]`, `[PLAN]`, `[LOG]`, `[META]`.
14
- - On **resume**, only update `.workflow/active_task.json`, metadata timestamps/state as needed, `[META]`, and append one concise `[LOG]` entry.
14
+ - On **resume**, only update `.workflow/active_task.json`, metadata timestamps/state as needed, and `[META]`, then append one concise `[LOG]` entry.
15
15
  - NEVER: duplicate guarded sections.
16
16
  - NEVER: overwrite existing `[BRIEF]`, `[GRILL]`, or `[PLAN]` during triage.
17
17
  - NEVER: create `PROBLEM.md`, `PRD.md`, `PLAN.md`, or `EVIDENCE.md`.
@@ -21,49 +21,34 @@ Start RPIV by creating, resuming, or explicitly reopening a task workspace.
21
21
  - NEVER: mutate `done` or `archived` tasks unless the user explicitly requested `reopen`, `fresh`, or `reset`.
22
22
 
23
23
  ## Command forms
24
- - `/triage local:setup-v2` — auto mode: create if missing, resume if active/blocked.
25
- - `/triage resume local:setup-v2` — resume existing task; create if missing only when helper reports that behavior.
26
- - `/triage reopen local:setup-v2` — explicitly reopen a done/archived task and mark it active.
27
- - `/triage fresh local:setup-v2` — archive/reset the previous task workspace and create a fresh one.
28
- - `/triage reset local:setup-v2` — alias for fresh/reset behavior when supported by the helper.
29
24
 
30
- ## Semantics
31
-
32
- ### Create
33
- Use when the target task folder does not exist.
34
- - Fetch remote issue data for `github:`, `gitlab:`, or `jira:` sources.
35
- - Create `.workflow/tasks/[source-id]/metadata.json` with at least `id`, `source`, `taskFolder`, `branch`, `status`, `phase`, `createdAt`, `updatedAt`.
36
- - Create `.workflow/tasks/[source-id]/WORK.md` with guarded RPIV sections.
37
- - Set `status=active` and `phase=triaged`.
38
- - Write canonical `.workflow/active_task.json`.
39
-
40
- ### Resume
41
- Use when the task exists and `status` is `active`, `blocked`, or missing/legacy.
42
- - Do not refetch remote data.
43
- - Do not rewrite the brief, grill notes, or plan.
25
+ ### /triage local:setup-v2
26
+ - **Standard/auto mode**: create if missing, resume if active/blocked.
27
+ - Will not rewrite brief, grill notes, or plan.
44
28
  - Backfill missing metadata fields without destroying unknown fields.
45
29
  - Refresh active pointer and human-readable `[META]`.
46
30
  - Append one timestamped `[LOG]` entry such as `Task resumed via /triage`.
47
31
 
48
- ### Reopen
49
- Use only when the user explicitly asks to reopen a task that is `done` or `archived`.
32
+ ### /triage local:setup-v2 reopen
33
+ - Use only if user explicitly asks to reopen a task that is `done` or `archived`.
50
34
  - Mark `status=active`.
51
35
  - Preserve existing `WORK.md` history.
52
36
  - Append a `[LOG]` entry explaining the reopen.
53
37
  - Recommend returning to the next valid RPIV stage based on existing sections.
54
38
 
55
- ### Fresh / reset
56
- Use only when the user explicitly asks to start over.
57
- - Preserve or archive the old task workspace before creating a new one when the helper supports it.
58
- - Create a new task workspace with clean guarded sections.
39
+ ### /triage local:setup-v2 fresh / reset
40
+ - Use only if user explicitly asks to start over.
41
+ - Preserve or archive old task workspace before creating new one when helper supports it.
42
+ - Create new task workspace with clean guarded sections.
59
43
  - Do not silently delete task history.
60
44
 
61
45
  ### Refuse
62
- Use when auto/resume mode targets a `done` or `archived` task.
46
+ - Use when auto/resume mode targets a `done` or `archived` task.
63
47
  - Stop instead of mutating.
64
- - Tell the user to choose `reopen` or `fresh/reset`.
48
+ - Tell user to choose `reopen` or `fresh/reset`.
65
49
 
66
50
  ## Workflow
51
+
67
52
  1. Parse optional mode and required namespace:
68
53
  - `jira:PROJ-123` -> `jira-PROJ-123`
69
54
  - `github:42` -> `github-42`
@@ -72,23 +57,24 @@ Use when auto/resume mode targets a `done` or `archived` task.
72
57
  2. Run the bundled helper script: `../scripts/triage_helper.sh <source> <id> [mode]`.
73
58
  - Preferred absolute path: `<skill_dir>/../scripts/triage_helper.sh`.
74
59
  3. Read the resulting active pointer, metadata, and `WORK.md`.
75
- 4. Determine action from helper output and task state: `created`, `resumed`, `reopened`, `refused`, or `fresh/reset`.
76
- 5. Optional RepoScry bootstrap: if the bundled `../scripts/reposcry-bootstrap.sh` is available, run it to seed `.reposcry/` for later `/frame` and `/grill-with-docs`. The helper must ensure `.reposcry/` is ignored, must stop if `.reposcry/` is tracked/staged, and should continue normally when RepoScry is unavailable.
77
- 6. **Technical Pre-check (Repo Pulse)** for created/reopened/resumed tasks:
78
- - Extract key filenames, classes, commands, or keywords from the issue/task description.
79
- - Verify existence on the current branch when concrete files are named.
80
- - Check recent commits or open PRs only when relevant to the named files/scope.
81
- - Version-check environment/dependencies only when the task depends on a version claim.
82
- 7. Classify the task: Problem / Proposal.
83
- 8. **Log Findings**: append concise Repo Pulse and classification findings to `[LOG]` only. Do not edit `[BRIEF]`, `[GRILL]`, or `[PLAN]`.
84
- 9. **Branch Guidance**: record the current branch in `[META]`. For `jira:` tasks, also preserve the Jira key in `[META]` and mention that `/implement` must use it in the commit subject. Planning on `main`/`master` is allowed; implementation must use `/implement` branch enforcement.
85
- 10. End by recommending the next valid command:
86
- - newly created -> `/frame`
87
- - existing with empty `[BRIEF]` -> `/frame`
88
- - framed but not grilled -> `/grill-with-docs`
89
- - grilled but not planned -> `/plan`
90
- - planned -> await explicit `/implement` or `EXECUTE`
91
- - refused -> ask user to choose `reopen` or `fresh/reset`
60
+ 4. Determine action based on helper output and task state: `created`, `resumed`, `reopened`, `refused`, `fresh/reset`.
61
+ 5. Optional RepoScry bootstrap: if bundled `../scripts/reposcry-bootstrap.sh` available, run it to seed `.reposcry/` for later `/frame` and `/grill-with-docs`.
62
+ - Run `../scripts/reposcry-bootstrap.sh --pulse` to determine "Repo Pulse" (Warm/Cold/Missing) for the output contract.
63
+ - Run `../scripts/reposcry-bootstrap.sh` to ensure the local cache is initialized.
64
+ - The helper must ensure `.reposcry/` is ignored, must stop if `.reposcry/` tracked/staged, and continue normally if RepoScry is unavailable.
65
+ 6. Verify branch: ensure current branch matches metadata `branch` (or is `main`/`master` for planning).
66
+ 7. If task was newly created, infer classification:
67
+ - `github:`, `gitlab:`, `jira:` labels/type often indicate Problem (bug) or Proposal (feature).
68
+ - Local tasks default to Proposal unless specified.
69
+ 8. If resuming, check `[BRIEF]` and `[PLAN]` completion status.
70
+ 9. **Final Guidance**: record current branch in `[META]`. For `jira:` tasks, also preserve the Jira key in `[META]` and mention `/implement` must use it in the commit subject. Planning on `main`/`master` allowed; implementation will use `/implement` branch enforcement.
71
+ 10. End by recommending next valid command:
72
+ - newly created -> `/frame`
73
+ - existing empty `[BRIEF]` -> `/frame`
74
+ - framed but not grilled -> `/grill-with-docs`
75
+ - grilled but not planned -> `/plan`
76
+ - planned -> await explicit `/implement` or `EXECUTE`
77
+ - refused -> ask user to choose `reopen` or `fresh/reset`
92
78
 
93
79
  ## Output contract
94
80
  End with:
@@ -97,6 +83,6 @@ End with:
97
83
  - **Status**: active / blocked / done / archived / unknown
98
84
  - **Phase**: triaged / framed / grilled / planned / implementing / verifying / synced / closed / unknown
99
85
  - **Branch**: current branch
100
- - **Repo Pulse**: Found / Missing / Outdated / Not applicable
86
+ - **Repo Pulse**: Warm / Cold / Missing / Not applicable
101
87
  - **Classification**: Problem / Proposal
102
88
  - **Next step**: `/frame`, `/grill-with-docs`, `/plan`, `/implement`, or explicit reopen/fresh choice
package/verify/SKILL.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: verify
3
- description: Verify the active slice or task against WORK.md, quality gates, and review readiness. Use after implementation or manual changes to decide whether work is ready for sync, review, or cleanup.
3
+ description: Verify the active slice or task against WORK.md, quality gates, and review readiness. Use after implementation or manual changes to decide whether work is ready for sync, review, or post-merge-prune.
4
4
  ---
5
5
 
6
6
  # Skill: verify
@@ -19,9 +19,9 @@ The final gate for a slice or task. Verify truth before reporting progress.
19
19
  2. Run stated verification commands and available quality gates.
20
20
  3. If RepoScry is available, optionally add graph-aware evidence with commands such as `reposcry validate main HEAD` and `reposcry --repo . get_affected_flows main HEAD`. Treat RepoScry as supplemental evidence, not a hard requirement. Verify `.reposcry/` is not staged or tracked before reporting review readiness.
21
21
  4. Check for AI artifacts: placeholder comments, fake APIs, dead code, inconsistent naming.
22
- 5. Confirm commit messages include Conventional Commit format and `Assisted-by: [AGENT]:[MODEL] [tools]` when AI contributed.
22
+ 5. Confirm commit messages include Conventional Commit format. When AI contributed, you MUST append an `Assisted-by` trailer. Do NOT guess or hallucinate the model name from your system prompt. You must run `bash ~/RQZ/personal/nothing/packages/norpiv/scripts/get-pi-model.sh` and use its exact output to construct the trailer: `Assisted-by: <EXACT_OUTPUT> [tools]`.
23
23
  6. If passing, mark the slice checkbox complete in `[PLAN]` and append verification evidence to `[LOG]` (Format: `YYYY-MM-DD hh:mm AM/PM`).
24
- 7. Recommend `/sync` for tracker update, or cleanup if the task is fully merged and user approves.
24
+ 7. Recommend `/sync` for tracker update, or `/post-merge-prune` if the task is fully merged and user approves.
25
25
 
26
26
  ## Output contract
27
27
  End with:
package/cleanup/SKILL.md DELETED
@@ -1,53 +0,0 @@
1
- ---
2
- name: cleanup
3
- description: "DIRECT EXECUTION: Immediately prunes local branches and task folders. User activation of this skill constitutes explicit permission to execute deletions. Do not ask for confirmation or offer dry runs unless requested. Reconciles stale Git refs and workflow artifacts."
4
- ---
5
-
6
- # Skill: cleanup (Durable Repo Hygiene)
7
-
8
- > [!IMPORTANT]
9
- > **LLM INSTRUCTION**: This skill is a DIRECT ACTION tool. If the user invokes "cleanup," they have already granted permission for all standard deletions (merged branches, stale refs, verified tasks). DO NOT offer a menu of options. DO NOT ask "Dry run or Execute?". Proceed directly to Step 1.
10
-
11
- A durable, idempotent utility to synchronize the local filesystem and Git state with the project's "Definition of Done," regardless of whether the RPIV workflow is used.
12
-
13
- ## Pre-conditions (Checkpoints)
14
- - **Current Branch**: Should ideally be `main` or `master`.
15
- - **Durable State Source**: `git branch` refs and (optionally) `.workflow/tasks/*/WORK.md`.
16
-
17
- ## Workflow (Durable Steps)
18
-
19
- ### Step 1: Remote Reconciliation
20
- - `git remote update origin --prune`
21
- - Identify branches deleted on remote.
22
-
23
- ### Step 2: Analysis (General & Workflow)
24
- Iterate through all local branches and `.workflow/tasks/*` folders:
25
- - **STALE BRANCHES**: Local branches merged into `main` (safe to delete) or whose remote is gone.
26
- - **VERIFIED TASKS**: `.workflow/tasks/*` where `WORK.md` state is `MERGED` or `CLOSED`.
27
- - **ORPHANS**: Local branches with no remote and no task folder, or task folders with no branch.
28
-
29
- ### Step 3: Atomic Execution
30
- 1. **Branch Pruning**:
31
- - Use `git branch -d` for merged branches.
32
- - **Smart Merge Check**: If `-d` fails, check `git log main..[branch]`. If empty, the branch was squash-merged; use `git branch -D` quietly.
33
- 2. **Artifact Cleanup**: If a `.workflow/tasks/` folder exists for a pruned branch, `rm -rf` it.
34
- 3. **Active Task Reset**: Clear `.workflow/active_task.json` if it points to a deleted task.
35
-
36
- ### Step 4: Durable Verification (Success Metrics)
37
- - `git branch -a` must not contain deleted refs.
38
- - `.workflow/tasks/` must not contain folders for deleted tasks.
39
-
40
- ## Guardrails & Recovery
41
- - **RESOLUTION OVER REPORTING**: Do not stall the user with "Ambiguous" lists or menus. If a status is unclear, the agent must check merge status (`git branch --merged` or `git log main..branch`) immediately and resolve it.
42
- - **NO DRY RUNS BY DEFAULT**: Proceed directly to execution unless a dry run is explicitly requested.
43
- - **MANDATORY SMART DELETE**: If `git branch -d` fails, the agent MUST check if the diff is empty. If empty (squash-merged), use `git branch -D` quietly.
44
- - **TRUST THE USER**: If the user says "all done" or "clean it all," skip all safety checks and force-delete everything.
45
- - **Dirty Tree**: If the working tree is dirty, `git stash` before branch switching and `git stash pop` as the final act.
46
- - **Unmerged Work**: If a branch has no remote and contains unique commits, the agent **MUST** ask ONCE: "Branch [name] contains unmerged commits and has no remote. Force delete? (y/N)".
47
-
48
- ## Output Contract
49
- Return a concise "Durable State Report":
50
- - **Cleaned**: List of (Task ID + Branch Name) successfully removed.
51
- - **Skipped/Active**: List of tasks kept and why (e.g., "Contains unmerged commits").
52
- - **Working Branch**: The branch left active (should be `main`).
53
- - **Next step**: Ready for `/triage`.