Skip to content

fix: Hades smart cleanup — dead code, duplication, suppressions#132

Merged
ANcpLua merged 3 commits intomainfrom
hades/smart-cleanup-elite
Feb 16, 2026
Merged

fix: Hades smart cleanup — dead code, duplication, suppressions#132
ANcpLua merged 3 commits intomainfrom
hades/smart-cleanup-elite

Conversation

@ANcpLua
Copy link
Owner

@ANcpLua ANcpLua commented Feb 16, 2026

Summary

  • hookify refactor: Extract shared hook_runner.py from 4 near-identical handlers (215→128 lines, ~197 lines eliminated)
  • exodia smart scripts DRY: Extract lib.sh shared functions (has_jq, has_flock, atomic_write), add permit.sh active subcommand replacing 3 inline reimplementations
  • Dead code purge: Delete .gemini/ directory, docs/AGENTS.md (subset of root), hookify empty packages (matchers/, utils/, hooks/__init__.py), template agents/.gitkeep
  • Suppression fixes: Narrow bare except Exception in rule_engine.py and precheck-dotnet.py, fix Pyright type annotations (Optional[str], Optional[Dict]), warn on missing jq in ralph-loop.sh
  • Doc sync: AGENTS.md decision tree synced with CLAUDE.md, stale skills/ refs fixed in spec-0001/ADR-0001, .gemini/ removed from ARCHITECTURE.md tree
  • Standardization: plugin.json fields (repository/license/keywords) added to exodia, feature-dev, otelwiki; plugin template modernized

32 files changed, 310 insertions, 589 deletions (-279 lines net)

Hades Audit Trail

  • Smart ID: SMART-2026-02-15-1771184309xTt3dMIk91F2OlEDui6Z
  • Ledger: 54 entries (append-only JSONL)
  • Phases: 3 phases × 4 teammates + 1 iteration = 17 Opus agents
  • Verification: Build PASS, ShellCheck PASS, ActionLint PASS, JSON PASS
  • Challenger: 16/18 claims confirmed, 0 challenged, 0 regressions

Test plan

  • CI passes (shellcheck, actionlint, markdownlint, JSON, plugin validate)
  • hookify hooks still work (pretooluse/posttooluse/stop/userpromptsubmit invoke hook_runner correctly)
  • permit.sh active returns correct exit codes (0=active, 1=inactive/expired)
  • No broken references to deleted files (.gemini/, docs/AGENTS.md, hookify packages)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added orchestration commands/modes (baryon-mode, eight-gates, hades) and new multi-agent workflow capabilities.
    • Added keywords to several plugin manifests for improved discoverability.
  • Documentation

    • Reorganized and updated architecture, changelog, docs, and plugin-template docs; moved/removed several legacy docs and added quick-reference material.
  • Chores

    • Removed Gemini Code Assist config and style guide files.
    • Consolidated hook execution into a centralized runner and simplified hook scripts.
    • Added utility helpers for robust scripting (locking/jq-aware parsing).

…ressions

32 files changed (-354 lines net). Audited by 17 Opus agents across 3 phases
with adversarial verification. Smart ID: SMART-2026-02-15-1771184309.

Key eliminations:
- hookify: extract shared hook_runner.py from 4 near-identical handlers
- exodia: extract lib.sh shared functions, add permit.sh active subcommand
- Delete .gemini/, docs/AGENTS.md, hookify empty packages, template cruft
- Narrow bare except clauses, fix Pyright type annotations
- Sync AGENTS.md decision tree with CLAUDE.md, fix stale doc references
- Standardize plugin.json fields across exodia, feature-dev, otelwiki

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 16, 2026 02:29
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai
Copy link

coderabbitai bot commented Feb 16, 2026

Caution

Review failed

Failed to post review comments

📝 Walkthrough

Walkthrough

Removes Gemini config/styleguide, centralizes hook execution via a new hook_runner and updates hook modules to delegate to it, shifts skills/agents to plugin-scoped locations in docs/ and ADRs, updates plugin manifests and templates, and adds/adjusts exodia helper scripts and permit handling.

