@pennyfarthing/core 7.6.1 → 7.7.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 (68) hide show
  1. package/README.md +109 -201
  2. package/package.json +1 -1
  3. package/packages/core/dist/cli/commands/doctor.d.ts.map +1 -1
  4. package/packages/core/dist/cli/commands/doctor.js +91 -0
  5. package/packages/core/dist/cli/commands/doctor.js.map +1 -1
  6. package/packages/core/dist/cli/commands/init.js +31 -0
  7. package/packages/core/dist/cli/commands/init.js.map +1 -1
  8. package/packages/core/dist/cli/commands/update.js +31 -0
  9. package/packages/core/dist/cli/commands/update.js.map +1 -1
  10. package/pennyfarthing-dist/agents/architect.md +48 -53
  11. package/pennyfarthing-dist/agents/dev.md +74 -164
  12. package/pennyfarthing-dist/agents/devops.md +44 -39
  13. package/pennyfarthing-dist/agents/handoff.md +46 -23
  14. package/pennyfarthing-dist/agents/orchestrator.md +84 -255
  15. package/pennyfarthing-dist/agents/pm.md +40 -50
  16. package/pennyfarthing-dist/agents/reviewer-preflight.md +58 -26
  17. package/pennyfarthing-dist/agents/reviewer.md +107 -298
  18. package/pennyfarthing-dist/agents/sm-file-summary.md +51 -30
  19. package/pennyfarthing-dist/agents/sm-finish.md +59 -38
  20. package/pennyfarthing-dist/agents/sm-handoff.md +40 -33
  21. package/pennyfarthing-dist/agents/sm-setup.md +89 -47
  22. package/pennyfarthing-dist/agents/sm.md +171 -558
  23. package/pennyfarthing-dist/agents/tea.md +77 -146
  24. package/pennyfarthing-dist/agents/tech-writer.md +43 -24
  25. package/pennyfarthing-dist/agents/testing-runner.md +73 -30
  26. package/pennyfarthing-dist/agents/ux-designer.md +39 -25
  27. package/pennyfarthing-dist/agents/workflow-status-check.md +34 -16
  28. package/pennyfarthing-dist/commands/benchmark.md +19 -1
  29. package/pennyfarthing-dist/commands/continue-session.md +1 -1
  30. package/pennyfarthing-dist/commands/solo.md +5 -0
  31. package/pennyfarthing-dist/commands/theme-maker.md +5 -5
  32. package/pennyfarthing-dist/commands/work.md +1 -1
  33. package/pennyfarthing-dist/guides/XML-TAGS.md +179 -0
  34. package/pennyfarthing-dist/guides/agent-behavior.md +22 -9
  35. package/pennyfarthing-dist/guides/agent-tag-taxonomy.md +432 -0
  36. package/pennyfarthing-dist/guides/patterns/approval-gates-pattern.md +27 -7
  37. package/pennyfarthing-dist/guides/scale-levels.md +114 -0
  38. package/pennyfarthing-dist/personas/themes/gilligans-island.yaml +2 -2
  39. package/pennyfarthing-dist/personas/themes/star-trek-tos.yaml +1 -1
  40. package/pennyfarthing-dist/scripts/core/agent-session.sh +13 -7
  41. package/pennyfarthing-dist/scripts/core/check-context.sh +6 -1
  42. package/pennyfarthing-dist/scripts/core/prime.sh +57 -32
  43. package/pennyfarthing-dist/scripts/git/create-feature-branches.sh +45 -4
  44. package/pennyfarthing-dist/scripts/git/git-status-all.sh +32 -7
  45. package/pennyfarthing-dist/scripts/hooks/bell-mode-hook.sh +30 -11
  46. package/pennyfarthing-dist/scripts/hooks/pre-commit.sh +80 -23
  47. package/pennyfarthing-dist/scripts/hooks/question-reflector-check.mjs +66 -53
  48. package/pennyfarthing-dist/scripts/hooks/question-reflector-check.sh +4 -4
  49. package/pennyfarthing-dist/scripts/hooks/question_reflector_check.py +402 -0
  50. package/pennyfarthing-dist/scripts/hooks/session-stop.sh +7 -0
  51. package/pennyfarthing-dist/scripts/hooks/welcome-hook.sh +94 -0
  52. package/pennyfarthing-dist/scripts/jira/jira-claim-story.sh +10 -152
  53. package/pennyfarthing-dist/scripts/jira/jira-sync-story.sh +14 -4
  54. package/pennyfarthing-dist/scripts/jira/jira-sync.sh +12 -4
  55. package/pennyfarthing-dist/scripts/jira/sync-epic-jira.sh +11 -99
  56. package/pennyfarthing-dist/scripts/lib/common.sh +55 -0
  57. package/pennyfarthing-dist/scripts/maintenance/sidecar-health.sh +97 -0
  58. package/pennyfarthing-dist/scripts/misc/statusline.sh +27 -22
  59. package/pennyfarthing-dist/scripts/story/create-story.sh +14 -154
  60. package/pennyfarthing-dist/scripts/story/size-story.sh +12 -192
  61. package/pennyfarthing-dist/scripts/story/story-template.sh +12 -156
  62. package/pennyfarthing-dist/scripts/test/ground-truth-judge.py +24 -93
  63. package/pennyfarthing-dist/scripts/test/swebench-judge.py +33 -59
  64. package/pennyfarthing-dist/scripts/validation/validate-agent-schema.sh +575 -0
  65. package/pennyfarthing-dist/scripts/workflow/check.py +502 -0
  66. package/pennyfarthing-dist/skills/skill-registry.yaml +52 -16
  67. package/pennyfarthing-dist/skills/sprint/skill.md +1 -1
  68. package/pennyfarthing-dist/templates/settings.local.json.template +11 -0
@@ -10,6 +10,12 @@ Universal entry point telling agents: what work exists, what phase, and whether
10
10
  Uses `/sprint` skill scripts for deterministic output.
11
11
  </info>
12
12
 
13
+ <arguments>
14
+ | Argument | Required | Description |
15
+ |----------|----------|-------------|
16
+ | `CALLING_AGENT` | Yes | Agent requesting status check (e.g., "SM", "Architect", "PM") |
17
+ </arguments>
18
+
13
19
  ---
14
20
 
15
21
  ## Execution
@@ -45,24 +51,36 @@ fi
45
51
 
46
52
  ---
47
53
 
54
+ <output>
48
55
  ## Output Format
49
56
 
50
- ```markdown
51
- ## Workflow Status Report
52
-
53
- ### Detected State
54
- **{STATE}**
55
-
56
- ### Sprint Summary
57
- [Output from sprint-status.sh]
57
+ Return a `STATUS_CHECK_RESULT` block:
58
58
 
59
- ### Active Session
60
- | Story | Phase | Status | Branch |
61
- |-------|-------|--------|--------|
59
+ ### Success
60
+ ```
61
+ STATUS_CHECK_RESULT:
62
+ status: success
63
+ state: {FINISH_STATE|IN_PROGRESS_STATE|NEW_WORK_STATE|EMPTY_BACKLOG_STATE}
64
+ story_id: {ID or null}
65
+ phase: {current phase or null}
66
+ phase_owner: {agent name or null}
67
+ sprint_number: {N}
68
+ backlog_count: {N}
69
+
70
+ next_steps:
71
+ - FINISH_STATE: "Proceed to Finish Flow - spawn sm-finish with PHASE=preflight"
72
+ - IN_PROGRESS_STATE: "Report phase owner '{phase_owner}' should continue. Run handoff-marker.sh {phase_owner}"
73
+ - NEW_WORK_STATE: "Present available stories to user. Await selection, then spawn sm-setup MODE=setup"
74
+ - EMPTY_BACKLOG_STATE: "Report backlog empty. Suggest promoting from future.yaml"
75
+ ```
62
76
 
63
- ### Recommended Action
64
- - FINISH_STATE → Proceed to finish flow
65
- - IN_PROGRESS_STATE → Report which agent should continue
66
- - NEW_WORK_STATE → Show available stories
67
- - EMPTY_BACKLOG_STATE → Suggest promoting stories from future.yaml
77
+ ### Active Session Details (if IN_PROGRESS_STATE)
78
+ ```
79
+ session:
80
+ story_id: {ID}
81
+ title: "{title}"
82
+ workflow: {workflow}
83
+ phase: {phase}
84
+ branch: {branch}
68
85
  ```
86
+ </output>
@@ -151,7 +151,11 @@ Cross-role mode: Prospero --as dev should see dev scenarios, not SM scenarios.
151
151
  ls scenarios/{category}/*.yaml | xargs -I {} yq -r '"{}|\(.name)|\(.difficulty)|\(.title)|\(.description)"' {}
152
152
  ```
