autoworkflow 3.8.4 → 3.9.0
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/.claude/.autoworkflow/memories/.gitkeep +2 -0
- package/.claude/.autoworkflow/memories/blockers.md +23 -0
- package/.claude/.autoworkflow/memories/decisions.md +23 -0
- package/.claude/.autoworkflow/memories/patterns.md +24 -0
- package/.claude/commands/audit.md +27 -29
- package/.claude/commands/init.md +5 -4
- package/.claude/hooks/blueprint-generator.sh +284 -22
- package/.claude/hooks/phase-transition.sh +200 -0
- package/.claude/hooks/pre-tool-router.sh +139 -1
- package/.claude/hooks/session-check.sh +74 -18
- package/.claude/settings.json +2 -2
- package/.claude/settings.local.json +7 -1
- package/CLAUDE.md +118 -8
- package/README.md +13 -13
- package/bin/cli.js +6 -6
- package/package.json +1 -1
|
@@ -53,6 +53,48 @@ get_task_type() {
|
|
|
53
53
|
fi
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
# Reflection prompts (Serena-inspired)
|
|
57
|
+
# These prompt Claude to self-assess before proceeding
|
|
58
|
+
output_reflection_prompt() {
|
|
59
|
+
local phase="$1"
|
|
60
|
+
|
|
61
|
+
echo ""
|
|
62
|
+
echo -e "${CYAN}━━━ REFLECTION CHECK ━━━${NC}"
|
|
63
|
+
|
|
64
|
+
case "$phase" in
|
|
65
|
+
PLAN)
|
|
66
|
+
echo -e "${DIM}Before proceeding to PLAN, verify:${NC}"
|
|
67
|
+
echo " • Have you read ALL relevant files?"
|
|
68
|
+
echo " • Do you understand the existing patterns?"
|
|
69
|
+
echo " • Have you checked BLUEPRINT.md for requirements?"
|
|
70
|
+
echo " • Are there edge cases you haven't considered?"
|
|
71
|
+
;;
|
|
72
|
+
IMPLEMENT)
|
|
73
|
+
echo -e "${DIM}Before proceeding to IMPLEMENT, verify:${NC}"
|
|
74
|
+
echo " • Does this plan match the original request?"
|
|
75
|
+
echo " • Have you considered all affected files?"
|
|
76
|
+
echo " • Are there simpler alternatives?"
|
|
77
|
+
echo " • Will this introduce breaking changes?"
|
|
78
|
+
;;
|
|
79
|
+
VERIFY)
|
|
80
|
+
echo -e "${DIM}Before proceeding to VERIFY, verify:${NC}"
|
|
81
|
+
echo " • Is the implementation complete?"
|
|
82
|
+
echo " • Have you handled all edge cases?"
|
|
83
|
+
echo " • Are there TODO/FIXME comments left?"
|
|
84
|
+
echo " • Did you test the happy path mentally?"
|
|
85
|
+
;;
|
|
86
|
+
COMMIT)
|
|
87
|
+
echo -e "${DIM}Before proceeding to COMMIT, verify:${NC}"
|
|
88
|
+
echo " • Is this work truly complete?"
|
|
89
|
+
echo " • Would you be confident shipping this?"
|
|
90
|
+
echo " • Have you updated BLUEPRINT.md if needed?"
|
|
91
|
+
echo " • Does the commit message accurately describe changes?"
|
|
92
|
+
;;
|
|
93
|
+
esac
|
|
94
|
+
echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
|
95
|
+
echo ""
|
|
96
|
+
}
|
|
97
|
+
|
|
56
98
|
# Check analyze gate
|
|
57
99
|
check_analyze_gate() {
|
|
58
100
|
echo ""
|
|
@@ -198,6 +240,10 @@ transition() {
|
|
|
198
240
|
echo ""
|
|
199
241
|
echo -e "${GREEN}✅ Gate passed - Now in ${BOLD}$to${NC} phase"
|
|
200
242
|
echo ""
|
|
243
|
+
|
|
244
|
+
# Output reflection prompt for the new phase
|
|
245
|
+
output_reflection_prompt "$to"
|
|
246
|
+
|
|
201
247
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
202
248
|
echo ""
|
|
203
249
|
|
|
@@ -240,6 +286,133 @@ reset_workflow() {
|
|
|
240
286
|
echo ""
|
|
241
287
|
}
|
|
242
288
|
|
|
289
|
+
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
290
|
+
# MEMORY SYSTEM (Serena-inspired)
|
|
291
|
+
# Persistent context that survives across sessions
|
|
292
|
+
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
293
|
+
|
|
294
|
+
MEMORY_DIR="$STATE_DIR/memories"
|
|
295
|
+
mkdir -p "$MEMORY_DIR"
|
|
296
|
+
|
|
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
|
+
}
|
|
331
|
+
|
|
332
|
+
# Read memories for a category
|
|
333
|
+
read_memories() {
|
|
334
|
+
local category="$1"
|
|
335
|
+
local memory_file="$MEMORY_DIR/${category}.md"
|
|
336
|
+
|
|
337
|
+
if [ -f "$memory_file" ]; then
|
|
338
|
+
cat "$memory_file"
|
|
339
|
+
else
|
|
340
|
+
echo "No memories found for category: $category"
|
|
341
|
+
fi
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
# List all memory categories
|
|
345
|
+
list_memories() {
|
|
346
|
+
echo ""
|
|
347
|
+
echo -e "${CYAN}Available Memory Categories:${NC}"
|
|
348
|
+
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
|
|
361
|
+
echo ""
|
|
362
|
+
}
|
|
363
|
+
|
|
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 -->
|
|
385
|
+
|
|
386
|
+
## What Remains
|
|
387
|
+
<!-- Claude should update this section -->
|
|
388
|
+
|
|
389
|
+
## Key Decisions Made
|
|
390
|
+
<!-- Document important choices and their rationale -->
|
|
391
|
+
|
|
392
|
+
## Files Modified
|
|
393
|
+
$(cat "$STATE_DIR/changed-files" 2>/dev/null || echo "None yet")
|
|
394
|
+
|
|
395
|
+
---
|
|
396
|
+
|
|
397
|
+
*Use this context to resume work in a new session.*
|
|
398
|
+
EOF
|
|
399
|
+
|
|
400
|
+
echo -e "${GREEN}✅${NC} Context saved for session continuity"
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
# Load context summary
|
|
404
|
+
load_context() {
|
|
405
|
+
local context_file="$MEMORY_DIR/context.md"
|
|
406
|
+
|
|
407
|
+
if [ -f "$context_file" ]; then
|
|
408
|
+
echo ""
|
|
409
|
+
echo -e "${CYAN}━━━ PREVIOUS SESSION CONTEXT ━━━${NC}"
|
|
410
|
+
cat "$context_file"
|
|
411
|
+
echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
|
412
|
+
echo ""
|
|
413
|
+
fi
|
|
414
|
+
}
|
|
415
|
+
|
|
243
416
|
# Main command dispatcher
|
|
244
417
|
case "$1" in
|
|
245
418
|
transition)
|
|
@@ -269,6 +442,25 @@ case "$1" in
|
|
|
269
442
|
fi
|
|
270
443
|
echo ""
|
|
271
444
|
;;
|
|
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
|
|
454
|
+
;;
|
|
455
|
+
context-save)
|
|
456
|
+
save_context "$2"
|
|
457
|
+
;;
|
|
458
|
+
context-load)
|
|
459
|
+
load_context
|
|
460
|
+
;;
|
|
461
|
+
reflect)
|
|
462
|
+
output_reflection_prompt "$2"
|
|
463
|
+
;;
|
|
272
464
|
*)
|
|
273
465
|
echo "Usage: phase-transition.sh <command> [args]"
|
|
274
466
|
echo ""
|
|
@@ -278,5 +470,13 @@ case "$1" in
|
|
|
278
470
|
echo " reject - Record plan rejection"
|
|
279
471
|
echo " reset - Reset workflow state"
|
|
280
472
|
echo " status - Show current state"
|
|
473
|
+
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"
|
|
281
481
|
;;
|
|
282
482
|
esac
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
# AutoWorkflow Pre-Tool Router
|
|
3
3
|
# Runs on: PreToolUse for Bash tool
|
|
4
|
-
# Purpose: Route commands to appropriate checks
|
|
4
|
+
# Purpose: Route commands to appropriate checks + Mode restrictions (Serena-inspired)
|
|
5
5
|
#
|
|
6
6
|
# This router determines what checks to run based on the command being executed
|
|
7
|
+
# It also enforces task-type-aware restrictions (similar to Serena's mode switching)
|
|
7
8
|
|
|
8
9
|
TOOL_INPUT="$1"
|
|
9
10
|
|
|
11
|
+
# Colors
|
|
12
|
+
RED='\033[0;31m'
|
|
13
|
+
YELLOW='\033[1;33m'
|
|
14
|
+
CYAN='\033[0;36m'
|
|
15
|
+
BOLD='\033[1m'
|
|
16
|
+
DIM='\033[2m'
|
|
17
|
+
NC='\033[0m'
|
|
18
|
+
|
|
10
19
|
# Project directory (use env var if set, otherwise current directory)
|
|
11
20
|
PROJECT_DIR="${CLAUDE_PROJECT_DIR:-.}"
|
|
12
21
|
|
|
@@ -14,6 +23,135 @@ PROJECT_DIR="${CLAUDE_PROJECT_DIR:-.}"
|
|
|
14
23
|
STATE_DIR="$PROJECT_DIR/.claude/.autoworkflow"
|
|
15
24
|
mkdir -p "$STATE_DIR"
|
|
16
25
|
|
|
26
|
+
# Get current task type
|
|
27
|
+
get_task_type() {
|
|
28
|
+
if [ -f "$STATE_DIR/task-type" ]; then
|
|
29
|
+
cat "$STATE_DIR/task-type"
|
|
30
|
+
else
|
|
31
|
+
echo "unknown"
|
|
32
|
+
fi
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
# Get current phase
|
|
36
|
+
get_phase() {
|
|
37
|
+
if [ -f "$STATE_DIR/phase" ]; then
|
|
38
|
+
cat "$STATE_DIR/phase"
|
|
39
|
+
else
|
|
40
|
+
echo "IDLE"
|
|
41
|
+
fi
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
45
|
+
# MODE RESTRICTIONS (Serena-inspired)
|
|
46
|
+
# Different task types have different allowed operations
|
|
47
|
+
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
48
|
+
|
|
49
|
+
# Check if command creates new files
|
|
50
|
+
is_file_creation() {
|
|
51
|
+
echo "$TOOL_INPUT" | grep -qE "(touch|mkdir|>|tee|cp.*-r)"
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
# Check if command modifies package dependencies
|
|
55
|
+
is_dependency_change() {
|
|
56
|
+
echo "$TOOL_INPUT" | grep -qE "(npm install|yarn add|pnpm add|pip install|go get)"
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
# Check if command runs database migrations
|
|
60
|
+
is_migration() {
|
|
61
|
+
echo "$TOOL_INPUT" | grep -qE "(migrate|prisma.*push|prisma.*migrate|alembic)"
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
# Check mode restrictions based on task type
|
|
65
|
+
check_mode_restrictions() {
|
|
66
|
+
local task_type=$(get_task_type)
|
|
67
|
+
local phase=$(get_phase)
|
|
68
|
+
|
|
69
|
+
case "$task_type" in
|
|
70
|
+
docs)
|
|
71
|
+
# Docs mode: Only allow documentation-related operations
|
|
72
|
+
if is_file_creation && ! echo "$TOOL_INPUT" | grep -qE "\.(md|txt|rst)"; then
|
|
73
|
+
echo ""
|
|
74
|
+
echo -e "${YELLOW}━━━ MODE RESTRICTION: docs ━━━${NC}"
|
|
75
|
+
echo ""
|
|
76
|
+
echo -e "Task type is ${BOLD}docs${NC} - creating non-documentation files requires approval."
|
|
77
|
+
echo -e "Command: ${DIM}$TOOL_INPUT${NC}"
|
|
78
|
+
echo ""
|
|
79
|
+
echo "If this is intentional, confirm with the user."
|
|
80
|
+
echo ""
|
|
81
|
+
# Warn but don't block
|
|
82
|
+
fi
|
|
83
|
+
;;
|
|
84
|
+
fix)
|
|
85
|
+
# Fix mode: Warn on new file creation (fixes usually modify existing files)
|
|
86
|
+
if is_file_creation; then
|
|
87
|
+
echo ""
|
|
88
|
+
echo -e "${YELLOW}━━━ MODE RESTRICTION: fix ━━━${NC}"
|
|
89
|
+
echo ""
|
|
90
|
+
echo -e "Task type is ${BOLD}fix${NC} - creating new files is unusual for bug fixes."
|
|
91
|
+
echo -e "Command: ${DIM}$TOOL_INPUT${NC}"
|
|
92
|
+
echo ""
|
|
93
|
+
echo "Consider: Is this truly a fix, or should this be classified as a feature?"
|
|
94
|
+
echo ""
|
|
95
|
+
fi
|
|
96
|
+
if is_dependency_change; then
|
|
97
|
+
echo ""
|
|
98
|
+
echo -e "${YELLOW}━━━ MODE RESTRICTION: fix ━━━${NC}"
|
|
99
|
+
echo ""
|
|
100
|
+
echo -e "Task type is ${BOLD}fix${NC} - adding dependencies for a fix is unusual."
|
|
101
|
+
echo -e "Command: ${DIM}$TOOL_INPUT${NC}"
|
|
102
|
+
echo ""
|
|
103
|
+
echo "Confirm this dependency is necessary for the fix."
|
|
104
|
+
echo ""
|
|
105
|
+
fi
|
|
106
|
+
;;
|
|
107
|
+
refactor)
|
|
108
|
+
# Refactor mode: Warn on behavior-changing operations
|
|
109
|
+
if is_migration; then
|
|
110
|
+
echo ""
|
|
111
|
+
echo -e "${YELLOW}━━━ MODE RESTRICTION: refactor ━━━${NC}"
|
|
112
|
+
echo ""
|
|
113
|
+
echo -e "Task type is ${BOLD}refactor${NC} - migrations may change behavior."
|
|
114
|
+
echo -e "Command: ${DIM}$TOOL_INPUT${NC}"
|
|
115
|
+
echo ""
|
|
116
|
+
echo "Refactoring should preserve existing behavior."
|
|
117
|
+
echo "Confirm this migration is safe."
|
|
118
|
+
echo ""
|
|
119
|
+
fi
|
|
120
|
+
;;
|
|
121
|
+
query)
|
|
122
|
+
# Query mode: Read-only, warn on any modifications
|
|
123
|
+
if is_file_creation || is_dependency_change || is_migration; then
|
|
124
|
+
echo ""
|
|
125
|
+
echo -e "${YELLOW}━━━ MODE RESTRICTION: query ━━━${NC}"
|
|
126
|
+
echo ""
|
|
127
|
+
echo -e "Task type is ${BOLD}query${NC} - this should be read-only."
|
|
128
|
+
echo -e "Command: ${DIM}$TOOL_INPUT${NC}"
|
|
129
|
+
echo ""
|
|
130
|
+
echo "Queries should not modify the codebase."
|
|
131
|
+
echo "If modifications are needed, reclassify the task."
|
|
132
|
+
echo ""
|
|
133
|
+
fi
|
|
134
|
+
;;
|
|
135
|
+
esac
|
|
136
|
+
|
|
137
|
+
# Phase-based restrictions
|
|
138
|
+
if [ "$phase" = "ANALYZE" ] || [ "$phase" = "PLAN" ]; then
|
|
139
|
+
if is_file_creation || is_dependency_change; then
|
|
140
|
+
echo ""
|
|
141
|
+
echo -e "${YELLOW}━━━ PHASE RESTRICTION ━━━${NC}"
|
|
142
|
+
echo ""
|
|
143
|
+
echo -e "Current phase is ${BOLD}$phase${NC} - modifications should wait for IMPLEMENT phase."
|
|
144
|
+
echo -e "Command: ${DIM}$TOOL_INPUT${NC}"
|
|
145
|
+
echo ""
|
|
146
|
+
echo "Complete planning and get approval before making changes."
|
|
147
|
+
echo ""
|
|
148
|
+
fi
|
|
149
|
+
fi
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
# Run mode restriction checks
|
|
153
|
+
check_mode_restrictions
|
|
154
|
+
|
|
17
155
|
# Check if this is a git commit command
|
|
18
156
|
is_git_commit() {
|
|
19
157
|
echo "$TOOL_INPUT" | grep -qE "git\s+commit|git\s+.*commit"
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
#
|
|
6
6
|
# This hook implements:
|
|
7
7
|
# - on:conversation_start trigger
|
|
8
|
-
# - on:blueprint_missing trigger (
|
|
8
|
+
# - on:blueprint_missing trigger (prompt user for documentation)
|
|
9
9
|
# - on:init_needed trigger
|
|
10
10
|
# - on:task_received trigger (task classification)
|
|
11
11
|
|
|
@@ -37,6 +37,41 @@ SESSION_RESUMED_FILE="$STATE_DIR/session-resumed"
|
|
|
37
37
|
CURRENT_TURN_EDITS_FILE="$STATE_DIR/current-turn-edits"
|
|
38
38
|
SUGGESTIONS_SHOWN_FILE="$STATE_DIR/suggestions-shown"
|
|
39
39
|
|
|
40
|
+
# Memory system (Serena-inspired)
|
|
41
|
+
MEMORY_DIR="$STATE_DIR/memories"
|
|
42
|
+
CONTEXT_FILE="$MEMORY_DIR/context.md"
|
|
43
|
+
|
|
44
|
+
# Load previous context if available (Serena-inspired)
|
|
45
|
+
load_previous_context() {
|
|
46
|
+
if [ -f "$CONTEXT_FILE" ]; then
|
|
47
|
+
echo ""
|
|
48
|
+
echo -e "${CYAN}━━━ PREVIOUS SESSION CONTEXT ━━━${NC}"
|
|
49
|
+
echo ""
|
|
50
|
+
# Extract key sections from context file
|
|
51
|
+
if grep -q "## What Was Done" "$CONTEXT_FILE"; then
|
|
52
|
+
echo -e "${BOLD}What Was Done:${NC}"
|
|
53
|
+
sed -n '/## What Was Done/,/## /p' "$CONTEXT_FILE" | head -10 | tail -n +2
|
|
54
|
+
echo ""
|
|
55
|
+
fi
|
|
56
|
+
if grep -q "## What Remains" "$CONTEXT_FILE"; then
|
|
57
|
+
echo -e "${BOLD}What Remains:${NC}"
|
|
58
|
+
sed -n '/## What Remains/,/## /p' "$CONTEXT_FILE" | head -10 | tail -n +2
|
|
59
|
+
echo ""
|
|
60
|
+
fi
|
|
61
|
+
if grep -q "## Key Decisions Made" "$CONTEXT_FILE"; then
|
|
62
|
+
echo -e "${BOLD}Key Decisions:${NC}"
|
|
63
|
+
sed -n '/## Key Decisions Made/,/## /p' "$CONTEXT_FILE" | head -5 | tail -n +2
|
|
64
|
+
echo ""
|
|
65
|
+
fi
|
|
66
|
+
echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
|
67
|
+
echo ""
|
|
68
|
+
echo -e "${DIM}Full context: .claude/.autoworkflow/memories/context.md${NC}"
|
|
69
|
+
echo ""
|
|
70
|
+
return 0
|
|
71
|
+
fi
|
|
72
|
+
return 1
|
|
73
|
+
}
|
|
74
|
+
|
|
40
75
|
# Check for resumable session state
|
|
41
76
|
check_session_resume() {
|
|
42
77
|
# Only show resume prompt once per session
|
|
@@ -97,6 +132,9 @@ check_session_resume() {
|
|
|
97
132
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
98
133
|
echo ""
|
|
99
134
|
|
|
135
|
+
# Load previous context if available
|
|
136
|
+
load_previous_context
|
|
137
|
+
|
|
100
138
|
# Mark that we've shown the resume prompt
|
|
101
139
|
touch "$SESSION_RESUMED_FILE"
|
|
102
140
|
return 0
|
|
@@ -162,7 +200,7 @@ check_init_needed() {
|
|
|
162
200
|
return 1
|
|
163
201
|
}
|
|
164
202
|
|
|
165
|
-
# Check for
|
|
203
|
+
# Check for project documentation - ask user to provide their docs
|
|
166
204
|
check_blueprint() {
|
|
167
205
|
# Only check once per session
|
|
168
206
|
if [ -f "$BLUEPRINT_CHECK_FILE" ]; then
|
|
@@ -175,31 +213,47 @@ check_blueprint() {
|
|
|
175
213
|
if [ ! -f "instructions/BLUEPRINT.md" ]; then
|
|
176
214
|
echo ""
|
|
177
215
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
178
|
-
echo -e "${
|
|
216
|
+
echo -e "${YELLOW}${BOLD}📋 AUTOWORKFLOW: PROJECT DOCUMENTATION NEEDED${NC}"
|
|
179
217
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
180
218
|
echo ""
|
|
181
|
-
echo "
|
|
219
|
+
echo "No project documentation found."
|
|
182
220
|
echo ""
|
|
183
|
-
echo -e "${BOLD}
|
|
221
|
+
echo -e "${BOLD}Please provide your project documentation:${NC}"
|
|
184
222
|
echo ""
|
|
185
|
-
echo "
|
|
223
|
+
echo " ${CYAN}Option 1:${NC} Point to existing docs"
|
|
224
|
+
echo " • PRD (Product Requirements Document)"
|
|
225
|
+
echo " • Specification document"
|
|
226
|
+
echo " • Userflow document"
|
|
227
|
+
echo " • Implementation guide"
|
|
228
|
+
echo " • Any design/architecture docs"
|
|
186
229
|
echo ""
|
|
187
|
-
echo
|
|
188
|
-
echo
|
|
189
|
-
echo
|
|
190
|
-
echo
|
|
230
|
+
echo " ${CYAN}Option 2:${NC} Describe your project"
|
|
231
|
+
echo " • What does this project do?"
|
|
232
|
+
echo " • What are the main features?"
|
|
233
|
+
echo " • What's the tech stack?"
|
|
191
234
|
echo ""
|
|
192
|
-
echo "
|
|
193
|
-
echo "
|
|
194
|
-
echo "
|
|
235
|
+
echo " ${CYAN}Option 3:${NC} Interactive"
|
|
236
|
+
echo " • Say: \"Help me define my project\""
|
|
237
|
+
echo " • I'll ask questions to understand your project"
|
|
195
238
|
echo ""
|
|
196
|
-
echo -e "${
|
|
239
|
+
echo -e "${DIM}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
|
240
|
+
echo ""
|
|
241
|
+
echo -e "${BOLD}When you provide documentation:${NC}"
|
|
242
|
+
echo ""
|
|
243
|
+
echo " Your document = ${GREEN}SINGLE SOURCE OF TRUTH${NC}"
|
|
244
|
+
echo ""
|
|
245
|
+
echo " • I will read and understand it"
|
|
246
|
+
echo " • I will reference it for all tasks"
|
|
247
|
+
echo " • No transformation or format conversion"
|
|
248
|
+
echo ""
|
|
249
|
+
echo -e "${DIM}Your document structure is preserved exactly as-is.${NC}"
|
|
250
|
+
echo -e "${DIM}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
|
197
251
|
echo ""
|
|
198
252
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
199
253
|
echo ""
|
|
200
254
|
|
|
201
|
-
# Set phase to indicate
|
|
202
|
-
set_phase "
|
|
255
|
+
# Set phase to indicate documentation is needed
|
|
256
|
+
set_phase "DOCS_REQUIRED"
|
|
203
257
|
return 1
|
|
204
258
|
fi
|
|
205
259
|
|
|
@@ -367,7 +421,9 @@ output_classification() {
|
|
|
367
421
|
|
|
368
422
|
# Instructions for this phase
|
|
369
423
|
echo -e "${DIM}Read relevant files and understand the codebase.${NC}"
|
|
370
|
-
echo -e "${DIM}
|
|
424
|
+
echo -e "${DIM}Reference user's documentation for requirements.${NC}"
|
|
425
|
+
echo ""
|
|
426
|
+
echo -e "${DIM}💡 Tip: Use 'phase-transition.sh memory-save decisions <key> <value>' to record decisions.${NC}"
|
|
371
427
|
echo ""
|
|
372
428
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
373
429
|
echo ""
|
|
@@ -428,7 +484,7 @@ main() {
|
|
|
428
484
|
check_session_resume
|
|
429
485
|
fi
|
|
430
486
|
|
|
431
|
-
# Check for missing blueprint (
|
|
487
|
+
# Check for missing blueprint (prompts user for documentation)
|
|
432
488
|
check_blueprint
|
|
433
489
|
|
|
434
490
|
# Show current state if not idle
|
package/.claude/settings.json
CHANGED
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
"→ THEN execute the audit with this knowledge loaded",
|
|
108
108
|
"",
|
|
109
109
|
"### Auto-Triggers (Hooks enforce these)",
|
|
110
|
-
"1. **SESSION START**: If
|
|
110
|
+
"1. **SESSION START**: If no documentation provided → Prompt user for project documentation",
|
|
111
111
|
"2. **AFTER CODE CHANGES**: Run `npm run verify` automatically. Fix errors until passing (max 10 iterations)",
|
|
112
112
|
"3. **BEFORE COMMIT**: All 7 gates must pass or commit is BLOCKED:",
|
|
113
113
|
" - TypeScript errors = 0",
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
"",
|
|
136
136
|
"### Required Files",
|
|
137
137
|
"- Read instructions/AI_RULES.md for coding standards",
|
|
138
|
-
"-
|
|
138
|
+
"- Reference user's documentation (single source of truth)",
|
|
139
139
|
"- Read system/router.md to classify task type",
|
|
140
140
|
"- Read system/gates.md for blocking rules",
|
|
141
141
|
"",
|
|
@@ -19,7 +19,13 @@
|
|
|
19
19
|
"Bash(npm view:*)",
|
|
20
20
|
"Bash(env)",
|
|
21
21
|
"Bash(npx autoworkflow update)",
|
|
22
|
-
"Bash(grep:*)"
|
|
22
|
+
"Bash(grep:*)",
|
|
23
|
+
"WebFetch(domain:github.com)",
|
|
24
|
+
"WebFetch(domain:medium.com)",
|
|
25
|
+
"WebFetch(domain:apidog.com)",
|
|
26
|
+
"WebFetch(domain:mcpservers.org)",
|
|
27
|
+
"WebFetch(domain:oraios.github.io)",
|
|
28
|
+
"Bash(bash:*)"
|
|
23
29
|
]
|
|
24
30
|
}
|
|
25
31
|
}
|