@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
@@ -26,9 +26,15 @@ Task arrives
26
26
  ├── Spec approved, need tickets? ───────→ spec-to-tickets
27
27
  ├── Need a single task tracked? ────────→ create-task
28
28
  ├── Need to plan a feature end-to-end? ─→ plan
29
+ ├── Deciding what to work on next? ─────→ guppi
30
+ │ └── Strategy stale or missing? ────→ prioritise-work
31
+ ├── Scoring or banding one bead? ──────→ score-bead
32
+ ├── Ranking the HITL decision queue? ──→ hitl-queue
33
+ ├── Collaborating on HITL work? ────────→ guppi
29
34
  ├── Running beads / task execution? ────→ ralph
30
35
  │ └── Single stage? ─────────────────→ run-pipeline-stage
31
- ├── Implementing code? ────────────────→ tdd
36
+ ├── Implementing a task? ──────────────→ implement-task
37
+ │ ├── Proving one behaviour? ────────→ tdd
32
38
  │ ├── Designing an interface? ───────→ design-an-interface
33
39
  │ └── Need style conventions? ───────→ style-code
34
40
  ├── Reviewing code? ───────────────────→ style-code
@@ -42,7 +48,7 @@ Task arrives
42
48
  ├── Evaluating architecture? ──────────→ technical-direction
43
49
  ├── Finding refactor opportunities? ───→ improve-codebase-architecture
44
50
  ├── Need task tracking? ───────────────→ bd-tool
45
- ├── Need human review / HITL? ─────────→ hitl-collab
51
+ ├── Need a human handoff document? ────→ hitl-collab
46
52
  ├── Need a handoff doc? ───────────────→ handoff
47
53
  ├── Writing a ticket for Jira? ────────→ write-a-ticket
48
54
  ├── Creating a new skill? ─────────────→ write-a-skill
@@ -97,12 +103,19 @@ For a complete feature, the typical skill sequence is:
97
103
  4. `prd-to-tasks` → Break into verifiable chunks
98
104
  5. `plan` → Orchestrate the full flow end-to-end
99
105
  6. `ralph` → Execute all pending beads
100
- 7. `tdd` → Prove each slice works
101
- 8. `style-code` → Review before merge
102
- 9. `review-security` → Check for secrets
103
- 10. `git-workflow` → Clean commit history
104
-
105
- Not every task needs every skill. A bug fix might only need: `tdd` → `style-code` → `review-security`.
106
+ 7. `implement-task` → Own the criteria, the scope, and the proof
107
+ 8. `tdd` → Prove each slice works
108
+ 9. `style-code` → Review before merge
109
+ 10. `review-security` → Check for secrets
110
+ 11. `git-workflow` → Clean commit history
111
+
112
+ Not every task needs every skill. A bug fix might only need: `implement-task` → `tdd` →
113
+ `style-code` → `review-security`.
114
+
115
+ Routing boundary: `implement-task` owns the request — its criteria, its scope, its evidence. `tdd`
116
+ owns the loop inside one criterion, and answers "how do I prove this behaviour" once the task is
117
+ already understood. A request with acceptance criteria to satisfy starts at `implement-task`; a
118
+ bare "write a test for X" still starts at `tdd`.
106
119
 
107
120
  ## Red Flags
108
121
 
@@ -51,6 +51,22 @@ rather than inventing a dotted form:
51
51
  `ask_user`) — and `task` / `read_agent` / `wait_for_agents` subagent tools, the last three
52
52
  supplied by this repo's own `extensions/subagent` rather than by pi; `skill` maps
53
53
  to `read` (skills load by reading the listed SKILL.md path).
54
+ Two rows carry session-to-session messaging rather than a built-in tool: `peer_send` and
55
+ `peer_list`. On claude they are Claude Code's own `SendMessage` and `ListAgents`; on pi they
56
+ are the `pi-peer` package's tools, which the consuming repository installs itself. A row maps
57
+ a **name, never a protocol**: the message kinds and the acknowledgement rule layered above
58
+ the transport are harness-invariant text, so only the transport forks and the protocol stays
59
+ in one authored copy.
60
+ One row names who waits for a CI run that outlives a check's own wait window:
61
+ `post_merge_watch`. Its two values differ in kind — this package's own `post-merge-watch`
62
+ extension on pi, Claude Code's built-in `ScheduleWakeup` tool on claude — so the prose around
63
+ it describes only what both do (the session resumes, the check runs again) and never a call
64
+ shape.
65
+ Both values are a **self-paced re-prompt, not an event subscription**: the session asks to be
66
+ woken and looks again on waking. Claude Code also supplies an event-watching `Monitor` tool,
67
+ but that tool is gated behind a feature flag that defaults off, so a portable skill may not
68
+ depend on it. Naming the re-prompt is what holds on every session; the playbook's prose
69
+ fallback covers the session where even that is absent.
54
70
  - **`paths`** — `plugin_root`, `agents_dir`, `skills_dir`, and `skill_anatomy`. These are the
55
71
  install-time variables that differ per harness. `plugin_root` is the anchor; the others
56
72
  resolve relative to it (`{base, relative}` specs) so a harness only overrides the single
@@ -102,6 +118,17 @@ Unknown (unmapped) tokens are a **hard error**, not a null — a silently-passed
102
118
  token is exactly the bug the map exists to prevent, and mirrors the build script's
103
119
  `unknown tool "x"` throw.
104
120
 
121
+ The peer channel is the worked example. `peer_get` and `peer_await` are `pi-peer` tools and
122
+ Claude Code has no equivalent, so they get no row and a shared sentence never names them:
123
+ substituting one would drop the token and leave the sentence that named it short of a name.
124
+ Their documentation stays inside a section labelled for one harness, where nothing is
125
+ substituted — see the `pi-peer` runbook in `skills/workflow/ralph/REFERENCE.md`.
126
+
127
+ `post_merge_watch` is deliberately **not** null on either side: a null would drop the token in the
128
+ pi render or the claude render and leave the sentence that named the mechanism short of one. The
129
+ fallback for a session that has no watcher is therefore written as prose in the same section, so
130
+ it survives both renders unchanged — see `skills/workflow/run-pipeline-stage/playbooks/post-merge.md`.
131
+
105
132
  The pi install-time installer (`bin/installers/pi.mjs`) follows the strict contract above.
106
133
  One consumer deviates deliberately: the pi `agent-modes` extension reads the map at
107
134
  **runtime** (not install time) to compose agent prompts from the composable agents
package/token-map.json CHANGED
@@ -25,7 +25,13 @@
25
25
  "skill": { "claude": "Skill", "pi": "read" },
26
26
  "task": { "claude": "Task", "pi": "task" },
27
27
  "read_agent": { "claude": null, "pi": "read_agent" },
28
- "wait_for_agents": { "claude": null, "pi": "wait_for_agents" }
28
+ "wait_for_agents": { "claude": null, "pi": "wait_for_agents" },
29
+ "peer_send": { "claude": "SendMessage", "pi": "peer_send" },
30
+ "peer_list": { "claude": "ListAgents", "pi": "peer_list" },
31
+ "post_merge_watch": { "claude": "ScheduleWakeup", "pi": "post-merge-watch" },
32
+ "interrupt_rewind": { "claude": "/rewind", "pi": "interrupt_resume" },
33
+ "interrupt_checkpoint": { "claude": null, "pi": "interrupt_checkpoint" },
34
+ "interrupt_resume": { "claude": null, "pi": "interrupt_resume" }
29
35
  },
30
36
  "paths": {
31
37
  "plugin_root": {
@@ -62,8 +68,8 @@
62
68
  "claude": "event-driven"
63
69
  },
64
70
  "notes": {
65
- "pi": "Blocking wait: wait_for_agents returns as soon as one worker finishes, carrying its result inline. No timer to start, nothing to kill — there is no poll loop.",
66
- "claude": "Event-driven: the harness re-invokes ralph when a worker completes and delivers the result inline. No poll timer, no sleep, no log flush."
71
+ "pi": "Blocking wait: wait_for_agents returns as soon as one worker finishes, carrying its result inline. No timer to start, nothing to kill — there is no poll loop. Progress is read from the bead trail the worker writes (`bd show`, `bd provenance log`).",
72
+ "claude": "Event-driven: the harness re-invokes ralph when a worker completes and delivers the result inline. No poll timer and no sleep. Progress is read from the bead trail the worker writes (`bd show`, `bd provenance log`), never from a file ralph tails."
67
73
  }
68
74
  },
69
75
  "notes": {
@@ -75,7 +81,13 @@
75
81
  "skill": "Claude (Skill) exposes skills as a tool. pi has no dedicated skill tool — skills are surfaced in the always-present 'Available skills' context block and loaded by reading the listed SKILL.md path ({{PATH:<skill>/SKILL.md}}). The pi mapping is read, the tool used to load a skill's file; a dedicated skill tool is a follow-on design candidate if prompting proves insufficient.",
76
82
  "read_agent": "Claude's Task returns results inline — there is no separate read step, so read_agent drops on claude (null). pi exposes read_agent as a fallback to wait_for_agents.",
77
83
  "task": "Claude provides a subagent tool natively. On pi it is supplied by this repo's own extensions/subagent extension (which also registers read_agent and wait_for_agents), not by pi itself — a pi session started before that extension was installed has no dispatch tool at all. Skills must therefore stop and report a missing subagent tool rather than improvising a backgrounded CLI run, which has no completion signal.",
78
- "wait_for_agents": "PI-only blocking wait over background subagent runs (the task tool): returns the results of completed agents and STILL RUNNING for the rest. Claude's Task delivers results inline with no wait step — null on claude."
84
+ "wait_for_agents": "PI-only blocking wait over background subagent runs (the task tool): returns the results of completed agents and STILL RUNNING for the rest. Claude's Task delivers results inline with no wait step — null on claude.",
85
+ "peer_send": "Session-to-session message send. pi takes it from the published pi-peer package (an ordinary package the consuming repository installs itself, never a dependency of this one). Claude Code has it built in and its docs name it there. Both address a peer by the name or address their own list reports, and neither send is proof of receipt. Only sends and discovery are tokenised: pi-peer's peer_get and peer_await have no Claude Code equivalent, and a null claude mapping drops the token and leaves the sentence that named it broken, so harness-varying prose must never name them — such passages stay inside a harness-labelled runbook.",
86
+ "peer_list": "Peer discovery: the peers that can receive a message, and the address each is reached by. pi's is the pi-peer package's tool. Claude Code's built-in equivalent is ListAgents (an earlier binary named it ListPeers), which also reports reachability and so doubles as the peer-state read.",
87
+ "post_merge_watch": "Who waits for a CI run that outlives the check's own wait window. The row maps a name, not a protocol: the verdicts and the escalation rule layered above it are harness-invariant text, so only the mechanism is tokenised. pi's name is this package's own post-merge-watch extension, which re-runs the check on a timer and wakes an idle session with the verdict. Claude Code's is its built-in ScheduleWakeup tool, which schedules the session's own resumption so it can re-run the check. The values differ in kind — an extension on pi, a tool on claude — because that is what each harness supplies; the surrounding prose therefore describes only what both do (the session resumes, the check runs again, the verdict table is unchanged) and never a call shape.",
88
+ "interrupt_rewind": "How an interrupted task returns to its checkpoint and leaves the interruption behind. Consumed by agents/guppi/agent.md's interrupt protocol, which names the row once and states the checkpoint, record, rewind and resume steps around it. The row maps a name, not a protocol: pi's name is this package's own interrupt-bookmark extension's resume tool, which rewinds the session tree and has pi's summariser keep the abandoned branch under a branch summary labelled `interrupt`. Claude Code's is its built-in /rewind command, which restores the conversation and the file checkpoints taken for it. The values differ in kind — a model-callable tool on pi, a user-facing command on claude — because that is what each harness supplies. Constraints on the prose: it must describe only what both do (the session returns to the earlier point, and the interrupt's turns leave the live context) and never a call shape; it must also state who acts, because the actor forks with the kind — guppi performs the rewind where the harness gives it a tool, and hands it to the human where the harness gives it a user command; and it must not tokenise the checkpoint half, because Claude Code checkpoints on its own while pi needs a tool call, and a null claude column would drop the token and leave the sentence that named it broken. test/guppi-interrupt-render.test.mjs stages both installs to prove the fork.",
89
+ "interrupt_checkpoint": "The checkpoint half of the interrupt protocol, pi-only: guppi takes a resume point by calling this tool, while Claude Code checkpoints on its own with no tool to call, so the claude column is null and no claude frontmatter lists it. It is a tool-list row, not a prose row — prose must never tokenise it, for the reason recorded on interrupt_rewind.",
90
+ "interrupt_resume": "The resume tool as a tool-list row, for an agent that declares its tools per harness (guppi lists it in agents/guppi/pi/frontmatter.json). It is distinct from the interrupt_rewind prose row, which maps the same pi name to Claude Code's user-run /rewind: a tool list cannot carry /rewind, because the agent cannot call a user command, so the claude column is null and no claude frontmatter lists it."
79
91
  },
80
92
  "paths": {
81
93
  "pi": "plugin_root is the staged package `agent-cortex install pi` materialises at ~/.agent-cortex/pi; pi loads that directory by path and the shipped extensions resolve their own resources relative to it (agent-modes computes plugin_root from its actual install location). A checkout or symlinked install differs — installers compute plugin_root from the actual resolution and can override it (--plugin-root).",