SLOPSHOPPER

harness-fleet

The owner's interface to the plugin fleet: /fleet shows each owned plugin's installed and offered version, the repository's open PRs with their CI state and…

panecommandtoastprocess
v0.1.5no licenseupdated 2026-10-23cdeust/claude-mods/mods/harness-fleet
A shopper browsing a rack in a slop shop
Preview · a replayed session in a sandbox
claude · ~/work/app · harness-fleet
│ ┃ Fleet ✕ › fix the failing auth test and add an audit log call │ ┃ Harness fleet │ ┃ the owner's plugins and their repositories · ⏺ Read(src/auth.ts) │ ┃ every action starts with a button you press; ⎿ Read 6 lines │ ┃ the mod itself only reads ⏺ Update(src/auth.ts) │ ┃ ⎿ Added 2 lines, removed 1 line │ ┃ inventory: ENOENT: no such file ⏺ Bash(bun test) │ ┃ /Users/dev/.claude/plugins/installed_plugins ⎿ 3 pass, 1 fail │ ┃ .json │ ┃ ● Done. refresh now rejects expired claims and logs an audit event. │ ┃ LESSONS │ ┃ 0 guard refusals · 0 classifier errors · 0 ✻ Worked for 42s · done 4:20 PM │ ┃ stuck escalations · 0 results offloaded │ ┃ [ Draft issue ] › /fleet │ ┃ ⎿ harness-fleet: Harness fleet opened. │ ┃ [ Refreshing… ] remote: not read yet │ ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── › ? for shortcuts

Draws

Pane · Fleet
Harness fleet the owner's plugins and their repositories · every action starts with a button you press; the mod itself only reads inventory: ENOENT: no such file /Users/dev/.claude/plugins/installed_plugins.json LESSONS 0 guard refusals · 0 classifier errors · 0 stuck escalations · 0 results offloaded [ Draft issue ] [ Refreshing… ] remote: not read yet
README

claude-mods

Claude Code mods and a separate Codex adapter for the ai-architect.tools harness. The Claude mods keep one concern per mod, state shared through dependencies:

