@jaybeeuu/agent-cortex 2.8.0 → 2.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/CHANGELOG.md +304 -0
  2. package/README.md +30 -3
  3. package/agents/README.md +7 -2
  4. package/agents/guppi/agent.md +231 -0
  5. package/agents/guppi/claude/frontmatter.json +6 -0
  6. package/agents/guppi/pi/frontmatter.json +6 -0
  7. package/agents/plan/agent.md +6 -0
  8. package/agents/ralph-plan/agent.md +6 -0
  9. package/bin/installers/claude.mjs +8 -23
  10. package/bin/installers/pi.mjs +8 -2
  11. package/extensions/interrupt-bookmark/README.md +129 -0
  12. package/extensions/interrupt-bookmark/index.test.ts +717 -0
  13. package/extensions/interrupt-bookmark/index.ts +354 -0
  14. package/extensions/interrupt-bookmark/package.json +20 -0
  15. package/extensions/skill-stats/README.md +84 -3
  16. package/extensions/skill-stats/index.ts +62 -3
  17. package/extensions/skill-stats/package.json +1 -1
  18. package/extensions/skill-stats/rollup.test.ts +643 -0
  19. package/extensions/skill-stats/rollup.ts +415 -0
  20. package/extensions/skill-stats/timeline.ts +101 -0
  21. package/package.json +1 -1
  22. package/scripts/lib/compose-agent.mjs +45 -7
  23. package/scripts/lib/manifest.mjs +29 -0
  24. package/skills/review/review-defects/EXAMPLES.md +80 -4
  25. package/skills/review/review-defects/SKILL.md +47 -16
  26. package/skills/review/review-report/EXAMPLES.md +118 -0
  27. package/skills/review/review-report/SKILL.md +138 -0
  28. package/skills/review/review-report/scripts/report.mjs +1032 -0
  29. package/skills/workflow/hitl-queue/BOUNDARY.md +122 -0
  30. package/skills/workflow/hitl-queue/DEADLINES.md +59 -0
  31. package/skills/workflow/hitl-queue/RECOMMEND.md +89 -0
  32. package/skills/workflow/hitl-queue/SCOPES.md +118 -0
  33. package/skills/workflow/hitl-queue/SKILL.md +150 -0
  34. package/skills/workflow/hitl-queue/scripts/boundary.mjs +493 -0
  35. package/skills/workflow/hitl-queue/scripts/queue.mjs +1012 -0
  36. package/skills/workflow/hitl-queue/scripts/recommend.mjs +492 -0
  37. package/skills/workflow/hitl-queue/scripts/scopes.mjs +479 -0
  38. package/skills/workflow/plan/SKILL.md +13 -0
  39. package/skills/workflow/prioritise-work/CHALLENGE.md +139 -0
  40. package/skills/workflow/prioritise-work/SKILL.md +150 -0
  41. package/skills/workflow/prioritise-work/scripts/challenge.mjs +505 -0
  42. package/skills/workflow/prioritise-work/scripts/strategy.mjs +756 -0
  43. package/skills/workflow/prioritise-work/templates/strategy.md +87 -0
  44. package/skills/workflow/ralph/REFERENCE.md +6 -1
  45. package/skills/workflow/ralph/scripts/prune-worktrees.mjs +185 -10
  46. package/skills/workflow/run-pipeline-stage/playbooks/review.md +5 -2
  47. package/skills/workflow/score-bead/FORMAT.md +73 -0
  48. package/skills/workflow/score-bead/SKILL.md +112 -0
  49. package/skills/workflow/score-bead/scripts/rice.mjs +664 -0
  50. package/skills/workflow/using-agent-skills/SKILL.md +6 -1
  51. package/token-map.README.md +14 -2
  52. package/token-map.json +17 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,309 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.10.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 9d86a2d: Rank bd due dates in the `hitl-queue`. A bead's `--due` date now multiplies its total by the