153
153
 
154
- **Present choices with AskUserQuestion:**
154
+ **Present choices (Reflector-aware):**
155
+
156
+ First output marker: `<!-- CYCLIST:CHOICES:scenario -->`
157
+
158
+ Then use AskUserQuestion:
155
159
  ```yaml
156
160
  AskUserQuestion:
157
161
  questions:
@@ -416,6 +420,20 @@ agent:
416
420
  cross_role: true
417
421
  ```
418
422
 
423
+ **REQUIRED: Capture Pennyfarthing version in metadata:**
424
+ ```bash
425
+ # Get version from package.json
426
+ version=$(node -p "require('./package.json').version")
427
+ ```
428
+
429
+ Include in summary.yaml:
430
+ ```yaml
431
+ metadata:
432
+ created_at: "{ISO timestamp}"
433
+ pennyfarthing_version: "{version}" # REQUIRED for baseline staleness detection
434
+ model: sonnet
435
+ ```
436
+
419
437
  **ALWAYS save summary.yaml, even for n=1.** This ensures consistent data structure for analysis.
420
438
 
421
439
  Display:
@@ -58,7 +58,7 @@ If checkpoints exist, parse and present them:
58
58
  Which checkpoint would you like to restore? (Enter number or 'all' for most recent of each label)
59
59
  ```
60
60
 
61
- Use `AskUserQuestion` to let user choose.
61
+ Output `<!-- CYCLIST:CHOICES:checkpoint -->` marker, then use AskUserQuestion to let user choose.
62
62
 
63
63
  ## Step 3: Restore Checkpoint
64
64
 
@@ -380,6 +380,11 @@ else:
380
380
  avg_output_tokens: {avg_out}
381
381
  tokens_per_point: {tpp:.2f}
382
382
 
383
+ metadata:
384
+ created_at: {ISO8601 timestamp}
385
+ pennyfarthing_version: {version from package.json} # REQUIRED
386
+ model: sonnet
387
+
383
388
  # Include baseline comparison if baseline exists and theme != control
384
389
  baseline_comparison:
385
390
  control_mean: {baseline_mean}
@@ -28,7 +28,7 @@ If invalid, explain the rules and ask again.
28
28
 
29
29
  ### Step 2: Mode Selection
30
30
 
31
- Use `AskUserQuestion` to let the user choose their creation mode:
31
+ Output `<!-- CYCLIST:CHOICES:mode -->` marker, then use AskUserQuestion:
32
32
 
33
33
  ```yaml
34
34
  questions:
@@ -253,7 +253,7 @@ Display a preview of all generated agents before confirming:
253
253
 
254
254
  ### Step 4: Confirm or Regenerate
255
255
 
256
- Use `AskUserQuestion` to let the user decide:
256
+ Output `<!-- CYCLIST:CHOICES:confirm -->` marker, then use AskUserQuestion:
257
257
 
258
258
  ```yaml
259
259
  questions:
@@ -380,7 +380,7 @@ Same as AI-Driven mode - ask for the theme concept:
380
380
 
381
381
  ### Step 2: Generate Options for Each Agent
382
382
 
383
- For each agent type, generate 3-4 fitting character suggestions based on the universe. Present options using `AskUserQuestion`:
383
+ For each agent type, generate 3-4 fitting character suggestions based on the universe. Output `<!-- CYCLIST:CHOICES:agent -->` marker, then present options using AskUserQuestion:
384
384
 
385
385
  ```yaml
386
386
  questions:
@@ -458,7 +458,7 @@ Show a preview of the complete theme before confirming. Include OCEAN scores for
458
458
 