ModOwnsDepends on
cortex-guardrefusals: wiki pages only through wiki_write, worktrees inside <repo>/.claude/worktrees/nothing
cortex-wiki/wiki <wiki/**.md> to PDFnothing
zetetic-geniusstate: the request grade (task class → effort), the genius patterns and skills it matchesnothing
zetetic-autopilotcontext, policy, phases: effort ladder, model routing (a subagent's call, then its own definition, then its prompt's DESIGN block, never lowered by pressure), the dispatch table (hooks/dispatch-table.ts): an inheriting subagent nobody designed runs at the model and effort of its task's class, graded by one classifier completion (cls/review on each spawn record the table decided, absent before 0.11.0), an inheriting subagent's effort from the turn's grade when its call names a model but no effort (effort on each spawn record, absent before 0.10.0), the quota's cap on the main loop's parallel subagents, offloaded tool results; the phase each loop is in, on each run the steps a stuck escalation raised (escalated, absent before 0.8.0), and the advisor callszetetic-genius
zetetic-insightsinsights: the turn ledger across sessions ($.store), joined with /insights session outcomes and .zetetic/goals; per-phase effort proposals, `/calibrate apply\reset`, the calibration file the autopilot readszetetic-autopilot, zetetic-genius
mission-controlrenderer; the /mission pane: the turn's lanes by phase (bar height = effort, advisor calls, failed calls), effort per phase, learning curves per phase. Pixels in kitty or Ghostty outside tmux, coloured cells elsewherezetetic-autopilot, zetetic-insights
harness-fleetfleet: the owner's plugins, installed vs offered version, open PRs with CI, open issues (a defect is taken and fixed, a feature request goes to the owner); /fleet. Reads only (gh pr list, gh issue list, git remote): every outward action is a button the owner presses, which puts a prompt in front of the modelguard, genius, autopilot
superpowersthird-party skills library (obra/superpowers, MIT), pinned to v7.0.0 bb92a77: listed here so it installs with the mods; which skills we keep is decided after measurementnothing

Audience

Each output of a mod has one reader, and the engine fixes the reader by the API the output goes through (there is no per-call option): $.ui.toast, $.ui.log, $.ui.status, panes and rows are the user's, and the model never sees them; a tool.call result's context, a prompt.submit context and prompt.compose sections are Claude's, and the user never sees them; a deny is the model's tool error (the transcript draws it too). A text is written for its reader, and one string is never sent to both. The mods that send to both say which text is whose:

  • zetetic-autopilot: the user reads a toast when main implements (what main ran) and when a subagent spawn is refused (which spawn, how many run, the cap and the window: no instruction); Claude reads, in the context of main's first implementing tool result of a turn, the rule to delegate to a subagent, and, as the Agent tool's error, the cap refusal with the way out (wait for a running agent to finish, spawn again).
  • cortex-guard: the user reads a toast for each refusal, for a worktree that was not registered, and for a guard that failed; Claude reads the refusal's rule and fix as the tool's error (the same error when the guard itself failed), and, in the context of the result of its git worktree add, that the worktree was not registered and its cleanup is not covered.
  • harness-fleet: the user reads the /fleet pane and its toasts; Claude reads only what a button the user presses puts in front of it (review, take an issue, draft an issue), as "The harness-fleet plugin sent a message: ..." in the plugin's own voice: the owner is "the owner" in it, never "me" or "I".

Developing

Each mod is validated, tested and type-checked on its own:

cd mods/<mod> && claude plugin validate . && claude plugin test && npx -y -p typescript tsc -p . --noEmit

tsc needs the engine to have loaded the mod once (it lays .claude-plugin/types/); keep --noEmit, since a plain tsc -p . writes .js files beside the sources. For hot reload in a session, link the mod into that session's ~/.claude/dev-mods/<session>/ folder; the engine watches the folder a link names.

A mod cannot import a file from another mod (the engine refuses it: "outside the plugin's folder"), so the few small pure files several mods need are copied into each of them: hooks/paths.ts (where ~/ lands: HOME, else USERPROFILE, CLAUDE_CONFIG_DIR for ~/.claude) in five mods, and hooks/design.ts (the one parser of a prompt's DESIGN block) in zetetic-insights and zetetic-autopilot, each with its test. After editing one, copy it over the others; this fails when a copy differs:

sh scripts/check-shared.sh

Installing

.claude-plugin/marketplace.json lists each mod as "source": "./mods/<mod>", so the repository is the marketplace. From another machine:

/plugin install <mod> --marketplace cdeust/claude-mods

y adds the marketplace, then the user scope. On this machine a folder marketplace reads the mods from the checkout, with no copy: claude plugin marketplace add <this folder>, then /plugin install <mod> and /reload-plugins after an edit.

Without write access to settings.json

claude plugin marketplace add and claude plugin install both write enabledPlugins and extraKnownMarketplaces into settings.json. Where that file cannot be changed, load the mods by directory instead: nothing is written, and each mod is registered for the session as <name>@inline.

MODS=/path/to/claude-mods/mods

# repeat --plugin-dir once per mod
claude \
  --plugin-dir $MODS/cortex-guard \
  --plugin-dir $MODS/cortex-wiki \
  --plugin-dir $MODS/zetetic-genius \
  --plugin-dir $MODS/zetetic-autopilot \
  --plugin-dir $MODS/zetetic-insights \
  --plugin-dir $MODS/mission-control \
  --plugin-dir $MODS/harness-fleet

# or one variable, colon separated
CLAUDE_CODE_PLUGIN_DIRS=$MODS/cortex-guard:$MODS/cortex-wiki:$MODS/zetetic-genius:$MODS/zetetic-autopilot:$MODS/zetetic-insights:$MODS/mission-control:$MODS/harness-fleet claude

# an alias in the shell profile: it sets MODS itself, because the alias body is single-quoted and
# is expanded each time it runs, not when the profile is read
alias claude-mods='MODS=/path/to/claude-mods/mods; CLAUDE_CODE_PLUGIN_DIRS=$MODS/cortex-guard:$MODS/cortex-wiki:$MODS/zetetic-genius:$MODS/zetetic-autopilot:$MODS/zetetic-insights:$MODS/mission-control:$MODS/harness-fleet claude'

Which form to prefer: an interactive session may ask for a login when CLAUDE_CONFIG_DIR points at an empty directory (seen once in an isolated directory, where headless claude -p did not ask). On the machine's own configuration directory, which is already logged in, that does not apply; use the repeated --plugin-dir or the alias there, and keep an isolated CLAUDE_CONFIG_DIR for tests only.

claude plugin list shows them under "Session-only plugins" with Status: loaded.

What then must hold:

  • The dependencies of a mod are resolved among the mods loaded in the same command, so load a mod together with what it names: zetetic-autopilot needs zetetic-genius; harness-fleet needs cortex-guard, zetetic-autopilot and zetetic-genius. A mod whose dependency is absent is listed disabled, with the error Dependency "<name>" is not installed.
  • Options cannot be set (they live in settings.json under pluginConfigs), so every default in a plugin.json has to be right on any machine:
ModOptionDefaultNotes
cortex-guardhygiene_script~/Developments/disk-hygiene/disk_hygiene.py~/ is the home of the user running the session, read at runtime. When the file is not there, one toast per session says hygiene script not found at <path>; worktrees are not registered; an empty value disables the registration without a toast. A python3 that fails to start gets one toast naming the cause, and no further worktree is registered for the session (no retry)
zetetic-geniusmode, classifier_modelobserve, haikuthe grade is one low-effort completion on the haiku alias
zetetic-autopilotpolicy_mode, quota_pressure_percent, max_parallel_agents, offload_threshold_chars, offload_preview_charsenforce, 80, 5, 30000, 2000the cap counts and refuses only the main loop's own spawns (a fork of main included): a subagent's nested spawn, a workflow script's agent() and a teammate are neither refused nor counted. A result past the threshold is written whole to a file in the session's tool-results directory (the engine's cleanupPeriodDays sweeps it, 30 days by default; the mod deletes nothing); the model reads the preview, the path and the size
mission-controlrendererautoauto draws pixels in kitty or Ghostty outside tmux (TMUX, TERM, TERM_PROGRAM, KITTY_WINDOW_ID), cells elsewhere; cells or pixels forces one
harness-fleetgithub_owner, refresh_on_startcdeust, truereads gh pr list, gh issue list and git remote
  • The machine must let the mods do what they ask: python3 (guard), gh and a route to api.github.com (fleet), the files under ~/.claude/plugins/ (fleet), pandoc and xelatex (wiki), and the model aliases (genius, autopilot).

Measured, on one Mac (Claude Code 2.1.293, no company sandbox): with a pristine settings.json holding {} and an isolated CLAUDE_CONFIG_DIR, loading the mods by CLAUDE_CODE_PLUGIN_DIRS lists them as loaded and leaves settings.json at {}; zetetic-autopilot loaded alone is disabled with the dependency error above.

Not measured: the managed-settings lock itself (it could not be reproduced), whether a company policy accepts --plugin-dir, any refusal of a real sandbox (blocked network, denied exec, unreadable ~/.claude), the model aliases, and whether /config lists the options of directory-loaded mods in an interactive session.

Source 5 files
hooks/register.tsx 257 lines
1import { atom, read, update } from 'claude-code'
2import type { EngineInterface, Register } from 'claude-code'
3
4import type { FleetState, IssueRow, PrRow, RepoRow } from '../types'
5import { placePath } from './paths'
6import {
7  INSTALLED_PLUGINS_PATH,
8  KNOWN_MARKETPLACES_PATH,
9  MARKETPLACE_MANIFEST,
10  type Lessons,
11  draftIssuePrompt,
12  fleetRows,
13  type ManifestRead,
14  PR_LIMIT,
15  issueListArgv,
16  parseInstalled,
17  parseIssues,
18  parseMarketplaces,
19  parseOffered,
20  parsePrCount,
21  parsePrList,
22  prCountArgv,
23  prListArgv,
24  remoteArgv,
25  repoOfRemote,
26  reviewPrompt,
27  takeIssuePrompt,
28} from './fleet'
29import { FleetView } from './fleetview'
30
31const PANE = 'harness-fleet'
32const REASON_CAP = 120 // source: the cut the pane already applied to a gh error line
33const why = (error: unknown): string => (error instanceof Error ? error.message : String(error)).slice(0, 140)
34const GH_TIMEOUT_MS = 20_000 // source: own choice, gh answers in 1–3 s; a stalled call must not hold the pane
35
36const fleet = atom({ plugin: 'harness-fleet', key: 'fleet' } as const, {
37  repos: [],
38  inventoryError: null,
39  isRefreshing: false,
40  readAt: null,
41} as FleetState)
42
43// The signals the LESSONS section counts come from the other mods' state (dependencies); read only.
44const GUARD_REFUSALS = { plugin: 'cortex-guard', key: 'refusals' } as const
45const GENIUS_STATE = { plugin: 'zetetic-genius', key: 'state' } as const
46const AUTOPILOT_POLICY = { plugin: 'zetetic-autopilot', key: 'policy' } as const
47
48// Where a `~/` path lands on this machine: HOME, else USERPROFILE, and CLAUDE_CONFIG_DIR for what lives
49// in the engine's config directory (paths.ts). No home to place it is an error with that reason.
50async function expandHome($: EngineInterface, path: string): Promise<string> {
51  if (!path.startsWith('~/')) return path
52  const placed = placePath(
53    { home: await $.env.get('HOME'), userProfile: await $.env.get('USERPROFILE'), configDir: await $.env.get('CLAUDE_CONFIG_DIR') },
54    path,
55  )
56  if ('reason' in placed) throw new Error(placed.reason)
57
58  return placed.path
59}
60
61// The signals come from the other mods' state. A mod that is not loaded leaves its state undefined,
62// a known state counted as zero; a read that throws is "no reading" (null) with its reason, which
63// the pane shows beside the counts (issue #6).
64async function lessonsOf($: EngineInterface): Promise<Lessons> {
65  const l: Lessons = { refusals: null, classifierErrors: null, stuckEscalations: null, offloads: null, unreadable: [] }
66  const unreadable: string[] = []
67  const fail = (mod: string, error: unknown): void => void unreadable.push(`${mod}: unreadable, ${why(error)}`)
68  try {
69    l.refusals = ((await $.state.get(GUARD_REFUSALS)).value ?? []).length
70  } catch (error) {
71    fail('cortex-guard', error)
72  }
73  try {
74    const g = (await $.state.get(GENIUS_STATE)).value
75    l.classifierErrors = g?.classifierError === null || g?.classifierError === undefined ? 0 : 1
76  } catch (error) {
77    fail('zetetic-genius', error)
78  }
79  try {
80    const p = (await $.state.get(AUTOPILOT_POLICY)).value
81    l.stuckEscalations = p?.decisions.filter((d) => d.kind === 'stuck').length ?? 0
82    l.offloads = p?.decisions.filter((d) => d.kind === 'offload').length ?? 0
83  } catch (error) {
84    fail('zetetic-autopilot', error)
85  }
86  return { ...l, unreadable }
87}
88
89// The inventory is local: the engine's records and each owned marketplace's manifest. Rejects
90// when a record cannot be read or is not the JSON the engine writes; a manifest that cannot be
91// read is carried on its marketplace's row, as the reason its offered versions are unknown.
92async function buildInventory($: EngineInterface, owner: string): Promise<RepoRow[]> {
93  const installed = parseInstalled(await $.fs.read(await expandHome($, INSTALLED_PLUGINS_PATH)))
94  const marketplaces = parseMarketplaces(await $.fs.read(await expandHome($, KNOWN_MARKETPLACES_PATH)))
95  const offered: Record<string, ManifestRead> = {}
96  for (const m of marketplaces) {
97    try {
98      offered[m.name] = { offered: parseOffered(await $.fs.read(`${m.installLocation}/${MARKETPLACE_MANIFEST}`)) }
99    } catch (error) {
100      offered[m.name] = { error: why(error) }
101    }
102  }
103  return fleetRows(installed, marketplaces, offered, owner)
104}
105
106async function loadInventory($: EngineInterface, owner: string): Promise<void> {
107  try {
108    const repos = await buildInventory($, owner)
109    await update($, fleet, (f) => ({ ...f, repos, inventoryError: null }))
110  } catch (error) {
111    await update($, fleet, (f) => ({ ...f, inventoryError: why(error) }))
112  }
113}
114
115type Ran = { exitCode: number; stdout: string; stderr: string }
116// One read-only command: what it answered, or the reason it did not (a refusal, a timeout, a
117// missing binary all reject the engine's call).
118type Call = { ran: Ran } | { failed: string }
119
120async function run($: EngineInterface, argv: string[]): Promise<Call> {
121  try {
122    return { ran: await $.process.run(argv, { timeoutMs: GH_TIMEOUT_MS }) }
123  } catch (error) {
124    return { failed: `could not run ${argv.slice(0, 5).join(' ')}: ${why(error)}` }
125  }
126}
127
128// The reason a call gave no answer worth parsing: it did not run, or it exited non-zero.
129const refusal = (c: Call): string | null =>
130  'failed' in c ? c.failed : c.ran.exitCode === 0 ? null : c.ran.stderr.trim().slice(0, REASON_CAP) || `gh exit ${c.ran.exitCode}`
131
132// The parser's own words when gh answered with something that is not the list it was asked for.
133const parsed = <T,>(c: Call, parse: (stdout: string) => T): { value: T } | { failed: string } => {
134  if ('failed' in c) return c
135  const r = refusal(c)
136  if (r !== null) return { failed: r }
137  try {
138    return { value: parse(c.ran.stdout) }
139  } catch (error) {
140    return { failed: why(error) }
141  }
142}
143
144// The exact number of open PRs, asked only when the list came back truncated.
145async function countPrs($: EngineInterface, repo: string): Promise<{ total: number } | { failed: string }> {
146  const got = parsed(await run($, prCountArgv(repo)), parsePrCount)
147  return 'value' in got ? { total: got.value } : got
148}
149
150// One repository's remote reading: open PRs with their CI, the open issue count. Read-only gh.
151// Every failure lands on this repository's row (error for the PR list, issuesError for the issue
152// list, prTotalError for the count), so one refused call never takes the other rows with it.
153async function readRepo($: EngineInterface, r: RepoRow): Promise<RepoRow> {
154  const readAt = await $.clock.now()
155  let repo = r.repo
156  if (repo === null && r.local !== null) {
157    const remote = await run($, remoteArgv(r.local))
158    const failed = refusal(remote)
159    if (failed !== null) return { ...r, readAt, error: failed }
160    repo = 'ran' in remote ? repoOfRemote(remote.ran.stdout) : null
161  }
162  if (repo === null) return { ...r, readAt, error: r.local === null ? 'no repository' : 'no GitHub remote' }
163  const [prCall, issueCall] = await Promise.all([run($, prListArgv(repo)), run($, issueListArgv(repo))])
164  const issues = parsed(issueCall, parseIssues)
165  const issuesRead = { issues: 'value' in issues ? issues.value : null, issuesError: 'failed' in issues ? issues.failed : null }
166  const list = parsed(prCall, parsePrList)
167  if ('failed' in list) return { ...r, repo, readAt, error: list.failed, ...issuesRead }
168  const prs = list.value.slice(0, PR_LIMIT)
169  if (list.value.length <= PR_LIMIT) return { ...r, repo, readAt, error: null, prs, prTotal: prs.length, prTotalError: null, ...issuesRead }
170  const count = await countPrs($, repo)
171  return {
172    ...r,
173    repo,
174    readAt,
175    error: null,
176    prs,
177    prTotal: 'total' in count ? count.total : null,
178    prTotalError: 'failed' in count ? count.failed : null,
179    ...issuesRead,
180  }
181}
182
183// source: the engine's session.start doc ("once per process for each loaded plugin ... never
184// /clear") and SessionEndInput.reason ("the process goes on under a new session id, and no
185// session.start fires for it"): after a /clear the session state starts empty and no event
186// rebuilds the inventory. So every refresh rebuilds it first; the local reads also pick up a
187// plugin installed or a marketplace updated since the session began. The rows already shown
188// stay on screen until the remote reading lands: the state is written once, at the end.
189async function refreshRemote($: EngineInterface, owner: string): Promise<void> {
190  const before = await read($, fleet)
191  if (before.isRefreshing) return
192  await update($, fleet, (f) => ({ ...f, isRefreshing: true }))
193  try {
194    let inventory: RepoRow[]
195    try {
196      inventory = await buildInventory($, owner)
197    } catch (error) {
198      await update($, fleet, (f) => ({ ...f, inventoryError: why(error) }))
199      return
200    }
201    const repos = await Promise.all(inventory.map((r) => readRepo($, r)))
202    await update($, fleet, (f) => ({ ...f, repos, inventoryError: null, readAt: repos[0]?.readAt ?? f.readAt }))
203  } catch (error) {
204    // Nothing above should reject (each repository carries its own error); if the engine itself
205    // does, the pane says so instead of keeping "remote: not read yet" for ever.
206    await update($, fleet, (f) => ({ ...f, inventoryError: `refresh failed: ${why(error)}` }))
207  } finally {
208    await update($, fleet, (f) => ({ ...f, isRefreshing: false }))
209  }
210}
211
212export const register: Register = (on, options) => {
213  const owner = String(options.github_owner ?? 'cdeust')
214  const refreshOnStart = options.refresh_on_start !== false
215
216  on('session.start', async ($, e, next) => {
217    await loadInventory($, owner)
218    try {
219      await $.command.register({ name: 'fleet', description: 'Open the harness fleet pane: plugins, versions, PRs, CI', immediate: true })
220    } catch (error) {
221      $.ui.toast(`/fleet is taken by another plugin: ${String(error).slice(0, 80)}`)
222    }
223    // Not awaited: nine repositories of gh calls would outlast the hook's budget; the pane
224    // says "remote: not read yet" until the reading lands.
225    if (refreshOnStart) void refreshRemote($, owner)
226
227    return next(e)
228  })
229
230  on('command.run', { command: 'fleet' }, async ($) => {
231    await $.ui.open({ id: PANE, title: 'Fleet' })
232    // With nothing shown yet, the local inventory is awaited so the pane has its rows at once;
233    // the remote reading goes on in the background and writes the whole state when it lands.
234    if ((await read($, fleet)).repos.length === 0) await loadInventory($, owner)
235    void refreshRemote($, owner)
236
237    return { text: 'Harness fleet opened.' }
238  })
239
240  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) =>
241    FleetView($.ui.resolve(e) as never, {
242      fleet: await read($, fleet),
243      lessons: await lessonsOf($),
244      now: await $.clock.now(),
245      onRefresh: () => void refreshRemote($, owner),
246      onReview: (repo: string, pr: PrRow) => void $.prompt.submit({ text: reviewPrompt(repo, pr) }),
247      onTake: (repo: string, issue: IssueRow) => void $.prompt.submit({ text: takeIssuePrompt(repo, issue) }),
248      onDraftIssue: () =>
249        void (async () => {
250          const f = await read($, fleet)
251          const repos = f.repos.map((r) => r.repo).filter((r): r is string => r !== null)
252          await $.prompt.submit({ text: draftIssuePrompt(repos, await lessonsOf($)) })
253        })(),
254    }),
255  )
256}
257
hooks/paths.ts 41 lines
1// Where `~/` lands on the machine a mod runs on. Pure: the engine follows `$` only inside the module
2// that spells it, so each mod's register file reads the three variables and hands their values here.
3//
4// This file exists once per mod that expands `~/` (a mod cannot import a file from another mod: the
5// engine refuses it, "outside the plugin's folder"), and every copy is byte-identical;
6// scripts/check-shared.sh fails when one differs.
7
8export type PathVars = { home: string | undefined; userProfile: string | undefined; configDir: string | undefined }
9export type Placed = { path: string } | { reason: string }
10
11const isSet = (value: string | undefined): value is string => value !== undefined && value !== ''
12const trimmed = (dir: string): string => dir.replace(/[\\/]+$/, '')
13
14// source: HOME is the home on macOS and Linux, USERPROFILE on Windows (cmd and PowerShell set it,
15// not HOME); Node's os.homedir() reads them in that order on each platform. Unset in a sandbox: no
16// place, said as such, never `/`.
17export const homeOf = (vars: PathVars): Placed =>
18  isSet(vars.home) ? { path: trimmed(vars.home) } : isSet(vars.userProfile) ? { path: trimmed(vars.userProfile) } : { reason: 'neither HOME nor USERPROFILE is set' }
19
20// source: CLAUDE_CONFIG_DIR relocates the engine's `~/.claude` (plugins/, reference/, settings.json);
21// without it the config directory is `<home>/.claude`.
22export const configDirOf = (vars: PathVars): Placed => {
23  if (isSet(vars.configDir)) return { path: trimmed(vars.configDir) }
24  const home = homeOf(vars)
25
26  return 'path' in home ? { path: `${home.path}/.claude` } : home
27}
28
29const CONFIG_PREFIX = '~/.claude'
30
31// A path as the mods spell it: `~/.claude/...` is under the config directory, any other `~/...` under
32// the home, anything else is already a place.
33export const placePath = (vars: PathVars, path: string): Placed => {
34  if (!path.startsWith('~/')) return { path }
35  const isConfig = path === CONFIG_PREFIX || path.startsWith(`${CONFIG_PREFIX}/`)
36  const base = isConfig ? configDirOf(vars) : homeOf(vars)
37  if ('reason' in base) return { reason: `${path} has no place: ${base.reason}` }
38
39  return { path: `${base.path}/${path.slice(isConfig ? CONFIG_PREFIX.length + 1 : 2)}` }
40}
41
hooks/fleet.ts 313 lines
1// Pure side of the fleet: the engine's plugin records, the marketplaces' manifests and gh's JSON
2// become rows; the prompts a Button puts in front of the model are composed here.
3
4import type { CiState, IssueRow, PluginRow, PrRow, RepoRow } from '../types'
5
6// source: ~/.claude/plugins/installed_plugins.json and known_marketplaces.json, the engine's
7// records (read 2026-10-08): plugins["<name>@<marketplace>"][0].{version, installPath};
8// marketplaces[<name>].{source:{source:"github",repo}|{source:"directory",path}, installLocation,
9// lastUpdated}. A marketplace's own manifest is <installLocation>/.claude-plugin/marketplace.json,
10// plugins[].{name, version}.
11export const INSTALLED_PLUGINS_PATH = '~/.claude/plugins/installed_plugins.json'
12export const KNOWN_MARKETPLACES_PATH = '~/.claude/plugins/known_marketplaces.json'
13export const MARKETPLACE_MANIFEST = '.claude-plugin/marketplace.json'
14
15export type Installed = { name: string; marketplace: string; version: string }
16export type Marketplace = {
17  name: string
18  repo: string | null
19  path: string | null
20  installLocation: string
21  lastUpdated: string | null
22}
23
24// A reading that cannot be trusted is an error that names its source, never an empty list: an
25// empty list is what a clean machine reads like.
26const parseJson = (what: string, text: string): unknown => {
27  try {
28    return JSON.parse(text)
29  } catch (error) {
30    throw new Error(`${what} is not valid JSON (${error instanceof Error ? error.message : String(error)})`.slice(0, 160))
31  }
32}
33
34const isObject = (d: unknown): d is Record<string, unknown> => d !== null && typeof d === 'object' && !Array.isArray(d)
35
36export const parseInstalled = (json: string): Installed[] => {
37  const what = 'installed_plugins.json'
38  const d = parseJson(what, json)
39  if (!isObject(d) || !isObject(d.plugins)) throw new Error(`${what} has no "plugins" object`)
40  return Object.entries(d.plugins).flatMap(([key, entries]) => {
41    if (!Array.isArray(entries)) throw new Error(`${what}: "${key}" is not a list`)
42    const at = key.lastIndexOf('@')
43    const version = (entries[0] as { version?: unknown } | undefined)?.version
44    if (at <= 0 || typeof version !== 'string') return []
45    return [{ name: key.slice(0, at), marketplace: key.slice(at + 1), version }]
46  })
47}
48
49type MarketplaceRecord = { source?: { source?: string; repo?: string; path?: string }; installLocation?: string; lastUpdated?: string }
50
51export const parseMarketplaces = (json: string): Marketplace[] => {
52  const what = 'known_marketplaces.json'
53  const d = parseJson(what, json)
54  if (!isObject(d)) throw new Error(`${what} is not an object`)
55  return Object.entries(d as Record<string, MarketplaceRecord>).flatMap(([name, m]) => {
56    if (!isObject(m) || typeof m.installLocation !== 'string') return []
57    const src = m.source ?? {}
58    return [
59      {
60        name,
61        repo: src.source === 'github' && typeof src.repo === 'string' ? src.repo : null,
62        path: src.source === 'directory' && typeof src.path === 'string' ? src.path : null,
63        installLocation: m.installLocation,
64        lastUpdated: typeof m.lastUpdated === 'string' ? m.lastUpdated : null,
65      },
66    ]
67  })
68}
69
70// plugin name → the version the marketplace offers.
71export const parseOffered = (manifestJson: string): Record<string, string> => {
72  const what = 'marketplace.json'
73  const d = parseJson(what, manifestJson)
74  if (!isObject(d) || !Array.isArray(d.plugins)) throw new Error(`${what} has no "plugins" list`)
75  const out: Record<string, string> = {}
76  for (const p of d.plugins as { name?: unknown; version?: unknown }[])
77    if (typeof p?.name === 'string' && typeof p.version === 'string') out[p.name] = p.version
78  return out
79}
80
81// Numeric dot-separated versions compare field by field; anything else compares as text.
82export const isBehind = (installed: string, offered: string | null): boolean => {
83  if (offered === null || installed === offered) return false
84  const a = installed.split('.').map(Number)
85  const b = offered.split('.').map(Number)
86  if (a.some(Number.isNaN) || b.some(Number.isNaN)) return installed < offered
87  for (let i = 0; i < Math.max(a.length, b.length); i++) {
88    const x = a[i] ?? 0
89    const y = b[i] ?? 0
90    if (x !== y) return x < y
91  }
92  return false
93}
94
95// The owner's repositories alone: a GitHub marketplace under the owner, or a local directory.
96export const isOwned = (m: Marketplace, owner: string): boolean =>
97  m.path !== null || (m.repo !== null && m.repo.toLowerCase().startsWith(`${owner.toLowerCase()}/`))
98
99// What reading a marketplace's manifest gave: the offered versions, or why there are none.
100export type ManifestRead = { offered: Record<string, string> } | { error: string }
101
102export const fleetRows = (
103  installed: readonly Installed[],
104  marketplaces: readonly Marketplace[],
105  offered: Readonly<Record<string, ManifestRead>>,
106  owner: string,
107): RepoRow[] =>
108  marketplaces
109    .filter((m) => isOwned(m, owner))
110    .map((m) => {
111      const read = offered[m.name]
112      const versions = read !== undefined && 'offered' in read ? read.offered : {}
113      const plugins: PluginRow[] = installed
114        .filter((p) => p.marketplace === m.name)
115        .map((p) => {
116          const off = versions[p.name] ?? null
117          return { name: p.name, installed: p.version, offered: off, isBehind: isBehind(p.version, off) }
118        })
119      return {
120        repo: m.repo,
121        local: m.path,
122        marketplace: m.name,
123        marketplaceUpdatedAt: m.lastUpdated,
124        manifestError: read !== undefined && 'error' in read ? read.error : null,
125        plugins,
126        prs: [],
127        prTotal: null,
128        prTotalError: null,
129        issues: null,
130        issuesError: null,
131        error: null,
132        readAt: null,
133      }
134    })
135    .filter((r) => r.plugins.length > 0)
136
137// `git remote get-url origin` → owner/name, for a directory marketplace.
138export const repoOfRemote = (url: string): string | null => {
139  const m = /github\.com[:/]([^/\s]+\/[^/\s]+?)(?:\.git)?\s*$/.exec(url.trim())
140  return m === null ? null : (m[1] ?? null)
141}
142
143// source: `gh pr list --json statusCheckRollup` (read on cdeust/Cortex, 2026-10-08): CheckRun rows
144// carry status (COMPLETED, IN_PROGRESS, QUEUED, ...) and conclusion (SUCCESS, FAILURE, CANCELLED,
145// SKIPPED, NEUTRAL, TIMED_OUT, ACTION_REQUIRED, null while running); StatusContext rows carry
146// state (SUCCESS, FAILURE, ERROR, PENDING, EXPECTED). An empty list is no check, not green.
147type Rollup = { __typename?: string; status?: string; conclusion?: string | null; state?: string }
148
149const RED = new Set(['FAILURE', 'ERROR', 'CANCELLED', 'TIMED_OUT', 'ACTION_REQUIRED', 'STARTUP_FAILURE'])
150const IGNORED = new Set(['SKIPPED', 'NEUTRAL'])
151
152export const ciOf = (rollup: readonly Rollup[]): CiState => {
153  if (rollup.length === 0) return 'none'
154  let hasGreen = false
155  let isPending = false
156  for (const r of rollup) {
157    const verdict = r.__typename === 'StatusContext' ? r.state : r.conclusion
158    if (r.__typename !== 'StatusContext' && r.status !== undefined && r.status !== 'COMPLETED') {
159      isPending = true
160      continue
161    }
162    if (verdict === undefined || verdict === null || verdict === 'PENDING' || verdict === 'EXPECTED') {
163      isPending = true
164      continue
165    }
166    if (RED.has(verdict)) return 'failure'
167    if (verdict === 'SUCCESS') hasGreen = true
168    else if (!IGNORED.has(verdict)) isPending = true
169  }
170  if (isPending) return 'pending'
171  return hasGreen ? 'success' : 'none'
172}
173
174export const parsePrList = (json: string): PrRow[] => {
175  const d = parseJson('gh pr list output', json)
176  if (!Array.isArray(d)) throw new Error('gh pr list output is not a list')
177  return d.flatMap((p: Record<string, unknown>) =>
178    typeof p.number === 'number' && typeof p.title === 'string'
179      ? [
180          {
181            number: p.number,
182            title: p.title,
183            isDraft: p.isDraft === true,
184            updatedAt: typeof p.updatedAt === 'string' ? p.updatedAt : '',
185            url: typeof p.url === 'string' ? p.url : '',
186            ci: ciOf(Array.isArray(p.statusCheckRollup) ? (p.statusCheckRollup as Rollup[]) : []),
187          },
188        ]
189      : [],
190  )
191}
192
193export const parseIssues = (json: string): IssueRow[] => {
194  const d = parseJson('gh issue list output', json)
195  if (!Array.isArray(d)) throw new Error('gh issue list output is not a list')
196  return d.flatMap((i: Record<string, unknown>) =>
197    typeof i.number === 'number' && typeof i.title === 'string'
198      ? [
199          {
200            number: i.number,
201            title: i.title,
202            labels: Array.isArray(i.labels) ? i.labels.flatMap((l: { name?: unknown }) => (typeof l.name === 'string' ? [l.name] : [])) : [],
203            createdAt: typeof i.createdAt === 'string' ? i.createdAt : '',
204            comments: Array.isArray(i.comments) ? i.comments.length : 0,
205            url: typeof i.url === 'string' ? i.url : '',
206          },
207        ]
208      : [],
209  )
210}
211
212// source: the owner's standing rule (model-behavior.md): repair work is taken and finished
213// without asking; only adding a feature needs the owner's arbitration. A label that names a
214// request (not a defect) therefore routes the issue to an assessment, never to a fix.
215const FEATURE_LABELS = new Set(['enhancement', 'feature', 'feature request', 'question', 'proposal'])
216export type IssueKind = 'defect' | 'feature'
217export const issueKind = (labels: readonly string[]): IssueKind =>
218  labels.some((l) => FEATURE_LABELS.has(l.toLowerCase())) ? 'feature' : 'defect'
219
220// The read-only gh and git calls the mod makes; nothing here writes anywhere.
221export const PR_LIMIT = 10 // source: own choice, the newest open PRs a pane row can carry
222export const ISSUE_LIMIT = 100 // source: own choice, past it the count reads "100+"
223export const prListArgv = (repo: string): string[] => [
224  'gh', 'pr', 'list', '--repo', repo, '--state', 'open', '--json',
225  'number,title,isDraft,updatedAt,url,statusCheckRollup', '--limit', String(PR_LIMIT + 1),
226]
227// source: GitHub GraphQL `Repository.pullRequests(states: OPEN) { totalCount }`, the exact count;
228// read on cdeust/Cortex with `gh api graphql` (2026-10-10). Asked only when the list above came
229// back with more than PR_LIMIT rows (it reads PR_LIMIT + 1), so a repository under the cap costs
230// no extra call.
231export const prCountArgv = (repo: string): string[] => {
232  const [owner = '', name = ''] = repo.split('/')
233  return [
234    'gh', 'api', 'graphql', '-f', `owner=${owner}`, '-f', `name=${name}`, '-f', // -f keeps a name like 2024 or true a string; -F would convert it
235    'query=query($owner:String!,$name:String!){repository(owner:$owner,name:$name){pullRequests(states:OPEN){totalCount}}}',
236  ]
237}
238export const parsePrCount = (json: string): number => {
239  const d = parseJson('gh api graphql output', json) as { data?: { repository?: { pullRequests?: { totalCount?: unknown } } } }
240  const n = d?.data?.repository?.pullRequests?.totalCount
241  if (typeof n !== 'number') throw new Error('gh api graphql output has no pullRequests.totalCount')
242  return n
243}
244export const issueListArgv = (repo: string): string[] => [
245  'gh', 'issue', 'list', '--repo', repo, '--state', 'open', '--json', 'number,title,labels,createdAt,url,comments',
246  '--limit', String(ISSUE_LIMIT),
247]
248export const remoteArgv = (local: string): string[] => ['git', '-C', local, 'remote', 'get-url', 'origin']
249
250// What the pane says of a repository's open PRs: how many it shows against how many exist, and
251// when the total could not be read, that.
252export const prsLabel = (r: Pick<RepoRow, 'prs' | 'error' | 'prTotal' | 'prTotalError'>): string => {
253  const plural = (n: number): string => `${n} open PR${n === 1 ? '' : 's'}`
254  if (r.error !== null) return 'PRs: no reading'
255  if (r.prTotal === null) return `${plural(r.prs.length)} shown, total not read (${r.prTotalError ?? 'no reason given'})`
256  return r.prTotal > r.prs.length ? `${r.prs.length} of ${r.prTotal} open PRs` : plural(r.prTotal)
257}
258
259// What a Button puts in front of the model. The rules named are the owner's standing ones: the
260// lead posts the verdict as a standalone comment with the head sha on line 2; a merge goes
261// through merge-gate.py with --repo; every worktree lives inside the repo and is registered.
262export const reviewPrompt = (repo: string, pr: PrRow): string =>
263  [
264    `Review PR #${pr.number} of ${repo} ("${pr.title}", CI ${pr.ci}).`,
265    'Read the diff and the CI logs for any red check. Post the review verdict as the lead: a standalone `gh pr comment` whose line 2 is the head sha.',
266    'Merge only through merge-gate.py with --repo, and only when CI is green and the verdict is posted. Never merge, close or push from a mod.',
267  ].join(' ')
268
269export const takeIssuePrompt = (repo: string, issue: IssueRow): string =>
270  issueKind(issue.labels) === 'feature'
271    ? [
272        `Issue #${issue.number} of ${repo} ("${issue.title}") is a feature request.`,
273        "Adding a feature needs the owner's decision: read the issue and its comments, then state in three sentences what it would change, what it costs and the alternative, and wait for the owner's answer before writing any code.",
274      ].join(' ')
275    : [
276        `Take issue #${issue.number} of ${repo} ("${issue.title}", ${issue.labels.length === 0 ? 'no label' : issue.labels.join(', ')}, ${issue.comments} comment${issue.comments === 1 ? '' : 's'}).`,
277        'Read the issue and its comments, reproduce the defect on current main with a test that fails before the fix, fix the root cause in a worktree under <repo>/.claude/worktrees/ registered with disk-hygiene, run the gates exactly as CI runs them, and open a PR that closes it.',
278        'Have the PR reviewed independently and merge only through merge-gate.py with --repo, once CI is green and the verdict is posted.',
279        'Never close an issue without evidence: if the defect cannot be reproduced, say so with the commands run and ask the reporter on the issue.',
280      ].join(' ')
281
282// A count is null when the state it counts could not be read: "no reading", never zero. A mod that
283// is not loaded is another condition (its state is undefined) and counts as zero. `unreadable`
284// carries one line per failed read, naming the mod and the reason.
285export type Lessons = {
286  refusals: number | null
287  classifierErrors: number | null
288  stuckEscalations: number | null
289  offloads: number | null
290  unreadable: readonly string[]
291}
292
293// "3 guard refusals", or "guard refusals: no reading" for a count that could not be read.
294export const lessonCell = (n: number | null, label: string): string => (n === null ? `${label}: no reading` : `${n} ${label}`)
295
296export const lessonsLine = (l: Lessons): string =>
297  [
298    lessonCell(l.refusals, 'guard refusals'),
299    lessonCell(l.classifierErrors, 'classifier errors'),
300    lessonCell(l.stuckEscalations, 'stuck escalations'),
301    lessonCell(l.offloads, 'results offloaded'),
302  ].join(' · ')
303
304// Sent as the plugin's message (not `asUser`): Claude reads "The harness-fleet plugin sent a message: ...", so the
305// text is the plugin's voice and names the owner in the third person, never as "me" or "I".
306export const draftIssuePrompt = (repos: readonly string[], l: Lessons): string =>
307  [
308    'From this session\'s harness signals, draft one GitHub issue on the plugin repository the signal belongs to:',
309    `${lessonsLine(l).replace(/ · /g, ', ')}.`,
310    `Candidate repositories: ${repos.join(', ')}.`,
311    'Show the owner the issue title and body first; create it with `gh issue create` only after the owner confirms.',
312  ].join(' ')
313
hooks/fleetview.tsx 142 lines
1import type { Elements } from 'claude-code'
2
3import type { CiState, FleetState, IssueRow, PluginRow, PrRow, RepoRow } from '../types'
4import { ISSUE_LIMIT, type Lessons, issueKind, lessonsLine, prsLabel } from './fleet'
5
6export type Ui = Elements['terminal']
7
8export type FleetData = {
9  fleet: FleetState
10  lessons: Lessons
11  now: number
12  onRefresh: () => void
13  onReview: (repo: string, pr: PrRow) => void
14  onTake: (repo: string, issue: IssueRow) => void
15  onDraftIssue: () => void
16}
17
18// source: the design system's verification lexicon: a state is named, never implied by colour alone.
19const CI_GLYPH: Record<CiState, string> = { success: '●', failure: '✗', pending: '◐', none: '○' }
20
21const ageLabel = (iso: string, now: number): string => {
22  const ms = now - Date.parse(iso)
23  if (!Number.isFinite(ms)) return ''
24  const h = Math.floor(ms / 3_600_000)
25  return h < 48 ? `${h} h ago` : `${Math.floor(h / 24)} d ago`
26}
27
28const PrLine = (ui: Ui, repo: string, pr: PrRow, now: number, onReview: FleetData['onReview']) => {
29  const { Box, Button, Text } = ui
30  return (
31    <Box gap={1}>
32      <Text color={pr.ci === 'failure' ? 'red' : pr.ci === 'success' ? 'green' : undefined}>
33        {CI_GLYPH[pr.ci]} #{pr.number} {pr.isDraft ? '(draft) ' : ''}
34        {pr.title.slice(0, 60)} · CI {pr.ci} · {ageLabel(pr.updatedAt, now)}
35      </Text>
36      <Button key={`review-${repo}-${pr.number}`} label="Review" onPress={() => onReview(repo, pr)} />
37    </Box>
38  )
39}
40
41const ISSUE_ROWS = 5 // source: own choice, the oldest open issues a pane row can carry
42
43// Defects first, each group oldest first: the owner's rule is that repair work is taken and
44// finished, so what is waiting longest and is not a feature request leads.
45const issueOrder = (a: IssueRow, b: IssueRow): number => {
46  const k = Number(issueKind(a.labels) === 'feature') - Number(issueKind(b.labels) === 'feature')
47  return k !== 0 ? k : a.createdAt.localeCompare(b.createdAt)
48}
49
50const IssueLine = (ui: Ui, repo: string, issue: IssueRow, now: number, onTake: FleetData['onTake']) => {
51  const { Box, Button, Text } = ui
52  const isFeature = issueKind(issue.labels) === 'feature'
53  return (
54    <Box gap={1}>
55      <Text dimColor={isFeature}>
56        #{issue.number} [{isFeature ? 'feature' : 'defect'}] {issue.title.slice(0, 60)} · {ageLabel(issue.createdAt, now)} ·{' '}
57        {issue.comments} comment{issue.comments === 1 ? '' : 's'}
58      </Text>
59      <Button key={`take-${repo}-${issue.number}`} label={isFeature ? 'Assess' : 'Take'} onPress={() => onTake(repo, issue)} />
60    </Box>
61  )
62}
63
64// An unreadable manifest makes the offered version unknown, which is not the same as a plugin its
65// marketplace does not list.
66const offeredLabel = (r: RepoRow, p: PluginRow): string =>
67  r.manifestError !== null ? ' · offered unknown' : p.offered === null ? '' : p.isBehind ? ` → ${p.offered} offered` : ' · current'
68
69const RepoBlock = (ui: Ui, r: RepoRow, now: number, onReview: FleetData['onReview'], onTake: FleetData['onTake']) => {
70  const { Box, Text } = ui
71  const title = r.repo ?? r.local ?? r.marketplace
72  const plugins = r.plugins
73    .map((p) => `${p.name} ${p.installed}${offeredLabel(r, p)}`)
74    .join(' · ')
75  return (
76    <Box flexDirection="column">
77      <Text bold>{title}</Text>
78      <Text dimColor>
79        {plugins}
80        {r.marketplaceUpdatedAt === null ? '' : ` · marketplace read ${ageLabel(r.marketplaceUpdatedAt, now)}`}
81      </Text>
82      {r.manifestError !== null && <Text color="red">manifest: {r.manifestError}</Text>}
83      {r.error !== null && <Text color="red">gh: {r.error}</Text>}
84      {r.issuesError !== null && <Text color="red">gh issues: {r.issuesError}</Text>}
85      {r.repo !== null && r.readAt !== null && (
86        // A failed PR read carries an error and no list: say "no reading", never "0 open PRs".
87        <Text dimColor>
88          {prsLabel(r)} ·{' '}
89          {r.issues === null ? 'issues: no reading' : `${r.issues.length >= ISSUE_LIMIT ? `${ISSUE_LIMIT}+` : r.issues.length} open issues`}
90        </Text>
91      )}
92      {r.repo !== null && r.prs.map((pr) => PrLine(ui, r.repo ?? '', pr, now, onReview))}
93      {r.repo !== null &&
94        r.issues !== null &&
95        [...r.issues].sort(issueOrder).slice(0, ISSUE_ROWS).map((i) => IssueLine(ui, r.repo ?? '', i, now, onTake))}
96      {r.repo !== null && r.issues !== null && r.issues.length > ISSUE_ROWS && (
97        <Text dimColor>+{r.issues.length - ISSUE_ROWS} more issues</Text>
98      )}
99    </Box>
100  )
101}
102
103export const FleetView = (ui: Ui, d: FleetData) => {
104  const { Box, Button, Text } = ui
105  const f = d.fleet
106  const l = d.lessons
107  return (
108    <Box flexDirection="column" gap={1}>
109      <Box flexDirection="column">
110        <Text bold>Harness fleet</Text>
111        <Text dimColor>
112          the owner's plugins and their repositories · every action starts with a button you press; the mod itself
113          only reads
114        </Text>
115      </Box>
116      {f.inventoryError !== null && <Text color="red">inventory: {f.inventoryError}</Text>}
117      {f.repos.length === 0 ? (
118        // With an inventory error the red line above is the answer; "none found" would read as a clean machine.
119        f.inventoryError === null && <Text dimColor>no owned plugin found in installed_plugins.json</Text>
120      ) : (
121        f.repos.map((r) => RepoBlock(ui, r, d.now, d.onReview, d.onTake))
122      )}
123      <Box flexDirection="column">
124        <Text bold dimColor>
125          LESSONS
126        </Text>
127        <Text dimColor>
128          {lessonsLine(l)}
129        </Text>
130        {l.unreadable.map((line) => (
131          <Text color="red">{line}</Text>
132        ))}
133        <Button key="draft-issue" label="Draft issue" hotkey="i" onPress={d.onDraftIssue} />
134      </Box>
135      <Box gap={1}>
136        <Button key="refresh" label={f.isRefreshing ? 'Refreshing…' : 'Refresh'} hotkey="r" onPress={d.onRefresh} />
137        <Text dimColor>{f.readAt === null ? 'remote: not read yet' : `remote read ${Math.round((d.now - f.readAt) / 1000)} s ago`}</Text>
138      </Box>
139    </Box>
140  )
141}
142
types/index.d.ts 67 lines
1// The fleet: the owner's plugins, where each is installed from, and what its repository holds.
2
3export type PluginRow = {
4  name: string
5  installed: string
6  offered: string | null
7  isBehind: boolean
8}
9
10export type CiState = 'success' | 'failure' | 'pending' | 'none'
11
12export type PrRow = {
13  number: number
14  title: string
15  isDraft: boolean
16  updatedAt: string
17  url: string
18  ci: CiState
19}
20
21export type IssueRow = {
22  number: number
23  title: string
24  labels: string[]
25  createdAt: string
26  comments: number
27  url: string
28}
29
30export type RepoRow = {
31  // owner/name on GitHub; null until a local marketplace's remote is resolved.
32  repo: string | null
33  // the local checkout a directory marketplace reads from; null for a GitHub marketplace.
34  local: string | null
35  marketplace: string
36  marketplaceUpdatedAt: string | null
37  // why the marketplace's manifest could not be read; the offered versions are then unknown, not absent.
38  manifestError: string | null
39  plugins: PluginRow[]
40  // the newest open PRs, ten at most.
41  prs: PrRow[]
42  // the exact number of open PRs; null while unread, and when the list was cut at ten and the count failed.
43  prTotal: number | null
44  prTotalError: string | null
45  // the open issues, newest 100 at most; null when the gh reading failed (never an empty list).
46  issues: IssueRow[] | null
47  issuesError: string | null
48  // why the PR list could not be read; the pane then says "no reading", never an empty list.
49  error: string | null
50  readAt: number | null
51}
52
53export type FleetState = {
54  repos: RepoRow[]
55  inventoryError: string | null
56  isRefreshing: boolean
57  readAt: number | null
58}
59
60declare module 'claude-code' {
61  interface PluginState {
62    'harness-fleet': {
63      fleet: FleetState
64    }
65  }
66}
67