@jaybeeuu/agent-cortex 2.7.0 → 2.9.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 (87) hide show
  1. package/CHANGELOG.md +412 -0
  2. package/README.md +87 -8
  3. package/agents/README.md +4 -4
  4. package/agents/guppi/agent.md +162 -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/agent.md +17 -16
  9. package/agents/ralph/claude/wake.md +4 -4
  10. package/agents/ralph/pi/wake.md +15 -20
  11. package/agents/ralph-plan/agent.md +6 -0
  12. package/bin/agent-cortex.mjs +20 -1
  13. package/bin/installers/claude.mjs +1 -20
  14. package/bin/installers/pi.mjs +8 -2
  15. package/extensions/interrupt-bookmark/README.md +129 -0
  16. package/extensions/interrupt-bookmark/index.test.ts +717 -0
  17. package/extensions/interrupt-bookmark/index.ts +354 -0
  18. package/extensions/interrupt-bookmark/package.json +20 -0
  19. package/extensions/post-merge-watch/README.md +133 -0
  20. package/extensions/post-merge-watch/index.test.ts +247 -0
  21. package/extensions/post-merge-watch/index.ts +123 -0
  22. package/extensions/post-merge-watch/package.json +16 -0
  23. package/extensions/post-merge-watch/watch.test.ts +469 -0
  24. package/extensions/post-merge-watch/watch.ts +431 -0
  25. package/extensions/session-clear/README.md +74 -0
  26. package/extensions/session-clear/index.test.ts +524 -0
  27. package/extensions/session-clear/index.ts +159 -0
  28. package/extensions/session-clear/package.json +16 -0
  29. package/extensions/skill-stats/README.md +84 -3
  30. package/extensions/skill-stats/index.ts +62 -3
  31. package/extensions/skill-stats/package.json +1 -1
  32. package/extensions/skill-stats/rollup.test.ts +643 -0
  33. package/extensions/skill-stats/rollup.ts +415 -0
  34. package/extensions/skill-stats/timeline.ts +101 -0
  35. package/lib/cli.mjs +42 -1
  36. package/lib/self-update.mjs +553 -0
  37. package/package.json +1 -1
  38. package/scripts/lib/manifest.mjs +29 -0
  39. package/skills/engineering/implement-task/SKILL.md +124 -0
  40. package/skills/engineering/tdd/SKILL.md +2 -0
  41. package/skills/planning/create-task/REFERENCE.md +15 -6
  42. package/skills/planning/create-task/SKILL.md +1 -1
  43. package/skills/planning/create-task/pipeline.json +8 -0
  44. package/skills/planning/create-task/scripts/create-chores.mjs +27 -18
  45. package/skills/planning/create-task/templates/code.md +8 -3
  46. package/skills/planning/create-task/templates/document.md +8 -3
  47. package/skills/planning/create-task/templates/fix.md +8 -3
  48. package/skills/planning/create-task/templates/housekeeping.md +8 -4
  49. package/skills/planning/create-task/templates/post-merge.md +67 -0
  50. package/skills/planning/create-task/templates/review.md +8 -3
  51. package/skills/planning/create-task/templates/verify.md +8 -3
  52. package/skills/productivity/bd-tool/SKILL.md +55 -0
  53. package/skills/review/review-defects/EXAMPLES.md +198 -0
  54. package/skills/review/review-defects/SKILL.md +121 -0
  55. package/skills/review/review-report/EXAMPLES.md +114 -0
  56. package/skills/review/review-report/SKILL.md +138 -0
  57. package/skills/review/review-report/scripts/report.mjs +1032 -0
  58. package/skills/style/style-tests/EXAMPLES.md +30 -0
  59. package/skills/style/style-tests/SKILL.md +10 -6
  60. package/skills/workflow/hitl-queue/SKILL.md +134 -0
  61. package/skills/workflow/hitl-queue/scripts/queue.mjs +626 -0
  62. package/skills/workflow/plan/SKILL.md +27 -3
  63. package/skills/workflow/prioritise-work/CHALLENGE.md +139 -0
  64. package/skills/workflow/prioritise-work/SKILL.md +150 -0
  65. package/skills/workflow/prioritise-work/scripts/challenge.mjs +505 -0
  66. package/skills/workflow/prioritise-work/scripts/strategy.mjs +566 -0
  67. package/skills/workflow/prioritise-work/templates/strategy.md +61 -0
  68. package/skills/workflow/ralph/REFERENCE.md +124 -27
  69. package/skills/workflow/ralph/SKILL.md +24 -15
  70. package/skills/workflow/ralph/scripts/post-merge-check.mjs +651 -0
  71. package/skills/workflow/run-pipeline-stage/SKILL.md +37 -22
  72. package/skills/workflow/run-pipeline-stage/playbooks/code.md +14 -8
  73. package/skills/workflow/run-pipeline-stage/playbooks/document.md +2 -2
  74. package/skills/workflow/run-pipeline-stage/playbooks/fix.md +2 -2
  75. package/skills/workflow/run-pipeline-stage/playbooks/housekeeping.md +1 -1
  76. package/skills/workflow/run-pipeline-stage/playbooks/post-merge.md +54 -0
  77. package/skills/workflow/run-pipeline-stage/playbooks/review.md +37 -3
  78. package/skills/workflow/run-pipeline-stage/playbooks/verify.md +2 -2
  79. package/skills/workflow/run-pipeline-stage/prompts/stage-runner.md +55 -11
  80. package/skills/workflow/run-pipeline-stage/scripts/recover-brief.mjs +805 -0
  81. package/skills/workflow/run-pipeline-stage/scripts/trail-entry.mjs +702 -0
  82. package/skills/workflow/score-bead/FORMAT.md +73 -0
  83. package/skills/workflow/score-bead/SKILL.md +112 -0
  84. package/skills/workflow/score-bead/scripts/rice.mjs +664 -0
  85. package/skills/workflow/using-agent-skills/SKILL.md +21 -8
  86. package/token-map.README.md +27 -0
  87. package/token-map.json +16 -4
@@ -0,0 +1,129 @@
1
+ # Interrupt Bookmark Extension
2
+
3
+ Gives an agent a checkpoint and a rewind, so an interruption does not drag its turns into the
4
+ context the original task then has to carry.
5
+
6
+ PI can rewind a session tree and summarise the branch it abandons. Nothing exposed that as a
7
+ deliberate operation, so an interruption — a meeting note, PR feedback to pass on, a Slack todo —
8
+ stayed in the live context and the task carried it. This extension adds two tools around pi's own
9
+ navigation: one records a resume point, one returns to it.
10
+
11
+ ## Usage
12
+
13
+ | Tool | Description |
14
+ | `interrupt_checkpoint` | Records the current leaf id and returns it |
15
+ | `interrupt_resume` | Rewinds to a checkpoint, keeps the abandoned branch under a summary, and ends the turn |
16
+
17
+ `interrupt_resume` takes `{ checkpointId, summary }`. `summary` describes the interruption; it
18
+ reaches pi's summariser as `customInstructions`.
19
+
20
+ After the turn settles, the rewind happens on its own: the abandoned branch is summarised by pi,
21
+ the summary entry is labelled `interrupt`, and the session continues from the checkpoint. The
22
+ summary is reported in the session (a notification and an `interrupt-rewind` custom entry), not in
23
+ the tool result — the tool call is part of the branch that the rewind summarises.
24
+
25
+ Nothing is deleted. The abandoned branch stays in the session file and in `/tree`, under the
26
+ summary. No model call is made by this extension: the summary comes from pi's own tree-navigation
27
+ summariser.
28
+
29
+ ## The two steps, and why they are two
30
+
31
+ `waitForIdle()` and `navigateTree()` exist on `ExtensionCommandContext` only. The installed
32
+ `types.d.ts` (pi 1.5.2) declares them there, and `docs/extensions.md` states the reason: they
33
+ deadlock when called while the turn that invoked them is still running. A tool receives
34
+ `ExtensionToolContext`, which has no `navigateTree` at all, and the session itself throws while it
35
+ is streaming — which it always is during a tool call.
36
+
37
+ So `interrupt_resume` cannot navigate. It validates the request, records it, and returns
38
+ `terminate: true`. An `agent_settled` handler then dispatches `/interrupt-rewind <checkpointId>`
39
+ through `sendUserMessage(..., { expandPromptTemplates: true })`, which runs the command rather than
40
+ prompting the model. That is the pattern pi documents for a tool that must reach a command-only API
41
+ (`docs/extensions.md`, "ctx.reload()").
42
+
43
+ The declared navigation signature, quoted from the installed package's own
44
+ `dist/core/extensions/types.d.ts`:
45
+
46
+ ```ts
47
+ navigateTree(targetId: string, options?: {
48
+ summarize?: boolean;
49
+ customInstructions?: string;
50
+ replaceInstructions?: boolean;
51
+ label?: string;
52
+ }): Promise<{ cancelled: boolean }>;
53
+ ```
54
+
55
+ Every option name here is real: `summarize`, `customInstructions`, `replaceInstructions` and
56
+ `label`. `label` is applied to the branch-summary entry when `summarize` is set, and to the target
57
+ entry when it is not.
58
+
59
+ ## Failure modes
60
+
61
+ | Case | Behaviour |
62
+ | Unknown checkpoint id | Fails before anything is written, naming the id |
63
+ | Already at the checkpoint | Reports that there is no interrupt to summarise, and writes nothing |
64
+ | Session still streaming | Waits for idle first, then navigates |
65
+ | Navigation rejected | Retries once, after another wait for idle; a second failure reports the reason and leaves the session unchanged |
66
+ | A second rewind requested | Refused while the first is scheduled |
67
+
68
+ A failed rewind records `ok: false` and the reason, and tells the caller to continue in the current
69
+ context rather than silently carrying the interruption.
70
+
71
+ ## What this extension does not do
72
+
73
+ - It does not decide when to checkpoint or what to record. The interrupt protocol belongs to the
74
+ agent that asks for the checkpoint.
75
+ - It cannot report the summary entry in the tool result, for the reason above.
76
+ - It needs a harness that dispatches extension commands. Where the command never runs, the rewind
77
+ reports that nothing was pending and the session is unchanged.
78
+
79
+ ## Claude Code parity
80
+
81
+ The mechanism differs in kind between harnesses, so it is named once through `token-map.json`: the
82
+ `interrupt_rewind` row renders as `interrupt_resume` on pi and as Claude Code's own `/rewind` on
83
+ claude. Claude Code checkpoints and rewinds with a user command rather than a model-callable tool,
84
+ so prose that names the row must describe only what both do — the session returns to an earlier
85
+ point and the abandoned turns leave the live context — never a call shape, and it must say who
86
+ acts: the agent where the harness gives it a tool, the human where the harness gives it a user
87
+ command. The row is consumed by `agents/guppi/agent.md`'s interrupt protocol, which checkpoints,
88
+ records the interrupt, rewinds and resumes; `test/guppi-interrupt-render.test.mjs` stages both
89
+ installs to prove the fork.
90
+
91
+ Both halves are wired per harness. guppi's pi frontmatter declares this extension's
92
+ `interrupt_checkpoint` and `interrupt_resume` in its tool list, so steps 1 and 3 of the protocol are
93
+ callable there. On claude the agent declares neither, because `/rewind` is the human's command, and
94
+ the protocol hands that step to the human.
95
+
96
+ An agent that uses these tools declares them in its own tool list, under the registered names
97
+ `interrupt_checkpoint` and `interrupt_resume`. pi replaces the whole tool selection when a list is
98
+ given. A tool an agent does not name is therefore never declared to its model, and the agent cannot
99
+ call it. A tool list carries tool names only, so the `interrupt_rewind` prose row never appears in
100
+ one.
101
+
102
+ ## Proven against pi
103
+
104
+ Behaviour is tested against a complete `ExtensionAPI` double, with a fake session that rejects
105
+ navigation while a response is active, exactly as pi does. Only the **pi** install is staged and
106
+ loaded by `test/pi-extensions-load.test.mjs`: `bin/installers/pi.mjs` copies `extensions/` into the
107
+ staged package, so that test loads this extension from a temp directory outside the checkout. It
108
+ covers no claude install, because there is no claude extension to load — `bin/installers/claude.mjs`
109
+ generates agents, skills, hooks and docs, and copies no `extensions/` tree at all.
110
+
111
+ The claude side was therefore checked by hand, not by a test of this extension: `/rewind` is one of
112
+ the commands the installed Claude Code CLI defines itself (verified in 2.1.294), and the
113
+ `interrupt_rewind` row renders as `interrupt_resume` on pi and `/rewind` on claude when the token is
114
+ substituted directly. The row's consumer is guppi's interrupt protocol, and
115
+ `test/guppi-interrupt-render.test.mjs` checks both staged renders; this hand check is what
116
+ established the claude name before that test existed.
117
+
118
+ The session shape a rewind produces was checked against pi's own `SessionManager` separately:
119
+ `branchWithSummary()` plus the label change leaves a `branch_summary` entry parented at the
120
+ checkpoint, with `fromId` naming the abandoned leaf, every original entry still present, and the
121
+ label recorded. A full session run — a real summariser call and a live `/tree` — needs a configured
122
+ model and was not exercised here.
123
+
124
+ ## Development
125
+
126
+ ```bash
127
+ pnpm test # behaviour: capture, refusal, dispatch, rewind, retry, branch retention
128
+ pnpm typecheck # tsc --noEmit, which also checks the complete ExtensionAPI double
129
+ ```