autoworkflow 3.9.0 → 3.9.1

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.
@@ -1,23 +1,15 @@
1
- # Blockers Memory
1
+ # Blockers
2
2
 
3
- > Document known issues, workarounds, and gotchas.
4
- > Saves time by not rediscovering the same problems.
3
+ > Known issues and workarounds. Claude edits directly.
5
4
 
6
5
  ---
7
6
 
8
- ## Template Entry
9
-
10
- *Recorded: YYYY-MM-DD HH:MM:SS*
7
+ ## Template
8
+ *YYYY-MM-DD*
11
9
 
12
10
  **Issue:** What is the problem?
13
-
14
- **Symptoms:** How does it manifest?
15
-
16
- **Root Cause:** Why does this happen? (if known)
17
-
18
11
  **Workaround:** How to work around it?
19
-
20
- **Status:** Open / Resolved / Won't Fix
12
+ **Status:** Open / Resolved
21
13
 
22
14
  ---
23
15
 
@@ -1,22 +1,14 @@
1
- # Decisions Memory
1
+ # Decisions
2
2
 
3
- > Document important architectural and implementation decisions here.
4
- > This helps maintain context across sessions and explains "why" for future reference.
3
+ > Architectural and implementation choices. Claude edits directly.
5
4
 
6
5
  ---
7
6
 
8
- ## Template Entry
9
-
10
- *Recorded: YYYY-MM-DD HH:MM:SS*
11
-
12
- **Context:** What was the situation or requirement?
13
-
14
- **Options Considered:**
15
- 1. Option A - pros/cons
16
- 2. Option B - pros/cons
7
+ ## Template
8
+ *YYYY-MM-DD*
17
9
 
10
+ **Context:** What was the situation?
18
11
  **Decision:** What was chosen and why?
19
-
20
12
  **Implications:** What does this mean going forward?
21
13
 
22
14
  ---
@@ -1,24 +1,15 @@
1
- # Patterns Memory
1
+ # Patterns
2
2
 
3
- > Document discovered patterns in this codebase.
4
- > Helps maintain consistency and avoid reinventing solutions.
3
+ > Discovered codebase patterns. Claude edits directly.
5
4
 
6
5
  ---
7
6
 
8
- ## Template Entry
7
+ ## Template
8
+ *YYYY-MM-DD*
9
9
 
10
- *Recorded: YYYY-MM-DD HH:MM:SS*
11
-
12
- **Pattern Name:** What is this pattern called?
13
-
14
- **Where Used:** Which files/components use this?
15
-
16
- **How It Works:**
17
- ```
18
- // Code example or description
19
- ```
20
-
21
- **When to Use:** What situations call for this pattern?
10
+ **Pattern:** What is this pattern?
11
+ **Where:** Which files/components use it?
12
+ **Usage:** When and how to use it?
22
13
 
23
14
  ---
24
15
 
@@ -244,6 +244,9 @@ transition() {
244
244
  # Output reflection prompt for the new phase
245
245
  output_reflection_prompt "$to"
246
246
 
247
+ # Prompt to update memories based on completed phase
248
+ prompt_memory_update "$from"
249
+
247
250
  echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
248
251
  echo ""
249
252
 
@@ -287,127 +290,119 @@ reset_workflow() {
287
290
  }
288
291
 
289
292
  # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
290
- # MEMORY SYSTEM (Serena-inspired)
291
- # Persistent context that survives across sessions
293
+ # MEMORY SYSTEM v2 (Serena-inspired)
294
+ # Claude edits files directly + hooks prompt at key moments
292
295
  # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
293
296
 
294
297
  MEMORY_DIR="$STATE_DIR/memories"
295
298
  mkdir -p "$MEMORY_DIR"
296
299
 
297
- # Save a memory (key-value with optional category)
298
- save_memory() {
299
- local category="$1"
300
- local key="$2"
301
- local value="$3"
302
- local timestamp=$(date +"%Y-%m-%d %H:%M:%S")
303
-
304
- local memory_file="$MEMORY_DIR/${category}.md"
305
-
306
- # Create file with header if it doesn't exist
307
- if [ ! -f "$memory_file" ]; then
308
- cat > "$memory_file" << EOF
309
- # ${category^} Memory
310
-
311
- > Auto-generated memory store. Add entries as you work.
312
-
313
- ---
314
-
315
- EOF
316
- fi
317
-
318
- # Append new memory entry
319
- cat >> "$memory_file" << EOF
320
- ## $key
321
- *Recorded: $timestamp*
322
-
323
- $value
324
-
325
- ---
326
-
327
- EOF
328
-
329
- echo -e "${GREEN}✅${NC} Memory saved: $category/$key"
330
- }
300
+ # Prompt Claude to update memories (called at phase transitions)
301
+ prompt_memory_update() {
302
+ local phase="$1"
303
+ local memory_type=""
304
+ local prompt_text=""
331
305
 
332
- # Read memories for a category
333
- read_memories() {
334
- local category="$1"
335
- local memory_file="$MEMORY_DIR/${category}.md"
306
+ case "$phase" in
307
+ PLAN|CONFIRM)
308
+ memory_type="decisions"
309
+ prompt_text="If you made any architectural or implementation decisions, update .claude/.autoworkflow/memories/decisions.md"
310
+ ;;
311
+ IMPLEMENT|VERIFY)
312
+ memory_type="patterns"
313
+ prompt_text="If you discovered any codebase patterns, update .claude/.autoworkflow/memories/patterns.md"
314
+ ;;
315
+ COMMIT)
316
+ memory_type="context"
317
+ prompt_text="Update .claude/.autoworkflow/memories/context.md with session summary for continuity"
318
+ ;;
319
+ esac
336
320
 
337
- if [ -f "$memory_file" ]; then
338
- cat "$memory_file"
339
- else
340
- echo "No memories found for category: $category"
321
+ if [ -n "$memory_type" ]; then
322
+ echo ""
323
+ echo -e "${CYAN}━━━ MEMORY UPDATE ━━━${NC}"
324
+ echo -e "${DIM}$prompt_text${NC}"
325
+ echo ""
326
+ echo -e "${DIM}Format: Add a new ## Section with date and details${NC}"
327
+ echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━${NC}"
328
+ echo ""
341
329
  fi
342
330
  }
343
331
 
344
- # List all memory categories
345
- list_memories() {
332
+ # Prompt to record a blocker (called when errors occur)
333
+ prompt_blocker_update() {
334
+ local error_context="$1"
346
335
  echo ""
347
- echo -e "${CYAN}Available Memory Categories:${NC}"
336
+ echo -e "${YELLOW}━━━ BLOCKER DETECTED ━━━${NC}"
337
+ echo -e "${DIM}Consider recording this in .claude/.autoworkflow/memories/blockers.md${NC}"
348
338
  echo ""
349
-
350
- if [ -d "$MEMORY_DIR" ]; then
351
- for file in "$MEMORY_DIR"/*.md; do
352
- if [ -f "$file" ]; then
353
- local category=$(basename "$file" .md)
354
- local count=$(grep -c "^## " "$file" 2>/dev/null || echo "0")
355
- echo " - $category ($count entries)"
356
- fi
357
- done
358
- else
359
- echo " No memories stored yet."
360
- fi
339
+ echo -e "${DIM}Include: Issue, Symptoms, Workaround, Status${NC}"
340
+ echo -e "${YELLOW}━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
361
341
  echo ""
362
342
  }
363
343
 
364
- # Save context for session continuity
365
- save_context() {
366
- local task_description="$1"
367
- local current_phase=$(get_phase)
368
- local task_type=$(get_task_type)
369
- local timestamp=$(date +"%Y-%m-%d %H:%M:%S")
370
-
371
- local context_file="$MEMORY_DIR/context.md"
372
-
373
- cat > "$context_file" << EOF
374
- # Session Context
375
-
376
- > Last updated: $timestamp
377
-
378
- ## Current State
379
- - **Phase:** $current_phase
380
- - **Task Type:** $task_type
381
- - **Description:** $task_description
382
-
383
- ## What Was Done
384
- <!-- Claude should update this section as work progresses -->
344
+ # Load and display memories at session start
345
+ load_memories_summary() {
346
+ echo ""
347
+ echo -e "${CYAN}━━━ PROJECT MEMORIES ━━━${NC}"
385
348
 
386
- ## What Remains
387
- <!-- Claude should update this section -->
349
+ local has_memories=false
388
350
 
389
- ## Key Decisions Made
390
- <!-- Document important choices and their rationale -->
351
+ # Check decisions
352
+ if [ -f "$MEMORY_DIR/decisions.md" ]; then
353
+ local decision_count=$(grep -c "^## " "$MEMORY_DIR/decisions.md" 2>/dev/null || echo "0")
354
+ if [ "$decision_count" -gt 1 ]; then # More than template
355
+ echo -e " ${GREEN}●${NC} Decisions: $((decision_count - 1)) recorded"
356
+ has_memories=true
357
+ fi
358
+ fi
391
359
 
392
- ## Files Modified
393
- $(cat "$STATE_DIR/changed-files" 2>/dev/null || echo "None yet")
360
+ # Check patterns
361
+ if [ -f "$MEMORY_DIR/patterns.md" ]; then
362
+ local pattern_count=$(grep -c "^## " "$MEMORY_DIR/patterns.md" 2>/dev/null || echo "0")
363
+ if [ "$pattern_count" -gt 1 ]; then
364
+ echo -e " ${GREEN}●${NC} Patterns: $((pattern_count - 1)) recorded"
365
+ has_memories=true
366
+ fi
367
+ fi
394
368
 
395
- ---
369
+ # Check blockers
370
+ if [ -f "$MEMORY_DIR/blockers.md" ]; then
371
+ local blocker_count=$(grep -c "^## " "$MEMORY_DIR/blockers.md" 2>/dev/null || echo "0")
372
+ if [ "$blocker_count" -gt 1 ]; then
373
+ echo -e " ${YELLOW}●${NC} Blockers: $((blocker_count - 1)) recorded"
374
+ has_memories=true
375
+ fi
376
+ fi
396
377
 
397
- *Use this context to resume work in a new session.*
398
- EOF
378
+ if [ "$has_memories" = false ]; then
379
+ echo -e " ${DIM}No memories recorded yet${NC}"
380
+ fi
399
381
 
400
- echo -e "${GREEN}✅${NC} Context saved for session continuity"
382
+ echo ""
383
+ echo -e "${DIM}Read with: Read tool on .claude/.autoworkflow/memories/*.md${NC}"
384
+ echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
385
+ echo ""
401
386
  }
402
387
 
403
- # Load context summary
388
+ # Load context summary (for session resume)
404
389
  load_context() {
405
390
  local context_file="$MEMORY_DIR/context.md"
406
391
 
407
392
  if [ -f "$context_file" ]; then
408
393
  echo ""
409
394
  echo -e "${CYAN}━━━ PREVIOUS SESSION CONTEXT ━━━${NC}"
410
- cat "$context_file"
395
+ # Show just the key sections
396
+ if grep -q "## What Was Done" "$context_file"; then
397
+ echo -e "${BOLD}What Was Done:${NC}"
398
+ sed -n '/## What Was Done/,/## /p' "$context_file" | head -8 | tail -n +2
399
+ fi
400
+ if grep -q "## What Remains" "$context_file"; then
401
+ echo -e "${BOLD}What Remains:${NC}"
402
+ sed -n '/## What Remains/,/## /p' "$context_file" | head -8 | tail -n +2
403
+ fi
404
+ echo ""
405
+ echo -e "${DIM}Full context: .claude/.autoworkflow/memories/context.md${NC}"
411
406
  echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
412
407
  echo ""
413
408
  fi
@@ -442,22 +437,16 @@ case "$1" in
442
437
  fi
443
438
  echo ""
444
439
  ;;
445
- # Memory commands (Serena-inspired)
446
- memory-save)
447
- save_memory "$2" "$3" "$4"
448
- ;;
449
- memory-read)
450
- read_memories "$2"
451
- ;;
452
- memory-list)
453
- list_memories
440
+ # Memory commands v2 (Claude edits files directly)
441
+ memories)
442
+ load_memories_summary
454
443
  ;;
455
- context-save)
456
- save_context "$2"
457
- ;;
458
- context-load)
444
+ context)
459
445
  load_context
460
446
  ;;
447
+ blocker)
448
+ prompt_blocker_update "$2"
449
+ ;;
461
450
  reflect)
462
451
  output_reflection_prompt "$2"
463
452
  ;;
@@ -471,12 +460,16 @@ case "$1" in
471
460
  echo " reset - Reset workflow state"
472
461
  echo " status - Show current state"
473
462
  echo ""
474
- echo "Memory Commands (Serena-inspired):"
475
- echo " memory-save <category> <key> <value> - Save a memory"
476
- echo " memory-read <category> - Read memories"
477
- echo " memory-list - List all categories"
478
- echo " context-save <description> - Save session context"
479
- echo " context-load - Load previous context"
480
- echo " reflect <phase> - Show reflection prompts"
463
+ echo "Memory Commands (Claude edits files directly):"
464
+ echo " memories - Show memory summary"
465
+ echo " context - Load previous session context"
466
+ echo " blocker - Prompt to record a blocker"
467
+ echo " reflect <phase> - Show reflection prompts"
468
+ echo ""
469
+ echo "Memory Files (edit directly with Claude):"
470
+ echo " .claude/.autoworkflow/memories/decisions.md"
471
+ echo " .claude/.autoworkflow/memories/patterns.md"
472
+ echo " .claude/.autoworkflow/memories/blockers.md"
473
+ echo " .claude/.autoworkflow/memories/context.md"
481
474
  ;;
482
475
  esac
@@ -462,6 +462,47 @@ reset_turn_state() {
462
462
  echo "0" > "$CURRENT_TURN_EDITS_FILE"
463
463
  }
464
464
 
465
+ # Load and display memories summary (for context awareness)
466
+ show_memories_summary() {
467
+ local has_memories=false
468
+
469
+ # Check if any memories exist (beyond templates)
470
+ for file in "$MEMORY_DIR/decisions.md" "$MEMORY_DIR/patterns.md" "$MEMORY_DIR/blockers.md"; do
471
+ if [ -f "$file" ]; then
472
+ local count=$(grep -c "^## " "$file" 2>/dev/null || echo "0")
473
+ if [ "$count" -gt 1 ]; then
474
+ has_memories=true
475
+ break
476
+ fi
477
+ fi
478
+ done
479
+
480
+ if [ "$has_memories" = true ]; then
481
+ echo ""
482
+ echo -e "${CYAN}━━━ PROJECT MEMORIES ━━━${NC}"
483
+
484
+ if [ -f "$MEMORY_DIR/decisions.md" ]; then
485
+ local count=$(grep -c "^## " "$MEMORY_DIR/decisions.md" 2>/dev/null || echo "0")
486
+ [ "$count" -gt 1 ] && echo -e " ${GREEN}●${NC} Decisions: $((count - 1)) recorded"
487
+ fi
488
+
489
+ if [ -f "$MEMORY_DIR/patterns.md" ]; then
490
+ local count=$(grep -c "^## " "$MEMORY_DIR/patterns.md" 2>/dev/null || echo "0")
491
+ [ "$count" -gt 1 ] && echo -e " ${GREEN}●${NC} Patterns: $((count - 1)) recorded"
492
+ fi
493
+
494
+ if [ -f "$MEMORY_DIR/blockers.md" ]; then
495
+ local count=$(grep -c "^## " "$MEMORY_DIR/blockers.md" 2>/dev/null || echo "0")
496
+ [ "$count" -gt 1 ] && echo -e " ${YELLOW}●${NC} Blockers: $((count - 1)) recorded"
497
+ fi
498
+
499
+ echo ""
500
+ echo -e "${DIM}Read: .claude/.autoworkflow/memories/*.md${NC}"
501
+ echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
502
+ echo ""
503
+ fi
504
+ }
505
+
465
506
  # Main execution
466
507
  main() {
467
508
  local is_new_session=false
@@ -487,6 +528,9 @@ main() {
487
528
  # Check for missing blueprint (prompts user for documentation)
488
529
  check_blueprint
489
530
 
531
+ # Show memories summary (if any exist)
532
+ show_memories_summary
533
+
490
534
  # Show current state if not idle
491
535
  show_state
492
536
  }
@@ -144,7 +144,16 @@
144
144
  "- phase: Current phase (ANALYZE, PLAN, etc.)",
145
145
  "- task-type: Classified task type",
146
146
  "- verify-iteration: Current verify loop count",
147
- "- gate-status: Last gate check result"
147
+ "- gate-status: Last gate check result",
148
+ "",
149
+ "### Memory System (Persistent Context)",
150
+ "Edit these files directly using the Edit tool:",
151
+ "- `.claude/.autoworkflow/memories/decisions.md` - After PLAN: record architectural choices",
152
+ "- `.claude/.autoworkflow/memories/patterns.md` - After IMPLEMENT: record discovered patterns",
153
+ "- `.claude/.autoworkflow/memories/blockers.md` - When errors: record issues and workarounds",
154
+ "- `.claude/.autoworkflow/memories/context.md` - Before COMMIT: update session summary",
155
+ "",
156
+ "Format: ## Title, *Date*, Content, ---"
148
157
  ],
149
158
 
150
159
  "workflow": {
package/CLAUDE.md CHANGED
@@ -126,33 +126,40 @@ All state stored in `.claude/.autoworkflow/`:
126
126
 
127
127
  ## Memory System (Serena-inspired)
128
128
 
129
- Persistent context that survives across sessions. Stored in `.claude/.autoworkflow/memories/`.
129
+ Persistent context that survives across sessions. **Claude edits files directly** + hooks prompt at key moments.
130
130
 
131
- | File | Purpose |
132
- |------|---------|
133
- | `decisions.md` | Document architectural/implementation choices |
134
- | `patterns.md` | Record discovered codebase patterns |
135
- | `blockers.md` | Track known issues and workarounds |
136
- | `context.md` | Session continuity (auto-generated) |
137
-
138
- **Memory Commands:**
139
- ```bash
140
- # Save a decision
141
- .claude/hooks/phase-transition.sh memory-save decisions "auth-approach" "Chose JWT over sessions for stateless API"
131
+ **Memory Files:** `.claude/.autoworkflow/memories/`
132
+ | File | Purpose | When to Update |
133
+ |------|---------|----------------|
134
+ | `decisions.md` | Architectural/implementation choices | After PLAN phase |
135
+ | `patterns.md` | Discovered codebase patterns | After IMPLEMENT |
136
+ | `blockers.md` | Known issues and workarounds | When hitting errors |
137
+ | `context.md` | Session continuity | Before COMMIT |
142
138
 
143
- # Read memories
144
- .claude/hooks/phase-transition.sh memory-read decisions
139
+ **How it works:**
140
+ 1. **Session Start** → Memories summary displayed automatically
141
+ 2. **Phase Transitions** → Hooks prompt to update relevant memory
142
+ 3. **Claude Edits Directly** → Use Edit tool on memory files
143
+ 4. **No Shell Commands** → Just read and edit the markdown files
145
144
 
146
- # List all categories
147
- .claude/hooks/phase-transition.sh memory-list
145
+ **Memory Format:**
146
+ ```markdown
147
+ ## [Entry Title]
148
+ *[Date]*
148
149
 
149
- # Save context for next session
150
- .claude/hooks/phase-transition.sh context-save "Implementing user auth"
150
+ [Content - decisions made, patterns found, blockers hit]
151
151
 
152
- # Load previous context
153
- .claude/hooks/phase-transition.sh context-load
152
+ ---
154
153
  ```
155
154
 
155
+ **Automated Prompts:**
156
+ | Trigger | Memory Prompt |
157
+ |---------|---------------|
158
+ | After PLAN | "Record any decisions made" |
159
+ | After IMPLEMENT | "Record any patterns discovered" |
160
+ | Before COMMIT | "Update context for next session" |
161
+ | Error encountered | "Consider recording this blocker" |
162
+
156
163
  ---
157
164
 
158
165
  ## Reflection Prompts (Serena-inspired)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autoworkflow",
3
- "version": "3.9.0",
3
+ "version": "3.9.1",
4
4
  "description": "Automated workflow enforcement for Claude Code via hooks and system prompts",
5
5
  "type": "module",
6
6
  "bin": {