autoworkflow 2.2.2 → 3.0.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.
@@ -5,6 +5,7 @@ Run UI enforcement and circular dependency checks.
5
5
  ## Trigger
6
6
  - User invokes `/audit`
7
7
  - User invokes `/audit project` (full project scan)
8
+ - **AUTOMATIC:** When BLUEPRINT.md is missing at session start
8
9
  - Or: Automatically after VERIFY phase (for features)
9
10
  - Or: Part of audit_loop
10
11
 
@@ -24,6 +25,12 @@ Per `system/router.md`, audit is required for:
24
25
 
25
26
  When `/audit project` is invoked OR when BLUEPRINT.md is missing:
26
27
 
28
+ **IMPORTANT:** When triggered by missing BLUEPRINT.md, this runs AUTOMATICALLY.
29
+ - Do NOT ask "Should I run the audit?"
30
+ - Do NOT wait for permission to start
31
+ - Just notify and run immediately
32
+ - Only ask permission when presenting results to SAVE
33
+
27
34
  ### Step 1: Scan Codebase (Single Pass)
28
35
  ```bash
29
36
  # All discovery commands run ONCE
@@ -0,0 +1,21 @@
1
+ #!/bin/bash
2
+ # AutoWorkflow Post-Edit Hook
3
+ # Runs on: PostToolUse for Write/Edit tools
4
+ # Purpose: Remind Claude to run verification after code changes
5
+
6
+ # Get the tool that was used (passed as argument or environment)
7
+ TOOL_NAME="${1:-unknown}"
8
+
9
+ # Only trigger for code file changes
10
+ case "$TOOL_NAME" in
11
+ Write|Edit)
12
+ echo ""
13
+ echo "--------------------------------------------------"
14
+ echo "AUTOWORKFLOW: File modified"
15
+ echo "--------------------------------------------------"
16
+ echo "After completing all changes, run: npm run verify"
17
+ echo "Fix any errors before proceeding to commit."
18
+ echo "--------------------------------------------------"
19
+ echo ""
20
+ ;;
21
+ esac
@@ -0,0 +1,60 @@
1
+ #!/bin/bash
2
+ # AutoWorkflow Pre-Commit Check Hook
3
+ # Runs on: PreToolUse for Bash tool when command contains "git commit"
4
+ # Purpose: Block commits with TODO/FIXME/console.log
5
+
6
+ # Get the command being run
7
+ COMMAND="$1"
8
+
9
+ # Check if this is a git commit command
10
+ if echo "$COMMAND" | grep -q "git commit"; then
11
+ echo ""
12
+ echo "=================================================="
13
+ echo "AUTOWORKFLOW: PRE-COMMIT CHECK"
14
+ echo "=================================================="
15
+
16
+ ERRORS=0
17
+
18
+ # Check for TODO/FIXME in staged files
19
+ if git diff --cached --name-only 2>/dev/null | xargs grep -l "TODO\|FIXME\|XXX\|HACK" 2>/dev/null; then
20
+ echo ""
21
+ echo "BLOCKED: TODO/FIXME comments found in staged files"
22
+ echo "Remove all TODO/FIXME comments before committing."
23
+ ERRORS=$((ERRORS + 1))
24
+ fi
25
+
26
+ # Check for console.log in staged files (excluding test files)
27
+ if git diff --cached --name-only 2>/dev/null | grep -v "\.test\.\|\.spec\.\|__tests__" | xargs grep -l "console\.log\|console\.debug\|console\.info" 2>/dev/null; then
28
+ echo ""
29
+ echo "BLOCKED: console.log statements found in staged files"
30
+ echo "Remove debug logs before committing."
31
+ ERRORS=$((ERRORS + 1))
32
+ fi
33
+
34
+ # Check commit message format (if provided)
35
+ if echo "$COMMAND" | grep -q '\-m'; then
36
+ MSG=$(echo "$COMMAND" | sed -n 's/.*-m ["\x27]\([^"\x27]*\)["\x27].*/\1/p')
37
+ if [ -n "$MSG" ]; then
38
+ # Check conventional commit format
39
+ if ! echo "$MSG" | grep -qE "^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\([a-z0-9-]+\))?: .+"; then
40
+ echo ""
41
+ echo "BLOCKED: Invalid commit message format"
42
+ echo "Use: type(scope): description"
43
+ echo "Types: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert"
44
+ ERRORS=$((ERRORS + 1))
45
+ fi
46
+ fi
47
+ fi
48
+
49
+ if [ $ERRORS -gt 0 ]; then
50
+ echo ""
51
+ echo "Fix the above issues before committing."
52
+ echo "=================================================="
53
+ echo ""
54
+ else
55
+ echo ""
56
+ echo "All pre-commit checks passed."
57
+ echo "=================================================="
58
+ echo ""
59
+ fi
60
+ fi
@@ -0,0 +1,58 @@
1
+ #!/bin/bash
2
+ # AutoWorkflow Session Check Hook
3
+ # Runs on: UserPromptSubmit (every user message)
4
+ # Purpose: Check for missing files and inject instructions to Claude
5
+
6
+ # Colors for output
7
+ RED='\033[0;31m'
8
+ YELLOW='\033[1;33m'
9
+ NC='\033[0m' # No Color
10
+
11
+ # Track if this is first message (check for state file)
12
+ STATE_FILE=".claude/.autoworkflow-session"
13
+
14
+ # Check if BLUEPRINT.md exists
15
+ if [ ! -f "instructions/BLUEPRINT.md" ]; then
16
+ echo ""
17
+ echo "=================================================="
18
+ echo "AUTOWORKFLOW TRIGGER: BLUEPRINT_MISSING"
19
+ echo "=================================================="
20
+ echo ""
21
+ echo "instructions/BLUEPRINT.md does not exist."
22
+ echo ""
23
+ echo "ACTION REQUIRED: Run project audit IMMEDIATELY."
24
+ echo "Do NOT ask permission. Just run these commands now:"
25
+ echo ""
26
+ echo "1. cat package.json (detect tech stack)"
27
+ echo "2. ls -la (see project structure)"
28
+ echo "3. find . -type d -name 'src' -o -name 'app' -o -name 'pages' | head -5"
29
+ echo "4. ls src/ 2>/dev/null || ls app/ 2>/dev/null || echo 'No src/app dir'"
30
+ echo ""
31
+ echo "Then generate BLUEPRINT.md with discovered features."
32
+ echo "Only ask user approval to SAVE, not to start scanning."
33
+ echo ""
34
+ echo "=================================================="
35
+ echo ""
36
+ fi
37
+
38
+ # Check if AI_RULES.md exists
39
+ if [ ! -f "instructions/AI_RULES.md" ]; then
40
+ echo ""
41
+ echo "WARNING: instructions/AI_RULES.md is missing."
42
+ echo "Generate it along with BLUEPRINT.md during audit."
43
+ echo ""
44
+ fi
45
+
46
+ # Check if autoworkflow is in node_modules but not initialized
47
+ if [ -d "node_modules/autoworkflow" ] && [ ! -f "CLAUDE.md" ]; then
48
+ echo ""
49
+ echo "=================================================="
50
+ echo "AUTOWORKFLOW TRIGGER: INIT_NEEDED"
51
+ echo "=================================================="
52
+ echo ""
53
+ echo "AutoWorkflow package detected but not initialized."
54
+ echo "Suggest user run: npx autoworkflow init"
55
+ echo ""
56
+ echo "=================================================="
57
+ echo ""
58
+ fi
@@ -1,111 +1,95 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/anthropics/claude-code/main/schemas/settings.json",
3
- "version": "1.0.0",
4
- "name": "AutoWorkflow - Full Architecture",
5
- "description": "System prompt layer that controls Claude's workflow with triggers, loops, and gates",
3
+ "version": "2.0.0",
4
+ "name": "AutoWorkflow",
5
+ "description": "Automated workflow enforcement for Claude Code via hooks and system prompts",
6
+
7
+ "hooks": {
8
+ "UserPromptSubmit": [
9
+ {
10
+ "command": "./.claude/hooks/session-check.sh",
11
+ "timeout": 5000
12
+ }
13
+ ],
14
+ "PostToolUse": [
15
+ {
16
+ "matcher": "Write|Edit",
17
+ "command": "./.claude/hooks/post-edit.sh"
18
+ }
19
+ ],
20
+ "PreToolUse": [
21
+ {
22
+ "matcher": "Bash",
23
+ "command": "./.claude/hooks/pre-commit-check.sh \"$COMMAND\""
24
+ }
25
+ ]
26
+ },
6
27
 
7
28
  "instructions": [
8
- "IF autoworkflow in node_modules but CLAUDE.md missing: suggest running /init",
9
- "ALWAYS read CLAUDE.md (entry point) at the start of EVERY task",
10
- "ALWAYS check if instructions/BLUEPRINT.md exists at session start",
11
- "IF BLUEPRINT.md missing: run /audit project to generate it",
12
- "ALWAYS check system/router.md to classify the task type",
13
- "ALWAYS check system/gates.md before phase transitions",
14
- "ALWAYS follow system/loops.md for verification and fix cycles",
15
- "ALWAYS check system/triggers.md for event handling",
16
- "ALWAYS update BLUEPRINT.md after adding new features/routes/APIs",
17
- "NEVER skip the plan approval gate - wait for user confirmation",
18
- "NEVER commit without passing all gates in system/gates.md",
19
- "NEVER implement without reading instructions/AI_RULES.md",
20
- "NEVER build backend without corresponding UI (UI enforcement)",
21
- "Git hooks (hooks/pre-commit, hooks/commit-msg) provide backup enforcement",
22
- "Scripts in scripts/ folder automate verification and audits"
23
- ],
29
+ "WORKFLOW: Follow ANALYZE PLAN CONFIRM IMPLEMENT → VERIFY → AUDIT → COMMIT for all tasks",
24
30
 
25
- "requiredFiles": [
26
- "CLAUDE.md",
27
- "system/triggers.md",
28
- "system/loops.md",
29
- "system/gates.md",
30
- "system/router.md",
31
- "instructions/CLAUDE.md",
32
- "instructions/AI_RULES.md",
33
- "instructions/BLUEPRINT.md"
34
- ],
31
+ "SESSION START: If instructions/BLUEPRINT.md missing, immediately scan codebase (cat package.json, ls src/, find directories) and generate it. Do not ask to start - only ask to save.",
32
+
33
+ "AFTER CODE CHANGES: Run 'npm run verify' automatically. If errors exist, fix them and re-verify until passing.",
35
34
 
36
- "automationFiles": [
37
- "scripts/setup.sh",
38
- "scripts/autoworkflow.sh",
39
- "scripts/check-ui-enforcement.sh",
40
- "hooks/pre-commit",
41
- "hooks/commit-msg"
35
+ "BEFORE COMMIT: Block if TODO/FIXME/console.log found in changes. Require conventional commit format: type(scope): description",
36
+
37
+ "UI ENFORCEMENT: Every backend endpoint/API must have a corresponding UI component. No orphan features allowed.",
38
+
39
+ "PLAN GATE: Always wait for user approval before implementing. Show plan with suggestions first.",
40
+
41
+ "BLUEPRINT UPDATE: After adding new features/routes/APIs, update instructions/BLUEPRINT.md",
42
+
43
+ "Read instructions/AI_RULES.md for project-specific coding standards"
42
44
  ],
43
45
 
44
46
  "workflow": {
45
- "mode": "agentic",
46
47
  "phases": ["ANALYZE", "PLAN", "CONFIRM", "IMPLEMENT", "VERIFY", "FIX", "AUDIT", "COMMIT", "UPDATE"],
47
- "requirePlanApproval": true,
48
- "requireVerifyBeforeCommit": true,
49
- "requireAuditForFeatures": true,
50
- "requireBlueprintCheck": true,
51
48
  "maxFixIterations": 10,
52
49
  "maxAuditIterations": 5
53
50
  },
54
51
 
55
52
  "gates": {
56
- "analyze": {
57
- "requires": ["Read relevant source files", "Check BLUEPRINT.md"]
58
- },
59
53
  "plan_approval": {
60
- "requires": ["User explicit approval"],
61
- "blocking": true
54
+ "blocking": true,
55
+ "requires": ["User explicit approval"]
62
56
  },
63
57
  "verify": {
64
- "requires": ["npm run verify passes"],
65
- "blocking": true
58
+ "blocking": true,
59
+ "command": "npm run verify"
66
60
  },
67
61
  "audit": {
68
- "requires": ["npm run audit:ui passes", "npm run audit:cycles passes"],
69
62
  "blocking": true,
70
- "appliesTo": ["feature", "refactor", "perf"]
63
+ "commands": ["npm run audit:ui", "npm run audit:cycles"],
64
+ "appliesTo": ["feature", "refactor"]
71
65
  },
72
66
  "pre_commit": {
73
- "requires": [
74
- "verify_gate passed",
75
- "audit_gate passed (if applicable)",
76
- "No TODO/FIXME in diff",
77
- "No console.log in diff",
78
- "Valid commit message format"
79
- ],
80
- "blocking": true
67
+ "blocking": true,
68
+ "checks": ["No TODO/FIXME", "No console.log", "Conventional commit format"]
81
69
  }
82
70
  },
83
71
 
84
- "triggers": {
85
- "on_conversation_start": ["Check if /init needed", "Read CLAUDE.md", "Check BLUEPRINT.md exists", "Route via system/router.md"],
86
- "on_init_needed": ["Notify autoworkflow detected", "Suggest running /init"],
87
- "on_blueprint_missing": ["Run project audit", "Generate AI_RULES.md + BLUEPRINT.md", "Present for approval"],
88
- "on_task_start": ["Read CLAUDE.md", "Route via system/router.md"],
89
- "on_implementation_complete": ["Enter VERIFY phase", "Run verify_loop"],
90
- "on_verification_failed": ["Enter FIX phase", "Run fix_loop"],
91
- "on_verification_passed": ["Check if audit required", "Proceed accordingly"],
92
- "on_commit_requested": ["Run pre_commit_gate", "Wait for approval"],
93
- "on_feature_complete": ["Check if BLUEPRINT.md needs update", "Present update for approval"]
94
- },
95
-
96
- "loops": {
97
- "verify_loop": {
98
- "command": "npm run verify",
99
- "maxIterations": 10,
100
- "onFail": "fix_loop"
72
+ "taskTypes": {
73
+ "feature": {
74
+ "workflow": ["ANALYZE", "PLAN", "CONFIRM", "IMPLEMENT", "VERIFY", "AUDIT", "COMMIT", "UPDATE"],
75
+ "requiresAudit": true,
76
+ "requiresSuggestions": true
101
77
  },
102
- "fix_loop": {
103
- "maxIterations": 10,
104
- "onComplete": "verify_loop"
78
+ "fix": {
79
+ "workflow": ["ANALYZE", "PLAN", "CONFIRM", "IMPLEMENT", "VERIFY", "COMMIT"],
80
+ "requiresAudit": false
105
81
  },
106
- "audit_loop": {
107
- "commands": ["npm run audit:ui", "npm run audit:cycles"],
108
- "maxIterations": 5
82
+ "refactor": {
83
+ "workflow": ["ANALYZE", "PLAN", "CONFIRM", "IMPLEMENT", "VERIFY", "AUDIT", "COMMIT"],
84
+ "requiresAudit": true
85
+ },
86
+ "docs": {
87
+ "workflow": ["ANALYZE", "IMPLEMENT", "COMMIT"],
88
+ "requiresAudit": false
89
+ },
90
+ "query": {
91
+ "workflow": ["ANALYZE", "RESPOND"],
92
+ "requiresAudit": false
109
93
  }
110
94
  },
111
95
 
@@ -119,13 +103,11 @@
119
103
  },
120
104
 
121
105
  "rules": {
122
- "noPartialImplementations": true,
123
106
  "noTodoComments": true,
124
107
  "noConsoleLogs": true,
125
108
  "noOrphanFeatures": true,
126
109
  "noCircularDependencies": true,
127
110
  "conventionalCommits": true,
128
- "oneFeatureAtATime": true,
129
111
  "readBeforeWrite": true
130
112
  }
131
113
  }
@@ -5,7 +5,8 @@
5
5
  "Bash(npm publish:*)",
6
6
  "Bash(npm version:*)",
7
7
  "Bash(node bin/cli.js:*)",
8
- "Bash(npm pkg:*)"
8
+ "Bash(npm pkg:*)",
9
+ "Bash(wc:*)"
9
10
  ]
10
11
  }
11
12
  }
package/CLAUDE.md CHANGED
@@ -1,344 +1,120 @@
1
- # AutoWorkflow - System Prompt Layer
1
+ # AutoWorkflow
2
2
 
3
- > **This file is the ENTRY POINT.** Claude MUST read this at the start of EVERY task.
3
+ > Automated workflow enforcement via hooks + system prompts.
4
4
 
5
- ---
6
-
7
- ## Session Start - FIRST THING
5
+ ## How It Works
8
6
 
9
- **Before ANY work, run this check:**
10
-
11
- ```
12
- 1. Check if instructions/BLUEPRINT.md exists
13
- 2. If NO → Run ONE audit → Update BOTH AI_RULES.md & BLUEPRINT.md
14
- 3. If YES → Read both files and proceed
15
7
  ```
16
-
17
- ### No Blueprint? Single Audit → Dual Output
18
-
8
+ Hooks (automatic) → Trigger checks on events
9
+ settings.json → Core instructions (system prompt)
10
+ This file → Workflow details + gates
11
+ instructions/ → AI_RULES.md + BLUEPRINT.md (project-specific)
19
12
  ```
20
- ⚠️ No BLUEPRINT.md found in this project.
21
-
22
- I'll run ONE audit to update TWO files:
23
-
24
- 📄 AI_RULES.md → Tech Stack & File Structure (HOW to code)
25
- 📘 BLUEPRINT.md → Features, Routes, APIs (WHAT exists)
26
13
 
27
- Running project audit now...
28
- ```
14
+ ---
29
15
 
30
- ### Single Audit Architecture
16
+ ## Workflow
31
17
 
32
18
  ```
33
- ┌─────────────────────────────────────────────────────────────┐
34
- │ ONE AUDIT SCAN │
35
- │ │
36
- │ $ cat package.json → Detect tech stack │
37
- │ $ find src -type d → Map file structure │
38
- │ $ ls src/pages/ → Discover routes │
39
- │ $ ls src/components/ → List components │
40
- │ $ find src/api/ → Find API endpoints │
41
- │ $ cat prisma/schema.prisma → Database models │
42
- │ $ grep -r "fetch\|/api/" → Map connections │
43
- │ │
44
- └─────────────────────────┬────────────────────────────────────┘
45
-
46
- ┌─────────────┴─────────────┐
47
- ▼ ▼
48
- ┌─────────────────┐ ┌─────────────────┐
49
- │ AI_RULES.md │ │ BLUEPRINT.md │
50
- │ (Update) │ │ (Generate) │
51
- │ │ │ │
52
- │ ## Tech Stack │ │ ## Features │
53
- │ - Framework: X │ │ - Feature 1 ✅ │
54
- │ - Styling: Y │ │ - Feature 2 ⚠️ │
55
- │ - Database: Z │ │ │
56
- │ │ │ ## Routes │
57
- │ ## File Struct │ │ - / → Home │
58
- │ src/ │ │ - /about → ... │
59
- │ ├── components │ │ │
60
- │ ├── pages │ │ ## APIs │
61
- │ └── ... │ │ - GET /api/x │
62
- └─────────────────┘ └─────────────────┘
63
- ```
64
-
65
- **This prevents double audit runs - ONE scan updates BOTH files.**
66
-
67
- ### Audit Output Format
68
-
69
- After scanning, present BOTH updates together:
70
-
19
+ ANALYZE → PLAN → CONFIRM → IMPLEMENT → VERIFY → AUDIT → COMMIT → UPDATE
71
20
  ```
