Skip to content

feat(session-flow): add now and ticket modes to audit-sessions with the retro hook #5929

Description

@kyle-sexton

Problem

/session-flow:audit-sessions (#5925) has only sweep, which covers every stored session. The design has two more modes:

  • now: the current session plus its plan. It says what to change for the rest of the session.
  • ticket: the sessions on one branch plus PR timing. /session-flow:retro session would call this section.

Done when

  • now audits the current session against the same rules and flags what to change before the session ends.
  • ticket gathers the sessions linked to a branch (by branch key or pr-link) and reports across them.
  • /session-flow:retro session calls the ticket section when the session is on a ticket branch.

Notes

Design thread T2c. Ticket linkage was recoverable for 34 of 90 sessions in the spike; sessions run on main cannot be linked.

Activity

  1. added
    needs-triageNot yet classified. Floor until a type and one priority tier are set.
    on Oct 2, 2026
  2. kyle-sexton commented on Oct 3, 2026

    @kyle-sexton
    MemberAuthor

    Design input for ticket mode from a /plugin-quality:audit of /session-flow:audit-sessions (2026-10-03, one Windows 11 machine, 764 stored sessions). Re-verified against main 9671ece.

    The store already holds what a per-work-item rollup needs. Each record carries the custom title, branches, PRs and cwd (plugins/session-flow/skills/audit-sessions/scripts/collect.py:638-641, :686-692); sweep.py:119 evaluates per-session rules only.

    Measured on that store (not re-measured here).

    • A generic ticket-shaped pattern, [A-Z][A-Z0-9]+-\d+, found a key in 223 of 764 sessions across 18 keys. 353 records had no stored title, yet the key still came from cwd or branches.
    • The pattern also matches non-ticket tokens such as UTF-8, SHA-256 and ISO-8601, so it must be configurable.
    • PR counts must be distinct PRs: store-wide, 210 PR links named 152 distinct PRs, and for individual keys the gap was larger.

    Operator decision carried from the audit's contract: the rollup sits behind a configurable key pattern with no hardcoded project prefix and no new userConfig key.

    Suggested shape (the audit proposed --by work-item --work-item-pattern '<regex>'; fold into ticket mode if that is the chosen surface):

    • Off by default; the default report is unchanged.
    • Per key: sessions, output tokens, first-to-last session span, distinct PR count, and gaps between consecutive sessions.
    • Prefer title and branch over cwd when assigning a key (a reused worktree over-attributes by cwd).
    • Label the span a session-side proxy, not cycle time.
    • Any new flag joins SKILL.md's accepted argument set (SKILL.md:25-27), with the pattern single-quoted in SKILL.md's example.

    Acceptance checks to add:

    • Without the rollup flag or mode, the report is unchanged.
    • With it, each key row shows sessions, output tokens, span, distinct PR count and gaps.
    • A fixture with 8 stored links to the same PR counts 1 PR.
    • No project prefix is hardcoded.

    Tracker-side cycle time, QA send-backs and CI results are out of scope for audit-sessions; the umbrella issue for this audit carries a needs-decision child on who owns that lane.

  3. kyle-sexton commented on Oct 4, 2026

    @kyle-sexton
    MemberAuthor

    This was generated by AI during triage.

    Agent Brief

    Type: Feature
    Summary: /session-flow:audit-sessions gains two scopes beyond sweep: now (the current session) and a per-work-item rollup (ticket), and /session-flow:retro session calls the rollup on a ticket branch.

    Current behavior:
    The skill's only action is sweep, over every stored session. Store records already carry custom title, branches, PR links and cwd, but no code groups sessions by work item, and there is no current-session mode.

    Desired behavior:

    • now: audits the current session against the sweep's rules and says what to change before the session ends.
    • Per-work-item rollup: groups stored sessions by a key matched with a configurable pattern (no hardcoded project prefix, no new userConfig key), preferring title and branch over cwd; per key it reports sessions, output tokens, first-to-last span (labelled a session-side proxy, not cycle time), distinct PR count and gaps between sessions.
    • Without the new mode or flag, the default report is unchanged.
    • Any new action or flag joins the skill's accepted argument set.

    Key interfaces:

    • The store record's title, branches, prs and cwd fields.
    • The skill's argument contract.
    • /session-flow:retro session output, which gains a ticket section.

    Acceptance criteria:

    • Without the rollup mode or flag, the report is unchanged.
    • With it, each key row shows sessions, output tokens, span, distinct PR count and gaps.
    • A fixture with 8 stored links to the same PR counts 1 PR.
    • A fixture with a non-ticket token (UTF-8, SHA-256) is not grouped when the configured pattern excludes it; no project prefix is hardcoded.
    • now reports against the same rules the sweep uses.

    Out of scope:

    Why this needs a human

    Open decisions:

    1. Surface: a ticket action, or the audit's proposed --by work-item --work-item-pattern '<regex>' flag on sweep. Recommended: one surface only; the flag keeps the argument set smaller.
    2. Where the pattern comes from with no new userConfig key and no hardcoded prefix: an argument each run, or repository config.
    3. now mode's contract: "the current session plus its plan" is not specified (which plan, which rules, what output), and the current session is not in the store until the collector runs.
    4. Sequencing: the rollup reports output tokens and spans whose underlying numbers fix(session-flow): make audit-sessions numbers, baseline, routes and report trustworthy #6074's children are correcting (fix(session-flow): measure Stop-hook wait and active time correctly in audit-sessions #6075 active time, fix(session-flow): call thresholds a shipped baseline and compute the recheck trigger #6077 thresholds); building on them first means re-baselining later.

    Splitting now from the rollup would let the rollup go agent-ready once 1 and 2 are answered. Work class once decided: work-class: scoped (C3, feature). Priority medium.

    Basis: verified, plugins/session-flow/skills/audit-sessions/SKILL.md:25 ("The only action is sweep"); #6074 body, "Handled outside the children" folds finding I2 into this issue; the audit comment on this issue (2026-10-03) for the measured key and PR-count figures.

  4. added
    priority: mediumReal value, no hard deadline; normal backlog flow.
    needs-humanHuman-in-the-loop required; autonomous sessions must not resolve items carrying this.
    status: needs-decisionAwaiting a human or maintainer judgment call.
    work-class: scopedA briefed fix or small feature; blast radius bounded by the brief, tests exist.
    and removed
    needs-triageNot yet classified. Floor until a type and one priority tier are set.
    on Oct 4, 2026
  5. kyle-sexton commented on Oct 18, 2026

    @kyle-sexton
    MemberAuthor

    Decision recorded.

    Question: /session-flow:audit-sessions would gain a current-session audit and a per-work-item rollup, and /session-flow:retro would call the rollup. Options: (a) two new actions, now and ticket; (b) flags on sweep; (c) now as an action and the rollup as a flag.

    Owner's answer: (a) The skill already adds modes as actions (sweep, sweep-only, style). The now contract is still unspecified, so ticket can ship first. Basis: audit-sessions SKILL.md:26-30; retro SKILL.md:200.

    The owner accepted this recommendation as item D6 of a 32-decision batch in an attended backlog-shaping session on 2026-10-18. The batch question: "Accept all 32 recommendations, including the four flagged above (D2 close the relearn, D26 cross-repo sync without per-repo confirm, D10 narrow hook, D23 delete guard only)?" The owner answered: "Accept all 32 (Recommended)".

    Posted by AI from the owner's answer in that session.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-humanHuman-in-the-loop required; autonomous sessions must not resolve items carrying this.priority: mediumReal value, no hard deadline; normal backlog flow.status: needs-decisionAwaiting a human or maintainer judgment call.work-class: scopedA briefed fix or small feature; blast radius bounded by the brief, tests exist.

    Fields

    No fields configured for Feature.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions