Skip to content

docs: explore lifecycle hooks and configurable actions - #2203

Draft
TabishB wants to merge 15 commits into
mainfrom
explore/intent-and-lifecycle
Draft

TabishB wants to merge 15 commits into
mainfrom
explore/intent-and-lifecycle

Conversation

@TabishB

@TabishB TabishB commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Explore lifecycle hooks for OpenSpec: a project defines named actions (instructions for an agent) and attaches them to points in the workflow, such as before Apply starts or after its tasks finish. OpenSpec resolves which actions are configured for a hook, and the calling agent or orchestrator handles them.

Includes a roadmap with five small PRs and two release checkpoints, a pilot proposal, a draft guide, and two example user-defined actions: an agent review of linked requirements against the plan, and a project-provided Git drift script. Git drift detection, source tracking, native executable actions, and plugins are out of scope.

Everything here is proposed, not implemented.

@coderabbitai

coderabbitai Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

TabishB commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

Updated implementation plan (replaces the Git-first pilot sequence)

Let's make the first slice a configurable lifecycle action, not a built-in Git drift detector. The goal is small, verifiable PRs over ~1 week; each PR proves a real behavior, and releases are integration checkpoints.

Proposed PR sequence

  1. Lifecycle CLI + config: openspec lifecycle check --at <point> --change <name> --json; resolve project-defined agent-guidance actions and mode: suggest triggers. Verify matching/multiple/empty/invalid actions, read-only invocation, and no-config compatibility.
  2. apply.completed integration: the Apply skill offers configured feedback reviews when its state is all_done (including an already-complete change). Accept/skip works in the current agent session; blocked does not offer completion reviews; no automatic upstream writes or duplicate prompts from instructions reads. Verify using the real skill.
  3. apply.before integration: when Apply is ready to begin/resume, offer configured reviews before edits. Respect blocked/all_done, and keep status/instruction refreshes side-effect-free. Verify both checkpoints with different actions.
    • Release checkpoint A: full CLI → Apply → offered/accepted/skipped review, plus no-config regression.
  4. Context reconciliation example: retain meaningful source links + why they matter in existing planning artifacts; provide configurable agent guidance to reread accessible sources and compare current expectations with the accepted plan. Report conflicts, affected work, evidence and uncertainty. No required Git revision, .openspec.yaml sources schema, or historical-diff claims.
  5. Reconcile via existing Update skill: the developer can review findings, keep the plan or request changes through openspec-update-change with confirmation; call out previously completed tasks that may need reconsideration. Verify a full plan → context review → approved update → Apply → optional feedback journey, including inaccessible/unrelated sources and custom schemas.
    • Release checkpoint B: end-to-end reconciliation and regression smoke test.
  6. Separate decision, not a dependency: user-defined executable checks. Define trust (including what happens if the script changes), timeouts, result/error contract and authorization before shipping. Git-based drift detection could be implemented by a user as one such action; it is not a default OpenSpec action.

Working rules: one tracking issue, one PR per logical step, acceptance tests + a reproducible demo in each PR, merge as verified. Reuse one fixture throughout the week. No plugins, global installation, profiles, observer, snapshots, provider-specific tracking, or general policy engine in this initial slice.

Please update this roadmap to match and keep the two release checkpoints distinct from individual PRs.

@TabishB TabishB left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up on the updated implementation-plan comment: these are the specific documentation changes needed to align the draft PR with the revised non-Git-first pilot. Keeping the existing action/trigger model; changing the first vertical slice and coverage claims.

Replace the Git-first pilot with lifecycle hooks: OpenSpec resolves
which actions are configured for a hook, and the calling agent or
orchestrator handles them.

- Roadmap: five PRs, two release checkpoints, and the
  `openspec lifecycle actions --at <hook>` command
- Pilot proposal and guide: rewritten around actions, triggers, and
  suggest/auto modes, with two user-defined actions as the proof
- Enterprise requirements: coverage re-scored against the revised pilot
- Direction and launch docs: cross-references aligned, the Nov 5
  lifecycle decision kept as superseded, skill names updated to 2.x
- Remove action chaining: the drift-script action reports its output
  and no longer invokes the requirements review
- Custom hook names must start with `custom.`, so a mistyped built-in
  name such as `aply.before` is rejected
- State that a Store's configuration decides the returned actions when
  the Store is the resolved root
- Guide limits: no enforced blocking, and a hook invoked again returns
  its actions again because lookup is stateless
- Keep `mode` (auto/suggest) and `policy` (warn/block) as distinct
  trigger settings. The pilot supports mode only, and a trigger that
  sets `policy` is reported as unsupported
- Record generalized references as a separate exploration with no
  schema yet, independent of lifecycle hooks
- State that detecting and managing drift remains a goal, served in the
  pilot by user-defined actions
- List agent orchestration alongside plugins and native executable
  actions as future work
@TabishB TabishB changed the title docs: explore lifecycle checks and optional reviews docs: explore lifecycle hooks and configurable actions Nov 18, 2026
Lead with how lifecycle actions work, the five-PR build plan with
verification per PR, criteria for both release checkpoints, draft
changelog entries, and what comes later. Keep the links to the other
docs and the working notes at the bottom.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant