@jaybeeuu/agent-cortex 2.7.0 → 2.8.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 (56) hide show
  1. package/CHANGELOG.md +239 -0
  2. package/README.md +61 -5
  3. package/agents/README.md +2 -2
  4. package/agents/ralph/agent.md +17 -16
  5. package/agents/ralph/claude/wake.md +4 -4
  6. package/agents/ralph/pi/wake.md +15 -20
  7. package/bin/agent-cortex.mjs +20 -1
  8. package/extensions/post-merge-watch/README.md +133 -0
  9. package/extensions/post-merge-watch/index.test.ts +247 -0
  10. package/extensions/post-merge-watch/index.ts +123 -0
  11. package/extensions/post-merge-watch/package.json +16 -0
  12. package/extensions/post-merge-watch/watch.test.ts +469 -0
  13. package/extensions/post-merge-watch/watch.ts +431 -0
  14. package/extensions/session-clear/README.md +74 -0
  15. package/extensions/session-clear/index.test.ts +524 -0
  16. package/extensions/session-clear/index.ts +159 -0
  17. package/extensions/session-clear/package.json +16 -0
  18. package/lib/cli.mjs +42 -1
  19. package/lib/self-update.mjs +553 -0
  20. package/package.json +1 -1
  21. package/skills/engineering/implement-task/SKILL.md +124 -0
  22. package/skills/engineering/tdd/SKILL.md +2 -0
  23. package/skills/planning/create-task/REFERENCE.md +15 -6
  24. package/skills/planning/create-task/SKILL.md +1 -1
  25. package/skills/planning/create-task/pipeline.json +8 -0
  26. package/skills/planning/create-task/scripts/create-chores.mjs +27 -18
  27. package/skills/planning/create-task/templates/code.md +8 -3
  28. package/skills/planning/create-task/templates/document.md +8 -3
  29. package/skills/planning/create-task/templates/fix.md +8 -3
  30. package/skills/planning/create-task/templates/housekeeping.md +8 -4
  31. package/skills/planning/create-task/templates/post-merge.md +67 -0
  32. package/skills/planning/create-task/templates/review.md +8 -3
  33. package/skills/planning/create-task/templates/verify.md +8 -3
  34. package/skills/productivity/bd-tool/SKILL.md +55 -0
  35. package/skills/review/review-defects/EXAMPLES.md +122 -0
  36. package/skills/review/review-defects/SKILL.md +91 -0
  37. package/skills/style/style-tests/EXAMPLES.md +30 -0
  38. package/skills/style/style-tests/SKILL.md +10 -6
  39. package/skills/workflow/plan/SKILL.md +14 -3
  40. package/skills/workflow/ralph/REFERENCE.md +124 -27
  41. package/skills/workflow/ralph/SKILL.md +24 -15
  42. package/skills/workflow/ralph/scripts/post-merge-check.mjs +651 -0
  43. package/skills/workflow/run-pipeline-stage/SKILL.md +37 -22
  44. package/skills/workflow/run-pipeline-stage/playbooks/code.md +14 -8
  45. package/skills/workflow/run-pipeline-stage/playbooks/document.md +2 -2
  46. package/skills/workflow/run-pipeline-stage/playbooks/fix.md +2 -2
  47. package/skills/workflow/run-pipeline-stage/playbooks/housekeeping.md +1 -1
  48. package/skills/workflow/run-pipeline-stage/playbooks/post-merge.md +54 -0
  49. package/skills/workflow/run-pipeline-stage/playbooks/review.md +34 -3
  50. package/skills/workflow/run-pipeline-stage/playbooks/verify.md +2 -2
  51. package/skills/workflow/run-pipeline-stage/prompts/stage-runner.md +55 -11
  52. package/skills/workflow/run-pipeline-stage/scripts/recover-brief.mjs +805 -0
  53. package/skills/workflow/run-pipeline-stage/scripts/trail-entry.mjs +702 -0
  54. package/skills/workflow/using-agent-skills/SKILL.md +15 -7
  55. package/token-map.README.md +27 -0
  56. package/token-map.json +10 -4
@@ -28,7 +28,8 @@ Task arrives
28
28
  ├── Need to plan a feature end-to-end? ─→ plan
29
29
  ├── Running beads / task execution? ────→ ralph
30
30
  │ └── Single stage? ─────────────────→ run-pipeline-stage
31
- ├── Implementing code? ────────────────→ tdd
31
+ ├── Implementing a task? ──────────────→ implement-task
32
+ │ ├── Proving one behaviour? ────────→ tdd
32
33
  │ ├── Designing an interface? ───────→ design-an-interface
33
34
  │ └── Need style conventions? ───────→ style-code
34
35
  ├── Reviewing code? ───────────────────→ style-code
@@ -97,12 +98,19 @@ For a complete feature, the typical skill sequence is:
97
98
  4. `prd-to-tasks` → Break into verifiable chunks
98
99
  5. `plan` → Orchestrate the full flow end-to-end
99
100
  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`.
101
+ 7. `implement-task` → Own the criteria, the scope, and the proof
102
+ 8. `tdd` → Prove each slice works
103
+ 9. `style-code` → Review before merge
104
+ 10. `review-security` → Check for secrets
105
+ 11. `git-workflow` → Clean commit history
106
+
107
+ Not every task needs every skill. A bug fix might only need: `implement-task` → `tdd` →
108
+ `style-code` → `review-security`.
109
+
110
+ Routing boundary: `implement-task` owns the request — its criteria, its scope, its evidence. `tdd`
111
+ owns the loop inside one criterion, and answers "how do I prove this behaviour" once the task is
112
+ already understood. A request with acceptance criteria to satisfy starts at `implement-task`; a
113
+ bare "write a test for X" still starts at `tdd`.
106
114
 
107
115
  ## Red Flags
108
116
 
@@ -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,10 @@
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" }
29
32
  },
30
33
  "paths": {
31
34
  "plugin_root": {
@@ -62,8 +65,8 @@
62
65
  "claude": "event-driven"
63
66
  },
64
67
  "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."
68
+ "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`).",
69
+ "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
70
  }
68
71
  },
69
72
  "notes": {
@@ -75,7 +78,10 @@
75
78
  "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
79
  "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
80
  "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."
81
+ "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.",
82
+ "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.",
83
+ "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.",
84
+ "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."
79
85
  },
80
86
  "paths": {
81
87
  "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).",