Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Patrol?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/akurganow-patrol)
---
name: patrol
description: Sweeps one department on one precinct at one commit, files at most the cap of draft leads as tracker issues, then exits.
---
# Patrol
One tick takes one order, sweeps one department on one precinct at one commit, files at most `cap` leads, and exits.
A lead is suspicion with evidence, not proof. Investigation tests it later.
## Limits
- Never run code from the precinct.
- Never file more than the cap allows.
- An empty tick is a success. Silence is the default.
- A doubt drops a candidate. A doubt never stops the tick.
- Never run an interpreter or a parser in a tree. The one exception is the recorded reading way of the catalog check and the license reading, which read the tree's content at `<sha>` as data. Even then nothing from the precinct executes and no tool that the precinct configures runs.
- When a page calls a check an approximation, its search form is the check.
The law in `lawman/skills/lawman-law/references/LAW.md` and the tick steps in `lawman/skills/lawman-law/references/tick.md` govern this skill. Obey them. Do not restate them. The outcome token of a tick comes from the law's `LAW.md#role-patrol` and `LAW.md#one-tick-one-case-exit` sections. Cite a law section by name when a rule needs a source.
Patrol uses the Read first files, the department page from any of its places and the page's source commands as the law's `LAW.md#texts-of-the-precinct` section says.
## Working rules
- A clone changes only by bringing it up to date with the host, and by adding and removing the tree that the steps name. Never switch its checked-out files, discard changes in it, commit, publish, create a branch or tag, merge or set changes aside.
- Read a precinct file only as its content at `<sha>`, taken from the clone `precincts/<p>`.
- Search and list files only in the tree. Count the lines of an output without printing them.
- A value from the tree or a log line enters a command only when it matches its class. The same holds for any text other than the law, this skill, the constitution and the department page. A value outside its class is not used.
| value | class |
| :-- | :-- |
| commit hash | `^(?!-)[A-Za-z0-9._/:+-]+$` |
| path or pathspec | `^[A-Za-z0-9._/-]+$`, no `..` segment, no leading `/` |
- The path class covers every path that a read, a listing or a history query takes.
- A search pattern from such text reaches a search only as data on standard input, one pattern per line. It goes through the quoted heredoc of the `tick.md#working-rules` section. The search matches each pattern as fixed text and shows each hit with its path and line number.
- A source command of the department page runs as the `exhibits.md#run-a-source` section says. Read that file once, when the page holds one. The source command of a page that passes its check stays allowed, and its values follow the table of that file.
- History queries are read-only and run on the precinct clone. `<sha>` is the analysed commit.
- A commit listing gives each commit's short hash, date and subject. It may stop at a count. It may add the names of the changed files. It may keep only the commits whose change added or removed a given string, or a line that matches a given regex. It may keep only the commits that touch a pathspec.
- A line attribution gives the commit that last changed each line of `<from>` to `<to>` of `<path>` at `<sha>`.
- A listing starts at `<sha>`. Never list every branch, and never start at a branch name.
- A string or regex for a change search comes only from the department page. Never take one from the tree, a commit subject or any other text.
- A search of a past commit runs only inside the alarm check. The commit is one that a listing from `<sha>` printed, except the commit that the law folder holds, in the positive control. The matched text is dropped before the output is shown or stored.
## Tick
Run items 1 to 3 of step 0 once per session. Then run one tick for each order of the group, in turn. A tick runs from item 4 of step 0 to step 6, every step between included. The group lists at most as many orders as the role has runs of work. Read it once, apart from the second read that item 3 names. Every started tick ends exactly once, at step 6. A step that fails after the start ends the tick as the `tick.md#end-the-tick` section says. Its items 1 and 2 end each tick. After a tick, go on with the next order of the group. A tick that ends `stopped-*` ends the session. Its item 3, the answer, comes once, after the last tick of the session. It puts the `ALARM` lines of every tick first. The harness page is `lawman/skills/lawman-law/references/harnesses/<harness>.md`. `<harness>` is the value of `harness` in `config.yaml`.
### Step 0: the input and the order
1. Manual run only. When the prompt names a precinct and a department, add that order before you take the input. A named order waits its turn. Exit 2 means that the precinct already has an open patrol order, of any department. The named order is not queued: answer only the silence form of the harness page, and stop. Any other failure: answer `journal unavailable: <stderr>` and stop. The input that came with the turn holds no new order, so run the role entry yourself in item 2.
```
bin/journal dispatch add --precinct <p> --role patrol --department <d>
```
2. Take the input. Run the role entry yourself when the turn starts with no part of a role group, whose first line starts with `lawman input`. Run it also when the input says that the entry failed, or when the entry exited non-zero with no output. When your own run exits non-zero with no output, answer `journal unavailable: <stderr>` and stop.
```
bin/journal wake --role patrol
```
Empty output with exit 0 means no work. Answer only the silence form of the harness page, and stop. Input output that is not empty and whose first line does not start with `lawman input` means that the journal is older than the law. Run the section `tick.md#sync-the-law-with-an-older-journal`, then take the input again.
Read the role group to its last part. For a cut part, follow the `tick.md#parts` section. A line `self law <path> <section>` or `self harness <path> <section>` stands in place of a block. Read that file or section yourself.
```
bin/journal tick input --role patrol --part <k>
```
A group without an `order` line means no work. Answer only the silence form of its `Silence` section, and stop.
3. Sync the law, then check the journal schema.
1. Sync the law as the section `tick.md#sync-the-law` says. A stop there is answered, not recorded. After the line `synced <tag>`, the role group you hold is stale. Read every part of it again with `bin/journal tick input --role patrol --part <k>`.
2. Check the journal schema. Exit 1 or 6: answer `journal unavailable: <stderr>` and stop.
```
bin/journal probe --schema 12
```
4. Start the tick with the first order that this session has not tried. The `order` lines read `order <id> <precinct> <repo> <department|-> <issue|->`, in the order of the visits. The orders that no tick took come first. Within each group, take the orders by weight. `<p>`, `<owner/repo>` and `<d>` are the precinct, the repository and the department of the order.
```
bin/journal tick start --role patrol --order <id>
```
- `order <id> untakeable` alone means that no tick started. Start with the next order the same way. With no order left, the session is over: give the answer.
- A non-zero exit: answer `journal unavailable: <stderr>` and stop.
- Otherwise the tick has started, and the first part of the tick group printed. Its first line is `lawman input <form> role=patrol tick=<tick id> part 1 of <n>`. Keep the tick id. The sections of `tick.md` in the role group govern the whole tick.
- The lines `ended <outcome>` and `report <report>` mean that the journal ended the tick. Keep its `ALARM` lines for the answer, and its report for a `failed` outcome. After a `stopped-*` outcome the session is over: give the answer. Otherwise go on with the next order.
5. Read `acting_login` from `config.yaml`. It is one `key: value` line. A missing file or key ends the tick with `failed`.
6. Read the tick group to its last part, as item 2 says. Keep every `ALARM` line for the answer. Do each `self` step at once, as the self steps of the intro of `tick.md` say.
```
bin/journal tick input <tick id> --part <k>
```
### Step 1: ask the cap
The `revision=` line gives the fetched commit. It is the analysed sha, and `<ref>` is that sha.
```
bin/journal cap <p> --department <d>
```
The output is `cap=<n> open=<k>`. Keep `k` for the report. When `n` is 0, no lead can be filed. Read the Proof section of the department page that the tick group gives. A page without an `Alarm check:` paragraph ends the tick with `capped` at once. Read nothing else, create no tree and sweep nothing. A page with that paragraph: create the tree (step 2). Run only that paragraph, as "The alarm check" below says. Then end the tick with `capped`.
### Step 2: create the tree
1. The line `department <d> place=<n>` and the `department` fence give the department page. Read its Proof section.
2. A page whose Proof sends a list through the journal runs items 1 and 2 of "The catalog check" now.
3. Add a new tree of the clone `precincts/<p>` at `<sha>`, in the folder `runs/<tick id>/tree`. It is detached from every branch. Confirm that the tree holds `<sha>`. A failure ends the tick with `failed`.
### Step 3: read the rules
1. The `lint` fence of the constitution holds the lines that the `tick.md#check-the-constitution` section describes. A department line is `<name><TAB><judged by>`.
2. Read each Read first file. A line is `- <path>` or `- <path> "<heading>"`. A quoted heading narrows the read to that section. A missing path is skipped and named in Blockers, as the `tick.md#check-the-constitution` section says.
3. Read the judging document named on the constitution's Departments line for your department. `judged by none` means there is none. Its text is evidence. Use its recorded answers in step 4.
4. The `precedent` fences are the precedents of your department. Know them before the search, as the law's `LAW.md#precedents` section says for patrol.
5. Use the page sections Mission, Kinds, Where to look, Not findings, Proof, Anchors, Lead body and Identity.
### Step 4: sweep
A page whose Proof sends a list through the journal sweeps by "The catalog check". That section names the items below that it replaces.
1. Make only reads in the tree, and run the source commands of the page. Run the alarm check first when the page has one. Follow the page's Where to look and Proof sections. Aim no search at the shape of a protecting precedent, and never skip a place for it. Search the tree for each pattern of the page and print each hit with its path and line number. Leave out of each search the path of each line of the Not judged section. Leave out none when that section says `none`. The law names the one exception for `licenses`. When the Proof holds a paragraph that starts with the words `License list:`, follow it where the Proof puts it, after the census. Open `lawman/skills/lawman-law/references/departments/licenses/reading.md` only when the condition of that paragraph holds.
2. Run the page's positive control with the same command on a unit known to be in use. Quote both outputs. A zero count proves nothing until the control shows a non-zero count.
3. Quote each command and its verbatim output in your notes. Count and quote only at `<sha>`.
4. Cut a candidate that fits no row of the page's Kinds table. Cut a candidate that matches Not findings, the page's too-small line, or the Fence section. The Fence section lists the checks CI already runs.
5. Cut a candidate that a recorded answer in the judging document settles. Name the answer in the report.
6. Attack each candidate once. Look for a caller the search could not see, a guarantee from the caller, an assertion or upstream check, or a pinning test. A recorded reason counts too. If one holds, drop the candidate. What the Not findings section of the page names as no guarantee does not hold.
7. Check each hidden class that the page's Proof lists. Name every class you did not check. Those names go to Not checked.
8. Score value and risk with the page's Anchors. Keep only candidates whose value meets the threshold the page states. Risk cuts none.
9. Drop a candidate you rate `plausible`, and any you cannot confirm.
10. Join the candidates that remain and are one defect repeated. They are one defect when their leads would differ only in the place. The kind, the reason and the change that the finding calls for are the same at every site. One wrong call written the same way at several sites is one defect. Things that each need their own judgement stay separate, even when each calls for the same sort of change. Several unused units are separate. Where the page says to keep things apart, keep them apart. A cluster or a concept that the page defines is one candidate from the start of the sweep. The joined candidate is one candidate. It takes the highest value among its sites. Its lead lists every site. When the page's Identity gives an id for this candidate, as for a cluster or a concept, use it. Otherwise the id is that of the first site. Sort the sites by path and then by symbol, by byte and before encoding. The title takes the symbol of the id.
11. Check each candidate against the journal. Encode its id (see Lead format) and run `bin/journal seen <p> --id <id>`. `open` drops it. `fixed #<n>` keeps it for filing with `of=<n>`. For a joined candidate without an id from the page, run `seen` for the id of every site. One `open` drops the whole candidate. With no `open`, a `fixed #<n>` keeps it with the highest `<n>`.
12. Apply the precedents to each candidate that remains, as the law's `LAW.md#precedents` section says for patrol. The `finding` of a dismissal is an id, encoded as in item 11. For a joined candidate without an id from the page, the id of each site counts, as that section says.
13. A kind with an external source is filed as a lead when the tree gives the hook the page names. Add its `Source:` lines to Not checked, as the Lead format says. Read no external source, except a source command of the page, the catalog check and the license reading.
14. Order the survivors by value, highest first.
### Step 5: file the leads
File at most `cap` leads from step 1, one issue for each, in order of value. Repeat these substeps for each lead.
1. Compose the title and the body from the Lead format section.
2. Send the title to the body check with `--no-marker`, then the body with no option, each on stdin.
```
bin/journal lint-body --no-marker <<'<delimiter>'
<title>
<delimiter>
```
```
bin/journal lint-body <<'<delimiter>'
<body>
<delimiter>
```
Exit 7 from either check: do not file this lead. File nothing more in this tick. Finish the report and end with `stopped-lint`.
3. Create the issue on the host in one write, with the title and the body the two checks printed, as the host notes record. Add no label. The title and the body reach the host only as data. The host's reply gives the issue URL and number. An HTTP 403 or 429 reply gives `stopped-rate-limit`. Any other failure gives `failed`. Neither retries. A failure without a reply can leave an issue behind. The next sync finds it by its marker.
4. Read the issue back from the host by its number. The author must equal `<login>`, ignoring ASCII case. The last non-empty line of the body must equal the marker you sent. A mismatch, or a failed read, gives `stopped-readback`.
5. Keep the number for the report. After any stop, make no more writes.
### Step 6: end the tick
Run the `tick.md#end-the-tick` section. Add `--department <d>` to `tick end`.
## The alarm check
Run it when the page's Proof holds a paragraph that starts with `Alarm check:`. A page without it has no alarm check, and nothing here applies. The cap does not stop it.
1. Run the paragraph's searches, on the tree at `<sha>` and on the history, as the paragraph states them. Every search that can show a value keeps only the path and the line, and drops the matched text. No literal from the precinct tree enters a command. Patterns come only from the page.
2. Run the positive control. It is the same search over the department page itself in the law folder, at the commit that the folder holds. The page's placeholder example must match. The search yields only the path and the line. A search with no match proves nothing, so the check did not run. It counts as a check not run.
3. A live secret is a credential in the tree at `<sha>` or in the history of `<sha>`. A placeholder is never a live secret. Print this line first in the reply, with any other `ALARM` line:
```
ALARM sweep <p> <path>:<line> <one line>
```
For a secret found only in history, write `<path>@<hash>` in place of `<path>:<line>`. `<hash>` is the short hash of the commit. `<one line>` names the kind of credential. The line holds no value.
4. Write nothing to the tracker for an alarm. File no lead for it. Never use the value. Never test it. Never put it in a command, a note or the report.
## The catalog check
Run it when the page's Proof says that a list sent through the journal replaces the pattern search. This check reads the catalog only through the `exhibits.md#send` section.
1. Read `catalog` and `catalog_precincts` from `config.yaml`, and the precinct's line under `## Dependency reading` in `host.md`. Do it before the tree is created and before any send. A missing key reads as no and is no failure. The precinct has consent only when `catalog` is `yes` and `catalog_precincts` holds the whole space-separated token `<p>=yes`.
2. End the tick with `silent` when the precinct has no consent, has no line, or has a line that says it lists no dependencies. Do the same when the section "Sending to the catalog" of the harness page gives no form. Send nothing. The report holds Coverage and Filed only. Coverage names the reason. Filed is the exact line `Filed nothing. Catalog check did not run.`
3. With consent and a line, take the list by the recorded way. The way reads the tree's content at `<sha>` as data. It runs nothing from the precinct and no tool that the precinct configures. `bin/journal form catalog` prints the form of the list.
4. Hand the list to the journal as data, as the `tick.md#working-rules` section says. Never hand it over as text that a shell reads as a command. Write no file for it. The journal cuts it into parts and counts it. Never cut, count or retype it.
5. Read the `exhibits.md#send` section once. Run `bin/journal catalog request --kind batch`, the send and `bin/journal catalog answer --kind batch` in the order that the section "Sending to the catalog" of the harness page shows. The first request takes the tick id, the precinct and the list. Each later request takes the tick id only. Repeat while the journal prints `catalog next`. Stop when it prints the result.
6. The Proof of the page governs the sweep. The journal's match against its own cache replaces the per-candidate check with `bin/journal seen`. Each line is its own candidate, and item 10 of step 4 joins none.
7. Apply item 12 of step 4 to each `new` and `fixed #<n>` line. The identity of the line is the id of the candidate. File the remaining lines in the journal's order, not by value, within the cap. Use the identity and the `Source:` line as the journal printed them. The filing steps of step 5 stay as they are.
8. A failed part goes to Blockers, with the reason the journal printed. So does a pass that produced no entry for a tree that names dependencies. The INCOMPLETE line of the law applies when nothing was filed.
## Lead format
Title: `[Lead] <department>: <symbol>: <what>`
The body holds every part of the law's `LAW.md#the-lead-body` section. These rules fill its patrol slots:
- For a fixed candidate, `## What` names the closed issue.
- For a candidate that differs from a protecting precedent or a dismissal, `## Why it is <kind>` names the difference beside the precedent.
- For the catalog check, Evidence is the journal's output for the match, verbatim. The title's symbol is the record identifier and the package of the `Source:` line.
- On the Cost and risk line, Risk is low, medium or high as the page's Anchors place it. Effort is the size of the change the finding calls for. File only `confirmed` or `demonstrated`.
- `## Evidence` holds the measurement that the page's Kinds table names for the kind.
- What the page's Lead body says of a part adds to or narrows what the law's slot for that part holds.
- Put every `@` inside a code span or a fenced block.
- A kind with an external source fills the `Source:` slot of Not checked. It holds one `Source:` line per source, inside one fenced block, in one of three shapes:
```
Source: catalog <record identifier> <package>
Source: releases <owner>/<repo>
Source: licenses <source> <ecosystem>/<name> <pin>
```
Take each `releases` value from the tree. Take the `catalog` line as the journal printed it.
Marker:
```
<!-- lawman: role=patrol stage=lead department=<department> id=<id> sha=<sha> at=<UTC> -->
```
- `at` is the current time in UTC at filing, written `YYYY-MM-DDTHH:MM:SSZ`.
- For a fixed candidate, add ` of=<n>` before ` -->`. Use the closed issue number.
Identity: `<id>` is `<path>::<symbol>::<kind>`. The page says what the path and the symbol are. The kind is one row of its Kinds table. No line number, count or commit enters the id. Encode each part as the section `markers.md#the-id-value` describes. For the catalog check, `<id>` is the identity the journal printed, unchanged.
`bin/journal seen` exit 1 means the id is not canonical. Fix the encoding and run it again.
## Report
Write the five parts that the law names under `LAW.md#five-part-report`, in that order. Keep each part short. When nothing was filed, the Filed part is exactly one of these lines:
```
Filed nothing. CLEAN at <sha>.
Filed nothing. INCOMPLETE at <sha>, <n> checks not run.
Filed nothing. Catalog check did not run.
```
- The third line belongs to a tick that ended at item 2 of "The catalog check".
- For the catalog check, Coverage gives the number of entries sent. It names the entries not sent and the entries outside a class by number, as the journal printed them.
- For the license reading, Coverage follows `reading.md`.
- A check is one measurement that the page's Kinds or Proof names. CLEAN needs every one to run, the positive control included, or not to apply.
- A hidden class that the page lists is no check. In Coverage, name each class you could not check.
- A check does not apply when its subject is absent from the tree. A census with a positive control shows that.
- A capped tick writes one line: `cap=<n> open=<k> at <sha>. No sweep.` When the page has an alarm check, add `Alarm check: ran.` or `Alarm check: not run, <reason>.`