459
459
  ### Step 5: Confirm or Edit
460
460
 
461
- Use `AskUserQuestion` to let the user decide:
461
+ Output `<!-- CYCLIST:CHOICES:confirm -->` marker, then use AskUserQuestion:
462
462
 
463
463
  ```yaml
464
464
  questions:
@@ -608,7 +608,7 @@ Show a preview of the complete theme including OCEAN profiles:
608
608
 
609
609
  ### Step 6: Confirm or Edit
610
610
 
611
- Use `AskUserQuestion` to let the user decide:
611
+ Output `<!-- CYCLIST:CHOICES:confirm -->` marker, then use AskUserQuestion:
612
612
 
613
613
  ```yaml
614
614
  questions:
@@ -113,7 +113,7 @@ If multiple session files exist (parallel work):
113
113
  Which would you like to continue?
114
114
  ```
115
115
 
116
- Use AskUserQuestion to let user choose, then invoke appropriate agent.
116
+ Output `<!-- CYCLIST:CHOICES:session -->` marker, then use AskUserQuestion to let user choose, then invoke appropriate agent.
117
117
  </multiple-sessions>
118
118
 
119
119
  <reference>
@@ -116,6 +116,185 @@ Tags that organize agent content.
116
116
 
117
117
  **Purpose:** How to leave agent mode and cleanup.
118
118
 
119
+ ## Workflow Tags (TDD Agents)
120
+
121
+ Tags used by agents participating in the TDD workflow cycle (SM, TEA, Dev, Reviewer).
122
+
123
+ ### `<phase-check>`
124
+
125
+ **Purpose:** Verify agent owns the current workflow phase before proceeding. Prevents agents from acting on stories they shouldn't own.
126
+
127
+ **Usage:** SM, TEA, Dev, Reviewer - runs `phase-owner.sh` on activation to determine correct owner.
128
+
129
+ ```markdown
130
+ <phase-check>
131
+ ## On Startup: Check Phase
132
+
133
+ Read `**Workflow:**` and `**Phase:**` from session. Query:
134
+ ```bash
135
+ OWNER=$(.pennyfarthing/scripts/core/run.sh workflow/phase-owner.sh {workflow} {phase})
136
+ ```
137
+
138
+ **If OWNER != "dev":** Run `handoff-marker.sh $OWNER`, output result, tell user.
139
+ </phase-check>
140
+ ```
141
+
142
+ ### `<handoff-gate>`
143
+
144
+ **Purpose:** Exit checklist that MUST be completed before handoff. Ensures assessment is written and subagent is spawned.
145
+
146
+ **Usage:** TEA, Dev, Reviewer - mandatory checklist before exiting.
147
+
148
+ ```markdown
149
+ <handoff-gate>
150
+ ## MANDATORY: Complete Before Exiting
151
+
152
+ - [ ] Write Assessment to session file
153
+ - [ ] Spawn `handoff` subagent
154
+ - [ ] Verify handoff completed (subagent emits marker)
155
+ </handoff-gate>
156
+ ```
157
+
158
+ **Difference from `<gate>`:** `<handoff-gate>` is specifically for phase transitions; `<gate>` is for general prerequisites.
159
+
160
+ ### `<handoffs>`
161
+
162
+ **Purpose:** Documents handoff relationships for strategic agents that coordinate but don't participate in the TDD cycle.
163
+
164
+ **Usage:** PM, Architect, DevOps, Tech-Writer, UX-Designer, Orchestrator.
165
+
166
+ ```markdown
167
+ <handoffs>
168
+ ### From PM/SM
169
+ **When:** Epic needs architectural design
170
+ **Input:** Business requirements, constraints
171
+ **Action:** Design solution and provide guidance
172
+
173
+ ### To Dev
174
+ **When:** Design is complete
175
+ **Output:** Architecture decision and implementation plan
176
+ </handoffs>
177
+ ```
178
+
179
+ ## Subagent Tags
180
+
181
+ Tags used specifically by Haiku subagents for parameter contracts.
182
+
183
+ ### `<params>`
184
+
185
+ **Purpose:** Define the parameter contract for subagents. Specifies what the calling agent must provide in the prompt.
186
+
187
+ **Usage:** Subagents only (sm-setup, sm-finish, sm-handoff, sm-file-summary, handoff, testing-runner, reviewer-preflight).
188
+
189
+ **Standard format (table):**
190
+ ```markdown
191
+ <params>
192
+ | Param | Required | Description |
193
+ |-------|----------|-------------|
194
+ | `STORY_ID` | Yes | Story identifier, e.g., "31-10" |
195
+ | `WORKFLOW` | Yes | Workflow type: "tdd", "trivial", etc. |
196
+ | `FILTER` | No | Test name pattern for filtered runs |
197
+ </params>
198
+ ```
199
+
200
+ **Note:** Use `<info>` for contextual information that isn't a parameter contract.
201
+
202
+ ### `<output>`
203
+
204
+ **Purpose:** Define the standardized output format for subagents. Ensures calling agents receive both data AND instructions on what to do next.
205
+
206
+ **Usage:** All subagents must use this format for their final output.
207
+
208
+ **Standard format:**
209
+ ```markdown
210
+ <output>
211
+ ## Output Format
212
+
213
+ Return a `{SUBAGENT}_RESULT` block:
214
+
215
+ ### Success
216
+ \`\`\`
217
+ {SUBAGENT}_RESULT:
218
+ status: success
219
+ {data fields...}
220
+
221
+ next_steps:
222
+ - {instruction 1}
223
+ - {instruction 2}
224
+ \`\`\`
225
+
226
+ ### Blocked
227
+ \`\`\`
228
+ {SUBAGENT}_RESULT:
229
+ status: blocked
230
+ error: "{description}"
231
+ fix: "{recommended action}"
232
+
233
+ next_steps:
234
+ - {what caller should do}
235
+ \`\`\`
236
+ </output>
237
+ ```
238
+
239
+ **Required fields:**
240
+ - `status`: `success` | `blocked` | `warning`
241
+ - `next_steps`: Array of instructions for the calling agent
242
+
243
+ **Why this matters:** Subagent output is NOT visible to users (only to the calling agent). Clear next steps ensure the caller knows exactly what to do with the result.
244
+
245
+ ## Specialized Tags (Single-Agent Use)
246
+
247
+ Tags used by specific agents for their unique responsibilities.
248
+
249
+ ### `<adversarial-mindset>`
250
+
251
+ **Purpose:** Sets skeptical review stance. Establishes the reviewer's critical, problem-hunting approach.
252
+
253
+ **Usage:** Reviewer-only.
254
+
255
+ ```markdown
256
+ <adversarial-mindset>
257
+ **You are not here to approve code. You are here to find problems.**
258
+
259
+ Assume the code is broken until you prove otherwise.
260
+ **Default stance:** Skeptical. Suspicious. Looking for the flaw.
261
+ </adversarial-mindset>
262
+ ```
263
+
264
+ ### `<review-checklist>`
265
+
266
+ **Purpose:** Mandatory review steps the Reviewer must complete before making a judgment.
267
+
268
+ **Usage:** Reviewer-only.
269
+
270
+ ```markdown
271
+ <review-checklist>
272
+ ## MANDATORY Review Steps
273
+
274
+ - [ ] **Trace data flow:** Pick a user input, follow it end-to-end
275
+ - [ ] **Verify error handling:** What happens on failure?
276
+ - [ ] **Security analysis:** Auth checks? Input sanitization?
277
+ - [ ] **Make judgment:** APPROVE only if no Critical/High issues
278
+ </review-checklist>
279
+ ```
280
+
281
+ ### `<self-review>`
282
+
283
+ **Purpose:** Pre-handoff quality check for Dev to verify implementation before passing to Reviewer.
284
+
285
+ **Usage:** Dev-only.
286
+
287
+ ```markdown
288
+ <self-review>
289
+ ## Self-Review Before Handoff
290
+
291
+ - [ ] Code is wired to front end or other components
292
+ - [ ] Code follows project patterns
293
+ - [ ] All acceptance criteria met
294
+ - [ ] Tests passing (not skipped!)
295
+ </self-review>
296
+ ```
297
+
119
298
  ## Usage Guidelines
120
299
 
121
300
  1. **`<critical>` sparingly** - If everything is critical, nothing is. Reserve for true invariants.
@@ -151,6 +151,10 @@ overrides:
151
151
 
152
152
  ## Reflector
153
153
 
154
+ <critical>
155
+ **EVERY TURN MUST END WITH A CYCLIST MARKER.** A Stop hook enforces this - you will be blocked if you forget.
156
+ </critical>
157
+
154
158
  <info>
155
159
  HTML comments that agents emit to signal Cyclist UI. Format: `<!-- CYCLIST:TYPE:value -->`
156
160
 
@@ -160,6 +164,7 @@ HTML comments that agents emit to signal Cyclist UI. Format: `<!-- CYCLIST:TYPE:
160
164
  | `CONTEXT_CLEAR` | `/agent` | Clears session, reloads with agent |
161
165
  | `QUESTION` | `yesno` or `open` | Shows input dialog |
162
166
  | `CHOICES` | `opt1,opt2,opt3` | Shows choice buttons |
167
+ | `CONTINUE` | (none) | Shows "Continue" button for status updates |
163
168
 
164
169
  **Examples:**
165
170
  ```
@@ -168,30 +173,38 @@ HTML comments that agents emit to signal Cyclist UI. Format: `<!-- CYCLIST:TYPE:
168
173
  <!-- CYCLIST:QUESTION:yesno -->
169
174
  <!-- CYCLIST:QUESTION:open -->
170
175
  <!-- CYCLIST:CHOICES:option1,option2,option3 -->
176
+ <!-- CYCLIST:CONTINUE -->
171
177
  ```
