From 41b7842fd8bf49e9de0086920fee9bba618bbab2 Mon Sep 17 00:00:00 2001 From: Mikael Hugo Date: Mon, 11 May 2026 19:34:49 +0200 Subject: [PATCH] TODO: cross-repo triage + slash-command routing + structured tiers (redo) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previous commit (1fb4b9882) captured only the reset and lost my intended additions due to a Read/Write race. Re-applying the four feature requests from today's dogfooding session: - Cross-repo `triage-all-repos` (real fix for the "many TODO.md files" surface area — single tool, per-repo SF dbs, unified read-only aggregation view). - Slash-command routing fix (`/todo triage` is currently re-implemented by the agent's LLM, bypassing the typed backend; patches to commands-todo.js were silently inert). - Structured tier/priority per triage item (today tiers exist only in LLM-prose appended to BUILD_PLAN.md; no parser-friendly field for "promote Tier 1 items"). - Phases-helpers stale-export error that fires on every SF run; needs either the missing export restored or a test that catches it. Co-Authored-By: Claude Opus 4.7 (1M context) --- TODO.md | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) diff --git a/TODO.md b/TODO.md index 8df1b17c1..2921fec69 100644 --- a/TODO.md +++ b/TODO.md @@ -2,3 +2,109 @@ Dump anything here. +--- + +## Cross-repo triage / unified backlog view + +Today's dogfood: a scan across active repos found **~40 TODO.md files** +totalling **~10,000+ lines** across `/srv/infra`, `/srv/operations-memory`, +`/home/mhugo/code/singularity-engine` (27 subdir TODOs, 9 000+ lines), +`/home/mhugo/code/inference-fabric` (8 crate TODOs), plus per-repo +singletons in ace-coder, dks-web, vectordrive, centralcloud, etc. + +The per-subdir files are **not noise** — most are substantive design +specs scoped to their domain/crate/service. Collapsing them into a +single root file would destroy useful structure. + +The actual gap: **no single way to see "what's queued across all the +repos" at once.** Today this requires walking N repos by hand. + +Wanted: + +``` +sf headless triage-all-repos --config ~/.sf/repos.yaml +``` + +Where `~/.sf/repos.yaml` is a list of repo paths and (optional) per-repo +priority. For each repo: +1. If `TODO.md` has non-template content, run `triageTodoDump` in that + repo's SF db. +2. After all repos triaged, emit a unified report: one row per backlog + item across all repos, sortable by priority / tier / inserted_at. +3. Optionally produce a single `~/.sf/cross-repo-view.md` for quick + human reading. + +Per-repo SF dbs stay separate (each repo owns its work); the cross-repo +view is read-only aggregation. + +## Slash command `/todo triage` should actually invoke the typed backend + +Observed today: `sf --print "/todo triage"` ran the agent, which read +TODO.md and emitted a triage-shaped markdown response, but the agent +**did not call `handleTodo` → `triageTodoDump`** — it re-implemented the +flow in natural language via Read/Write tools. Side effect: a patched +backend in `commands-todo.js` was bypassed entirely. + +Wanted: when a slash command has a registered typed handler in the +extension surface (i.e. `handleTodo`, `handleNewMilestone`, …), the +agent's prompt should *require* the call go through that handler rather +than letting the LLM improvise. The handler can be invoked as a tool +call so the LLM still has narrative space, but the side effects (DB +writes, file scaffolds, etc.) come from the typed path, not from raw +Write/Edit on TODO.md. + +Concretely: + +- In `slash-commands.md` (or wherever the slash dispatch prompt lives), + enumerate handlers and forbid the LLM from "doing the work" itself + when a typed handler exists. +- Add an integration test that runs `sf --print "/todo triage"` against + a fixture TODO.md and asserts that `triage_runs` rows appear in + `sf.db` (i.e. the backend ran, not just the LLM). + +## Triage result needs structured tier/priority per item + +Current shape: + +```ts +result.implementation_tasks: string[] // titles only +result.memory_requirements: string[] +result.harness_suggestions: string[] +result.docs_or_tests: string[] +result.unclear_notes: string[] +result.eval_candidates: { id, task_input, expected_behavior, … }[] +``` + +Tiers (T1 / T2 / T3) appear only in the LLM-prose tier list it appends +to `BUILD_PLAN.md`. They are **not** present as a structured field per +item. That blocks any downstream "for each Tier-1 item, scaffold a +milestone" automation — the tier info is locked in prose. + +Wanted: extend the triage JSON schema so each implementation task is + +```ts +{ title: string, tier: "T1" | "T2" | "T3", rationale: string } +``` + +and update `appendBacklogItems` + a future milestone-escalator to read +the structured tier rather than re-parsing markdown. + +## Phases-helpers extension-load error on every SF run + +Every `sf …` invocation today prints: + +``` +[sf] Extension load error Error: Failed to load extension +"/home/mhugo/.sf/agent/extensions/sf/index.js": The requested module +'./phases-helpers.js' does not provide an export named 'closeoutAndStop' +``` + +Non-fatal (SF continues), but noisy and a sign of stale state. Either: + +- A recent rename of `closeoutAndStop` in `phases-helpers.js` wasn't + propagated to its caller, and `npm run copy-resources` quietly shipped + the partial state, or +- A test gap doesn't catch missing exports from `phases-helpers.js`. + +Add an import-time sanity check (or a test that imports every entry +in the extension index and asserts all required symbols resolve).