72
- ## 🔍 Audit Complete - Proposed Updates
73
-
74
- ### 📄 AI_RULES.md Updates
75
21
 
76
- **Tech Stack** (will update):
77
- - Framework: [detected]
78
- - Styling: [detected]
79
- - Database: [detected]
80
-
81
- **File Structure** (will update):
82
- src/
83
- ├── [directories found]
84
- └── [file counts]
22
+ | Phase | Action |
23
+ |-------|--------|
24
+ | ANALYZE | Read relevant files, check BLUEPRINT.md |
25
+ | PLAN | Design approach, show suggestions |
26
+ | CONFIRM | Wait for user approval |
27
+ | IMPLEMENT | Make changes (after approval only) |
28
+ | VERIFY | Run `npm run verify` |
29
+ | AUDIT | Run `npm run audit:ui` + `audit:cycles` |
30
+ | COMMIT | Conventional commit format |
31
+ | UPDATE | Update BLUEPRINT.md if new feature/route/API |
85
32
 
86
33
  ---
87
34
 
88
- ### 📘 BLUEPRINT.md (will create)
89
-
90
- **Features Discovered:**
91
- | Feature | Frontend | Backend | Route | Status |
92
- |---------|----------|---------|-------|--------|
93
- | Auth | LoginForm.tsx | /api/auth | /login | ✅ |
94
- | Dashboard | Dashboard.tsx | /api/stats | /dashboard | ✅ |
95
- | Settings | ❌ None | /api/settings | ❌ None | ⚠️ ORPHAN |
35
+ ## Task Types
96
36
 