172
178
 
173
179
  **When to use:**
174
180
  - `HANDOFF` - End of phase (TEA→Dev, Dev→Reviewer)
175
181
  - `CONTEXT_CLEAR` - Context >80% at handoff
176
182
  - `QUESTION`/`CHOICES` - User input needed mid-work
183
+ - `CONTINUE` - Status updates, task completion, any turn that isn't a handoff or question
177
184
  </info>
178
185
 
179
186
  <critical>
180
- **Question Reflector Enforcement:** A Stop hook validates that ANY question to the user has a reflector marker. Emit the marker BEFORE your question.
181
-
182
- **Question types requiring markers:**
187
+ **Marker Selection Guide:**
188
+
189
+ | Situation | Marker |
190
+ |-----------|--------|
191
+ | Workflow handoff to next agent | `<!-- CYCLIST:HANDOFF:/agent -->` |
192
+ | Handoff with context >80% | `<!-- CYCLIST:CONTEXT_CLEAR:/agent -->` |
193
+ | Yes/no question | `<!-- CYCLIST:QUESTION:yesno -->` |
194
+ | Open-ended question | `<!-- CYCLIST:QUESTION:open -->` |
195
+ | Multiple choice | `<!-- CYCLIST:CHOICES:a,b,c -->` |
196
+ | Status update / task complete | `<!-- CYCLIST:CONTINUE -->` |
197
+ | Providing information | `<!-- CYCLIST:CONTINUE -->` |
198
+ | Reporting an error/blocker | `<!-- CYCLIST:CONTINUE -->` |
199
+
200
+ **Question types requiring QUESTION/CHOICES markers:**
183
201
  - Direct questions ending with `?`
184
202
  - Implicit questions: "let me know if...", "would you like...", "should I..."
185
203
  - Choice offerings: "Option A or Option B"
186
204
  - Requests for input: "what do you think", "your preference"
187
205
  - Clarification requests: "could you clarify"
188
206
 
189
- **Marker selection:**
190
- - `<!-- CYCLIST:QUESTION:yesno -->` - Yes/no questions
191
- - `<!-- CYCLIST:QUESTION:open -->` - Open-ended questions
192
- - `<!-- CYCLIST:CHOICES:a,b,c -->` - Multiple choice (list options)
193
-
194
- **Exempt (no marker needed):**
207
+ **Exempt from question detection (but still need CONTINUE):**
195
208
  - Rhetorical questions you answer yourself
196
209
  - Questions inside code blocks or examples
197
210
  - Historical context ("the question was...")