Skip to content

Per-agent detection rules as data (Codex, Copilot, Gemini…) plus an "explain state" view #164

Open

Description

@AThraen

This was generated by AI during triage.

Summary

Replace AlertDetector's hard-coded Claude regexes with per-agent detection rules loaded as data, and add an "explain" view that shows why a session is in its current state.

Motivation

AlertDetector knows Claude's approval and input prompts only. Codex, GitHub Copilot CLI, Gemini CLI, Cursor Agent, OpenCode and others run fine in CSM, but get no waiting/approval alerts at all.

Herdr (v0.9.x) recognises about 18 agents through detection manifests:

  • the agent is identified by its foreground process;
  • per-agent screen rules decide idle / working / blocked;
  • the manifests update without a new release (server.agent_manifests, reload_agent_manifests).

Its release notes are mostly a long tail of per-agent fixes, e.g. "Codex mention popups no longer look blocked" and "Claude MCP questions stay blocked across option layouts". That is the cost of doing this well, and it is why Herdr keeps the rules as data rather than code.

herdr agent explain reports which rule matched. That matters, because "why does it say waiting?" is otherwise undebuggable.

Proposal

  • Process identification. Identify the agent from the session command, plus the foreground child process where available. Today ClaudeSessionService.IsClaudeCommand checks only the command string.
  • Rule files. Each agent gets a JSON rule file (patterns for blocked/approval, input prompt and working indicators, plus an idle debounce). Built-in files are embedded, and user overrides go in %AppData%\CodeShellManager\agents\.
  • Explain. "Explain state" in the session context menu shows the matched agent, rule and excerpt.
  • Fallback. Keep the current Claude patterns as the default rule set. Behaviour must not change for Claude users.

Notes

Activity

  1. AThraen commented on Nov 10, 2026

    @AThraen
    ContributorAuthor

    This was generated by AI during triage.

    Lower priority after #190. With OSC 7501, any agent that reports its own state skips the regex entirely, and the regex now runs only when a session has no 7501 records. Per-agent detection rules matter only for agents that don't emit 7501.

    Next step before building this: check which of the agents people actually run in CSM (Codex, Copilot CLI, Gemini CLI, OpenCode, Cursor) send the OSC 7501 ; ? probe or report state. Write rules only for the ones that don't. The "explain state" view is still useful either way. It should say whether the state came from 7501 (and which record) or from the fallback, and which rule matched.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions