rule-editor
Adds, edits, removes or downgrades one rule in rules-as-scripts with a per-rule cascade and no global rebuild: mints or keeps the stable RL-hash id, regenerates only that rule's scripts, and writes the map through src/rule-scripts/apply.ts. Use when the user asks to add, edit or remove a rule, or to mark one unverifiable.
- License 许可
- MIT
- 所属仓库
- Eliyce/paqad-ai
- 最近更新
- 2026-11-13
- Stars
- ★ 8
- Forks
- 0
01 前言 Front Matter
- name
- rule-editor
- metadata
- { "cacheable": "false", "model_tier": "medium", "paqad-meta": "skill.meta.yaml", "output_format": "markdown" }
- description
- Adds, edits, removes or downgrades one rule in rules-as-scripts with a per-rule cascade and no global rebuild: mints or keeps the stable RL-hash id, regenerates only that rule's scripts, and writes the map through src/rule-scripts/apply.ts. Use when the user asks to add, edit or remove a rule, or to mark one unverifiable.
02 资源文件 4
- 参考文档agents/openai.yaml305 B
- 参考文档references/edit-modes.md1.8 KB
- 脚本scripts/edit-rule.mjs2.9 KB
- 参考文档skill.meta.yaml344 B
03 SKILL.md 正文
What It Does
Owns the mutation cascade so adding, editing, or removing a rule recomputes only what changed: never a full regeneration:
| Mode | Effect |
|---|---|
| add | Inserts the bullet into the target rule file, mints a stable RL-<hash> id, then classifies + generates scripts for only the new rule. |
| edit | Updates the bullet text, preserves the id, regenerates only that rule's scripts, and surfaces a behavior diff via Decision Pause when scripts change. |
| remove | Removes the bullet, moves the map entry to archived: (delayed delete); scripts pruned on the next regen pass. |
| downgrade | Keeps the rule, deletes its scripts, flips the map entry to verifiability.kind: unverifiable with a recorded reason. |
Use This When
- A user prompt matches the priority-225 router rules
add rule,edit rule,remove rule, ormark rule as unverifiable.
Inputs
- The target rule file (for
add) or theRL-<id>(for edit/remove/downgrade). - The new rule text (
add,edit) or downgrade reason (downgrade). docs/instructions/rules/rule-script-map.yml(written only via the bundled wrapper →src/rule-scripts/apply.ts).
Procedure
- Apply the deterministic mechanics:
node scripts/edit-rule.mjs add <project-root> <source-rel> "<text>" node scripts/edit-rule.mjs edit <project-root> RL-<id> "<text>" node scripts/edit-rule.mjs remove <project-root> RL-<id> node scripts/edit-rule.mjs downgrade <project-root> RL-<id> "<reason>" - For
addandedit: re-runanalyze rules(idempotent, touches only the changed rule) thengenerate rule scriptswithonly_rule_idset to the affected id, so only that rule's scripts are regenerated. - For
edit, diff the regenerated scripts against the prior ones; if behavior changed, surface a Decision Pause packet before accepting. - Present a
## Rule Change Summarynaming the id, the mode, and any scripts added/removed.
Output Contract
- The rule markdown updated with a preserved/minted
<!-- @rule RL-<hash> -->marker. rule-script-map.ymlupdated viasrc/rule-scripts/apply.ts(archive on remove, unverifiable on downgrade, script set on add/edit).- A
## Rule Change Summarymarkdown block.
Escalate / Stop Conditions
edit/remove/downgradeon an id not found on disk stops with a clear error: never guesses which rule was meant.- Behavior-changing
editregenerations surface a Decision Pause diff before acceptance. - Never edit
rule-script-map.ymlby hand; the wrapper is the only path. - A new rule that contradicts an existing one is surfaced as a conflict (via
rule-analyzer) before its scripts are written.
Resources
references/edit-modes.md: the four sub-modes + cascade contract.runtime/base/skills/rule-editor/agents/openai.yaml: agent interface metadata.src/rule-scripts/editor.ts: markdown add/edit/remove mechanics.src/rule-scripts/mutate.ts: per-rule map mutations.- the Decision Pause Contract (in the framework bootstrap): packet semantics for edit diffs + conflicts.
04 同仓库更多 Skills
sample-skill
Sample bundled skill fixture
processing-invoices
Turns a supplier invoice into one ledger line. Use when a supplier invoice arrives and needs booking.
processing-invoices
Turns a supplier invoice into one ledger line. Use when a supplier invoice arrives and needs booking.
understand-idea
Chat and Claude Code: Step 1 of the discover journey: clarifies the goal, who benefits, success and constraints into the idea block. Use when the journey directs it to step 1, not directly.
size-work
Chat and Claude Code: Suggest a size for a ticket from comparable finished work, as a labelled suggestion the team still owns. Use it when someone asks "how big is this?", "roughly how much work is ABC-12?", or wants a backlog item sized. It finds the team's sizing scale at first use, picks two to five of the closest finished tickets with links, and gives a size or range with the drivers behind it and a confidence of low, medium or high, lowered and explained when the area's documents are template text. Every result is labelled a suggested size, never a date or a commitment. It writes nothing into the size field unless the user says "set it", and it refuses to overwrite an existing size unless the user asks to replace it. Produces the sizing block of the record.
refine-ticket
Chat and Claude Code: Improve one or more existing tracker tickets without losing the author's intent. Use it when someone wants a ticket read, diagnosed and tidied up ("this ticket is vague", "fix up ABC-12", "split this, it's too big"). It reads each ticket in full and snapshots it with its last-updated time, says what is wrong with evidence, and proposes a field-by-field before and after change set limited to summary, description, labels, parent, links and new child tickets on a split. It writes nothing until an explicit "apply it" bound to that exact change set, re-checks the ticket for conflicting edits just before writing, never replaces rich descriptions with plain text, never deletes or closes a ticket, and reads each ticket back after applying. Produces the existing and changes blocks of the record.