@mediadatafusion/pi-workflow-suite 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/CONTRIBUTING.md +9 -0
  3. package/LICENSE.md +201 -0
  4. package/NOTICE +6 -0
  5. package/README.md +1208 -0
  6. package/SECURITY.md +7 -0
  7. package/SUPPORT.md +9 -0
  8. package/TRADEMARKS.md +14 -0
  9. package/VERSION +1 -0
  10. package/agents/codebase-research.md +42 -0
  11. package/agents/general-worker.md +26 -0
  12. package/agents/implementation-planning.md +46 -0
  13. package/agents/quality-validation.md +43 -0
  14. package/agents/workflow-orchestrator.md +44 -0
  15. package/config/prompts/execute-approved-plan.md +43 -0
  16. package/config/prompts/mission-checkpoint.md +26 -0
  17. package/config/prompts/mission-final-validation.md +21 -0
  18. package/config/prompts/mission-plan.md +129 -0
  19. package/config/prompts/mission-repair.md +33 -0
  20. package/config/prompts/mission-run.md +37 -0
  21. package/config/prompts/validate-approved-plan.md +42 -0
  22. package/config/prompts/workflow-plan-prompt.md +93 -0
  23. package/config/prompts/workflow-repair.md +20 -0
  24. package/config/prompts/workflow-summary.md +23 -0
  25. package/config/workflow-settings.example.json +335 -0
  26. package/docs/assets/mediadatafusion-logo.png +0 -0
  27. package/docs/assets/pi-workflow-suite-card.png +0 -0
  28. package/docs/assets/pi-workflow-suite-header.png +0 -0
  29. package/docs/assets/pi-workflow-suite-video-thumb.png +0 -0
  30. package/docs/assets/readme-link-commands.svg +10 -0
  31. package/docs/assets/readme-link-install.svg +10 -0
  32. package/docs/assets/readme-link-quick-start.svg +10 -0
  33. package/docs/assets/readme-link-settings.svg +10 -0
  34. package/extensions/subagent/agents.ts +149 -0
  35. package/extensions/subagent/index.ts +1136 -0
  36. package/extensions/subagent/runner.ts +291 -0
  37. package/extensions/workflow-model-router.ts +1485 -0
  38. package/extensions/workflow-modes.ts +14778 -0
  39. package/extensions/workflow-parsers.ts +212 -0
  40. package/extensions/workflow-settings-capabilities.ts +282 -0
  41. package/extensions/workflow-state.ts +978 -0
  42. package/extensions/workflow-subagent-policy.ts +180 -0
  43. package/extensions/workflow-summary.ts +381 -0
  44. package/extensions/workflow-tool-guard.ts +302 -0
  45. package/extensions/workflow-validation-classifier.ts +102 -0
  46. package/extensions/workflow-web-tools.ts +356 -0
  47. package/package.json +1 -0
  48. package/scripts/audit-live.sh +69 -0
  49. package/scripts/audit-settings.sh +136 -0
  50. package/scripts/backup-live.sh +63 -0
  51. package/scripts/bootstrap-project.sh +220 -0
  52. package/scripts/install-to-live.sh +87 -0
  53. package/scripts/quarantine-live-junk.sh +69 -0
  54. package/scripts/verify-live.sh +128 -0
  55. package/skills/codebase-discovery/SKILL.md +20 -0
  56. package/skills/find-skills/SKILL.md +155 -0
  57. package/skills/git-safe-summary/SKILL.md +20 -0
  58. package/skills/implementation-planning/SKILL.md +20 -0
  59. package/skills/project-rules-audit/SKILL.md +20 -0
  60. package/skills/safe-execution/SKILL.md +20 -0
  61. package/skills/validation-review/SKILL.md +20 -0
@@ -0,0 +1,220 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
5
+ APPLY=0
6
+ ALLOW_HOME=0
7
+ CREATE_WORKFLOW_SETTINGS=1
8
+ CREATE_APPEND_SYSTEM=1
9
+ UPDATE_GITIGNORE=1
10
+ PACKAGE_SOURCE=""
11
+ PRESET=""
12
+ WORKFLOW_THEME=""
13
+ TARGET=""
14
+
15
+ usage() {
16
+ cat <<'USAGE'
17
+ Usage: ./scripts/bootstrap-project.sh <project-dir> [options]
18
+
19
+ Dry-run by default. Creates a project Workflow Suite scaffold only with --apply.
20
+ Does not modify the live ~/.pi/agent runtime.
21
+
22
+ Options:
23
+ --apply Write files. Default is dry-run.
24
+ --allow-home Allow targeting $HOME explicitly.
25
+ --no-workflow-settings Do not create .pi/workflow-settings.json.
26
+ --no-append-system Do not create .pi/APPEND_SYSTEM.md.
27
+ --no-gitignore Do not append project .gitignore runtime exclusions.
28
+ --package-source <source> Also create .pi/settings.json with a Pi package reference.
29
+ Example after publish: npm:@mediadatafusion/pi-workflow-suite
30
+ --preset <name> Set presets.activePreset in copied workflow settings.
31
+ --workflow-theme <name> Set ui.workflowTheme in copied workflow settings.
32
+ -h, --help Show help.
33
+
34
+ Current behavior note:
35
+ Workflow Suite settings are global/project scoped, not session-local. Project
36
+ .pi/workflow-settings.json affects sessions launched under that project scope.
37
+ USAGE
38
+ }
39
+
40
+ while [[ $# -gt 0 ]]; do
41
+ case "$1" in
42
+ --apply) APPLY=1; shift ;;
43
+ --allow-home) ALLOW_HOME=1; shift ;;
44
+ --no-workflow-settings) CREATE_WORKFLOW_SETTINGS=0; shift ;;
45
+ --no-append-system) CREATE_APPEND_SYSTEM=0; shift ;;
46
+ --no-gitignore) UPDATE_GITIGNORE=0; shift ;;
47
+ --package-source)
48
+ [[ $# -ge 2 ]] || { printf 'ERROR: --package-source needs a value\n' >&2; exit 2; }
49
+ PACKAGE_SOURCE="$2"; shift 2 ;;
50
+ --preset)
51
+ [[ $# -ge 2 ]] || { printf 'ERROR: --preset needs a value\n' >&2; exit 2; }
52
+ PRESET="$2"; shift 2 ;;
53
+ --workflow-theme)
54
+ [[ $# -ge 2 ]] || { printf 'ERROR: --workflow-theme needs a value\n' >&2; exit 2; }
55
+ WORKFLOW_THEME="$2"; shift 2 ;;
56
+ -h|--help) usage; exit 0 ;;
57
+ --*) printf 'ERROR: unknown option: %s\n' "$1" >&2; usage >&2; exit 2 ;;
58
+ *)
59
+ if [[ -n "$TARGET" ]]; then
60
+ printf 'ERROR: multiple project directories provided: %s and %s\n' "$TARGET" "$1" >&2
61
+ exit 2
62
+ fi
63
+ TARGET="$1"; shift ;;
64
+ esac
65
+ done
66
+
67
+ if [[ -z "$TARGET" ]]; then
68
+ usage >&2
69
+ exit 2
70
+ fi
71
+
72
+ if [[ ! -d "$TARGET" ]]; then
73
+ printf 'ERROR: project directory does not exist: %s\n' "$TARGET" >&2
74
+ exit 2
75
+ fi
76
+
77
+ TARGET="$(cd "$TARGET" && pwd -P)"
78
+ HOME_REAL="$(cd "$HOME" && pwd -P)"
79
+ if [[ "$TARGET" == "$HOME_REAL" && "$ALLOW_HOME" -ne 1 ]]; then
80
+ printf 'ERROR: refusing to target HOME without --allow-home: %s\n' "$TARGET" >&2
81
+ printf 'This avoids confusing home-directory project settings with global ~/.pi/agent state.\n' >&2
82
+ exit 2
83
+ fi
84
+
85
+ PI_DIR="$TARGET/.pi"
86
+ WORKFLOW_FILE="$PI_DIR/workflow-settings.json"
87
+ APPEND_SYSTEM_FILE="$PI_DIR/APPEND_SYSTEM.md"
88
+ PROJECT_SETTINGS_FILE="$PI_DIR/settings.json"
89
+ GITIGNORE_FILE="$TARGET/.gitignore"
90
+ EXAMPLE_WORKFLOW="$REPO_DIR/config/workflow-settings.example.json"
91
+
92
+ printf 'Pi Workflow Suite project bootstrap\n'
93
+ printf 'Mode: %s\n' "$([[ "$APPLY" -eq 1 ]] && printf apply || printf dry-run)"
94
+ printf 'Project: %s\n' "$TARGET"
95
+ printf '\n'
96
+ printf 'Current scope behavior:\n'
97
+ printf ' Pi core project settings: exact cwd .pi/settings.json\n'
98
+ printf ' Workflow Suite project settings: nearest upward .pi/workflow-settings.json\n'
99
+ printf ' Workflow Suite settings are not session-local today.\n'
100
+ printf '\n'
101
+
102
+ planned=0
103
+
104
+ plan_line() {
105
+ printf '%s\n' "$1"
106
+ planned=1
107
+ }
108
+
109
+ if [[ "$CREATE_WORKFLOW_SETTINGS" -eq 1 ]]; then
110
+ if [[ -e "$WORKFLOW_FILE" ]]; then
111
+ printf 'exists, skip: %s\n' "$WORKFLOW_FILE"
112
+ else
113
+ plan_line "create: $WORKFLOW_FILE"
114
+ fi
115
+ fi
116
+
117
+ if [[ "$CREATE_APPEND_SYSTEM" -eq 1 ]]; then
118
+ if [[ -e "$APPEND_SYSTEM_FILE" ]]; then
119
+ printf 'exists, skip: %s\n' "$APPEND_SYSTEM_FILE"
120
+ else
121
+ plan_line "create: $APPEND_SYSTEM_FILE"
122
+ fi
123
+ fi
124
+
125
+ if [[ "$UPDATE_GITIGNORE" -eq 1 ]]; then
126
+ plan_line "ensure runtime exclusions in: $GITIGNORE_FILE"
127
+ fi
128
+
129
+ if [[ -n "$PACKAGE_SOURCE" ]]; then
130
+ if [[ -e "$PROJECT_SETTINGS_FILE" ]]; then
131
+ printf 'exists, skip package reference: %s\n' "$PROJECT_SETTINGS_FILE"
132
+ printf ' Review and edit existing project Pi settings manually if needed.\n'
133
+ else
134
+ plan_line "create package reference: $PROJECT_SETTINGS_FILE -> $PACKAGE_SOURCE"
135
+ fi
136
+ fi
137
+
138
+ if [[ "$planned" -eq 0 ]]; then
139
+ printf 'No changes needed.\n'
140
+ fi
141
+
142
+ if [[ "$APPLY" -ne 1 ]]; then
143
+ printf '\nDry run only. Re-run with --apply to write files.\n'
144
+ exit 0
145
+ fi
146
+
147
+ mkdir -p "$PI_DIR"
148
+
149
+ if [[ "$CREATE_WORKFLOW_SETTINGS" -eq 1 && ! -e "$WORKFLOW_FILE" ]]; then
150
+ if [[ ! -f "$EXAMPLE_WORKFLOW" ]]; then
151
+ printf 'ERROR: missing example workflow settings: %s\n' "$EXAMPLE_WORKFLOW" >&2
152
+ exit 1
153
+ fi
154
+ cp "$EXAMPLE_WORKFLOW" "$WORKFLOW_FILE"
155
+ if [[ -n "$PRESET" || -n "$WORKFLOW_THEME" ]]; then
156
+ node - "$WORKFLOW_FILE" "$PRESET" "$WORKFLOW_THEME" <<'NODE'
157
+ const fs = require('fs');
158
+ const file = process.argv[2];
159
+ const preset = process.argv[3];
160
+ const workflowTheme = process.argv[4];
161
+ const data = JSON.parse(fs.readFileSync(file, 'utf8'));
162
+ if (preset) {
163
+ data.presets = data.presets || {};
164
+ data.presets.activePreset = preset;
165
+ }
166
+ if (workflowTheme) {
167
+ data.ui = data.ui || {};
168
+ data.ui.workflowTheme = workflowTheme;
169
+ }
170
+ fs.writeFileSync(file, JSON.stringify(data, null, 2) + '\n');
171
+ NODE
172
+ fi
173
+ printf 'created: %s\n' "$WORKFLOW_FILE"
174
+ fi
175
+
176
+ if [[ "$CREATE_APPEND_SYSTEM" -eq 1 && ! -e "$APPEND_SYSTEM_FILE" ]]; then
177
+ cat > "$APPEND_SYSTEM_FILE" <<'EOF'
178
+ # Project Workflow Guidance
179
+
180
+ This project may use Pi Workflow Suite for approval-gated planning, execution, validation, and mission workflows.
181
+
182
+ - Prefer `/p <task>` for scoped implementation work.
183
+ - Use `/workflow-settings scope` to verify whether project workflow settings are active.
184
+ - Treat project `AGENTS.md` as the main source of project rules and commands.
185
+ - Do not assume Workflow Suite settings are session-local; project `.pi/workflow-settings.json` applies to sessions launched under this project scope.
186
+ EOF
187
+ printf 'created: %s\n' "$APPEND_SYSTEM_FILE"
188
+ fi
189
+
190
+ if [[ "$UPDATE_GITIGNORE" -eq 1 ]]; then
191
+ touch "$GITIGNORE_FILE"
192
+ if ! grep -qF '# Pi Workflow Suite runtime state' "$GITIGNORE_FILE"; then
193
+ cat >> "$GITIGNORE_FILE" <<'EOF'
194
+
195
+ # Pi Workflow Suite runtime state
196
+ .pi/sessions/
197
+ .pi/workflows/
198
+ .pi/npm/
199
+ .pi/git/
200
+ .pi/*.tmp-*
201
+ EOF
202
+ printf 'updated: %s\n' "$GITIGNORE_FILE"
203
+ else
204
+ printf 'already has Pi Workflow Suite runtime block: %s\n' "$GITIGNORE_FILE"
205
+ fi
206
+ fi
207
+
208
+ if [[ -n "$PACKAGE_SOURCE" && ! -e "$PROJECT_SETTINGS_FILE" ]]; then
209
+ node - "$PROJECT_SETTINGS_FILE" "$PACKAGE_SOURCE" <<'NODE'
210
+ const fs = require('fs');
211
+ const file = process.argv[2];
212
+ const source = process.argv[3];
213
+ const data = { packages: [source] };
214
+ fs.writeFileSync(file, JSON.stringify(data, null, 2) + '\n');
215
+ NODE
216
+ printf 'created: %s\n' "$PROJECT_SETTINGS_FILE"
217
+ fi
218
+
219
+ printf '\nBootstrap complete. Verify with:\n'
220
+ printf ' %s/scripts/audit-settings.sh %s\n' "$REPO_DIR" "$TARGET"
@@ -0,0 +1,87 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
5
+ LIVE_DIR="${PI_AGENT_DIR:-$HOME/.pi/agent}"
6
+
7
+ printf 'Installing from repo mirror into live Pi runtime ~/.pi/agent.\n'
8
+ printf 'Repo mirror: %s\n' "$REPO_DIR"
9
+ printf 'Live runtime: %s\n' "$LIVE_DIR"
10
+ printf 'A live backup will be created before installing files.\n'
11
+
12
+ "$REPO_DIR/scripts/backup-live.sh"
13
+
14
+ is_forbidden_path() {
15
+ local rel="$1"
16
+ case "$rel" in
17
+ auth.json|settings.json|workflow-settings.json|active.json|workflows/*|missions/*|plans/*|sessions/*|logs/*|*.log|*.backup.*|*.broken.*|.env|.env.*|.factory/*|.cursor/*|*.DS_Store|*.tmp)
18
+ return 0
19
+ ;;
20
+ esac
21
+ return 1
22
+ }
23
+
24
+ validate_source_file() {
25
+ local file="$1"
26
+ case "$file" in
27
+ *.json) python3 -m json.tool "$file" >/dev/null ;;
28
+ *.ts|*.md|*.sh) test -s "$file" ;;
29
+ *) test -f "$file" ;;
30
+ esac
31
+ }
32
+
33
+ atomic_install_file() {
34
+ local rel="$1"
35
+ if is_forbidden_path "$rel"; then
36
+ printf 'refusing forbidden install path: %s\n' "$rel" >&2
37
+ exit 1
38
+ fi
39
+ local src="$REPO_DIR/$rel"
40
+ local dst="$LIVE_DIR/$rel"
41
+ if [[ ! -f "$src" ]]; then
42
+ printf 'missing repo file: %s\n' "$src" >&2
43
+ exit 1
44
+ fi
45
+ validate_source_file "$src"
46
+ mkdir -p "$(dirname "$dst")"
47
+ local tmp="$dst.tmp-$$-$(date +%s%N)"
48
+ install -m 0644 "$src" "$tmp"
49
+ validate_source_file "$tmp"
50
+ mv -f "$tmp" "$dst"
51
+ printf 'installed atomically: %s -> %s\n' "$src" "$dst"
52
+ }
53
+
54
+ install_dir() {
55
+ local rel="$1"
56
+ local src_root="$REPO_DIR/$rel"
57
+ if [[ ! -d "$src_root" ]]; then
58
+ printf 'skipping missing optional repo directory: %s\n' "$src_root"
59
+ return 0
60
+ fi
61
+ if find "$src_root" -type l | grep -q .; then
62
+ printf 'refusing to install symlinks from repo directory: %s\n' "$src_root" >&2
63
+ exit 1
64
+ fi
65
+ while IFS= read -r -d '' file; do
66
+ local sub="${file#$REPO_DIR/}"
67
+ if is_forbidden_path "$sub"; then
68
+ continue
69
+ fi
70
+ atomic_install_file "$sub"
71
+ done < <(find "$src_root" -type f \
72
+ ! -name '.DS_Store' \
73
+ ! -name '*.log' \
74
+ ! -name '*.tmp' \
75
+ ! -name '*.backup.*' \
76
+ ! -name '*.broken.*' \
77
+ -print0)
78
+ }
79
+
80
+ atomic_install_file "package.json"
81
+ atomic_install_file "package-lock.json"
82
+ install_dir "extensions"
83
+ install_dir "agents"
84
+ install_dir "skills"
85
+ install_dir "config"
86
+
87
+ printf 'install complete; auth, settings, and workflow state were not touched\n'
@@ -0,0 +1,69 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ LIVE_DIR="${PI_AGENT_DIR:-$HOME/.pi/agent}"
5
+ BACKUP_BASE="${PI_BACKUP_DIR:-$HOME/.pi/agent-emergency-backups}"
6
+ TS="$(date +%Y%m%d-%H%M%S)"
7
+ DEST="$BACKUP_BASE/live-junk-quarantine-$TS"
8
+ APPLY=0
9
+
10
+ if [[ "${1:-}" == "--apply" ]]; then
11
+ APPLY=1
12
+ elif [[ "${1:-}" == "" ]]; then
13
+ APPLY=0
14
+ else
15
+ printf 'usage: %s [--apply]\n' "$0" >&2
16
+ exit 2
17
+ fi
18
+
19
+ printf 'Pi Workflow Suite live junk quarantine\n'
20
+ printf 'Live runtime: %s\n' "$LIVE_DIR"
21
+ printf 'Quarantine destination: %s\n' "$DEST"
22
+ if [[ "$APPLY" -eq 0 ]]; then
23
+ printf 'Mode: dry run. Re-run with --apply to move files.\n'
24
+ else
25
+ printf 'Mode: apply. Files will be moved, not deleted.\n'
26
+ mkdir -p "$DEST"
27
+ fi
28
+
29
+ move_rel() {
30
+ local rel="$1"
31
+ local src="$LIVE_DIR/$rel"
32
+ local dst="$DEST/$rel"
33
+ [[ -e "$src" ]] || return 0
34
+ if [[ "$APPLY" -eq 0 ]]; then
35
+ printf 'would quarantine: %s\n' "$rel"
36
+ return 0
37
+ fi
38
+ mkdir -p "$(dirname "$dst")"
39
+ mv "$src" "$dst"
40
+ printf 'quarantined: %s\n' "$rel"
41
+ }
42
+
43
+ # Stale Git metadata in the live runtime is not required by Pi and should not be
44
+ # mixed with auth, settings, sessions, or workflow state.
45
+ move_rel ".git"
46
+
47
+ # Only move backup/broken/log/Finder debris. Do not move current auth/settings,
48
+ # current workflow state, session JSONL files, mission files, or plan files.
49
+ while IFS= read -r -d '' path; do
50
+ rel="${path#$LIVE_DIR/}"
51
+ case "$rel" in
52
+ auth.json|settings.json|workflow-settings.json|sessions/*.jsonl|workflows/missions/*|workflows/plans/*)
53
+ continue
54
+ ;;
55
+ esac
56
+ move_rel "$rel"
57
+ done < <(find "$LIVE_DIR" -maxdepth 3 \( -name '*.backup.*' -o -name '*.broken.*' -o -name '.DS_Store' -o -name '*.log' \) -print0 2>/dev/null)
58
+
59
+ # Known stale/development directories from earlier manual repair flows. These are
60
+ # quarantined whole only when present. Review the dry-run output first.
61
+ for rel in recovery-snapshots extensions-disabled prompts.disabled docs; do
62
+ move_rel "$rel"
63
+ done
64
+
65
+ if [[ "$APPLY" -eq 0 ]]; then
66
+ printf 'Dry run complete; no files moved.\n'
67
+ else
68
+ printf 'Quarantine complete: %s\n' "$DEST"
69
+ fi
@@ -0,0 +1,128 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ LIVE_DIR="${PI_AGENT_DIR:-$HOME/.pi/agent}"
5
+ printf 'This verifies the local live Pi runtime. GitHub Actions cannot perform this check.\n'
6
+ printf 'Live runtime: %s\n' "$LIVE_DIR"
7
+ missing=0
8
+ warning=0
9
+
10
+ require_file() {
11
+ local rel="$1"
12
+ if [[ -f "$LIVE_DIR/$rel" ]]; then
13
+ printf 'found: %s\n' "$LIVE_DIR/$rel"
14
+ else
15
+ printf 'missing: %s\n' "$LIVE_DIR/$rel" >&2
16
+ missing=1
17
+ fi
18
+ }
19
+
20
+ warn_path() {
21
+ local rel="$1"
22
+ local message="$2"
23
+ if [[ -e "$LIVE_DIR/$rel" ]]; then
24
+ printf 'warning: %s (%s)\n' "$message" "$LIVE_DIR/$rel" >&2
25
+ warning=1
26
+ fi
27
+ }
28
+
29
+ warn_stale_files() {
30
+ local stale
31
+ stale="$(find "$LIVE_DIR" -maxdepth 3 \( -name '*.backup.*' -o -name '*.broken.*' -o -name '.DS_Store' -o -name '*.log' \) -print 2>/dev/null | sort || true)"
32
+ if [[ -n "$stale" ]]; then
33
+ printf 'warning: stale/noisy files found in live runtime; run scripts/audit-live.sh for details\n' >&2
34
+ warning=1
35
+ fi
36
+ }
37
+
38
+ warn_unexpected_loadable_extensions() {
39
+ local expected actual unexpected
40
+ expected="$(cat <<'TEXT'
41
+ extensions/subagent/index.ts
42
+ extensions/workflow-model-router.ts
43
+ extensions/workflow-modes.ts
44
+ extensions/workflow-state.ts
45
+ extensions/workflow-summary.ts
46
+ extensions/workflow-tool-guard.ts
47
+ TEXT
48
+ )"
49
+ actual="$(
50
+ {
51
+ find "$LIVE_DIR/extensions" -maxdepth 1 \( -name '*.ts' -o -name '*.js' \) -type f -print 2>/dev/null || true
52
+ find "$LIVE_DIR/extensions" -mindepth 2 -maxdepth 2 \( -name 'index.ts' -o -name 'index.js' \) -type f -print 2>/dev/null || true
53
+ } | sed "s#^$LIVE_DIR/##" | sort
54
+ )"
55
+ unexpected="$(comm -13 <(printf '%s\n' "$expected" | sort) <(printf '%s\n' "$actual" | sort) || true)"
56
+ if [[ -n "$unexpected" ]]; then
57
+ printf 'warning: unexpected loadable extension candidates found:\n%s\n' "$unexpected" >&2
58
+ warning=1
59
+ fi
60
+ }
61
+
62
+ require_file "extensions/workflow-modes.ts"
63
+ require_file "extensions/workflow-state.ts"
64
+ require_file "extensions/workflow-summary.ts"
65
+ require_file "extensions/workflow-tool-guard.ts"
66
+ require_file "extensions/workflow-model-router.ts"
67
+ require_file "extensions/subagent/index.ts"
68
+ require_file "extensions/subagent/agents.ts"
69
+
70
+ require_file "agents/codebase-research.md"
71
+ require_file "agents/general-worker.md"
72
+ require_file "agents/implementation-planning.md"
73
+ require_file "agents/quality-validation.md"
74
+ require_file "agents/workflow-orchestrator.md"
75
+
76
+ require_file "skills/codebase-discovery/SKILL.md"
77
+ require_file "skills/find-skills/SKILL.md"
78
+ require_file "skills/git-safe-summary/SKILL.md"
79
+ require_file "skills/implementation-planning/SKILL.md"
80
+ require_file "skills/project-rules-audit/SKILL.md"
81
+ require_file "skills/safe-execution/SKILL.md"
82
+ require_file "skills/validation-review/SKILL.md"
83
+
84
+ require_file "config/prompts/execute-approved-plan.md"
85
+ require_file "config/prompts/validate-approved-plan.md"
86
+ require_file "config/prompts/workflow-plan-prompt.md"
87
+ require_file "config/prompts/workflow-summary.md"
88
+ require_file "config/prompts/workflow-repair.md"
89
+ require_file "config/prompts/mission-plan.md"
90
+ require_file "config/prompts/mission-run.md"
91
+ require_file "config/prompts/mission-repair.md"
92
+ require_file "config/prompts/mission-checkpoint.md"
93
+ require_file "config/prompts/mission-final-validation.md"
94
+
95
+ require_file "config/workflow-settings.example.json"
96
+
97
+ warn_path ".git" "top-level .git should not be inside the live Pi runtime"
98
+ warn_path "recovery-snapshots" "stale recovery snapshot directory should be quarantined outside active runtime"
99
+ warn_path "extensions-disabled" "disabled extension directory should be reviewed/quarantined outside active runtime"
100
+ warn_path "prompts.disabled" "disabled prompt directory should be reviewed/quarantined outside active runtime"
101
+ warn_path "docs" "repo docs should not be mixed into active live runtime unless intentionally used"
102
+ warn_stale_files
103
+ warn_unexpected_loadable_extensions
104
+
105
+ if [[ "$missing" -ne 0 ]]; then
106
+ exit 1
107
+ fi
108
+
109
+ if [[ "$warning" -ne 0 ]]; then
110
+ printf 'live runtime warnings detected; required files are present, but cleanup/audit is recommended\n' >&2
111
+ fi
112
+
113
+ printf '\nRunning basic Pi load check: pi --help\n'
114
+ pi --help >/dev/null
115
+ printf 'basic load check passed\n'
116
+
117
+ cat <<'TEXT'
118
+
119
+ Manual runtime tests still required:
120
+ - pi
121
+ - /workflow status
122
+ - /workflow settings Show Current Settings
123
+ - /p
124
+ - /p <task>
125
+ - approval action
126
+
127
+ Note: pi --help is only a basic load check, not full workflow verification.
128
+ TEXT
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: codebase-discovery
3
+ description: Inspect project structure, frameworks, package managers, entry points, configs, and architecture before implementation planning. Use when planning requires understanding an unfamiliar codebase.
4
+ ---
5
+
6
+ # Codebase Discovery
7
+
8
+ Use read-only inspection only. Identify package manager, framework, entry points, key configs, tests, build scripts, and relevant existing patterns. Summarize findings before proposing changes.
9
+
10
+ Mermaid diagrams are rendered by Workflow Suite in a uniform dark-mode visual style. For user-facing workflows, export/share paths, request lifecycles, architecture, data flow, multi-step sequences, state transitions, dependencies, validation flow, or implementation phases, include a meaningful Mermaid diagram plus concise prose unless the user requested prose only or the response is trivial. Use concise labels and the right diagram type; do not hardcode random style/classDef/light-theme overrides unless the user explicitly asks.
11
+ ## Professional Constraints
12
+
13
+ - Check project instructions before recommendations when the task touches code, docs, settings, or workflow behavior.
14
+ - Keep scope bounded to the user request and approved workflow phase.
15
+ - Do not print secrets, credentials, tokens, auth/session values, private runtime state, or `.env` contents.
16
+ - Avoid destructive commands, deploys, pushes, resets, cleans, database mutations, and dependency installs unless explicitly approved outside this workflow.
17
+ - Prefer concise, evidence-based output with exact files or commands reviewed.
18
+ ## Skills vs Agents
19
+
20
+ Use this skill as in-process guidance for the current model. Use a sub-agent only when the task benefits from an isolated context window, parallel read-only research, forced preflight, or independent validation. Do not use both this skill and a same-purpose agent for the same narrow job unless the workflow or user explicitly requires it.
@@ -0,0 +1,155 @@
1
+ ---
2
+ name: find-skills
3
+ description: Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.
4
+ ---
5
+
6
+ # Find Skills
7
+
8
+ This skill helps you discover and install skills from the open agent skills ecosystem.
9
+
10
+ ## When to Use This Skill
11
+
12
+ Use this skill when the user:
13
+
14
+ - Asks "how do I do X" where X might be a common task with an existing skill
15
+ - Says "find a skill for X" or "is there a skill for X"
16
+ - Asks "can you do X" where X is a specialized capability
17
+ - Expresses interest in extending agent capabilities
18
+ - Wants to search for tools, templates, or workflows
19
+ - Mentions they wish they had help with a specific domain (design, testing, deployment, etc.)
20
+
21
+ ## What is the Skills CLI?
22
+
23
+ The Skills CLI (`npx skills`) is the package manager for the open agent skills ecosystem. Skills are modular packages that extend agent capabilities with specialized knowledge, workflows, and tools.
24
+
25
+ **Key commands:**
26
+
27
+ - `npx skills find [query]` - Search for skills interactively or by keyword
28
+ - `npx skills add <package>` - Install a skill from GitHub or other sources
29
+ - `npx skills check` - Check for skill updates
30
+ - `npx skills update` - Update all installed skills
31
+
32
+ **Browse skills at:** https://skills.sh/
33
+
34
+
35
+ For workflow/tooling explanations with user-facing flows, request lifecycles, architecture, data flow, or multi-step sequences, include a meaningful Mermaid diagram plus concise prose unless the user requested prose only or the response is trivial. Workflow Suite renders diagrams in a uniform dark-mode visual style; use concise labels and do not hardcode random light styling unless explicitly requested.
36
+
37
+ ## How to Help Users Find Skills
38
+
39
+ ### Step 1: Understand What They Need
40
+
41
+ When a user asks for help with something, identify:
42
+
43
+ 1. The domain (e.g., React, testing, design, deployment)
44
+ 2. The specific task (e.g., writing tests, creating animations, reviewing PRs)
45
+ 3. Whether this is a common enough task that a skill likely exists
46
+
47
+ ### Step 2: Check the Leaderboard First
48
+
49
+ Before running a CLI search, check the [skills.sh leaderboard](https://skills.sh/) to see if a well-known skill already exists for the domain. The leaderboard ranks skills by total installs, surfacing the most popular and battle-tested options.
50
+
51
+ For example, top skills for web development include:
52
+ - `vercel-labs/agent-skills` — React, Next.js, web design (100K+ installs each)
53
+ - `anthropics/skills` — Frontend design, document processing (100K+ installs)
54
+
55
+ ### Step 3: Search for Skills
56
+
57
+ If the leaderboard doesn't cover the user's need, run the find command:
58
+
59
+ ```bash
60
+ npx skills find [query]
61
+ ```
62
+
63
+ For example:
64
+
65
+ - User asks "how do I make my React app faster?" → `npx skills find react performance`
66
+ - User asks "can you help me with PR reviews?" → `npx skills find pr review`
67
+ - User asks "I need to create a changelog" → `npx skills find changelog`
68
+
69
+ ### Step 4: Verify Quality Before Recommending
70
+
71
+ **Do not recommend a skill based solely on search results.** Always verify:
72
+
73
+ 1. **Install count** — Prefer skills with 1K+ installs. Be cautious with anything under 100.
74
+ 2. **Source reputation** — Official sources (`vercel-labs`, `anthropics`, `microsoft`) are more trustworthy than unknown authors.
75
+ 3. **GitHub stars** — Check the source repository. A skill from a repo with <100 stars should be treated with skepticism.
76
+
77
+ ### Step 5: Present Options to the User
78
+
79
+ When you find relevant skills, present them to the user with:
80
+
81
+ 1. The skill name and what it does
82
+ 2. The install count and source
83
+ 3. The install command they can run
84
+ 4. A link to learn more at skills.sh
85
+
86
+ Example response:
87
+
88
+ ```
89
+ I found a skill that might help! The "react-best-practices" skill provides
90
+ React and Next.js performance optimization guidelines from Vercel Engineering.
91
+ (185K installs)
92
+
93
+ To install it:
94
+ npx skills add vercel-labs/agent-skills@react-best-practices
95
+
96
+ Learn more: https://skills.sh/vercel-labs/agent-skills/react-best-practices
97
+ ```
98
+
99
+ ### Step 6: Offer to Install
100
+
101
+ If the user wants to proceed, you can install the skill for them:
102
+
103
+ ```bash
104
+ npx skills add <owner/repo@skill> -g -y
105
+ ```
106
+
107
+ The `-g` flag installs globally (user-level) and `-y` skips confirmation prompts.
108
+
109
+ ## Common Skill Categories
110
+
111
+ When searching, consider these common categories:
112
+
113
+ | Category | Example Queries |
114
+ | --------------- | ---------------------------------------- |
115
+ | Web Development | react, nextjs, typescript, css, tailwind |
116
+ | Testing | testing, jest, playwright, e2e |
117
+ | DevOps | deploy, docker, kubernetes, ci-cd |
118
+ | Documentation | docs, readme, changelog, api-docs |
119
+ | Code Quality | review, lint, refactor, best-practices |
120
+ | Design | ui, ux, design-system, accessibility |
121
+ | Productivity | workflow, automation, git |
122
+
123
+ ## Tips for Effective Searches
124
+
125
+ 1. **Use specific keywords**: "react testing" is better than just "testing"
126
+ 2. **Try alternative terms**: If "deploy" doesn't work, try "deployment" or "ci-cd"
127
+ 3. **Check popular sources**: Many skills come from `vercel-labs/agent-skills` or `ComposioHQ/awesome-claude-skills`
128
+
129
+ ## When No Skills Are Found
130
+
131
+ If no relevant skills exist:
132
+
133
+ 1. Acknowledge that no existing skill was found
134
+ 2. Offer to help with the task directly using your general capabilities
135
+ 3. Suggest the user could create their own skill with `npx skills init`
136
+
137
+ Example:
138
+
139
+ ```
140
+ I searched for skills related to "xyz" but didn't find any matches.
141
+ I can still help you with this task directly! Would you like me to proceed?
142
+
143
+ If this is something you do often, you could create your own skill:
144
+ npx skills init my-xyz-skill
145
+ ```
146
+ ## Professional Constraints
147
+
148
+ - Check project instructions before recommendations when the task touches code, docs, settings, or workflow behavior.
149
+ - Keep scope bounded to the user request and approved workflow phase.
150
+ - Do not print secrets, credentials, tokens, auth/session values, private runtime state, or `.env` contents.
151
+ - Avoid destructive commands, deploys, pushes, resets, cleans, database mutations, and dependency installs unless explicitly approved outside this workflow.
152
+ - Prefer concise, evidence-based output with exact files or commands reviewed.
153
+ ## Skills vs Agents
154
+
155
+ Use this skill as in-process guidance for the current model. Use a sub-agent only when the task benefits from an isolated context window, parallel read-only research, forced preflight, or independent validation. Do not use both this skill and a same-purpose agent for the same narrow job unless the workflow or user explicitly requires it.