Changes

Cohort / File(s) Summary
Gemini config removed
​.gemini/config.yaml, ​.gemini/styleguide.md
Deleted Gemini Code Assist configuration and style guide, removing review/memory/config and ignore patterns.
Documentation & index changes
AGENTS.md, CLAUDE.md, docs/AGENTS.md, docs/ARCHITECTURE.md, docs/decisions/ADR-0001-marketplace-architecture.md, docs/specs/spec-0001-framework-architecture.md
Removed docs/AGENTS.md, replaced references with QUICK-REFERENCE.md/ENGINEERING-PRINCIPLES.md, and updated architecture/ADR/spec to state skills/agents are plugin-scoped under plugins/*/.
CHANGELOG updates
CHANGELOG.md
Expanded Unreleased section with a new Fixed subsection and reorganized Added/Changed/Removed documentation/tooling entries.
Hookify — new centralized runner
plugins/hookify/hookify/core/hook_runner.py
Added run_hook(hook_event_name, fixed_event) that centralizes stdin parsing, rule loading, RuleEngine invocation, JSON output, and error reporting.
Hookify — rule engine adjustments
plugins/hookify/hookify/core/rule_engine.py
Narrowed exception handling in permit checks; method signatures updated to use Optional[Dict] for input_data.
Hookify — hooks delegated
plugins/hookify/hooks/posttooluse.py, plugins/hookify/hooks/pretooluse.py, plugins/hookify/hooks/stop.py, plugins/hookify/hooks/userpromptsubmit.py
Replaced per-hook main loops with imports of run_hook(...) and simplified main entry to delegate execution to centralized runner.
Exodia scripts & permit
plugins/exodia/scripts/smart/lib.sh, plugins/exodia/scripts/smart/permit.sh
Added helpers has_jq(), has_flock(), atomic_write() to lib.sh; permit.sh now conditionally parses expires_epoch using jq when available, falling back to grep when not.
Plugin manifest metadata
plugins/exodia/.claude-plugin/plugin.json, plugins/feature-dev/.claude-plugin/plugin.json, plugins/otelwiki/.claude-plugin/plugin.json
Added keywords arrays to multiple plugin manifests; feature-dev also gained repository and license fields.
Dotnet plugin tweaks
plugins/dotnet-architecture-lint/CLAUDE.md, plugins/dotnet-architecture-lint/scripts/precheck-dotnet.py
Removed SKILL.md reference from CLAUDE.md; precheck-dotnet delegates active-permit checks to exodia/scripts/smart/permit.sh and simplified JSON exception clause.
Plugin template changes
tooling/templates/plugin-template/.claude-plugin/plugin.json, tooling/templates/plugin-template/CLAUDE.md, tooling/templates/plugin-template/README.md, tooling/templates/plugin-template/hooks/hooks.json, tooling/templates/plugin-template/agents/.gitkeep
Renamed template values (example-plugin → plugin-name), added CLAUDE.md, reworked README content/paths, removed agents/.gitkeep, and expanded hooks.json with a PreToolUse hook example.
Hook-related small docs
plugins/dotnet-architecture-lint/CLAUDE.md (already listed)
Minor doc cleanup (removed SKILL.md reference).

Sequence Diagram(s)

sequenceDiagram
  participant HookScript as Hook script (e.g., pretooluse)
  participant Runner as hook_runner.run_hook
  participant Loader as Rule loader (load_rules)
  participant Engine as RuleEngine
  participant Permit as permit.sh / external helpers

  HookScript->>Runner: invoke run_hook(hook_event_name, fixed_event?)
  Runner->>Runner: read stdin -> input_data
  Runner->>Loader: load_rules(event)
  Loader-->>Runner: rules
  Runner->>Engine: RuleEngine(rules).evaluate(input_data)
  Engine->>Permit: (if _hades_permit_active) call permit.sh via bash
  Permit-->>Engine: permit result
  Engine-->>Runner: evaluation result
  Runner-->>HookScript: print JSON result / systemMessage
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main objective of the PR: removing dead code, eliminating duplication, and fixing suppression issues in the Hades cleanup work. It is concise, specific, and clearly communicates the primary change.
Docstring Coverage ✅ Passed Docstring coverage is 81.82% which is sufficient. The required threshold is 80.00%.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch hades/smart-cleanup-elite

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


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

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link

Summary of Changes

Hello @ANcpLua, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request delivers a comprehensive cleanup and refactoring initiative, primarily targeting the hookify and exodia plugins. The changes aim to enhance code quality and maintainability by eliminating dead code, reducing duplication through shared utility functions and centralized logic, and improving robustness by narrowing exception handling. Additionally, it standardizes plugin metadata and updates documentation to reflect current architectural patterns, streamlining future development and ensuring a clearer understanding of the system's components.

Highlights

  • Hookify Refactor: Extracted shared hook_runner.py from four near-identical hook handlers (pretooluse, posttooluse, stop, userpromptsubmit), significantly reducing code duplication and centralizing logic.
  • Exodia Smart Scripts DRY: Extracted common shell functions (has_jq, has_flock, atomic_write) into lib.sh and introduced a canonical permit.sh active subcommand, replacing multiple inline reimplementations.
  • Dead Code Purge: Deleted the .gemini/ directory, the redundant docs/AGENTS.md file, and empty hookify packages (matchers/, utils/, hooks/__init__.py), along with the template agents/.gitkeep.
  • Suppression Fixes: Narrowed bare except Exception clauses in rule_engine.py and precheck-dotnet.py, fixed Pyright type annotations (Optional[str], Optional[Dict]), and added a warning for missing jq in ralph-loop.sh.
  • Documentation Synchronization: Synchronized the AGENTS.md decision tree with CLAUDE.md, corrected stale skills/ references in spec-0001 and ADR-0001, and removed .gemini/ from the ARCHITECTURE.md directory tree.
  • Standardization: Added missing repository, license, and keywords fields to plugin.json files for exodia, feature-dev, and otelwiki, and modernized the plugin template.
Changelog
  • AGENTS.md
    • Updated command count from 20 to 22.
    • Added new decision tree entries for deep-analysis, hades, baryon-mode, and eight-gates skills.
  • CHANGELOG.md
    • Updated with new entries under 'Changed', 'Fixed', 'Removed', and 'Added' sections, detailing refactoring, bug fixes, dead code removal, and new documentation.
  • docs/AGENTS.md
    • Removed as it was a redundant subset of the root AGENTS.md.
  • docs/ARCHITECTURE.md
    • Removed reference to the .gemini/ directory.
    • Updated the AGENTS.md reference to QUICK-REFERENCE.md.
  • docs/decisions/ADR-0001-marketplace-architecture.md
    • Updated the description of the chosen repository option to reflect that skills and agents now live within their respective plugins.
  • docs/specs/spec-0001-framework-architecture.md
    • Updated the stable directory layout to remove skills/ as a top-level directory.
    • Clarified that plugins contain their own skills/, commands/, and agents/ directories.
  • plugins/dotnet-architecture-lint/CLAUDE.md
    • Removed a stale reference to a non-existent skill documentation file.
  • plugins/dotnet-architecture-lint/scripts/precheck-dotnet.py
    • Refactored the _hades_permit_active function to delegate to permit.sh active.
    • Narrowed the except Exception clause in main to json.JSONDecodeError.
  • plugins/exodia/.claude-plugin/plugin.json
    • Added repository, license, and keywords fields for standardization.
  • plugins/exodia/scripts/smart/checkpoint.sh
    • Replaced direct command -v jq checks with the has_jq utility function.
  • plugins/exodia/scripts/smart/ledger.sh
    • Replaced manual flock logic with the new atomic_write utility function for appending entries.
  • plugins/exodia/scripts/smart/lib.sh
    • Added has_jq, has_flock, and atomic_write utility functions for shared shell script logic.
  • plugins/exodia/scripts/smart/permit.sh
    • Refactored create and revoke functions to use atomic_write.
    • Introduced an active subcommand for checking permit status.
  • plugins/exodia/scripts/smart/session-state.sh
    • Replaced direct command -v jq checks with the has_jq utility function across multiple functions.
  • plugins/feature-dev/.claude-plugin/plugin.json
    • Added repository, license, and keywords fields for standardization.
  • plugins/hookify/hookify/core/hook_runner.py
    • Added a new Python script to centralize shared hook handler logic, reducing duplication across individual hook files.
  • plugins/hookify/hookify/core/rule_engine.py
    • Narrowed the except Exception clause in _hades_permit_active to specific exception types.
    • Updated type annotations for input_data parameters to Optional[Dict[str, Any]].
  • plugins/hookify/hookify/matchers/init.py
    • Removed as an empty package.
  • plugins/hookify/hooks/posttooluse.py
    • Refactored to import and utilize the shared run_hook function from hook_runner.py.
  • plugins/hookify/hooks/pretooluse.py
    • Refactored to import and utilize the shared run_hook function from hook_runner.py.
  • plugins/hookify/hooks/stop.py
    • Refactored to import and utilize the shared run_hook function from hook_runner.py.
  • plugins/hookify/hooks/userpromptsubmit.py
    • Refactored to import and utilize the shared run_hook function from hook_runner.py.
  • plugins/metacognitive-guard/hooks/scripts/epistemic-guard.sh
    • Updated the Hades permit check to use the new permit.sh active subcommand for a single source of truth.
  • plugins/metacognitive-guard/hooks/scripts/ralph-loop.sh
    • Added a warning message to stderr if jq is not found, instead of silently exiting.
  • plugins/otelwiki/.claude-plugin/plugin.json
    • Added repository, license, and keywords fields for standardization.
  • tooling/templates/plugin-template/.claude-plugin/plugin.json
    • Updated the plugin name and description fields.
    • Removed an internal comment.
  • tooling/templates/plugin-template/CLAUDE.md
    • Added a new CLAUDE.md file to the plugin template for concise plugin context.
  • tooling/templates/plugin-template/README.md
    • Modernized the README content, simplifying sections and updating the directory structure.
  • tooling/templates/plugin-template/agents/.gitkeep
    • Removed the empty .gitkeep file from the agents directory in the plugin template.
  • tooling/templates/plugin-template/hooks/hooks.json
    • Updated the hooks.json template to include a basic PreToolUse example hook structure.
Ignored Files
  • Ignored by pattern: .gemini/** (2)
    • .gemini/config.yaml
    • .gemini/styleguide.md
Activity
  • Smart ID: SMART-2026-02-15-1771184309xTt3dMIk91F2OlEDui6Z
  • Ledger: 54 entries (append-only JSONL)
  • Phases: 3 phases × 4 teammates + 1 iteration = 17 Opus agents
  • Verification: Build PASS, ShellCheck PASS, ActionLint PASS, JSON PASS
  • Challenger: 16/18 claims confirmed, 0 challenged, 0 regressions
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This is an excellent pull request that performs a significant and valuable cleanup across the repository. The refactoring to extract shared logic into hook_runner.py for Python hooks and lib.sh for shell scripts is a great improvement for maintainability and follows the DRY principle. The removal of dead code, standardization of plugin.json files, and modernization of the plugin template are all welcome changes. The improved exception handling and type hints also increase code quality. I've found a couple of minor areas for improvement, but overall this is a very strong contribution.

Comment on lines +137 to +139
local now expires_epoch
now="$(date -u +%s)"
expires_epoch="$(grep -o '"expires_epoch":[0-9]*' "$PERMIT_FILE" | grep -o '[0-9]*')"

Choose a reason for hiding this comment

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

medium

The active function uses grep to parse expires_epoch from JSON. This can be brittle and will fail with an error if the field is not found because set -u is enabled. For consistency with other scripts in this directory and for improved robustness, consider using jq with a grep fallback. This also allows you to safely handle cases where the field might be missing.

Suggested change
local now expires_epoch
now="$(date -u +%s)"
expires_epoch="$(grep -o '"expires_epoch":[0-9]*' "$PERMIT_FILE" | grep -o '[0-9]*')"
local now expires_epoch
now="$(date -u +%s)"
if has_jq; then
expires_epoch="$(jq -r '.expires_epoch // 0' "$PERMIT_FILE")"
else
expires_epoch="$(grep -o '"expires_epoch":[0-9]*' "$PERMIT_FILE" | grep -o '[0-9]*' || echo 0)"
fi
References
  1. Repository style guide requires proper error handling in shell scripts (line 115). The current implementation can fail with an error if the JSON field is missing. (link)

Comment on lines +35 to 41
### Added

- **docs/designs/ directory**: Referenced in CLAUDE.md but didn't exist, now created with .gitkeep

### Added

- **ecosystem architecture section**: New Section 8 in `docs/ARCHITECTURE.md` documenting the full developer setup beyond this marketplace (LSP plugins, IDE MCP, Service MCP, Browser MCP), how layers compose, and why separation matters

Choose a reason for hiding this comment

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

low

There appears to be a duplicated ### Added heading. You can merge the content under a single heading to improve readability.

Suggested change
### Added
- **docs/designs/ directory**: Referenced in CLAUDE.md but didn't exist, now created with .gitkeep
### Added
- **ecosystem architecture section**: New Section 8 in `docs/ARCHITECTURE.md` documenting the full developer setup beyond this marketplace (LSP plugins, IDE MCP, Service MCP, Browser MCP), how layers compose, and why separation matters
### Added
- **docs/designs/ directory**: Referenced in CLAUDE.md but didn't exist, now created with .gitkeep
- **ecosystem architecture section**: New Section 8 in `docs/ARCHITECTURE.md` documenting the full developer setup beyond this marketplace (LSP plugins, IDE MCP, Service MCP, Browser MCP), how layers compose, and why separation matters

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Refactors and de-duplicates hook and “Smart/Hades” infrastructure across the plugin marketplace, while removing dead code and syncing documentation/templates to the repo’s current layout.

Changes:

  • Extracts shared hookify hook execution logic into hookify/core/hook_runner.py, leaving thin per-event wrappers.
  • DRYs exodia smart scripts via a shared lib.sh and adds permit.sh active for a standardized “permit enabled” check.
  • Removes dead/duplicated docs/config (.gemini, docs/AGENTS.md), syncs specs/ADRs, and modernizes the plugin template + plugin manifests.

Reviewed changes

Copilot reviewed 31 out of 34 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tooling/templates/plugin-template/hooks/hooks.json Updates template hook config format and adds an example PreToolUse hook
tooling/templates/plugin-template/agents/.gitkeep Removes placeholder file from template
tooling/templates/plugin-template/README.md Simplifies/modernizes plugin template README and structure example
tooling/templates/plugin-template/CLAUDE.md Adds template plugin CLAUDE context file
tooling/templates/plugin-template/.claude-plugin/plugin.json Updates template manifest placeholders and removes template-only comment
plugins/otelwiki/.claude-plugin/plugin.json Adds keywords metadata
plugins/metacognitive-guard/hooks/scripts/ralph-loop.sh Emits warning when jq is missing (instead of silent disable)
plugins/metacognitive-guard/hooks/scripts/epistemic-guard.sh Delegates permit bypass check to exodia permit.sh active
plugins/hookify/hooks/userpromptsubmit.py Converts to thin wrapper calling shared hook runner
plugins/hookify/hooks/stop.py Converts to thin wrapper calling shared hook runner
plugins/hookify/hooks/pretooluse.py Converts to thin wrapper calling shared hook runner
plugins/hookify/hooks/posttooluse.py Converts to thin wrapper calling shared hook runner
plugins/hookify/hooks/init.py Removed empty package marker (per PR description)
plugins/hookify/hookify/utils/init.py Removed empty utils package marker (per PR description)
plugins/hookify/hookify/core/rule_engine.py Narrows permit-check exception handling; fixes Optional typing
plugins/hookify/hookify/core/hook_runner.py New shared hook execution implementation
plugins/feature-dev/.claude-plugin/plugin.json Adds repository/license/keywords metadata
plugins/exodia/scripts/smart/session-state.sh Uses shared has_jq helper
plugins/exodia/scripts/smart/permit.sh Uses shared atomic_write; adds active subcommand
plugins/exodia/scripts/smart/lib.sh Introduces shared helpers (has_jq, has_flock, atomic_write)
plugins/exodia/scripts/smart/ledger.sh Uses shared atomic_write for append
plugins/exodia/scripts/smart/checkpoint.sh Uses shared has_jq helper
plugins/exodia/.claude-plugin/plugin.json Adds keywords metadata
plugins/dotnet-architecture-lint/scripts/precheck-dotnet.py Delegates permit bypass to permit.sh active; narrows exception handling
plugins/dotnet-architecture-lint/CLAUDE.md Removes stale reference to non-existent skill file
docs/specs/spec-0001-framework-architecture.md Updates repo layout references (removes repo-level skills/)
docs/decisions/ADR-0001-marketplace-architecture.md Updates repo layout references (skills/agents live inside plugins)
docs/ARCHITECTURE.md Removes .gemini/ from tree; updates docs entry
docs/AGENTS.md Deletes duplicated subset doc (root AGENTS.md becomes SSOT)
docs/designs/.gitkeep Adds missing directory placeholder referenced elsewhere
CHANGELOG.md Documents refactors, removals, and doc sync updates
AGENTS.md Updates routing tree + command counts and adds new decision branches
.gemini/styleguide.md Removed Gemini config/doc (dead code purge)
.gemini/config.yaml Removed Gemini config (dead code purge)

Comment on lines +3 to +6
"PreToolUse": [
{
"matcher": "Bash|Edit|Write",
"hooks": [
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

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

The template PreToolUse matcher omits the MultiEdit tool, so any hook logic won’t run for MultiEdit operations by default. Other repo hooks (e.g. plugins/hookify/hooks/hooks.json) include MultiEdit in these matchers; consider updating the template matcher to include MultiEdit for parity and to avoid surprising gaps for new plugin authors.

Copilot uses AI. Check for mistakes.
Comment on lines +139 to +140
expires_epoch="$(grep -o '"expires_epoch":[0-9]*' "$PERMIT_FILE" | grep -o '[0-9]*')"

Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

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

active() runs under set -euo pipefail and assigns expires_epoch via a grep | grep pipeline. If the permit file is malformed (missing expires_epoch) that pipeline will fail and can cause the script to exit early due to -e/pipefail rather than simply returning inactive. Consider making expires_epoch extraction fail-closed (default 0 / return 1) so callers using permit.sh active don’t get unexpected hard failures.

Suggested change
expires_epoch="$(grep -o '"expires_epoch":[0-9]*' "$PERMIT_FILE" | grep -o '[0-9]*')"
expires_epoch="$(sed -n 's/.*"expires_epoch":\([0-9][0-9]*\).*/\1/p' "$PERMIT_FILE")"
if [ -z "$expires_epoch" ]; then
return 1
fi

