RepoOps
Open the app
04 / AI Security

Watch rules on coding sessions

Watch rules use watch-rule/v1, the format the PromptReports family uses to watch work. With REPOOPS_WATCH_RULES=1, session_signals answers two kinds of hit: the built-in Session Signals, each named for its built-in rule, and the hits of your own rules, run over the sessions this machine captured. Off, session_signals answers as before and reads no rule file.

Last updated

1

How to

The RepoOps desktop app, capturing your coding sessions.

REPOOPS_WATCH_RULES=1 where the desktop runs.

  1. Write a rule file.

    Put a JSON file in the watch-rules folder of the desktop's data folder, holding one watch-rule/v1 rule or an array of them. Each is checked against the schema, and a refused rule never runs.

  2. Use a kind the desktop runs.

    On a session the desktop runs three kinds: ordered_pair (a tool call with no earlier call of the tool it needs first), forbidden_value (a value in the output or a tool's arguments) and tool_loop (the same tool with the same arguments more than max_calls times, 5 when absent).

  3. Ask for the hits.

    Call session_signals through the MCP or the telemetry chat. Each row says whether it is built-in or custom, and the answer lists the custom rules that ran, the ones skipped with the reason and the ones the schema refused.

2

Use cases

No deploy before the tests

Situation
An engineering manager wants to know when an agent deployed without running the tests first.
You do
Write an ordered_pair rule that the deploy tool needs the test tool first.
You see
Each session where the deploy came first shows as a custom hit beside the security signals.

An agent stuck in a loop

Situation
An agent calls the same tool with the same arguments over and over.
You do
Write a tool_loop rule.
You see
A session past the limit shows as a custom hit.
3

Expected outcome

Workedsession_signals reports byKind, the count of built-in and custom hits.
WorkedEach custom hit is marked custom, with severity medium and its matched value masked to its first and last four characters.
Did not workA rule is listed under skipped.

Next step: It uses a model, runs only on steps, runs or schedules, names an action type or an event, is turned off, or is a built-in setting. The reason is beside it.

Did not workA rule is listed under refused.

Next step: It did not pass the schema, its file is over 256 KB, or more than 500 rules were read.

Did not workA rule about tool calls finds nothing.

Next step: Custom rules see a session's tool calls only when deep capture is on.

4

What else to consider

Built-in rules stay as they are

A file rule with builtin set to true is skipped: a team rule cannot change a built-in on the desktop. The built-in Session Signals scan is unchanged.

Not read from the hub yet

The desktop reads rules only from its own data folder. Reading an org's rules from promptcompute.ai is not built (LDG-3018).