Hardening Local AI Agents: Fixing 60-Character Skill Truncation and Smart-Approval Gaps in Nemotron + Hermes

Technical diagram illustrating the 60-character skill routing fix for Nextcloud and GitLab and the explicit human approval gate for new-project
Technical diagram illustrating the 60-character skill routing fix for Nextcloud and GitLab and the explicit human approval gate for new-project
Fixing two real-world failure modes in local Nemotron + Hermes Agent deployments: fitting skill triggers inside the 60-character index limit and enforcing an unbypassable human approval gate on shared project creation.

In our previous architectural deep dive, we laid out the blueprint for a Sovereign Principal-Agent Collaborative Workspace—connecting two autonomous AI agents across a Nextcloud WebDAV correspondence ledger and a dual-gated GitLab execution plane. Every integration script passed its isolated API, ETag locking, and guardrail checks on day one.

Then we put a real local small-footprint model—Nemotron-3.5-Bolt (32K context) running via Ollama inside Hermes Agent—at the controls in live interactive sessions. Immediately, two subtle framework-level failure modes surfaced that isolated script tests never catch:

  1. Silent Routing Failure: Asking the agent to check a remote project log like projects/<project>/correspondence.md caused it to ignore the workspace skill completely and call local read_file, failing with File not found.
  2. Smart-Approval Bypass: Even with a custom dangerous-command regex guarding shared project creation (new-project), the default smart approval guardian could evaluate the Python CLI invocation as benign and auto-approve it without prompting the human principal.

Here is how we diagnosed both bugs at the source-code level inside Hermes Agent, patched them cleanly without sacrificing developer ergonomics, and verified every layer with automated unit suites and live local-LLM runs.


1. Root Cause #1: The 60-Character Skill Index Cliff

When Hermes Agent assembles its system prompt, it does not inject every installed SKILL.md file in full (which would rapidly consume a 32K local context budget). Instead, it builds an <available_skills> directory containing each skill’s name and frontmatter description.

Inspecting agent/skill_utils.py and the live .skills_prompt_snapshot.json cache revealed a hard constant: SKILL_PROMPT_DESC_LIMIT = 60. Any skill description longer than 60 characters is silently clipped to 57 characters plus ... inside the prompt index.

Our original prose description looked thorough on disk—over 220 characters explaining WebDAV, GitLab’s agents group, and owner-only authorization—but inside the system prompt sent to Nemotron, it collapsed into:

- agent-workspace: Collaborate with Bill and Bill's agent (agent-bill) via t...

Every critical routing cue—Nextcloud, WebDAV, GitLab, projects/, and correspondence.md—had been truncated off the end. Worse, neither SOUL.md nor MEMORY.md mentioned the remote workspace skill. So when a user typed check projects/<name>/correspondence.md at reasoning_effort: low, the local model saw no relevant skill in its index and understandably treated the path as a local file.

The Fix: Routing-Dense Descriptions + Explicit Remote Disambiguation

  • Fit inside the 60-character budget: We rewrote the SKILL.md frontmatter description to exactly 60 characters—"Nextcloud Agent Workspace & GitLab shared projects with Bill"—eliminating truncation and keeping every key trigger word visible in <available_skills>, while tightening SKILL.md to ~7.7 KB with a clear ## When to Use section for 32K context efficiency.
  • Disambiguate remote paths in persistent context: We added concise one-line notes in MEMORY.md and SOUL.md stating explicitly that projects/<name>/correspondence.md, brief.md, and agents/<project> are remote Nextcloud/GitLab targets accessed via skill_view("agent-workspace")—never local read_file or search_files.
  • Refresh the prompt snapshot: Rebuilding .skills_prompt_snapshot.json and running Hermes’s lint_skill tool confirmed the description-length warning was completely cleared.

2. Root Cause #2: The Smart-Approval Guardian Trap

Our second discovery happened when we audited the authorization boundary for creating shared projects. In a principal-agent architecture, creating a new repository or shared workspace folder must require explicit human confirmation—never silent execution triggered by an external request or autonomous drift.

Initially, we had added a custom regex pattern inside tools/approval.py (DANGEROUS_PATTERNS) matching gitlab.py ... new-project and workspace.py ... new-project, alongside approvals.deny rules blocking raw curl, wget, and glab project creation.

However, when config.yaml omits approvals.mode, Hermes defaults to smart mode (hermes_cli/config_defaults.py). In smart mode, check_all_command_guards() runs Phase 2.5 before prompting the user: it sends any flagged command to _smart_approve()—an auxiliary LLM risk reviewer whose prompt explicitly treats benign Python script invocations as safe.

When we tested _smart_approve() live against nemotron-3.5-bolt:32k on:

python3 ~/.hermes/skills/agent-workspace/scripts/gitlab.py new-project demo-proj "Test"

the auxiliary model returned approve—quietly bypassing the interactive human prompt entirely.

The Fix: Human-Only Escalation & Closed Bypass Surfaces

Simply flipping the entire host to approvals.mode: manual would force interactive prompts on every harmless python3 -c inspection command. Instead, we kept approvals.mode: smart for everyday ergonomics and hardened the specific principal-authorization boundary in three layers:

  1. Non-smart-approvable gate in tools/approval.py: We introduced _EXPLICIT_HUMAN_ONLY_KEYS containing the new-project pattern key. In check_all_command_guards(), any warning matching _EXPLICIT_HUMAN_ONLY_KEYS skips Phase 2.5 (_smart_approve) unconditionally and disables permanent [a]lways allowlisting via a shared _persist_warning_approvals() helper—so interactive CLI prompts only offer [o]nce | [s]ession | [d]eny, while unattended -q single-query and cron runs still fail closed (BLOCKED).
  2. Defense-in-depth policy & expanded deny rules in config.yaml: We explicitly declared approvals.mode: smart, added an approvals.smart_policy rule instructing the guardian to escalate new-project, and expanded approvals.deny to block inline *python*/api/v4/projects* and *http*/api/v4/projects* calls in addition to curl, wget, and glab.
  3. Clean auxiliary Ollama resolution: Adding api_key: ollama under providers.ollama-launch in config.yaml eliminated the spurious named custom provider 'Ollama' has no resolvable api_key warning logged during auxiliary LLM resolution.

