Skip to content

refactor(agent-cli): scan /opt/plugins dynamically + verify Skill tool chain#8375

Merged
HydraOps-T-rav merged 1 commit intomainfrom
skill-loading-robustness
Apr 21, 2026
Merged

refactor(agent-cli): scan /opt/plugins dynamically + verify Skill tool chain#8375
HydraOps-T-rav merged 1 commit intomainfrom
skill-loading-robustness

Conversation

@HydraOps-T-rav
Copy link
Copy Markdown
Collaborator

Follow-up to #8374. Two small improvements:

1. Dynamic scan of /opt/plugins/*

agent_cli._DOCKER_PLUGIN_DIRS was a hardcoded tuple of three pre-cloned plugin paths. Adding a new plugin to Dockerfile.agent-base required a parallel edit here — easy to forget. Replaced with a single _PRE_CLONED_PLUGIN_ROOT = Path("/opt/plugins") constant + dynamic iterdir() scan. No API changes.

2. End-to-end verification of the Skill-tool chain

Probed the merged #8374 feature against real claude -p:

```
echo 'Use the Skill tool to invoke "superpowers:systematic-debugging"…'
| claude -p --output-format stream-json --verbose --permission-mode bypassPermissions …
```

Stream included "tool_use","name":"Skill","input":{"skill":"superpowers:systematic-debugging"} — the Skill tool IS exposed in -p mode and routes to plugins discovered from ~/.claude/plugins/cache/. Docker mode uses the same mechanism via host ~/.claude/ mount + CLAUDE_CONFIG_DIR. Documented in ADR-0043's new Verification section.

Test plan

  • 6 new unit tests in `tests/test_agent_cli_plugin_dirs.py` (flag emission on various filesystem states).
  • 8 existing `test_agent_cli.py` plugin-dir tests updated for the new constant name.
  • `make quality` green: 11,038 passed, 0 failures, exit 0.

🤖 Generated with Claude Code

agent_cli._DOCKER_PLUGIN_DIRS hardcoded three plugin paths. Adding a
new pre-cloned plugin in Dockerfile.agent-base required a parallel
edit here that was easy to forget. Replace with a single
_PRE_CLONED_PLUGIN_ROOT=/opt/plugins constant plus a dynamic scan.

Also adds 6 unit tests locking in the flag-emission contract, and a
Verification section in ADR-0043 documenting the host-mode probe that
proved claude -p correctly invokes the Skill tool for discovered
plugins.

No signature changes to build_agent_command / build_lightweight_command.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@HydraOps-T-rav HydraOps-T-rav merged commit 046f5fa into main Apr 21, 2026
20 checks passed
@HydraOps-T-rav HydraOps-T-rav deleted the skill-loading-robustness branch April 21, 2026 20:38
HydraOps-T-rav added a commit that referenced this pull request Apr 21, 2026
* docs(agents): 5 new avoided patterns + planner self-audit step

Retrospective of PR #8374/#8375 surfaced five recurring anti-patterns that the
plan review caught repeatedly. Document each in the canonical
`docs/agents/avoided-patterns.md` (the sensor enricher and audit agents already
read this file) and add a Planning-Steps self-audit reference so the planner
phase catches them BEFORE emitting a plan.

New patterns:
- Underscore-prefixed names imported across modules
- Writing a new test helper without checking conftest
- logger.error(value) without a format string
- Hardcoded path lists that duplicate filesystem state
- _name for unused loop variables (prefer bare _)

Catching these at plan-writing time prevents the agent-review-fix loop cost
observed in PR #8374 (8 fix commits beyond the initial 8 task commits).

* test(planner): bump truncation-test threshold for expanded planning-steps block

Adding the new step 8 (self-audit against avoided-patterns.md) grew the
planner prompt baseline by ~650 chars. The truncation test's `< 10_000`
sanity bound was tight; bump to 11_000. Semantic is unchanged —
"…(truncated)" marker assertion still verifies body truncation works
and the prompt remains well under the original 20k body size.

---------

Co-authored-by: T-rav-Hydra-Ops <t@koderex.dev>
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