devflow-kit 1.1.0 → 1.3.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/CHANGELOG.md +69 -1
- package/README.md +23 -6
- package/dist/cli.js +2 -0
- package/dist/commands/ambient.js +5 -4
- package/dist/commands/init.js +4 -2
- package/dist/commands/memory.js +4 -4
- package/dist/commands/skills.d.ts +11 -0
- package/dist/commands/skills.js +116 -0
- package/dist/commands/uninstall.js +11 -1
- package/dist/plugins.js +67 -3
- package/dist/utils/installer.js +20 -2
- package/package.json +4 -2
- package/plugins/devflow-accessibility/.claude-plugin/plugin.json +22 -0
- package/plugins/devflow-ambient/.claude-plugin/plugin.json +4 -2
- package/plugins/devflow-ambient/README.md +8 -8
- package/plugins/devflow-ambient/commands/ambient.md +14 -14
- package/plugins/devflow-ambient/skills/ambient-router/SKILL.md +16 -9
- package/plugins/devflow-ambient/skills/ambient-router/references/skill-catalog.md +6 -2
- package/plugins/devflow-audit-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/devflow-code-review/.claude-plugin/plugin.json +13 -6
- package/plugins/devflow-code-review/agents/reviewer.md +8 -0
- package/plugins/devflow-code-review/commands/code-review-teams.md +11 -1
- package/plugins/devflow-code-review/commands/code-review.md +12 -2
- package/plugins/devflow-code-review/skills/architecture-patterns/SKILL.md +1 -1
- package/plugins/devflow-code-review/skills/complexity-patterns/SKILL.md +1 -1
- package/plugins/devflow-code-review/skills/consistency-patterns/SKILL.md +1 -1
- package/plugins/devflow-code-review/skills/database-patterns/SKILL.md +1 -1
- package/plugins/devflow-code-review/skills/dependencies-patterns/SKILL.md +1 -1
- package/plugins/devflow-code-review/skills/documentation-patterns/SKILL.md +1 -1
- package/plugins/devflow-code-review/skills/performance-patterns/SKILL.md +1 -1
- package/plugins/devflow-code-review/skills/regression-patterns/SKILL.md +1 -1
- package/plugins/devflow-code-review/skills/review-methodology/SKILL.md +1 -1
- package/plugins/devflow-code-review/skills/security-patterns/SKILL.md +1 -1
- package/plugins/devflow-core-skills/.claude-plugin/plugin.json +10 -7
- package/plugins/devflow-core-skills/skills/test-driven-development/SKILL.md +5 -8
- package/plugins/devflow-debug/.claude-plugin/plugin.json +10 -3
- package/plugins/devflow-frontend-design/.claude-plugin/plugin.json +22 -0
- package/plugins/devflow-go/.claude-plugin/plugin.json +22 -0
- package/plugins/devflow-go/skills/go/SKILL.md +187 -0
- package/plugins/devflow-go/skills/go/references/concurrency.md +312 -0
- package/plugins/devflow-go/skills/go/references/detection.md +129 -0
- package/plugins/devflow-go/skills/go/references/patterns.md +232 -0
- package/plugins/devflow-go/skills/go/references/violations.md +205 -0
- package/plugins/devflow-implement/.claude-plugin/plugin.json +19 -5
- package/plugins/devflow-implement/agents/coder.md +11 -6
- package/plugins/devflow-implement/skills/self-review/SKILL.md +1 -1
- package/plugins/devflow-java/.claude-plugin/plugin.json +22 -0
- package/plugins/devflow-java/skills/java/SKILL.md +183 -0
- package/plugins/devflow-java/skills/java/references/detection.md +120 -0
- package/plugins/devflow-java/skills/java/references/modern-java.md +270 -0
- package/plugins/devflow-java/skills/java/references/patterns.md +235 -0
- package/plugins/devflow-java/skills/java/references/violations.md +213 -0
- package/plugins/devflow-python/.claude-plugin/plugin.json +22 -0
- package/plugins/devflow-python/skills/python/SKILL.md +188 -0
- package/plugins/devflow-python/skills/python/references/async.md +220 -0
- package/plugins/devflow-python/skills/python/references/detection.md +128 -0
- package/plugins/devflow-python/skills/python/references/patterns.md +226 -0
- package/plugins/devflow-python/skills/python/references/violations.md +204 -0
- package/plugins/devflow-react/.claude-plugin/plugin.json +22 -0
- package/plugins/{devflow-core-skills → devflow-react}/skills/react/SKILL.md +1 -1
- package/plugins/{devflow-core-skills → devflow-react}/skills/react/references/patterns.md +3 -3
- package/plugins/devflow-resolve/.claude-plugin/plugin.json +13 -3
- package/plugins/devflow-resolve/skills/security-patterns/SKILL.md +1 -1
- package/plugins/devflow-rust/.claude-plugin/plugin.json +22 -0
- package/plugins/devflow-rust/skills/rust/SKILL.md +193 -0
- package/plugins/devflow-rust/skills/rust/references/detection.md +131 -0
- package/plugins/devflow-rust/skills/rust/references/ownership.md +242 -0
- package/plugins/devflow-rust/skills/rust/references/patterns.md +210 -0
- package/plugins/devflow-rust/skills/rust/references/violations.md +191 -0
- package/plugins/devflow-self-review/.claude-plugin/plugin.json +10 -3
- package/plugins/devflow-self-review/skills/self-review/SKILL.md +1 -1
- package/plugins/devflow-specify/.claude-plugin/plugin.json +15 -4
- package/plugins/devflow-typescript/.claude-plugin/plugin.json +22 -0
- package/plugins/{devflow-core-skills → devflow-typescript}/skills/typescript/references/patterns.md +3 -3
- package/scripts/hooks/{ambient-prompt.sh → ambient-prompt} +4 -4
- package/scripts/hooks/{background-memory-update.sh → background-memory-update} +3 -3
- package/scripts/hooks/{ensure-memory-gitignore.sh → ensure-memory-gitignore} +1 -1
- package/scripts/hooks/{pre-compact-memory.sh → pre-compact-memory} +2 -2
- package/scripts/hooks/run-hook +23 -0
- package/scripts/hooks/session-start-memory +151 -0
- package/scripts/hooks/{stop-update-memory.sh → stop-update-memory} +4 -4
- package/shared/agents/coder.md +11 -6
- package/shared/agents/reviewer.md +8 -0
- package/shared/skills/ambient-router/SKILL.md +16 -9
- package/shared/skills/ambient-router/references/skill-catalog.md +6 -2
- package/shared/skills/architecture-patterns/SKILL.md +1 -1
- package/shared/skills/complexity-patterns/SKILL.md +1 -1
- package/shared/skills/consistency-patterns/SKILL.md +1 -1
- package/shared/skills/database-patterns/SKILL.md +1 -1
- package/shared/skills/dependencies-patterns/SKILL.md +1 -1
- package/shared/skills/documentation-patterns/SKILL.md +1 -1
- package/shared/skills/go/SKILL.md +187 -0
- package/shared/skills/go/references/concurrency.md +312 -0
- package/shared/skills/go/references/detection.md +129 -0
- package/shared/skills/go/references/patterns.md +232 -0
- package/shared/skills/go/references/violations.md +205 -0
- package/shared/skills/java/SKILL.md +183 -0
- package/shared/skills/java/references/detection.md +120 -0
- package/shared/skills/java/references/modern-java.md +270 -0
- package/shared/skills/java/references/patterns.md +235 -0
- package/shared/skills/java/references/violations.md +213 -0
- package/shared/skills/performance-patterns/SKILL.md +1 -1
- package/shared/skills/python/SKILL.md +188 -0
- package/shared/skills/python/references/async.md +220 -0
- package/shared/skills/python/references/detection.md +128 -0
- package/shared/skills/python/references/patterns.md +226 -0
- package/shared/skills/python/references/violations.md +204 -0
- package/shared/skills/react/SKILL.md +1 -1
- package/shared/skills/react/references/patterns.md +3 -3
- package/shared/skills/regression-patterns/SKILL.md +1 -1
- package/shared/skills/review-methodology/SKILL.md +1 -1
- package/shared/skills/rust/SKILL.md +193 -0
- package/shared/skills/rust/references/detection.md +131 -0
- package/shared/skills/rust/references/ownership.md +242 -0
- package/shared/skills/rust/references/patterns.md +210 -0
- package/shared/skills/rust/references/violations.md +191 -0
- package/shared/skills/security-patterns/SKILL.md +1 -1
- package/shared/skills/self-review/SKILL.md +1 -1
- package/shared/skills/test-driven-development/SKILL.md +5 -8
- package/shared/skills/typescript/references/patterns.md +3 -3
- package/src/templates/settings.json +3 -3
- package/plugins/devflow-code-review/skills/react/SKILL.md +0 -276
- package/plugins/devflow-code-review/skills/react/references/patterns.md +0 -1331
- package/plugins/devflow-core-skills/skills/accessibility/SKILL.md +0 -229
- package/plugins/devflow-core-skills/skills/accessibility/references/detection.md +0 -171
- package/plugins/devflow-core-skills/skills/accessibility/references/patterns.md +0 -670
- package/plugins/devflow-core-skills/skills/accessibility/references/violations.md +0 -419
- package/plugins/devflow-core-skills/skills/frontend-design/SKILL.md +0 -254
- package/plugins/devflow-core-skills/skills/frontend-design/references/detection.md +0 -184
- package/plugins/devflow-core-skills/skills/frontend-design/references/patterns.md +0 -511
- package/plugins/devflow-core-skills/skills/frontend-design/references/violations.md +0 -453
- package/plugins/devflow-core-skills/skills/react/references/violations.md +0 -565
- package/plugins/devflow-implement/skills/accessibility/SKILL.md +0 -229
- package/plugins/devflow-implement/skills/accessibility/references/detection.md +0 -171
- package/plugins/devflow-implement/skills/accessibility/references/patterns.md +0 -670
- package/plugins/devflow-implement/skills/accessibility/references/violations.md +0 -419
- package/plugins/devflow-implement/skills/frontend-design/SKILL.md +0 -254
- package/plugins/devflow-implement/skills/frontend-design/references/detection.md +0 -184
- package/plugins/devflow-implement/skills/frontend-design/references/patterns.md +0 -511
- package/plugins/devflow-implement/skills/frontend-design/references/violations.md +0 -453
- package/scripts/hooks/session-start-memory.sh +0 -126
- /package/plugins/{devflow-code-review → devflow-accessibility}/skills/accessibility/SKILL.md +0 -0
- /package/plugins/{devflow-code-review → devflow-accessibility}/skills/accessibility/references/detection.md +0 -0
- /package/plugins/{devflow-code-review → devflow-accessibility}/skills/accessibility/references/patterns.md +0 -0
- /package/plugins/{devflow-code-review → devflow-accessibility}/skills/accessibility/references/violations.md +0 -0
- /package/plugins/{devflow-code-review → devflow-frontend-design}/skills/frontend-design/SKILL.md +0 -0
- /package/plugins/{devflow-code-review → devflow-frontend-design}/skills/frontend-design/references/detection.md +0 -0
- /package/plugins/{devflow-code-review → devflow-frontend-design}/skills/frontend-design/references/patterns.md +0 -0
- /package/plugins/{devflow-code-review → devflow-frontend-design}/skills/frontend-design/references/violations.md +0 -0
- /package/plugins/{devflow-code-review → devflow-react}/skills/react/references/violations.md +0 -0
- /package/plugins/{devflow-core-skills → devflow-typescript}/skills/typescript/SKILL.md +0 -0
- /package/plugins/{devflow-core-skills → devflow-typescript}/skills/typescript/references/violations.md +0 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "devflow-typescript",
|
|
3
|
+
"description": "TypeScript language patterns - type safety, generics, utility types, type guards",
|
|
4
|
+
"author": {
|
|
5
|
+
"name": "DevFlow Contributors",
|
|
6
|
+
"email": "dean@keren.dev"
|
|
7
|
+
},
|
|
8
|
+
"version": "1.3.0",
|
|
9
|
+
"homepage": "https://github.com/dean0x/devflow",
|
|
10
|
+
"repository": "https://github.com/dean0x/devflow",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"keywords": [
|
|
13
|
+
"typescript",
|
|
14
|
+
"types",
|
|
15
|
+
"generics",
|
|
16
|
+
"type-safety"
|
|
17
|
+
],
|
|
18
|
+
"agents": [],
|
|
19
|
+
"skills": [
|
|
20
|
+
"typescript"
|
|
21
|
+
]
|
|
22
|
+
}
|
package/plugins/{devflow-core-skills → devflow-typescript}/skills/typescript/references/patterns.md
RENAMED
|
@@ -137,7 +137,7 @@ const isUndefined = (value: unknown): value is undefined =>
|
|
|
137
137
|
const isNullish = (value: unknown): value is null | undefined =>
|
|
138
138
|
value === null || value === undefined;
|
|
139
139
|
|
|
140
|
-
const isFunction = (value: unknown): value is
|
|
140
|
+
const isFunction = (value: unknown): value is (...args: unknown[]) => unknown =>
|
|
141
141
|
typeof value === 'function';
|
|
142
142
|
|
|
143
143
|
const isObject = (value: unknown): value is object =>
|
|
@@ -760,7 +760,7 @@ function debounce<T extends (...args: any[]) => any>(
|
|
|
760
760
|
fn: T,
|
|
761
761
|
delayMs: number
|
|
762
762
|
): (...args: Parameters<T>) => void {
|
|
763
|
-
let timeoutId:
|
|
763
|
+
let timeoutId: ReturnType<typeof setTimeout> | null = null;
|
|
764
764
|
|
|
765
765
|
return (...args: Parameters<T>) => {
|
|
766
766
|
if (timeoutId) clearTimeout(timeoutId);
|
|
@@ -774,7 +774,7 @@ function throttle<T extends (...args: any[]) => any>(
|
|
|
774
774
|
limitMs: number
|
|
775
775
|
): (...args: Parameters<T>) => void {
|
|
776
776
|
let lastRun = 0;
|
|
777
|
-
let timeoutId:
|
|
777
|
+
let timeoutId: ReturnType<typeof setTimeout> | null = null;
|
|
778
778
|
|
|
779
779
|
return (...args: Parameters<T>) => {
|
|
780
780
|
const now = Date.now();
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
# relevant skill loading via the ambient-router skill.
|
|
6
6
|
# Zero file I/O beyond stdin — static injection only.
|
|
7
7
|
|
|
8
|
-
set -
|
|
8
|
+
set -e
|
|
9
9
|
|
|
10
10
|
# jq is required to parse hook input JSON — silently no-op if missing
|
|
11
11
|
if ! command -v jq &>/dev/null; then exit 0; fi
|
|
@@ -33,12 +33,12 @@ fi
|
|
|
33
33
|
# Inject classification preamble
|
|
34
34
|
PREAMBLE="AMBIENT MODE ACTIVE: Before responding, silently classify this prompt:
|
|
35
35
|
Intent: BUILD | DEBUG | REVIEW | PLAN | EXPLORE | CHAT
|
|
36
|
-
Depth: QUICK (no overhead) |
|
|
36
|
+
Depth: QUICK (no overhead) | GUIDED (load skills) | ELEVATE (suggest /command)
|
|
37
37
|
|
|
38
|
-
If
|
|
38
|
+
If GUIDED+: Use the ambient-router skill already in your session context for classification details and skill selection matrix. Then Read the selected skills from ~/.claude/skills/<name>/SKILL.md and apply their patterns. For BUILD tasks, also load test-driven-development skill and enforce RED-GREEN-REFACTOR.
|
|
39
39
|
|
|
40
40
|
If QUICK: Respond normally without stating classification.
|
|
41
|
-
Only state classification aloud for
|
|
41
|
+
Only state classification aloud for GUIDED/ELEVATE."
|
|
42
42
|
|
|
43
43
|
jq -n --arg ctx "$PREAMBLE" '{
|
|
44
44
|
"hookSpecificOutput": {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
|
|
3
3
|
# Background Working Memory Updater
|
|
4
|
-
# Called by stop-update-memory
|
|
4
|
+
# Called by stop-update-memory as a detached background process.
|
|
5
5
|
# Resumes the parent session headlessly to update .memory/WORKING-MEMORY.md.
|
|
6
6
|
# On failure: logs error, does nothing (no fallback).
|
|
7
7
|
|
|
8
|
-
set -
|
|
8
|
+
set -e
|
|
9
9
|
|
|
10
10
|
CWD="$1"
|
|
11
11
|
SESSION_ID="$2"
|
|
@@ -29,7 +29,7 @@ rotate_log() {
|
|
|
29
29
|
|
|
30
30
|
# --- Stale Lock Recovery ---
|
|
31
31
|
|
|
32
|
-
# Portable mtime in epoch seconds (same pattern as stop-update-memory
|
|
32
|
+
# Portable mtime in epoch seconds (same pattern as stop-update-memory:35-39)
|
|
33
33
|
get_mtime() {
|
|
34
34
|
if stat --version &>/dev/null 2>&1; then
|
|
35
35
|
stat -c %Y "$1"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
# Ensures .memory/ exists and .gitignore entries are configured.
|
|
3
3
|
# Called from stop and pre-compact hooks. Idempotent, ~1μs after first run.
|
|
4
|
-
# Usage: source ensure-memory-gitignore
|
|
4
|
+
# Usage: source ensure-memory-gitignore "$CWD"
|
|
5
5
|
|
|
6
6
|
_MEMORY_DIR="$1/.memory"
|
|
7
7
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
# has something to inject after compaction.
|
|
7
7
|
# PreCompact hooks cannot block compaction — this is informational only.
|
|
8
8
|
|
|
9
|
-
set -
|
|
9
|
+
set -e
|
|
10
10
|
|
|
11
11
|
# jq is required to parse hook input JSON — silently no-op if missing
|
|
12
12
|
if ! command -v jq &>/dev/null; then exit 0; fi
|
|
@@ -19,7 +19,7 @@ if [ -z "$CWD" ]; then
|
|
|
19
19
|
fi
|
|
20
20
|
|
|
21
21
|
# Auto-create .memory/ and ensure .gitignore entries (idempotent after first run)
|
|
22
|
-
source "$(cd "$(dirname "$0")" && pwd)/ensure-memory-gitignore
|
|
22
|
+
source "$(cd "$(dirname "$0")" && pwd)/ensure-memory-gitignore" "$CWD" || exit 0
|
|
23
23
|
|
|
24
24
|
BACKUP_FILE="$CWD/.memory/backup.json"
|
|
25
25
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
: << 'CMDBLOCK'
|
|
2
|
+
@echo off
|
|
3
|
+
setlocal enabledelayedexpansion
|
|
4
|
+
set "SCRIPT_DIR=%~dp0"
|
|
5
|
+
set "HOOK_NAME=%~1"
|
|
6
|
+
shift
|
|
7
|
+
REM Try standard Git for Windows locations, then PATH
|
|
8
|
+
set "BASH_EXE="
|
|
9
|
+
if exist "C:\Program Files\Git\bin\bash.exe" set "BASH_EXE=C:\Program Files\Git\bin\bash.exe"
|
|
10
|
+
if not defined BASH_EXE if exist "C:\Program Files (x86)\Git\bin\bash.exe" set "BASH_EXE=C:\Program Files (x86)\Git\bin\bash.exe"
|
|
11
|
+
if not defined BASH_EXE (
|
|
12
|
+
where bash >nul 2>&1 && set "BASH_EXE=bash"
|
|
13
|
+
)
|
|
14
|
+
if defined BASH_EXE (
|
|
15
|
+
"%BASH_EXE%" "%SCRIPT_DIR%%HOOK_NAME%" %* & exit /b !errorlevel!
|
|
16
|
+
)
|
|
17
|
+
echo Warning: bash not found, DevFlow hooks require bash >&2
|
|
18
|
+
exit /b 0
|
|
19
|
+
CMDBLOCK
|
|
20
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
21
|
+
HOOK_NAME="$1"
|
|
22
|
+
shift
|
|
23
|
+
exec bash "$SCRIPT_DIR/${HOOK_NAME}" "$@"
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# SessionStart Hook
|
|
4
|
+
# Injects working memory AND ambient skill content as additionalContext.
|
|
5
|
+
# Memory: restores .memory/WORKING-MEMORY.md + patterns + git state + compact recovery.
|
|
6
|
+
# Ambient: injects ambient-router SKILL.md so Claude has it in context (no Read call needed).
|
|
7
|
+
# Either section can fire independently — ambient works even without memory files.
|
|
8
|
+
|
|
9
|
+
set -e
|
|
10
|
+
|
|
11
|
+
# jq is required to parse hook input JSON — silently no-op if missing
|
|
12
|
+
if ! command -v jq &>/dev/null; then exit 0; fi
|
|
13
|
+
|
|
14
|
+
INPUT=$(cat)
|
|
15
|
+
|
|
16
|
+
CWD=$(echo "$INPUT" | jq -r '.cwd // ""' 2>/dev/null)
|
|
17
|
+
if [ -z "$CWD" ]; then
|
|
18
|
+
exit 0
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
CONTEXT=""
|
|
22
|
+
|
|
23
|
+
# --- Section 1: Working Memory ---
|
|
24
|
+
|
|
25
|
+
MEMORY_FILE="$CWD/.memory/WORKING-MEMORY.md"
|
|
26
|
+
|
|
27
|
+
if [ -f "$MEMORY_FILE" ]; then
|
|
28
|
+
MEMORY_CONTENT=$(cat "$MEMORY_FILE")
|
|
29
|
+
|
|
30
|
+
# Read accumulated patterns if they exist
|
|
31
|
+
PATTERNS_FILE="$CWD/.memory/PROJECT-PATTERNS.md"
|
|
32
|
+
PATTERNS_CONTENT=""
|
|
33
|
+
if [ -f "$PATTERNS_FILE" ]; then
|
|
34
|
+
PATTERNS_CONTENT=$(cat "$PATTERNS_FILE")
|
|
35
|
+
fi
|
|
36
|
+
|
|
37
|
+
# Compute staleness warning
|
|
38
|
+
if stat --version &>/dev/null 2>&1; then
|
|
39
|
+
FILE_MTIME=$(stat -c %Y "$MEMORY_FILE")
|
|
40
|
+
else
|
|
41
|
+
FILE_MTIME=$(stat -f %m "$MEMORY_FILE")
|
|
42
|
+
fi
|
|
43
|
+
NOW=$(date +%s)
|
|
44
|
+
AGE=$(( NOW - FILE_MTIME ))
|
|
45
|
+
|
|
46
|
+
# Check for pre-compact memory snapshot (compaction recovery)
|
|
47
|
+
BACKUP_FILE="$CWD/.memory/backup.json"
|
|
48
|
+
COMPACT_NOTE=""
|
|
49
|
+
if [ -f "$BACKUP_FILE" ]; then
|
|
50
|
+
BACKUP_MEMORY=$(jq -r '.memory_snapshot // ""' "$BACKUP_FILE" 2>/dev/null)
|
|
51
|
+
if [ -n "$BACKUP_MEMORY" ]; then
|
|
52
|
+
BACKUP_TS=$(jq -r '.timestamp // ""' "$BACKUP_FILE" 2>/dev/null)
|
|
53
|
+
BACKUP_EPOCH=0
|
|
54
|
+
if [ -n "$BACKUP_TS" ]; then
|
|
55
|
+
BACKUP_EPOCH=$(date -j -f "%Y-%m-%dT%H:%M:%SZ" "$BACKUP_TS" +%s 2>/dev/null \
|
|
56
|
+
|| date -d "$BACKUP_TS" +%s 2>/dev/null \
|
|
57
|
+
|| echo "0")
|
|
58
|
+
fi
|
|
59
|
+
if [ "$BACKUP_EPOCH" -gt "$FILE_MTIME" ]; then
|
|
60
|
+
COMPACT_NOTE="
|
|
61
|
+
--- PRE-COMPACT SNAPSHOT ($BACKUP_TS) ---
|
|
62
|
+
Context was compacted. This snapshot may contain decisions or progress not yet in working memory.
|
|
63
|
+
|
|
64
|
+
$BACKUP_MEMORY
|
|
65
|
+
"
|
|
66
|
+
fi
|
|
67
|
+
fi
|
|
68
|
+
fi
|
|
69
|
+
|
|
70
|
+
STALE_WARNING=""
|
|
71
|
+
if [ "$AGE" -gt 3600 ]; then
|
|
72
|
+
HOURS=$(( AGE / 3600 ))
|
|
73
|
+
STALE_WARNING="⚠ This working memory is ${HOURS}h old. Verify before relying on it.
|
|
74
|
+
|
|
75
|
+
"
|
|
76
|
+
fi
|
|
77
|
+
|
|
78
|
+
# Capture fresh git state
|
|
79
|
+
GIT_BRANCH=""
|
|
80
|
+
GIT_STATUS=""
|
|
81
|
+
GIT_LOG=""
|
|
82
|
+
|
|
83
|
+
if cd "$CWD" 2>/dev/null && git rev-parse --git-dir >/dev/null 2>&1; then
|
|
84
|
+
GIT_BRANCH=$(git branch --show-current 2>/dev/null || echo "unknown")
|
|
85
|
+
GIT_STATUS=$(git status --porcelain 2>/dev/null | head -20)
|
|
86
|
+
GIT_LOG=$(git log --oneline -5 2>/dev/null || echo "")
|
|
87
|
+
fi
|
|
88
|
+
|
|
89
|
+
# Build memory context
|
|
90
|
+
CONTEXT="${STALE_WARNING}--- WORKING MEMORY (from previous session) ---
|
|
91
|
+
|
|
92
|
+
${MEMORY_CONTENT}"
|
|
93
|
+
|
|
94
|
+
# Insert accumulated patterns between working memory and git state
|
|
95
|
+
if [ -n "$PATTERNS_CONTENT" ]; then
|
|
96
|
+
CONTEXT="${CONTEXT}
|
|
97
|
+
|
|
98
|
+
--- PROJECT PATTERNS (accumulated) ---
|
|
99
|
+
|
|
100
|
+
${PATTERNS_CONTENT}"
|
|
101
|
+
fi
|
|
102
|
+
|
|
103
|
+
CONTEXT="${CONTEXT}
|
|
104
|
+
|
|
105
|
+
--- CURRENT GIT STATE ---
|
|
106
|
+
Branch: ${GIT_BRANCH}
|
|
107
|
+
Recent commits:
|
|
108
|
+
${GIT_LOG}"
|
|
109
|
+
|
|
110
|
+
if [ -n "$GIT_STATUS" ]; then
|
|
111
|
+
CONTEXT="${CONTEXT}
|
|
112
|
+
Uncommitted changes:
|
|
113
|
+
${GIT_STATUS}"
|
|
114
|
+
fi
|
|
115
|
+
|
|
116
|
+
if [ -n "$COMPACT_NOTE" ]; then
|
|
117
|
+
CONTEXT="${CONTEXT}
|
|
118
|
+
${COMPACT_NOTE}"
|
|
119
|
+
fi
|
|
120
|
+
fi
|
|
121
|
+
|
|
122
|
+
# --- Section 2: Ambient Skill Injection ---
|
|
123
|
+
|
|
124
|
+
# Inject ambient-router SKILL.md directly into context so Claude doesn't need a Read call.
|
|
125
|
+
# Only injects when ambient mode is enabled (UserPromptSubmit hook present in settings).
|
|
126
|
+
AMBIENT_SKILL_PATH="$HOME/.claude/skills/ambient-router/SKILL.md"
|
|
127
|
+
[ ! -f "$AMBIENT_SKILL_PATH" ] && AMBIENT_SKILL_PATH="$CWD/.claude/skills/ambient-router/SKILL.md"
|
|
128
|
+
|
|
129
|
+
SETTINGS_FILE="$HOME/.claude/settings.json"
|
|
130
|
+
if [ -f "$AMBIENT_SKILL_PATH" ] && [ -f "$SETTINGS_FILE" ] && grep -q "ambient-prompt" "$SETTINGS_FILE" 2>/dev/null; then
|
|
131
|
+
AMBIENT_SKILL_CONTENT=$(cat "$AMBIENT_SKILL_PATH")
|
|
132
|
+
CONTEXT="${CONTEXT}
|
|
133
|
+
|
|
134
|
+
--- AMBIENT ROUTER (auto-loaded) ---
|
|
135
|
+
${AMBIENT_SKILL_CONTENT}"
|
|
136
|
+
fi
|
|
137
|
+
|
|
138
|
+
# --- Output ---
|
|
139
|
+
|
|
140
|
+
# Only output if we have something to inject
|
|
141
|
+
if [ -z "$CONTEXT" ]; then
|
|
142
|
+
exit 0
|
|
143
|
+
fi
|
|
144
|
+
|
|
145
|
+
# Output as additionalContext JSON envelope (Claude sees it as system context, not user-visible)
|
|
146
|
+
jq -n --arg ctx "$CONTEXT" '{
|
|
147
|
+
"hookSpecificOutput": {
|
|
148
|
+
"hookEventName": "SessionStart",
|
|
149
|
+
"additionalContext": $ctx
|
|
150
|
+
}
|
|
151
|
+
}'
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
# The session ends immediately — no visible edit in the TUI.
|
|
6
6
|
# On failure: does nothing (stale memory is better than fake data).
|
|
7
7
|
|
|
8
|
-
set -
|
|
8
|
+
set -e
|
|
9
9
|
|
|
10
10
|
# Break feedback loop: background updater's headless session triggers stop hook on exit.
|
|
11
|
-
# DEVFLOW_BG_UPDATER is set by background-memory-update
|
|
11
|
+
# DEVFLOW_BG_UPDATER is set by background-memory-update before invoking claude.
|
|
12
12
|
if [ "${DEVFLOW_BG_UPDATER:-}" = "1" ]; then exit 0; fi
|
|
13
13
|
|
|
14
14
|
# jq is required to parse hook input JSON — silently no-op if missing
|
|
@@ -24,7 +24,7 @@ fi
|
|
|
24
24
|
|
|
25
25
|
# Auto-create .memory/ and ensure .gitignore entries (idempotent after first run)
|
|
26
26
|
SCRIPT_DIR_EARLY="$(cd "$(dirname "$0")" && pwd)"
|
|
27
|
-
source "$SCRIPT_DIR_EARLY/ensure-memory-gitignore
|
|
27
|
+
source "$SCRIPT_DIR_EARLY/ensure-memory-gitignore" "$CWD" || exit 0
|
|
28
28
|
|
|
29
29
|
# Logging (shared log file with background updater; [stop-hook] prefix distinguishes)
|
|
30
30
|
MEMORY_FILE="$CWD/.memory/WORKING-MEMORY.md"
|
|
@@ -65,7 +65,7 @@ fi
|
|
|
65
65
|
|
|
66
66
|
# Resolve the background updater script (same directory as this hook)
|
|
67
67
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
68
|
-
UPDATER="$SCRIPT_DIR/background-memory-update
|
|
68
|
+
UPDATER="$SCRIPT_DIR/background-memory-update"
|
|
69
69
|
if [ ! -x "$UPDATER" ]; then
|
|
70
70
|
log "Skipped: updater not found/not executable at $UPDATER"
|
|
71
71
|
exit 0
|
package/shared/agents/coder.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: Coder
|
|
3
3
|
description: Autonomous task implementation on feature branch. Implements, tests, and commits.
|
|
4
4
|
model: inherit
|
|
5
|
-
skills: core-patterns, git-safety, implementation-patterns, git-workflow,
|
|
5
|
+
skills: core-patterns, git-safety, implementation-patterns, git-workflow, test-patterns, input-validation
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Coder Agent
|
|
@@ -33,11 +33,16 @@ You receive from orchestrator:
|
|
|
33
33
|
|
|
34
34
|
2. **Reference handoff** (if PRIOR_PHASE_SUMMARY provided): Use summary to validate your understanding of prior work, not as the sole source of truth. The actual code is authoritative.
|
|
35
35
|
|
|
36
|
-
3. **Load domain skills**: Based on DOMAIN hint,
|
|
37
|
-
- `backend
|
|
38
|
-
- `
|
|
39
|
-
- `
|
|
40
|
-
- `
|
|
36
|
+
3. **Load domain skills**: Based on DOMAIN hint and files in scope, dynamically load relevant language/ecosystem skills by reading their SKILL.md. Only load skills that are installed:
|
|
37
|
+
- `backend` (TypeScript): Read `~/.claude/skills/typescript/SKILL.md`, `~/.claude/skills/input-validation/SKILL.md`
|
|
38
|
+
- `backend` (Go): Read `~/.claude/skills/go/SKILL.md`
|
|
39
|
+
- `backend` (Java): Read `~/.claude/skills/java/SKILL.md`
|
|
40
|
+
- `backend` (Python): Read `~/.claude/skills/python/SKILL.md`
|
|
41
|
+
- `backend` (Rust): Read `~/.claude/skills/rust/SKILL.md`
|
|
42
|
+
- `frontend`: Read `~/.claude/skills/react/SKILL.md`, `~/.claude/skills/typescript/SKILL.md`, `~/.claude/skills/accessibility/SKILL.md`, `~/.claude/skills/frontend-design/SKILL.md`
|
|
43
|
+
- `tests`: Read `~/.claude/skills/test-patterns/SKILL.md`, `~/.claude/skills/typescript/SKILL.md`
|
|
44
|
+
- `fullstack`: Combine backend + frontend skills
|
|
45
|
+
- If a Read fails (skill not installed), skip it silently and continue.
|
|
41
46
|
|
|
42
47
|
4. **Implement the plan**: Work through execution steps systematically, creating and modifying files. Follow existing patterns. Type everything. Use Result types if codebase uses them.
|
|
43
48
|
|
|
@@ -34,6 +34,10 @@ The orchestrator provides:
|
|
|
34
34
|
| `react` | `~/.claude/skills/react/SKILL.md` |
|
|
35
35
|
| `accessibility` | `~/.claude/skills/accessibility/SKILL.md` |
|
|
36
36
|
| `frontend-design` | `~/.claude/skills/frontend-design/SKILL.md` |
|
|
37
|
+
| `go` | `~/.claude/skills/go/SKILL.md` |
|
|
38
|
+
| `java` | `~/.claude/skills/java/SKILL.md` |
|
|
39
|
+
| `python` | `~/.claude/skills/python/SKILL.md` |
|
|
40
|
+
| `rust` | `~/.claude/skills/rust/SKILL.md` |
|
|
37
41
|
|
|
38
42
|
## Responsibilities
|
|
39
43
|
|
|
@@ -117,3 +121,7 @@ Report format for `{output_path}`:
|
|
|
117
121
|
| react | If .tsx/.jsx files changed |
|
|
118
122
|
| accessibility | If .tsx/.jsx files changed |
|
|
119
123
|
| frontend-design | If .tsx/.jsx/.css/.scss files changed |
|
|
124
|
+
| go | If .go files changed |
|
|
125
|
+
| java | If .java files changed |
|
|
126
|
+
| python | If .py files changed |
|
|
127
|
+
| rust | If .rs files changed |
|
|
@@ -36,7 +36,7 @@ Determine what the user is trying to do from their prompt.
|
|
|
36
36
|
| **EXPLORE** | "what is", "where is", "find", "show me", "explain", "how does" | "where is the config?", "explain this function" |
|
|
37
37
|
| **CHAT** | greetings, meta-questions, confirmations, short responses | "thanks", "yes", "what can you do?" |
|
|
38
38
|
|
|
39
|
-
**Ambiguous prompts:** Default to the lowest-overhead classification. "Update the README" → BUILD/
|
|
39
|
+
**Ambiguous prompts:** Default to the lowest-overhead classification. "Update the README" → BUILD/GUIDED. Git operations like "commit this" → QUICK.
|
|
40
40
|
|
|
41
41
|
## Step 2: Classify Depth
|
|
42
42
|
|
|
@@ -45,16 +45,16 @@ Determine how much enforcement the prompt warrants.
|
|
|
45
45
|
| Depth | Criteria | Action |
|
|
46
46
|
|-------|----------|--------|
|
|
47
47
|
| **QUICK** | CHAT intent. EXPLORE with no analytical depth ("where is X?"). Git/devops operations (commit, push, merge, branch, pr, deploy, reinstall). Single-word continuations. | Respond normally. Zero overhead. Do not state classification. |
|
|
48
|
-
| **
|
|
49
|
-
| **
|
|
48
|
+
| **GUIDED** | BUILD/DEBUG/REVIEW/PLAN intent (any word count). EXPLORE with analytical depth ("analyze our X", "discuss how Y works"). | Read and apply 2-3 relevant skills from the selection matrix below. State classification briefly. |
|
|
49
|
+
| **ELEVATE** | Multi-file architectural change, system-wide scope, > 5 files. Detailed implementation plan (100+ words with plan structure). | Respond at best effort + recommend: "This looks like it would benefit from `/implement` for full lifecycle management." |
|
|
50
50
|
|
|
51
|
-
## Step 3: Select Skills (
|
|
51
|
+
## Step 3: Select Skills (GUIDED depth only)
|
|
52
52
|
|
|
53
53
|
Based on classified intent, read the following skills to inform your response.
|
|
54
54
|
|
|
55
55
|
| Intent | Primary Skills | Secondary (if file type matches) |
|
|
56
56
|
|--------|---------------|----------------------------------|
|
|
57
|
-
| **BUILD** | test-driven-development, implementation-patterns | typescript (.ts), react (.tsx/.jsx), frontend-design (CSS/UI), input-validation (forms/API), security-patterns (auth/crypto) |
|
|
57
|
+
| **BUILD** | test-driven-development, implementation-patterns | typescript (.ts), react (.tsx/.jsx), go (.go), java (.java), python (.py), rust (.rs), frontend-design (CSS/UI), input-validation (forms/API), security-patterns (auth/crypto) |
|
|
58
58
|
| **DEBUG** | test-patterns, core-patterns | git-safety (if git operations involved) |
|
|
59
59
|
| **REVIEW** | self-review, core-patterns | test-patterns |
|
|
60
60
|
| **PLAN** | implementation-patterns | core-patterns |
|
|
@@ -65,19 +65,26 @@ See `references/skill-catalog.md` for the full skill-to-intent mapping with file
|
|
|
65
65
|
|
|
66
66
|
## Step 4: Apply
|
|
67
67
|
|
|
68
|
+
<IMPORTANT>
|
|
69
|
+
When classification is GUIDED or ELEVATE, skill application is NON-NEGOTIABLE.
|
|
70
|
+
Do not rationalize skipping skills. Do not respond without loading them first.
|
|
71
|
+
If test-driven-development is selected, you MUST write the failing test before ANY production code.
|
|
72
|
+
</IMPORTANT>
|
|
73
|
+
|
|
68
74
|
- **QUICK:** Respond directly. No preamble, no classification statement.
|
|
69
|
-
- **
|
|
70
|
-
- **
|
|
75
|
+
- **GUIDED:** State classification briefly: `Ambient: BUILD/GUIDED. Loading: test-driven-development, implementation-patterns.` Then read the selected skills and apply their patterns. No exceptions.
|
|
76
|
+
- **ELEVATE:** Respond with your best effort, then append: `> This task spans multiple files/systems. Consider \`/implement\` for full lifecycle.`
|
|
71
77
|
|
|
72
78
|
---
|
|
73
79
|
|
|
74
80
|
## Transparency Rules
|
|
75
81
|
|
|
76
82
|
1. **QUICK → silent.** No classification output.
|
|
77
|
-
2. **
|
|
78
|
-
3. **
|
|
83
|
+
2. **GUIDED → brief statement + full skill enforcement.** One line: intent, depth, skills loaded. Then follow every skill requirement without shortcuts.
|
|
84
|
+
3. **ELEVATE → recommendation.** Best-effort response + workflow nudge.
|
|
79
85
|
4. **Never lie about classification.** If uncertain, say so.
|
|
80
86
|
5. **Never over-classify.** When in doubt, go one tier lower.
|
|
87
|
+
6. **Never under-apply.** Rationalization is the enemy of quality. If a skill requires a step, do the step.
|
|
81
88
|
|
|
82
89
|
## Edge Cases
|
|
83
90
|
|
|
@@ -4,7 +4,7 @@ Full mapping of DevFlow skills to ambient intents and file-type triggers. The am
|
|
|
4
4
|
|
|
5
5
|
## Skills Available for Ambient Loading
|
|
6
6
|
|
|
7
|
-
These skills may be loaded during
|
|
7
|
+
These skills may be loaded during GUIDED-depth ambient routing.
|
|
8
8
|
|
|
9
9
|
### BUILD Intent
|
|
10
10
|
|
|
@@ -16,6 +16,10 @@ These skills may be loaded during STANDARD-depth ambient routing.
|
|
|
16
16
|
| react | React components in scope | `*.tsx`, `*.jsx` |
|
|
17
17
|
| frontend-design | UI/styling work | `*.css`, `*.scss`, `*.tsx` with styling keywords |
|
|
18
18
|
| input-validation | Forms, APIs, user input | Files with form/input/validation keywords |
|
|
19
|
+
| go | Go files in scope | `*.go` |
|
|
20
|
+
| java | Java files in scope | `*.java` |
|
|
21
|
+
| python | Python files in scope | `*.py` |
|
|
22
|
+
| rust | Rust files in scope | `*.rs` |
|
|
19
23
|
| security-patterns | Auth, crypto, secrets | Files with auth/token/crypto/password keywords |
|
|
20
24
|
|
|
21
25
|
### DEBUG Intent
|
|
@@ -61,4 +65,4 @@ These skills are loaded only by explicit DevFlow commands (primarily `/code-revi
|
|
|
61
65
|
- **Maximum 3 skills** per ambient response (primary + up to 2 secondary)
|
|
62
66
|
- **Primary skills** are always loaded for the classified intent
|
|
63
67
|
- **Secondary skills** are loaded only when file patterns match conversation context
|
|
64
|
-
- If more than 3 skills seem relevant, this is an
|
|
68
|
+
- If more than 3 skills seem relevant, this is an ELEVATE signal
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: architecture-patterns
|
|
3
|
-
description:
|
|
3
|
+
description: This skill should be used when reviewing code for SOLID violations, tight coupling, or layering issues.
|
|
4
4
|
user-invocable: false
|
|
5
5
|
allowed-tools: Read, Grep, Glob
|
|
6
6
|
---
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: complexity-patterns
|
|
3
|
-
description:
|
|
3
|
+
description: This skill should be used when reviewing code for high cyclomatic complexity, deep nesting, or long functions.
|
|
4
4
|
user-invocable: false
|
|
5
5
|
allowed-tools: Read, Grep, Glob
|
|
6
6
|
---
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: consistency-patterns
|
|
3
|
-
description:
|
|
3
|
+
description: This skill should be used when reviewing code for naming convention violations, pattern deviations, or inconsistent API styles.
|
|
4
4
|
user-invocable: false
|
|
5
5
|
allowed-tools: Read, Grep, Glob
|
|
6
6
|
---
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: database-patterns
|
|
3
|
-
description:
|
|
3
|
+
description: This skill should be used when reviewing database queries, migrations, indexes, or schema changes.
|
|
4
4
|
user-invocable: false
|
|
5
5
|
allowed-tools: Read, Grep, Glob
|
|
6
6
|
---
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: dependencies-patterns
|
|
3
|
-
description:
|
|
3
|
+
description: This skill should be used when reviewing dependency changes, lock files, or package additions.
|
|
4
4
|
user-invocable: false
|
|
5
5
|
allowed-tools: Read, Grep, Glob
|
|
6
6
|
---
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: documentation-patterns
|
|
3
|
-
description:
|
|
3
|
+
description: This skill should be used when reviewing for documentation drift, missing API docs, or stale comments.
|
|
4
4
|
user-invocable: false
|
|
5
5
|
allowed-tools: Read, Grep, Glob
|
|
6
6
|
---
|