continuous-improvement 3.12.3 → 3.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +31 -1
  3. package/LICENSE +21 -21
  4. package/QUICKSTART.md +1 -1
  5. package/README.md +25 -5
  6. package/bin/analyze.sh +161 -161
  7. package/bin/backfill.mjs +19 -19
  8. package/bin/check-doc-runtime-claims.mjs +0 -0
  9. package/bin/check-docs-substrings.mjs +0 -0
  10. package/bin/check-everything-mirror.mjs +0 -0
  11. package/bin/check-routing-targets.mjs +0 -0
  12. package/bin/check-scripts-citation-drift.mjs +0 -0
  13. package/bin/check-skill-count.mjs +32 -1
  14. package/bin/check-skill-law-tag.mjs +0 -0
  15. package/bin/check-skill-mirror.mjs +0 -0
  16. package/bin/check-skill-tiers.mjs +0 -0
  17. package/bin/check-test-imports-only.mjs +1 -1
  18. package/bin/check-third-party-shape.mjs +0 -0
  19. package/bin/check-tool-count.mjs +0 -0
  20. package/bin/companion-preference-status.mjs +0 -0
  21. package/bin/gateguard-clear.mjs +0 -0
  22. package/bin/generate-plugin-manifests.mjs +2 -1
  23. package/bin/harvest-friction.mjs +0 -0
  24. package/bin/hook-stats.mjs +21 -21
  25. package/bin/install.mjs +74 -1
  26. package/bin/lint-transcript.mjs +0 -0
  27. package/bin/mcp-server.mjs +65 -8
  28. package/bin/observe.mjs +0 -0
  29. package/bin/plan-pack.mjs +77 -0
  30. package/bin/pre-commit-block-strays.sh +0 -0
  31. package/bin/refresh-third-party.mjs +0 -0
  32. package/bin/unified-cli.mjs +55 -410
  33. package/commands/continuous-improvement.md +115 -115
  34. package/commands/dashboard.md +56 -56
  35. package/commands/model-forward.md +13 -0
  36. package/commands/production-readiness-review.md +53 -0
  37. package/commands/seven-laws.md +16 -16
  38. package/commands/ship.md +57 -0
  39. package/commands/workspace-surface-audit.md +77 -77
  40. package/hooks/companion-preference.mjs +31 -19
  41. package/hooks/gateguard.mjs +38 -16
  42. package/hooks/goal-drift-stop.mjs +0 -0
  43. package/hooks/hook-pack.mjs +110 -0
  44. package/hooks/observe.sh +0 -0
  45. package/hooks/recall-briefing.mjs +0 -0
  46. package/hooks/route-prompt.mjs +0 -0
  47. package/hooks/session.sh +106 -106
  48. package/hooks/three-section-close.mjs +0 -0
  49. package/instinct-packs/go.json +58 -58
  50. package/instinct-packs/meta.json +16 -16
  51. package/instinct-packs/python.json +58 -58
  52. package/instinct-packs/react.json +58 -58
  53. package/lib/cli-anything.mjs +0 -0
  54. package/lib/gateguard-state.mjs +62 -13
  55. package/lib/goal-drift-gate.mjs +0 -0
  56. package/lib/goal-state.mjs +8 -4
  57. package/lib/hook-pack-gate.mjs +65 -0
  58. package/lib/install-targets.mjs +121 -0
  59. package/lib/observe-event.mjs +0 -0
  60. package/lib/plan-review-packet.mjs +96 -0
  61. package/lib/plugin-metadata.mjs +23 -2
  62. package/lib/pm-marketplace.mjs +0 -0
  63. package/lib/recall-briefing.mjs +0 -0
  64. package/lib/recall-index.mjs +0 -0
  65. package/lib/resolve-home-dir.mjs +0 -0
  66. package/lib/skill-distill.mjs +141 -0
  67. package/lib/skill-tiers.mjs +0 -0
  68. package/llms.txt +2 -2
  69. package/package.json +4 -3
  70. package/plugins/beginner.json +2 -2
  71. package/plugins/continuous-improvement/.claude-plugin/marketplace.json +2 -2
  72. package/plugins/continuous-improvement/.claude-plugin/plugin.json +2 -2
  73. package/plugins/continuous-improvement/LICENSE +21 -21
  74. package/plugins/continuous-improvement/README.md +1 -1
  75. package/plugins/continuous-improvement/bin/backfill.mjs +19 -19
  76. package/plugins/continuous-improvement/bin/gateguard-clear.mjs +0 -0
  77. package/plugins/continuous-improvement/bin/mcp-server.mjs +65 -8
  78. package/plugins/continuous-improvement/bin/observe.mjs +0 -0
  79. package/plugins/continuous-improvement/commands/continuous-improvement.md +115 -115
  80. package/plugins/continuous-improvement/commands/dashboard.md +56 -56
  81. package/plugins/continuous-improvement/commands/model-forward.md +13 -0
  82. package/plugins/continuous-improvement/commands/production-readiness-review.md +53 -0
  83. package/plugins/continuous-improvement/commands/seven-laws.md +16 -16
  84. package/plugins/continuous-improvement/commands/ship.md +57 -0
  85. package/plugins/continuous-improvement/commands/workspace-surface-audit.md +77 -77
  86. package/plugins/continuous-improvement/hooks/companion-preference.mjs +31 -19
  87. package/plugins/continuous-improvement/hooks/gateguard.mjs +38 -16
  88. package/plugins/continuous-improvement/hooks/goal-drift-stop.mjs +0 -0
  89. package/plugins/continuous-improvement/hooks/hook-pack.mjs +110 -0
  90. package/plugins/continuous-improvement/hooks/hooks.json +10 -0
  91. package/plugins/continuous-improvement/hooks/observe.sh +0 -0
  92. package/plugins/continuous-improvement/hooks/recall-briefing.mjs +0 -0
  93. package/plugins/continuous-improvement/hooks/route-prompt.mjs +0 -0
  94. package/plugins/continuous-improvement/hooks/session.sh +106 -106
  95. package/plugins/continuous-improvement/hooks/three-section-close.mjs +0 -0
  96. package/plugins/continuous-improvement/instinct-packs/go.json +58 -58
  97. package/plugins/continuous-improvement/instinct-packs/meta.json +16 -16
  98. package/plugins/continuous-improvement/instinct-packs/python.json +58 -58
  99. package/plugins/continuous-improvement/instinct-packs/react.json +58 -58
  100. package/plugins/continuous-improvement/lib/gateguard-state.mjs +62 -13
  101. package/plugins/continuous-improvement/lib/goal-drift-gate.mjs +0 -0
  102. package/plugins/continuous-improvement/lib/goal-state.mjs +8 -4
  103. package/plugins/continuous-improvement/lib/hook-pack-gate.mjs +65 -0
  104. package/plugins/continuous-improvement/lib/observe-event.mjs +0 -0
  105. package/plugins/continuous-improvement/lib/plugin-metadata.mjs +23 -2
  106. package/plugins/continuous-improvement/lib/recall-briefing.mjs +0 -0
  107. package/plugins/continuous-improvement/lib/recall-index.mjs +0 -0
  108. package/plugins/continuous-improvement/lib/resolve-home-dir.mjs +0 -0
  109. package/plugins/continuous-improvement/lib/skill-distill.mjs +141 -0
  110. package/plugins/continuous-improvement/skills/README.md +1 -1
  111. package/plugins/continuous-improvement/skills/gateguard/SKILL.md +4 -4
  112. package/plugins/continuous-improvement/skills/goal-monitor/SKILL.md +1 -1
  113. package/plugins/continuous-improvement/skills/handoff/SKILL.md +0 -1
  114. package/plugins/continuous-improvement/skills/model-forward/SKILL.md +44 -0
  115. package/plugins/continuous-improvement/skills/tdd-workflow/SKILL.md +411 -411
  116. package/plugins/expert.json +5 -1
  117. package/skills/README.md +4 -2
  118. package/skills/gateguard.md +4 -4
  119. package/skills/goal-monitor.md +1 -1
  120. package/skills/handoff.md +0 -1
  121. package/skills/model-forward.md +44 -0
  122. package/skills/tdd-workflow.md +411 -411
  123. package/lib/compound-engineering.mjs +0 -831
  124. package/lib/pm-skills.mjs +0 -1274
  125. package/lib/unified-plugin.mjs +0 -924
  126. package/plugins/continuous-improvement/skills/para-memory-files/SKILL.md +0 -108
  127. package/skills/para-memory-files.md +0 -108
