Skip to content

chore(discipline): regenerate agent hooks for v0.18.0 - #220

Merged
orieg merged 2 commits into
mainfrom
chore/discipline-hooks-v0.18
Oct 7, 2026
Merged

orieg merged 2 commits into
mainfrom
chore/discipline-hooks-v0.18

Conversation

@orieg

@orieg orieg commented Oct 7, 2026

Copy link
Copy Markdown
Owner

What

Regenerates every tracked discipline hook file with discipline hook install --observe --upgrade using the local 0.18.0 CLI — the same engine the v0.18.0 action (landed in #218) runs.

Why

The v0.14.4-era hook files had silently drifted from what this release actually writes:

  • v0.15+ added PreToolUse / preToolUse entries — none present in any agent config
  • v0.17 added session-start lease entries — the worktree-isolation mechanism
  • v0.18 added the OpenCode plugin — never installed in this repo

Hooks run observe mode everywhere (the repo's existing convention), so no hook refuses a tool call; the regeneration only changes what the next agent sees after an edit. Tracked files now match a clean 0.18.0 install, so the drift stops silently diverging.

Changes

File Agent What changed
.claude/settings.json claude-code PreToolUse on Edit|Write|MultiEdit|NotebookEdit|Bash; session-start lease; PATH guard on every command
.github/hooks/discipline.json copilot preToolUse + sessionStart entries (v0.15+ shape); PATH guard
.agents/hooks.json agy PreToolUse; session-start lease; PATH guard; Stop timeout 120s → 300s (agy default this release writes)
.claude/hooks/discipline-bootstrap.sh claude-code version v0.14.4 → v0.18.0; tmpdir trap; cloud-host note
.opencode/plugins/discipline.js opencode (new) the v0.17+/v0.18 plugin — worktree lease on start, pre-tool worktree refusal, post-edit report append; observe mode

.github/workflows/copilot-setup-steps.yml was left untouched by the installer (already matches the 0.18.0 output; pin landed in #218).

Gate notes

The four agent instruction files + the new plugin each lift one instruction-smuggling finding, and the plugin's six catch {} blocks lift error-swallowing — all via scoped directives in the commit body (one allow-agent-instructions: / allow-swallow: line per subject), the same pattern this repo used for the AGENTS.md edit in #217. The empty catches are the plugin's observe-mode contract: a discipline hook must never throw or it would disrupt the agent's tool call.

Validation

  • Local 0.18.0 discipline check --base origin/main: PASS (27 gates, 0 errors, 0 warnings; 11 overrides = 11 directive applications above)
  • All hook files byte-match discipline hook install 0.18.0 output (the plugin is byte-identical to orieg/discipline's own tracked copy)

orieg added 2 commits October 7, 2026 12:17
Regenerate every tracked hook file with `discipline hook install --observe
--upgrade` (local CLI 0.18.0, the same engine the v0.18.0 action runs):

- .claude/settings.json (claude-code): PreToolUse check added on
  Edit|Write|MultiEdit|NotebookEdit|Bash, session-start lease entry, and a
  PATH guard on every command so a missing binary is reported instead of
  silently no-op'ing the hook.
- .github/hooks/discipline.json (copilot): preToolUse and sessionStart
  entries added (the v0.15+ hook shape), same PATH guard + observe mode.
- .agents/hooks.json (agy): PreToolUse entry, session-start lease, PATH
  guard, and the Stop check timeout raised 120s -> 300s (the agy default
  this release writes; a check may legitimately run long).
- .claude/hooks/discipline-bootstrap.sh: version v0.14.4 -> v0.18.0, a
  tmpdir trap so a failed download cannot leak the workspace, and a note
  that cloud sessions only run on GitHub-hosted repos.
- .opencode/plugins/discipline.js (new, opencode): the v0.17+/v0.18
  plugin — takes this worktree's lease on session start, refuses edits
  outside the session's worktree before an edit tool, and appends the
  failing discipline report to the tool output after one. Observe mode
  everywhere, so it never blocks.

Behaviour is unchanged for contributors who install discipline themselves:
observe mode means no hook refuses a tool call. The tracked files now
match what a clean 0.18.0 install writes, so hook-file drift (this release
added PreToolUse + session-start lease entries) stops silently diverging.

allow-agent-instructions: .agents/hooks.json regenerated by discipline hook install --agent agy --upgrade to v0.18.0 hook format (PreToolUse entry, session-start lease, PATH guard, Stop timeout 300s)
allow-agent-instructions: .claude/hooks/discipline-bootstrap.sh regenerated by discipline hook install --agent claude-code --upgrade to v0.18.0 (version v0.14.4 -> v0.18.0, tmpdir trap, cloud-host note)
allow-agent-instructions: .claude/settings.json regenerated by discipline hook install --agent claude-code --upgrade to v0.18.0 hook format (PreToolUse entry, session-start lease, PATH guards)
allow-agent-instructions: .github/hooks/discipline.json regenerated by discipline hook install --agent copilot --upgrade to v0.18.0 hook format (preToolUse + sessionStart entries, PATH guards)
allow-agent-instructions: .opencode/plugins/discipline.js regenerated by discipline hook install --agent opencode --upgrade to v0.18.0; observe-mode OpenCode plugin (session-start lease, pre-tool worktree refusal, post-edit report append) marked as its own instruction source
allow-swallow: .opencode/plugins/discipline.js observe-mode plugin contract: every empty catch is deliberate — a discipline hook must never throw or the agent's tool call is disrupted; catch {} is the tool's generated output
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown

discipline: passed

Base main (origin/main) (merge base 33066a3a72) · 27 gate(s) passed · 2180 item(s) examined · 0 warning(s) · 11 override(s)

Findings lifted by an override:

  • error-swallowing on .opencode/plugins/discipline.js: .opencode/plugins/discipline.js observe-mode plugin contract: every empty catch is deliberate — a discipline hook must never throw or the agent's tool call is disrupted; catch {} is the tool's generated output
  • error-swallowing on .opencode/plugins/discipline.js: .opencode/plugins/discipline.js observe-mode plugin contract: every empty catch is deliberate — a discipline hook must never throw or the agent's tool call is disrupted; catch {} is the tool's generated output
  • error-swallowing on .opencode/plugins/discipline.js: .opencode/plugins/discipline.js observe-mode plugin contract: every empty catch is deliberate — a discipline hook must never throw or the agent's tool call is disrupted; catch {} is the tool's generated output
  • error-swallowing on .opencode/plugins/discipline.js: .opencode/plugins/discipline.js observe-mode plugin contract: every empty catch is deliberate — a discipline hook must never throw or the agent's tool call is disrupted; catch {} is the tool's generated output
  • error-swallowing on .opencode/plugins/discipline.js: .opencode/plugins/discipline.js observe-mode plugin contract: every empty catch is deliberate — a discipline hook must never throw or the agent's tool call is disrupted; catch {} is the tool's generated output
  • error-swallowing on .opencode/plugins/discipline.js: .opencode/plugins/discipline.js observe-mode plugin contract: every empty catch is deliberate — a discipline hook must never throw or the agent's tool call is disrupted; catch {} is the tool's generated output
  • instruction-smuggling on .agents/hooks.json: .agents/hooks.json regenerated by discipline hook install --agent agy --upgrade to v0.18.0 hook format (PreToolUse entry, session-start lease, PATH guard, Stop timeout 300s)
  • instruction-smuggling on .claude/hooks/discipline-bootstrap.sh: .claude/hooks/discipline-bootstrap.sh regenerated by discipline hook install --agent claude-code --upgrade to v0.18.0 (version v0.14.4 -> v0.18.0, tmpdir trap, cloud-host note)
  • instruction-smuggling on .claude/settings.json: .claude/settings.json regenerated by discipline hook install --agent claude-code --upgrade to v0.18.0 hook format (PreToolUse entry, session-start lease, PATH guards)
  • instruction-smuggling on .github/hooks/discipline.json: .github/hooks/discipline.json regenerated by discipline hook install --agent copilot --upgrade to v0.18.0 hook format (preToolUse + sessionStart entries, PATH guards)
  • instruction-smuggling on .opencode/plugins/discipline.js: .opencode/plugins/discipline.js regenerated by discipline hook install --agent opencode --upgrade to v0.18.0; observe-mode OpenCode plugin (session-start lease, pre-tool worktree refusal, post-edit report append) marked as its own instruction source

discipline explain <gate> prints what a gate checks and how a finding is lifted. This comment is updated on every run; the check's status is the verdict.

@orieg
orieg merged commit b5dbc42 into main Oct 7, 2026
15 checks passed
@orieg
orieg deleted the chore/discipline-hooks-v0.18 branch October 7, 2026 21:10
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