Skip to content

feat(agent): cpm agent with V-model phase guardrails - #149

Draft
rkristelijn wants to merge 2 commits into
mainfrom
feat/cpm-agent-guardrails
Draft

feat(agent): cpm agent with V-model phase guardrails#149
rkristelijn wants to merge 2 commits into
mainfrom
feat/cpm-agent-guardrails

Conversation

@rkristelijn

Copy link
Copy Markdown
Owner

What

New /agent cpm that enforces cpm's V-model process boundaries. Blocks git/PR commands until checks pass.

Demo

> /agent cpm
[agent: cpm — Process-aware agent — enforces V-model phases]

> deploy my changes
<exec>git push origin main</exec>
[guardrail] git/PR commands blocked — complete check phase first. Run: make cpm-fast

Changes

  • res/agents/cpm.txt: system prompt enforcing design→test→implement→check→commit
  • res/agents/agents.yml: cpm agent with exec_deny_patterns
  • src/orchestrator/agent_config.h: add exec_deny_patterns + deny_message fields
  • src/orchestrator/agent_config.cpp: parse new YAML fields
  • src/repl/repl_annotations.cpp: check deny patterns in confirm_exec

How it works

  1. Agent has exec_deny_patterns: list of command prefixes to block
  2. Before user confirmation prompt, patterns are checked
  3. If match: command blocked, DENIED feedback returned to LLM
  4. LLM receives the denial and should adjust its approach
  5. All blocks logged to audit trail (exec_guardrail event)

Testing

  • 57 unit test scenarios pass
  • Manual test: mock provider + git push → blocked ✓

@see docs/adr/adr-121-cpm-quality-layer.md

New /agent cpm enforces process boundaries:
- Blocks git push/commit/add/merge and gh pr commands
- Returns DENIED feedback to the LLM so it learns the constraint
- deny_message explains what to do instead (make cpm-fast)

Architecture:
- exec_deny_patterns field on AgentConfig (list of command prefixes)
- deny_message field for human-readable guardrail explanation
- Check runs in confirm_exec before user prompt
- Blocked commands are logged to audit trail (exec_guardrail event)

The cpm agent prompt instructs the model to follow V-model phases:
design → test → implement → check → commit

@see docs/adr/adr-121-cpm-quality-layer.md
@coderabbitai

coderabbitai Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 4c8af909-3e6d-4080-bc14-15f3d06c66ef

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/cpm-agent-guardrails

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.

@sonarqubecloud

Copy link
Copy Markdown

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