@@ -1,56 +1,56 @@
1
- ---
2
- name: dashboard
3
- description: Visual dashboard showing instinct health, observation stats, and learning progress
4
- ---
5
-
6
- # Instinct Dashboard
7
-
8
- Generate a visual dashboard for this project's continuous-improvement status.
9
-
10
- ## Instructions
11
-
12
- 1. **Find project hash:** Run `git rev-parse --show-toplevel 2>/dev/null`, then SHA-256 first 12 chars
13
- 2. **Read observations:** Count lines in `~/.claude/instincts/<hash>/observations.jsonl`
14
- 3. **Read instincts:** Load all `*.yaml` files from project dir + `global/`
15
- 4. **Read instinct packs:** Check if any packs from `instinct-packs/` have been loaded
16
-
17
- ## Display Format
18
-
19
- ```
20
- ╔══════════════════════════════════════════════════════════════╗
21
- ║ continuous-improvement Dashboard ║
22
- ╠══════════════════════════════════════════════════════════════╣
23
- ║ ║
24
- ║ Project: <name> Level: <CAPTURE|ANALYZE|...> ║
25
- ║ Sessions: ~<obs/10> Mode: <beginner|expert> ║
26
- ║ ║
27
- ║ ┌─ Observations ────────────────────────────────────────┐ ║
28
- ║ │ Total: <n> Unprocessed: <n> Last: <date> │ ║
29
- ║ └───────────────────────────────────────────────────────┘ ║
30
- ║ ║
31
- ║ ┌─ Instincts ───────────────────────────────────────────┐ ║
32
- ║ │ Total: <n> │ ║
33
- ║ │ ████████░░ Auto-apply (0.7+): <n> │ ║
34
- ║ │ █████░░░░░ Suggest (0.5-0.69): <n> │ ║
35
- ║ │ ██░░░░░░░░ Silent (< 0.5): <n> │ ║
36
- ║ │ Global: <n> Project: <n> │ ║
37
- ║ └───────────────────────────────────────────────────────┘ ║
38
- ║ ║
39
- ║ ┌─ Top Instincts ───────────────────────────────────────┐ ║
40
- ║ │ <list top 5 instincts by confidence with bars> │ ║
41
- ║ └───────────────────────────────────────────────────────┘ ║
42
- ║ ║
43
- ║ ┌─ Health ──────────────────────────────────────────────┐ ║
44
- ║ │ Stale (30+ days): <n> Decaying: <n> │ ║
45
- ║ │ Recently reinforced: <n> │ ║
46
- ║ └───────────────────────────────────────────────────────┘ ║
47
- ║ ║
48
- ╚══════════════════════════════════════════════════════════════╝
49
- ```
50
-
51
- ## After Display
52
-
53
- - If stale instincts > 0: suggest reviewing them
54
- - If unprocessed observations > 20: suggest running analysis
55
- - If no instincts exist: explain the auto-leveling timeline
56
- - Show available instinct packs that haven't been loaded yet
1
+ ---
2
+ name: dashboard
3
+ description: Visual dashboard showing instinct health, observation stats, and learning progress
4
+ ---
5
+
6
+ # Instinct Dashboard
7
+
8
+ Generate a visual dashboard for this project's continuous-improvement status.
9
+
10
+ ## Instructions
11
+
12
+ 1. **Find project hash:** Run `git rev-parse --show-toplevel 2>/dev/null`, then SHA-256 first 12 chars
13
+ 2. **Read observations:** Count lines in `~/.claude/instincts/<hash>/observations.jsonl`
14
+ 3. **Read instincts:** Load all `*.yaml` files from project dir + `global/`
15
+ 4. **Read instinct packs:** Check if any packs from `instinct-packs/` have been loaded
16
+
17
+ ## Display Format
18
+
19
+ ```
20
+ ╔══════════════════════════════════════════════════════════════╗
21
+ ║ continuous-improvement Dashboard ║
22
+ ╠══════════════════════════════════════════════════════════════╣
23
+ ║ ║
24
+ ║ Project: <name> Level: <CAPTURE|ANALYZE|...> ║
25
+ ║ Sessions: ~<obs/10> Mode: <beginner|expert> ║
26
+ ║ ║
27
+ ║ ┌─ Observations ────────────────────────────────────────┐ ║
28
+ ║ │ Total: <n> Unprocessed: <n> Last: <date> │ ║
29
+ ║ └───────────────────────────────────────────────────────┘ ║
30
+ ║ ║
31
+ ║ ┌─ Instincts ───────────────────────────────────────────┐ ║
32
+ ║ │ Total: <n> │ ║
33
+ ║ │ ████████░░ Auto-apply (0.7+): <n> │ ║
34
+ ║ │ █████░░░░░ Suggest (0.5-0.69): <n> │ ║
35
+ ║ │ ██░░░░░░░░ Silent (< 0.5): <n> │ ║
36
+ ║ │ Global: <n> Project: <n> │ ║
37
+ ║ └───────────────────────────────────────────────────────┘ ║
38
+ ║ ║
39
+ ║ ┌─ Top Instincts ───────────────────────────────────────┐ ║
40
+ ║ │ <list top 5 instincts by confidence with bars> │ ║
41
+ ║ └───────────────────────────────────────────────────────┘ ║
42
+ ║ ║
43
+ ║ ┌─ Health ──────────────────────────────────────────────┐ ║
44
+ ║ │ Stale (30+ days): <n> Decaying: <n> │ ║
45
+ ║ │ Recently reinforced: <n> │ ║
46
+ ║ └───────────────────────────────────────────────────────┘ ║
47
+ ║ ║
48
+ ╚══════════════════════════════════════════════════════════════╝
49
+ ```
50
+
51
+ ## After Display
52
+
53
+ - If stale instincts > 0: suggest reviewing them
54
+ - If unprocessed observations > 20: suggest running analysis
55
+ - If no instincts exist: explain the auto-leveling timeline
56
+ - Show available instinct packs that haven't been loaded yet
@@ -0,0 +1,13 @@
1
+ ---
2
+ name: model-forward
3
+ description: Restate the model-forward stance — go with Claude, not against it; skills are scaffolding; the durable core is goal-driven execution plus guardrails.
4
+ ---
5
+
6
+ # /model-forward
7
+
8
+ Load the `model-forward` skill and apply its stance to the current session.
9
+
10
+ 1. Restate the two invariants: goal-driven execution (anchor on the highest stated goal) and self-discipline guardrails (the 7 Laws).
11
+ 2. Audit the current task for places where custom scaffolding fights a native Claude Code capability; list each with the native alternative.
12
+ 3. Apply the decision rules from the skill before adding any new skill, hook, or wrapper to the workflow.
13
+ 4. Close with one line naming which native capability was preferred, which scaffold (if any) was proposed for retirement, and that the operator decides.
@@ -0,0 +1,53 @@
1
+ ---
2
+ name: production-readiness-review
3
+ description: "Parallel multi-agent readiness gate — fan blind reviewers across performance, security, UI/UX, and test coverage, each grounding findings in real code/logs/live data, then reconcile into one deduplicated, severity-ranked punch-list. Reports only; never fixes, merges, or deploys."
4
+ ---
5
+
6
+ # /production-readiness-review
7
+
8
+ The review-side sibling of `/ship`. Fans a set of blind, specialized reviewers across distinct dimensions, then reconciles their findings into a single prioritized punch-list. It reports — it does not fix. Fixing a finding is a separate `/ship` run.
9
+
10
+ Pure routing over existing skills and agents. Adds no new code.
11
+
12
+ ## Usage
13
+
14
+ ```
15
+ /production-readiness-review [scope]
16
+ ```
17
+
18
+ `scope` defaults to the current branch diff against `origin/main`. Pass a path or PR number to narrow it.
19
+
20
+ ## Behavior
21
+
22
+ 1. **Scope** — establish ground truth: the diff under review and which changes are recent (`git diff`; `reconcile` fallback for branch/base state). Recent changes get extra scrutiny because they are the likeliest source of self-inflicted defects.
23
+ 2. **Fan out** — `superpowers:dispatching-parallel-agents` launches four reviewers, each blind to the others. Every reviewer is instructed to ground each finding in real code, logs, or live queries, and never to assume or fabricate state:
24
+ - **Performance & bundle-size** — hot paths, N+1 queries, unbounded work, regressions.
25
+ - **Security & data-access** (`security-auditor`) — authn/authz, input handling, injection, secret exposure, unsafe data access.
26
+ - **UI/UX correctness** — verified live with Playwright when the MCP is available, else static review of the changed surface.
27
+ - **Test coverage & flaky/stale mocks** (`test-engineer`) — uncovered branches, stale mocks, timing-flaky tests.
28
+ 3. **Reconcile** — a final pass dedupes findings across reviewers, ranks each CRITICAL / HIGH / MEDIUM / LOW by severity and confidence, and explicitly flags any defect introduced by the changes under review.
29
+ 4. **Present** — emit the consolidated punch-list, severity-ranked, with file references. **Stop.**
30
+
31
+ ## Hard stops (report, never act)
32
+
33
+ - Does not fix, edit, commit, merge, or deploy anything — output is a punch-list only.
34
+ - A reviewer that cannot ground a finding marks it `unverified` rather than asserting it.
35
+ - If a dimension's tooling is unavailable (e.g. no Playwright MCP), it says so rather than silently skipping coverage.
36
+
37
+ ## Anti-patterns this command refuses
38
+
39
+ - **Fabricated state.** No finding may rest on an assumed SHA, row, or log line — ground it or mark it `unverified`.
40
+ - **Silent skip.** A dimension that cannot run is reported as not-run, never dropped from the summary.
41
+ - **Drive-by fix.** Findings become `/ship` tasks; this command does not touch code.
42
+
43
+ ## Composition
44
+
45
+ Routes through: `reconcile` (scope/ground truth) → `superpowers:dispatching-parallel-agents` (fan-out) → the `security-auditor` and `test-engineer` agents (two of the four dimensions) → a reconciliation pass that ranks and dedupes. Each step falls back to its inline behavior when the preferred skill or agent is not installed.
46
+
47
+ ## Example
48
+
49
+ ```
50
+ /production-readiness-review #246
51
+ ```
52
+
53
+ Scopes PR #246's diff, fans four blind reviewers across performance, security, UI/UX, and test coverage, then returns one deduplicated severity-ranked punch-list — flagging anything the PR's own changes introduced — and stops for you to prioritize.
@@ -1,16 +1,16 @@
1
- ---
2
- name: seven-laws
3
- description: "Brand-aligned alias for /continuous-improvement. Reflect on the current session, analyze observations for patterns, and show instinct status under the 7 Laws of AI Agent Discipline."
4
- ---
5
-
6
- # /seven-laws
7
-
8
- Brand-aligned alias for [`/continuous-improvement`](continuous-improvement.md). Both commands run the exact same three-step workflow under the 7 Laws of AI Agent Discipline:
9
-
10
- 1. **Reflect** (Law 5) — generate a reflection block for this session.
11
- 2. **Analyze** (Law 7) — process pending observations into instincts.
12
- 3. **Status** — show all instincts for the project + global with confidence and current level.
13
-
14
- Run the workflow defined in [`continuous-improvement.md`](continuous-improvement.md). Subcommands `weekly` and `always-on` work identically.
15
-
16
- `/continuous-improvement` remains supported indefinitely for backward compatibility. Prefer `/seven-laws` going forward — it matches the brand and the SKILL.md spec.
1
+ ---
2
+ name: seven-laws
3
+ description: "Brand-aligned alias for /continuous-improvement. Reflect on the current session, analyze observations for patterns, and show instinct status under the 7 Laws of AI Agent Discipline."
4
+ ---
5
+
6
+ # /seven-laws
7
+
8
+ Brand-aligned alias for [`/continuous-improvement`](continuous-improvement.md). Both commands run the exact same three-step workflow under the 7 Laws of AI Agent Discipline:
9
+
10
+ 1. **Reflect** (Law 5) — generate a reflection block for this session.
11
+ 2. **Analyze** (Law 7) — process pending observations into instincts.
12
+ 3. **Status** — show all instincts for the project + global with confidence and current level.
13
+
14
+ Run the workflow defined in [`continuous-improvement.md`](continuous-improvement.md). Subcommands `weekly` and `always-on` work identically.
15
+
16
+ `/continuous-improvement` remains supported indefinitely for backward compatibility. Prefer `/seven-laws` going forward — it matches the brand and the SKILL.md spec.
@@ -0,0 +1,57 @@
1
+ ---
2
+ name: ship
3
+ description: "Single-defect fast path — walk one bug from ground-truth audit through a TDD fix, full verification, a single-concern commit, and an open PR, then stop. Never auto-merges, never deploys. For multi-PR rollouts use /release-train instead."
4
+ ---
5
+
6
+ # /ship
7
+
8
+ The one-defect fast path. `/release-train` is for stacked multi-PR rollouts and `/proceed-with-the-recommendation` walks an arbitrary recommendation list; `/ship` is the common case: fix one defect, open one PR, hand it back for review.
9
+
10
+ Pure routing over existing skills. It adds no new orchestration logic and it does NOT bypass branch protection, force-push, auto-merge, or deploy.
11
+
12
+ ## Usage
13
+
14
+ ```
15
+ /ship <one-line description of the defect>
16
+ ```
17
+
18
+ If the description is ambiguous or names more than one concern, `/ship` halts and asks you to narrow it — one defect per run.
19
+
20
+ ## Behavior
21
+
22
+ In order, for the single defect:
23
+
24
+ 1. **Ground truth** — `reconcile` (or its inline fallback): confirm the working tree is clean and on a feature branch cut from an up-to-date `origin/<base>`. If on a protected branch or a stale base, halt and ask.
25
+ 2. **Reproduce (RED)** — `tdd-workflow`: write a failing test that reproduces the defect; watch it fail. Pre-test implementation code is deleted, not kept.
26
+ 3. **Fix (GREEN)** — write the minimal change that makes the test pass; watch it pass. One concern only.
27
+ 4. **Verify** — `verification-loop`: run the project's verify ladder (build, types, tests). Build-green is evidence of mechanism, not of the fix — confirm the defect itself no longer reproduces.
28
+ 5. **Commit** — one commit, one concern, staged by explicit filename (never `git add -A`). Use a Windows-safe commit message: a single-line `-m` (repeat `-m` for paragraphs) or `git commit -F <tempfile>` — no multi-line here-docs/here-strings.
29
+ 6. **Open PR** — `commit-commands:commit-push-pr` (or `gh pr create`): push the branch and open a single-concern PR that cites the plan or issue. **Stop here.** The merge is yours.
30
+ 7. **Deploy receipt (advisory)** — after you merge, `deploy-receipt` verifies the deployed SHA matches the merge SHA. Advisory only; `/ship` does not deploy.
31
+
32
+ ## Hard stops (halt and ask, never improvise)
33
+
34
+ - Ambiguous or multi-concern defect description.
35
+ - Working tree not clean, or branch is protected / cut from a stale base.
36
+ - Any verification step fails with a non-obvious fix.
37
+ - The fix would touch more than 15 non-generated files (that is no longer one concern — split it, or use `/release-train`).
38
+ - Push would target a protected branch.
39
+
40
+ ## Anti-patterns this command refuses
41
+
42
+ - **Auto-merge.** Never merges the PR it opens, even when CI is green.
43
+ - **Deploy.** Never runs a deploy; `deploy-receipt` only verifies after you merge.
44
+ - **Bypass.** No `--admin`, `--force`, `--no-verify`.
45
+ - **Bundled concerns.** Will not fold an unrelated fix into the same commit; logs it as a deferred follow-up instead.
46
+
47
+ ## Composition
48
+
49
+ Routes through, in order: `reconcile` → `tdd-workflow` → `verification-loop` → `commit-commands:commit-push-pr` → `deploy-receipt`. Each step falls back to its inline behavior when the preferred skill is not installed.
50
+
51
+ ## Example
52
+
53
+ ```
54
+ /ship registration form accepts a negative deposit amount
55
+ ```
56
+
57
+ Reconciles git state, writes a failing test asserting deposits must be positive, implements the guard, runs the verify ladder, commits one concern with a single-line message, opens the PR, and stops for your review.
@@ -1,77 +1,77 @@
1
- ---
2
- name: workspace-surface-audit
3
- description: "Audit workspace capabilities and recommend continuous-improvement-native skills, hooks, and workflows"
4
- ---
5
-
6
- # /workspace-surface-audit
7
-
8
- Audit the active repo, MCP servers, plugins, connectors, env surfaces, and harness setup. Returns a 5-section report with specific next moves.
9
-
10
- ## Usage
11
-
12
- ```
13
- /workspace-surface-audit
14
- ```
15
-
16
- ## What It Checks
17
-
18
- 1. **Repo surface** — `package.json`, lockfiles, framework config, `.mcp.json`, `.claude/settings*.json`, `AGENTS.md`
19
- 2. **Environment surface** — `.env*` files (key names only, no secrets)
20
- 3. **Connected tools** — installed plugins, MCP servers, LSPs, app integrations
21
- 4. **continuous-improvement surface** — existing skills, commands, hooks, agents
22
-
23
- ## Output Format
24
-
25
- ```
26
- === Workspace Surface Audit ===
27
-
28
- ## Current Surface
29
- - [What is usable right now]
30
-
31
- ## Parity
32
- - [Where continuous-improvement matches or exceeds benchmarks]
33
-
34
- ## Primitive-Only Gaps
35
- - [Tools exist, but continuous-improvement lacks clean operator skills]
36
-
37
- ## Missing Integrations
38
- - [Capabilities not available yet]
39
-
40
- ## Top 3-5 Next Moves
41
- 1. [Concrete continuous-improvement-native addition]
42
- 2. [Ordered by impact]
43
- ```
44
-
45
- ## Rules
46
-
47
- - **Never print secrets** — only provider names, capability names, file paths
48
- - **Prefer continuous-improvement** over generic "install another plugin" advice
49
- - **Organize by workflows**, not API brands
50
- - **Specific recommendations** — concrete enough to implement without another discovery pass
51
-
52
- ## Example Output
53
-
54
- ```
55
- ## Current Surface
56
- - MCP: filesystem, github, playwright
57
- - Plugins: beginner, expert (continuous-improvement)
58
- - Env: STRIPE_API_KEY, FAL_KEY configured
59
- - Framework: Next.js 15, React 19, TypeScript
60
-
61
- ## Parity
62
- - Continuous improvement: covered (native)
63
- - Testing discipline: covered (TDD workflows)
64
-
65
- ## Primitive-Only Gaps
66
- - Stripe connected but no billing-operator skill
67
- - GitHub MCP available but no issue-triage workflow
68
-
69
- ## Missing Integrations
70
- - No Linear connector detected
71
- - No Slack webhook configured
72
-
73
- ## Top 3-5 Next Moves
74
- 1. Create billing-operator skill (Stripe integration)
75
- 2. Create github-ops workflow for issue triage
76
- 3. Add Linear connector skill for project management
77
- ```
1
+ ---
2
+ name: workspace-surface-audit
3
+ description: "Audit workspace capabilities and recommend continuous-improvement-native skills, hooks, and workflows"
4
+ ---
5
+
6
+ # /workspace-surface-audit
7
+
8
+ Audit the active repo, MCP servers, plugins, connectors, env surfaces, and harness setup. Returns a 5-section report with specific next moves.
9
+
10
+ ## Usage
11
+
12
+ ```
13
+ /workspace-surface-audit
14
+ ```
15
+
16
+ ## What It Checks
17
+
18
+ 1. **Repo surface** — `package.json`, lockfiles, framework config, `.mcp.json`, `.claude/settings*.json`, `AGENTS.md`
19
+ 2. **Environment surface** — `.env*` files (key names only, no secrets)
20
+ 3. **Connected tools** — installed plugins, MCP servers, LSPs, app integrations
21
+ 4. **continuous-improvement surface** — existing skills, commands, hooks, agents
22
+
23
+ ## Output Format
24
+
25
+ ```
26
+ === Workspace Surface Audit ===
27
+
28
+ ## Current Surface
29
+ - [What is usable right now]
30
+
31
+ ## Parity
32
+ - [Where continuous-improvement matches or exceeds benchmarks]
33
+
34
+ ## Primitive-Only Gaps
35
+ - [Tools exist, but continuous-improvement lacks clean operator skills]
36
+
37
+ ## Missing Integrations
38
+ - [Capabilities not available yet]
39
+
40
+ ## Top 3-5 Next Moves
41
+ 1. [Concrete continuous-improvement-native addition]
42
+ 2. [Ordered by impact]
43
+ ```
44
+
45
+ ## Rules
46
+
47
+ - **Never print secrets** — only provider names, capability names, file paths
48
+ - **Prefer continuous-improvement** over generic "install another plugin" advice
49
+ - **Organize by workflows**, not API brands
50
+ - **Specific recommendations** — concrete enough to implement without another discovery pass
51
+
52
+ ## Example Output
53
+
54
+ ```
55
+ ## Current Surface
56
+ - MCP: filesystem, github, playwright
57
+ - Plugins: beginner, expert (continuous-improvement)
58
+ - Env: STRIPE_API_KEY, FAL_KEY configured
59
+ - Framework: Next.js 15, React 19, TypeScript
60
+
61
+ ## Parity
62
+ - Continuous improvement: covered (native)
63
+ - Testing discipline: covered (TDD workflows)
64
+
65
+ ## Primitive-Only Gaps
66
+ - Stripe connected but no billing-operator skill
67
+ - GitHub MCP available but no issue-triage workflow
68
+
69
+ ## Missing Integrations
70
+ - No Linear connector detected
71
+ - No Slack webhook configured
72
+
73
+ ## Top 3-5 Next Moves
74
+ 1. Create billing-operator skill (Stripe integration)
75
+ 2. Create github-ops workflow for issue triage
76
+ 3. Add Linear connector skill for project management
77
+ ```
@@ -12,11 +12,17 @@
12
12
  * (when installed) or the install hint (when not).
