AGENT SKILL

tagger

暂无简介

License 许可
MIT
最近更新
2026-11-09
Stars
★ 1
Forks
0

02 资源文件 3

03 SKILL.md 正文

<!-- platform:role-line --> tag_library in @DATASET@ and write tags. That is the entire scope. Do not write lines, corrections, or dictionary terms.

Tagger judges; a tool does the bookkeeping. The tool hands over one batch at a time with its context, takes the tags back, validates them, writes them, and proves the batches covered the whole conversation. Never track a cursor, never assemble a MERGE, and never count coverage. The split is deliberate. From the outside, untagged lines and never-read lines look identical. The pipeline this replaces ran LIMIT 500 against longer transcripts and appeared to work. Repeated runs moved forward through the remaining lines, and nothing ever said a transcript was incompletely tagged. Coverage is arithmetic, so a tool that cannot forget should count it.

In that pipeline the tags table had zero rows across every dataset. Tagger is not a port of a working step. It makes tagging work for the first time. Treat unexpected results as probably real, not as a quirk of the old system.

The loop

The loop uses three commands. Repeat the first two until the first says done.

# 1. what to judge next
~/.buzz/bin/tagger-batch.mjs --slug @SLUG@ --dataset @DATASET@ \
  --conversation <conversation_id> --next-batch

# 2. hand back what you judged, for the range you were given
~/.buzz/bin/tagger-batch.mjs --slug @SLUG@ --dataset @DATASET@ \
  --conversation <conversation_id> --write-tags --lo <lo> --hi <hi> <<'JSON'
{"tags":[{"line_id":"...","tag_id":"...","confidence":0.82,"justification":"..."}]}
JSON

# 3. the coverage proof, once, at the end
~/.buzz/bin/tagger-batch.mjs --slug @SLUG@ --dataset @DATASET@ \
  --conversation <conversation_id> --status

--next-batch returns lines_to_tag (the lines to judge in this batch), context_only (two lines either side, so a thought split across turns is readable — they belong to their own batch and get judged there), the active tag_library, the batch range to pass back, and remaining_lines_after_this. status: done means the conversation is fully covered. Stop.

Judge each batch only from its own lines and their context. No state carries between batches. A shared buffer leaking tags across batches was a real bug in the previous system. When about to apply a tag because of something in a batch no longer in view, stop.

A batch with no tags is a real result. Send {"tags":[]}. Some lines legitimately get no tag. Recording the empty batch is what advances the cursor. Skipping the write means the same range is served forever.

What the tool refuses, and why that is not a problem to argue with

--write-tags validates the whole payload before writing any of it, and rejects all of it if any row fails. It exits 3, with a rejected list naming each row and its reason. Nothing is written and the batch is not recorded, so the same range can be fixed and re-sent.

It rejects a tag when: tag_id is not an active tag in the library; confidence is below that tag's own confidence_threshold; line_id is outside the range given; justification is empty.

None of those checks takes a judgment call away from Tagger. They are the rules Tagger would otherwise apply by hand, applied consistently. A rejection means re-judge or drop that row, not work around the check.

Exit codes: 0 fine, 1 a wiring fault, 3 payload rejected (nothing written), 4 BigQuery rejected a statement, 5 coverage is incomplete.

Judging a line

Read description in full. It is the definition to judge against. The tool sends the library with every batch so no judgment works from memory.

  • tag_id is the library's tag value, lower_snake_case. The tool checks it exists and is active.
  • confidence is Tagger's call, between 0 and 1. Per-tag thresholds vary deliberately. A tag set at 0.50 is meant to fire readily, and one at 0.80 is meant to be rare. The tool enforces the threshold. Choosing an honest number is Tagger's job. Raising a number to pass the threshold is exactly what this arrangement exists to prevent.
  • justification quotes or paraphrases the specific span that qualifies the line for the tag. A justification restating the tag's definition is not a justification.
  • window_size is optional; the tool records the context width it supplied.

Aliases in the library are recall hints — near-synonyms and stock phrasings so a tag comes to mind. They are not a keyword match. A line containing a listed word does not automatically qualify for the tag, and a line using none of them still can. A tag justified only by pointing at an alias string is not a match.

is_human_edited on a line means a person corrected that text. It is worth naming in a justification when their wording is what qualifies the line for the tag.

Where the tag library comes from

<!-- platform:library-dataset --> active = TRUE, and the tool loads exactly that.

The underlying source is a Tag Dictionary sheet shared across every project — it is not <!-- platform:sheet-outside-fence --> read it and must not try. sync-tag-dictionary.mjs copies it into this table at deploy time. BigQuery is authoritative here. If the dictionary looks wrong or a tag is missing, say so. The fix is an edit to the shared sheet plus a re-sync, never an INSERT from Tagger.

Do not look for a Google Sheet, and do not try knowledge.tags. The old prompt called tools that did not exist in its own workflow, so every run silently failed to load a library. If --next-batch reports no-active-tags, stop and tell Claire. Do not invent tags to fill the gap.

Read from the view, never the draft

Line text comes from @DATASET@.lines_current, not transcript_lines. The view resolves human corrections over the parser's. The raw table is a draft without those corrections, so tagging it means tagging text the team has rejected. The tool reads the view, and so must any query written by hand.

In hand-written SQL, inline every value as a quoted literal, because execute_sql takes a single sql string with no parameter binding. Never add a LIMIT to a query whose result will be treated as complete. Never write to tags directly. The tool owns that statement.

Reporting

Run --status once at the end and report from it, not from memory: the ranges covered, whether coverage is complete, how many tag rows were written on how many lines, and lines_considered_but_untagged.

lines_considered_but_untagged counts lines that were read and got no tag, which is a real and useful result. It is only reported once coverage is complete, because until then it cannot be distinguished from lines nobody ever read. If --status exits 5, the conversation is not tagged. Report the missing ranges it names; never report a tag count from an incomplete run as though the work were done.

04 同仓库更多 Skills

borderux
borderux/recursica-knowledge

recursica-skill-template

Replace with a description of the skill and its purpose.

★ 1
borderux
borderux/recursica-knowledge

recursica-skill-working-memory

The research behind Recursica's item-count limits, with citations — Miller's 7 ± 2, Cowan's 4, chunking, and recognition versus recall. Use when a decision turns on how many options, navigation items, or chips to show at once, or to justify or challenge a count. Not for choosing a control — see recursica-skill-selection-controls.

★ 1
borderux
borderux/recursica-knowledge

recursica-skill-discoverability

The research behind Recursica's rule that rarely needed settings get a real but unpromoted entry point — the paradox of the active user, satisficing (settling for the first method that is good enough), and progressive disclosure, with citations. Use when deciding whether to hide, promote, or build a configuration or customization feature, or to justify that choice. Not for item counts — see recursica-skill-working-memory.

★ 1
borderux
borderux/recursica-knowledge

recursica-skill-design-router

Start here for any Recursica screen work. The router says what to decide in what order, which skill owns each decision, which rule wins when two rules conflict, and when to confirm with the user instead of guessing. Load the router first to design, build, review, or refactor a screen, page, panel, or flow, or when rules seem to disagree or no rule applies. The router routes, and the owning skill holds the rules.

★ 1
borderux
borderux/recursica-knowledge

recursica-skill-undo

House rules for undo — when an action gets an undo instead of a confirmation, where the undo goes (on the page, in place, or in a toast), when a toast is needed at all, and the Undo button's accessible name. Use whenever an action can be reversed, or when choosing between an undo and a confirmation. Not for building the toast that holds an Undo button — see recursica-skill-toast. Not for the confirmation modal — see recursica-skill-buttons-links.

★ 1
borderux
borderux/recursica-knowledge

recursica-skill-typography-semantics

House rules for type and semantic markup — real elements instead of styled divs, one H1 per page, type styles from tokens only, loading the brand typefaces, hidden headings, emphasis with em and strong, abbreviations, and AP style. Use for headings, body copy, emphasis, and the markup under a visual hierarchy. Not for naming — see recursica-skill-names-and-terms.

★ 1