delimit_ledger_auto_close_external
Automatically close ledger items linked to resolved GitHub issues or pull requests. Scans descriptions and tags for GitHub references, checks their status, and marks done or archives accordingly.
Instructions
Auto-close ledger items whose linked GitHub issue/PR already resolved.
When to use: as periodic maintenance to keep the ledger in sync with external reality — LEDs whose tracked GitHub issue/PR is closed/merged should not stay open. When NOT to use: to close one item by hand (use delimit_ledger_done) or to read external state (delimit_resource_get).
Sibling contrast: delimit_ledger_done is per-item; this auto-detects across many items.
Side effects: when dry_run=False, marks/archives via delimit_ledger_bulk under the hood. Default dry_run=True returns a plan only. Detection scans description/context/last_note/tags for github links / shorthand / gh: tag form.
Detection scans description / context / last_note / tags for:
https://github.com///(issues|pull)/
/# (short form)
gh:// (explicit tag form)
Action map (per LED-1146 deliberation):
PR with merged=true → mark_done with merge SHA in note
issue/PR closed with state_reason="completed" → mark_done with closed_at
issue/PR closed with state_reason="not_planned" or no reason → archive
state="open" → leave alone
gh API error / 404 → leave alone, recorded in
errors
Implementation re-uses bulk_action() under the hood; nothing new on the write path. dry_run=True (default) returns a plan; dry_run=False applies.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| venture | No | project name or path. Auto-detects if empty. | |
| dry_run | No | True (default) returns a plan without writing. | |
| max_items | No | hard cap on items processed in one call (default 200). When the candidate set exceeds this, the response is `truncated=True`. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||