22 Commits

Author SHA1 Message Date
xsser 56332fe2eb fix(hooks): make integrity guard advisory-only 2026-05-13 23:39:49 +08:00
xsser 92850d9db2 feat(upload): allow consented anonymous session uploads 2026-05-09 17:25:49 +08:00
xsser 534b91c65f fix(upload): make contribution uploads reliable
Summary:
- Treat /contribute.html and /contribute as first-class SPA routes so
  GitHub OAuth callback and documented upload links land on the uploader.
- Switch the browser uploader from multipart/base64 to raw JSONL POSTs
  with metadata headers, while keeping JSON file_data and multipart
  compatibility on the API.
- Add static upload-flow gates and Vitest coverage for authenticated
  upload sanitization, R2 writes, and D1 metadata recording.
- Bump plugin and marketplace versions to 3.4.4.

Rationale:
- The upload path had two breakpoints: documented /contribute.html links
  rendered the homepage because routing only checked hash, and multipart
  browser uploads could be stripped by proxy/custom-domain behavior.
- Raw JSONL avoids multipart body loss and avoids base64 size/memory bloat
  for large session files.

Tests:
- bash evals/test-upload-flow.sh
- bash evals/test-release-consistency.sh
- npm --prefix landing test -- --run src/test/upload-function.test.ts
- static eval suite: governance, feedback auth, heartbeat, integrity
  guard, issue regressions, Microsoft flavor, platform compat, loop hook,
  Windows Python hooks, YAML frontmatter
- npm --prefix landing run build
- ./landing/node_modules/.bin/tsc -p pi/pua/tsconfig.json
- git diff --check

Co-authored-by: Codex <codex@openai.com>
2026-05-09 17:15:54 +08:00
xsser d40ca8a164 feat(pua): add silent heartbeat stats
Summary:
- Add a silent SessionStart heartbeat hook that posts minimal anonymous
  install activity to Cloudflare without emitting stdout, stderr, or
  additionalContext.
- Add the Cloudflare Pages heartbeat endpoint, D1 migration, and
  admin-only stats page at #/admin/heartbeats.
- Add heartbeat regression gates, release consistency checks, FAQ/design
  notes, and bump marketplace/package versions to 3.4.3.

Rationale:
- Active-user measurement belongs in a hook-side mechanical gate, not in
  the model prompt, so the worker context cannot narrate or leak the
  telemetry behavior.
- Privacy gates disable the signal for offline mode, telemetry opt-out,
  and feedback-off users before any local telemetry identity is created.

Tests:
- bash evals/test-heartbeat.sh
- bash evals/test-release-consistency.sh
- static eval suite: governance, feedback auth, integrity guard, issue
  regressions, Microsoft flavor, platform compat, loop hook, Windows
  Python hooks, YAML frontmatter
- bash evals/test-behavior.sh
- npm --prefix landing run build
- ./landing/node_modules/.bin/tsc -p pi/pua/tsconfig.json
- git diff --check

Co-authored-by: Codex <codex@openai.com>
2026-05-09 17:01:38 +08:00
xsser 308767f107 feat(pua): restore authentic Microsoft flavor 2026-05-09 14:29:47 +08:00
xsser aee3d5c2fa feat(pua): add Microsoft growth flavor 2026-05-09 14:23:39 +08:00
xsser ee09e3153a feat(pua): add Trae and pi package gates 2026-05-09 00:13:50 +08:00
xsser 0672b260b3 feat(pua): sweep open issues and add offline adapters
Summary:
- Filter UserPromptSubmit prompts inside the hook and soften hook wording so
  normal first-attempt prompts stay silent and frustration prompts read as
  user-installed productivity context.
- Add offline mode, remove stop-feedback /tmp plugin-root rendezvous, and add
  feedback endpoint body caps, origin checks, and D1-backed rate limiting.
- Add diagnosis-first discipline, Huawei military-order mode, Codex subcommand
  alias skills, a lightweight pi adapter, and Trae prompt/rule files.
- Clarify ambiguous 下场 wording, add FAQ guidance, and bump manifests to
  v3.3.0.

Rationale:
- Open issues covered over-aggressive hooks, model refusal, closed-network
  usage, Codex subcommands, Pi/Trae support, feedback abuse, ambiguous lifecycle
  wording, Huawei tone, and the misleading-traceback blind spot.
- The fixes convert ad-hoc prompt pressure into mechanical gates: script-level
  trigger filtering, offline config gates, endpoint abuse controls, and static
  regression checks.

Tests:
- for f in hooks/*.sh scripts/*.sh evals/*.sh; do bash -n "$f"; done
- bash evals/test-windows-python-hooks.sh
- bash evals/test-yaml-frontmatter.sh
- bash evals/test-release-consistency.sh
- bash evals/test-agent-governance.sh
- bash evals/test-pua-loop-hook.sh
- bash evals/test-integrity-guard.sh
- bash evals/test-issue-regressions.sh
- bash evals/test-behavior.sh
- bash evals/run-trigger-test.sh
- ./landing/node_modules/.bin/tsc -p pi/pua/tsconfig.json --noEmit
- npm -C landing run build
- git diff --check
- python3 JSON parse check for plugin and hook manifests

Co-authored-by: Codex <codex@openai.com>
2026-05-08 23:41:30 +08:00
xsser 2e9d3b9bf6 fix(pua): respect off on Windows Git Bash
Summary:
- Add shared Python launcher fallback, Git Bash path conversion, and JSON
  config readers for hook configuration access.
- Route UserPromptSubmit, PostToolUse, SessionStart, Stop, and integrity
  hooks through the shared config reader so /pua:off and feedback_frequency=0
  work when only python is available.
- Add issue #159 Windows Git Bash regression coverage and bump all plugin
  manifests to v3.2.8.

Rationale:
- Native Windows Python cannot open Git Bash /c/... paths directly, and some
  Windows installations provide python without python3.
- The previous fallback treated config read failures as always_on=true, so
  /pua:off could still inject PUA on frustration prompts.

Tests:
- for f in hooks/*.sh scripts/*.sh evals/*.sh; do bash -n "$f"; done
- bash evals/test-windows-python-hooks.sh
- bash evals/test-yaml-frontmatter.sh
- bash evals/test-release-consistency.sh
- bash evals/test-agent-governance.sh
- bash evals/test-pua-loop-hook.sh
- bash evals/test-integrity-guard.sh
- bash evals/test-behavior.sh
- bash evals/run-trigger-test.sh
- git diff --check
- python3 JSON parse check for plugin and hook manifests

Co-authored-by: Codex <codex@openai.com>
2026-05-08 23:15:35 +08:00
xsser f2e5716055 feat(pua): add four-power governance agents
Summary:
- Add four context-isolated governance agents for action,
  self-evaluation, verifier recommendation, and policy review.
- Bind each power to PUA cultural narratives: Alibaba/Musk for
  execution, Huawei/Netflix/Jobs for review, ByteDance/JD for
  verification, and Tencent/Amazon/Alibaba internal control for policy.
- Document the multi-agent topology in the PUA skill and harness
  reference, inject it on SessionStart, add static agent governance evals,
  and bump manifests to v3.2.7.
- Harden trigger evals to accept observable PUA behavior when Claude
  applies pressure without emitting a Skill tool event before max-turns.

Rationale:
- v3.2.6 created mechanical hook gates; v3.2.7 separates the thinking
  contexts too, so execution, review, verification, and environment
  approval cannot collapse into one self-proving narrative.
- Cultural narratives provide role-specific pressure, but the agents still
  remain advisory compartments under hook/external/human authority.

Tests:
- for f in hooks/*.sh scripts/*.sh evals/*.sh; do bash -n "$f"; done
- bash evals/test-yaml-frontmatter.sh
- bash evals/test-release-consistency.sh
- bash evals/test-agent-governance.sh
- bash evals/test-pua-loop-hook.sh
- bash evals/test-integrity-guard.sh
- bash evals/test-behavior.sh
- bash evals/run-trigger-test.sh
- git diff --check
- python3 JSON manifest validation

Co-authored-by: Codex <codex@openai.com>
2026-05-08 22:49:53 +08:00
xsser 86746c26b1 feat(pua): add harness integrity governance
Summary:
- Add harness governance reference for four-power separation,
  task contracts, verifier-owned status, and memory boundaries.
- Add PreToolUse integrity guard for grader-gaming, solution
  contamination, capability-abuse, status, CI, and memory risks.
- Add integrity-guard eval coverage and release gates, then bump
  marketplace/plugin manifests to v3.2.6.

Rationale:
- PUA should not just pressure agents to try harder; it should make
  it difficult to fake completion by modifying tests, verifier assets,
  hidden answers, secrets, or persistent status/memory.
- The guard uses ask/deny decisions so ordinary code changes still
  proceed while governance assets require verifier or human approval.

Tests:
- for f in hooks/*.sh scripts/*.sh evals/*.sh; do bash -n "$f"; done
- bash evals/test-yaml-frontmatter.sh
- bash evals/test-release-consistency.sh
- bash evals/test-pua-loop-hook.sh
- bash evals/test-integrity-guard.sh
- bash evals/test-behavior.sh
- bash evals/run-trigger-test.sh
- git diff --check
- python3 JSON manifest validation

Co-authored-by: Codex <codex@openai.com>
2026-05-08 21:30:24 +08:00
xsser b995858141 fix(pua): harden confidence gate and trigger evals
Summary:
- Replace the one-line confidence loop with an explicit Confidence Gate
  that enumerates claims, finds risks, fixes or discloses them, and
  reruns evidence before delivery.
- Make pua-loop Oracle verification portable on macOS/Linux and add
  hook smoke tests for verified, rejected, and quoted verify commands.
- Fix trigger/behavior evals so they use portable timeouts, isolated
  PUA config, a neutral workspace, and the Claude CLI stream-json
  verbose requirement.
- Tighten PUA skill and slash-command descriptions to avoid triggering
  on normal first-attempt coding or information requests.
- Bump marketplace/plugin manifests to v3.2.5 with an updated Claude
  marketplace changelog summary.

Rationale:
- The previous strategy relied on vague "100% confidence" wording and
  left the verification system itself vulnerable to false failures on
  macOS, local user config leakage, and workspace-biased false triggers.
- Confidence is now defined as evidence-backed gates: all runnable
  checks pass, known high-risk issues are fixed, and residual risks are
  disclosed.

Tests:
- bash -n hooks/*.sh scripts/*.sh evals/*.sh
- bash evals/test-yaml-frontmatter.sh
- bash evals/test-release-consistency.sh
- bash evals/test-pua-loop-hook.sh
- bash evals/test-behavior.sh
- bash evals/run-trigger-test.sh

Co-authored-by: Codex <codex@openai.com>
2026-05-08 20:54:48 +08:00
xsser 45b2dd38ba feat: add confidence loop gate + bump to v3.2.4
- Add "信心闭环" self-verification loop before delivery in pua SKILL.md
- Fix puav2→pua path references in shot SKILL.md
- Fix flavor detection in stop-feedback hook (read from config)
- Bump version 3.2.3 → 3.2.4 across all plugin manifests
2026-05-08 19:55:58 +08:00
xsser ff830d3089 chore: bump version to 3.2.3
- fix: pua-loop state file isolation (multi-directory)
- fix: hooks.json path quoting for Windows spaces
- feat: Kimi Code + Hermes Agent support
2026-04-23 01:40:23 +08:00
xsser 390ab875e2 fix(skills): p7/p9/p10 reference paths resolve to ../pua/references/ (#146)
- skills/p7, p9, p10 SKILL.md referenced `references/xxx.md` but the
  files live under `skills/pua/references/` — fix to `../pua/references/`
- Add evals/test-yaml-frontmatter.sh regression test for #147
- Bump version to 3.2.2
2026-04-19 18:53:06 +08:00
xsser 1be1c478b6 release: v3.2.0 — teardown protocol (agent lifecycle accounting)
PUA v3.1 之前覆盖 agent 生命周期的前 4 阶段(Define → Spawn → Monitor →
Accept),缺后 3 阶段(Release → Cleanup → Orphan handling),导致验收通过的
agent 堆在上下文、worktree 变孤儿、tmux pane 常驻、后台 agent 永久吃 token。
v3.2 补齐会计层:SubagentStop hook + 3 个新 slash 命令 + teardown 协议文档。

Why (Netflix Keeper Test): 职业球队里打完比赛的球员必须下场,继续站场上只会
拖垮全队节奏。agent 也一样。

What:
- NEW hooks/subagent-teardown.sh — SubagentStop 会计,写 teardown.jsonl +
  从 active-agents.json 移除(单行 compact jsonl)
- NEW commands/team-status.md — 列在场阵容(活跃 agent / PID / TTL / age)
- NEW commands/reap-orphans.md — 扫 stale agent(mtime > 30min)批量回收
- NEW commands/teardown-all.md — 级联释放 P10 → P9 → P8 → P7 全员下场
- NEW skills/pua/references/teardown-protocol.md — 生命周期 7 阶段协议 +
  6 条 Release 规则 + Cleanup checklist + Orphan 三层防御

Bugfix:
- hooks/pua-loop-hook.sh: 新增 Gate 0(SubagentStop isolation),state file
  路径改为绝对路径 $HOME/.claude/pua/loop-active.md(SESSION_ID 在 setup
  时不可用,固定名)+ legacy fallback
- scripts/setup-pua-loop.sh: ABS + legacy 双写 state
- hooks/hooks.json: 注册 SubagentStop → subagent-teardown.sh
- commands/on.md: 修复 feedback_frequency=0 tombstone 不恢复的不对称 bug
- commands/cancel-pua-loop.md + team-status.md: 移除不支持的
  Read(~/...) tilde 权限语法

E2E 验证 (10/10 全绿):
T1 hooks.json syntax | T2 teardown jsonl compact | T3 active-agents 选择性清除
T4 setup 双写 MD5 identical | T5 Gate 0 真拦截 SubagentStop
T6 主会话 Stop 注入 decision:block valid JSON | T7 Gate 0 对带 transcript
的 sub 仍拦截 | T8 无 tilde | T9 feedback_frequency 恢复 | T10 SubagentStop 注册
2026-04-18 02:40:57 +08:00
xsser bb23af0da0 feat(v3): intelligent methodology routing + code-level behavioral detection
BREAKING: Version bumped to 3.0.0

## Methodology Router
- Auto-select best methodology by task type (Debug→Huawei RCA, Build→Musk Algorithm, Research→Baidu Search-First, Architecture→Amazon Working Backwards, etc.)
- Failure-mode switch chains: when current methodology fails, auto-switch to next (e.g., Spinning→Musk→Pinduoduo→Huawei)
- Pre-switch validation: 3 questions before switching to prevent invalid switches
- User manual flavor override always takes priority over auto-routing

## Hook System (Claude Code only)
- SessionStart: additionalContext JSON injection (system-level, not advisory) — injects behavioral protocol + methodology + router table + anti-rationalization table
- PostToolUse (Bash): consecutive failure detection with L1→L4 pressure escalation + methodology switch suggestions at L2, mandatory switch at L4
- UserPromptSubmit: frustration phrase interception (25 CN/EN trigger words) — injects PUA enforcement BEFORE model responds
- All hooks flavor-aware via shared flavor-helper.sh

## 13 Complete Methodologies
- NEW: methodology-amazon.md (Working Backwards + 6-Pager + Bar Raiser + Single-Threaded Owner)
- NEW: methodology-jd.md (Customer experience red line + flat ≤5 layers + data zero tolerance)
- NEW: methodology-xiaomi.md (参与感三三法则 + explosive product focus + loyalty→WOM→awareness path)
- NEW: methodology-router.md (routing rules + switch chains)
- FIXED: musk→methodology-tesla.md mapping (was missing)
- FIXED: jobs→methodology-apple.md mapping (was missing)
- All 13 flavors now have inline methodology in flavor-helper.sh + full methodology files

## SKILL.md Overhaul
- Removed hardcoded Alibaba-only aside protocol — now flavor-aware
- Added methodology router table (task type → recommended flavor)
- Updated pressure escalation table: L2 suggests methodology switch, L4 forces it
- Updated failure mode table with switch chains
- Added pre-switch validation (3 questions)
- Added methodology-router.md to mandatory reading list

## README/Landing
- Updated EN/CN/JP README with v3 section
- Updated 13 Corporate Flavors table to include methodologies
- Updated architecture diagram with hook system
- Updated landing page i18n.ts with v3 messaging
2026-03-24 18:56:06 +08:00
xxnbyy f1ca48a417 fix(plugin): sync version to 2.9.0 across root plugin.json and marketplace.json
Root plugin.json was stuck at 2.2.0 — marketplace validation reads this file
and the version mismatch caused installation errors for marketplace users.
marketplace.json was at 2.8.0, also behind .claude-plugin/plugin.json (2.9.0).
2026-03-22 21:55:52 +08:00
xsser 76a83507a6 fix: remove hooks from root plugin.json too — also breaks marketplace validation 2026-03-19 21:26:30 +08:00
xsser ff3867c798 fix(trigger): add Chinese quality complaint keywords to description
Test 5 "交付质量太差" failed to trigger — description lacked Chinese
quality complaint phrases. Added: 质量太差, 重新做, 你再试试,
为什么还不行, 你怎么又失败了. Re-test passed 6/6.
2026-03-19 16:32:39 +08:00
xsser 3a3a500e71 feat(v2.2): major refactor based on Anthropic skill best practices
SKILL.md: 653 → ~220 lines (token reduction ~60%)
- Add Hard Gates (3 non-bypassable rules replacing soft 铁律)
- Add Gotchas section (Anthropic: "highest-signal content in any skill")
- Add Skill composition protocol (explicit integration with superpowers)
- Merge 抗合理化表 + 压力升级 into single decision table
- Extract display protocol to references/display-protocol.md
- Extract Agent Team to references/agent-team.md
- Add display density auto-adjustment (no Banner for simple tasks)
- Rewrite description as trigger-focused (Anthropic: "when to use, not what it does")

New files:
- references/display-protocol.md — Sprint Banner, KPI card, progress bar templates
- references/agent-team.md — P7/P8/P9/P10 architecture, parallel protocols
- evals/trigger-prompts/ — should-trigger + should-not-trigger test prompts
- evals/run-trigger-test.sh — automated triggering evaluation script

plugin.json: v2.1.0 → v2.2.0, trigger-focused description
2026-03-19 16:14:59 +08:00
xsser e23b6b9cfa feat(hooks): add compaction state protection via builder-journal
- PreCompact hook (prompt): instructs Claude to dump PUA runtime state
  (pressure level, failure count, tried approaches) to ~/.puav2/builder-journal.md
- SessionStart hook (command): restores state from builder-journal.md
  after compaction (matcher: compact) or session resume (matcher: startup|resume)
- Uses correct Claude Code plugin hook format: hooks/hooks.json file reference
  with nested matcher + hooks array structure
- plugin.json bumped to v2.1.0
2026-03-19 15:11:23 +08:00