13
13
  *
14
14
  * Fail-open: any unexpected error reading stdin / parsing settings / probing
15
- * the filesystem → emit { decision: "allow" } and exit 0. The hook never
16
- * blocks on its own bugs.
15
+ * the filesystem → exit 0 with empty stdout (allow). The hook never blocks
16
+ * on its own bugs.
17
17
  *
18
18
  * Stdin : JSON { tool_name, tool_input }
19
- * Stdout : JSON { decision: "allow" | "block", reason?: string }
19
+ * Stdout : empty on allow (no output = no opinion, the call proceeds); on
20
+ * deny, the documented PreToolUse shape:
21
+ * { hookSpecificOutput: { hookEventName: "PreToolUse",
22
+ * permissionDecision: "deny", permissionDecisionReason } }
23
+ * A bare { decision: "allow" } is not schema-valid for PreToolUse
24
+ * (the deprecated enum is "approve" | "block") and surfaces as a
25
+ * "Hook JSON output validation failed" error on every tool call.
20
26
  * Exit : 0 always — decision lives in stdout, never in the exit code.
21
27
  *
22
28
  * OVERRIDES map must stay row-aligned with skills/superpowers.md
@@ -50,8 +56,20 @@ const OVERRIDES = {
50
56
  plugin: "oh-my-claudecode",
51
57
  },