Copilot uses AI. Check for mistakes.
CHANGELOG.md Outdated
Comment on lines 38 to 40

### Added

Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

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

There are two consecutive ### Added sections here, which breaks the Keep a Changelog structure and makes the Unreleased section harder to scan. These entries should be merged under a single ### Added heading.

Suggested change
### Added

Copilot uses AI. Check for mistakes.
CHANGELOG.md Outdated

- **hookify: extract shared hook_runner.py**: 4 near-identical handlers (pretooluse/posttooluse/stop/userpromptsubmit) reduced from 60-78 lines each to 18-line thin wrappers. Shared logic in `hookify/core/hook_runner.py` (~197 lines eliminated)
- **exodia smart scripts: extract lib.sh shared functions**: `has_jq()`, `has_flock()`, `atomic_write()` extracted from inline duplications across permit.sh, ledger.sh, checkpoint.sh, session-state.sh
- **exodia permit.sh: add `active` subcommand**: Canonical permit-active check replaces 3 inline reimplementations in epistemic-guard.sh, precheck-dotnet.py, and rule_engine.py
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

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

This entry says the new permit.sh active check replaces inline implementations in epistemic-guard.sh, precheck-dotnet.py, and rule_engine.py, but hookify’s rule_engine.py still reads .smart/delete-permit.json directly (no delegation to permit.sh). Either update the changelog text (and PR summary if applicable) or switch rule_engine to use the canonical permit.sh active check to match the documented behavior.

