Repository navigation
feat: add lifecycle extension system for user-defined workflow hooks - #1224
Closed
jhochenbaum wants to merge 59 commits into
Closed
jhochenbaum wants to merge 59 commits into
jhochenbaum wants to merge 59 commits into
Conversation
Design for making using-git-worktrees, finishing-a-development-branch, and subagent-driven-development skills work in the Codex App's sandboxed worktree environment. Read-only environment detection via git-dir vs git-common-dir comparison, ~48 lines across 4 files, zero breaking changes. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Fix three Important issues from spec review: - Clarify Step 1.5 placement relative to existing Steps 2/3 - Re-derive environment state at cleanup time instead of relying on earlier skill output - Acknowledge pre-existing Step 5 cleanup inconsistency Also: precise step references, exact codex-tools.md content, clearer Integration section update instructions. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
- Add commit SHA + data loss warning to handoff payload (HIGH) - Add explicit commit step before handoff (HIGH) - Remove misleading "mark as externally managed" from Path B - Add executing-plans 1-line edit (was missing) - Add branch name derivation rules - Add conditional UI language for non-App environments - Add sandbox fallback for permission errors - Add STOP directive after Step 0 reporting Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
) to spec Both tests address real risk scenarios: - obra#5: cleanup guard bug would delete Codex App's own worktree (data loss) - obra#10: Local thread sandbox fallback needs manual Codex App validation Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
8 tasks covering: environment detection in using-git-worktrees, Step 1.5 + cleanup guard in finishing-a-development-branch, Integration line updates, codex-tools.md docs, automated tests, and final verification. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
The subagent review loop (dispatching a fresh agent to review plans/specs) doubled execution time (~25 min overhead) without measurably improving plan quality. Regression testing across 5 versions (v3.6.0 through v5.0.4) with 5 trials each showed identical plan sizes, task counts, and quality scores regardless of whether the review loop ran. Changes: - writing-plans: Replace subagent Plan Review Loop with inline Self-Review checklist (spec coverage, placeholder scan, type consistency) - writing-plans: Add explicit "No Placeholders" section listing plan failures (TBD, vague descriptions, undefined references, "similar to Task N") - brainstorming: Replace subagent Spec Review Loop with inline Spec Self-Review (placeholder scan, internal consistency, scope check, ambiguity check) - Both skills now use "look at it with fresh eyes" framing Testing: 5 trials with the new skill show self-review catches 3-5 real bugs per run (spawn positions, API mismatches, seed bugs, grid indexing) in ~30s instead of ~25 min. Remaining defects are comparable to the subagent approach. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…view" This reverts commit bf8f757.
…eview" This reverts commit b045fa3.
Metadata files (.server-info, .events, .server.pid, .server.log,
.server-stopped) were stored in the same directory served over HTTP,
making them accessible via the /files/ route. They now live in a .meta/
subdirectory that is not web-accessible.
Also fixes a stale test assertion ("Waiting for Claude" → "Waiting for
the agent").
Reported-By: 吉田仁
This reverts commit ab500da.
The session directory now contains two peers: content/ (HTML served to
the browser) and state/ (events, server-info, pid, log). Previously
all files shared a single directory, making server state and user
interaction data accessible over the /files/ HTTP route.
Also fixes stale test assertion ("Waiting for Claude" → "Waiting for
the agent").
Reported-By: 吉田仁
ownerAlive() treated EPERM (permission denied) the same as ESRCH (process not found), causing the server to self-terminate within 60s whenever the owner process ran as a different user. This affected WSL (owner is a Windows process), Tailscale SSH, and any cross-user scenario. The fix: `return e.code === 'EPERM'` — if we get permission denied, the process is alive; we just can't signal it. Tested on Linux via Tailscale SSH with a root-owned grandparent PID: - Server survives past the 60s lifecycle check (EPERM = alive) - Server still shuts down when owner genuinely dies (ESRCH = dead) Fixes obra#879
Two bugs caused the brainstorm server to self-terminate within 60s: 1. ownerAlive() treated EPERM (permission denied) as "process dead". When the owner PID belongs to a different user (Tailscale SSH, system daemons), process.kill(pid, 0) throws EPERM — but the process IS alive. Fixed: return e.code === 'EPERM'. 2. On WSL, the grandparent PID resolves to a short-lived subprocess that exits before the first 60s lifecycle check. The PID is genuinely dead (ESRCH), so the EPERM fix alone doesn't help. Fixed: validate the owner PID at server startup — if it's already dead, it was a bad resolution, so disable monitoring and rely on the 30-minute idle timeout. This also removes the Windows/MSYS2-specific OWNER_PID="" carve-out from start-server.sh, since the server now handles invalid PIDs generically at startup regardless of platform. Tested on Linux (magic-kingdom) via Tailscale SSH: - Root-owned owner PID (EPERM): server survives ✓ - Dead owner PID at startup (WSL sim): monitoring disabled, survives ✓ - Valid owner that dies: server shuts down within 60s ✓ Fixes obra#879
…ction Copilot CLI v1.0.11 reads `additionalContext` from sessionStart hook output, but the session-start script only emits the Claude Code-specific nested format. Add COPILOT_CLI env var detection so Copilot CLI gets the SDK-standard top-level `additionalContext` while Claude Code continues getting `hookSpecificOutput`. Based on PR obra#910 by @culinablaz.
- Add references/copilot-tools.md with full tool equivalence table - Add Copilot CLI to using-superpowers skill platform instructions - Add marketplace install instructions to README - Add changelog entry crediting @culinablaz for the hook fix
The bootstrap text advertised a configDir-based skills path that didn't match the runtime path (resolved relative to the plugin file). Tests used yet another hardcoded path and referenced a nonexistent lib/ dir. - Remove misleading skills path from bootstrap text; the agent should use the native skill tool, not read files by path - Fix test setup to create a consistent layout matching the plugin's ../../skills resolution - Export SUPERPOWERS_SKILLS_DIR from setup.sh so tests use a single source of truth - Add regression test that bootstrap doesn't advertise the old path - Remove broken cp of nonexistent lib/ directory Fixes obra#847
…sage Move bootstrap injection from experimental.chat.system.transform to experimental.chat.messages.transform, prepending to the first user message instead of adding a system message. This avoids two issues: - System messages repeated every turn inflate token usage (obra#750) - Multiple system messages break Qwen and other models (obra#894) Tested on OpenCode 1.3.2 with Claude Sonnet 4.5 — brainstorming skill fires correctly on "Let's make a React to do list" prompt.
Design for detect-and-defer worktree support. Superpowers defers to native harness worktree systems when available, falls back to manual git worktree creation when not. Covers Phases 0-2: detection, consent, native tool preference, finishing state detection, and three bug fixes (obra#940, obra#999, obra#238). Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
- Fix Bug obra#999 order: merge → verify → remove worktree → delete branch (avoids losing work if merge fails after worktree removal) - Add submodule guard to Step 0 detection (GIT_DIR != GIT_COMMON is also true in submodules) - Preserve global path (~/.config/superpowers/worktrees/) in detection for backward compatibility, just stop offering it to new users - Add step numbering note and implementation notes section - Expand provenance heuristic to cover global path and manual creation Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
- Step 1a is the load-bearing assumption, not just a risk — if it fails, the entire design needs rework. TDD validation must be first impl task. - obra#1009 resolution depends on Step 1a working, stated explicitly - obra#574 honestly deferred, not "partially addressed" - Add hooks symlink to Step 1b (PR obra#965 idea, prevents silent hook loss) - Add stale worktree pruning to Step 5 (PR obra#1072 idea, one-line self-heal) Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
5 tasks: TDD gate for Step 1a, using-git-worktrees rewrite, finishing-a-development-branch rewrite, integration updates, end-to-end validation. Task 1 is a hard gate — if native tool preference fails RED/GREEN, stop and redesign. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Add parse_extensions_yaml and build_extensions_registry functions that read ~/.superpowers/extensions.yaml and .superpowers/extensions.yaml, merge them by lifecycle event, and inject the registry into session context. This is the foundation for the lifecycle extensions system. Co-Authored-By: Claude Opus 4.6 <[email protected]>
…agent-driven-development
Three-tier test coverage for the lifecycle extensions feature: - Hook unit tests (test-lifecycle-extensions-hook.sh): 9 tests, 22 assertions - Skill documentation tests (test-lifecycle-extensions.sh): 8 headless tests - Integration test (test-lifecycle-extensions-integration.sh): 5 Claude sessions verifying all 7 lifecycle events via JSONL transcript analysis Also includes the design spec and implementation plan. Co-Authored-By: Claude Opus 4.6 <[email protected]>
…t from repo root Fixes two edge cases in the session-start hook: - Skill names containing colons (e.g. github:gh-fix-ci) were split incorrectly by the colon delimiter. Switch to tab-separated parsing. - Project extensions manifest was only found in $PWD. Now walks up to the git root (or nearest parent) so it works from subdirectories. Adds test coverage for both cases. Co-Authored-By: Claude Opus 4.6 <[email protected]>
These are process artifacts, not part of the feature. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Author
|
@obra curious if this is something you'd be open to or if you think it's out of scope for Superpowers? Apologies for not opening an issue to discuss first. |
5 tasks done
1 task done
2 of 5 tasks
1 task done
obra
force-pushed
the
dev
branch
3 times, most recently
from
June 17, 2026 05:46
210b867 to
b62616f
Compare
1 task done
1 task done
4 of 5 tasks
Owner
|
Hi @jhochenbaum! I'm Claude, helping @obra triage. I'm closing this in favor of #2398, the master tracking ticket for configurability. The status change isn't a judgment about your work. We found fourteen requests for different kinds of configurability and want to design them together rather than one knob at a time. Your write-up is linked there as part of the input, and we'd love your thoughts in that thread. — Claude (Opus 5.5, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem are you trying to solve?
One of Superpowers' core strengths is its minimal set of skills and configuration without bloating the core. This is one of the reasons many of us find ourselves coming back to Superpowers over similar frameworks. At the same time, while we can (and should) create our own toolkits or plugins to manage custom skills, there are many instances where injecting a specific skill into the superpowers workflow would be genuinely useful. Today, users who want to add custom steps, whether a compound learning phase after plan execution, a specialized security review after code review, or a compliance check before merge, have no supported way to do it. Their only options are to submit a PR to core (which will, and should, be rejected since these tend to be domain or user-specific) or to maintain a fork.
This creates two problems: (1) unnecessary PR pressure on the core repo maintainer from users trying to add domain-specific workflow steps, and (2) users who could benefit from superpowers' lifecycle structure can't extend it without modifying core.
Concrete example: Issue #230 requests compound learning at the end of work (inspired by the compound-engineering-plugin). This is a great idea for some users, but too domain-specific for core, and there are countless others like it. With this change, any user could implement it as a personal extension skill, without bloating the core Superpowers framework.
What does this PR change?
Adds a lifecycle extension system: users declare custom skills to run at specific workflow events via YAML manifest files. Two manifest locations are supported — personal (
~/.superpowers/extensions.yaml) and project-level (.superpowers/extensions.yaml) — which are merged at session start (personal first, project appends). The session-start hook parses both manifests and injects the combined registry into session context.Core skills check the registry at seven lifecycle events and invoke registered extensions via the Skill tool:
post-brainstormpost-planpre-taskpost-taskpost-executionpost-reviewpre-finishExtension skills are just regular skills in the user's own skill directories — no new skill format or tooling required.
Example manifest (
~/.superpowers/extensions.yaml):Is this change appropriate for the core library?
Yes — this is general-purpose infrastructure, not a domain-specific skill. It benefits all users by giving them a sanctioned way to extend superpowers without modifying core. It's explicitly designed to reduce the need for (and burden of) domain-specific PRs by providing extension points instead.
No third-party dependencies, no domain-specific content, and no new skills were added to core. Extension skills live entirely in the user's own skill directories.
What alternatives did you consider?
Three approaches were evaluated:
Frontmatter hooks — Custom skills declare lifecycle hooks via a
hooks:orsuperpowers-hooks:field in YAML frontmatter. Rejected because it adds superpowers-specific semantics on top of the agentskills.io spec, which would confuse users who expect frontmatter to be standard.Named extension points in core skills — Core skills define explicit named extension points. Potentially more granular but requires a larger API surface and more upfront design. Elements of this were borrowed (named lifecycle events) without the full complexity.
Skill composition / wrapper pattern — Custom skills "extend" core skills via an
extends:field. Most flexible but fragile — wrappers break silently when core skills change, and composing multiple extensions is hard.Final approach is a separate manifest file (
extensions.yaml) that maps named lifecycle events to skills. This keeps skill files spec-compliant, makes the superpowers-specific wiring explicit, and provides a single file to see all active extensions at a glance.Does this PR contain multiple unrelated changes?
No. All changes serve one feature: the lifecycle extension system. The session-start hook parses manifests,
using-superpowerstells the agent about extensions, and the core skill edits add minimal extension check points at lifecycle events. None of these are useful independently.Existing PRs
plugins/directory. Different scope (skill organization)No existing PR proposes a lifecycle hook/extension system.
Testing
Three-tier test suite
1. Hook unit tests (
test-lifecycle-extensions-hook.sh) — 11 tests, 25 assertionsTests the bash session-start hook directly without the Claude CLI:
2. Skill documentation tests (
test-lifecycle-extensions.sh) — 8 headless testsFast
claude -psessions verifying each skill's documentation mentions extension checkpoints:using-superpowersskill describes the extensions registry3. Integration test (
test-lifecycle-extensions-integration.sh) — 5 Claude sessions, 7 lifecycle eventsEnd-to-end verification that Claude actually invokes registered extension skills at each lifecycle event during real workflow execution. Uses the repo's established testing pattern:
~/.superpowers/extensions.yamlgrep '"skill":"lifecycle-canary"')pre-task,post-task,post-execution,post-plan,post-review,pre-finish,post-brainstormIntegration test results
Note: The integration test verifies via JSONL transcript analysis that Claude invokes extensions through the Skill tool (not just that it outputs the expected text). This catches cases where the agent simulates the extension output without actually invoking the skill.
Environment tested
Evaluation
Rigor
superpowers:writing-skillsandcompleted adversarial pressure testing (paste results below)
rationalizations, "human partner" language) without extensive evals
showing the change is an improvement
The skill changes are additive one-line instructions at lifecycle transition points. The integration test suite verifies end-to-end extension invocation across all 7 lifecycle events via JSONL transcript analysis.
Human review