index_rules_from_markdown
Index Markdown rule files into SQLite to make team coding rules queryable, upserting canonical blocks or staging legacy proposals for approval.
Instructions
Index rules from a markdown file directly into SQLite.
mode="atomic" upserts canonical blocks by code (existing rules are
updated in place, new ones created). mode="legacy" stages each old-style
block as a pending_proposals entry instead of writing to rules directly.
Access level: write. Returns: JSON with indexed/created/updated counts, a per-scope breakdown, and any parser warnings or errors.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | 'atomic': parse canonical ## RN-XXX-NNN blocks (the {TECH} segment is optional — plain ## RN-NNN is also accepted) and upsert them directly into rules/rule_history. 'legacy': parse old ### blocks into pending_proposals only, never writing to rules directly. | atomic |
| filepath | Yes | Path to the source .md file containing rule blocks. | |
| default_scope_id | Yes | Scope assigned to blocks that don't declare their own **Scope:** field (e.g. 'global-java', 'project-<id>'). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |