Skip to content

refactor(skill): split the 40 KB monit card into an index plus five surface cards - #158

Merged
ysyneu merged 3 commits into
mainfrom
refactor/monit-card-split
Aug 20, 2026
Merged

refactor(skill): split the 40 KB monit card into an index plus five surface cards#158
ysyneu merged 3 commits into
mainfrom
refactor/monit-card-split

Conversation

@ysyneu

@ysyneu ysyneu commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Stacked on #157 — base is fix/monit-query-diagnose-dstype, so this PR's diff shows only the split. GitHub retargets it to main automatically once #157 merges. Merge #157 first.

Why

reference/monit.md was 40,490 B / 41 verbs. The monit command group is not one surface — it is five (datasources, alert rules, probing, service map, store rulesets) that happen to share a CLI prefix. A skill that only needs datasource-list was loading rule export, service-map topology and the on-box tools catalog along with it, and the card is loaded whole or not at all.

What

Partition the generated fence by verb prefix; the router in SKILL.md now addresses each surface directly instead of pointing every monit intent at one card.

card contents verbs size
monit.md index + preview-sync 1 2,160 B
monit-datasource.md datasource CRUD, SLS discovery 7 5,419 B
monit-rule.md rule CRUD, folders, export/import 18 20,335 B
monit-probe.md ad-hoc query, RCA, targets, tools 5 8,004 B
monit-servicemap.md fleet, topology, status 5 6,026 B
monit-ruleset.md store ruleset CRUD 5 2,635 B

Largest card: 40,490 → 20,335 B. Typical monit intent now loads one card of a few KB instead of 40 KB.

preview-sync belongs to no surface (it previews a datasource query before a rule saves it), so it stays on the index card rather than getting a card of its own.

The partition is exact

The prefix fences claim all 41 verbs with no double-claim and no dead prefix, so skilldoc check remains authoritative — a new verb still has to land in exactly one card or CI fails. This is the same prefix-fence mechanism already used by three other cards, so it is mechanical, not a new pattern.

monit-probe.md deliberately has no top-level router row. For query and host-diagnostic intents the curated monit-query / monit-agent cards are the better entry point and the router already sends those intents there; the raw verbs stay reachable one hop down through the index.

Verified

  • go run ./internal/cmd/skilldoc checkskilldoc: cards OK
  • go run ./internal/cmd/skilldoc gen → no diff on a clean tree
  • go build ./... clean; go test ./... → 0 FAIL
  • All 41 verb blocks accounted for; every intent row from the old card is present in a new one (two are reworded, none dropped)

ysyneu added 3 commits August 19, 2026 21:35
…urface cards

`reference/monit.md` had grown to 40,490 B / 41 verbs spanning five unrelated
Flashmonit surfaces, so every monit intent — however narrow — paid for all of
them. Partition the generated fence by verb prefix and let SKILL.md's router
address each surface directly:

  monit.md             index + preview-sync                 1 verb   2,160 B
  monit-datasource.md  datasource CRUD, SLS discovery       7 verbs  5,419 B
  monit-rule.md        rule CRUD, folders, export/import   18 verbs 20,335 B
  monit-probe.md       ad-hoc query, RCA, targets, tools    5 verbs  8,004 B
  monit-servicemap.md  fleet, topology, status              5 verbs  6,026 B
  monit-ruleset.md     store ruleset CRUD                   5 verbs  2,635 B

The partition is exact — the prefix fences claim all 41 verbs with no
double-claim and no dead prefix — so `skilldoc check` stays authoritative and
`gen` remains a no-op on a clean tree. Largest card drops 40,490 -> 20,335 B.

Intent rows keep their original wording so existing routing still resolves.
`monit-probe.md` is reachable through the index rather than from the top-level
router: for query and host-diagnostic intents the curated `monit-query` /
`monit-agent` cards are the better entry point, and the top-level router
already sends those intents there.
…ay which

Two leftovers from splitting the monit card.

The `monit-query` group description still advertised `diagnose/rows support
prometheus|victorialogs|loki|mysql`. `diagnose` never accepted mysql — it pairs
`log_patterns` with loki/victorialogs and `metric_trends` with prometheus — and
`rows` has been deprecated and hidden since `data` replaced it, so the group
blurb was pointing at a command the help output no longer lists.

The bigger one: this product uses "datasource" for two unrelated things.
`POST /monit/datasource/*` is the Flashmonit config surface — the systems
Flashmonit queries. `POST /datasource/*` is On-call, holding IM-integration
plumbing, and On-call's *integrations* — what actually receives alerts into a
channel — are a third surface again. Giving datasources their own card made this
worse, because the router now hands the bare word "数据源 / datasource" straight
to Flashmonit, and an On-call integration question matches that row.

So the card says which one it is, in the first paragraph a reader sees, and
names where the other two live. The router row is qualified the same way, and
the channel row picks up 告警来源 so the On-call sense has a keyword of its own.
The index card carries a one-line version for readers who land there first.
@ysyneu
ysyneu changed the base branch from fix/monit-query-diagnose-dstype to main August 20, 2026 05:35
@ysyneu
ysyneu merged commit 6a54b42 into main Aug 20, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant