Skip to content

feat(plugins): add skill-enforcer plugin for periodic compliance checkpoints#18849

Closed
Cyrene963 wants to merge 1 commit into
NousResearch:mainfrom
Cyrene963:feat/skill-enforcer-plugin
Closed

feat(plugins): add skill-enforcer plugin for periodic compliance checkpoints#18849
Cyrene963 wants to merge 1 commit into
NousResearch:mainfrom
Cyrene963:feat/skill-enforcer-plugin

Conversation

@Cyrene963

Copy link
Copy Markdown

Summary

Adds a new bundled plugin skill-enforcer that addresses the "having rules ≠ following rules" problem in LLM agents.

The Problem

Agents with skills, memory, and rules loaded in context still fail to follow them during execution. This is a behavioral issue, not a technical one — the rules are present but not enforced.

The Solution

A pre_tool_call hook plugin that triggers periodic COMPLIANCE CHECKPOINTS during agent execution:

  • Tracks action tool calls per session (terminal, write_file, patch, browser_*, delegate_task, cronjob, execute_code)
  • Every 8 action calls, blocks with a compliance verification message
  • Agent must acknowledge by calling skill_view, hindsight_recall, or session_search
  • Counter resets after acknowledgment
  • Non-action tools (read_file, search_files, web_search) don't count toward the limit
  • Per-session isolation

How It Works

Agent starts session
  → call #1-7: action tools pass freely
  → call #8: BLOCKED with COMPLIANCE CHECKPOINT
  → agent calls hindsight_recall() to acknowledge
  → call #9-16: action tools pass freely
  → call #16: BLOCKED again
  → ...repeat...

Complements PR #18316 (Hybrid Skill Selector)

Component Responsibility
PR #18316 (hybrid selector) Which skills to inject into system prompt
This plugin Periodic verification that injected rules are followed

Configuration

_CHECKPOINT_INTERVAL = 8 (configurable constant in __init__.py)

Testing

All scenarios verified:

  • ✅ First 7 action tools pass, 8th triggers checkpoint
  • ✅ Acknowledgment resets counter, next 8 pass
  • ✅ read_file/search_files don't increment counter
  • ✅ Sessions are independently tracked
  • ✅ Plugin loads and registers hook correctly

Files

  • plugins/skill-enforcer/plugin.yaml — manifest
  • plugins/skill-enforcer/__init__.py — hook implementation

…kpoints

Addresses the 'having rules != following rules' problem where the agent
has skills and memory loaded but fails to follow their rules during
execution. The plugin hooks into pre_tool_call and triggers compliance
checkpoints every N action tool calls.

How it works:
- Tracks 'action tool' calls per session (terminal, write_file, patch,
  browser_*, delegate_task, cronjob, execute_code, etc.)
- Every 8 action calls, blocks with a COMPLIANCE CHECKPOINT message
- Agent must call skill_view/hindsight_recall/session_search to acknowledge
- Counter resets after acknowledgment
- Non-action tools (read_file, search_files, web_search) don't count
- Per-session isolation (different sessions tracked independently)

Complements PR NousResearch#18316 (hybrid skill selector):
- PR NousResearch#18316 = which skills to inject into system prompt
- This plugin = periodic verification that injected rules are followed

Configurable via _CHECKPOINT_INTERVAL constant (default: 8).

Tested scenarios:
- First 7 action tools pass, 8th triggers checkpoint
- Acknowledgment resets counter, next 8 pass
- read_file/search_files don't increment counter
- Sessions are independently tracked
@Cyrene963 Cyrene963 force-pushed the feat/skill-enforcer-plugin branch from 7b56cc7 to cb07bfc Compare May 7, 2026 14:54
@Cyrene963

Copy link
Copy Markdown
Author

Closing this PR — the functionality has already been implemented locally in our fork's patch stack (local patch applied). The local implementation covers the same scope and has been running in production.

Thanks for the contribution! If upstream merges similar functionality, we'll rebase our patches accordingly.

@Cyrene963 Cyrene963 closed this May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants