Skip to content

feat(agents): add disallowedTools frontmatter to non-writer agents (#378)#382

Merged
azalio merged 1 commit into
mainfrom
claude/compassionate-cerf-pkvli6
Jul 23, 2026
Merged

feat(agents): add disallowedTools frontmatter to non-writer agents (#378)#382
azalio merged 1 commit into
mainfrom
claude/compassionate-cerf-pkvli6

Conversation

@azalio

@azalio azalio commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes #378 — enforce capability boundaries at the harness level for four high-use agents that should never edit code. Previously these agents relied on prompt-text alone; now the harness enforces the restriction directly.

Changes per agent:

  • monitor: disallowedTools: [Edit, Agent] — Write kept (may write .map/ evidence artifacts)
  • research-agent: disallowedTools: [Edit, Agent] — Write kept (may append to research artifact in MAP-planning mode)
  • predictor: disallowedTools: [Edit, Write, Agent]
  • evaluator: disallowedTools: [Edit, Write, Agent]

task-decomposer already has permissionMode: plan and is unchanged. actor and final-verifier are intentionally excluded as legitimate writers.

Files changed:

  • src/mapify_cli/templates_src/agents/{monitor,research-agent,predictor,evaluator}.md.jinja — source edits
  • Propagated via make render-templates to .claude/agents/ and src/mapify_cli/templates/agents/
  • tests/test_agent_frontmatter.py — new TestAgentCapabilityHardening class with 15 targeted assertions
  • docs/ARCHITECTURE.md — capability constraint notes added per agent spec

Test plan

  • uv run python -m pytest tests/test_agent_frontmatter.py -v — 17 passed (15 new capability tests + 2 existing)
  • uv run python -m pytest tests/test_template_render.py -v — all render parity + check-render tests pass
  • uv run python -m pytest tests/ -v — 4074 passed, 4 skipped
  • uv run ruff check src/ tests/ — all checks passed
  • make render-templates — propagated cleanly to all generated trees

Generated by Claude Code

Summary by CodeRabbit

  • New Features

    • Added clearer capability boundaries for automated workflow roles.
    • Analysis and evaluation roles are now prevented from making edits or launching additional actions.
    • Monitoring and research roles retain approved evidence-writing capabilities while remaining restricted from unrelated modifications.
    • Updated research processing to use a lighter-weight model where applicable.
  • Tests

    • Added coverage to verify role permissions and preserve existing planning and writing behaviors.

)

Enforce capability boundaries at the harness level for four high-use
agents that should never edit code:

- monitor: disallowedTools: [Edit, Agent]
  (Write kept — may write .map/ evidence artifacts)
- research-agent: disallowedTools: [Edit, Agent]
  (Write kept — may append to research artifact in MAP-planning mode)
- predictor: disallowedTools: [Edit, Write, Agent]
- evaluator: disallowedTools: [Edit, Write, Agent]

task-decomposer already has permissionMode: plan and is unchanged.
actor and final-verifier are intentionally excluded as legitimate writers.

Propagates .jinja source through make render-templates to all generated
trees (.claude/agents/, src/mapify_cli/templates/agents/).

Adds TestAgentCapabilityHardening in tests/test_agent_frontmatter.py
with 15 targeted assertions pinning the new contracts and guarding against
silent removal. Updates docs/ARCHITECTURE.md with capability constraint
notes per agent.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ncmsm1CnxkN9e6cgLGoDT8
@azalio
azalio merged commit 36feab0 into main Jul 23, 2026
1 of 2 checks passed
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6ad0492a-9182-4e54-855b-18cbfb41ddf5

📥 Commits

Reviewing files that changed from the base of the PR and between 1bf45c9 and f9025dd.

📒 Files selected for processing (14)
  • .claude/agents/evaluator.md
  • .claude/agents/monitor.md
  • .claude/agents/predictor.md
  • .claude/agents/research-agent.md
  • docs/ARCHITECTURE.md
  • src/mapify_cli/templates/agents/evaluator.md
  • src/mapify_cli/templates/agents/monitor.md
  • src/mapify_cli/templates/agents/predictor.md
  • src/mapify_cli/templates/agents/research-agent.md
  • src/mapify_cli/templates_src/agents/evaluator.md.jinja
  • src/mapify_cli/templates_src/agents/monitor.md.jinja
  • src/mapify_cli/templates_src/agents/predictor.md.jinja
  • src/mapify_cli/templates_src/agents/research-agent.md.jinja
  • tests/test_agent_frontmatter.py

📝 Walkthrough

Walkthrough

Changes

The PR adds explicit disallowedTools metadata to four Claude agents across source and rendered templates, documents the capability contracts, and adds tests validating restrictions and writer exceptions.

Agent capability hardening

Layer / File(s) Summary
Agent capability metadata
.claude/agents/*, src/mapify_cli/templates/agents/*, src/mapify_cli/templates_src/agents/*
Monitor and ResearchAgent deny Edit and Agent; Predictor and Evaluator additionally deny Write.
Architecture capability contracts
docs/ARCHITECTURE.md
Documents the restrictions, ResearchAgent’s Haiku model, and its limited research-artifact write exception.
Frontmatter regression coverage
tests/test_agent_frontmatter.py
Parses agent frontmatter and checks tool restrictions, plan mode, and writer-agent exceptions.

Estimated code review effort: 2 (Simple) | ~10 minutes

Poem

I’m a rabbit with a tidy map,
No rogue tools can spring the trap.
Monitor watches, writers write,
Predictors reason, scores stay right.
Frontmatter guards the path—
Hop, hop, safer agents at last!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/compassionate-cerf-pkvli6

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.

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.

[Claude sub-agents] Add frontmatter capability hardening for high-use agents

2 participants