A budgeted plan-to-review delivery workflow for .NET teams: start, fix, feature, plan, implement, test, review and next, with plan and review pages as Claude…

A Claude Code plugin for .NET teams that takes work from a ticket through planning, implementation, review and QA hand-off. It builds plan and review pages with enforced word budgets, so you can read the proposed work and the results before approving each.
One project profile sets your architecture, tests, tracker and QA workflow. Use the eight skills, start, fix, feature, plan, implement, test, review and next, together or on their own, with or without a ticket tracker or the Artifact tool.
Install | Workflow | Skills | Progress bar | /goal | Branding | Profile reference | dotnet-claude-kit | Jev | Contributing
Run in a terminal:
claude plugin marketplace add chrisjainsley/claude-dotnet-workflow-kit
claude plugin install dotnet-workflow-kit@dotnet-workflow-kit
Then run setup in Claude Code from your project:
/dotnet-workflow-kit:setup
Setup asks about your team and writes .claude/dotnet-workflow-kit.json. Commit that file to share the settings. Run setup again when your workflow changes.
The scripts require Python 3.11 or later. Pillow is optional; without it, the plan builder embeds full-size images instead of downscaling them.
For terminal setup from a clone of this repository:
python scripts/setup.py
Start with a ticket ID, or a short slug when tracker is none:
/dotnet-workflow-kit:start 1234
Use the pipeline driver to continue, or wrap it in a goal so it keeps going until the next gate:
/dotnet-workflow-kit:next
/goal /next has stopped at a gate
The driver checks the branch, PR and saved state, then runs the earliest unfinished stage. It pauses for plan answers or approval, the review decision, and blockers. Invoking it authorizes commits, pushes, a draft PR and configured deployment labels before the review checkpoint. The kit never merges; a person approves every merge.
| Stage | Who | Result |
|---|---|---|
| 0. Start | Agent | Create and push a branch; assign and activate the item when a tracker is configured. |
| 1. Plan | Agent, then you | Build the plan page; you answer the open questions or approve. |
| 2. Implement | Agent | Implement the plan one layer per commit, then run the reviewer sweep, fix findings and verify. |
| 3. Test | Agent | Run the suites, then the plan's scenarios in the configured environment; fix failures and rerun. |
| 4. Review | Agent, then you | Present the final diff, findings and QA evidence on one page; you approve or send it back. |
| 5. Pull request | Agent, then you | Resolve threads and get checks green. After approval, post the QA report, apply labels and mark the PR ready. You merge. |
Requesting changes returns the pipeline to implementation with your notes and per-finding fix or accept choices. The draft stays a draft until approval.
For a bug, start with fix instead. It replaces Start and Plan with a Reproduce stage, has no plan gate, and approves its own review when the fix is verified:
/dotnet-workflow-kit:fix 1234
For a whole feature or PRD, start with feature. It splits the work into stories, plans the feature on one page for a single approval, then creates the stories and prints one /next brief each. Each story runs every stage, with no plan gate, and stops at its own review checkpoint. In a Claude project the briefs run as parallel threads, and dependent stories stack their pull requests:
/dotnet-workflow-kit:feature 1200
Use to start work from an ID, issue URL or untracked slug. It creates and pushes a branch from base_branch using branch_pattern. With a tracker, it assigns the item to user and moves it to the configured active state. It then renames the session when supported and hands off to plan.
Use to fix a bug hands-off. It branches as start does, then tries to reproduce the bug in the system running locally through stack.local_run (an Aspire AppHost on ports of its own, Docker or plain dotnet run), saving before evidence. It carries on when the bug will not reproduce. It writes a failing regression test, finds the regression area (the feature files and test classes beside the code the fix touches) and writes a small plan with no gate. Implement, test and review then run as usual, and Test also runs the regression area. When the bug reproduced, its scenario now passes, everything is green and no finding is open, the review approves itself and the pull request is marked ready. Otherwise the run stops at the review checkpoint and says why. It asks a question only when the ticket cannot say what correct looks like.
Use to deliver a PRD, epic or feature story by story. It reads the PRD from the tracker, a file or chat, reuses the children the feature already has, and splits the rest into up to twelve stories, each one pull request with Gherkin acceptance criteria. scripts/feature_order.py groups the stories into waves by their dependencies and works out what each branches from, following feature.stacking. A script checks the page's budget and rejects a cycle or a story without specs.
The feature page has the stories, their specs, the delivery order, decisions, risks and open questions, with the plan's answer form. Nothing reaches the tracker until you approve it. On approval it creates the stories under the feature and prints one brief per story, opening with /dotnet-workflow-kit:next <id>. Each story's plan follows the approved specs with no gate, and stops only when the story needs something the feature page did not settle. Running a feature in a Claude project covers running the briefs as threads, and what is not yet verified there.
Use for an implementation plan. It reads the ticket and codebase, then writes plans/<id>-<slug>/plan.md and builds plan.html. Sections follow your architecture, with test scenarios, decisions, risks and open questions. A script checks section budgets before publication.
Before the layer sections, an Architecture diagram shows the proposed change and where it lives: one lane per architecture layer, one row per service or infrastructure stack, and a box per component with new, changed and unchanged marked. It is the same layer map the review draws from the diff, with a Before (today) / After (this plan) toggle, so the plan's map and the review's map can be compared side by side. Click a box for its file, what changes and any example data.
When stack.frontend is set and a ticket changes a screen that came with no design, the skill draws the screens first, with Claude Code's /design command or the Design canvas Artifact type, and embeds the artboards in a Designs section of the plan page next to a link to the editable canvas. Designs supplied by the tracker are used as they are and no canvas is made.
On an Artifact page, choose answers, pick Approve or Revise the plan and press Send answers. The page passes the choices to the session, which folds them into the plan; on Approve it goes straight on to Implement. If the page says to tell Claude "decided", the session could not be reached; say it in chat and the skill reads the stored choices.
With optional.walkthrough on, the plan page also has Walk me through it: a narrated tour of what gets built, the riskiest decision and each open question with its recommendation, ending on the form. It works as the review's does, described below.

Use to build an approved plan. It walks the plan's layers in order, one commit each, tests first when testing.tdd is strict, then runs the reviewer sweep: read-only reviewers in parallel, cleanup and verification in sequence. The built-in reviewers are bug-hunt and conventions; the profile can enable companion reviewers and a Codex second opinion. Findings are fixed on the branch before anything is tested, and missing tools appear in the skipped list with a reason. This skill edits files.
Use to run the Test stage and write up what was tested. It runs the build and the suites, then the approved plan's scenarios in qa.environment, opening the draft PR and applying qa.deploy_label when that environment needs a deployment. It then writes the QA report, or testing notes for a QA team.
| Mode | Content | Posting |
|---|---|---|
| Report | Given/When/Then scenarios, Pass/Fail/Blocked results, evidence (API request and response pairs, query results folded under the step each proves; screenshots and videos in a visible grid per scenario), summary and untested criteria. | After approval, post according to qa.evidence. |
| Notes | What changed, steps per persona, test data, edge cases, scope, environment and flags. | After approval, post for qa-team according to qa.evidence; otherwise print in chat. |
Reports cover acceptance runs against a real environment and manual checks. Unit and integration suites do not count as QA evidence. Notes come from the approved plan's Specs, or the diff when no plan exists. Select notes mode with:
/dotnet-workflow-kit:test notes
Use to review a branch or PR. It combines the approved plan, actual diff, sweep findings and QA evidence into review.md and review.html. When no sweep is fresh for the branch, it runs one first, so a branch nobody implemented in this session can still be reviewed.
The page includes verdict counts, plan versus delivered, a change diagram (click it to open full size), file links to full diffs, findings, the QA report and a rollout checklist. Choose Approve or Request changes and press Send decision. The page passes the decision to the session, which reads it with each open finding's fix or accept choice; on Approve it goes straight on to the pull request stage. Say "decided" in chat if the page asks.
With optional.walkthrough on, the review (and the plan, see above) ends with a short narrated tour and the page gets a Walk me through it button under the header. It scrolls to each scene, highlights the row or flowmap box, animates the box's connections and plays the line with its caption. The voice is recorded when the review is built, by Kokoro, an open-source voice model that runs on your machine (pip install kokoro-onnx; the model downloads once). The text is never sent anywhere, and every reader hears the same voice in any browser. Without Kokoro installed, the tour plays as captions only.

