-
Notifications
You must be signed in to change notification settings - Fork 0
Organize dirty work from codex/universal-ledger-hook-review-fix-472f10 #1345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b3ac681
1be1a52
d788e79
a1d69b1
3996b86
169fcce
d06ca5d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,10 @@ | ||
| #!/usr/bin/env bash | ||
| # SessionStart hook — surface the outstanding-work memory into context. | ||
| # | ||
| # Reads docs/outstanding-issues.md (the /issues ledger) and prints a compact, | ||
| # glanceable summary of the OPEN items so every session starts already aware of | ||
| # what is outstanding. When the trigger is a context reset (compact / resume / | ||
| # clear) it also emits a reminder to run `/issues capture` — that is the moment | ||
| # a session's in-flight follow-ups are most likely to be lost. | ||
| # Reads docs/outstanding-issues.md (the universal /issues ledger) and prints the | ||
| # ordered recommended tasks plus open-item counts so every session starts with | ||
| # the same repository-wide priorities. When the trigger is a context reset | ||
| # (compact / resume / clear) it also emits a reminder to run `/issues capture`. | ||
| # | ||
| # Contract: READ-ONLY. Never writes, never commits, never fails a session — it | ||
| # always exits 0, and every step is guarded so a parse error just yields less | ||
|
|
@@ -43,9 +42,27 @@ rows="$(awk ' | |
| } | ||
| ' "$ledger" 2>/dev/null || true)" | ||
|
|
||
| # --- parse the ordered recommended execution queue -------------------------- | ||
| # Emit "ORDER<TAB>ID<TAB>ACUITY<TAB>WHEN<TAB>ESTIMATE" per recommended row. | ||
| recommended="$(awk ' | ||
| /^## Recommended execution queue/ { inrecommended=1; next } | ||
| /^## / { if (inrecommended) inrecommended=0 } | ||
| inrecommended && /^\|[[:space:]]*[0-9]+[[:space:]]*\|/ { | ||
| n=split($0, c, "|") | ||
| order=c[2]; id=c[3]; acuity=c[5]; timing=c[6]; estimate=c[7] | ||
| gsub(/^[ \t]+|[ \t]+$/, "", order) | ||
| gsub(/^[ \t]+|[ \t]+$/, "", id) | ||
| gsub(/^[ \t]+|[ \t]+$/, "", acuity) | ||
| gsub(/^[ \t]+|[ \t]+$/, "", timing) | ||
| gsub(/^[ \t]+|[ \t]+$/, "", estimate) | ||
| printf "%s\t%s\t%s\t%s\t%s\n", order, id, acuity, timing, estimate | ||
| } | ||
| ' "$ledger" 2>/dev/null || true)" | ||
|
|
||
| total="$(printf '%s' "$rows" | grep -c . || true)" | ||
| if [ "${total:-0}" -eq 0 ]; then | ||
| echo "[issues] Outstanding-work memory (docs/outstanding-issues.md): no open items. Record one with /issues add …" | ||
| recommended_total="$(printf '%s' "$recommended" | grep -c . || true)" | ||
| if [ "${total:-0}" -eq 0 ] && [ "${recommended_total:-0}" -eq 0 ]; then | ||
| echo "[issues] Universal task ledger (docs/outstanding-issues.md): no recommended or open items. Record one with /issues add …" | ||
| exit 0 | ||
| fi | ||
|
|
||
|
|
@@ -54,7 +71,25 @@ count() { printf '%s' "$1" | grep -c . || true; } | |
| p1="$(group P1)"; p2="$(group P2)"; p3="$(group P3)" | ||
| c1="$(count "$p1")"; c2="$(count "$p2")"; c3="$(count "$p3")" | ||
|
|
||
| echo "[issues] Outstanding-work memory — ${total} open (${c1}×P1, ${c2}×P2, ${c3}×P3). Source of truth: docs/outstanding-issues.md · read the full list back with /issues." | ||
| echo "[issues] Universal task ledger — ${recommended_total} recommended · ${total} open (${c1}×P1, ${c2}×P2, ${c3}×P3). Source of truth: docs/outstanding-issues.md · read the full ledger with /issues." | ||
|
|
||
| print_recommended() { # $1=max-to-list | ||
| local limit="$1" shown=0 more=0 order id acuity timing estimate | ||
| [ -z "$recommended" ] && return 0 | ||
| while IFS=$'\t' read -r order id acuity timing estimate; do | ||
| [ -z "$order" ] && continue | ||
| if [ "$shown" -lt "$limit" ]; then | ||
| echo " ${order} ${id} ${acuity} — ${timing} · ${estimate}" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
On every SessionStart with the new queue, this prints entries such as AGENTS.md reference: AGENTS.md:L470-L473 Useful? React with 👍 / 👎. |
||
| shown=$((shown + 1)) | ||
| else | ||
| more=$((more + 1)) | ||
| fi | ||
| done <<EOF | ||
| $recommended | ||
| EOF | ||
| [ "$more" -gt 0 ] && echo " … +${more} more recommended tasks in ledger order (see /issues)" | ||
| return 0 | ||
| } | ||
|
|
||
| print_group() { # $1=rows $2=max-to-list | ||
| local data="$1" limit="$2" shown=0 more=0 pri id typ sum | ||
|
|
@@ -74,10 +109,15 @@ EOF | |
| return 0 | ||
| } | ||
|
|
||
| # P1 = do-next, list all. P2 = should-do, list up to 8. P3 = collapse to a count. | ||
| [ "$c1" -gt 0 ] && print_group "$p1" 999 | ||
| [ "$c2" -gt 0 ] && print_group "$p2" 8 | ||
| [ "$c3" -gt 0 ] && echo " ${c3} × P3 (nice-to-have / revisit-when) — see /issues" | ||
| # Prefer the universal recommended order. Fall back to priority groups for an | ||
| # older ledger that does not yet have the recommended execution section. | ||
| if [ "${recommended_total:-0}" -gt 0 ]; then | ||
| print_recommended 10 | ||
| else | ||
| [ "$c1" -gt 0 ] && print_group "$p1" 999 | ||
| [ "$c2" -gt 0 ] && print_group "$p2" 8 | ||
| [ "$c3" -gt 0 ] && echo " ${c3} × P3 (nice-to-have / revisit-when) — see /issues" | ||
| fi | ||
|
|
||
| # --- capture reminder --------------------------------------------------------- | ||
| case "$source_val" in | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,14 +3,16 @@ name: issues | |
| description: Track and recall all outstanding tasks, recommendations, and issues for this repo as durable cross-session memory. Use when the user types "/issues" (state the open items back), or asks to add/close/update/capture an outstanding task, recommendation, or issue. The memory lives in docs/outstanding-issues.md; a plain "/issues" is read-only. | ||
| --- | ||
|
|
||
| # issues — the outstanding-work memory | ||
| # issues — the universal repository task ledger | ||
|
|
||
| `docs/outstanding-issues.md` is the durable, cross-session memory of everything still outstanding: | ||
| open **tasks**, **recommendations** not yet acted on, and **issues** not yet resolved. Chat context | ||
| resets; that file does not. This skill reads it back and keeps it current. | ||
|
|
||
| **The ledger is the source of truth, not chat memory.** Never answer `/issues` from conversation | ||
| recall — always read the file first, so the answer is correct even in a fresh session. | ||
| recall — always read the file first, so the answer is correct even in a fresh session. The ordered | ||
| **Recommended execution queue** is the active task view; the wider open table preserves issues, | ||
| conditional ideas, and audit history that are not necessarily recommended now. | ||
|
|
||
| ## Trigger | ||
|
|
||
|
|
@@ -20,9 +22,10 @@ recall — always read the file first, so the answer is correct even in a fresh | |
| ## Default: `/issues` (read-only) | ||
|
|
||
| 1. Read `docs/outstanding-issues.md`. | ||
| 2. State the **open items** back, grouped by priority (P1 → P3), each as | ||
| `#ID · type · summary — next action (source)`. | ||
| 3. End with a one-line count, e.g. `5 open: 0×P1, 3×P2, 2×P3 · 0 resolved this session`. | ||
| 2. State the **Recommended execution queue** back in its recorded order, including ID, acuity, | ||
| intelligence, timing, estimate, and completion signal. | ||
| 3. End with recommended/open counts and the open priority split, e.g. | ||
| `4 recommended · 7 open: 1×P1, 4×P2, 2×P3`. | ||
| 4. Do **not** mutate the file or commit on a plain read. | ||
|
|
||
| If a filter is given, narrow step 2: `/issues P1` (by priority), `/issues issues` / `/issues recs` | ||
|
|
@@ -35,9 +38,12 @@ Parse the intent from natural language too — the exact syntax is a convenience | |
| - **`/issues add <text>`** — append a row to **Open items**. Infer `Pri`/`Type` from the text | ||
| (ask only if genuinely ambiguous; default `P2`/`task`). Allocate the ID from the | ||
| `<!-- issues:next-id=NNN -->` marker, then bump that marker. Fill `Source` with | ||
| `session <today>` unless the user names one; `Added` is today's date. | ||
| `session <today>` unless the user names one; `Added` is today's date. If the work is currently | ||
| recommended, also add it to the ordered execution ledger with acuity, intelligence, timing, | ||
| estimate, dependency, and completion signal; otherwise retain it only in Open items. | ||
| - **`/issues done <id> [outcome]`** — move that row from **Open items** to **Resolved / archive** | ||
| with today's date and a one-line outcome. Archive, never delete. | ||
| with today's date and a one-line outcome, remove it from the recommended execution queue, and | ||
| close the order gap. Archive, never delete. | ||
|
Comment on lines
44
to
+46
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When AGENTS.md reference: AGENTS.md:L460-L462 Useful? React with 👍 / 👎. |
||
| - **`/issues update <id> <text>`** — edit an open row's summary or next action in place. | ||
| - **`/issues capture`** — scan the current session for recommendations, follow-ups, deferrals, and | ||
| unfixed problems that surfaced but were not recorded. Propose them as a numbered list and add the | ||
|
|
@@ -54,6 +60,9 @@ paragraph; put the smallest next action in **Detail / next action**. | |
|
|
||
| - Keep the table format and column order exactly as in `docs/outstanding-issues.md`. One row per item. | ||
| - IDs are monotonic and never reused — always allocate from the `issues:next-id` marker and bump it. | ||
| - Keep the recommended execution queue dependency-ordered, gap-free, deduplicated, and synchronized | ||
| with its referenced open rows. Never add refuted, parked, superseded, resolved, or decision-only | ||
| records to the active recommendation view. | ||
| - Escape `|` inside cell text (write `\|`) so the markdown table stays intact. | ||
| - Respect the repo's RAG/clinical/privacy flagging rules if an item _itself_ touches a protected | ||
| surface — recording it here is fine, but acting on it later still needs the usual gate. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The writing rules explicitly permit escaped
\|characters in cells, butsplit($0, c, "|")treats those as delimiters too. Once a recommended outcome contains an escaped pipe—for example, two alternative commands—the outcome fragments shiftc[5],c[6], andc[7], so the hook reports arbitrary text as acuity, timing, and effort; use an escape-aware Markdown-table parser or protect escaped pipes before splitting.AGENTS.md reference: AGENTS.md:L470-L473
Useful? React with 👍 / 👎.