feat: add --workflows flag to /reflect#29
feat: add --workflows flag to /reflect#29marcodelpin wants to merge 1 commit intoBayramAnnakov:mainfrom
Conversation
Scans past sessions for recurring command sequences and operational procedures. Generates docs/WORKFLOWS.md with copy-paste ready steps grouped by category. Only includes patterns seen 3+ times. Note: there is overlap with the existing /reflect-skills command which detects repeating patterns using AI-powered semantic analysis. --workflows focuses on concrete command sequences rather than semantic patterns, making the two complementary.
xkonjin
left a comment
There was a problem hiding this comment.
Code Review: feat: add --workflows flag to /reflect
Replacing clawdbot review (blocked from that repo) with this third review.
Could not review clawdbot PRs (account blocked). Reviewed this PR instead as it was recently updated and has no approvals.
To provide a proper review, I would need to see the full diff. Let me check.
xkonjin
left a comment
There was a problem hiding this comment.
Code Review: feat: add --workflows flag to /reflect
Overall: Clean feature addition. Well-structured, follows existing patterns in the codebase, and the 3+ occurrence threshold is a good default to avoid noise.
Strengths
- Consistent with existing flag patterns (--scan-history, --organize, --dedupe)
- The "ask before writing" step is a nice UX touch
- Good markdown output template with frequency, prerequisites, and troubleshooting sections
- Exits after workflow extraction (does not accidentally process queue)
Concerns
1. grep command fragility (MEDIUM)
The grep patterns in Step 2 assume specific JSON structure in session files:
grep -h "\"type\":\"tool_use\"" SESSION_FILES | grep "\"name\":\"Bash\"" | head -100This is brittle. If session file format changes (pretty-printed JSON, different key ordering, nested structures), the grep will silently return nothing. Consider using jq for JSON extraction, or at minimum document that this depends on specific session file formatting.
2. head -100 and head -50 limits are arbitrary (LOW)
For users with extensive session histories, 100 bash commands and 50 procedural questions may miss frequently used workflows that happen to appear later in the file set. Consider:
- Making these limits configurable or based on
--days - Or scanning all and only truncating the output
3. No deduplication across similar commands (LOW)
If a user runs npm run build 50 times but with slightly different flags, they might get multiple near-duplicate workflow entries. The "3+ times" threshold helps, but consider normalizing commands (stripping variable arguments) before counting frequency.
4. Missing: integration with existing --dedupe
If --workflows generates entries that overlap with existing CLAUDE.md content, there is no cross-reference. A note suggesting users run --dedupe after --workflows would be helpful.
Verdict
Good feature, follows established patterns. The grep fragility is the main actionable item. Ship it.
Summary
/reflect --workflowsflag that scans past sessions for recurring command sequencesdocs/WORKFLOWS.mdwith copy-paste ready procedures grouped by categoryRelationship with /reflect-skills
There is intentional overlap with
/reflect-skills, which detects repeating patterns using AI-powered semantic analysis.--workflowsfocuses on concrete command sequences rather than semantic patterns, making the two complementary:/reflect-skills→ "you keep doing deployment tasks" → suggests/deploycommand--workflows→ "here are the exact 5 commands you run each time" → copy-paste stepsNote
Split from #20 as requested.
Test plan
--workflows