Skip to content

feat(guardrails): add remaining 5 CC agent definitions#117

Merged
terisuke merged 1 commit intodevfrom
feat/guardrails-remaining-agents
Apr 6, 2026
Merged

feat(guardrails): add remaining 5 CC agent definitions#117
terisuke merged 1 commit intodevfrom
feat/guardrails-remaining-agents

Conversation

@terisuke
Copy link
Copy Markdown

@terisuke terisuke commented Apr 6, 2026

Issue for this PR

Closes #110

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Adds the final 5 Claude Code agent definitions that were missing from the OpenCode guardrails profile, bringing agent parity to 100% (31 agents total, covering all 26 CC agents + 5 OC originals).

New agents:

Agent Mode Key design decision
code-reviewer subagent (read-only) Expert code review with confidence-based severity filtering
database-administrator subagent (read-only) DB admin with read-only diagnostic bash commands (psql, mysql, mongosh, redis-cli)
mobile-developer subagent (edit/write) React Native + Flutter with standard implement-like permissions
refactor-cleaner subagent (edit/write ask) Dead code cleanup with scoped bash (knip, depcheck, ts-prune only)
security-reviewer subagent (read-only) OWASP Top 10 + CWE detection, proactive trigger on auth/input changes

Security: findLast pitfall avoided — No agent-level read: or grep: blocks are set. All agents inherit profile-level secret file deny rules (.env, .pem, .key, credentials, etc.) via the profile's opencode.json permission config. This follows the established pattern of review.md, investigate.md, and security.md.

How did you verify your code works?

  1. Typecheck: bun turbo typecheck — 13/13 pass
  2. Build: bun run --filter opencode build — smoke test pass
  3. Binary execution: opencode --version outputs correctly
  4. Code review: Ran code-reviewer agent, fixed CRITICAL findLast pitfall (removed agent-level read/grep overrides)

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Copilot AI review requested due to automatic review settings April 6, 2026 10:25
…r, database-administrator, mobile-developer, refactor-cleaner, security-reviewer)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

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

Adds the final missing Claude Code–parity agent definitions to the packages/guardrails profile so they can be loaded as OpenCode agents (bringing the profile to the stated full agent set).

Changes:

  • Added new read-only review agents: code-reviewer and security-reviewer
  • Added a read-only diagnostic database-administrator agent with a DB CLI bash allowlist
  • Added write-capable agents mobile-developer and refactor-cleaner (with permission constraints)

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/guardrails/profile/agents/security-reviewer.md Adds a read-only security-focused reviewer agent definition.
packages/guardrails/profile/agents/refactor-cleaner.md Adds a refactor/cleanup agent definition, including bash allowlist and ask-gated edits.
packages/guardrails/profile/agents/mobile-developer.md Adds a mobile-focused implementation agent definition with implement-like bash deny rules.
packages/guardrails/profile/agents/database-administrator.md Adds a read-only DBA agent definition with DB CLI diagnostic command allowlist.
packages/guardrails/profile/agents/code-reviewer.md Adds a read-only code quality reviewer agent definition.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +12 to +18
"npx knip*": allow
"npx depcheck*": allow
"npx ts-prune*": allow
"npx eslint*": allow
"bun run *": allow
"bun test*": allow
"npm run*": allow
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

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

The bash allowlist here is broader than the PR description/issue requirement (“scoped bash … knip/depcheck/ts-prune only”). Allowing bun run *, npm run*, and npx eslint* can execute arbitrary project scripts/binaries (including destructive ones) despite the intent of a narrowly-scoped refactor-cleaner. Tighten the bash allowlist to only the intended analysis commands (and any strictly necessary read-only helpers like git diff/status/log, ls, pwd, which).

Copilot uses AI. Check for mistakes.
Comment on lines +19 to +22
"psql --version*": allow
"psql -c 'EXPLAIN *": allow
"psql -c 'SELECT *": allow
"psql -c '\\d*": allow
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

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

Allowing arbitrary psql -c 'SELECT ...' is very broad for a “read-only diagnostic” agent: it can easily result in large data dumps/exfiltration and expensive queries (and Postgres also supports mutating forms like SELECT INTO). Consider narrowing the allowlist to safer diagnostics (e.g., EXPLAIN/catalog \d queries) or enforce constraints like requiring LIMIT / explicit schema-qualified tables.

Copilot uses AI. Check for mistakes.
"mysql --version*": allow
"mysql -e 'EXPLAIN *": allow
"mysql -e 'SHOW *": allow
"mysql -e 'SELECT *": allow
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

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

Similarly, allowing mysql -e 'SELECT ...' is broad for a diagnostic-only DBA agent and can lead to full-table reads or expensive queries. Consider restricting to EXPLAIN/SHOW-only patterns (or requiring SELECT statements to include LIMIT) to better align with the agent’s read-only diagnostic intent.

Suggested change
"mysql -e 'SELECT *": allow

Copilot uses AI. Check for mistakes.
@terisuke terisuke force-pushed the feat/guardrails-remaining-agents branch from 06fcb0b to 0a50eec Compare April 6, 2026 10:30
@terisuke terisuke merged commit 8c1ff9f into dev Apr 6, 2026
4 of 6 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.

feat(guardrails): remaining 5 CC agent definitions to OC

2 participants