Use to run the workflow from the current stage. It reads live signals alongside ~/.claude/dotnet-workflow-kit/pipeline/<slug>.json and updates stage completion. Live evidence overrides saved state; sweeps, test runs and reviews older than new commits must run again. State files written by 0.5.0 are migrated on first read.
To inspect progress without running a stage:
/next status
The skills now carry the names of the stages they run. Old names are not aliased; update any saved prompts or /goal text.
| Before | Now |
|---|---|
start-ticket | start |
visual-plan | plan |
Execute stage inside next, plus mega-review | implement (the sweep lives at skills/review/sweep.md) |
qa-report, plus the QA stage inside next | test |
visual-review | review |
| Draft PR, Resolve comments and Publish and hand off stages | next stage 5, Pull request |
The kit ships a Claude Code mod that draws a progress bar above the prompt, in the terminal and the desktop Code tab. It shows the work item on the session's own branch: the ticket id and a short title, a bar with a segment per stage, the current stage, the percentage and what Claude is doing right now. A stage waiting on you turns amber. The bar reads the pipeline state file that start, plan and next write.
The skills write that file through a tool the mod adds, mcp__dotnet-workflow-kit__stage. It finds the branch's file, merges the change and redraws the bar at once. Where mods are blocked, the skills edit the file by hand. While subagents run, such as the reviewers in the sweep, the bar counts them instead of showing what each one reads. The bar follows the light or dark theme and stops moving when the system asks for reduced motion.
Every session on a branch other than main, master or the profile's base_branch shows, whether or not it ran a skill. For a branch no skill has touched, the mod writes the state file itself, marked adopted, with Start done and a title taken from the branch name; the first start, plan or next run on that branch takes the file over.
Other items on branches of the same repository, touched in the last day, appear as a +N chip at the end of the bar; it turns amber when one of them is waiting on you. Pressing the chip, or /sessions, opens the Sessions pane: every item grouped as Needs you, Running and Done. Open items are cards with their stages, status and a Show button that names the branch whose session to open; the item you are viewing has a purple edge and one waiting on you an amber one. A plugin cannot switch the app to another session, so Show points you to it instead. Finished items take one line each, with a cross to hide one and Dismiss all to hide the lot. A toast when another item reaches a gate is off by default, because the app's own notifications already cover a session waiting on you; the last row of the pane turns it on. /progress hides or shows the bar, and the cross on a finished item hides it.
An item closes by itself when its pull request merges or closes, or when the worktree it was started in is gone, as it is once a worktree chat is archived; /progress done closes the current branch's item by hand. An adopted item no skill took over also closes when its branch is deleted or after a week with no session working on it. A closed item shows every stage done, and a day later its row goes and scripts/close_items.py deletes its state file. The PR check asks gh (or az for Azure Repos) every ten minutes.
When several sessions run Aspire on one machine, the mod keeps track of which session owns each running AppHost, so they stop getting in each other's way. Every session scans for AppHosts with scripts/aspire_sessions.py: an AppHost belongs to the worktree it was built in, and the session working in that worktree owns it. The list lives in ~/.claude/dotnet-workflow-kit/aspire, one file per AppHost with its process, ports, dashboard URL and owner, and a file goes when its AppHost exits.
kill, pkill, killall, taskkill, Stop-Process, or freeing a port with lsof, fuser or Get-NetTCPConnection), or start an AppHost that another session already runs from the same folder, or on a port another session's AppHost holds. The refusal names the owner and what to do instead.A session that ends leaves its AppHosts free for the next session in that worktree, and one that stops scanning for two minutes counts as ended. Scanning runs when the profile's stack.local_run is aspire, when this session starts an AppHost, or when any session has one listed, and needs Python like the rest of the kit. AppHosts in two worktrees of one repository start on the same ports, so give each worktree a launch profile of its own; see adapters/stack/local_run.md.
The bar turns on by itself once the plugin is installed: mods load in every new session, with nothing to enable. It stays empty until a work item is started. An organisation's managed settings can block user-installed mods, for example with allowManagedModsOnly.
/next runs stage after stage inside one turn, but nothing restarts it if the turn ends early. The kit's hooks wrap each half of the run in a goal for you:
| When | The hooks set |
|---|---|
| The plan is approved | /goal /next has reached the review checkpoint |
| The review is approved | /goal complete /next: the pull request is ready |
Each goal is met by the message /next ends that half with, so it clears on its own instead of re-prompting while you decide. While /next is stopped on a blocker the hooks keep the goal quiet until you answer. Sending from the plan or review page wakes the session through Send to Claude, and an approval carries the run on by itself. When a page cannot reach the session, it says so; tell the session "decided" instead.
Without function hooks, set a goal yourself after each gate:
/goal /next has stopped at a gate
Tool permission prompts may still require input. When the pipeline reports a blocker, resolve it before continuing.
Set artifacts to false through setup when the Artifact tool is unavailable. The skills build the same HTML pages and give you local file paths to open.
Local forms cannot save answers or decisions. Reply in chat with question numbers and choices, or with "approve" or "changes" and your finding decisions. Rollout checklist ticks do not persist; track rollout outside the kit. See Running without the Artifact tool.
The plan and review pages use the Delivery Labs colours and carry an attribution footer linking there. Set branding to false through setup, or in the profile file, to render the neutral palette with no footer.
Setup writes .claude/dotnet-workflow-kit.json in the project. Profile resolution uses an explicit path first, then the project file, then the user file at ~/.claude/dotnet-workflow-kit.json, then defaults. Missing fields receive defaults.
Each row below names a field, including nested fields in dotted form. For example, testing.tdd lives inside the testing object. Empty strings appear as "".
| Field | Allowed values | Default | Purpose |
|---|---|---|---|
schema | Integer | 1 | Profile schema version. |
user | Free text | "" | Assignee and name used in page prose. |
architecture | clean, vertical, ddd-clean, modular-monolith | "clean" | Plan section order and review rules. |
testing.tdd | strict, encouraged, none | "encouraged" | TDD expectation; strict means tests first during execution. |
testing.unit | xunit, nunit, mstest | "xunit" | Unit test framework. |
testing.integration | webapplicationfactory, testcontainers, none | "webapplicationfactory" | Integration test approach. |
testing.acceptance | reqnroll, specflow, none | "none" | Acceptance test runner; none keeps scenarios without a BDD runner. |
qa.owner | qa-team, self, none | "self" | Who tests and signs off. |
qa.evidence | work-item, pr-comment, none | "none" | Where approved QA reports go. |
qa.handoff_label | Free text | "" | PR label for QA hand-off. |
qa.deploy_label | Free text | "" | PR label to deploy to QA. |
qa.environment | Free text | "local" | Environment named in QA evidence. |
tracker | azure-boards, github-issues, jira, none | "none" | Ticket adapter; none uses your description. |
tracker_project | Free text | "" | Project or organization identifier for tracker calls. |
scm | github, azure-repos | "github" | PR and diff adapter. |
base_branch | Free text | "main" | Starting branch and fallback PR base; stacked work uses its parent. |
branch_pattern | Free text containing {slug}; supports {kind} and {id} | "{kind}/{id}-{slug}" | Branch naming template. |
branch_kinds.feature | Non-empty text | "feat" | Feature value for the kind token. |
branch_kinds.bug | Non-empty text | "bug" | Bug value for the kind token. |
tracker_states.active | Free text | "" | State when work starts; blank uses the adapter default. |
tracker_states.qa_ready | Free text | "" | QA hand-off state; blank uses the adapter default. |
artifacts | true, false | true | Publish Artifacts, or build local HTML and take answers in chat. |
branding | true, false | true | Delivery Labs colours and an attribution footer on the plan and review pages; false renders the neutral palette with no footer. |
stack.data | ef-core, dapper, cosmos, other | "ef-core" | Data access conventions. |
stack.api | minimal-api, controllers, graphql, grpc | "minimal-api" | API contract style. |
stack.messaging | masstransit, wolverine, service-bus, none | "none" | Messaging conventions. |
stack.errors | result, exceptions | "exceptions" | Error handling conventions. |
stack.local_run | aspire, docker, plain | "plain" | How to start the system for local QA. |
stack.frontend | none, blazor, razor, react, angular, vue, javascript | "none" | Whether the repo has a frontend and which kind; see the plan skill. |
feature.stacking | off, base, gh-stack | "base" | How a feature's dependent story stacks on its parent: base branches from the parent and sets it as the PR base, gh-stack also links a linear chain with GitHub's gh stack (needs scm github), off waits for the parent to merge. See feature. |
reviewers | bug-hunt, conventions, kit, security-scan, convention-learner, code-review-workflow | ["bug-hunt", "conventions"] | Reviewer sweep passes; the two built-ins always run. |
pipeline.execute | Free text | "" | Execution command; blank implements the plan directly. |
pipeline.resolve_comments | Free text | "" | Comment-resolution command; blank uses the SCM adapter. |
pipeline.qa | Free text | "" | QA command; blank runs plan Specs manually per the QA adapter. |
pipeline.open_pr_in_browser | true, false | true | In Claude desktop, open a newly created PR in the Claude browser pane. Set false to only report the link. |
pipeline.auto_fix_pr | true, false | true | In Claude desktop, turn on CI auto-fix and comment handling for a newly created PR, so the session wakes on CI failures, conflicts and review comments. Set false to leave it off. |
optional.dotnet-claude-kit | true, false | false | Companion plugin availability. |
optional.codex | true, false | false | Enable the Codex second-opinion reviewer. |
optional.roslyn-mcp | true, false | false | Roslyn MCP availability for code-review-workflow. |
optional.walkthrough | true, false | false | Narrated walkthrough on the plan and review pages, voiced by Kokoro on your machine (pip install kokoro-onnx). See review. |
optional.jev | true, false | false | Jev availability: a TYPESAFE_API_KEY or a jev MCP server. Detected by setup. See Jev. |
jev.flag_at | Number from 0 to 1 | 0.75 | Probability at or above which a scored check becomes a finding at the rule's severity. |
| jev.review_at | Number from 0 to 1,
hooks/register.tsx 1625 lines1// The kit's progress bar: the current branch's work item above the prompt, drawn from the pipeline
2// state files `start`, `plan` and `next` write under ~/.claude/dotnet-workflow-kit/pipeline, and a
3// Sessions pane listing every item in this repository. A branch no skill has touched yet gets a
4// file of its own, marked `adopted`, so every session shows whether or not it used the kit. It also sets the run's /goal when the plan
5// and then the review are approved. With Aspire it tracks which session owns each running AppHost
6// through scripts/aspire_sessions.py, shows them, tells Claude, and refuses commands that would
7// stop or clash with another session's.
8import { atom, read, update } from 'claude-code'
9import type { EngineInterface, Register } from 'claude-code'
10
11import type { Activity, AspireEntry, PipelineRow, RunningAgent, StageStatus } from '../types'
12
13const rows = atom({ plugin: 'dotnet-workflow-kit', key: 'rows' } as const, [])
14const isHidden = atom({ plugin: 'dotnet-workflow-kit', key: 'isHidden' } as const, false)
15const dismissed = atom({ plugin: 'dotnet-workflow-kit', key: 'dismissed' } as const, [])
16const activity = atom({ plugin: 'dotnet-workflow-kit', key: 'activity' } as const, null)
17// What the session still has running in the background when its turn ends, so the bar keeps
18// moving while Claude waits on a shell, subagent or workflow to wake it.
19const background = atom({ plugin: 'dotnet-workflow-kit', key: 'background' } as const, [])
20// Goals already set, per item: survives reloads so a phase's goal is set once.
21const goalsSet = atom({ plugin: 'dotnet-workflow-kit', key: 'goalsSet' } as const, {})
22// Whether this session toasts when another item reaches a gate; off, since the app notifies too.
23const notifyOthers = atom({ plugin: 'dotnet-workflow-kit', key: 'notifyOthers' } as const, false)
24// The subagents running now, so the band can count them without their tool calls taking it over.
25const agents = atom({ plugin: 'dotnet-workflow-kit', key: 'agents' } as const, [])
26// Every Aspire AppHost running on this machine, with the session that owns it.
27const aspire = atom({ plugin: 'dotnet-workflow-kit', key: 'aspire' } as const, [])
28
29const PANE = 'sessions'
30const AGENT_MS = 60 * 60 * 1000
31
32// The kit's own pipeline; a state file's `order` replaces it when a team adds stages.
33const DEFAULT_ORDER = ['start', 'plan', 'implement', 'test', 'review', 'pull_request']
34const DEFAULT_LABELS: Record<string, string> = {
35 start: 'Start',
36 plan: 'Plan',
37 repro: 'Reproduce',
38 implement: 'Implement',
39 test: 'Test',
40 review: 'Review',
41 pull_request: 'PR',
42 pullRequest: 'PR',
43}
44const MAX_ROWS = 12
45// Other items show in the Sessions pane only while someone touched them recently.
46const RECENT_MS = 24 * 60 * 60 * 1000
47const POLL_MS = 4000
48// A closed item's row goes a day after it closed; scripts/close_items.py deletes its file then.
49const REMOVE_MS = 24 * 60 * 60 * 1000
50// Asking GitHub or Azure about each PR is a network call, so it runs far less often than the poll.
51const CLOSE_MS = 10 * 60 * 1000
52const CLOSED_LABELS: Record<string, string> = {
53 merged: 'Merged',
54 closed: 'PR closed',
55 archived: 'Archived',
56 deleted: 'Branch deleted',
57 idle: 'Idle',
58 manual: 'Done',
59}
60// An adopted item's file is rewritten at most this often while its session works, so it stays recent.
61const TOUCH_MS = 10 * 60 * 1000
62const ADOPTED_DETAIL = 'Not run through the kit yet: /next picks it up'
63// A session that owns an AppHost rescans this often; any other session only every QUIET_MS.
64const ASPIRE_MS = 15 * 1000
65const QUIET_MS = 60 * 1000
66// Commands worth asking scripts/aspire_sessions.py about: ones that stop processes or start an AppHost.
67const ASPIRE_COMMAND =
68 /\b(kill|pkill|killall|taskkill|stop-process|spps|fuser)\b|\bdotnet(\.exe)?\s+(run|watch)\b|\baspire(\.exe)?\s+(run|start)\b/i
69// A start's AppHost builds before it listens, so the scans after one come at these delays.
70const START_SCANS_MS = [5000, 20000, 45000, 90000]
71
72// `todo` is a theme key, so the stages ahead read on a light terminal as on a dark one.
73const COLOR = { done: '#c4c0ff', active: '#8e86f8', waiting: '#f59e0b', todo: 'inactive' }
74// The Sessions pane's cards: a purple edge on the item being viewed, an amber one on an item
75// waiting on you, with a faint tint of the same where the surface can draw one.
76const CARD = {
77 // A theme key, so a plain card's edge reads on a light theme as on a dark one.
78 border: 'subtle',
79 currentBorder: '#5d52a3',
80 currentTint: '#9d8cff14',
81 currentText: '#8e86f8',
82 waitingBorder: '#8a6a33',
83 waitingTint: '#e9ae4f14',
84 check: '#6fbf73',
85}
86// A card's stage segments: done stages muted, the active one bright, those ahead a dark track.
87const SEGMENT = { done: '#5d52a3', active: '#9d8cff', waitingDone: '#8a6a33', waiting: '#e9ae4f', todo: '#3a3836' }
88
89type Stage = {
90 done?: boolean
91 at?: string
92 waiting?: boolean
93 label?: string
94 artifactUrl?: string
95 decision?: string
96 note?: string
97}
98type Closed = { reason: string; at: string }
99type StateFile = {
100 closed?: Closed
101 adopted?: boolean
102 worktree?: boolean | string
103 repo?: string
104 ticket?: string
105 title?: string
106 shortTitle?: string
107 branch?: string
108 current?: { stage?: string; detail?: string; blocked?: boolean }
109 order?: (string | { id: string; label?: string })[]
110 stages?: Record<string, Stage | undefined>
111}
112
113// One stage's done flag, reading the 0.5.0 keys for the built-in stages when the new ones are absent.
114function stageDone(s: Record<string, Stage | undefined>, id: string): boolean {
115 const d = (key: string) => s[key]?.done === true
116 const has = (key: string) => s[key] !== undefined
117
118 switch (id) {
119 case 'start':
120 return has('start') ? d('start') : d('startTicket')
121 case 'implement':
122 return has('implement') ? d('implement') : d('execute') && d('megaReview')
123 case 'test':
124 return has('test') ? d('test') : d('qa')
125 case 'review':
126 return d('review') || s.review?.decision === 'approve'
127 case 'pull_request':
128 case 'pullRequest':
129 return has('pullRequest') ? d('pullRequest') : has('pull_request') ? d('pull_request') : d('handoff')
130 default:
131 return d(id)
132 }
133}
134
135// A stage's entry in the file, under either spelling of the PR stage.
136const stageEntry = (s: Record<string, Stage | undefined>, id: string) =>
137 id === 'pull_request' || id === 'pullRequest' ? (s.pullRequest ?? s.pull_request) : s[id]
138
139// The stages in order with their labels: the file's `order` when present, else the kit's six.
140function stageList(data: StateFile): { id: string; label: string }[] {
141 const order = data.order?.length ? data.order : DEFAULT_ORDER
142 const stages = data.stages ?? {}
143
144 return order.map(entry => {
145 const id = typeof entry === 'string' ? entry : entry.id
146 const given = typeof entry === 'string' ? undefined : entry.label
147 const label = given || stages[id]?.label || DEFAULT_LABELS[id] || id.replace(/[-_]/g, ' ')
148
149 return { id, label: label.charAt(0).toUpperCase() + label.slice(1) }
150 })
151}
152
153// feat/391-jev-agent-router -> "jev agent router"; claude/foo-bar-7d2e6c -> "foo bar".
154function titleFromBranch(branch: string): string {
155 return branch
156 .replace(/^.*\//, '')
157 .replace(/^#?\d+[a-z]?-/, '')
158 .replace(/-[0-9a-f]{6}$/, '')
159 .replace(/-/g, ' ')
160}
161
162// "391" -> "#391"; "PROJ-12" stays; placeholders such as "none" or "untracked" show nothing.
163function ticketId(ticket: string | undefined): string {
164 const id = (ticket ?? '').trim()
165 if (!id || /^(none|untracked)$/i.test(id)) return ''
166
167 return /^\d+$/.test(id) ? `#${id}` : id
168}
169
170// A row's title in at most four words and 28 characters: the story at a glance, not its full name.
171function shortTitle(title: string): string {
172 const words = title.trim().split(/\s+/).slice(0, 4).join(' ')
173
174 return words.length > 28 ? `${words.slice(0, 27).trimEnd()}…` : words
175}
176
177function toRow(slug: string, data: StateFile, branch: string): PipelineRow {
178 const stages = data.stages ?? {}
179 const list = stageList(data)
180 // A stage a skill has written to means every stage before it is behind the item, even when a
181 // skill skipped marking them (a plan written without Start ticked is still at Plan).
182 // `/next` seeds stages it has not reached with blank placeholders, so only real progress counts.
183 const isReached = (id: string) => {
184 const s = stageEntry(stages, id)
185 return data.current?.stage === id || !!(s && (s.done || s.waiting || s.at || s.artifactUrl || s.decision))
186 }
187 const reached = list.reduce((last, stage, i) => (isReached(stage.id) ? i : last), -1)
188 // A closed item counts every stage as done, whatever the stage flags say.
189 const flags = list.map((stage, i) => !!data.closed || i < reached || stageDone(stages, stage.id))
190 const activeIndex = flags.indexOf(false)
191 const active = activeIndex === -1 ? undefined : list[activeIndex].id
192 const activeStage = active ? stageEntry(stages, active) : undefined
193 const isPlanGate = active === 'plan' && !!activeStage?.artifactUrl
194 const isCheckpoint = active === 'review' && !!activeStage?.artifactUrl && !activeStage?.decision
195 const isCustomGate = activeStage?.waiting === true
196 const isGate = isPlanGate || isCheckpoint || isCustomGate
197
198 const statuses: StageStatus[] = flags.map((done, i): StageStatus => {
199 if (done) return 'done'
200 if (i !== activeIndex) return 'todo'
201
202 return isGate ? 'waiting' : 'active'
203 })
204
205 const detail = data.closed
206 ? (CLOSED_LABELS[data.closed.reason] ?? 'Done')
207 : isPlanGate
208 ? 'Waiting on you: answer or approve the plan'
209 : isCheckpoint
210 ? 'Waiting on you: review checkpoint'
211 : isCustomGate
212 ? `Waiting on you${activeStage?.note ? `: ${activeStage.note}` : ''}`
213 : activeIndex === -1
214 ? 'Every stage done'
215 : (data.current?.detail ?? activeStage?.note ?? '')
216
217 return {
218 slug,
219 ticket: ticketId(data.ticket),
220 title: data.shortTitle || shortTitle(data.title || titleFromBranch(data.branch ?? '')),
221 branch: data.branch ?? '',
222 isCurrentBranch: !!branch && data.branch === branch,
223 labels: list.map(stage => stage.label),
224 isPlanApproved: stageDone(stages, 'plan'),
225 isReviewApproved: stages.review?.decision === 'approve',
226 isBlocked: data.current?.blocked === true,
227 statuses,
228 doneCount: flags.filter(Boolean).length,
229 activeIndex,
230 detail,
231 }
232}
233
234const basename = (path: unknown) => String(path ?? '').replace(/^.*[\\/]/, '')
235const clip = (text: string, max = 60) => (text.length > max ? `${text.slice(0, max - 1)}…` : text)
236
237// A slug-style ticket ("todo-by-id") already says what the title says; show it once.
238const same = (a: string, b: string) =>
239 a.toLowerCase().replace(/[^a-z0-9]/g, '') === b.toLowerCase().replace(/[^a-z0-9]/g, '')
240const rowName = (row: PipelineRow) =>
241 (row.ticket && same(row.ticket, row.title) ? row.ticket : [row.ticket, row.title].filter(Boolean).join(' ')) ||
242 row.slug
243// The ticket and title apart, for the pane's cards; a slug-style ticket stands in for the title.
244const nameParts = (row: PipelineRow) =>
245 row.ticket && same(row.ticket, row.title)
246 ? { ticket: '', title: row.ticket }
247 : { ticket: row.ticket, title: row.title || row.slug }
248const pct = (row: PipelineRow) => Math.round((row.doneCount / row.labels.length) * 100)
249const isComplete = (row: PipelineRow) => row.activeIndex === -1
250const isWaiting = (row: PipelineRow) => !isComplete(row) && row.statuses[row.activeIndex] === 'waiting'
251const stageLabel = (row: PipelineRow) =>
252 isComplete(row) ? 'Complete' : `${row.labels[row.activeIndex]} ${row.activeIndex + 1}/${row.labels.length}`
253const dotColor = (row: PipelineRow) =>
254 isComplete(row) ? COLOR.done : isWaiting(row) ? COLOR.waiting : COLOR.active
255
256// What a tool call says Claude is doing, in a few words; undefined for calls not worth showing.
257function describe(e: Record<string, unknown>): string | undefined {
258 const tool = String(e.tool ?? '')
259 const said = typeof e.description === 'string' && e.description ? e.description : undefined
260
261 switch (tool) {
262 case 'Skill':
263 return `Running /${String(e.skill ?? '').replace(/^.*:/, '')}`
264 case 'Agent':
265 return said ? `Agent: ${said}` : 'Running a subagent'
266 case 'Bash':
267 case 'PowerShell':
268 return said
269 case 'Edit':
270 case 'Write':
271 case 'NotebookEdit':
272 return `Editing ${basename(e.file_path ?? e.notebook_path)}`
273 case 'Read':
274 return `Reading ${basename(e.file_path)}`
275 case 'Grep':
276 case 'Glob':
277 return `Searching for ${clip(String(e.pattern ?? ''), 30)}`
278 case 'WebFetch':
279 case 'WebSearch':
280 return 'Researching on the web'
281 case 'Artifact':
282 return e.action === 'read' ? 'Reading a page' : 'Publishing a page'
283 default:
284 return tool.startsWith('mcp__') ? `Calling ${tool.split('__').pop()}` : undefined
285 }
286}
287
288// One goal per phase, each met at that phase's own gate: the review checkpoint, then a ready PR.
289const GOALS = {
290 review: '/next has reached the review checkpoint',
291 complete: 'complete /next: the pull request is ready',
292} as const
293
294// Phases seen on the previous refresh; a goal fires only on a change seen while watching.
295let lastPhases: Record<string, { plan: boolean; review: boolean }> | null = null
296// When this module loaded; an item first seen whose file was written later is a change seen live.
297let watchingSince = 0
298
299async function setGoals($: EngineInterface, rows: PipelineRow[], mtimes: Record<string, number>) {
300 const current = rows.find(row => row.isCurrentBranch)
301 const before = lastPhases
302 lastPhases = Object.fromEntries(
303 rows.map(row => [row.slug, { plan: row.isPlanApproved, review: row.isReviewApproved }]),
304 )
305 if (!current || !before) return
306
307 const fresh = (mtimes[current.slug] ?? 0) > watchingSince
308 const was = before[current.slug] ?? (fresh ? { plan: false, review: false } : undefined)
309 if (!was) return
310 const phase =
311 current.isReviewApproved && !was.review
312 ? 'complete'
313 : current.isPlanApproved && !was.plan
314 ? 'review'
315 : undefined
316 // A pipeline already finished has nothing left for the completion goal to drive.
317 if (!phase || (phase === 'complete' && current.activeIndex === -1)) return
318
319 const already = (await read($, goalsSet))[current.slug] ?? []
320 if (already.includes(phase)) return
321 await update($, goalsSet, all => ({ ...all, [current.slug]: [...already, phase] }))
322
323 // command.run is refused inside a hook the turn waits on, so it runs off a timer instead.
324 $.clock.after(50, () => {
325 $.command
326 .run({ command: 'goal', args: GOALS[phase] })
327 .then(() => $.ui.toast(`Goal set: ${GOALS[phase]}`))
328 .catch(err => $.ui.log(`dotnet-workflow-kit: could not set the goal: ${String(err)}`))
329 })
330}
331
332let lastJson = ''
333// The refresh under way, and the one queued behind it: a caller that asks during a refresh
334// waits for the next one, so what it just wrote is on the bar when its await returns.
335let running: Promise<void> | null = null
336let queued: Promise<void> | null = null
337// Parsed state files by name, reused while the file's mtime is unchanged.
338const cache = new Map<string, { mtime: number; data: StateFile | null }>()
339let lastDone: Record<string, boolean[]> | null = null
340let lastWaiting: Record<string, boolean> | null = null
341
342// A work item's state file, not a stage's checks or evidence file written beside it.
343const isStateFile = (entry: { name: unknown; kind: string }) =>
344 entry.kind === 'file' && String(entry.name).endsWith('.json') && !String(entry.name).includes('-checks')
345
346async function homeDir($: EngineInterface) {
347 const home = (await $.env.get('USERPROFILE')) || (await $.env.get('HOME')) || ''
348
349 return home.replace(/\\/g, '/')
350}
351
352// a/b/../c -> a/c: a worktree's `commondir` is relative (`../..`), and git prints the folded path.
353function resolveDots(path: string): string {
354 const out: string[] = []
355 for (const part of path.split('/')) {
356 if (part === '..' && out.length > 1) out.pop()
357 else if (part !== '.') out.push(part)
358 }
359
360 return out.join('/')
361}
362
363type Repo = { branch: string; commonDir: string; root: string; isWorktree: boolean }
364
365// The session's repository: its checked-out branch and the git dir that holds its refs
366// (a worktree's own git dir points at the shared one through `commondir`).
367async function currentRepo($: EngineInterface): Promise<Repo | undefined> {
368 try {
369 let dir = ((await $.session.cwd()) as string).replace(/\\/g, '/')
370 for (let i = 0; i < 12 && dir; i++) {
371 const dotGit = `${dir}/.git`
372 if (await $.fs.exists(dotGit)) {
373 const stat = await $.fs.stat(dotGit)
374 let gitDir = dotGit
375 if (stat.kind === 'file') {
376 const pointer = ((await $.fs.read(dotGit)) as string).trim()
377 gitDir = pointer.replace(/^gitdir:\s*/, '').replace(/\\/g, '/')
378 if (!/^([a-zA-Z]:)?\//.test(gitDir)) gitDir = `${dir}/${gitDir}`
379 }
380 const head = ((await $.fs.read(`${gitDir}/HEAD`)) as string).trim()
381 let commonDir = gitDir
382 if (await $.fs.exists(`${gitDir}/commondir`)) {
383 const common = ((await $.fs.read(`${gitDir}/commondir`)) as string).trim().replace(/\\/g, '/')
384 commonDir = resolveDots(/^([a-zA-Z]:)?\//.test(common) ? common : `${gitDir}/${common}`)
385 }
386
387 return {
388 branch: head.startsWith('ref: refs/heads/') ? head.slice(16) : '',
389 commonDir,
390 root: dir,
391 isWorktree: stat.kind === 'file',
392 }
393 }
394 const parent = dir.replace(/\/[^/]+$/, '')
395 if (parent === dir) break
396 dir = parent
397 }
398 } catch {
399 // Not a repository: no rows, since no item can be tied to it.
400 }
401
402 return undefined
403}
404
405// Whether the branch exists in this repository, loose or packed; items from other repos fail it.
406async function hasBranch($: EngineInterface, repo: Repo, branch: string, packed: string): Promise<boolean> {
407 if (!branch) return false
408 if (packed.includes(` refs/heads/${branch}\n`)) return true
409
410 return $.fs.exists(`${repo.commonDir}/refs/heads/${branch}`)
411}
412
413function refresh($: EngineInterface): Promise<void> {
414 if (running) {
415 queued ??= running.then(() => {
416 queued = null
417
418 return refresh($)
419 })
420
421 return queued
422 }
423 running = refreshNow($).finally(() => {
424 running = null
425 })
426
427 return running
428}
429
430async function refreshNow($: EngineInterface) {
431 try {
432 const dir = `${await homeDir($)}/.claude/dotnet-workflow-kit/pipeline`
433 const [entries, repo, now] = await Promise.all([
434 $.fs.exists(dir).then(has => (has ? $.fs.list(dir) : [])),
435 currentRepo($),
436 $.clock.now(),
437 ])
438 const branch = repo?.branch ?? ''
439 const packed = repo && (await $.fs.exists(`${repo.commonDir}/packed-refs`))
440 ? `${await $.fs.read(`${repo.commonDir}/packed-refs`)}\n`
441 : ''
442
443 const found: { row: PipelineRow; mtime: number; branch: string }[] = []
444 // Every branch some file names, closed or not, so a branch is adopted only when none does.
445 const named = new Set<string>()
446 for (const entry of entries) {
447 const name = entry.name as string
448 if (!isStateFile(entry)) continue
449 try {
450 let hit = cache.get(name)
451 if (!hit || hit.mtime !== entry.mtimeMs) {
452 hit = { mtime: entry.mtimeMs, data: JSON.parse(await $.fs.read(`${dir}/${name}`)) as StateFile }
453 cache.set(name, hit)
454 }
455 const data = hit.data
456 if (data?.branch) named.add(data.branch)
457 if (!data?.stages || Object.keys(data.stages).length === 0) continue
458 if (data.closed && now - Date.parse(data.closed.at) > REMOVE_MS) continue
459 const row = toRow(name.slice(0, -5), data, branch)
460 const isRecent = now - entry.mtimeMs < RECENT_MS
461 // Other items show only when recent and on a branch of this same repository.
462 const isHere =
463 row.isCurrentBranch || (isRecent && !!repo && (await hasBranch($, repo, data.branch ?? '', packed)))
464 if (isHere) found.push({ row, mtime: entry.mtimeMs, branch: data.branch ?? '' })
465 } catch {
466 // A half-written or foreign file: skip it this round.
467 }
468 }
469
470 if (repo && !named.has(repo.branch) && (await adopt($, dir, repo))) return
471
472 // The cap below must never push a live item out for a finished one, so unfinished rows sort
473 // ahead of complete ones; the viewing session's own row always stays first.
474 found.sort(
475 (a, b) =>
476 Number(b.row.isCurrentBranch) - Number(a.row.isCurrentBranch) ||
477 Number(isComplete(a.row)) - Number(isComplete(b.row)) ||
478 b.mtime - a.mtime,
479 )
480 // Two files for one branch (keyed differently by two writers) are one item: keep the newest.
481 const seen = new Set<string>()
482 const unique = found.filter(f => !f.branch || (!seen.has(f.branch) && !!seen.add(f.branch)))
483 const next = unique.slice(0, MAX_ROWS).map(f => f.row)
484
485 // Every session runs this module, so each toasts only its own item's stages; another item's
486 // gate toasts only when the person turned that on in the Sessions pane.
487 const shouldNotifyOthers = await read($, notifyOthers)
488 const done: Record<string, boolean[]> = {}
489 const waiting: Record<string, boolean> = {}
490 for (const row of next) {
491 done[row.slug] = row.statuses.map(s => s === 'done')
492 waiting[row.slug] = isWaiting(row)
493 const before = lastDone?.[row.slug]
494 if (row.isCurrentBranch && before) {
495 row.statuses.forEach((s, i) => {
496 if (s === 'done' && !before[i]) $.ui.toast(`${row.ticket || row.title}: ${row.labels[i]} done`)
497 })
498 }
499 const isNewGate = !!lastWaiting && waiting[row.slug] && !lastWaiting[row.slug]
500 if (!row.isCurrentBranch && shouldNotifyOthers && isNewGate) {
501 $.ui.toast(`${rowName(row)}: ${row.detail || 'waiting on you'}`)
502 }
503 }
504 lastDone = done
505 lastWaiting = waiting
506
507 await setGoals($, next, Object.fromEntries(found.map(f => [f.row.slug, f.mtime])))
508
509 const json = JSON.stringify(next)
510 if (json !== lastJson) {
511 lastJson = json
512 await update($, rows, () => next)
513 }
514 } catch (err) {
515 $.ui.log(`dotnet-workflow-kit: ${String(err)}`)
516 }
517}
518
519// The branches a team works from, per repository root; their sessions are not work items.
520const bases = new Map<string, string[]>()
521
522async function baseBranches($: EngineInterface, repo: Repo): Promise<string[]> {
523 const known = bases.get(repo.root)
524 if (known) return known
525 const found = ['main', 'master']
526 for (const path of [`${repo.root}/.claude/dotnet-workflow-kit.json`, `${await homeDir($)}/.claude/dotnet-workflow-kit.json`]) {
527 try {
528 if (!(await $.fs.exists(path))) continue
529 const base = (JSON.parse(await $.fs.read(path)) as { base_branch?: unknown }).base_branch
530 if (typeof base === 'string' && base) found.push(base)
531 break
532 } catch {
533 // An unreadable profile leaves the defaults.
534 }
535 }
536 bases.set(repo.root, found)
537
538 return found
539}
540
541// feat/391-foo -> feat-391-foo: the file name `/next` keys a branch with no ticket id by. A
542// "-checks" in it becomes "_checks", since refresh skips files named like a stage's checks.
543const branchSlug = (branch: string) =>
544 branch
545 .replace(/[^A-Za-z0-9._-]+/g, '-')
546 .replace(/^-+|-+$/g, '')
547 .replace(/-checks/g, '_checks')
548
549// Writes a state file for a branch no skill has written one for, with Start done; the skills
550// take it over on their first run. Resolves to whether a file was written.
551async function adopt($: EngineInterface, dir: string, repo: Repo): Promise<boolean> {
552 if (!repo.branch || (await baseBranches($, repo)).includes(repo.branch)) return false
553 const slug = branchSlug(repo.branch)
554 const path = `${dir}/${slug}.json`
555 // A file already there is one refresh could not read yet, such as a skill's half-written one.
556 if (!slug || (await $.fs.exists(path))) return false
557 const at = new Date(await $.clock.now()).toISOString().replace(/\.\d{3}Z$/, 'Z')
558 const data: StateFile = {
559 adopted: true,
560 branch: repo.branch,
561 repo: repo.commonDir,
562 ...(repo.isWorktree ? { worktree: repo.root } : {}),
563 current: { detail: ADOPTED_DETAIL },
564 stages: { start: { done: true, at } },
565 }
566 await $.fs.write(path, `${JSON.stringify(data, null, 2)}
567`)
568 // The next refresh reads the new file; refresh is idle again by the time this timer fires.
569 $.clock.after(50, () => void refresh($))
570
571 return true
572}
573
574// Rewrites the current branch's adopted file when it is older than TOUCH_MS, so other sessions
575// keep listing it and the closing script does not count a working branch as idle.
576async function touchAdopted($: EngineInterface) {
577 const current = (await read($, rows)).find(row => row.isCurrentBranch)
578 if (!current) return
579 const path = `${await homeDir($)}/.claude/dotnet-workflow-kit/pipeline/${current.slug}.json`
580 try {
581 const [stat, now] = await Promise.all([$.fs.stat(path), $.clock.now()])
582 if (now - stat.mtimeMs < TOUCH_MS) return
583 const data = JSON.parse(await $.fs.read(path)) as StateFile
584 if (data.adopted !== true || data.closed) return
585 await $.fs.write(path, `${JSON.stringify(data, null, 2)}
586`)
587 } catch {
588 // Gone or half written: the next turn tries again.
589 }
590}
591
592let isClosing = false
593
594// Runs scripts/close_items.py for this repository: closes merged, closed and archived items
595// and deletes those closed over a day ago. A missing Python or a failed run only logs.
596async function closeItems($: EngineInterface) {
597 if (isClosing) return
598 isClosing = true
599 try {
600 const repo = await currentRepo($)
601 if (!repo) return
602 const script = `${$.plugin.root.replace(/\\/g, '/')}/scripts/close_items.py`
603 const dir = `${await homeDir($)}/.claude/dotnet-workflow-kit/pipeline`
604 for (const python of ['python', 'python3']) {
605 try {
606 const result = await $.process.run([python, script, '--repo', repo.commonDir, '--dir', dir], { timeoutMs: 300000 })
607 if (result.exitCode !== 0) $.ui.log(`dotnet-workflow-kit: close_items: ${result.stderr.trim()}`)
608 for (const line of result.stdout.split('\n').filter(Boolean)) $.ui.toast(line)
609 break
610 } catch {
611 // This name is not on PATH; try the next.
612 }
613 }
614 await refresh($)
615 } finally {
616 isClosing = false
617 }
618}
619
620// `/progress done`: closes the current branch's item by hand, for work that ends without a PR.
621async function closeCurrent($: EngineInterface): Promise<string> {
622 const current = (await read($, rows)).find(row => row.isCurrentBranch)
623 if (!current) return 'No pipeline item for this branch.'
624 const path = `${await homeDir($)}/.claude/dotnet-workflow-kit/pipeline/${current.slug}.json`
625 let data: StateFile
626 try {
627 data = JSON.parse(await $.fs.read(path)) as StateFile
628 } catch {
629 return `Could not read ${current.slug}.json; nothing was changed.`
630 }
631 if (!data.closed) {
632 data.closed = { reason: 'manual', at: new Date(await $.clock.now()).toISOString().replace(/\.\d{3}Z$/, 'Z') }
633 await $.fs.write(path, `${JSON.stringify(data, null, 2)}\n`)
634 }
635 await refresh($)
636
637 return `${current.ticket || current.title} is done; its row goes in a day.`
638}
639
640const STAGE_TOOL = 'mcp__dotnet-workflow-kit__stage'
641
642type StageInput = {
643 stage?: string
644 fields?: Record<string, unknown>
645 current?: StateFile['current']
646 item?: Pick<StateFile, 'ticket' | 'title' | 'shortTitle' | 'order'>
647}
648
649const isoNow = async ($: EngineInterface) => new Date(await $.clock.now()).toISOString().replace(/\.\d{3}Z$/, 'Z')
650
651// The file for this branch: the one whose `branch` names it, whatever it is called, else a new
652// one keyed by the ticket id, else by the branch, as /next keys it.
653// The folder is shared by every repository, so a file is this item's only when its branch and
654// repository match and it is still open; of several, the newest, as refresh shows.
655async function stateFileFor($: EngineInterface, dir: string, repo: Repo, ticket?: string): Promise<string> {
656 const entries = (await $.fs.exists(dir)) ? await $.fs.list(dir) : []
657 const sameRepo = (path: string | undefined) => !path || samePath(path, repo.commonDir)
658 const taken = new Set<string>()
659 let best: { name: string; mtime: number } | undefined
660 for (const entry of entries) {
661 const name = entry.name as string
662 if (!isStateFile(entry)) continue
663 taken.add(name)
664 try {
665 const data = JSON.parse(await $.fs.read(`${dir}/${name}`)) as StateFile
666 const isMine = data.branch === repo.branch && sameRepo(data.repo) && !data.closed
667 if (isMine && (!best || entry.mtimeMs > best.mtime)) best = { name, mtime: entry.mtimeMs }
668 } catch {
669 // Unreadable: not this branch's file as far as anyone can tell.
670 }
671 }
672 if (best) return `${dir}/${best.name}`
673
674 // A new file never reuses the name of another repository's or a closed item's.
675 const slug = branchSlug(ticketId(ticket).replace(/^#/, '') || repo.branch)
676 let name = `${slug}.json`
677 for (let n = 2; taken.has(name); n++) name = `${slug}-${n}.json`
678
679 return `${dir}/${name}`
680}
681
682// Git and the skills spell one path with either slash and either case on Windows.
683const pathKey = (path: string) => resolveDots(path.replace(/\\/g, '/')).replace(/\/+$/, '').toLowerCase()
684const samePath = (a: string, b: string) => pathKey(a) === pathKey(b)
685
686// Stage calls run one at a time, so two in flight never read the same file and drop a write.
687let writing: Promise<unknown> = Promise.resolve()
688
689const writeStage = ($: EngineInterface, input: StageInput): Promise<string> => {
690 const next = writing.then(() => writeStageNow($, input))
691 writing = next.catch(() => undefined)
692
693 return next
694}
695
696// The stage tool: merges what a skill recorded into this branch's state file and redraws the bar.
697async function writeStageNow($: EngineInterface, input: StageInput): Promise<string> {
698 const repo = await currentRepo($)
699 if (!repo?.branch) return 'Not on a branch of a git repository; nothing written.'
700 if ((await baseBranches($, repo)).includes(repo.branch)) return `On the base branch ${repo.branch}; nothing written.`
701 const dir = `${await homeDir($)}/.claude/dotnet-workflow-kit/pipeline`
702 const path = await stateFileFor($, dir, repo, input.item?.ticket)
703 const name = basename(path)
704 let data: StateFile = {}
705 if (await $.fs.exists(path)) {
706 try {
707 data = JSON.parse(await $.fs.read(path)) as StateFile
708 } catch {
709 return `Could not parse ${name}; nothing changed.`
710 }
711 }
712
713 const at = await isoNow($)
714 delete data.adopted
715 data.branch = repo.branch
716 data.repo ??= repo.commonDir
717 if (repo.isWorktree) data.worktree ??= repo.root
718 for (const key of ['ticket', 'title', 'shortTitle', 'order'] as const) {
719 if (input.item?.[key] !== undefined) Object.assign(data, { [key]: input.item[key] })
720 }
721 if (input.current) data.current = { ...data.current, ...input.current }
722 if (input.stage) {
723 const key = input.stage === 'pull_request' ? 'pullRequest' : input.stage
724 const stages = (data.stages ??= {})
725 const before = stages[key] ?? {}
726 const after: Stage & Record<string, unknown> = { ...before, ...input.fields }
727 if (after.done === true && input.fields?.at === undefined && !(before.done && before.at)) after.at = at
728 stages[key] = after
729 }
730 await $.fs.write(path, `${JSON.stringify(data, null, 2)}
731`)
732 await refresh($)
733
734 const row = (await read($, rows)).find(one => one.isCurrentBranch)
735 return row ? `Wrote ${name}: ${stageLabel(row)}${row.detail ? `, ${row.detail}` : ''}` : `Wrote ${name}.`
736}
737
738// --- Aspire ---------------------------------------------------------------------------------
739
740let isScanning = false
741let lastQuietScan = 0
742// Whether this session ran a command that started an AppHost; until then a quiet machine is scanned slowly.
743let hasStarted = false
744let runsAspire: boolean | undefined
745let lastAspire: AspireEntry[] | null = null
746let pythonName: string | undefined
747
748const aspireDir = async ($: EngineInterface) => `${await homeDir($)}/.claude/dotnet-workflow-kit/aspire`
749const ownerName = (entry: AspireEntry) => entry.label || entry.branch || 'another session'
750const portsOf = (entry: AspireEntry) => [...new Set([...entry.ports, ...entry.launchPorts])].sort((a, b) => a - b)
751const portList = (entry: AspireEntry) => portsOf(entry).map(port => `:${port}`).join(' ')
752const dashboardPort = (entry: AspireEntry) => /:(\d+)/.exec(entry.dashboard.replace(/^[a-z]+:\/\//i, ''))?.[1]
753
754// Whether the profile says the system runs through Aspire: the project's profile, else the personal one.
755async function profileRunsAspire($: EngineInterface): Promise<boolean> {
756 if (runsAspire !== undefined) return runsAspire
757 runsAspire = false
758 const repo = await currentRepo($)
759 const paths = [...(repo ? [`${repo.root}/.claude/dotnet-workflow-kit.json`] : []), `${await homeDir($)}/.claude/dotnet-workflow-kit.json`]
760 for (const path of paths) {
761 try {
762 if (!(await $.fs.exists(path))) continue
763 const profile = JSON.parse(await $.fs.read(path)) as { stack?: { local_run?: unknown } }
764 runsAspire = profile.stack?.local_run === 'aspire'
765 break
766 } catch {
767 // An unreadable profile leaves Aspire off.
768 }
769 }
770
771 return runsAspire
772}
773
774// Whether any session has an AppHost in the registry, live or not yet cleared away.
775async function isListed($: EngineInterface): Promise<boolean> {
776 const dir = await aspireDir($)
777 if (!(await $.fs.exists(dir))) return false
778
779 return (await $.fs.list(dir)).some(entry => entry.kind === 'file' && String(entry.name).endsWith('.json'))
780}
781
782type AspireResult = { entries: AspireEntry[]; deny?: string; starts?: string }
783
784// Runs scripts/aspire_sessions.py as this session: its id, worktree, branch and item name.
785async function runAspire($: EngineInterface, action: 'scan' | 'check', extra: string[] = []): Promise<AspireResult | undefined> {
786 const repo = await currentRepo($)
787 const current = (await read($, rows)).find(row => row.isCurrentBranch)
788 const script = `${$.plugin.root.replace(/\\/g, '/')}/scripts/aspire_sessions.py`
789 const args = [
790 script, action,
791 '--dir', await aspireDir($),
792 '--session', await $.session.id(),
793 '--root', repo?.root ?? '',
794 '--repo', repo?.commonDir ?? '',
795 '--branch', repo?.branch ?? '',
796 '--label', current ? rowName(current) : (repo?.branch ?? ''),
797 ...extra,
798 ]
799 for (const python of pythonName ? [pythonName] : ['python', 'python3']) {
800 try {
801 const result = await $.process.run([python, ...args], { timeoutMs: 60000 })
802 if (result.exitCode !== 0) {
803 // A name that ran the script and failed is the right Python; a stub that is not goes on to the next.
804 if (pythonName || result.stderr.includes('aspire_sessions')) {
805 $.ui.log(`dotnet-workflow-kit: aspire_sessions: ${result.stderr.trim()}`)
806 return undefined
807 }
808 continue
809 }
810 pythonName = python
811
812 return JSON.parse(result.stdout) as AspireResult
813 } catch {
814 // This name is not on PATH, or printed no JSON; try the next.
815 }
816 }
817
818 return undefined
819}
820
821// Stores a scan's entries, with a toast when another session's AppHost goes and when this one's starts.
822async function applyAspire($: EngineInterface, entries: AspireEntry[]) {
823 const before = lastAspire
824 lastAspire = entries
825 if (before) {
826 const live = new Set(entries.map(entry => entry.pid))
827 for (const gone of before.filter(entry => !entry.isMine && !live.has(entry.pid))) {
828 const free = portList(gone)
829 $.ui.toast(`${ownerName(gone)} stopped ${gone.project}${free ? ` · ${free} free` : ''}`)
830 }
831 const had = new Set(before.filter(entry => entry.isMine).map(entry => entry.pid))
832 for (const fresh of entries.filter(entry => entry.isMine && !had.has(entry.pid))) {
833 $.ui.toast(`${fresh.project} is this session's${fresh.dashboard ? `: dashboard ${fresh.dashboard}` : ''}`)
834 }
835 }
836 // seenAt moves on every scan; only a change worth drawing updates the atom.
837 const key = (list: AspireEntry[]) => JSON.stringify(list.map(({ seenAt, ...rest }) => rest))
838 if (key(entries) !== key(await read($, aspire))) await update($, aspire, () => entries)
839}
840
841async function scanAspire($: EngineInterface) {
842 if (isScanning) return
843 isScanning = true
844 try {
845 // An owner rescans often, so its entries never look abandoned; any other session looks now and
846 // then, since a check scans afresh before judging a command anyway.
847 const isOwner = hasStarted || (await read($, aspire)).some(entry => entry.isMine)
848 if (!isOwner) {
849 // Nothing listed and no profile running Aspire: nothing to show or protect.
850 if (!(await isListed($)) && !(await profileRunsAspire($))) {
851 if ((await read($, aspire)).length > 0) await applyAspire($, [])
852 return
853 }
854 const now = await $.clock.now()
855 if (now - lastQuietScan < QUIET_MS) return
856 lastQuietScan = now
857 }
858 const result = await runAspire($, 'scan')
859 if (result) await applyAspire($, result.entries)
860 } catch (err) {
861 $.ui.log(`dotnet-workflow-kit: aspire: ${String(err)}`)
862 } finally {
863 isScanning = false
864 }
865}
866
867// Why a command must not run, as scripts/aspire_sessions.py judges it; undefined lets it through.
868async function checkAspire($: EngineInterface, command: string): Promise<string | undefined> {
869 const mayStart = /\b(run|watch|start)\b/i.test(command)
870 if (!mayStart && !(await isListed($))) return undefined
871 const result = await runAspire($, 'check', ['--cwd', await $.session.cwd(), '--command', command])
872 if (!result) return undefined
873 await applyAspire($, result.entries)
874 if (result.starts) {
875 hasStarted = true
876 for (const ms of START_SCANS_MS) $.clock.after(ms, () => void scanAspire($))
877 }
878
879 return result.deny
880}
881
882// What Claude is told about the AppHosts on this machine; empty when none run.
883function aspirePrompt(entries: AspireEntry[]): string {
884 const mine = entries.filter(entry => entry.isMine)
885 const others = entries.filter(entry => !entry.isMine && !entry.isStale)
886 if (mine.length === 0 && others.length === 0) return ''
887 const line = (entry: AspireEntry) =>
888 `- ${entry.project} · pid ${entry.pid}${entry.dashboard ? ` · dashboard ${entry.dashboard}` : ''}` +
889 `${portsOf(entry).length ? ` · ports ${portsOf(entry).join(' ')}` : ''}`
890
891 return [
892 '# Aspire on this machine',
893 'The dotnet-workflow-kit tracks which Claude session owns each running Aspire AppHost.',
894 'Yours:',
895 ...(mine.length ? mine.map(line) : ['- none running']),
896 ...(others.length
897 ? [
898 "Other sessions':",
899 ...others.map(entry => `${line(entry)} · ${ownerName(entry)}`),
900 "Never stop, restart or reuse another session's AppHost or its ports: commands that would are refused. " +
901 'Start yours on ports nobody else holds. To have one stopped, ask the person or message its session.',
902 ]
903 : []),
904 ].join('\n')
905}
906
907// The Sessions pane's "Ask its session to stop it": a message to the session that owns the AppHost.
908async function askToStop($: EngineInterface, entry: AspireEntry) {
909 try {
910 const sent = await $.session.send({
911 to: { sessionId: entry.session },
912 text:
913 `The person asked, from another session's Sessions pane, for ${entry.project} (pid ${entry.pid}) to be ` +
914 'stopped so its ports are free. Stop it if your work allows, and say so.',
915 })
916 $.ui.toast(sent.isDelivered ? `Asked ${ownerName(entry)} to stop ${entry.project}` : `Could not reach that session: ${sent.reason}`)
917 } catch (err) {
918 $.ui.toast(`Could not reach that session: ${String(err)}`)
919 }
920}
921
922// A session that ends leaves its AppHosts' entries marked as gone, for a session in the same worktree to take.
923async function endAspire($: EngineInterface) {
924 const dir = await aspireDir($)
925 for (const entry of (await read($, aspire)).filter(one => one.isMine)) {
926 try {
927 const path = `${dir}/${entry.pid}.json`
928 const data = JSON.parse(await $.fs.read(path)) as AspireEntry
929 if (data.session === entry.session) await $.fs.write(path, `${JSON.stringify({ ...data, seenAt: 0 }, null, 2)}\n`)
930 } catch {
931 // Gone already.
932 }
933 }
934}
935
936export const register: Register = on => {
937 on('session.start', async ($, e, next) => {
938 watchingSince = await $.clock.now()
939 await $.command.register({
940 name: 'progress',
941 description: 'Show or hide the workflow progress bar; "done" closes this branch\'s item',
942 })
943 await $.tool.register({
944 name: 'stage',
945 description:
946 "Record the dotnet-workflow-kit pipeline state for this branch: the progress bar's state file. " +
947 'Pass `stage` with `fields` to merge into stages.<stage> (done, artifactUrl, decision, note, waiting, ...; ' +
948 '`at` is filled when done is true), `current` for what the bar shows now, and `item` (ticket, title, ' +
949 'shortTitle, order) when the item starts. Fields left out keep their value. Finds or creates the file itself.',
950 inputSchema: {
951 type: 'object',
952 properties: {
953 stage: { type: 'string', description: 'Stage id: start, plan, implement, sweep, test, review, pull_request or a profile extra stage.' },
954 fields: { type: 'object', description: 'Keys merged into stages.<stage>.' },
955 current: {
956 type: 'object',
957 properties: { stage: { type: 'string' }, detail: { type: 'string' }, blocked: { type: 'boolean' } },
958 },
959 item: {
960 type: 'object',
961 properties: {
962 ticket: { type: 'string' },
963 title: { type: 'string' },
964 shortTitle: { type: 'string', description: 'At most four words.' },
965 order: { type: 'array', items: {}, description: 'Stage ids, or {id, label}, in pipeline order.' },
966 },
967 },
968 },
969 },
970 })
971 await $.command.register({
972 name: 'sessions',
973 description: 'Show or hide the pane listing every work item in this repository',
974 })
975 await refresh($)
976 $.clock.every(POLL_MS, () => void refresh($))
977 $.clock.after(1000, () => void closeItems($))
978 $.clock.every(CLOSE_MS, () => void closeItems($))
979 // The first prompt is composed right after this, so the AppHosts are looked up first, briefly.
980 await Promise.race([scanAspire($), $.clock.sleep(3000)])
981 $.clock.every(ASPIRE_MS, () => void scanAspire($))
982
983 return next(e)
984 })
985
986 on('session.end', async ($, e, next) => {
987 await endAspire($)
988
989 return next(e)
990 })
991
992 // The AppHosts on this machine and whose they are, last in the prompt, while any run.
993 on('prompt.compose', async ($, e, next) => {
994 const result = await next(e)
995 const text = aspirePrompt(await read($, aspire))
996 if (!text) return result
997
998 return { sections: [...result.sections, { id: 'dotnet-workflow-kit:aspire', text, scope: 'session' as const }] }
999 })
1000
1001 on('command.run', { command: 'progress' }, async ($, e) => {
1002 if (e.args.trim() === 'done') return { text: await closeCurrent($) }
1003 const hidden = await update($, isHidden, h => !h)
1004 await refresh($)
1005
1006 return { text: hidden ? 'Workflow progress bar hidden.' : 'Workflow progress bar shown.' }
1007 })
1008
1009 on('command.run', { command: 'sessions' }, async $ => {
1010 const isOpen = await toggleSessions($)
1011
1012 return { text: isOpen ? 'Sessions pane opened.' : 'Sessions pane closed.' }
1013 })
1014
1015 on('tool.call', { tool: STAGE_TOOL }, async ($, e) => ({
1016 result: await writeStage($, e as unknown as StageInput).catch(err => `Could not write the state file: ${String(err)}`),
1017 }))
1018
1019 on('tool.call', async ($, e, next) => {
1020 const input = e as unknown as Record<string, unknown>
1021 // A subagent's calls are its own: the band names the subagent, not what it is reading.
1022 const isSubagent = e.agentId !== undefined
1023 const text = isSubagent ? undefined : describe(input)
1024 if (text) {
1025 const now = await $.clock.now()
1026 await update($, activity, (): Activity => ({ text: clip(text), at: now }))
1027 }
1028 // A shell command that stops processes or starts an AppHost is judged against the other sessions' first.
1029 const command =
1030 (input.tool === 'Bash' || input.tool === 'PowerShell') && typeof input.command === 'string' ? input.command : ''
1031 const isAspire = !!command && ASPIRE_COMMAND.test(command)
1032 if (isAspire) {
1033 // A failed check never holds the command up; the deny is a guard, not a gate.
1034 const deny = await checkAspire($, command).catch(err => void $.ui.log(`dotnet-workflow-kit: aspire: ${String(err)}`))
1035 if (deny) return { deny }
1036 }
1037 const result = await next(e)
1038 if (!isSubagent) void refresh($)
1039 if (isAspire) $.clock.after(2000, () => void scanAspire($))
1040
1041 return result
1042 })
1043
1044 // While /next is blocked, a goal re-prompt would only repeat the blocker; skip the goal's
1045 // Stop hook so the goal stays set but quiet until the person answers.
1046 on('classic.Stop', async ($, e, next) => {
1047 const pending = (e.background_tasks ?? []).filter(t => t.status === 'running' || t.status === 'pending')
1048 await update($, background, () => pending.map(t => clip(t.description || t.command || t.type)))
1049 await refresh($)
1050 const current = (await read($, rows)).find(row => row.isCurrentBranch)
1051 if (current?.isBlocked) return {}
1052
1053 return next(e)
1054 })
1055
1056 on('agent.spawn', async ($, e, next) => {
1057 const started = await next(e)
1058 const id = started.deny === undefined ? started.agentId : undefined
1059 if (id) {
1060 const at = await $.clock.now()
1061 await update($, agents, list => [...list.filter(a => a.id !== id), { id, description: e.description, at }]).catch(
1062 err => $.ui.log(`dotnet-workflow-kit: ${String(err)}`),
1063 )
1064 }
1065
1066 return started
1067 })
1068
1069 on('turn.complete', async ($, e, next) => {
1070 const agentId = e.agentId
1071 if (agentId === undefined) await update($, activity, () => null)
1072 else await update($, agents, list => list.filter(a => a.id !== agentId))
1073 await refresh($)
1074 await touchAdopted($)
1075
1076 return next(e)
1077 })
1078
1079 // The band shows only this session's item; a chip counts the others and opens the Sessions pane.
1080 on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
1081 const hiddenSlugs = await read($, dismissed)
1082 const all = (await read($, rows)).filter(one => !hiddenSlugs.includes(one.slug))
1083 const row = all.find(one => one.isCurrentBranch)
1084 const others = all.filter(one => !one.isCurrentBranch && !isComplete(one))
1085 const othersWaiting = others.filter(isWaiting).length
1086 if (e.props.hasSurvey || (!row && others.length === 0) || (await read($, isHidden))) {
1087 return next(e)
1088 }
1089
1090 // The row shows live tool activity while Claude works, otherwise the file's detail.
1091 const live = await read($, activity)
1092 const tasks = e.props.isWorking ? [] : await read($, background)
1093 const isBusy = e.props.isWorking || tasks.length > 0
1094 // An agent that never reports its end (a remote one, a killed one) stops counting after an hour.
1095 const now = await $.clock.now()
1096 const running = (await read($, agents)).filter(a => now - a.at < AGENT_MS).length
1097 const crew = running === 0 ? '' : ` · ${running} ${running === 1 ? 'agent' : 'agents'} running`
1098 // A finished item says how it ended; this session's own shells and agents are not its news.
1099 const doing = (one: PipelineRow) =>
1100 isWaiting(one) || isComplete(one)
1101 ? one.detail
1102 : e.props.isWorking && live
1103 ? `${live.text}${crew}`
1104 : tasks.length > 0
1105 ? `Waiting on ${tasks.length === 1 ? tasks[0] : `${tasks.length} background tasks`}`
1106 : one.detail
1107 const chipLabel =
1108 others.length === 0 ? '' : othersWaiting > 0 ? `+${others.length} · ${othersWaiting} needs you` : `+${others.length}`
1109 const openPane = () => void toggleSessions($)
1110 // This session's own AppHost, by its dashboard port.
1111 const host = (await read($, aspire)).find(one => one.isMine)
1112 const hostPort = host ? dashboardPort(host) ?? host.ports[0] : undefined
1113 const hostLabel = host ? `Aspire${hostPort ? ` :${hostPort}` : ''}` : ''
1114
1115 if (e.surface === 'terminal') {
1116 const { Box, Text, Button } = $.ui.resolve(e)
1117 const cols = e.props.bodyColumns
1118 const chip = chipLabel ? (
1119 <Box flexShrink={0} gap={1}>
1120 {othersWaiting > 0 ? <Text color={COLOR.waiting}>●</Text> : null}
1121 <Button key="sessions-chip" label={chipLabel} plain dimColor={othersWaiting === 0} onPress={openPane} />
1122 </Box>
1123 ) : null
1124 if (!row) {
1125 return (
1126 <Box width={cols} justifyContent="flex-end">
1127 {chip}
1128 </Box>
1129 )
1130 }
1131
1132 const nameWidth = Math.max(10, Math.min(28, Math.floor(cols * 0.22)))
1133 const stageWidth = stageLabel(row).length
1134 const chipWidth = chipLabel ? chipLabel.length + 4 : 0
1135 const doingMin = cols >= 90 ? 24 : 0
1136 // A narrow terminal keeps the AppHost's mark and drops its label.
1137 const isHostLabelled = cols >= 90
1138 const hostWidth = host ? (isHostLabelled ? hostLabel.length + 3 : 2) : 0
1139 // dot, name, bar, stage, percent, AppHost, chip and their one-cell gaps, then the activity text.
1140 const room = cols - 2 - nameWidth - stageWidth - 4 - 5 - hostWidth - chipWidth - doingMin
1141 const segment = Math.max(1, Math.min(6, Math.floor(room / row.labels.length)))
1142
1143 return (
1144 <Box gap={1} width={cols}>
1145 <Box flexShrink={0}>
1146 <Text color={dotColor(row)}>●</Text>
1147 </Box>
1148 <Box width={nameWidth} flexShrink={0}>
1149 <Text wrap="truncate-end" bold>
1150 {rowName(row)}
1151 </Text>
1152 </Box>
1153 <Box width={segment * row.labels.length} flexShrink={0}>
1154 <Text wrap="truncate-end">
1155 {row.statuses.map(s => (
1156 <Text color={s === 'todo' ? COLOR.todo : COLOR[s]} dimColor={s === 'todo'}>
1157 {(s === 'todo' ? '░' : s === 'done' ? '█' : '▓').repeat(segment)}
1158 </Text>
1159 ))}
1160 </Text>
1161 </Box>
1162 <Box width={stageWidth} flexShrink={0}>
1163 <Text color={dotColor(row)} wrap="truncate-end">
1164 {stageLabel(row)}
1165 </Text>
1166 </Box>
1167 <Box width={4} flexShrink={0}>
1168 <Text dimColor>{String(pct(row)).padStart(3)}%</Text>
1169 </Box>
1170 {host ? (
1171 <Box flexShrink={0} gap={1}>
1172 <Text color={CARD.check}>◆</Text>
1173 {isHostLabelled ? <Text dimColor>{hostLabel}</Text> : null}
1174 </Box>
1175 ) : null}
1176 {doingMin > 0 && doing(row) ? (
1177 <Box flexGrow={1} flexShrink={1} minWidth={0}>
1178 <Text dimColor wrap="truncate-end">
1179 {doing(row)}
1180 </Text>
1181 </Box>
1182 ) : null}
1183 {chip}
1184 </Box>
1185 )
1186 }
1187
1188 const { Box, Text, Svg, Button } = $.ui.resolve(e)
1189 const chip = chipLabel ? (
1190 <Box flexDirection="row" alignItems="center" gap={1} flexShrink={0}>
1191 {othersWaiting > 0 ? <Text color={COLOR.waiting}>●</Text> : null}
1192 <Button key="sessions-chip" label={`${chipLabel} ›`} plain dimColor={othersWaiting === 0} onPress={openPane} />
1193 </Box>
1194 ) : null
1195 if (!row) {
1196 return (
1197 <Box flexDirection="row" justifyContent="flex-end">
1198 {chip}
1199 </Box>
1200 )types/index.d.ts 49 lines1export type Activity = { text: string; at: number }
2
3export type RunningAgent = { id: string; description: string; at: number }
4
5export type StageStatus = 'done' | 'active' | 'waiting' | 'todo'
6
7export type PipelineRow = {
8 slug: string
9 ticket: string
10 title: string
11 branch: string
12 isCurrentBranch: boolean
13 labels: string[]
14 isPlanApproved: boolean
15 isReviewApproved: boolean
16 isBlocked: boolean
17 statuses: StageStatus[]
18 doneCount: number
19 activeIndex: number
20 detail: string
21}
22
23// One running Aspire AppHost, as scripts/aspire_sessions.py reads the registry: the session
24// that owns it, the worktree it runs from, the processes it started and the ports they hold.
25export type AspireEntry = {
26 pid: number
27 project: string
28 projectDir: string
29 root: string
30 repo: string
31 branch: string
32 label: string
33 session: string
34 dashboard: string
35 ports: number[]
36 launchPorts: number[]
37 pids: number[]
38 firstSeen: number
39 seenAt: number
40 isMine: boolean
41 isStale: boolean
42}
43
44declare module 'claude-code' {
45 interface PluginState {
46 'dotnet-workflow-kit': { rows: PipelineRow[]; isHidden: boolean; dismissed: string[]; activity: Activity | null; background: string[]; goalsSet: Record<string, string[]>; notifyOthers: boolean; aspire: AspireEntry[]; agents: RunningAgent[] }
47 }
48}
49