97
- **⚠️ Issues Found:**
98
- - Orphan API: /api/settings (no UI)
37
+ | Type | Workflow | Audit? |
38
+ |------|----------|--------|
39
+ | feature | Full (9 phases) | Yes |
40
+ | fix | ANALYZE → PLAN → CONFIRM → IMPLEMENT → VERIFY → COMMIT | No |
41
+ | refactor | ANALYZE → PLAN → CONFIRM → IMPLEMENT → VERIFY → AUDIT → COMMIT | Yes |
42
+ | docs | ANALYZE → IMPLEMENT → COMMIT | No |
43
+ | query | ANALYZE → RESPOND | No |
99
44
 
100
45
  ---
101
46
 
102
- **Should I save these updates?**
103
- - AI_RULES.md → Update Tech Stack & File Structure sections
104
- - BLUEPRINT.md → Create with discovered features
47
+ ## Gates (Blocking)
105
48
 
106
- (yes/no/edit first)
107
- ```
49
+ ### 1. Plan Approval Gate
50
+ **Before:** IMPLEMENT
51
+ **Requires:** User says "yes", "proceed", "approved", etc.
108
52
 
109
- See `system/triggers.md#on:blueprint_missing` for trigger details.
53
+ ### 2. Verify Gate
54
+ **Before:** AUDIT/COMMIT
55
+ **Requires:** `npm run verify` passes (0 errors)
110
56
 
111
- ---
57
+ ### 3. Audit Gate
58
+ **Before:** COMMIT (for features/refactors)
59
+ **Requires:**
60
+ - `npm run audit:ui` passes (no orphan features)
61
+ - `npm run audit:cycles` passes (no circular deps)
112
62
 
113
- ## System Architecture
114
-
115
- ```
116
- ┌─────────────────────────────────────────────────────────────┐
117
- │ THIS FILE (Entry Point) │
118
- │ Load on every task, route to system │
119
- └───────────────────────────┬─────────────────────────────────┘
120
-
121
-
122
- ┌─────────────────────────────────────────────────────────────┐
123
- │ system/ (Control Layer) │
124
- │ │
125
- │ triggers.md │ loops.md │ gates.md │ router.md │
126
- │ (events) │ (cycles) │ (blocks) │ (routing) │
127
- └───────────────────────────┬─────────────────────────────────┘
128
-
129
-
130
- ┌─────────────────────────────────────────────────────────────┐
131
- │ instructions/ (Content Layer) │
132
- │ │
133
- │ CLAUDE.md │ AI_RULES.md │ BLUEPRINT.md │
134
- │ (workflow) │ (standards) │ (project spec) │
135
- └─────────────────────────────────────────────────────────────┘
136
- ```
63
+ ### 4. Pre-Commit Gate
64
+ **Before:** git commit
65
+ **Blocks if:**
66
+ - TODO/FIXME comments in diff
67
+ - console.log statements in diff
68
+ - Invalid commit message format
137
69
 
138
70
  ---
139
71
 
140
- ## On Task Start - MANDATORY
141
-
142
- When you receive ANY task, you MUST:
143
-
144
- ### 1. Route the Task
145
- Read `system/router.md` to classify:
146
- - Is this a feature, fix, refactor, query, etc.?
147
- - What workflow applies?
148
- - What gates are required?
149
-
150
- ### 2. Load Control Systems
151
- - `system/triggers.md` - Event handling
152
- - `system/loops.md` - Verification cycles
153
- - `system/gates.md` - Blocking checkpoints
72
+ ## Blocking Rules
154
73
 
155
- ### 3. Load Instructions
156
- - `instructions/CLAUDE.md` - Workflow steps
157
- - `instructions/AI_RULES.md` - Coding standards
158
- - `instructions/BLUEPRINT.md` - Project requirements
74
+ | Rule | Description |
75
+ |------|-------------|
76
+ | No orphan features | Backend must have UI |
77
+ | No TODO/FIXME | Complete the work |
78
+ | No console.log | No debug logs |
79
+ | No circular deps | Clean imports |
80
+ | Conventional commits | `type(scope): description` |
159
81
 
160
82
  ---
161
83
 
162
- ## Workflow Overview
163
-
164
- ```
165
- ANALYZE → PLAN → CONFIRM → IMPLEMENT → VERIFY → AUDIT → COMMIT → UPDATE
166
- │ │ │ │ │ │ │ │
167
- ▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼
168
- Read Design Wait for Write Run npm Check Create Update
169
- files approach approval code verify orphans commit BLUEPRINT
170
- ```
171
-
172
- ### Conditional Flows
173
-
174
- ```
175
- Session Start:
176
- ┌─────────────────────────────────────────────────┐
177
- │ Check BLUEPRINT.md exists? │
178
- ├─────────────────────────────────────────────────┤
179
- │ NO → Run /audit project → Generate both files │
180
- │ YES → Read AI_RULES.md + BLUEPRINT.md → Proceed │
181
- └─────────────────────────────────────────────────┘
84
+ ## Commands
182
85
 
183
- After Commit:
184
- ┌─────────────────────────────────────────────────┐
185
- Was new feature/route/API added? │
186
- ├─────────────────────────────────────────────────┤
187
- YES Prompt to update BLUEPRINT.md │
188
- │ NO → Skip update phase │
189
- └─────────────────────────────────────────────────┘
86
+ ```bash
87
+ npm run verify # TypeScript + ESLint
88
+ npm run audit:ui # Check orphan features
89
+ npm run audit:cycles # Check circular deps
90
+ npm run format # Prettier
190
91
  ```
191
92
 
192
93
  ---
193
94
 
194
- ## Hard Rules (NEVER Bypass)
195
-
196
- ### Blocking Gates
197
- | Gate | When | Blocks If |
198
- |------|------|-----------|
199
- | `plan_approval_gate` | Before implement | User hasn't approved |
200
- | `verify_gate` | After implement | TypeScript/ESLint errors |
201
- | `audit_gate` | Before commit (features) | Orphan features or cycles |
202
- | `pre_commit_gate` | Before commit | TODO/FIXME, console.log, etc. |
203
-
204
- ### Blocking Rules
205
- - **No orphan features** - Backend MUST have UI
206
- - **No TODO/FIXME** - Complete the work
207
- - **No console.log** - No debug logs in code
208
- - **No circular deps** - Clean architecture
209
- - **Conventional commits** - type(scope): description
210
-
211
- ---
95
+ ## Instructions
212
96
 
213
- ## Available Commands
97
+ Read `instructions/AI_RULES.md` for coding standards.
98
+ Read `instructions/BLUEPRINT.md` for project specification.
214
99
 
215
- | Command | Purpose |
216
- |---------|---------|
217
- | `/analyze [task]` | Analyze codebase for a task |
218
- | `/plan [task]` | Create implementation plan |
219
- | `/build [feature]` | Full workflow for features |
220
- | `/verify` | Run TypeScript + ESLint |
221
- | `/fix` | Fix verification errors |
222
- | `/audit` | Run UI + cycle audits |
223
- | `/audit project` | Full project scan → update BLUEPRINT.md |
224
- | `/suggest [task]` | Generate suggestions |
225
- | `/commit [msg]` | Pre-commit check + commit |
100
+ If BLUEPRINT.md is missing, the session-check hook will trigger.
101
+ Run a project audit and generate it.
226
102
 
227
103
  ---
228
104
 
229
105
  ## Quick Reference
230
106
 
231
- ### Session Start
107
+ **New feature:**
232
108
  ```
233
- Check BLUEPRINT.md exists?
234
- ├── NO → Run /audit project → Update AI_RULES.md + Create BLUEPRINT.md
235
- └── YES → Read both → Proceed
109
+ Analyze Plan+Suggest → [approval] → Implement → Verify → Audit → Commit → Update Blueprint
236
110
  ```
237
111
 
238
- ### For Features
112
+ **Bug fix:**
239
113
  ```
240
- /build [description]
241
- → Runs: ANALYZE → PLAN+SUGGEST → CONFIRM → IMPLEMENT → VERIFY → AUDIT → COMMIT → UPDATE
114
+ Analyze → Plan → [approval] → Implement → Verify → Commit
242
115
  ```
243
116
 
244
- ### For Fixes
245
- ```
246
- /analyze [issue] → /plan → [approval] → implement → /verify → /commit
247
- ```
248
-
249
- ### For Questions
250
- ```
251
- /analyze [question]
252
- → Returns information, no implementation
253
- ```
254
-
255
- ---
256
-
257
- ## File Map
258
-
117
+ **Question:**
259
118
  ```
260
- @autoworkflow/
261
- ├── CLAUDE.md ← YOU ARE HERE (Entry Point)
262
-
263
- ├── system/ ← Control Layer
264
- │ ├── triggers.md Event → Action mappings
265
- │ ├── loops.md Repeat-until definitions
266
- │ ├── gates.md Blocking checkpoints
267
- │ └── router.md Task type routing
268
-
269
- ├── instructions/ ← Content Layer
270
- │ ├── CLAUDE.md Workflow steps
271
- │ ├── AI_RULES.md Coding standards
272
- │ └── BLUEPRINT.md Project specification
273
-
274
- ├── scripts/ ← Automation Scripts
275
- │ ├── setup.sh One-command project setup
276
- │ ├── autoworkflow.sh CLI orchestrator
277
- │ ├── run-verification.sh Verification with output
278
- │ ├── ensure-no-errors.sh Pre-commit check
279
- │ └── check-ui-enforcement.sh Orphan feature detection
280
-
281
- ├── hooks/ ← Git Hooks
282
- │ ├── pre-commit Blocks bad commits
283
- │ └── commit-msg Validates commit format
284
-
285
- ├── .claude/ ← Claude Code Integration
286
- │ ├── settings.json Settings + instructions
287
- │ └── commands/ Slash command definitions
288
- │ ├── analyze.md
289
- │ ├── plan.md
290
- │ ├── build.md
291
- │ ├── verify.md
292
- │ ├── fix.md
293
- │ ├── audit.md
294
- │ ├── suggest.md
295
- │ └── commit.md
296
-
297
- ├── .vscode/ ← VS Code Integration
298
- │ ├── settings.json Editor settings
299
- │ ├── tasks.json Runnable tasks
300
- │ └── extensions.json Recommended extensions
301
-
302
- ├── .prettierrc ← Prettier config
303
- ├── eslint.config.example.js ← ESLint reference
304
- └── tsconfig.example.json ← TypeScript reference
119
+ Analyze → Respond
305
120
  ```
306
-
307
- ---
308
-
309
- ## Enforcement Summary
310
-
311
- **Claude is the PRIMARY enforcement engine.** These files control behavior:
312
-
313
- 1. **system/triggers.md** - WHEN to act
314
- 2. **system/loops.md** - HOW to repeat until success
315
- 3. **system/gates.md** - WHAT blocks progress
316
- 4. **system/router.md** - WHERE to route tasks
317
- 5. **instructions/CLAUDE.md** - THE workflow to follow
318
- 6. **instructions/AI_RULES.md** - THE standards to meet
319
-
320
- **Backup enforcement via automation:**
321
-
322
- 7. **hooks/pre-commit** - Blocks commits with errors (git hook)
323
- 8. **hooks/commit-msg** - Validates commit format (git hook)
324
- 9. **scripts/check-ui-enforcement.sh** - Detects orphan features
325
- 10. **scripts/autoworkflow.sh** - CLI for manual workflow runs
326
-
327
- Claude follows the instructions. Hooks catch anything that slips through.
328
-
329
- ---
330
-
331
- ## Start Here
332
-
333
- For every task:
334
- 1. Read this file (done)
335
- 2. Check if `instructions/BLUEPRINT.md` exists
336
- - If NO → Run `/audit project` first
337
- - If YES → Read it and proceed
338
- 3. Read `system/router.md` to classify task
339
- 4. Follow the appropriate workflow
340
- 5. Never skip gates
341
- 6. Complete features fully
342
- 7. Update BLUEPRINT.md after adding features
343
-
344
- **VERIFY ALWAYS. CHECK BLUEPRINT. NO ORPHANS. ONE AUDIT → TWO FILES.**
package/README.md CHANGED
@@ -1,91 +1,53 @@
1
- # AutoWorkflow - System Prompt Layer for Claude Code
1
+ # AutoWorkflow
2
2
 
3
- > **Claude is the enforcement engine.** System prompts control the workflow. Scripts and hooks provide backup enforcement.
3
+ > Automated workflow enforcement for Claude Code via hooks and system prompts.
4
4
 
5
- A system prompt architecture that controls Claude Code's behavior through triggers, loops, gates, and routing. When you use Claude Code in VS Code with this project, Claude automatically follows a structured 9-phase workflow for all coding tasks.
5
+ When you use Claude Code with AutoWorkflow, hooks automatically trigger checks and Claude follows a structured workflow for all coding tasks.
6
6
 
7
7
  ---
8
8
 
9
9
  ## Installation
10
10
 
11
- ### One Command Setup (Recommended)
12
-
13
11
  ```bash
14
12
  npx autoworkflow init