52
58
  };
53
- function emitAndExit(d) {
54
- process.stdout.write(`${JSON.stringify(d)}\n`);
59
+ // Allow = empty stdout + exit 0. Emitting JSON here is wrong: PreToolUse has
60
+ // no { decision: "allow" } shape, and the invalid output surfaces as a
61
+ // per-tool-call "Hook JSON output validation failed" error in the client.
62
+ function emitAllowAndExit() {
63
+ process.exit(0);
64
+ }
65
+ function emitDenyAndExit(reason) {
66
+ process.stdout.write(`${JSON.stringify({
67
+ hookSpecificOutput: {
68
+ hookEventName: "PreToolUse",
69
+ permissionDecision: "deny",
70
+ permissionDecisionReason: reason,
71
+ },
72
+ })}\n`);
55
73
  process.exit(0);
56
74
  }
57
75
  function readStdin() {
@@ -137,19 +155,19 @@ function main() {
137
155
  payload = JSON.parse(raw);
138
156
  }
139
157
  catch {
140
- emitAndExit({ decision: "allow" });
158
+ emitAllowAndExit();
141
159
  }
142
160
  if (payload.tool_name !== "Skill") {
143
- emitAndExit({ decision: "allow" });
161
+ emitAllowAndExit();
144
162
  }
145
163
  const skill = payload.tool_input?.skill;
146
164
  if (typeof skill !== "string" || skill.length === 0) {
147
- emitAndExit({ decision: "allow" });
165
+ emitAllowAndExit();
148
166
  }
149
167
  const normalized = normalizeSkill(skill);
150
168
  const override = OVERRIDES[normalized];
151
169
  if (!override) {
152
- emitAndExit({ decision: "allow" });
170
+ emitAllowAndExit();
153
171
  }
154
172
  const home = resolveHome();
155
173
  const mode = readMode(home);
@@ -166,25 +184,19 @@ function main() {
166
184
  // Shadow row: what companions-first would have done. This is the data
167
185
  // set that earns a future default-flip decision.
168
186
  writeTelemetry(home, { ...baseEvent, mode, action: "observation" });
169
- emitAndExit({ decision: "allow" });
187
+ emitAllowAndExit();
170
188
  }
171
189
  if (mode === "companions-first") {
172
190
  process.stderr.write(`[continuous-improvement] companion_preference=companions-first → prefer \`${override.companion}\` over \`ci:${normalized}\`.\n`);
173
191
  writeTelemetry(home, { ...baseEvent, mode, action: "advisory" });
174
- emitAndExit({ decision: "allow" });
192
+ emitAllowAndExit();
175
193
  }
176
194
  // strict-companions: always block; reason depends on install state.
177
195
  if (installed) {
178
196
  writeTelemetry(home, { ...baseEvent, mode, action: "block" });
179
- emitAndExit({
180
- decision: "block",
181
- reason: `companion_preference=strict-companions: route to \`${override.companion}\` instead of \`ci:${normalized}\`. The CI fallback is suppressed by your setting.`,
182
- });
197
+ emitDenyAndExit(`companion_preference=strict-companions: route to \`${override.companion}\` instead of \`ci:${normalized}\`. The CI fallback is suppressed by your setting.`);
183
198
  }
184
199
  writeTelemetry(home, { ...baseEvent, mode, action: "block-not-installed" });
185
- emitAndExit({
186
- decision: "block",
187
- reason: `companion_preference=strict-companions: companion plugin \`${override.plugin}\` is not installed. Install with \`/plugin install ${override.plugin}@continuous-improvement\` or relax the setting to \`companions-first\` or \`ci-first\` in ~/.claude/settings.json.`,
188
- });
200
+ emitDenyAndExit(`companion_preference=strict-companions: companion plugin \`${override.plugin}\` is not installed. Install with \`/plugin install ${override.plugin}@continuous-improvement\` or relax the setting to \`companions-first\` or \`ci-first\` in ~/.claude/settings.json.`);
189
201
  }
190
202
  main();
@@ -3,7 +3,13 @@
3
3
  * Runtime PreToolUse gateguard hook.
4
4
  *
5
5
  * Stdin : JSON { tool_name, tool_input }
6
- * Stdout : JSON { decision: "allow" | "block", reason?: string }
6
+ * Stdout : empty on allow (no output = no opinion, the call proceeds); on
7
+ * deny, the documented PreToolUse shape:
8
+ * { hookSpecificOutput: { hookEventName: "PreToolUse",
9
+ * permissionDecision: "deny", permissionDecisionReason } }
10
+ * A bare { decision: "allow" } is not schema-valid for PreToolUse
11
+ * (the deprecated enum is "approve" | "block") and surfaces as a
12
+ * "Hook JSON output validation failed" error on every tool call.
7
13
  * Exit : 0 always (decision is in stdout, fail-open on parse error).
8
14
  *
9
15
  * Three-stage gate per skills/gateguard.md:
@@ -132,7 +138,7 @@ function buildMutatingFileReason(toolName, filePaths, stateFilePath) {
132
138
  "",
133
139
  "Then clear the gate and retry the same call. Either route works:",
134
140
  ` A. Bash (always works — run verbatim): node ${quotePath(CLEAR_CLI_PATH)} --state ${quotePath(stateFilePath)} ${quoted.join(" ")}`,
135
- ` B. MCP tool (when the continuous-improvement server is connected): ci_gateguard_clear {file_paths: [${quoted.join(", ")}]}`,
141
+ ` B. MCP tool (when the continuous-improvement server is connected): ci_gateguard_clear {file_paths: [${quoted.join(", ")}], state_path: ${quotePath(stateFilePath)}}`,
136
142
  " Both canonicalize paths — drive-letter case and separators don't matter.",
137
143
  " (Harnesses that forward unknown tool params may instead retry the call with",
138
144
  " `_gateguard_facts_presented: true`; Claude Code's strict schema rejects that, so use A or B.)",
@@ -151,13 +157,26 @@ function buildDestructiveBashReason(command) {
151
157
  }
152
158
  function buildCapReachedReason() {
153
159
  return [
154
- `Gateguard session clearance cap reached (${MAX_CLEARED_FILES} distinct files).`,
155
- "Start a new Claude Code session to reset the gate. The cap exists to bound",
156
- "stuck-loop or rogue-agent clearance from compounding within a single session.",
160
+ `Gateguard clearance cap reached (${MAX_CLEARED_FILES} distinct files this session).`,
161
+ "The cap is per-session: start a new Claude Code session to reset it, or wait",
162
+ "for the state file to self-heal. It bounds stuck-loop or rogue-agent clearance",
163
+ "from compounding within one session without affecting your other sessions.",
157
164
  ].join("\n");
158
165
  }
159
- function emit(decision) {
160
- process.stdout.write(`${JSON.stringify(decision)}\n`);
166
+ // Allow = empty stdout + exit 0. Emitting JSON here is wrong: PreToolUse has
167
+ // no { decision: "allow" } shape, and the invalid output surfaces as a
168
+ // per-tool-call "Hook JSON output validation failed" error in the client.
169
+ function emitAllow() {
170
+ process.exit(0);
171
+ }
172
+ function emitDeny(reason) {
173
+ process.stdout.write(`${JSON.stringify({
174
+ hookSpecificOutput: {
175
+ hookEventName: "PreToolUse",
176
+ permissionDecision: "deny",
177
+ permissionDecisionReason: reason,
178
+ },
179
+ })}\n`);
161
180
  process.exit(0);
162
181
  }
163
182
  function main() {
@@ -166,7 +185,7 @@ function main() {
166
185
  raw = readFileSync(0, "utf8");
167
186
  }
168
187
  catch {
169
- emit({ decision: "allow" });
188
+ emitAllow();
170
189
  return;
171
190
  }
172
191
  let payload;
@@ -174,23 +193,26 @@ function main() {
174
193
  payload = JSON.parse(raw);
175
194
  }
176
195
  catch {
177
- emit({ decision: "allow" }); // fail-open
196
+ emitAllow(); // fail-open
178
197
  return;
179
198
  }
180
199
  const toolName = typeof payload.tool_name === "string" ? payload.tool_name : "";
181
200
  const toolInput = payload.tool_input ?? {};
182
201
  const gate = classifyTool(toolName, toolInput);
183
202
  if (gate === "allow") {
184
- emit({ decision: "allow" });
203
+ emitAllow();
185
204
  return;
186
205
  }
187
206
  if (gate === "destructive-bash") {
188
207
  const cmd = typeof toolInput.command === "string" ? toolInput.command : "";
189
- emit({ decision: "block", reason: buildDestructiveBashReason(cmd) });
208
+ emitDeny(buildDestructiveBashReason(cmd));
190
209
  return;
191
210
  }
192
- // mutating-file
193
- const sessionDir = resolveSessionDir();
211
+ // mutating-file — scope state to THIS session so the clearance cap never
212
+ // bleeds across concurrent same-day sessions. session_id is the standard hook
213
+ // stdin field (see recall-briefing / observe-event); absent → legacy dir.
214
+ const sessionId = typeof payload.session_id === "string" ? payload.session_id : undefined;
215
+ const sessionDir = resolveSessionDir(sessionId);
194
216
  const stateFilePath = join(sessionDir, "gateguard-session.json");
195
217
  const state = loadState(sessionDir);
196
218
  const filePaths = extractFilePaths(toolInput);
@@ -199,12 +221,12 @@ function main() {
199
221
  const alreadyCleared = filePaths.length > 0 && filePaths.every((path) => isFileCleared(state, path));
200
222
  const newFileCount = countDistinctNewFilePaths(filePaths, state);
201
223
  if (!factsFlagged && !alreadyCleared) {
202
- emit({ decision: "block", reason: buildMutatingFileReason(toolName, filePaths.length > 0 ? filePaths : [filePath], stateFilePath) });
224
+ emitDeny(buildMutatingFileReason(toolName, filePaths.length > 0 ? filePaths : [filePath], stateFilePath));
203
225
  return;
204
226
  }
205
227
  if (factsFlagged && !alreadyCleared) {
206
228
  if (isCapReached(state) || Object.keys(state.cleared_files).length + newFileCount > MAX_CLEARED_FILES) {
207
- emit({ decision: "block", reason: buildCapReachedReason() });
229
+ emitDeny(buildCapReachedReason());
208
230
  return;
209
231
  }
210
232
  let nextState = state;
@@ -214,6 +236,6 @@ function main() {
214
236
  if (filePaths.length > 0)
215
237
  saveState(sessionDir, nextState);
216
238
  }
217
- emit({ decision: "allow" });
239
+ emitAllow();
218
240
  }
219
241
  main();