Suggested change
- **exodia permit.sh: add `active` subcommand**: Canonical permit-active check replaces 3 inline reimplementations in epistemic-guard.sh, precheck-dotnet.py, and rule_engine.py
- **exodia permit.sh: add `active` subcommand**: Adds canonical permit-active check for use by epistemic-guard.sh, precheck-dotnet.py, and rule_engine.py in place of their inline implementations (migration in progress)

Copilot uses AI. Check for mistakes.
ANcpLua and others added 2 commits February 16, 2026 06:24
- CLAUDE.md: replace deleted docs/AGENTS.md with actual docs/ contents
  (QUICK-REFERENCE.md, ENGINEERING-PRINCIPLES.md, designs/)
- CHANGELOG: merge duplicate Added sections, fix plugin.json wording
- AGENTS.md: add missing deep-analysis.md to compressed docs index

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- permit.sh: use jq with grep fallback for expires_epoch parsing (fail-safe under set -euo pipefail)
- lib.sh: add has_jq(), has_flock(), atomic_write() shared helpers
- CHANGELOG.md: merge duplicate ### Added headings, correct permit.sh scope claim
- plugin template hooks.json: add MultiEdit to matcher for parity

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 16, 2026 15:11
@ANcpLua ANcpLua merged commit 86a4c76 into main Feb 16, 2026
12 of 14 checks passed
@ANcpLua ANcpLua deleted the hades/smart-cleanup-elite branch February 16, 2026 15:15
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 27 out of 30 changed files in this pull request and generated 2 comments.