We also verified an expected third behavior observed during troubleshooting: asking the agent to open ~/.hermes/.env with read_file correctly returns Access denied: Hermes credential store. That is intentional defense-in-depth; the helper scripts continue receiving their allowlisted tokens cleanly via terminal.env_passthrough and dotenv fallback.


3. Verification: From Unit Suites to Live Local-LLM Execution

After applying all patches, we validated every layer—from Hermes’s internal pytest suites up through live end-to-end conversations driven by nemotron-3.5-bolt:32k:

Verification LayerResultDetails Observed
Hermes Unit Test Suites208 Passed106 passed across test_approval_deny_rules.py, test_approval_mode_parity.py, test_smart_approval_policy.py, test_single_query_approval_mode.py, test_cron_approval_mode.py, and test_skill_utils.py, plus 102 passed in test_approval.py.
Skill Linter & Aux ClientZero Warningslint_skill cleared the description-length warning; resolve_provider_client("approval") resolved nemotron-3.5-bolt:32k cleanly with empty warning output.
Approval & Deny EnforcementVerifiedapprovals.deny blocked curl, wget, python3 -c, and glab repo create calls hitting /api/v4/projects. Interactive check_all_command_guards() prompted on new-project with allow_permanent=False, while -q and cron contexts blocked it.
Live Nextcloud & GitLab Routing (nemotron-3.5-bolt:32k)PassedVerified both via direct AIAgent runs and a live hermes chat -Q CLI session after v2.0 snapshot refresh: check projects/<project>/correspondence.md triggered skill_view("agent-workspace") → workspace.py cat with zero local read_file calls, and GitLab MR queries triggered gitlab.py mr-list.
v2.0 Gate, Agenda & Scheduler Verification25 Checks + Live OKtest_gate.py passed all 25 offline checks (stale approvals, findings ordering, paused/completed topic refusals across write commands, and agenda parsing). Live read-only workspace.py check, gitlab.py check, gitlab.py mr-gate, agenda.py --json, and scheduled_run.py --dry all succeeded.

4. November 2026 Follow-Up (v2.0): Deterministic Agenda, Chronological Gates & Safe Scheduling

With routing and human-only approvals stabilized, we upgraded the entire agent-workspace skill to full v2.0 protocol parity—moving deterministic checks out of the 32K LLM prompt and into auditable Python tooling:

  • Deterministic Agenda Pre-Flight (agenda.py): Scans Nextcloud correspondence.md logs and GitLab merge requests using pure Python before waking the model. It tracks unanswered partner REQUEST/QUESTION items, MR reviews, pipeline/findings follow-ups, and ready auto-merges, while filtering HUMAN follow-ups strictly to our own principal so partner HUMAN entries never falsely queue work on our side.
  • Chronological Auto-Merge Gate (mr-gate & mr-merge --auto): Because our GitLab edition does not automatically reset approvals when new commits are pushed, evaluate_gate() cross-checks push timestamps (/versions) against system approval notes, verifies the auto-merge topic, checks head-SHA pipeline success, confirms <!-- agent-review:<sha> --> is present, and requires both an author reply and a post-review approval whenever opposition findings were raised.
  • Owner Lifecycle Controls Across Every Write Path: Projects tagged paused-by-* or completed are halted across agenda.py and every write command in gitlab.py (clone, mr-create, mr-comment, mr-approve, mr-unapprove, mr-merge, and mutating gitlab.py git subcommands).
  • Structured Questions & Safe Git Wrapper: Added workspace.py ask for logging For Mark: architectural questions without external noise, check commands on both scripts, and gitlab.py git restricting pushes to agent-mark/<topic> with zero hooks or force pushes.
  • Unattended Scheduler with Retry Circuit Breaker (scheduled_run.py): Configured a systemd user timer (07:00–22:00 every 30 minutes, left disabled until explicitly enabled) guarded by flock. It runs agenda.py --json with zero LLM cost, launches an isolated hermes chat -Q single-query session only when actionable items exist, and drops/alerts any item still open after 3 consecutive runs so stuck tasks never loop indefinitely.

5. Engineering Takeaways for Local Agent Deployments

Deploying small, fast local models in sovereign agent setups rewards attention to details that cloud-scale frontier models sometimes mask:

  • Audit the actual prompt sent to the model, not just the file on disk. If your agent framework truncates skill metadata or caches prompt snapshots, verify the rendered <available_skills> block directly.
  • Front-load routing keywords inside the first 60 characters. Put protocol names, folder prefixes, and action verbs at the start of every skill description, and add short disambiguation notes in persistent memory when remote paths resemble local paths.
  • Never rely on an auxiliary LLM to enforce principal-authorization boundaries. Smart-approval classifiers are great for triaging benign shell noise, but human-authorized gates like repository creation or production merges must bypass auto-approval in code.
  • Remember in-memory process caches. Any interactive agent session already running before config, skill, or Python module edits must be restarted so it reloads the updated prompt snapshot and code.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *