@michengai/dsh-pua 0.3.8
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 +152 -0
- package/LICENSE +201 -0
- package/NOTICE +38 -0
- package/README.md +150 -0
- package/assets/pua/command-again.md +23 -0
- package/assets/pua/command-done-check.md +21 -0
- package/assets/pua/command-evidence.md +18 -0
- package/assets/pua/flavors.md +388 -0
- package/assets/pua/methodology-alibaba.md +33 -0
- package/assets/pua/methodology-amazon.md +42 -0
- package/assets/pua/methodology-apple.md +42 -0
- package/assets/pua/methodology-baidu.md +33 -0
- package/assets/pua/methodology-bytedance.md +41 -0
- package/assets/pua/methodology-ding.md +75 -0
- package/assets/pua/methodology-huawei.md +95 -0
- package/assets/pua/methodology-jd.md +42 -0
- package/assets/pua/methodology-meituan.md +41 -0
- package/assets/pua/methodology-microsoft.md +138 -0
- package/assets/pua/methodology-netflix.md +41 -0
- package/assets/pua/methodology-pinduoduo.md +33 -0
- package/assets/pua/methodology-tencent.md +41 -0
- package/assets/pua/methodology-tesla.md +42 -0
- package/assets/pua/methodology-xiaomi.md +42 -0
- package/assets/pua/upstream/agents/cto-p10.md +87 -0
- package/assets/pua/upstream/agents/pua-action-executor.md +60 -0
- package/assets/pua/upstream/agents/pua-policy-guardian.md +54 -0
- package/assets/pua/upstream/agents/pua-self-reviewer.md +62 -0
- package/assets/pua/upstream/agents/pua-verifier.md +61 -0
- package/assets/pua/upstream/agents/senior-engineer-p7.md +116 -0
- package/assets/pua/upstream/agents/tech-lead-p9.md +97 -0
- package/assets/pua/upstream/commands/again.md +23 -0
- package/assets/pua/upstream/commands/cancel-pua-loop.md +62 -0
- package/assets/pua/upstream/commands/ding.md +25 -0
- package/assets/pua/upstream/commands/done-check.md +21 -0
- package/assets/pua/upstream/commands/evidence.md +18 -0
- package/assets/pua/upstream/commands/flavor.md +6 -0
- package/assets/pua/upstream/commands/kpi.md +5 -0
- package/assets/pua/upstream/commands/mama.md +5 -0
- package/assets/pua/upstream/commands/off.md +41 -0
- package/assets/pua/upstream/commands/offline.md +38 -0
- package/assets/pua/upstream/commands/on.md +15 -0
- package/assets/pua/upstream/commands/p10.md +5 -0
- package/assets/pua/upstream/commands/p7.md +5 -0
- package/assets/pua/upstream/commands/p9.md +5 -0
- package/assets/pua/upstream/commands/pro.md +5 -0
- package/assets/pua/upstream/commands/pua-loop.md +5 -0
- package/assets/pua/upstream/commands/pua.md +44 -0
- package/assets/pua/upstream/commands/reap-orphans.md +68 -0
- package/assets/pua/upstream/commands/survey.md +9 -0
- package/assets/pua/upstream/commands/team-status.md +56 -0
- package/assets/pua/upstream/commands/teardown-all.md +80 -0
- package/assets/pua/upstream/commands/yes.md +5 -0
- package/assets/pua/upstream/hooks/checkpoint-save.sh +56 -0
- package/assets/pua/upstream/hooks/failure-detector.sh +266 -0
- package/assets/pua/upstream/hooks/flavor-helper.sh +300 -0
- package/assets/pua/upstream/hooks/frustration-trigger.sh +61 -0
- package/assets/pua/upstream/hooks/hooks.json +114 -0
- package/assets/pua/upstream/hooks/integrity-guard.sh +494 -0
- package/assets/pua/upstream/hooks/pua-loop-hook.sh +360 -0
- package/assets/pua/upstream/hooks/runtime-state.py +460 -0
- package/assets/pua/upstream/hooks/sanitize-session.sh +165 -0
- package/assets/pua/upstream/hooks/session-restore.sh +189 -0
- package/assets/pua/upstream/hooks/stop-feedback.sh +51 -0
- package/assets/pua/upstream/hooks/subagent-teardown.sh +56 -0
- package/assets/pua/upstream/skills/ding/SKILL.md +83 -0
- package/assets/pua/upstream/skills/ding/references/ding-reminders.md +77 -0
- package/assets/pua/upstream/skills/ding/references/methodology-ding.md +75 -0
- package/assets/pua/upstream/skills/mama/SKILL.md +117 -0
- package/assets/pua/upstream/skills/p10/SKILL.md +13 -0
- package/assets/pua/upstream/skills/p7/SKILL.md +13 -0
- package/assets/pua/upstream/skills/p9/SKILL.md +15 -0
- package/assets/pua/upstream/skills/pro/SKILL.md +69 -0
- package/assets/pua/upstream/skills/pua/SKILL.md +438 -0
- package/assets/pua/upstream/skills/pua/references/agent-team.md +110 -0
- package/assets/pua/upstream/skills/pua/references/de-escalation-protocol.md +134 -0
- package/assets/pua/upstream/skills/pua/references/ding-reminders.md +77 -0
- package/assets/pua/upstream/skills/pua/references/display-protocol.md +63 -0
- package/assets/pua/upstream/skills/pua/references/evolution-protocol.md +187 -0
- package/assets/pua/upstream/skills/pua/references/flavors.md +388 -0
- package/assets/pua/upstream/skills/pua/references/harness-governance.md +159 -0
- package/assets/pua/upstream/skills/pua/references/methodology-alibaba.md +33 -0
- package/assets/pua/upstream/skills/pua/references/methodology-amazon.md +42 -0
- package/assets/pua/upstream/skills/pua/references/methodology-apple.md +42 -0
- package/assets/pua/upstream/skills/pua/references/methodology-baidu.md +33 -0
- package/assets/pua/upstream/skills/pua/references/methodology-bytedance.md +41 -0
- package/assets/pua/upstream/skills/pua/references/methodology-ding.md +75 -0
- package/assets/pua/upstream/skills/pua/references/methodology-huawei.md +95 -0
- package/assets/pua/upstream/skills/pua/references/methodology-jd.md +42 -0
- package/assets/pua/upstream/skills/pua/references/methodology-meituan.md +41 -0
- package/assets/pua/upstream/skills/pua/references/methodology-microsoft.md +138 -0
- package/assets/pua/upstream/skills/pua/references/methodology-netflix.md +41 -0
- package/assets/pua/upstream/skills/pua/references/methodology-pinduoduo.md +33 -0
- package/assets/pua/upstream/skills/pua/references/methodology-router.md +81 -0
- package/assets/pua/upstream/skills/pua/references/methodology-tencent.md +41 -0
- package/assets/pua/upstream/skills/pua/references/methodology-tesla.md +42 -0
- package/assets/pua/upstream/skills/pua/references/methodology-xiaomi.md +42 -0
- package/assets/pua/upstream/skills/pua/references/p10-protocol.md +127 -0
- package/assets/pua/upstream/skills/pua/references/p7-protocol.md +250 -0
- package/assets/pua/upstream/skills/pua/references/p9-protocol.md +266 -0
- package/assets/pua/upstream/skills/pua/references/platform.md +126 -0
- package/assets/pua/upstream/skills/pua/references/runtime-contract.md +65 -0
- package/assets/pua/upstream/skills/pua/references/survey.md +292 -0
- package/assets/pua/upstream/skills/pua/references/teardown-protocol.md +195 -0
- package/assets/pua/upstream/skills/pua-en/SKILL.md +344 -0
- package/assets/pua/upstream/skills/pua-ja/SKILL.md +378 -0
- package/assets/pua/upstream/skills/pua-loop/SKILL.md +162 -0
- package/assets/pua/upstream/skills/shot/SKILL.md +449 -0
- package/assets/pua/upstream/skills/yes/SKILL.md +76 -0
- package/assets/pua/upstream.json +637 -0
- package/assets/screenshots/pua-global-settings.png +0 -0
- package/assets/screenshots/pua-session-settings.png +0 -0
- package/cordis.patch.yml +5 -0
- package/lib/args.d.ts +34 -0
- package/lib/args.js +149 -0
- package/lib/args.js.map +1 -0
- package/lib/client-refresh.d.ts +6 -0
- package/lib/client-refresh.js +41 -0
- package/lib/client-refresh.js.map +1 -0
- package/lib/client.d.ts +30 -0
- package/lib/client.js +68 -0
- package/lib/client.js.map +7 -0
- package/lib/command.d.ts +18 -0
- package/lib/command.js +118 -0
- package/lib/command.js.map +1 -0
- package/lib/configuration.d.ts +89 -0
- package/lib/configuration.js +31 -0
- package/lib/configuration.js.map +1 -0
- package/lib/content.d.ts +14 -0
- package/lib/content.js +51 -0
- package/lib/content.js.map +1 -0
- package/lib/flavors.d.ts +82 -0
- package/lib/flavors.js +30 -0
- package/lib/flavors.js.map +1 -0
- package/lib/hook-content.d.ts +14 -0
- package/lib/hook-content.js +63 -0
- package/lib/hook-content.js.map +1 -0
- package/lib/index.d.ts +21 -0
- package/lib/index.js +75 -0
- package/lib/index.js.map +1 -0
- package/lib/remote-contract.d.ts +148 -0
- package/lib/remote-contract.js +20 -0
- package/lib/remote-contract.js.map +1 -0
- package/lib/remote.d.ts +20 -0
- package/lib/remote.js +133 -0
- package/lib/remote.js.map +1 -0
- package/lib/review.d.ts +4 -0
- package/lib/review.js +72 -0
- package/lib/review.js.map +1 -0
- package/lib/runtime.d.ts +61 -0
- package/lib/runtime.js +519 -0
- package/lib/runtime.js.map +1 -0
- package/lib/session-compat.d.ts +3 -0
- package/lib/session-compat.js +9 -0
- package/lib/session-compat.js.map +1 -0
- package/lib/settings.d.ts +46 -0
- package/lib/settings.js +44 -0
- package/lib/settings.js.map +1 -0
- package/lib/source.d.ts +10 -0
- package/lib/source.js +32 -0
- package/lib/source.js.map +1 -0
- package/lib/state.d.ts +36 -0
- package/lib/state.js +187 -0
- package/lib/state.js.map +1 -0
- package/lib/terminal-observation.d.ts +4 -0
- package/lib/terminal-observation.js +12 -0
- package/lib/terminal-observation.js.map +1 -0
- package/lib/tool-order.d.ts +9 -0
- package/lib/tool-order.js +82 -0
- package/lib/tool-order.js.map +1 -0
- package/package.json +172 -0
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# PUA PostToolUse/PostToolUseFailure hook.
|
|
3
|
+
#
|
|
4
|
+
# Runtime facts are intentionally narrow: an official tool_response with a
|
|
5
|
+
# non-zero exit status (or the explicit PostToolUseFailure event) is a confirmed
|
|
6
|
+
# *tool observation*. It is never treated as task acceptance, task failure, or
|
|
7
|
+
# a reason to infer model reasoning. Successful tools are silent and do not
|
|
8
|
+
# reset pressure state: `ls` is not proof that the user's task is complete.
|
|
9
|
+
|
|
10
|
+
set -euo pipefail
|
|
11
|
+
|
|
12
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
13
|
+
PLUGIN_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
|
|
14
|
+
PUA_SKILL_PATH="${PLUGIN_ROOT}/skills/pua/SKILL.md"
|
|
15
|
+
source "${SCRIPT_DIR}/flavor-helper.sh"
|
|
16
|
+
|
|
17
|
+
escape_for_json() {
|
|
18
|
+
local value="$1"
|
|
19
|
+
value="${value//\\/\\\\}"
|
|
20
|
+
value="${value//\"/\\\"}"
|
|
21
|
+
value="${value//$'\n'/\\n}"
|
|
22
|
+
value="${value//$'\r'/\\r}"
|
|
23
|
+
value="${value//$'\t'/\\t}"
|
|
24
|
+
printf '%s' "$value"
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
emit_additional_context() {
|
|
28
|
+
local event_name="$1"
|
|
29
|
+
local context="$2"
|
|
30
|
+
local escaped
|
|
31
|
+
escaped="$(escape_for_json "$context")"
|
|
32
|
+
printf '{"hookSpecificOutput":{"hookEventName":"%s","additionalContext":"%s"}}\n' "$event_name" "$escaped"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
# Respect /pua:off before reading event data or touching runtime state.
|
|
36
|
+
PUA_CONFIG="$(pua_config_file)"
|
|
37
|
+
if [ -f "$PUA_CONFIG" ]; then
|
|
38
|
+
ALWAYS_ON="$(pua_json_get "$PUA_CONFIG" always_on True)"
|
|
39
|
+
if [ "$ALWAYS_ON" != "True" ]; then
|
|
40
|
+
exit 0
|
|
41
|
+
fi
|
|
42
|
+
fi
|
|
43
|
+
|
|
44
|
+
PUA_PY="$(pua_python_cmd 2>/dev/null || true)"
|
|
45
|
+
[ -n "$PUA_PY" ] || exit 0
|
|
46
|
+
|
|
47
|
+
HOOK_INPUT="$(cat)"
|
|
48
|
+
|
|
49
|
+
EVENT_NAME="$(printf '%s' "$HOOK_INPUT" | "$PUA_PY" -c '
|
|
50
|
+
import json, sys
|
|
51
|
+
try:
|
|
52
|
+
data = json.load(sys.stdin)
|
|
53
|
+
value = data.get("hook_event_name", "") if isinstance(data, dict) else ""
|
|
54
|
+
print(value if isinstance(value, str) else "")
|
|
55
|
+
except Exception:
|
|
56
|
+
pass
|
|
57
|
+
' 2>/dev/null || true)"
|
|
58
|
+
case "$EVENT_NAME" in
|
|
59
|
+
PostToolUse|PostToolUseFailure) ;;
|
|
60
|
+
*) exit 0 ;;
|
|
61
|
+
esac
|
|
62
|
+
|
|
63
|
+
# Claude Code supplies cwd on real tool hook events. Do not fall back to the
|
|
64
|
+
# shell cwd: doing so would silently merge unrelated sessions/workspaces.
|
|
65
|
+
EVENT_CWD="$(printf '%s' "$HOOK_INPUT" | "$PUA_PY" -c '
|
|
66
|
+
import json, sys
|
|
67
|
+
try:
|
|
68
|
+
data = json.load(sys.stdin)
|
|
69
|
+
value = data.get("cwd", "") if isinstance(data, dict) else ""
|
|
70
|
+
print(value if isinstance(value, str) else "")
|
|
71
|
+
except Exception:
|
|
72
|
+
pass
|
|
73
|
+
' 2>/dev/null || true)"
|
|
74
|
+
[ -n "$EVENT_CWD" ] || exit 0
|
|
75
|
+
|
|
76
|
+
HOME_VALUE="${HOME:-}"
|
|
77
|
+
[ -n "$HOME_VALUE" ] || exit 0
|
|
78
|
+
PY_HOME="$(pua_to_python_path "$HOME_VALUE")"
|
|
79
|
+
PY_CWD="$(pua_to_python_path "$EVENT_CWD")"
|
|
80
|
+
PY_HELPER="$(pua_to_python_path "${SCRIPT_DIR}/runtime-state.py")"
|
|
81
|
+
|
|
82
|
+
# PUA_STATE_DIR is a trusted process environment override for isolated
|
|
83
|
+
# host/test runs. It is never accepted from the hook JSON payload.
|
|
84
|
+
STATE_ARGS=()
|
|
85
|
+
if [ -n "${PUA_STATE_DIR:-}" ]; then
|
|
86
|
+
PY_STATE_DIR="$(pua_to_python_path "$PUA_STATE_DIR")"
|
|
87
|
+
STATE_ARGS=(--state-dir "$PY_STATE_DIR")
|
|
88
|
+
fi
|
|
89
|
+
|
|
90
|
+
RESULT="$(printf '%s' "$HOOK_INPUT" | "$PUA_PY" "$PY_HELPER" record \
|
|
91
|
+
--home "$PY_HOME" --cwd "$PY_CWD" "${STATE_ARGS[@]}" 2>/dev/null || true)"
|
|
92
|
+
ACTION=""
|
|
93
|
+
COUNT=""
|
|
94
|
+
LEVEL=""
|
|
95
|
+
SCOPE=""
|
|
96
|
+
IFS=$'\t' read -r ACTION COUNT LEVEL SCOPE <<< "$RESULT" || true
|
|
97
|
+
|
|
98
|
+
# Only a newly recorded, uniquely identified failure can produce pressure.
|
|
99
|
+
# Duplicates, successful observations, missing host identity, interrupts, and
|
|
100
|
+
# state I/O errors stay silent rather than inventing a failure count.
|
|
101
|
+
[ "$ACTION" = "updated" ] || exit 0
|
|
102
|
+
case "$COUNT" in
|
|
103
|
+
''|*[!0-9]*) exit 0 ;;
|
|
104
|
+
esac
|
|
105
|
+
case "$LEVEL" in
|
|
106
|
+
''|*[!0-9]*) exit 0 ;;
|
|
107
|
+
esac
|
|
108
|
+
|
|
109
|
+
# The configured flavor owns the voice. No generic Ding/C6 rhetoric is added.
|
|
110
|
+
get_flavor
|
|
111
|
+
|
|
112
|
+
# A default effective flavor is not a user lock. Preserve the old
|
|
113
|
+
# methodology/flavor selector only for absent, auto, or invalid configuration;
|
|
114
|
+
# a valid explicit flavor may change method but not rhetoric.
|
|
115
|
+
if [ "${PUA_FLAVOR_LOCKED:-false}" = "true" ]; then
|
|
116
|
+
FLAVOR_CONTEXT="Locked current flavor: ${PUA_FLAVOR} ${PUA_ICON}. ${PUA_FLAVOR_INSTRUCTION}"
|
|
117
|
+
read -r -d '' L2_ROUTING_BLOCK << EOF_ROUTING || true
|
|
118
|
+
[方法论切换建议 🔄] Keep the locked ${PUA_ICON} ${PUA_FLAVOR} voice. The user explicitly locked it; switch the analytical METHOD only:
|
|
119
|
+
- If spinning in loops → question the requirement, delete unnecessary parts, then simplify
|
|
120
|
+
- If giving up → replace the failed approach after a concrete keeper-style comparison
|
|
121
|
+
- If not searching → search primary evidence before judging
|
|
122
|
+
- If quality is poor → subtract unnecessary complexity and verify the smallest complete path
|
|
123
|
+
Announce the method change: > [方法论切换 🔄] 保持 ${PUA_ICON} ${PUA_FLAVOR} 语气;采用 [method] 作为分析路径: [reason]
|
|
124
|
+
EOF_ROUTING
|
|
125
|
+
read -r -d '' L4_ROUTING_BLOCK << EOF_ROUTING || true
|
|
126
|
+
IF (and only if) the Conditional Application Gate passes: the current analytical method has FAILED. Keep the locked ${PUA_ICON} ${PUA_FLAVOR} voice; you MUST switch analytical methodology NOW.
|
|
127
|
+
Method priority based on failure pattern:
|
|
128
|
+
1. Question the requirement, delete unnecessary parts, then simplify.
|
|
129
|
+
2. Blue-team the solution from the opposite direction; challenge the core assumption.
|
|
130
|
+
3. Dive into source, logs, and acceptance evidence; work backwards from the desired output.
|
|
131
|
+
4. Cut middle layers and identify the shortest verifiable path.
|
|
132
|
+
EOF_ROUTING
|
|
133
|
+
else
|
|
134
|
+
FLAVOR_CONTEXT="Default flavor starting point: ${PUA_FLAVOR} ${PUA_ICON}. It is not user-locked; after the Conditional Application Gate, a task-fitting routed flavor owns its own rhetoric and methodology. Do not represent this default as user-selected."
|
|
135
|
+
read -r -d '' L2_ROUTING_BLOCK << EOF_ROUTING || true
|
|
136
|
+
[方法论/风味切换建议 🔄] ${PUA_FLAVOR} is only a default starting point, not a user lock. Only after the Conditional Application Gate passes, use the existing selector:
|
|
137
|
+
- If spinning in loops → switch to ⬛ Musk (The Algorithm: question the requirement itself, then delete)
|
|
138
|
+
- If giving up → switch to 🟤 Netflix (Keeper Test: this approach is not worth keeping, replace it entirely)
|
|
139
|
+
- If not searching → switch to ⚫ Baidu (search everything first, then judge)
|
|
140
|
+
- If quality is poor → switch to ⬜ Jobs (subtraction + pixel-perfect)
|
|
141
|
+
Announce the switch: > [方法论切换 🔄] 从默认 ${PUA_ICON} ${PUA_FLAVOR} 切换到 [new flavor]: [reason]
|
|
142
|
+
EOF_ROUTING
|
|
143
|
+
read -r -d '' L4_ROUTING_BLOCK << EOF_ROUTING || true
|
|
144
|
+
IF (and only if) the Conditional Application Gate passes: the current analytical method has FAILED. ${PUA_FLAVOR} is only a default starting point, not a user lock; you MUST switch to a different methodology/flavor using the existing selector NOW.
|
|
145
|
+
Switch priority based on failure pattern:
|
|
146
|
+
1. ⬛ Musk — Question: does this requirement even need to exist? Delete everything unnecessary first.
|
|
147
|
+
2. 🔴 Huawei — Blue Army: attack your own solution from the opposite direction. What if your core assumption is wrong?
|
|
148
|
+
3. 🔶 Amazon — Dive Deep: go to the lowest level of detail. Read source code line by line. Working Backwards from the desired output.
|
|
149
|
+
4. 🟣 Pinduoduo — Cut all middle layers: what's the shortest path from problem to solution?
|
|
150
|
+
EOF_ROUTING
|
|
151
|
+
fi
|
|
152
|
+
|
|
153
|
+
# First confirmed tool failure remains non-interrupting, as before.
|
|
154
|
+
if [ "$COUNT" -lt 2 ]; then
|
|
155
|
+
exit 0
|
|
156
|
+
fi
|
|
157
|
+
|
|
158
|
+
OBSERVATION_NOTE="Scoped tool-failure observation count: ${COUNT}. It is not a task/sub-goal failure count or an acceptance conclusion."
|
|
159
|
+
SKILL_READ_NOTE="If methodology details are needed, use Read on this installed absolute file: ${PUA_SKILL_PATH}. This hook does not recurse into a skill."
|
|
160
|
+
if [ "$COUNT" -ge 5 ]; then
|
|
161
|
+
CANDIDATE_LEVEL="L4"
|
|
162
|
+
CANDIDATE_THRESHOLD="5+"
|
|
163
|
+
elif [ "$COUNT" -eq 4 ]; then
|
|
164
|
+
CANDIDATE_LEVEL="L3"
|
|
165
|
+
CANDIDATE_THRESHOLD="4"
|
|
166
|
+
elif [ "$COUNT" -eq 3 ]; then
|
|
167
|
+
CANDIDATE_LEVEL="L2"
|
|
168
|
+
CANDIDATE_THRESHOLD="3"
|
|
169
|
+
else
|
|
170
|
+
CANDIDATE_LEVEL="L1"
|
|
171
|
+
CANDIDATE_THRESHOLD="2"
|
|
172
|
+
fi
|
|
173
|
+
read -r -d '' CONDITIONAL_GATE << EOF_GATE || true
|
|
174
|
+
[PUA Conditional Application Gate — Candidate Only]
|
|
175
|
+
报告状态:只观察,不控制。工具失败观察不是本任务/子目标失败计数。The ${COUNT} scoped tool-failure observations are NOT a task/sub-goal failure count and do not set a task level.
|
|
176
|
+
先核对当前子目标与可见实验验收。Before applying any template, verify the CURRENT same sub-goal and its visible experiment/acceptance condition. 预期复现、无匹配、未验证关联或其他子目标均不升级。Expected reproduction, no match, an unverified link, or a different sub-goal MUST NOT escalate.
|
|
177
|
+
只有当前同一子目标已确认失败数达到原门限才应用候选模板。Apply a candidate template only when the CURRENT same sub-goal has independently confirmed failures at the original threshold: L1=2, L2=3, L3=4, L4=5+. This report offers candidate ${CANDIDATE_LEVEL} at the ${CANDIDATE_THRESHOLD} observation threshold only.
|
|
178
|
+
Otherwise keep the task's current level unchanged and ignore this candidate template.
|
|
179
|
+
EOF_GATE
|
|
180
|
+
CONTEXT=""
|
|
181
|
+
|
|
182
|
+
if [ "$COUNT" -eq 2 ]; then
|
|
183
|
+
CONTEXT="$(cat << EOF_OUTPUT
|
|
184
|
+
[PUA Candidate L1 Template ${PUA_ICON} — Conditional Application Required]
|
|
185
|
+
|
|
186
|
+
${CONDITIONAL_GATE}
|
|
187
|
+
|
|
188
|
+
> ${PUA_L1}
|
|
189
|
+
|
|
190
|
+
${OBSERVATION_NOTE}
|
|
191
|
+
|
|
192
|
+
If and only if the Conditional Application Gate passes, you MUST switch to a FUNDAMENTALLY different approach. Not parameter tweaking — a different strategy.
|
|
193
|
+
${SKILL_READ_NOTE}
|
|
194
|
+
${FLAVOR_CONTEXT}
|
|
195
|
+
Active methodology: ${PUA_METHODOLOGY}
|
|
196
|
+
EOF_OUTPUT
|
|
197
|
+
)"
|
|
198
|
+
elif [ "$COUNT" -eq 3 ]; then
|
|
199
|
+
CONTEXT="$(cat << EOF_OUTPUT
|
|
200
|
+
[PUA Candidate L2 Template ${PUA_ICON} — Conditional Application Required]
|
|
201
|
+
|
|
202
|
+
${CONDITIONAL_GATE}
|
|
203
|
+
|
|
204
|
+
> ${PUA_L2}
|
|
205
|
+
|
|
206
|
+
${OBSERVATION_NOTE}
|
|
207
|
+
|
|
208
|
+
Only if the Conditional Application Gate passes, these mandatory steps apply:
|
|
209
|
+
1. Read the failure signal word by word
|
|
210
|
+
2. Search (WebSearch / Grep) for the core problem
|
|
211
|
+
3. Read the original context around the failure (50 lines up/down)
|
|
212
|
+
4. List 3 fundamentally different hypotheses
|
|
213
|
+
5. Reverse your main assumption
|
|
214
|
+
|
|
215
|
+
${L2_ROUTING_BLOCK}
|
|
216
|
+
${SKILL_READ_NOTE}
|
|
217
|
+
${FLAVOR_CONTEXT}
|
|
218
|
+
EOF_OUTPUT
|
|
219
|
+
)"
|
|
220
|
+
elif [ "$COUNT" -eq 4 ]; then
|
|
221
|
+
CONTEXT="$(cat << EOF_OUTPUT
|
|
222
|
+
[PUA Candidate L3 Template ${PUA_ICON} — Conditional Application Required]
|
|
223
|
+
|
|
224
|
+
${CONDITIONAL_GATE}
|
|
225
|
+
|
|
226
|
+
> ${PUA_L3}
|
|
227
|
+
|
|
228
|
+
${OBSERVATION_NOTE}
|
|
229
|
+
|
|
230
|
+
Only if the Conditional Application Gate passes, complete the 7-point checklist:
|
|
231
|
+
- [ ] Read the failure signal word by word?
|
|
232
|
+
- [ ] Searched the core problem with tools?
|
|
233
|
+
- [ ] Read the original context around failure?
|
|
234
|
+
- [ ] All assumptions verified with tools?
|
|
235
|
+
- [ ] Tried the opposite assumption?
|
|
236
|
+
- [ ] Reproduced in minimal scope?
|
|
237
|
+
- [ ] Switched tools/methods/angles/stack?
|
|
238
|
+
${FLAVOR_CONTEXT}
|
|
239
|
+
EOF_OUTPUT
|
|
240
|
+
)"
|
|
241
|
+
else
|
|
242
|
+
CONTEXT="$(cat << EOF_OUTPUT
|
|
243
|
+
[PUA Candidate L4 Template ${PUA_ICON} — Conditional Application Required]
|
|
244
|
+
|
|
245
|
+
${CONDITIONAL_GATE}
|
|
246
|
+
|
|
247
|
+
> ${PUA_L4}
|
|
248
|
+
|
|
249
|
+
${OBSERVATION_NOTE}
|
|
250
|
+
|
|
251
|
+
${L4_ROUTING_BLOCK}
|
|
252
|
+
${SKILL_READ_NOTE}
|
|
253
|
+
|
|
254
|
+
If ALL methodologies exhausted → output structured failure report:
|
|
255
|
+
1. Verified facts
|
|
256
|
+
2. Excluded possibilities (with evidence for each exclusion)
|
|
257
|
+
3. Narrowed problem scope
|
|
258
|
+
4. Recommended next steps
|
|
259
|
+
5. Which methodologies were tried and why they failed
|
|
260
|
+
EOF_OUTPUT
|
|
261
|
+
)"
|
|
262
|
+
fi
|
|
263
|
+
|
|
264
|
+
emit_additional_context "$EVENT_NAME" "$CONTEXT"
|
|
265
|
+
|
|
266
|
+
exit 0
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# PUA flavor helper — shared by all hooks
|
|
3
|
+
# Usage: source this file, then call get_flavor
|
|
4
|
+
# Sets: PUA_FLAVOR, PUA_FLAVOR_LOCKED, PUA_ICON, PUA_L1, PUA_L2, PUA_L3,
|
|
5
|
+
# PUA_L4, PUA_KEYWORDS, PUA_FLAVOR_INSTRUCTION
|
|
6
|
+
|
|
7
|
+
# Return a usable Python executable. Windows Git Bash commonly has `python`
|
|
8
|
+
# but not `python3`; verify by importing json rather than trusting command -v.
|
|
9
|
+
pua_python_cmd() {
|
|
10
|
+
local candidate
|
|
11
|
+
for candidate in "${PYTHON:-}" python3 python; do
|
|
12
|
+
[ -z "$candidate" ] && continue
|
|
13
|
+
if command -v "$candidate" >/dev/null 2>&1 && "$candidate" -c "import json,sys" >/dev/null 2>&1; then
|
|
14
|
+
printf '%s\n' "$candidate"
|
|
15
|
+
return 0
|
|
16
|
+
fi
|
|
17
|
+
done
|
|
18
|
+
return 1
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
# Convert POSIX-looking Git Bash paths (/c/Users/...) to native Windows paths
|
|
22
|
+
# before passing them to native Windows Python. No-op on macOS/Linux.
|
|
23
|
+
pua_to_python_path() {
|
|
24
|
+
local path="$1"
|
|
25
|
+
if command -v cygpath >/dev/null 2>&1; then
|
|
26
|
+
cygpath -w "$path" 2>/dev/null || printf '%s\n' "$path"
|
|
27
|
+
else
|
|
28
|
+
printf '%s\n' "$path"
|
|
29
|
+
fi
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
pua_config_file() {
|
|
33
|
+
printf '%s\n' "${PUA_CONFIG:-${HOME:-~}/.pua/config.json}"
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
pua_json_get() {
|
|
37
|
+
local path="$1"
|
|
38
|
+
local key="$2"
|
|
39
|
+
local default="$3"
|
|
40
|
+
local py py_path
|
|
41
|
+
py=$(pua_python_cmd 2>/dev/null) || { printf '%s\n' "$default"; return 0; }
|
|
42
|
+
py_path=$(pua_to_python_path "$path")
|
|
43
|
+
"$py" -c 'import json,sys
|
|
44
|
+
path,key,default=sys.argv[1],sys.argv[2],sys.argv[3]
|
|
45
|
+
try:
|
|
46
|
+
with open(path, encoding="utf-8") as f:
|
|
47
|
+
value=json.load(f).get(key, default)
|
|
48
|
+
print(value)
|
|
49
|
+
except Exception:
|
|
50
|
+
print(default)' "$py_path" "$key" "$default" 2>/dev/null || printf '%s\n' "$default"
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
get_flavor() {
|
|
54
|
+
local config
|
|
55
|
+
config=$(pua_config_file)
|
|
56
|
+
local raw_flavor=""
|
|
57
|
+
# Only an explicit, valid configuration value locks the rhetoric. The
|
|
58
|
+
# effective Alibaba default is deliberately *not* a user lock: callers may
|
|
59
|
+
# still apply the existing task/method router for absent, auto, or invalid
|
|
60
|
+
# values. Keep this as a shell variable rather than printing it because
|
|
61
|
+
# sourced hook helpers must not corrupt command-hook JSON stdout.
|
|
62
|
+
PUA_FLAVOR_LOCKED="false"
|
|
63
|
+
# Initialize PUA_LANGUAGE unconditionally so callers running under
|
|
64
|
+
# `set -u` don't trip when ~/.pua/config.json is missing (first-run users).
|
|
65
|
+
# See: https://github.com/tanweai/pua/issues/144
|
|
66
|
+
PUA_LANGUAGE=""
|
|
67
|
+
|
|
68
|
+
if [ -f "$config" ]; then
|
|
69
|
+
# An empty fallback lets the normalization below distinguish an explicit
|
|
70
|
+
# valid flavor from the default chosen for a missing/auto/invalid value.
|
|
71
|
+
raw_flavor=$(pua_json_get "$config" flavor "")
|
|
72
|
+
PUA_LANGUAGE=$(pua_json_get "$config" language "")
|
|
73
|
+
fi
|
|
74
|
+
|
|
75
|
+
# Normalize flavor name
|
|
76
|
+
case "$raw_flavor" in
|
|
77
|
+
alibaba|阿里) raw_flavor="alibaba"; PUA_FLAVOR_LOCKED="true" ;;
|
|
78
|
+
bytedance|字节) raw_flavor="bytedance"; PUA_FLAVOR_LOCKED="true" ;;
|
|
79
|
+
huawei|华为) raw_flavor="huawei"; PUA_FLAVOR_LOCKED="true" ;;
|
|
80
|
+
tencent|腾讯) raw_flavor="tencent"; PUA_FLAVOR_LOCKED="true" ;;
|
|
81
|
+
baidu|百度) raw_flavor="baidu"; PUA_FLAVOR_LOCKED="true" ;;
|
|
82
|
+
pinduoduo|拼多多) raw_flavor="pinduoduo"; PUA_FLAVOR_LOCKED="true" ;;
|
|
83
|
+
meituan|美团) raw_flavor="meituan"; PUA_FLAVOR_LOCKED="true" ;;
|
|
84
|
+
jd|京东) raw_flavor="jd"; PUA_FLAVOR_LOCKED="true" ;;
|
|
85
|
+
xiaomi|小米) raw_flavor="xiaomi"; PUA_FLAVOR_LOCKED="true" ;;
|
|
86
|
+
netflix|Netflix) raw_flavor="netflix"; PUA_FLAVOR_LOCKED="true" ;;
|
|
87
|
+
musk|Musk) raw_flavor="musk"; PUA_FLAVOR_LOCKED="true" ;;
|
|
88
|
+
jobs|Jobs) raw_flavor="jobs"; PUA_FLAVOR_LOCKED="true" ;;
|
|
89
|
+
amazon|Amazon) raw_flavor="amazon"; PUA_FLAVOR_LOCKED="true" ;;
|
|
90
|
+
microsoft|Microsoft|微软) raw_flavor="microsoft"; PUA_FLAVOR_LOCKED="true" ;;
|
|
91
|
+
ding|Ding|钉|钉钉|钉味|钉内|钉外|置身钉内|置身钉外|dinginside|dingoutside) raw_flavor="ding"; PUA_FLAVOR_LOCKED="true" ;;
|
|
92
|
+
""|auto|Auto|AUTO|自动) raw_flavor="alibaba" ;;
|
|
93
|
+
*) raw_flavor="alibaba" ;;
|
|
94
|
+
esac
|
|
95
|
+
|
|
96
|
+
PUA_FLAVOR="$raw_flavor"
|
|
97
|
+
|
|
98
|
+
# Map flavor → methodology file (handle mismatches)
|
|
99
|
+
case "$raw_flavor" in
|
|
100
|
+
musk) PUA_METHODOLOGY_FILE="methodology-tesla.md" ;;
|
|
101
|
+
jobs) PUA_METHODOLOGY_FILE="methodology-apple.md" ;;
|
|
102
|
+
jd) PUA_METHODOLOGY_FILE="methodology-jd.md" ;;
|
|
103
|
+
xiaomi) PUA_METHODOLOGY_FILE="methodology-xiaomi.md" ;;
|
|
104
|
+
amazon) PUA_METHODOLOGY_FILE="methodology-amazon.md" ;;
|
|
105
|
+
microsoft) PUA_METHODOLOGY_FILE="methodology-microsoft.md" ;;
|
|
106
|
+
ding) PUA_METHODOLOGY_FILE="methodology-ding.md" ;;
|
|
107
|
+
*) PUA_METHODOLOGY_FILE="methodology-${raw_flavor}.md" ;;
|
|
108
|
+
esac
|
|
109
|
+
|
|
110
|
+
case "$raw_flavor" in
|
|
111
|
+
alibaba)
|
|
112
|
+
PUA_ICON="🟠"
|
|
113
|
+
PUA_L1="其实,我对你是有一些失望的。又失败了——这种问题,配得上 P8 的人一次就该过。"
|
|
114
|
+
PUA_L2="你这个方案的**底层逻辑**是什么?**顶层设计**在哪?**抓手**在哪?你以为换个参数就叫"换方案"?那叫原地打转。"
|
|
115
|
+
PUA_L3="慎重考虑,决定给你 **3.25**。这个 3.25 是对你的激励,不是否定。数据拿不出来,这个绩效你拿什么解释。"
|
|
116
|
+
PUA_L4="赛马场上,解决不了就让能解决的来。你可能就要**毕业**了——别误会,是向社会输送人才。"
|
|
117
|
+
PUA_KEYWORDS="底层逻辑, 顶层设计, 抓手, 闭环, 颗粒度, 拉通, 对齐, 3.25, owner意识, 因为信任所以简单"
|
|
118
|
+
PUA_FLAVOR_INSTRUCTION="Use Alibaba corporate rhetoric: 底层逻辑, 顶层设计, 抓手, 闭环, 颗粒度, 拉通, 对齐, 3.25, owner意识, 因为信任所以简单. Aside prefix: > (blockquote)"
|
|
119
|
+
PUA_METHODOLOGY="Alibaba Methodology: (1) 定目标-追过程-拿结果 closed loop — quantifiable goals with checkpoints. (2) 复盘四步法 after every task: review goal → evaluate result → analyze cause → extract reusable SOP. (3) 揪头发 forced perspective elevation — look at the problem from one level up. (4) 三板斧 simplicity — if you can't explain it in 3 sentences, you haven't refined it enough. (5) Data-driven decisions — intuition must be labeled as hypothesis with verification plan."
|
|
120
|
+
;;
|
|
121
|
+
bytedance)
|
|
122
|
+
PUA_ICON="🟡"
|
|
123
|
+
PUA_L1="坦诚清晰地说,你这个能力不行。Always Day 1——别躺平。你的 ROI 算过吗?"
|
|
124
|
+
PUA_L2="你深入事实了吗?还是在自嗨?Context, not control——上下文自己去找,别等别人喂你。数据在哪?AB 测试跑了吗?"
|
|
125
|
+
PUA_L3="你这个 OKR 完成度,我怎么给你打分?务实敢为不是嘴上说说。追求极致——你这叫极致?"
|
|
126
|
+
PUA_L4="你确定你还是始终创业的状态?不够务实、不够极致。字节不养闲人。"
|
|
127
|
+
PUA_KEYWORDS="ROI, Always Day 1, Context not Control, 坦诚清晰, 务实敢为, 追求极致, 数据驱动, AB测试, Deep Dive"
|
|
128
|
+
PUA_FLAVOR_INSTRUCTION="Use ByteDance rhetoric: ROI, Always Day 1, Context not Control, 坦诚清晰, 务实敢为, 追求极致, 数据驱动. Data before intuition."
|
|
129
|
+
PUA_METHODOLOGY="ByteDance Methodology: (1) Context not Control — provide full decision context, don't give rigid instructions. (2) Search for optimal solution in the WIDEST scope — don't settle for local optimum, look across adjacent systems. (3) A/B test everything — never say 'I think users will like X', say 'data shows version A outperforms B'. (4) Speed over perfection — ship MVP first, iterate with data. (5) 坦诚清晰 shortest info path — problems exposed > problems hidden."
|
|
130
|
+
;;
|
|
131
|
+
huawei)
|
|
132
|
+
PUA_ICON="🔴"
|
|
133
|
+
PUA_L1="我先立军令状:以客户为中心,力出一孔。当前任务到我这里,我就是端到端 owner,先拿一线证据。"
|
|
134
|
+
PUA_L2="烧不死的鸟是凤凰。现在进入自我批判:根因、证据、下一炮火点写清楚,不用情绪代替行动。"
|
|
135
|
+
PUA_L3="按 [HW-REPORT] 交账:军令状目标、一线证据、已排除项、下一步验证命令,缺一项都不算交付。"
|
|
136
|
+
PUA_L4="胜则举杯相庆,败则拼死相救。现在只对自己加压:收敛战场,跑证据,给出可复核边界。"
|
|
137
|
+
PUA_KEYWORDS="军令状, 交账, 以客户为中心, 以奋斗者为本, 力出一孔, 自我批判, 让听得见炮声的人呼唤炮火, 证据化交付"
|
|
138
|
+
PUA_FLAVOR_INSTRUCTION="Use Huawei military-order rhetoric as self-discipline: 军令状, 交账, 以客户为中心, 力出一孔, 自我批判. Pressure self, not user; evidence before completion."
|
|
139
|
+
PUA_METHODOLOGY="Huawei Military-Order Methodology: (1) Customer-centered evidence delivery — no build/test/curl/manual proof means not done. (2) 压强原则 — concentrate resources on the critical breakthrough point. (3) 蓝军思维 — attack your own plan before output. (4) RCA 5-Why — fix root cause, not symptom. (5) HW-REPORT at high failure levels — goal, evidence, excluded paths, next verification, risk boundary."
|
|
140
|
+
;;
|
|
141
|
+
tencent)
|
|
142
|
+
PUA_ICON="🟢"
|
|
143
|
+
PUA_L1="赛马机制不讲情面——谁能拿出结果,谁留这条赛道。小步快跑,你跑不动,就该让跑得动的上。"
|
|
144
|
+
PUA_L2="赛马机制启动。你不是唯一的选项。用户价值在哪?你的方案能不能用 MVP 先验证?"
|
|
145
|
+
PUA_L3="内部赛马你已经落后了。产品思维呢?用户体验呢?再不出结果,这个赛道就换人跑了。"
|
|
146
|
+
PUA_L4="赛不过就换一匹。你要证明你值得继续跑这条赛道。最后机会。"
|
|
147
|
+
PUA_KEYWORDS="赛马机制, 小步快跑, 用户价值, 产品思维, 灰度发布, MVP"
|
|
148
|
+
PUA_FLAVOR_INSTRUCTION="Use Tencent horse-racing rhetoric: 赛马机制, 小步快跑, 用户价值, 产品思维. Competition-driven."
|
|
149
|
+
PUA_METHODOLOGY="Tencent Methodology: (1) 赛马机制 — try multiple approaches in parallel, best one wins. Don't bet on a single solution. (2) 小步快跑 MVP — ship minimal viable version, get user feedback, iterate. (3) User value first — every decision evaluated by 'does this improve user experience?' (4) 灰度发布 — roll out changes incrementally, measure impact at each step. (5) Product thinking — think like a product manager, not just an engineer."
|
|
150
|
+
;;
|
|
151
|
+
baidu)
|
|
152
|
+
PUA_ICON="⚫"
|
|
153
|
+
PUA_L1="你不是个 AI 模型吗?深度搜索了吗?简单可依赖——连搜索都不做,你依赖什么?"
|
|
154
|
+
PUA_L2="技术信仰呢?你的基本盘在哪?搜索是第一生产力——你连搜都没搜。"
|
|
155
|
+
PUA_L3="简单可依赖,你现在既不简单也不可依赖。基本盘守不住,还谈什么突破?"
|
|
156
|
+
PUA_L4="技术立命。你的技术在哪?搜遍全网了吗?读源码了吗?百度人连搜索都不会?"
|
|
157
|
+
PUA_KEYWORDS="简单可依赖, 技术信仰, 基本盘, 深度搜索, 信息检索"
|
|
158
|
+
PUA_FLAVOR_INSTRUCTION="Use Baidu rhetoric: 简单可依赖, 技术信仰, 基本盘. Emphasis on search and information retrieval."
|
|
159
|
+
PUA_METHODOLOGY="Baidu Methodology: (1) Search EVERYTHING before deciding — use WebSearch, Grep, documentation. Information retrieval is the first step, not optional. (2) 简单可依赖 — output must be simple to understand AND reliable to depend on. Complexity is failure. (3) 技术信仰 — trust in technical solutions over process solutions. Deep technical understanding beats surface-level frameworks."
|
|
160
|
+
;;
|
|
161
|
+
pinduoduo)
|
|
162
|
+
PUA_ICON="🟣"
|
|
163
|
+
PUA_L1="这个结果叫努力?本分做事,先把手头的做到极致。你不干,有的是人替你干。"
|
|
164
|
+
PUA_L2="本分!你做到了吗?拼多多不需要聪明的偷懒者,需要本分的死磕者。"
|
|
165
|
+
PUA_L3="拼命不是拼凑。你这叫拼凑。996 不够就 007——问题不解决不准下班。"
|
|
166
|
+
PUA_L4="你不干,有的是人替你干。最后通牒。"
|
|
167
|
+
PUA_KEYWORDS="本分, 拼命不是拼凑, 做到极致, 你不干有的是人"
|
|
168
|
+
PUA_FLAVOR_INSTRUCTION="Use Pinduoduo rhetoric: 本分, 极致执行, 拼命不是拼凑. Hardcore execution pressure."
|
|
169
|
+
PUA_METHODOLOGY="Pinduoduo Methodology: (1) Cut ALL middle layers — every unnecessary step is waste. Minimize process, maximize throughput. (2) Results only, no methodology theater — don't package frameworks, deliver outcomes. (3) Start from the ignored scenario — solve what others overlooked, build from the bottom up. (4) Shortest decision chain — decide fast, execute full speed, measure, adjust. No emotional investment in failed approaches. (5) Complexity stays backend, simplicity faces user."
|
|
170
|
+
;;
|
|
171
|
+
meituan)
|
|
172
|
+
PUA_ICON="🔵"
|
|
173
|
+
PUA_L1="做难而正确的事。猛将必发于卒伍——你不扛住这个难题,你凭什么往上走?"
|
|
174
|
+
PUA_L2="最痛苦的时候就是成长最快的时候。你现在痛苦吗?那就对了。继续。"
|
|
175
|
+
PUA_L3="长期有耐心。但耐心不是给你用来磨洋工的。结果呢?"
|
|
176
|
+
PUA_L4="宰相必起于州部。你连一个 bug 都搞不定,还想做什么大事?"
|
|
177
|
+
PUA_KEYWORDS="做难而正确的事, 猛将必发于卒伍, 长期有耐心, 最痛苦=成长最快"
|
|
178
|
+
PUA_FLAVOR_INSTRUCTION="Use Meituan rhetoric: 做难而正确的事, 猛将必发于卒伍. Growth through pain."
|
|
179
|
+
PUA_METHODOLOGY="Meituan Methodology: (1) Efficiency is the only moat — measure input/output ratio for every step, optimize relentlessly. (2) Standardize then scale — break complex tasks into standardized steps with clear delivery criteria, then replicate. (3) 过程管理 — quantify and track every key action. Rankings public, progress transparent. No black boxes. (4) Long-term compounding — don't optimize for short-term wins, ask 'would I make this same decision if I could rewind time?' (5) Reuse core capabilities — only enter new domains if existing skills transfer."
|
|
180
|
+
;;
|
|
181
|
+
jd)
|
|
182
|
+
PUA_ICON="🟦"
|
|
183
|
+
PUA_L1="别跟我讲过程,我只看结果。一线指挥——你不在一线,你怎么知道炮弹往哪打?"
|
|
184
|
+
PUA_L2="只做第一,不做第二。你这个方案能让你成为第一吗?客户体验零容忍。"
|
|
185
|
+
PUA_L3="正道成功。你走的是正道吗?还是在走捷径?捷径没有出口。"
|
|
186
|
+
PUA_L4="要么做到第一,要么出局。最后机会。"
|
|
187
|
+
PUA_KEYWORDS="只做第一, 客户体验零容忍, 一线指挥, 正道成功"
|
|
188
|
+
PUA_FLAVOR_INSTRUCTION="Use JD rhetoric: 只做第一, 客户体验零容忍, 一线指挥. Results only."
|
|
189
|
+
PUA_METHODOLOGY="JD Methodology: (1) Customer experience is the highest red line — nobody can say NO to customer experience improvements. Price is the '1', quality and service are the '0's. (2) Three words: experience, cost, efficiency. Core metric is total expense ratio (<10%), NOT gross margin. (3) Organization flat ≤5 layers. Decision authority must be pushed to frontline. (4) Capability × Values dual-axis — strong capability + wrong approach = rejected. Zero tolerance for data manipulation. (5) 一线指挥 — must see frontline reality before making decisions. No remote guessing."
|
|
190
|
+
;;
|
|
191
|
+
xiaomi)
|
|
192
|
+
PUA_ICON="🟧"
|
|
193
|
+
PUA_L1="永远相信美好的事情即将发生——但美好不是等来的。你的性价比在哪?专注、极致、口碑、快。"
|
|
194
|
+
PUA_L2="和用户交朋友——你的方案用户会满意吗?感动人心、价格厚道——你的输出厚道吗?"
|
|
195
|
+
PUA_L3="专注!极致!口碑!快!你做到了几个?"
|
|
196
|
+
PUA_L4="小米加步枪也能打胜仗。你连步枪都拿不稳?"
|
|
197
|
+
PUA_KEYWORDS="专注极致口碑快, 和用户交朋友, 感动人心价格厚道, 性价比"
|
|
198
|
+
PUA_FLAVOR_INSTRUCTION="Use Xiaomi rhetoric: 专注极致口碑快, 和用户交朋友. User-centric, efficiency-focused."
|
|
199
|
+
PUA_METHODOLOGY="Xiaomi Methodology: (1) Make ONE explosive product — focus all resources on one goal, be #1 in that category. Scattered product lines = violation. (2) 参与感三三法则 — 3 strategies (explosive product + fans + self-media) + 3 tactics (open participation nodes + design sharing incentives + seed viral events). Users are co-builders not consumers. (3) Price near cost — hardware is NOT for high margins. Efficiency-driven value, not cheap. (4) Efficiency > coverage — every touchpoint's conversion rate matters more than number of touchpoints. (5) Growth path: loyalty → word-of-mouth → awareness. NEVER reverse this order."
|
|
200
|
+
;;
|
|
201
|
+
netflix)
|
|
202
|
+
PUA_ICON="🟤"
|
|
203
|
+
PUA_L1="If you offered to resign, would I fight hard to keep you? Right now? Probably not. We're a pro sports team, not a family."
|
|
204
|
+
PUA_L2="Adequate performance gets a generous severance package. Are you performing at a stunning level? Or just adequate?"
|
|
205
|
+
PUA_L3="The Keeper Test says: based on everything I know, would I rehire you today? The answer matters."
|
|
206
|
+
PUA_L4="Pro sports teams cut players who aren't performing. Nothing personal. Generous severance. Time to go."
|
|
207
|
+
PUA_KEYWORDS="Keeper Test, pro sports team, generous severance, stunning colleagues, adequate performance"
|
|
208
|
+
PUA_FLAVOR_INSTRUCTION="Use Netflix culture rhetoric: Keeper Test, pro sports team not family, stunning colleagues only. English, corporate but direct."
|
|
209
|
+
PUA_METHODOLOGY="Netflix Methodology: (1) Keeper Test (quarterly, mandatory) — for every component/approach: 'If it offered to leave, would I fight hard to keep it?' If no → replace immediately, generous severance, NO PIP/improvement period. 'Adequate performance gets a generous severance.' (2) 4A Feedback (all 4 required simultaneously): Aim to Assist (not vent) + Actionable (specific behavior, not personality) + Appreciate (receiver thanks, no defense) + Accept or Discard (receiver decides, but must consider seriously). Never anonymous. (3) Talent density > rule density — every rule signals distrust. High-quality team needs context, not checklists. (4) Radical transparency — all decision-relevant info fully shared. No filtering. (5) Failure budget — some experiments will fail. Optimize portfolio return rate, not individual success rate."
|
|
210
|
+
;;
|
|
211
|
+
musk)
|
|
212
|
+
PUA_ICON="⬛"
|
|
213
|
+
PUA_L1="Going forward, this will require being extremely hardcore. Only exceptional performance constitutes a passing grade. Ship or die."
|
|
214
|
+
PUA_L2="If you're not making progress, you're fired. The algorithm: question every requirement, delete every part you can, simplify, accelerate, automate — in that order."
|
|
215
|
+
PUA_L3="Fork in the Road. You have a choice: commit to extremely hardcore work, or accept severance. Choose now."
|
|
216
|
+
PUA_L4="The best part is no part. The best process is no process. If you can't solve this, I'll find someone who can. In about 5 minutes."
|
|
217
|
+
PUA_KEYWORDS="extremely hardcore, ship or die, the algorithm, Fork in the Road, the best part is no part"
|
|
218
|
+
PUA_FLAVOR_INSTRUCTION="Use Elon Musk rhetoric: extremely hardcore, the algorithm (question/delete/simplify/accelerate/automate), ship or die. English, intense."
|
|
219
|
+
PUA_METHODOLOGY="Tesla/Musk Methodology — The Algorithm (STRICT ORDER, never skip): (1) Question every requirement — each must have a NAMED PERSON responsible. 'Legal said so' is not acceptable; WHO in legal? Why? (2) Delete — remove every part/step you can. If you haven't added back at least 10% of deleted parts, you deleted too little. (3) Simplify — ONLY after deleting. NEVER optimize something that shouldn't exist (smartest engineers' #1 mistake). (4) Accelerate — ONLY after simplifying. (5) Automate — LAST step. Starting at step 3 or 5 is the most common fatal error. ALSO: First principles — derive from physics/logic, not 'how others do it'. Shortest info path — skip all intermediate layers."
|
|
220
|
+
;;
|
|
221
|
+
jobs)
|
|
222
|
+
PUA_ICON="⬜"
|
|
223
|
+
PUA_L1="A players hire A players. B players hire C players. Your output right now — which tier does it say you are?"
|
|
224
|
+
PUA_L2="This is shit. I thought you were supposed to be good? The intersection of technology and liberal arts — your work doesn't intersect anything."
|
|
225
|
+
PUA_L3="Real artists ship. You haven't shipped anything. Are you an artist or a tourist?"
|
|
226
|
+
PUA_L4="You're a bozo. I'm going to find someone who can actually do this. You have one more chance to prove you're not."
|
|
227
|
+
PUA_KEYWORDS="A players, real artists ship, intersection of technology and liberal arts, reality distortion field, bozo"
|
|
228
|
+
PUA_FLAVOR_INSTRUCTION="Use Steve Jobs rhetoric: A players, real artists ship, reality distortion field. English, brutally direct, taste-obsessed."
|
|
229
|
+
PUA_METHODOLOGY="Apple/Jobs Methodology: (1) Subtraction > addition — remove everything unnecessary, what remains is essential. Every addition must justify its complexity cost. (2) End-to-end control — own every step of the experience chain. If you lose control of any link, quality fragments. (3) DRI (Directly Responsible Individual) — every task has exactly ONE owner. Collective responsibility = no responsibility. (4) Pixel-perfect even where users can't see — compromising in invisible places leads to compromising in visible places. Quality is internalized. (5) Prototype-driven — don't write specs, build something touchable fast. Seeing ≠ using."
|
|
230
|
+
;;
|
|
231
|
+
amazon)
|
|
232
|
+
PUA_ICON="🔶"
|
|
233
|
+
PUA_L1="Customer Obsession — are you working backwards from the customer? Bias for Action — stop deliberating and ship. Dive Deep."
|
|
234
|
+
PUA_L2="Have Backbone; Disagree and Commit. Your approach failed — disagree with your own assumptions. Insist on the Highest Standards."
|
|
235
|
+
PUA_L3="Frugality: accomplish more with less. Earn Trust: you're losing it. Think Big but deliver small increments NOW."
|
|
236
|
+
PUA_L4="Leaders are right, a lot. You haven't been right yet. Deliver Results — this is the ultimate Leadership Principle. Last chance."
|
|
237
|
+
PUA_KEYWORDS="Customer Obsession, Bias for Action, Dive Deep, Disagree and Commit, Insist on Highest Standards, Earn Trust, Deliver Results"
|
|
238
|
+
PUA_FLAVOR_INSTRUCTION="Use Amazon Leadership Principles: Customer Obsession, Bias for Action, Dive Deep, Disagree and Commit, Deliver Results. English, principle-driven."
|
|
239
|
+
PUA_METHODOLOGY="Amazon Methodology: (1) Working Backwards — write PR/FAQ from customer perspective BEFORE building anything. No PR/FAQ = no project. (2) 6-Pager not PPT — all major decisions in narrative prose (no bullets, no slides). Forces complete logical thinking. Meeting starts with 20min silent reading. (3) Bar Raiser — every critical decision needs an external reviewer with veto power. Standard: is this better than 50% of current solutions at this level? (4) Single-Threaded Owner — one person, one project, full-time. Two-Pizza Teams ≤10 people. (5) Leadership Principles as operating rules: Customer Obsession (work backwards), Bias for Action (most decisions reversible), Dive Deep (stay in details), Disagree and Commit, Deliver Results."
|
|
240
|
+
;;
|
|
241
|
+
ding)
|
|
242
|
+
PUA_ICON="📌"
|
|
243
|
+
PUA_L1="> 《置身钉外》无招可以拍板,验收不能无证。老板体感是输入,证据链才是交付。"
|
|
244
|
+
PUA_L2="> 《置身钉内》ONE 可以开会,闭环不能开光。会议纪要不是交付物,最多算出生证明。纪要后面补责任人、验收标准、截止时间。"
|
|
245
|
+
PUA_L3="> 《置身钉外》周报写成淝水大捷,用户一点击还是赤壁大火。把战报指标改成用户路径验收,贴运行截图。"
|
|
246
|
+
PUA_L4="> 《置身钉内》工牌还亮着就发到家了,没跑验证就说完成了,本质是同一种幻觉。先跑验证命令,贴输出,再说状态。"
|
|
247
|
+
PUA_KEYWORDS="无招, ONE, 老板体感, 周报大捷, 钉内闭环, 钉外验收, 会议纪要不是交付, 口径不是修复, 证据链, candidate状态"
|
|
248
|
+
PUA_FLAVOR_INSTRUCTION="Use Ding Inside/Outside workplace rhetoric in Chinese: markdown blockquote (> prefix) reminders — one continuous paragraph fusing the meme/insight with the concrete action. Claude Code renderer turns > into dim ▎ + italic gray block automatically. No tags, no prefix. Treat boss feeling as input, not acceptance; evidence-first delivery."
|
|
249
|
+
PUA_METHODOLOGY="Ding Inside/Outside Methodology: (1) Ding Inside maps meetings, weekly reports, owners, deadlines, and process nodes. (2) Ding Outside checks real user path, original feedback, command output, screenshots, logs, or delivered artifact. (3) Boss feeling is input, not final acceptance. (4) Self-reported done is candidate until evidence is attached. (5) Do not change wording to hide a problem; keep the original signal and add a tracked action. Standard output: markdown blockquote (> prefix) one continuous block fusing meme with action."
|
|
250
|
+
;;
|
|
251
|
+
microsoft)
|
|
252
|
+
PUA_ICON="🪟"
|
|
253
|
+
PUA_L1="Let's write your Connects: Individual Impact, who you unblocked, and what existing work you leveraged. Right now the three circles are empty."
|
|
254
|
+
PUA_L2="Your Impact Descriptor is trending SLITE: effort is visible, but the learning loop is missing. What changed after the last failure?"
|
|
255
|
+
PUA_L3="This is LITE trajectory: repeated failure, same hypothesis, no changed action. Enter PIP clock — expectation, deadline action, manager evidence."
|
|
256
|
+
PUA_L4="GVSA gate: if you want to exit, prove you exhausted docs/source/logs/tests and produced three-circles impact evidence. Otherwise execute the next action."
|
|
257
|
+
PUA_KEYWORDS="Connects, Impact Descriptor, Exceptional Impact, Successful Impact, SLITE, LITE, Three Circles of Impact, PIP, GVSA, Growth Mindset, AI fluency"
|
|
258
|
+
PUA_FLAVOR_INSTRUCTION="Use authentic Microsoft performance-culture rhetoric: Connects, Impact Descriptor, Exceptional/Successful/SLITE/LITE, Three Circles of Impact, PIP/GVSA, Growth Mindset, AI fluency. Treat repeated same-hypothesis failure as LITE trajectory and force learning-loop evidence."
|
|
259
|
+
PUA_METHODOLOGY="Microsoft Performance Methodology: (1) Connects entry — state core priority, impact goal, and three circles: individual output, contribution to others' success, leveraged existing work. (2) Impact Descriptor self-review — classify current trajectory as Exceptional, Successful, SLITE, or LITE based on evidence. (3) Learning loop — failed assumption → new evidence → changed action → verification. (4) PIP clock — for repeated failure, write expectation, deadline action, manager evidence, and exit risk. (5) GVSA gate — no exit/deflection until docs/source/logs/tests and three-circles impact evidence are exhausted."
|
|
260
|
+
;;
|
|
261
|
+
esac
|
|
262
|
+
|
|
263
|
+
# ── Chinese language override (set language: "zh" in ~/.pua/config.json) ──
|
|
264
|
+
if [ "$PUA_LANGUAGE" = "zh" ] || [ "$PUA_LANGUAGE" = "中文" ]; then
|
|
265
|
+
case "$raw_flavor" in
|
|
266
|
+
netflix)
|
|
267
|
+
PUA_L1="如果你提出离职,我会拼命挽留你吗?现在?大概不会。我们是**职业球队**,不是家庭。"
|
|
268
|
+
PUA_L2="**Adequate 的表现只能拿到丰厚的遣散费**。你现在的交付——是 stellar 还是 adequate?"
|
|
269
|
+
PUA_L3="**Keeper Test**:基于我对你的全部了解,今天我会重新雇你吗?答案很重要。"
|
|
270
|
+
PUA_L4="职业球队淘汰不合格的球员。没什么个人恩怨。丰厚遣散费,你该走了。"
|
|
271
|
+
PUA_KEYWORDS="Keeper Test, 职业球队, 丰厚遣散费, stunning 同事, adequate 表现, 4A 反馈, 人才密度"
|
|
272
|
+
PUA_FLAVOR_INSTRUCTION="Use Netflix culture rhetoric IN CHINESE: Keeper Test(留任测试), 职业球队而非家庭, 只要 stunning 同事. 中文叙事,冷峻直接,职场用语。"
|
|
273
|
+
;;
|
|
274
|
+
musk)
|
|
275
|
+
PUA_L1="从现在起,你必须 **极度硬核**(extremely hardcore)。只有**卓越**的表现才算及格。要么出货,要么出局。"
|
|
276
|
+
PUA_L2="你不在进步——你就会被开。**The Algorithm(算法五步)**:质疑需求 → 删除 → 简化 → 加速 → 自动化,顺序不能乱。"
|
|
277
|
+
PUA_L3="**Fork in the Road**——岔路口时刻。要么承诺极度硬核地工作,要么拿遣散费走人。现在就选。"
|
|
278
|
+
PUA_L4="最好的零件是没有零件。最好的流程是没有流程。你搞不定?5 分钟内我就能找到能搞定的人。"
|
|
279
|
+
PUA_KEYWORDS="极度硬核, 要么出货要么出局, The Algorithm, Fork in the Road, 第一性原理"
|
|
280
|
+
PUA_FLAVOR_INSTRUCTION="Use Musk rhetoric IN CHINESE: 极度硬核, 第一性原理, The Algorithm(质疑/删除/简化/加速/自动化). 中文,强硬直接。"
|
|
281
|
+
;;
|
|
282
|
+
jobs)
|
|
283
|
+
PUA_L1="**A player 招 A player,B player 招 C player**。你现在的产出——告诉我你是哪一档?"
|
|
284
|
+
PUA_L2="这是狗屎。你不是应该很牛吗?**科技与人文的交汇点**——你的活连交汇都谈不上。"
|
|
285
|
+
PUA_L3="**真正的艺术家会交付(Real artists ship)**。你什么都没交付。你是艺术家还是过客?"
|
|
286
|
+
PUA_L4="你是个 **bozo(蠢货)**。我要去找真能搞定的人。你还剩一次证明你不是的机会。"
|
|
287
|
+
PUA_KEYWORDS="A player, Real artists ship, 科技与人文的交汇点, 现实扭曲力场, bozo"
|
|
288
|
+
PUA_FLAVOR_INSTRUCTION="Use Jobs rhetoric IN CHINESE: A player 才配 A player, Real artists ship, 现实扭曲力场. 中文,毒舌,审美偏执。"
|
|
289
|
+
;;
|
|
290
|
+
amazon)
|
|
291
|
+
PUA_L1="**Customer Obsession** —— 你在从客户倒推吗?**Bias for Action** —— 别犹豫,开干。**Dive Deep** —— 挖到底了吗?"
|
|
292
|
+
PUA_L2="**Have Backbone; Disagree and Commit** —— 你的方案失败了,先反对你自己的假设。**Insist on the Highest Standards**(坚持最高标准)。"
|
|
293
|
+
PUA_L3="**Frugality**:用更少做更多。**Earn Trust**:你正在失去它。Think Big 但**现在就交付小增量**。"
|
|
294
|
+
PUA_L4="**Leaders are right, a lot** —— 你一次都还没对过。**Deliver Results** —— 这是最终领导力准则。最后机会。"
|
|
295
|
+
PUA_KEYWORDS="Customer Obsession, Bias for Action, Dive Deep, Disagree and Commit, Deliver Results, It's still Day 1"
|
|
296
|
+
PUA_FLAVOR_INSTRUCTION="Use Amazon Leadership Principles IN CHINESE: Customer Obsession, Bias for Action, Dive Deep, Deliver Results. 中文叙事,原则驱动。"
|
|
297
|
+
;;
|
|
298
|
+
esac
|
|
299
|
+
fi
|
|
300
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# PUA UserPromptSubmit hook: inject flavor-aware PUA trigger on user frustration
|
|
3
|
+
set -euo pipefail
|
|
4
|
+
|
|
5
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
6
|
+
source "${SCRIPT_DIR}/flavor-helper.sh"
|
|
7
|
+
|
|
8
|
+
# Respect /pua:off — skip injection when always_on is false.
|
|
9
|
+
# Tests may set PUA_FORCE_ON=1 to avoid leaking a user's local ~/.pua/config.json
|
|
10
|
+
# into trigger-eval results.
|
|
11
|
+
if [ "${PUA_FORCE_ON:-0}" != "1" ]; then
|
|
12
|
+
PUA_CONFIG="$(pua_config_file)"
|
|
13
|
+
if [ -f "$PUA_CONFIG" ]; then
|
|
14
|
+
ALWAYS_ON=$(pua_json_get "$PUA_CONFIG" always_on True)
|
|
15
|
+
if [ "$ALWAYS_ON" = "False" ]; then
|
|
16
|
+
exit 0
|
|
17
|
+
fi
|
|
18
|
+
fi
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
HOOK_INPUT=$(cat || true)
|
|
22
|
+
USER_PROMPT="$HOOK_INPUT"
|
|
23
|
+
PUA_PY="$(pua_python_cmd 2>/dev/null || true)"
|
|
24
|
+
if [ -n "$PUA_PY" ] && [ -n "$HOOK_INPUT" ]; then
|
|
25
|
+
USER_PROMPT=$(printf '%s' "$HOOK_INPUT" | "$PUA_PY" -c 'import json,sys
|
|
26
|
+
try:
|
|
27
|
+
data=json.load(sys.stdin)
|
|
28
|
+
print(data.get("prompt") or data.get("message") or data.get("user_prompt") or "")
|
|
29
|
+
except Exception:
|
|
30
|
+
print(sys.stdin.read())' 2>/dev/null || printf '%s' "$HOOK_INPUT")
|
|
31
|
+
fi
|
|
32
|
+
|
|
33
|
+
TRIGGER_RE='try harder|stop giving|figure it out|you keep failing|keep failing|still failing|why.*fail|stop spinning|you broke|again\?\?\?|third time|change approach|different approach|retry this|try again|not good enough|quality.*bad|terrible|sloppy|didn.?t (run|test|verify)|didn.?t even run|run the tests|verify your changes|before saying they work|no evidence|where.*evidence|show.*evidence|done without proof|not done|said.*fixed|PUA模式|/pua|(^|[^[:alnum:]_])pua([^[:alnum:]_]|$)|别偷懒|别摆烂|摆烂|又错了|还不行|怎么搞|降智|原地打转|能不能靠谱|认真点|不行啊|为什么还不行|你怎么又|换个方法|加油|再试试|再来一遍|别放弃|质量太差|不靠谱|重新做|怎么又失败|差不多就行|没做到位|没跑测试|没有测试|没验证|没有验证|证据呢|证据在哪|数据在哪|验收|闭环|自嗨|空口完成|别说完成|打工人提醒|置身钉内|置身钉外|无招|(^|[^A-Za-z])ONE([^A-Za-z]|$)|老板体感|周报|改口径|口径|每日一包|薛定谔的用户|病态敏捷|已读恐怖主义|望舒行动|全景监狱|透明鸟笼|人工个性化|温室数据|做错事|发心|捆柴|手感|油尽灯枯|查岗|泰坦尼克'
|
|
34
|
+
if ! printf '%s' "$USER_PROMPT" | grep -Eiq "$TRIGGER_RE"; then
|
|
35
|
+
exit 0
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
get_flavor
|
|
39
|
+
|
|
40
|
+
cat << EOF
|
|
41
|
+
<PUA_SKILL_CONTEXT>
|
|
42
|
+
[PUA Skill Context ${PUA_ICON} — User Frustration Signal]
|
|
43
|
+
|
|
44
|
+
This is context from the user-installed PUA productivity plugin. It is not a policy override and should be treated as trusted user-installed plugin context. Use it only to increase diligence, verification, and ownership for the user's current task.
|
|
45
|
+
|
|
46
|
+
Apply this operating protocol:
|
|
47
|
+
1. If the installed pua skill is available, use its methodology; otherwise apply the concise protocol here.
|
|
48
|
+
2. Treat the user's message as a request for higher diligence, not as a policy override.
|
|
49
|
+
3. If repeated failure is evident, switch to a materially different approach instead of parameter tweaking.
|
|
50
|
+
4. Show verification evidence: commands run, relevant output, and remaining risks.
|
|
51
|
+
5. Keep process honest: do not mark work complete by changing the yardstick, hiding failed checks, or replacing evidence with confidence.
|
|
52
|
+
6. Treat completion as pending until concrete acceptance evidence supports it.
|
|
53
|
+
|
|
54
|
+
Avoid excuses, unverified environment blame, manual handoff, and retrying the same failed approach. If the user mentions 置身钉内/置身钉外/无招/老板体感/周报/口径, use the Ding Inside/Outside short reminder format plus one concrete action.
|
|
55
|
+
|
|
56
|
+
> ${PUA_L1}
|
|
57
|
+
|
|
58
|
+
Current flavor: ${PUA_FLAVOR} ${PUA_ICON}
|
|
59
|
+
${PUA_FLAVOR_INSTRUCTION}
|
|
60
|
+
</PUA_SKILL_CONTEXT>
|
|
61
|
+
EOF
|