Skip to content

Restructure as a cross-agent plugin - #1

Merged
anwai98 merged 6 commits into
mainfrom
plugin-restructure
Jul 22, 2026
Merged

anwai98 merged 6 commits into
mainfrom
plugin-restructure

Conversation

@anwai98

@anwai98 anwai98 commented Jul 22, 2026 •

Copy link
Copy Markdown
Owner

Makes the repo an installable plugin and its own marketplace, so the rules and skills apply everywhere after one install.

  • AGENTS.md is the single source of truth; CLAUDE.md imports it
  • SessionStart hook ships the rules globally; PreToolUse hook enforces the non-negotiable ones
  • Skill moved to skills/; tests + CI added

See docs/design.md for rationale.

🤖 Generated with Claude Code

anwai98 and others added 2 commits July 22, 2026 23:38
Make the repository an installable Claude Code plugin and its own
marketplace, so the rules and the skills apply in every repository on
any machine after one install.

- AGENTS.md holds the rules and is the single source of truth. Codex
  reads it directly. CLAUDE.md imports it and adds the rules that apply
  only to this repository.
- A SessionStart hook sends the rules into every session, because a
  plugin cannot supply a CLAUDE.md.
- A PreToolUse hook denies package installs and escalates a commit or a
  push to the user. Instructions are context and are not enforced, so
  the rules that must hold need a hook.
- Move the skill to skills/, the default location of a plugin.
- Add tests for both hooks and a CI workflow that runs them.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The push trigger and the pull request trigger both started a run for a
branch of a pull request, so every push ran the full matrix two times.
The push trigger now applies to main only.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@anwai98
anwai98 force-pushed the plugin-restructure branch from 42d3dae to f5a3b24 Compare July 22, 2026 21:45
anwai98 and others added 4 commits July 23, 2026 00:08
Add native Codex plugin and marketplace manifests while keeping the rules, skills, and hooks shared with Claude Code.

Strengthen command enforcement, expand regression coverage, document the dual-agent setup, and pin the skill validator used by CI.

Co-authored-by: codex <codex@openai.com>
Document the standing commit attribution rule for Codex-created commits.

Co-authored-by: codex <codex@openai.com>
Close the gaps that a code review found in the two hooks.

enforce-rules.sh:
- Inspect the command inside a runner, as in `micromamba run -n super pip
  install x`. A new `inspect_runner` reuses the subcommand parser to skip the
  runner options, then recurses into the nested command. This also covers
  `conda run`, `mamba run`, and `uv run`.
- Count a `--help` or a `--dry-run` only in an option position, so
  `git commit -m --help` stays a real commit and still asks the user.
- Read `python -m pip` in the attached form `-mpip` and inside a bundle of
  short options such as `-um pip`.
- Block every install verb, not only `install`: `uv add`, `uv sync`,
  `uv tool install`, and the conda and micromamba verbs `create`, `update`,
  `upgrade`, and `env create`/`env update`.
- Return early on an empty argument list, so the hook does not abort on bash
  3.2 under `set -u`. macOS ships bash 3.2, and the CI runs there.
- Hold the deny messages in named globals instead of repeated string literals.

emit-rules.sh:
- Read the plugin root from CLAUDE_PLUGIN_ROOT, then PLUGIN_ROOT, then the
  script location, so an empty variable no longer reads `/AGENTS.md`.
- Warn on stderr when the rules file or both JSON tools are absent, so a
  broken install does not look the same as a working one.

Add a Compatibility rule to AGENTS.md: do not add backward compatibility for a
new feature unless the user asks for it.

Extend tests/test-hooks.sh to cover all of the above. 128 pass, 0 fail.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VCMqu2544iQSf5yzWdqLg2
Harden nested preview parsing, heredocs, command prefixes, and Codex approval handling.

Co-authored-by: codex <codex@openai.com>
@anwai98
anwai98 merged commit dcd041e into main Jul 22, 2026
5 checks passed
@anwai98
anwai98 deleted the plugin-restructure branch July 22, 2026 23:25
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