Comment on lines 75 to +82
# Check expiration
local now expires_epoch
now="$(date -u +%s)"
expires_epoch="$(grep -o '"expires_epoch":[0-9]*' "$PERMIT_FILE" | grep -o '[0-9]*')"
if has_jq; then
expires_epoch="$(jq -r '.expires_epoch // 0' "$PERMIT_FILE")"
else
expires_epoch="$(grep -o '"expires_epoch":[0-9]*' "$PERMIT_FILE" | grep -o '[0-9]*' || echo 0)"
fi
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

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

The PR description claims to add a permit.sh active subcommand, but this implementation only updates the validate() function to use has_jq() from lib.sh. The active subcommand mentioned in the PR description and referenced by precheck-dotnet.py (line 129: ['bash', matches[0], 'active']) appears to be missing from the implementation.

Copilot uses AI. Check for mistakes.

print(json.dumps(result), file=sys.stdout)

except Exception as e:
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

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

The PR description claims to narrow bare exceptions in hook_runner.py, but line 53 still uses except Exception as e which is a broad catch-all. For consistency with the narrowed exceptions in rule_engine.py (line 50) and precheck-dotnet.py (line 133), this should be narrowed to specific exception types like (json.JSONDecodeError, KeyError, AttributeError) or similar relevant exceptions that could occur during rule evaluation.

Suggested change
except Exception as e:
except (json.JSONDecodeError, KeyError, AttributeError, ValueError) as e:

Copilot uses AI. Check for mistakes.
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.

2 participants