15
13
  ```
16
14
 
17
- This copies all workflow files to your project. Options:
15
+ Options:
18
16
  - `npx autoworkflow init` - Required + recommended files
19
17
  - `npx autoworkflow init --all` - Include .vscode and config templates
20
18
  - `npx autoworkflow init --minimal` - Required files only
21
19
 
22
- ### Or Install as Dependency
23
-
24
- ```bash
25
- npm install autoworkflow
26
- npx autoworkflow init
27
- ```
28
-
29
- **Or copy manually:**
30
-
31
- ```bash
32
- # Copy all workflow files
33
- cp -r node_modules/autoworkflow/CLAUDE.md .
34
- cp -r node_modules/autoworkflow/system ./system
35
- cp -r node_modules/autoworkflow/instructions ./instructions
36
- cp -r node_modules/autoworkflow/.claude ./.claude
37
- cp -r node_modules/autoworkflow/scripts ./scripts
38
- cp -r node_modules/autoworkflow/hooks ./hooks
39
-
40
- # Optional: Copy VS Code settings
41
- cp -r node_modules/autoworkflow/.vscode ./.vscode
42
-
43
- # Optional: Copy config examples
44
- cp node_modules/autoworkflow/.prettierrc .
45
- cp node_modules/autoworkflow/eslint.config.example.js ./eslint.config.js
46
- cp node_modules/autoworkflow/tsconfig.example.json ./tsconfig.json
47
-
48
- # Setup git hooks
49
- npm run setup:hooks
50
- ```
51
-
52
- ### Manual Installation
53
-
54
- Clone or download this repository and copy the files to your project.
55
-
56
20
  ---
57
21
 
58
22
  ## How It Works
59
23
 
60
24
  ```
61
25
  ┌─────────────────────────────────────────────────────────────┐
62
- CLAUDE.md (Entry Point)
63
- │ Loaded automatically by Claude Code │
64
- └───────────────────────────┬─────────────────────────────────┘
65
-
66
-
67
- ┌─────────────────────────────────────────────────────────────┐
68
- │ system/ (Control Layer) │
26
+ HOOKS (Automatic)
69
27
  │ │
70
- triggers.md loops.md gates.md │ router.md │
71
- WHEN to act │ HOW to │ WHAT │ WHERE to
72
- repeat │ blocks route │
73
- └───────────────────────────┬─────────────────────────────────┘
28
+ UserPromptSubmit session-check.sh
29
+ PostToolUse → post-edit.sh (after Write/Edit)
30
+ PreToolUse → pre-commit-check.sh (before git)
31
+ │ │
32
+ │ Hooks output messages that Claude sees as instructions │
33
+ └─────────────────────────────────────────────────────────────┘
74
34
 
75
35
 
76
36
  ┌─────────────────────────────────────────────────────────────┐
77
- instructions/ (Content Layer) │
37
+ settings.json (System Prompt) │
78
38
  │ │
79
- CLAUDE.md AI_RULES.md │ BLUEPRINT.md │
80
- Workflow Standards │ Project spec │
81
- └───────────────────────────┬─────────────────────────────────┘
39
+ "instructions": [
40
+ "SESSION START: If BLUEPRINT.md missing, scan codebase"
41
+ │ "AFTER CODE CHANGES: Run npm run verify" │
42
+ │ "BEFORE COMMIT: Block if TODO/console.log found" │
43
+ │ ] │
44
+ └─────────────────────────────────────────────────────────────┘
82
45
 
83
46
 
84
47
  ┌─────────────────────────────────────────────────────────────┐
85
- Backup Enforcement (Runtime Layer)
48
+ CLAUDE.md + instructions/
86
49
  │ │
87
- scripts/ │ hooks/ │ npm scripts
88
- │ Automation │ Git hooks │ Verification │
50
+ Workflow details, gates, task types, coding standards
89
51
  └─────────────────────────────────────────────────────────────┘
90
52
  ```
91
53
 
@@ -93,222 +55,117 @@ Clone or download this repository and copy the files to your project.
93
55
 
94
56
  ## The Workflow
95
57
 
96
- When you ask Claude to do something, it follows this 9-phase workflow:
97
-
98
58
  ```
99
- ANALYZE → PLAN → CONFIRM → IMPLEMENT → VERIFY → FIX → AUDIT → COMMIT → UPDATE
59
+ ANALYZE → PLAN → CONFIRM → IMPLEMENT → VERIFY → AUDIT → COMMIT → UPDATE
100
60
  ```
101
61
 
102
- | Phase | What Claude Does |
103
- |-------|------------------|
104
- | **ANALYZE** | Reads relevant files, checks BLUEPRINT.md |
105
- | **PLAN** | Designs approach, shows categorized suggestions |
106
- | **CONFIRM** | Waits for your approval |
107
- | **IMPLEMENT** | Makes changes (only after approval) |
108
- | **VERIFY** | Runs `npm run verify` (typecheck + lint) |
109
- | **FIX** | Fixes errors, loops back to VERIFY |
110
- | **AUDIT** | Checks for orphan features, circular deps |
111
- | **COMMIT** | Creates conventional commit (after approval) |
112
- | **UPDATE** | Updates BLUEPRINT.md if new feature/route/API added |
113
-
114
- ### Session Start
115
-
116
- At the start of every session, Claude:
117
- 1. Checks if `instructions/BLUEPRINT.md` exists
118
- 2. If missing → Runs `/audit project` to generate it
119
- 3. If exists → Reads AI_RULES.md + BLUEPRINT.md and proceeds
62
+ | Phase | What Happens |
63
+ |-------|--------------|
64
+ | ANALYZE | Read relevant files, check BLUEPRINT.md |
65
+ | PLAN | Design approach, show suggestions |
66
+ | CONFIRM | Wait for user approval |
67
+ | IMPLEMENT | Make changes (after approval only) |
68
+ | VERIFY | Run `npm run verify` (auto-triggered by hook) |
69
+ | AUDIT | Check orphan features + circular deps |
70
+ | COMMIT | Conventional commit format |
71
+ | UPDATE | Update BLUEPRINT.md if needed |
120
72
 
121
73
  ---
122
74
 
123
- ## Blocking Gates
75
+ ## Auto-Triggers (Hooks)
124
76
 
125
- Claude will STOP and cannot proceed if:
126
-
127
- | Gate | Blocks If |
128
- |------|-----------|
129
- | `plan_approval_gate` | You haven't approved the plan |
130
- | `verify_gate` | TypeScript or ESLint errors exist |
131
- | `audit_gate` | Orphan features or circular dependencies |
132
- | `pre_commit_gate` | TODO/FIXME, console.log, bad commit format |
77
+ | Hook | Trigger | Action |
78
+ |------|---------|--------|
79
+ | `session-check.sh` | Every user message | Check if BLUEPRINT.md exists, prompt audit if missing |
80
+ | `post-edit.sh` | After Write/Edit | Remind to run verification |
81
+ | `pre-commit-check.sh` | Before git commit | Block if TODO/FIXME/console.log found |
133
82
 
134
83
  ---
135
84
 
136
- ## Available Commands
85
+ ## Blocking Gates
137
86
 
138
- | Command | Purpose |
139
- |---------|---------|
140
- | `/init` | Set up AutoWorkflow files from node_modules |
141
- | `/analyze [task]` | Analyze codebase for a task |
142
- | `/plan [task]` | Create implementation plan |
143
- | `/build [feature]` | Full workflow for features |
144
- | `/verify` | Run TypeScript + ESLint |
145
- | `/fix` | Fix verification errors |
146
- | `/audit` | Run UI + cycle audits |
147
- | `/audit project` | Full project scan → generates BLUEPRINT.md |
148
- | `/suggest [task]` | Generate suggestions |
149
- | `/commit [msg]` | Pre-commit check + commit |
87
+ | Gate | Blocks If |
88
+ |------|-----------|
89
+ | Plan Approval | User hasn't approved the plan |
90
+ | Verify | TypeScript or ESLint errors exist |
91
+ | Audit | Orphan features or circular dependencies |
92
+ | Pre-Commit | TODO/FIXME, console.log, bad commit format |
150
93
 
151
94
  ---
152
95
 
153
- ## Hard Rules
154
-
155
- Claude enforces these automatically:
96
+ ## File Structure
156
97
 
157
- - **No orphan features** - Backend MUST have corresponding UI
158
- - **No TODO/FIXME** - Complete the work, don't leave placeholders
159
- - **No console.log** - No debug logs in production code
160
- - **No circular deps** - Clean architecture required
161
- - **Conventional commits** - `type(scope): description` format
98
+ ```
99
+ project/
100
+ ├── CLAUDE.md # Workflow + gates (auto-read)
101
+
102
+ ├── .claude/
103
+ │ ├── settings.json # System prompt + hooks config
104
+ │ ├── hooks/ # Auto-trigger scripts
105
+ │ │ ├── session-check.sh
106
+ │ │ ├── post-edit.sh
107
+ │ │ └── pre-commit-check.sh
108
+ │ └── commands/ # Slash commands
109
+
110
+ ├── instructions/
111
+ │ ├── AI_RULES.md # Your coding standards
112
+ │ └── BLUEPRINT.md # Project spec (auto-generated)
113
+
114
+ ├── scripts/ # Automation scripts
115
+ ├── hooks/ # Git hooks (backup enforcement)
116
+ └── .vscode/ # VS Code settings (optional)
117
+ ```
162
118
 
163
119
  ---
164
120
 
165
- ## npm Scripts
121
+ ## Commands
166
122
 
167
123
  ### Verification
168
124
  ```bash
169
125
  npm run verify # TypeScript + ESLint
170
126
  npm run typecheck # TypeScript only
171
127
  npm run lint # ESLint only
172
- npm run format # Prettier format
173
128
  ```
174
129
 
175
130
  ### Audits
176
131
  ```bash
177
- npm run audit:ui # Check orphan features (BLOCKING)
178
- npm run audit:cycles # Check circular deps (BLOCKING)
132
+ npm run audit:ui # Check orphan features
133
+ npm run audit:cycles # Check circular deps
179
134
  npm run audit:all # Run all audits
180
135
  ```
181
136
 
182
- ### Workflow Automation
183
- ```bash
184
- npm run dyad:status # Show workflow status
185
- npm run dyad:verify # Run verification
186
- npm run dyad:commit # Commit with checks
187
- npm run dyad:full # Full workflow
188
- ```
189
-
190
- ### Setup
191
- ```bash
192
- npm run setup:hooks # Install git hooks
193
- ```
194
-
195
- ---
196
-
197
- ## File Structure
198
-
199
- ```
200
- autoworkflow/
201
- ├── CLAUDE.md # Entry point (Claude reads this first)
202
-
203
- ├── system/ # Control Layer
204
- │ ├── triggers.md # Event → Action mappings
205
- │ ├── loops.md # Verify/fix cycle definitions
206
- │ ├── gates.md # Blocking checkpoints
207
- │ └── router.md # Task type routing
208
-
209
- ├── instructions/ # Content Layer
210
- │ ├── CLAUDE.md # Workflow steps (9 phases)
211
- │ ├── AI_RULES.md # Coding standards
212
- │ └── BLUEPRINT.md # Project specification
213
-
214
- ├── .claude/ # Claude Code Integration
215
- │ ├── settings.json # Settings + hard rules
216
- │ └── commands/ # Slash command definitions
217
- │ ├── init.md
218
- │ ├── analyze.md
219
- │ ├── plan.md
220
- │ ├── build.md
221
- │ ├── verify.md
222
- │ ├── fix.md
223
- │ ├── audit.md
224
- │ ├── suggest.md
225
- │ └── commit.md
226
-
227
- ├── scripts/ # Automation Scripts
228
- │ ├── setup.sh # Initial setup
229
- │ ├── autoworkflow.sh # Workflow automation
230
- │ ├── check-ui-enforcement.sh
231
- │ ├── run-verification.sh
232
- │ └── ensure-no-errors.sh
233
-
234
- ├── hooks/ # Git Hooks (backup enforcement)
235
- │ ├── pre-commit # Blocks bad commits
236
- │ └── commit-msg # Validates commit messages
237
-
238
- ├── .vscode/ # VS Code Integration (optional)
239
- │ ├── settings.json # Editor settings
240
- │ ├── tasks.json # Runnable tasks
241
- │ └── extensions.json # Recommended extensions
242
-
243
- ├── .prettierrc # Prettier config
244
- ├── eslint.config.example.js # ESLint config template
245
- └── tsconfig.example.json # TypeScript config template
246
- ```
247
-
248
- ---
249
-
250
- ## Why This Approach?
251
-
252
- ### Dual Enforcement Strategy
253
-
254
- **Primary: Claude as Enforcement Engine**
255
- - Claude reads instructions from system prompts
256
- - Claude follows the 9-phase workflow
257
- - Claude enforces rules proactively as it works
258
- - Claude explains what's happening
259
-
260
- **Backup: Scripts & Git Hooks**
261
- - Git hooks catch anything Claude misses
262
- - Scripts automate verification
263
- - Pre-commit blocks bad code from reaching the repo
264
-
265
- ### Benefits
266
-
267
- | Feature | Benefit |
137
+ ### Slash Commands
138
+ | Command | Purpose |
268
139
  |---------|---------|
269
- | System prompts | No runtime code to maintain |
270
- | Portable | Just copy files to any project |
271
- | Transparent | Claude explains the workflow |
272
- | Flexible | Claude adapts to context |
273
- | Suggestions | Proactively improves code quality |
274
- | Git hooks | Backup enforcement layer |
275
- | npm scripts | Easy automation |
140
+ | `/analyze [task]` | Analyze codebase |
141
+ | `/plan [task]` | Create implementation plan |
142
+ | `/build [feature]` | Full workflow |
143
+ | `/verify` | Run verification |
144
+ | `/audit` | Run audits |
145
+ | `/audit project` | Full scan generate BLUEPRINT.md |
146
+ | `/commit` | Pre-commit check + commit |
276
147
 
277
148
  ---
278
149
 
279
150
  ## Customization
280
151
 
281
- ### Adding Your Coding Standards
152
+ ### Your Coding Standards
282
153
  Edit `instructions/AI_RULES.md`:
283
154
  ```markdown
284
155
  ## ALWAYS
285
156
  - Use TypeScript strict mode
286
157
  - Handle all error cases
287
- - Add loading states for async
288
158
 
289
159
  ## NEVER
290
160
  - Use `any` type
291
161
  - Leave console.logs
292
- - Skip error handling
293
162
  ```
294
163
 
295
- ### Adding Your Project Spec
296
- Edit `instructions/BLUEPRINT.md`:
297
- ```markdown
298
- ## Features
299
- - [ ] User authentication
300
- - [ ] Dashboard page
301
- - [ ] Settings panel
302
-
303
- ## Data Model
304
- User: id, email, name, role
305
- ```
164
+ ### Adjust Gates
165
+ Edit `.claude/settings.json` gates section.
306
166
 
307
- ### Adjusting Gates
308
- Edit `system/gates.md` to change what blocks progress.
309
-
310
- ### Adjusting Loops
311
- Edit `system/loops.md` to change retry behavior.
167
+ ### Modify Hooks
168
+ Edit files in `.claude/hooks/` to change auto-trigger behavior.
312
169
 
313
170
  ---
314
171
 
@@ -320,23 +177,6 @@ Edit `system/loops.md` to change retry behavior.
320
177
 
321
178
  ---
322
179
 
323
- ## What Gets Copied
324
-
325
- When you install via npm, these files are available to copy:
326
-
327
- | Category | Files | Required? |
328
- |----------|-------|-----------|
329
- | Entry point | `CLAUDE.md` | ✅ Yes |
330
- | Control layer | `system/` | ✅ Yes |
331
- | Content layer | `instructions/` | ✅ Yes |
332
- | Claude integration | `.claude/` | ✅ Yes |
333
- | Automation | `scripts/` | Recommended |
334
- | Git hooks | `hooks/` | Recommended |
335
- | VS Code | `.vscode/` | Optional |
336
- | Configs | `.prettierrc`, `*.example.*` | Optional |
337
-
338
- ---
339
-
340
180
  ## License
341
181
 
342
182
  MIT
package/bin/cli.js CHANGED
@@ -101,10 +101,25 @@ function init(options = {}) {
101
101
  // Required files
102
102
  console.log(colors.bold('Required files:'));
103
103
  copyFile(join(packageRoot, 'CLAUDE.md'), join(cwd, 'CLAUDE.md'), 'CLAUDE.md');
104
- copyFile(join(packageRoot, 'system'), join(cwd, 'system'), 'system/');
105
104
  copyFile(join(packageRoot, 'instructions'), join(cwd, 'instructions'), 'instructions/');
106
105
  copyFile(join(packageRoot, '.claude'), join(cwd, '.claude'), '.claude/');
107
106
 
107
+ // Make Claude hooks executable
108
+ if (process.platform !== 'win32' && existsSync(join(cwd, '.claude', 'hooks'))) {
109
+ try {
110
+ const hookFiles = ['session-check.sh', 'post-edit.sh', 'pre-commit-check.sh'];
111
+ hookFiles.forEach(hook => {
112
+ const hookPath = join(cwd, '.claude', 'hooks', hook);
113
+ if (existsSync(hookPath)) {
114
+ chmodSync(hookPath, 0o755);
115
+ }
116
+ });
117
+ console.log(` ${colors.green('✓')} Claude hooks made executable`);
118
+ } catch (e) {
119
+ // Ignore chmod errors
120
+ }
121
+ }
122
+
108
123
  if (!minimal) {
109
124
  // Recommended files
110
125
  console.log(`\n${colors.bold('Recommended files:')}`);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "autoworkflow",
3
- "version": "2.2.2",
4
- "description": "System prompt layer that controls Claude Code's workflow with triggers, loops, and gates",
3
+ "version": "3.0.0",
4
+ "description": "Automated workflow enforcement for Claude Code via hooks and system prompts",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "autoworkflow": "bin/cli.js"
@@ -11,7 +11,9 @@
11
11
  "claude-code",
12
12
  "workflow",
13
13
  "system-prompts",
14
- "ai-instructions"
14
+ "ai-instructions",
15
+ "hooks",
16
+ "automation"
15
17
  ],
16
18
  "author": "",
17
19
  "license": "MIT",
@@ -71,16 +71,22 @@ Or run `/init --all` to include .vscode and config templates.
71
71
  ### `on:blueprint_missing`
72
72
 
73
73
  **When:** BLUEPRINT.md does not exist at session start
74
+ **Behavior:** AUTOMATIC - runs without asking permission
75
+
76
+ **IMPORTANT:** This trigger runs AUTOMATICALLY. Do NOT ask "Should I run the audit?" - just run it.
77
+ Only ask for approval when SAVING the generated files, not when starting the scan.
78
+
74
79
  **Action:**
75
- 1. Run single audit scan of codebase
76
- 2. Generate BOTH AI_RULES.md updates AND BLUEPRINT.md
77
- 3. Present proposed updates to user
78
- 4. Save after approval
80
+ 1. Notify user (brief message)
81
+ 2. **RUN audit immediately** (no permission needed)
82
+ 3. Generate BOTH AI_RULES.md updates AND BLUEPRINT.md
83
+ 4. Present proposed updates to user
84
+ 5. Ask approval to SAVE (not to start)
79
85
 
80
86
  ```
81
87
  TRIGGER: blueprint_missing
82
- ├── Notify: "No BLUEPRINT.md found. Running project audit..."
83
- ├── Scan: codebase (single pass)
88
+ ├── Notify: "No BLUEPRINT.md found. Running project audit..." ← Just notify
89
+ ├── RUN IMMEDIATELY (no permission needed): ← Auto-run
84
90
  │ ├── cat package.json → Tech stack
85
91
  │ ├── find src -type d → File structure
86
92
  │ ├── ls src/pages/ → Routes
@@ -91,19 +97,35 @@ TRIGGER: blueprint_missing
91
97
  ├── Generate: AI_RULES.md updates (Tech Stack, File Structure)
92
98
  ├── Generate: BLUEPRINT.md (Features, Routes, APIs)
93
99
  ├── Present: both updates to user
94
- ├── Await: user approval
100
+ ├── Await: approval TO SAVE (not to start) ← Only save needs approval
95
101
  └── Save: both files after approval
96
102
  ```
97
103
 
104
+ **DO NOT:**
105
+ - Ask "Should I run the audit?"
106
+ - Ask "Do you want me to scan the project?"
107
+ - Wait for permission to start scanning
108
+
109
+ **DO:**
110
+ - Notify and immediately start scanning
111
+ - Only ask permission when presenting results to save
112
+
98
113
  **Output Format:**
99
114
  ```
100
- ⚠️ No BLUEPRINT.md found in this project.
115
+ ⚠️ No BLUEPRINT.md found.
116
+
117
+ Running project audit now...
118
+
119
+ [scanning happens automatically]
120
+
121
+ ---
122
+
123
+ ## 🔍 Audit Complete
101
124
 
102
- Running ONE audit to update TWO files:
103
- - 📄 AI_RULES.md → Tech Stack & File Structure
104
- - 📘 BLUEPRINT.md → Features, Routes, APIs
125
+ [present AI_RULES.md updates]
126
+ [present BLUEPRINT.md content]
105
127
 
106
- Scanning codebase...
128
+ **Should I save these files?** (yes/no/edit first)
107
129
  ```
108
130
 
109
131
  ---