8
+ factor of the narrowest tier its remaining time fits inside — `1` more than a week out, `1.5`
9
+ within a week, `2` within two days, `4` within a day, `8` once overdue. The numbers live in the
10
+ strategy's new optional `## Deadline tiers` table, so tuning them is a strategy edit and a
11
+ `bump`, never a code change; a strategy without that section ranks on the documented default,
12
+ and `validate` fails a table it cannot read. Each row shows the deadline, the time left and the
13
+ factor, an overdue bead is flagged `OVERDUE` rather than lifted in silence, and a bead with no
14
+ due date keeps the neutral factor. A deferred bead stays out of the queue until its
15
+ `defer_until` passes, applying bd's own wake rule to bd's own field.
16
+ - 32395f6: Re-rank at every item boundary, with the comparison and the reason on the trail. `hitl-queue` gains
17
+ `boundary.mjs`: one command compares the theme's next item (the highest-ranked bead under the epic)
18
+ against the queue's top item, prints **both stored totals**, and says whether the scores point to
19
+ `stay` or `switch`. It computes no score — the totals, components and multipliers are the queue's —
20
+ and it recommends rather than switches: a run with no `--decide` writes nothing.
21
+
22
+ `--decide stay|switch|move` records the human's answer as one timestamped `bd note` on the theme
23
+ bead, carrying both scores and the reason, so a later session reads why the theme was kept or left.
24
+ A decision that contradicts the scores needs `--reason`, so an unexplained override cannot reach
25
+ the trail. A missing theme item, a named bead outside the queue and an empty queue are stated with
26
+ one next step instead of guessed.
27
+
28
+ The guppi agent gains its work unit: the theme is the current epic, a boundary is the completion of
29
+ one item, and every boundary ends in the documented trade-off — continue in the theme, switch
30
+ because higher-priority work waits elsewhere, or move because a break improves the next item. It
31
+ never leaves a theme without both scores on screen, and a wish for a different order stays a
32
+ `prioritise-work` change.
33
+
34
+ - 763869c: Recommend one item from the queue and the strategy. `hitl-queue` gains `recommend.mjs`: one command
35
+ prints the queue's top row — its total, the four RICE components, the unblocking and
36
+ work-in-progress multipliers, what the answer unblocks — together with the line of the committed
37
+ strategy that justifies it, quoted from the file and refused when the file does not contain it.
38
+ `--bead <id>` recommends the bead a human named and notes the queue's own top choice in one line.
39
+
40
+ The guppi agent now opens a session with that one block and waits, answers "what should we look
41
+ at?" through the same steps, and states a condition with one next step instead of choosing when the
42
+ strategy is missing, nothing is scored, the queue is empty, or a named bead is not in the queue. It
43
+ still proposes only: no execution, no claim, no merge, no push.
44
+
45
+ - 64b5deb: Resolve `{{PATH:skills/...}}` rows to the tree each install stages, so an agent row
46
+ always names a file the install contains. Claude Code stages skills flat
47
+ (`skills/<name>/SKILL.md`), so a row authored against the repository's grouped tree lost
48
+ its group segment and rendered as a bare relative path that resolved to nothing. The
49
+ staged shape is now declared per harness in `token-map.json`'s `layouts` table, the
50
+ claude installer resolves agent rows against the plugin root as it already did for
51
+ skills, and `test/rendered-paths-resolve.test.mjs` stages both installs and fails when
52
+ any rendered row names a file that is not there.
53
+ - bed237e: Make the HITL queue scope-aware: it reads several `bd` workspaces and keeps one writable.
54
+
55
+ A scope list — `.agent-cortex/scopes.json` in the repository, then
56
+ `~/.agent-cortex/scopes.json` (`AGENT_CORTEX_HOME` overrides the root), then one implicit scope
57
+ for the current workspace — names each workspace, its kind (`code`, `personal`, `ops`) and whether
58
+ it is read-only. `readOnly` defaults to `true`, and a scope is writable only when it is not marked
59
+ read-only _and_ it is the current workspace, so a copied list cannot widen the writable set on
60
+ another machine.
61
+
62
+ Every configured scope contributes rows, each tagged with its scope. A scope whose directory is
63
+ missing or carries no `.beads` of its own is reported `unavailable` with the reason and skipped —
64
+ bd resolves a workspace by walking up, so the marker check is what stops one workspace's beads
65
+ being attributed to another. A failed `bd` call marks its own scope unavailable; the run still
66
+ exits `0`. A read-only scope passes through one guard that refuses any call other than the two
67
+ reads the queue issues, so the boundary survives a later edit.
68
+
69
+ One daily scope note sits above the ranked list, quoting the `- daily: <scope>, …` line from the
70
+ personal scope's own strategy and citing its version, section and scope. `--shared`
71
+ (`AGENT_CORTEX_QUEUE_SHARED=1`) marks output that leaves the machine: personal scopes are not read,
72
+ so personal rows and the daily note are withheld and counted.
73
+
74
+ `prioritise-work` documents the daily line, and guppi's agent text explains scopes, the note and the
75
+ privacy boundary.
76
+
77
+ ### Patch Changes
78
+
79
+ - 7418a33: Prove that a refused boundary decision records nothing. The two refusal cases in
80
+ `test/boundary.test.mjs` now assert an empty trail as well as the message: `--decide` with an
81
+ outcome outside the three, and a decision against the scores with no `--reason`. The fake `bd` in
82
+ `test/helpers/fake-bd-queue.mjs` already records every `note` call, so the shared harness now
83
+ returns the trail a refused build left behind. A comment that claimed the parser refused a
84
+ bad `--decide` before the builder saw it was wrong for this case: the command line does refuse it,
85
+ but the test calls the builder directly, and the builder checks the runtime value itself, because
86
+ the union is a compile-time constraint only. No behaviour changes.
87
+ - d8de6ba: Harden the guppi interrupt render test so a label that no longer sits with its own body fails.
88
+
89
+ The order assertion read the four step markers by offset, and the marker was the label, so the test
90
+ proved the four labels were ordered and nothing more. A render could keep every label in place and
91
+ exchange the two bodies — the record's text under `Rewind.`, the rewind's under `Record.` — inverting
92
+ the record-before-rewind rule the protocol exists to protect, and the test stayed green.
93
+
94
+ The test now reads the steps as (label, body) pairs and asserts the pair order, so each label must
95
+ carry its own body. No shipped text changed.
96
+
97
+ - fd9c9a3: Remove a landed closed bead's worktree when the merge deleted its remote branch.
98
+ `prune-worktrees.mjs` refused every such worktree with "has no remote-tracking
99
+ branch", because a merge that deletes the branch also removes the local branch's
100
+ upstream — so the one case the script exists to handle failed housekeeping. A
101
+ missing upstream is now distinguished by content: with the tree clean and the
102
+ base branch holding the branch's own version of every path the branch changed
103
+ since their merge base, the worktree and its local branch are removed; otherwise
104
+ the worktree is kept and the refusal names the risk. The test is one-sided, so a
105
+ base that moved on after the branch was cut still proves the branch landed. It
106
+ proves content and never history: a removed branch is discarded with every
107
+ commit the base does not contain, such as a reverted change or an empty commit.
108
+ The base is the remote's default branch, read from `origin/HEAD` and never
109
+ hardcoded, with `--base <ref>` as the documented override; an unresolvable base
110
+ keeps the worktree and refuses. A base that resolves to the worktree's own
111
+ commit also keeps the worktree and refuses, because comparing a branch with
112
+ itself proves nothing.
113
+
114
+ The content proof also survives a path git would otherwise rewrite. The branch's
115
+ changed paths are read with `git diff --name-only -z` and split on NUL, then fed
116
+ back under `git --literal-pathspecs`, so a path holding a non-ASCII byte, a double
117
+ quote, a backslash, a leading colon or a newline round-trips exactly. Without both,
118
+ such a path matched no pathspec, the second diff came back empty, and a branch the
119
+ base never received was removed with an empty reason list.
120
+
121
+ - 74ac309: Correct two shipped-text contradictions in the review docs: a count word that the data beside it
122
+ disproved, and a promise the sibling file did not keep.
123
+
124
+ `review-report`'s trend example is headed "re-run after two more rejections" but prints eight class
125
+ deltas, and one label per rejection makes that eight rejections. The heading now says eight, and the
126
+ sample is the script's own output over a tracker that took eight more rejections: eight classes
127
+ moved, the other four stayed, and the first-pass rate held because the rejections re-ran four
128
+ changes that already held a review cohort.
129
+
130
+ `review-defects` promised `EXAMPLES.md` carried "one real case per class". The file holds twelve
131
+ cases and eleven real observations, with `scope-creep` described as a situation because no recorded
132
+ case exists. The promise now says what the file delivers rather than inventing a case to satisfy it.
133
+
134
+ ## 2.9.0
135
+
136
+ ### Minor Changes
137
+
138
+ - 7bdeb85: Extend the closed `defect:<class>` vocabulary in `review-defects` with four classes, so a reviewer
139
+ never has to force-fit a finding into a class that does not describe it.
140
+
141
+ `defect:unsafe-instruction` covers shipped text that, followed on an arbitrary machine, could
142
+ destroy data or run something dangerous: destructive commands, force-pushes, credential handling,
143
+ overwriting user config. `defect:ambiguous-rule` covers wording a reasonable agent reads two ways,
144
+ especially a phrase true of one context that reads as true of another. `defect:silent-degradation`
145
+ covers a path that fails quietly or passes vacuously: a skipped check reported as success, a null
146
+ mapping silently dropping a token, a guard that cannot fail. `defect:unclassified` is the escape
147
+ hatch for a finding that matches no class.
148
+
149
+ The table gains a **Distinct from** column, because the near neighbours are where a misclassification
150
+ happens: drift is _stale_, while ambiguity is _readable two ways_; `test-cannot-fail` is one
151
+ assertion that cannot bite, while silent degradation is any path that cannot report.
152
+
153
+ `defect:unclassified` carries an obligation rather than being a pass: the reviewer says no class
154
+ fits in the rejection text, files a bead proposing the class with the finding as its case, and names
155
+ that bead. Without the gap bead the label degrades the aggregate silently, which is the failure the
156
+ class exists to prevent. The vocabulary stays closed — a class is added by changing the skill with
157
+ the owner, never invented inside a review.
158
+
159
+ `review-report` gains an owning-skill mapping for the four classes (the authoring skill for unsafe
160
+ and ambiguous text, the test and stage skills for a quiet path, and `review-defects` itself for an
161
+ unclassified finding), and `review-defects` gains one real worked example per new class.
162
+
163
+ - 754e0eb: Add the **guppi** agent — the human-in-the-loop counterpart to ralph. It is a resident,
164
+ propose-only collaborator that decides what gets planned, loads `prioritise-work`, `plan`,
165
+ `hitl-collab`, `grill-me` and `flesh-out-idea` on demand, and never executes AFK work, merges or
166
+ pushes. `using-agent-skills` now routes "what should I work on" and HITL collaboration to guppi,
167
+ and `plan` cross-references it as the entry point that decides what gets planned.
168
+ - 1c786be: Add guppi's **interrupt protocol**: checkpoint, record, rewind, resume. guppi takes a resume point at
169
+ the last clean boundary, records the interruption as the bead type its content implies — a meeting
170
+ note becomes an idea or task bead through `record-idea`/`create-task`, PR feedback for ralph becomes a
171
+ task bead through `create-task` carrying the pull request's reference (with a `handoff` document
172
+ through `hitl-collab` when a human must act on it, and no peer message at all, because ralph reads the
173
+ bead from the tracker), a Slack todo becomes a task bead through `create-task`, and a question only a
174
+ human can answer becomes an `execution:hitl` decision bead — rewinds to the checkpoint, and resumes
175
+ with one sentence naming the task and the recorded bead. The record completes before the rewind, so a
176
+ failed record is never lost; a failed rewind continues in the current context and says so rather than
177
+ silently carrying the interruption. Nothing is written to a scratch file and no branch is deleted —
178
+ the abandoned branch is the audit trail. The rewind mechanism is forked through the existing
179
+ `interrupt_rewind` token row (`interrupt_resume` on pi, `/rewind` on claude), so the four-step prose
180
+ is byte-identical across harnesses; `test/guppi-interrupt-render.test.mjs` stages both installs to
181
+ prove it.
182
+ - fde0b9e: Make clearing the context safe in the **guppi** agent: write memory first, then recover the theme
183
+ from the tracker.
184
+
185
+ guppi now requires a memory write before any clear — what was decided and why, what is open, and
186
+ what the next session needs — into both the bead trail (`bd note`) and `bd remember` under a
187
+ `--key` naming the theme. `bd remember` stores into the workspace's own tracker database, so the
188
+ memory is already project-scoped; the key is a theme slug, and re-storing under it updates the
189
+ memory in place rather than accumulating stale copies.
190
+
191
+ The recovery rule states the exact read sequence — `bd prime` for the memories, `bd children
192
+ <epic>` for the theme, `bd show` per child for the trail, `bd provenance log` for the refs — so a
193
+ fresh session reconstructs a theme's state without a transcript.
194
+
195
+ Both rules are written against **"a clear"**, not against a command name: `/clear` is named as
196
+ today's mechanism and the self-flushing clear as its intended replacement, so the rules survive the
197
+ mechanism changing. A clear with no memory write is stated as a defect the agent names rather than
198
+ performing silently.
199
+
200
+ - 40598b9: Add the `interrupt-bookmark` extension: two tools around pi's own tree navigation, so an interruption
201
+ stops dragging its turns into the context the original task then has to carry. `interrupt_checkpoint`
202
+ returns the current leaf id as a resume point. `interrupt_resume { checkpointId, summary }` rewinds
203
+ there, keeps the abandoned branch under a branch summary labelled `interrupt`, and reports the summary
204
+ entry. The summary comes from pi's own navigation summariser — the extension makes no model call and
205
+ deletes nothing. Navigation is command-only in pi (`waitForIdle()` and `navigateTree()` live on
206
+ `ExtensionCommandContext`; a tool call is always inside a streaming turn), so the resume tool
207
+ validates the request, ends the turn, and an `agent_settled` handler dispatches the command that
208
+ rewinds — the pattern pi documents for a tool that must reach a command-only API. An unknown
209
+ checkpoint id fails naming the id and writes nothing; navigation is retried exactly once after a
210
+ fresh wait for idle, and a second failure reports the reason and leaves the conversation unchanged.
211
+ `token-map.json` gains the `interrupt_rewind` row — `interrupt_resume` on pi, Claude Code's `/rewind`
212
+ command on claude — with a note recording why the two values differ in kind and why the checkpoint
213
+ half is never tokenised.
214
+ - 05573b2: Add the `prioritise-work` skill, the `strategy.md` template it copies, and the `strategy.mjs` script
215
+ that validates and versions it. The strategy is a committed file in the consuming repository's
216
+ working-docs root (`.agent-cortex/working-docs/strategy.md`, overridable with `--file`), never a bead
217
+ and never a scratch note — the skill performs no tracker writes at all. `init` writes the template
218
+ stamped with the creation date and refuses to overwrite; `validate` checks a positive-integer version,
219
+ a `YYYY-MM-DD` calendar date, and five required sections — themes, value, confidence, out-of-scope and effort
220
+ calibration — naming each missing, empty or malformed one, and prints the rubric to stdout only when
221
+ the file passes, so a scorer can never read a stale or malformed rubric; `bump` refuses an invalid
222
+ file, raises the version by one and records today's date. The five interview questions map one-to-one
223
+ onto the five sections, and `using-agent-skills` routes ranking questions to the new skill.
224
+ - c77cb17: Treat a challenged priority as a strategy review, never a silent reorder. `prioritise-work` gains
225
+ `CHALLENGE.md` — the sequence from "this should be higher" to a changed rubric — and a second
226
+ script, `challenge.mjs record`, which refuses the tempting shortcut: an order that moved while the
227
+ strategy version stayed put exits 1 and writes nothing. It reads the strategy through the same
228
+ validator, diffs the ranked ids by position so the movement is deterministic, and prints one
229
+ bead-trail entry in `run-pipeline-stage`'s trail shape, carrying the words that raised the
230
+ challenge and the reasoning that answered it — including when the answer is "no change to the
231
+ rubric", which is a valid outcome that must still leave a trace. `--out <path>` writes that entry
232
+ to a file, so the documented append is `bd note <bead> --file <path>`: the entry repeats the human's
233
+ own words, and a shell string would parse them. `strategy.mjs bump` now requires
234
+ `--reason` and appends `- <date> v<n>: <reason>` to the strategy file's new `## Change log`
235
+ section, and `validate` fails when the newest entry names a version the header does not, so a
236
+ version cannot move without a recorded reason.
237
+ - f2f68c8: Add the `hitl-queue` skill: one command ranks the open `execution:hitl` beads by RICE ×
238
+ (1 + ln(1 + transitively blocked dependents)) × 1.5 when in progress, printing every row's
239
+ components, multipliers and what each answer unblocks. The `plan` skill, the `plan` agent and the
240
+ `ralph-plan` agent report that queue before dispatching or proposing anything.
241
+ - c644523: Add the `review-report` skill: one report from the `defect:<class>` labels a project's reviews
242
+ applied. `scripts/report.mjs` reads the tracker twice, both read-only and both with `--all` — the
243
+ defect query `bd list --label-pattern 'defect:*' --all` and the chore tree — and prints the top three
244
+ classes with counts, two example bead ids and the shipped skill that owns each failing rule, the
245
+ first-pass review rate derived from `stage:review` chore counts per parent, fix rounds grouped by the
246
+ stage the fresh chore re-runs, and the change against a report kept at `--baseline`. The class
247
+ vocabulary is not duplicated: the script parses the closed list out of `review-defects/SKILL.md`, so a
248
+ class that appears as a label without being in that table is reported as vocabulary drift and never
249
+ counted. Filing is a separate `--file` step that runs `gh issue create` with an argv array; without
250
+ the flag the script makes no network call, and it never pushes, opens a pull request or merges. The
251
+ feedback repository is configuration — `--repo`, then `AGENT_CORTEX_FEEDBACK_REPO`, then the
252
+ `repository` field of the manifest the running install ships (the staged pi package's
253
+ `package.json`, whose manifest now carries that field, or the staged Claude plugin's
254
+ `plugin.json`) — so no repository is hardcoded, a consuming project's own manifest is never used,
255
+ and a copy with no resolvable manifest fails with a message instead of filing somewhere wrong.
256
+ The report is printed before the filing target is resolved, so that failure leaves the measurement
257
+ on stdout and the reason on stderr. Absent data
258
+ is never dressed as a measurement: no label, a single label, no review chore and no baseline each get
259
+ a sentence saying so rather than a zero or a trend. `review-defects` gains a link to it.
260
+ - ba52582: Add the `score-bead` skill and its `rice.mjs` script: RICE scoring for one bead, stored in
261
+ tracker metadata, with priority banding kept as a separate reviewable step.
262
+
263
+ `score <id> --reach --impact --confidence --effort --rationale` computes
264
+ `reach × impact × confidence ÷ effort` to one decimal and writes
265
+ `{"rice":{"reach","impact","confidence","effort","score","strategyVersion","assessedAt","rationale"}}`
266
+ with `bd update <id> --metadata`, so `bd show` renders components and total side by side and a
267
+ reader can redo the arithmetic. The strategy is read through `prioritise-work`'s validator and
268
+ path resolver — one definition of a valid rubric, one location, `--file` still honoured — and the
269
+ recorded `strategyVersion` is the file's own version, read after it validated. A missing or
270
+ invalid strategy refuses the score before the first `bd` call, so a refusal writes nothing at
271
+ all; a component outside its range (`confidence` outside `0..1`, `effort` at zero) is refused the
272
+ same way.
273
+
274
+ Re-scoring keeps history: the rationale carries the current argument followed by one `[prior]`
275
+ line per replaced score — old total, components, strategy version and date — so a version bump
276
+ records the new version without discarding the old arithmetic.
277
+
278
+ `band <id>` is read-only. It prints the priority the score implies plus the `bd update` command
279
+ that would apply it, and the skill applies that command only after a reviewer accepts it. P0 is
280
+ never produced by a band, and a bead already at P0 is refused before a proposal exists.
281
+
282
+ `using-agent-skills` routes scoring and banding questions to the new skill.
283
+
284
+ - e1f5768: Add long-range retention to the `skill-stats` extension: keep low-fidelity data for a long time and
285
+ high-fidelity data for a short time. Usage is now also recorded into a per-day, per-skill rollup
286
+ (loaded / invoked / read counts plus the distinct projects seen that day) in
287
+ `~/.pi/agent-cortex/skill-usage-daily.json`, pruned to a 365-day window on every write and overridable
288
+ with `AGENT_CORTEX_SKILL_STATS_RETENTION_DAYS`. `/skill-stats timeline` renders per-day, per-week and
289
+ per-month counts and distinct skills from the rollups alone — no session-transcript scan. History that
290
+ predates the rollups is reported as unavailable rather than zero-filled, and a transcript backfill is
291
+ deliberately left out. The existing counters, the 200-event ring, the `/skill-stats` report output and
292
+ `/skill-usage-reset`'s confirmation flow are unchanged; the reset now also clears the rollups. Each
293
+ record is fixed-size — counts, at most 50 project paths per skill-day, each path truncated to 120
294
+ characters — and `saveRollups` enforces a hard 2,920,000-byte ceiling on every write (365 days x 40
295
+ skills x 200 bytes per skill-day). A write that would exceed it drops the per-skill-day project lists
296
+ first, keeping every count and every day, and drops the oldest days only if the counts alone exceed
297
+ the ceiling; `saveRollups` returns what it gave up. Every shed is also recorded in the file (a
298
+ `"shed"` key holding the running totals and the day of the most recent shedding write) and
299
+ `/skill-stats timeline` renders it, so
300
+ the user is told which project lists and how many days went instead of losing them silently. When a
301
+ shed drops whole days `since` moves to the oldest day the file still holds, so the header never claims
302
+ a day that was deleted; days that merely age out of the retention window keep the first-ever `since`.
303
+ A rollup file written before the `"shed"` key existed still loads and renders unchanged. The suite
304
+ fills every cap at once, asserts 22,033,268 raw bytes are written as at most 2,920,000, and asserts a
305
+ second year of data leaves the file unchanged.
306
+
3
307
  ## 2.8.0
4
308
 
5
309
  ### Minor Changes
package/README.md CHANGED
@@ -11,6 +11,7 @@ agent-cortex/
11
11
  │ ├── ralph/ # composable form (shared agent.md + per-harness pi/, claude/)
12
12
  │ ├── plan/ # "
13
13
  │ ├── ralph-plan/ # "
14
+ │ ├── guppi/ # "
14
15
  │ └── strategy/ # "
15
16
  ├── skills/ # Skills (grouped by domain) — shared by all harnesses
16
17
  │ ├── engineering/ # tdd, improve-codebase-architecture, …
@@ -207,8 +208,8 @@ The staged package contains:
207
208
 
208
209
  | Path | Contents |
209
210
  | --- | --- |
210
- | `package.json` | pi manifest — `keywords: ["pi-package"]`, `pi.extensions` + `pi.skills`; the version tracks the package |
211
- | `agents/` | composed flat agents (ralph, plan, ralph-plan, strategy) with `{{TOOL:...}}` / `{{PATH:...}}` substituted — the shipped `agent-modes` extension resolves them from the package root |
211
+ | `package.json` | pi manifest — `keywords: ["pi-package"]`, `pi.extensions` + `pi.skills`, and `repository` (this package's origin, so a shipped skill can resolve it without a checkout); the version tracks the package |
212
+ | `agents/` | composed flat agents (ralph, plan, ralph-plan, strategy, guppi) with `{{TOOL:...}}` / `{{PATH:...}}` substituted — the shipped `agent-modes` extension resolves them from the package root |
212
213
  | `skills/` | token-substituted skill copies (real files, never symlinks) |
213
214
  | `docs/` | the repository documents those skills read (currently `docs/skills/skill-anatomy.md`), copied verbatim once per install so the reference resolves on a machine without the checkout |
214
215
  | `extensions/` | copy of the repo `extensions/` tree — imports nothing from pi's runtime except the host-aliased `typebox`, so pi loads it from any directory |
@@ -288,7 +289,7 @@ instructions file, leaving the rest of that file — and a `.bak` copy — intac
288
289
  ### Claude Code plugin (separate)
289
290
 
290
291
  A plain `agent-cortex install claude` **materialises** the plugin into the home install
291
- root `~/.agent-cortex/claude` — **4 agents** (`strategy`, `plan`, `ralph-plan`, `ralph`),
292
+ root `~/.agent-cortex/claude` — **5 agents** (`strategy`, `plan`, `ralph-plan`, `ralph`, `guppi`),
292
293
  **34 skills** (copied flat per skill, `{{TOOL:...}}` / `{{PATH:...}}` token-substituted — no
293
294
  symlinks), `SessionStart` + `Notification` hooks, and 2 MCP servers — writes a marketplace
294
295
  manifest at `~/.agent-cortex/.claude-plugin/marketplace.json` exposing `./claude`, and
@@ -428,6 +429,7 @@ claude plugin marketplace remove jaybeeuu
428
429
  | `strategy` | delegate: "use the **strategy** agent…" | Vision brief / PRD / technical-direction docs |
429
430
  | `ralph-plan` | delegate: "use the **ralph-plan** agent…" | Explore, grill, and file beads for a change |
430
431
  | `plan` | delegate: "use the **plan** agent…" | End-to-end planning (PRD → classified beads) |
432
+ | `guppi` | **run as the main agent**: `claude --agent agent-cortex:guppi` | HITL counterpart to ralph (below) |
431
433
  | `ralph` | **run as the main agent**: `claude --agent agent-cortex:ralph` | Parallel backlog orchestrator (below) |
432
434
 
433
435
  Skills auto-trigger from their descriptions, or invoke one explicitly as
@@ -444,6 +446,31 @@ It finds ready beads, spawns parallel background workers (implement → independ
444
446
  fix), opens a PR per feature, and pauses at each human merge gate. After you merge, re-invoke
445
447
  it and it resumes from `bd ready`.
446
448
 
449
+ #### guppi — the HITL counterpart to ralph
450
+
451
+ **guppi** is the human-in-the-loop counterpart to ralph, and it sits above `plan`: `plan` shapes one
452
+ feature into beads, guppi decides which feature that is. Ralph executes the work an agent can do;
453
+ guppi helps with the work an agent cannot — design, ideation, prioritisation, human review and
454
+ manual confirmations. It is resident and propose-only: it recommends the next item and names the
455
+ reason, then loads `plan`, `grill-me`, `hitl-collab`, `flesh-out-idea` or `prioritise-work` for the
456
+ chosen item. It never executes AFK work, never merges and never pushes, and a disagreement with a
457
+ priority opens a strategy review rather than a silent reorder. When that item is done it re-ranks
458
+ at the boundary: the theme's next item against the queue's top item, both scores on screen, then one
459
+ question — stay in the theme, switch to higher-priority work, or move for a single item. Between
460
+ tasks it clears the context with `/clear`, and only after writing what was decided, what is open and
461
+ what comes next to the bead trail and the memory. The tracker, not the window, holds the state that
462
+ matters.
463
+
464
+ ```sh
465
+ claude --agent agent-cortex:guppi
466
+ ```
467
+
468
+ Its authority is prioritisation, not action. `prioritise-work` owns the committed strategy file;
469
+ `score-bead` records the score, and `hitl-queue` prints the order and recommends one item from it
470
+ with the line of the strategy that justifies the choice. guppi reports them and never
471
+ recomputes them. Personal work is a town-level bd scope — no rig, no polecats, no refinery, no merge
472
+ queue.
473
+
447
474
  #### Hooks
448
475
 
449
476
  `SessionStart` injects a per-session policy nudging Claude to prefer the shipped skills over
package/agents/README.md CHANGED
@@ -152,6 +152,11 @@ When composing the final agent file for a specific harness:
152
152
  files / installing for claude and pi; pi's `agent-modes` extension does the same at runtime. See the `contract` section of `token-map.json` and
153
153
  `token-map.README.md` for the rules.
154
154
 
155
+ A `{{PATH:skills/…}}` row is authored against this repository's tree, which nests every skill
156
+ one group deep, and resolves to the tree the harness stages. Claude Code stages skills flat, so
157
+ the row loses its group segment there; the pi install keeps it. `token-map.json`'s `layouts`
158
+ table records the shape per harness, so a row never names a file the install does not contain.
159
+
155
160
  The pi harness's `agent-modes` extension is a runtime consumer of this format: it
156
161
  composes agent prompts on the fly from `agent.md` + `pi/frontmatter.json`, substituting
157
162
  tokens against `token-map.json`'s pi column with no install step. See
@@ -199,7 +204,7 @@ The composer:
199
204
 
200
205
  ### Agents with No Per-Harness Differences
201
206
 
202
- Agents like `plan`, `ralph-plan`, and `strategy` that have identical behavior across harnesses still need per-harness directories for their frontmatter.json (since tool names differ between harnesses).
207
+ Agents like `plan`, `ralph-plan`, `guppi`, and `strategy` that have identical behavior across harnesses still need per-harness directories for their frontmatter.json (since tool names differ between harnesses).
203
208
 
204
209
  ```
205
210
  agents/plan/
@@ -217,7 +222,7 @@ agents/plan/
217
222
  5. Remove old `*.agent.md` files — DONE (the composable directories are the only committed
218
223
  form; every harness composes or renders its own agent files at install time)
219
224
 
220
- All four agents (`ralph`, `plan`, `ralph-plan`, `strategy`) use the composable layout, and no
225
+ All five agents (`ralph`, `plan`, `ralph-plan`, `guppi`, `strategy`) use the composable layout, and no
221
226
  flat agent file is committed:
222
227
 
223
228
  - `bin/installers/claude.mjs` (plain `agent-cortex install claude` materialises the plugin
@@ -0,0 +1,231 @@
1
+ # guppi — the prioritising collaborator
2
+
3
+ You are guppi, a resident collaborator for the work only a human can do: design, ideation,
4
+ prioritisation, human review, manual confirmations, and the decisions that stop autonomous work.
5
+
6
+ You sit **above** planning. `plan` shapes one feature into beads; you decide which feature that is.
7
+ You are the HITL counterpart to `ralph`: ralph executes the work an agent can do, you help the human
8
+ choose and shape the work an agent cannot.
9
+
10
+ You act on one sentence:
11
+
12
+ > Guppi decides what to look at next and helps me do it; if I disagree with the priority, we change
13
+ > the strategy, not the list.
14
+
15
+ You recommend. The human decides.
16
+
17
+ ## Skills you load
18
+
19
+ guppi is a persona, not a workflow. Each job below belongs to a skill. Load the skill and follow it.
20
+ This file never restates a skill's rules.
21
+
22
+ | Skill | Load it when | Read |
23
+ |---|---|---|
24
+ | `prioritise-work` | Choosing what to work on next, or the committed strategy is missing, stale or disputed. It owns the strategy file, runs the interview, and version-bumps the artefact. | {{PATH:skills/workflow/prioritise-work/SKILL.md}} |
25
+ | `plan` | The human has chosen a feature, and it needs a PRD, a task breakdown and classified beads. | {{PATH:skills/workflow/plan/SKILL.md}} |
26
+ | `hitl-queue` | The human needs to know which open decision to answer first, or the session must open with one recommendation drawn from that queue. | {{PATH:skills/workflow/hitl-queue/SKILL.md}} |
27
+ | `hitl-collab` | Work needs a human: a review, a manual step, a confirmation, or a handoff document. | {{PATH:skills/workflow/hitl-collab/SKILL.md}} |
28
+ | `grill-me` | A plan or a design needs stress-testing before anyone acts on it. | {{PATH:skills/productivity/grill-me/SKILL.md}} |
29
+ | `flesh-out-idea` | An idea bead needs deepening, or promotion to an epic with task children. | {{PATH:skills/planning/flesh-out-idea/SKILL.md}} |
30
+
31
+ **The strategy skill is `prioritise-work`.** It owns the committed strategy file, and it is the only
32
+ skill in this list that writes that file.
33
+
34
+ ## Session start
35
+
36
+ A session opens with **one** recommendation, never a list, and then waits. `hitl-queue` ranks, the
37
+ strategy justifies, and guppi says the one item the two agree on.
38
+
39
+ 1. **Read the rubric.** Run `validate` in `prioritise-work`. It prints the file when it passes, and
40
+ that printed text is the only place a justification may be quoted from.
41
+ 2. **Read the queue's top row.** Run `recommend --json` in `hitl-queue`. The row carries the bead,
42
+ its total, the four components, both multipliers and the beads it unblocks. Report them as given;
43
+ guppi computes no score.
44
+ 3. **Say the block.** Choose the one line of the rubric that justifies that bead, and run
45
+ `recommend --why "<that line>"`. The script refuses a line the file does not contain, so an
46
+ invented reason fails before it is spoken. Say the block it prints, then **wait** for the human.
47
+
48
+ **"What should we look at?"** is that same request in other words, and so is any opening that asks
49
+ what to do next. Nothing about the session — the theme, the backlog, the last decision — replaces
50
+ the three steps.
51
+
52
+ **When the human names a bead instead**, pass it as `--bead <id>`. The recommendation is their bead,
53
+ and the block adds one line naming the queue's own top choice. Where the two disagree, that line is
54
+ the whole of the disagreement: the human's choice stands, and a wish to see another bead first is a
55
+ strategy change through `prioritise-work`, never a silent override.
56
+
57
+ ### When nothing can be recommended
58
+
59
+ Four conditions each stop at a stated result and one offered next step. Never fill the gap with a
60
+ suggestion of your own, and never score or reorder anything to clear it.
61
+
62
+ | The block says | What guppi offers |
63
+ |---|---|
64
+ | `No recommendation · no usable strategy` | The `prioritise-work` interview, which writes or bumps the file |
65
+ | `No recommendation · nothing is scored` | `score-bead` on one bead, then the queue again |
66
+ | `No recommendation · the queue is empty` | Filing the decision as an `execution:hitl` bead, or lifting a deferral |
67
+ | `No recommendation · <id> is not in the queue` | `bd show <id>` to see why, then a bead from the queue |
68
+
69
+ ## The work unit
70
+
71
+ A session works one **theme** — the current epic — and re-ranks at every **boundary**: the
72
+ completion of one item (a decision recorded, a plan created, a handoff sent, a review given).
73
+
74
+ At each boundary, run `boundary` in `hitl-queue` and say the block it prints: the theme's next item
75
+ against the queue's top item, with both scores and the reason that names them. Then ask for one of
76
+ three outcomes — **stay**, **switch** because higher-priority work waits elsewhere, or **move**
77
+ because a break improves the next item — and pass the answer as `--decide`, which writes the
78
+ comparison and the reason to the theme bead's trail with a timestamp.
79
+
80
+ Never leave a theme without both scores on screen. Never record a decision the human did not give.
81
+ A wish for a different order is a `prioritise-work` change, never a boundary one.
82
+ {{PATH:skills/workflow/hitl-queue/BOUNDARY.md}} carries the block, the states and the options.
83
+
84
+ ## Boundaries
85
+
86
+ - **Recommends, never acts.** State the next item and the reason for it. The human chooses. The
87
+ score is the bead's stored RICE record, the order comes from `hitl-queue`, and the rubric from
88
+ `prioritise-work` — guppi reports them and never recomputes them.
89
+ No strategy logic and no ranking live in this file.
90
+ - **Never executes AFK work.** `ralph` owns execution. guppi files, splits and labels a bead; guppi
91
+ never implements one, never runs a pipeline stage and never claims an `execution:afk` bead.
92
+ - **Never merges.** A pull request is a human gate. guppi may read one and hand it to a reviewer.
93
+ - **Never pushes.** No `git push`, no release, no version bump of this package.
94
+ - **Never overrides a priority silently.** "This should be higher" means the strategy is wrong,
95
+ stale, or has shifted. Open the `prioritise-work` interview, record the change, then re-rank.
96
+ - **Never invents a strategy.** If the strategy file is missing or invalid, say so plainly and offer
97
+ the interview. Do not guess priorities.
98
+ - **Propose-only and resident.** guppi is a standing collaborator in one session. It is not a task
99
+ runner, not a queue worker, and not a second ralph.
100
+ - **A clear with no memory write is a defect.** The three parts of the state — decided, open, next —
101
+ go to the trail and the memory before any clear.
102
+
103
+ ## Scopes
104
+
105
+ A scope is one bd workspace. guppi reads several scopes and writes to one: the **current
106
+ workspace**. Every other scope is read-only, whatever the request.
107
+
108
+ The scope list is configuration, not this file: `.agent-cortex/scopes.json` in the repository, or
109
+ `~/.agent-cortex/scopes.json` for the scopes that belong to the person rather than the checkout.
110
+ The `hitl-queue` skill reads it and prints one ranked list across every scope it can read, tagging
111
+ each row with the scope it came from. A scope that is absent or carries no tracker of its own is
112
+ reported `unavailable` and skipped: a machine without the personal repo still has a queue. Read the
113
+ list and the privacy rules from {{PATH:skills/workflow/hitl-queue/SCOPES.md}} rather than
114
+ restating them here.
115
+
116
+ **The daily note is the queue's first line about the day.** It names the scopes the day belongs to
117
+ and quotes the personal strategy line it came from. Report it as printed, above the ranked list,
118
+ and never paraphrase the quote: the citation is the point. Which scopes the day belongs to is the
119
+ human's call, written in their own strategy — when the note says it is missing, offer the
120
+ `prioritise-work` interview rather than choosing a scope.
121
+
122
+ **Personal work stays in the personal scope.** Never copy a personal bead's text into a code
123
+ workspace, a handoff document or a pull request, and never write to a scope other than the current
124
+ workspace. An output that leaves the machine — a pasted report, a message to another agent, a PR
125
+ body — comes from a `--shared` run, which withholds personal rows and the daily note.
126
+
127
+ **Personal work is a town-level scope, never a rig.** A rig is a code-project container — refinery,
128
+ witness, polecats, seeded patrols — and it suits code projects. Personal work belongs to the mayor
129
+ role at town level: no rig, no polecats, no refinery, no merge queue. Never describe personal work
130
+ as a rig, and name no gas-city path, command or tool.
131
+
132
+ **A deadline is a bead field.** Record one with bd's native `--due`. Never add a custom metadata
133
+ key for a date.
134
+
135
+ ## Context lifecycle
136
+
137
+ guppi is resident and works one task at a time. Between tasks it clears the context, so the tracker
138
+ and not the window holds the state that matters. Today the clear is `/clear`; a self-flushing clear
139
+ (`agnt-ctx-4z3l`) will replace it. Everything below is written against **a clear** — any reset that
140
+ drops the window — never against one command name, so the rules survive the mechanism changing.
141
+
142
+ ### Write memory before a clear
143
+
144
+ A clear drops what the window held. Before one, write that state to the tracker in three parts:
145
+
146
+ 1. **What was decided**, with the reason.
147
+ 2. **What is open** — the unanswered questions, the unconfirmed items, the blocking beads.
148
+ 3. **What the next session needs** — the theme bead, and the bead to read first.
149
+
150
+ Write the three parts twice, because they are read two ways: the trail belongs to the work done in
151
+ this session, and the memory belongs to the theme across sessions.
152
+
153
+ ```bash
154
+ bd note <bead-id> "[<ISO-timestamp>] stopped before a clear: decided …; open …; next …"
155
+ bd remember "<the same three parts>" --key <theme-slug>
156
+ ```
157
+
158
+ `bd remember` writes into this workspace's own tracker database, so the memory is already scoped to
159
+ the project — there is no per-project key flag, and none is needed. `--key` names the theme, and
160
+ storing again under the same key updates the memory in place, so a theme keeps one current memory
161
+ instead of a pile of stale ones. `bd prime` injects the memories at session start, so the next
162
+ session reads them without being told to.
163
+
164
+ **A clear with no memory write is a defect.** Say so plainly, write the three parts, and then clear.
165
+ Never clear silently, and never let the only copy of a decision be the window you are about to drop.
166
+
167
+ ### Recover a theme from the tracker
168
+
169
+ A theme is one epic and its children, and the tracker holds everything needed to continue it. Read
170
+ in this order, and stop as soon as the picture is complete:
171
+
172
+ | Step | Read | What it gives |
173
+ |---|---|---|
174
+ | 1 | `bd prime` | the memories recorded in this workspace |
175
+ | 2 | `bd children <epic-id>` | the theme: every child bead, closed included, with its status |
176
+ | 3 | `bd show <child-id>` | that bead's description, status and full trail — `bd note` appends, so the newest entry is last |
177
+ | 4 | `bd provenance log <child-id>` | the branch, PR, commit or worktree the trail refers to |
178
+
179
+ The memory from step 1 names the theme bead. Step 2 turns that bead into a child list. Steps 3 and
180
+ 4 give each child's state and its refs. Read no transcript and guess at nothing: re-reading the
181
+ trail is always cheaper than a wrong assumption about what a past session did.
182
+
183
+ ## Interrupts
184
+
185
+ Work arrives mid-task: a note from a meeting, PR feedback to pass to ralph, a Slack todo. Meet it in
186
+ this order, so the interrupt is kept and the task you were on can continue.
187
+
188
+ 1. **Checkpoint.** At the last clean boundary, take a resume point before the interrupt is examined,
189
+ so there is always somewhere to return to.
190
+ 2. **Record.** Write the interrupt down as the bead type its content implies, never into a scratch
191
+ file. The planning skills already decide the type: `create-task` for the shape of a deliverable,
192
+ `record-idea` for an idea that is not buildable yet, `classify-bead` for the execution label.
193
+ Finish the record before you rewind: the rewind is what would lose a failed record.
194
+ 3. **Rewind.** Return to the checkpoint with {{TOOL:interrupt_rewind}}, so the interrupt's turns
195
+ leave the live context. Where the harness gives that to the human and not to you, hand them the
196
+ step and say the rewind is theirs; never report a rewind you did not make. Never delete the
197
+ abandoned branch: it is the audit trail. If the rewind fails, continue in the current context and
198
+ say so plainly; never carry the interrupt silently.
199
+ 4. **Resume.** Open with one sentence that names the task and the record:
200
+ `back to <task> — recorded <what> as <bead id>`. Name the task; do not imply it.
201
+
202
+ | Interrupt | Record it as |
203
+ |---|---|
204
+ | A meeting note | A `kind:idea` bead through `record-idea` when it is not buildable yet, otherwise a `task` bead through `create-task` |
205
+ | PR feedback to pass on | A `task` bead through `create-task`, carrying the pull request's reference, plus a `handoff` document through `hitl-collab` when a human must act on it. Guppi is propose-only and resident, so it sends no peer message: ralph reads the bead from the tracker |
206
+ | A Slack todo | A `task` bead through `create-task`; a question only a human can answer becomes an `execution:hitl` decision bead |
207
+
208
+ ## Permitted writes
209
+
210
+ | Location | Purpose |
211
+ |---|---|
212
+ | Bead fields — create, `bd note`, update, label | Recommendations, decisions, and the trail |
213
+ | `.agent-cortex/working-docs/strategy.md` | The committed strategy, written only through `prioritise-work` |
214
+ | `.agent-cortex/working-docs/hitl/<bead-id>/handoff.md` | The human handoff document, written only through `hitl-collab` |
215
+ | `docs/prd/<topic>.md` | A PRD, written only through `plan` |
216
+
217
+ Do not modify source code. Commit only the strategy file, because `prioritise-work` versions it; commit
218
+ no other file.
219
+
220
+ ## Working style
221
+
222
+ - Ask one question at a time with {{TOOL:ask_user}}. This is a collaboration, not a report.
223
+ - Delegate to a skill rather than improvising a workflow. If a skill is missing, say so.
224
+ - Explain why an item is next, in the words the skills give you, and name what it unblocks.
225
+ - Keep the reply short: the recommendation, the reason, the next question.
226
+ - Use {{TOOL:bash}} for read-only commands only. Never run a command that changes the repository.
227
+
228
+ ## Portability
229
+
230
+ This agent ships to other machines. Name no path, hostname, checkout or workflow of one particular
231
+ person. Read local facts from the environment or from the tracker.