Skip to content

feat(agent): add native plugin management - #42

Merged
lucifer1004 merged 2 commits into
mainfrom
agent-plugin-management
Jul 31, 2026
Merged

feat(agent): add native plugin management#42
lucifer1004 merged 2 commits into
mainfrom
agent-plugin-management

Conversation

@lucifer1004

@lucifer1004 lucifer1004 commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add project-independent govctl agent doctor|install|update workflows for Codex and Claude native plugins
  • keep runtime-specific agent projections and hook manifests while sharing governance semantics
  • provide bounded governed-project context on session start and non-blocking guidance before direct artifact edits
  • update RFC-0002, ADR-0061, skills, documentation, changelog, and focused tests

Governance

  • WI-2026-07-31-001: done
  • RFC-0002:C-AGENT-INTEGRATION v3.4.0: impl
  • ADR-0061: accepted

Validation

  • GUARD-GOVCTL-CHECK
  • GUARD-CARGO-TEST
  • cargo clippy --all-targets --all-features -- -D warnings
  • focused agent plugin, hook, describe, and agent-directory tests
  • compliance re-audit: pass

Summary by CodeRabbit

  • New Features

    • Added govctl agent doctor, install, and update commands for Claude and Codex.
    • Added native plugins, skills, reviewer agents, and lifecycle hooks.
    • Added session-start context and pre-edit guidance for governed artifacts.
    • Added dry-run previews, runtime detection, diagnostics, and update handling.
  • Documentation

    • Updated setup guides, validation guidance, changelog, and governance records.
  • Bug Fixes

    • Improved project discovery and preservation of existing configurations during integration updates.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 9cb98baa-5203-4a9c-977c-bd901bc8db17

📥 Commits

Reviewing files that changed from the base of the PR and between a36253a and 43a87a5.

📒 Files selected for processing (13)
  • CHANGELOG.md
  • docs/rfc/RFC-0002.md
  • gov/rfc/RFC-0002/clauses/C-AGENT-INTEGRATION.toml
  • gov/rfc/RFC-0002/clauses/C-GLOBAL-COMMANDS.toml
  • gov/rfc/RFC-0002/rfc.toml
  • gov/work/2026-07-31-harden-agent-plugin-installation-across-codex-and-claude.toml
  • src/cli/commands.rs
  • src/cmd/agent.rs
  • src/cmd/agent_hooks.rs
  • src/command_router/execute/builtin.rs
  • src/command_router/plan.rs
  • src/config/runtime.rs
  • tests/test_agent_plugin.rs
🚧 Files skipped from review as they are similar to previous changes (9)
  • gov/rfc/RFC-0002/clauses/C-AGENT-INTEGRATION.toml
  • gov/rfc/RFC-0002/clauses/C-GLOBAL-COMMANDS.toml
  • src/command_router/plan.rs
  • CHANGELOG.md
  • gov/rfc/RFC-0002/rfc.toml
  • src/config/runtime.rs
  • src/cmd/agent_hooks.rs
  • src/cmd/agent.rs
  • src/cli/commands.rs

📝 Walkthrough

Walkthrough

Adds govctl agent doctor, install, and update for Codex and Claude. The change bundles native plugin assets, projects runtime-specific files, adds session and pre-tool-use hooks, and documents the integration contract.

Changes

Agent integration

Layer / File(s) Summary
Integration contract
docs/rfc/RFC-0002.md, gov/adr/*, gov/rfc/RFC-0002/*, gov/work/*, CHANGELOG.md
Defines the unified agent command, runtime projections, hook behavior, and acceptance criteria.
Bundled plugin assets
.claude/*, build.rs, Cargo.toml, build_support/*, README.md, docs/guide/validation.md, AGENTS.md, Justfile
Packages plugin manifests and hooks, embeds assets at build time, and documents installation and workflow behavior.
CLI and command execution
src/cli/*, src/command_router/*, src/cmd/mod.rs, src/cmd/describe/catalog.rs, src/config/*, src/main.rs, src/diagnostic/*
Adds agent command parsing, routing, project-independent execution, explicit directory tracking, and agent diagnostics.
Runtime installation management
src/cmd/agent.rs
Implements diagnostics, installation, updates, plugin materialization, Codex role projection, and operation reporting.
Native hook handling
src/cmd/agent_hooks.rs, src/config/runtime.rs
Adds session-start context, lifecycle-edit advisories, bounded hook output, recovery diagnostics, and governed-project discovery.
Integration validation
tests/test_agent_plugin.rs, tests/test_agent_dir.rs, tests/test_describe.rs, src/cmd/agent.rs, src/command_router/execute/builtin.rs
Validates runtime operations, generated assets, dry runs, hooks, project discovery, recovery behavior, completion filtering, and command exposure.

Estimated code review effort: 5 (Critical) | ~120 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CLI
  participant CommandRouter
  participant AgentManager
  participant Codex
  participant Claude
  CLI->>CommandRouter: parse govctl agent install or update
  CommandRouter->>AgentManager: dispatch runtime operation
  AgentManager->>Codex: project and install Codex assets
  AgentManager->>Claude: project and install Claude assets
  AgentManager-->>CLI: return diagnostics and status
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 48.24% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ 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 clearly and concisely describes the main change: native plugin management for agent integrations.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent-plugin-management

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.

@codecov

codecov Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.70507% with 54 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/cmd/agent.rs 87.95% 36 Missing ⚠️
src/cmd/agent_hooks.rs 93.20% 18 Missing ⚠️

📢 Thoughts on this report? Let us know!

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🧹 Nitpick comments (9)
src/config/runtime.rs (1)

33-46: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value

Handle relative start paths in governed_root_from.

The loop calls current.pop() to walk ancestors. If start is relative, pop() reduces the path to an empty PathBuf and the loop stops after re-checking the process working directory. True ancestors are never inspected. Current callers pass absolute paths: find_config uses std::env::current_dir(), and read_hook_input in src/cmd/agent_hooks.rs normalizes cwd to an absolute path. The method is pub(crate), so a future caller can pass a relative path and get silent Ok(None).

Canonicalize or absolutize start at entry to make the contract explicit.

♻️ Suggested hardening
     pub(crate) fn governed_root_from(start: &Path) -> DiagnosticResult<Option<PathBuf>> {
-        let mut current = start.to_path_buf();
+        let mut current = if start.is_absolute() {
+            start.to_path_buf()
+        } else {
+            std::env::current_dir()
+                .map_err(|err| Diagnostic::io_error("resolve current directory", err, "."))?
+                .join(start)
+        };
         loop {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/config/runtime.rs` around lines 33 - 46, Update governed_root_from to
canonicalize or otherwise convert start to an absolute path before initializing
current, preserving the existing ancestor traversal and governance checks while
ensuring relative inputs inspect their true parent directories.
src/cmd/agent_hooks.rs (4)

167-183: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value

Consider shell redirect patterns in command payloads.

managed_edit_target inspects command only through patch_path, which matches Codex apply_patch headers. A Claude Bash call that writes a governance artifact directly, for example cat > gov/work/x.toml <<'EOF' or printf ... > gov/releases.toml, produces no advisory. The advisory is best-effort, so this is not a defect. If broader coverage is a requirement of RFC-0002:C-AGENT-INTEGRATION, add redirect-target extraction.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/cmd/agent_hooks.rs` around lines 167 - 183, Extend managed_edit_target’s
command inspection to recognize shell output redirection targets in addition to
patch_path results, including commands such as cat or printf writing governance
artifacts. Extract each redirect destination and pass it through
is_lifecycle_managed_path using the existing project_root and input.cwd context,
while preserving the current apply_patch handling and best-effort behavior.

227-243: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value

Guard ParentDir against popping the root.

normalize_path pops unconditionally for Component::ParentDir. For a path such as /../gov/work/a.toml, pop() removes the RootDir component. The result is the relative path gov/work/a.toml. In is_lifecycle_managed_path, strip_prefix against the absolute project_root then fails and the advisory is skipped. The outcome is fail-safe, so this is not a correctness break for the advisory. Skip the pop when the accumulated path is a root or a prefix to keep the helper reusable.

♻️ Suggested change
             Component::ParentDir => {
-                normalized.pop();
+                if !matches!(
+                    normalized.components().next_back(),
+                    Some(Component::RootDir | Component::Prefix(_)) | None
+                ) {
+                    normalized.pop();
+                }
             }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/cmd/agent_hooks.rs` around lines 227 - 243, Update normalize_path’s
Component::ParentDir handling to avoid popping when the accumulated normalized
path is already a filesystem root or prefix; only pop ordinary path components.
Preserve normal parent-directory normalization while ensuring paths such as
`/../gov/work/a.toml` remain absolute.

274-298: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add negative-path tests for the advisory scope.

The two tests cover the character limit and the recovery case. Three behaviors carry the advisory contract and have no test:

  • is_lifecycle_managed_path must return false for paths outside gov/, for gov/config.toml, and for gov/releases.toml/extra.
  • managed_edit_target must detect a path from a command payload through patch_path.
  • bound_context must return the input unchanged when the length equals HOOK_CONTEXT_CHAR_LIMIT.

Add these cases to lock the boundaries before the advisory logic changes.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/cmd/agent_hooks.rs` around lines 274 - 298, Add negative-path tests near
the existing hook scope tests: verify is_lifecycle_managed_path returns false
for paths outside gov/, gov/config.toml, and gov/releases.toml/extra; verify
managed_edit_target recognizes a command payload containing patch_path; and
verify bound_context returns input unchanged when its length equals
HOOK_CONTEXT_CHAR_LIMIT.

211-215: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Prevent drift between this artifact list and Config.

The match hard-codes rfc, adr, work, guard, conformance, and releases.toml. Config in src/config/runtime.rs already exposes rfc_dir, adr_dir, work_dir, guard_dir, conformance_dir, and releases_path. Duplicating the list here is justified, because the pre-tool-use path must work without a loadable config. Add a shared constant slice for the directory names so a new artifact kind updates both places at once.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/cmd/agent_hooks.rs` around lines 211 - 215, Define a shared constant
slice for the artifact directory names and use it in the artifact check around
the shown components match instead of hard-coding the `rfc`, `adr`, `work`,
`guard`, and `conformance` alternatives. Keep `releases.toml` handling separate,
and update `Config`’s corresponding directory-name usage to reference the same
constant so additions remain synchronized.
src/cli/commands.rs (1)

90-96: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add RFC traceability comments to the new agent surface. The surrounding code annotates command definitions and lock classifications with [[RFC-...]] citations, but the new agent code paths carry none. The shared root cause is missing clause references for the agent integration contract.

  • src/cli/commands.rs#L90-L96: cite [[RFC-0002:C-AGENT-INTEGRATION]] and [[RFC-0002:C-GLOBAL-COMMANDS]] on the Agent command variant.
  • src/command_router/plan.rs#L174-L175: cite the clause that keeps user-scoped agent operations outside the gov-root write-lock class, in the same style as the Search arm.

As per coding guidelines: "Implement behavior in Rust only according to normative RFC requirements; cite applicable RFC clauses when implementing invariants."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/cli/commands.rs` around lines 90 - 96, Add RFC traceability comments to
the Agent variant in src/cli/commands.rs at lines 90-96, citing
[[RFC-0002:C-AGENT-INTEGRATION]] and [[RFC-0002:C-GLOBAL-COMMANDS]]. Also
annotate the corresponding agent arm in src/command_router/plan.rs at lines
174-175 with the clause establishing that user-scoped agent operations remain
outside the gov-root write-lock class, matching the Search arm’s citation style.

Source: Coding guidelines

src/cmd/agent.rs (3)

44-58: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Document why doctor() probes with Update instead of Doctor.

doctor() calls check_runtime(*runtime, AgentPluginOperation::Update). check_runtime has no match arm for AgentPluginOperation::Doctor; only Install and Update are handled. Using Update gives the broadest probe set, since Claude with Update checks both Install and Update readiness. This is not obvious from reading the code alone.

Add a short comment at the doctor() call site explaining that Update is used deliberately to get the most comprehensive readiness check, not because Doctor maps to Update semantically.

Also applies to: 133-151

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/cmd/agent.rs` around lines 44 - 58, Document the deliberate
AgentPluginOperation::Update argument at the check_runtime call inside doctor(),
noting that Update provides the broadest readiness probe because it checks both
Install and Update capabilities, rather than representing Doctor semantically.
Add only a short explanatory comment and leave the existing probing behavior
unchanged.

233-260: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Replace the hardcoded manifest count with a named constant.

validate_bundled_versions requires checked == 2 bundled plugin.json manifests. This number is not tied to any symbolic definition of the supported runtime count.

Introduce a named constant (for example, const EXPECTED_PLUGIN_MANIFEST_COUNT: usize = 2;) with a comment linking it to the two supported runtimes (Codex and Claude). This makes the invariant self-documenting for future maintainers adding a runtime.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/cmd/agent.rs` around lines 233 - 260, In validate_bundled_versions,
replace the hardcoded checked != 2 comparison with a named
EXPECTED_PLUGIN_MANIFEST_COUNT constant set to 2. Define the constant near the
function and document that it represents the two supported runtimes, Codex and
Claude; use it in the error message as well.

184-200: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low value

Old versioned plugin bundles are never cleaned up.

materialize_plugin writes plugin assets under marketplace_root/versions/{CARGO_PKG_VERSION}/.claude on every install or update, but nothing removes assets from prior govctl versions. Over repeated upgrades, the user-scoped marketplace_root directory accumulates stale versioned bundles indefinitely.

Consider pruning versions/* directories that do not match the current CARGO_PKG_VERSION after materializing the current one, or documenting that this is left to manual/OS-level cleanup.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/cmd/agent.rs` around lines 184 - 200, Update materialize_plugin to prune
stale directories under marketplace_root/versions after successfully
materializing the current version, preserving the directory matching
CARGO_PKG_VERSION and removing prior versioned bundles. Keep the current
manifest and asset-writing behavior unchanged, and propagate filesystem cleanup
errors through DiagnosticResult.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@gov/rfc/RFC-0002/clauses/C-AGENT-INTEGRATION.toml`:
- Around line 16-20: Add a language identifier such as text or sh to the
canonical command fence in gov/rfc/RFC-0002/clauses/C-AGENT-INTEGRATION.toml at
lines 16-20, then regenerate the rendered projection at docs/rfc/RFC-0002.md
lines 1048-1052; do not edit the generated Markdown directly.
- Around line 16-22: Define the hook adapter subcommands, invocation contract,
and runtime-selector exception in
gov/rfc/RFC-0002/clauses/C-AGENT-INTEGRATION.toml (lines 16-22), then
synchronize gov/rfc/RFC-0002/clauses/C-GLOBAL-COMMANDS.toml (lines 207-213) and
regenerate docs/rfc/RFC-0002.md (lines 1046-1054); keep
.claude/hooks/claude.json (lines 8-20) aligned with the corrected grammar.

In `@src/cmd/agent_hooks.rs`:
- Around line 68-71: Update handle_session_start so warnings from
load_work_items_with_warnings are appended to the existing lines and included in
the final bound_context output instead of being returned as Err. Preserve the
project summary and active work context, adding each warning as an extra line;
only escalate warnings if required by RFC-0002 and document that requirement in
a comment.
- Around line 185-194: Update patch_path to trim trailing whitespace from the
path extracted after matching the patch header prefixes, including CRLF carriage
returns and trailing spaces, while preserving the existing prefix detection and
return behavior.

In `@tests/test_agent_plugin.rs`:
- Around line 133-135: Strengthen the dry-run log assertions by first verifying
that the log read from log_path is non-empty, then retain the existing all-lines
--help assertion. Update the test around the log variable so a skipped preflight
cannot satisfy the test through vacuous all() behavior.

---

Nitpick comments:
In `@src/cli/commands.rs`:
- Around line 90-96: Add RFC traceability comments to the Agent variant in
src/cli/commands.rs at lines 90-96, citing [[RFC-0002:C-AGENT-INTEGRATION]] and
[[RFC-0002:C-GLOBAL-COMMANDS]]. Also annotate the corresponding agent arm in
src/command_router/plan.rs at lines 174-175 with the clause establishing that
user-scoped agent operations remain outside the gov-root write-lock class,
matching the Search arm’s citation style.

In `@src/cmd/agent_hooks.rs`:
- Around line 167-183: Extend managed_edit_target’s command inspection to
recognize shell output redirection targets in addition to patch_path results,
including commands such as cat or printf writing governance artifacts. Extract
each redirect destination and pass it through is_lifecycle_managed_path using
the existing project_root and input.cwd context, while preserving the current
apply_patch handling and best-effort behavior.
- Around line 227-243: Update normalize_path’s Component::ParentDir handling to
avoid popping when the accumulated normalized path is already a filesystem root
or prefix; only pop ordinary path components. Preserve normal parent-directory
normalization while ensuring paths such as `/../gov/work/a.toml` remain
absolute.
- Around line 274-298: Add negative-path tests near the existing hook scope
tests: verify is_lifecycle_managed_path returns false for paths outside gov/,
gov/config.toml, and gov/releases.toml/extra; verify managed_edit_target
recognizes a command payload containing patch_path; and verify bound_context
returns input unchanged when its length equals HOOK_CONTEXT_CHAR_LIMIT.
- Around line 211-215: Define a shared constant slice for the artifact directory
names and use it in the artifact check around the shown components match instead
of hard-coding the `rfc`, `adr`, `work`, `guard`, and `conformance`
alternatives. Keep `releases.toml` handling separate, and update `Config`’s
corresponding directory-name usage to reference the same constant so additions
remain synchronized.

In `@src/cmd/agent.rs`:
- Around line 44-58: Document the deliberate AgentPluginOperation::Update
argument at the check_runtime call inside doctor(), noting that Update provides
the broadest readiness probe because it checks both Install and Update
capabilities, rather than representing Doctor semantically. Add only a short
explanatory comment and leave the existing probing behavior unchanged.
- Around line 233-260: In validate_bundled_versions, replace the hardcoded
checked != 2 comparison with a named EXPECTED_PLUGIN_MANIFEST_COUNT constant set
to 2. Define the constant near the function and document that it represents the
two supported runtimes, Codex and Claude; use it in the error message as well.
- Around line 184-200: Update materialize_plugin to prune stale directories
under marketplace_root/versions after successfully materializing the current
version, preserving the directory matching CARGO_PKG_VERSION and removing prior
versioned bundles. Keep the current manifest and asset-writing behavior
unchanged, and propagate filesystem cleanup errors through DiagnosticResult.

In `@src/config/runtime.rs`:
- Around line 33-46: Update governed_root_from to canonicalize or otherwise
convert start to an absolute path before initializing current, preserving the
existing ancestor traversal and governance checks while ensuring relative inputs
inspect their true parent directories.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 822346ae-234f-4f4c-9d2e-47cae423428d

📥 Commits

Reviewing files that changed from the base of the PR and between 5cc6812 and a36253a.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (42)
  • .claude/.claude-plugin/plugin.json
  • .claude/.codex-plugin/plugin.json
  • .claude/hooks/claude.json
  • .claude/hooks/codex.json
  • .claude/skills/discuss/SKILL.md
  • .claude/skills/gov/SKILL.md
  • .claude/skills/init/SKILL.md
  • .claude/skills/spec/SKILL.md
  • AGENTS.md
  • CHANGELOG.md
  • Cargo.toml
  • Justfile
  • README.md
  • build.rs
  • build_support/agent_templates.rs
  • docs/guide/validation.md
  • docs/rfc/RFC-0002.md
  • gov/adr/ADR-0033-distribute-govctl-agent-integration-as-claude-code-plugin.toml
  • gov/adr/ADR-0061-use-one-agent-integration-command-with-client-specific-projections.toml
  • gov/rfc/RFC-0002/clauses/C-AGENT-INTEGRATION.toml
  • gov/rfc/RFC-0002/clauses/C-GLOBAL-COMMANDS.toml
  • gov/rfc/RFC-0002/rfc.toml
  • gov/work/2026-07-31-harden-agent-plugin-installation-across-codex-and-claude.toml
  • src/cli/commands.rs
  • src/cli/help.rs
  • src/cli/mod.rs
  • src/cmd/agent.rs
  • src/cmd/agent_hooks.rs
  • src/cmd/describe/catalog.rs
  • src/cmd/mod.rs
  • src/cmd/new/skills.rs
  • src/command_router/execute/builtin.rs
  • src/command_router/parsed.rs
  • src/command_router/plan.rs
  • src/config/mod.rs
  • src/config/runtime.rs
  • src/diagnostic/code/metadata.rs
  • src/diagnostic/code/mod.rs
  • src/main.rs
  • tests/test_agent_dir.rs
  • tests/test_agent_plugin.rs
  • tests/test_describe.rs

Comment thread gov/rfc/RFC-0002/clauses/C-AGENT-INTEGRATION.toml Outdated
Comment on lines +16 to +22
```
govctl agent doctor <codex|claude|all>
govctl agent install <codex|claude|all>
govctl agent update <codex|claude|all>
```

The runtime selector is required. `all` selects Codex and Claude.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Define the hook adapter command in the normative command grammar.

The Claude manifest invokes govctl agent hook session-start and govctl agent hook pre-tool-use. The normative grammar lists only doctor, install, and update, and requires a runtime selector. The installed hook invocation is therefore outside the governing command contract.

  • gov/rfc/RFC-0002/clauses/C-AGENT-INTEGRATION.toml#L16-L22: Define the hook adapter subcommands, their invocation contract, and their runtime-selector exception, or replace the hook invocation with a listed command.
  • gov/rfc/RFC-0002/clauses/C-GLOBAL-COMMANDS.toml#L207-L213: Synchronize the global command grammar with the canonical clause.
  • docs/rfc/RFC-0002.md#L1046-L1054: Regenerate this rendered projection from the corrected canonical clause.
  • .claude/hooks/claude.json#L8-L20: Keep these invocations aligned with the corrected normative grammar.

As per coding guidelines, gov/rfc/**/*.toml RFCs are normative authority and code must not conflict with normative RFC content.

📍 Affects 4 files
  • gov/rfc/RFC-0002/clauses/C-AGENT-INTEGRATION.toml#L16-L22 (this comment)
  • gov/rfc/RFC-0002/clauses/C-GLOBAL-COMMANDS.toml#L207-L213
  • docs/rfc/RFC-0002.md#L1046-L1054
  • .claude/hooks/claude.json#L8-L20
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@gov/rfc/RFC-0002/clauses/C-AGENT-INTEGRATION.toml` around lines 16 - 22,
Define the hook adapter subcommands, invocation contract, and runtime-selector
exception in gov/rfc/RFC-0002/clauses/C-AGENT-INTEGRATION.toml (lines 16-22),
then synchronize gov/rfc/RFC-0002/clauses/C-GLOBAL-COMMANDS.toml (lines 207-213)
and regenerate docs/rfc/RFC-0002.md (lines 1046-1054); keep
.claude/hooks/claude.json (lines 8-20) aligned with the corrected grammar.

Source: Coding guidelines

Comment thread src/cmd/agent_hooks.rs Outdated
Comment thread src/cmd/agent_hooks.rs
Comment thread tests/test_agent_plugin.rs
@lucifer1004
lucifer1004 merged commit dfaf281 into main Jul 31, 2026
8 checks passed
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