@pennyfarthing/core 8.1.0 → 9.0.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 (148) hide show
  1. package/README.md +3 -3
  2. package/package.json +3 -3
  3. package/pennyfarthing-dist/agents/README.md +1 -1
  4. package/pennyfarthing-dist/agents/dev.md +1 -1
  5. package/pennyfarthing-dist/agents/handoff.md +1 -1
  6. package/pennyfarthing-dist/agents/reviewer-preflight.md +1 -1
  7. package/pennyfarthing-dist/agents/sm-setup.md +3 -3
  8. package/pennyfarthing-dist/agents/sm.md +1 -1
  9. package/pennyfarthing-dist/agents/tea.md +1 -1
  10. package/pennyfarthing-dist/agents/testing-runner.md +3 -3
  11. package/pennyfarthing-dist/commands/architect.md +2 -0
  12. package/pennyfarthing-dist/commands/continue-session.md +2 -2
  13. package/pennyfarthing-dist/commands/dev.md +2 -0
  14. package/pennyfarthing-dist/commands/devops.md +2 -0
  15. package/pennyfarthing-dist/commands/health-check.md +2 -0
  16. package/pennyfarthing-dist/commands/new-work.md +23 -0
  17. package/pennyfarthing-dist/commands/orchestrator.md +2 -0
  18. package/pennyfarthing-dist/commands/parallel-work.md +4 -2
  19. package/pennyfarthing-dist/commands/pm.md +2 -0
  20. package/pennyfarthing-dist/commands/reviewer.md +2 -0
  21. package/pennyfarthing-dist/commands/sm.md +2 -0
  22. package/pennyfarthing-dist/commands/tea.md +2 -0
  23. package/pennyfarthing-dist/commands/tech-writer.md +2 -0
  24. package/pennyfarthing-dist/commands/ux-designer.md +2 -0
  25. package/pennyfarthing-dist/commands/work.md +2 -0
  26. package/pennyfarthing-dist/guides/agent-behavior.md +29 -264
  27. package/pennyfarthing-dist/scripts/core/agent-session.sh +7 -0
  28. package/pennyfarthing-dist/scripts/core/check-context.sh +140 -226
  29. package/pennyfarthing-dist/scripts/core/handoff-marker.sh +13 -2
  30. package/pennyfarthing-dist/scripts/git/worktree-manager.sh +4 -1
  31. package/pennyfarthing-dist/scripts/health/drift-detection.sh +1 -7
  32. package/pennyfarthing-dist/scripts/hooks/post-merge.sh +4 -11
  33. package/pennyfarthing-dist/scripts/hooks/pre-commit.sh +3 -8
  34. package/pennyfarthing-dist/scripts/hooks/pre-push.sh +3 -3
  35. package/pennyfarthing-dist/scripts/jira/create-jira-epic.sh +1 -7
  36. package/pennyfarthing-dist/scripts/jira/create-jira-story.sh +2 -8
  37. package/pennyfarthing-dist/scripts/jira/jira-reconcile.sh +2 -8
  38. package/pennyfarthing-dist/scripts/lib/find-root.sh +17 -45
  39. package/pennyfarthing-dist/scripts/maintenance/sidecar-health.sh +1 -7
  40. package/pennyfarthing-dist/scripts/sprint/archive-story.sh +2 -8
  41. package/pennyfarthing-dist/scripts/sprint/available-stories.sh +2 -8
  42. package/pennyfarthing-dist/scripts/sprint/check-story.sh +2 -8
  43. package/pennyfarthing-dist/scripts/sprint/get-epic-field.sh +2 -8
  44. package/pennyfarthing-dist/scripts/sprint/get-story-field.sh +2 -8
  45. package/pennyfarthing-dist/scripts/sprint/list-future.sh +2 -8
  46. package/pennyfarthing-dist/scripts/sprint/new-sprint.sh +2 -8
  47. package/pennyfarthing-dist/scripts/sprint/promote-epic.sh +2 -8
  48. package/pennyfarthing-dist/scripts/sprint/sprint-info.sh +2 -8
  49. package/pennyfarthing-dist/scripts/tests/test-character-voice.sh +2 -1
  50. package/pennyfarthing-dist/scripts/workflow/finish-story.sh +4 -9
  51. package/pennyfarthing-dist/scripts/workflow/fix-session-phase.sh +2 -8
  52. package/pennyfarthing-dist/scripts/workflow/list-workflows.sh +2 -8
  53. package/pennyfarthing-dist/scripts/workflow/phase-owner.sh +1 -7
  54. package/pennyfarthing-dist/scripts/workflow/resume-workflow.sh +2 -8
  55. package/pennyfarthing-dist/scripts/workflow/show-workflow.sh +2 -8
  56. package/pennyfarthing-dist/scripts/workflow/start-workflow.sh +2 -8
  57. package/pennyfarthing-dist/scripts/workflow/workflow-status.sh +2 -8
  58. package/pennyfarthing-dist/skills/dev-patterns/SKILL.md +1 -1
  59. package/pennyfarthing-dist/skills/jira/SKILL.md +48 -24
  60. package/pennyfarthing-dist/skills/sprint/scripts/sync-epic-jira.sh +7 -0
  61. package/pennyfarthing-dist/skills/sprint/skill.md +30 -30
  62. package/pennyfarthing-dist/workflows/patch.yaml +68 -0
  63. package/pennyfarthing_scripts/__pycache__/__init__.cpython-314.pyc +0 -0
  64. package/pennyfarthing_scripts/__pycache__/cli.cpython-314.pyc +0 -0
  65. package/pennyfarthing_scripts/common/__pycache__/__init__.cpython-314.pyc +0 -0
  66. package/pennyfarthing_scripts/common/__pycache__/config.cpython-314.pyc +0 -0
  67. package/pennyfarthing_scripts/common/__pycache__/output.cpython-314.pyc +0 -0
  68. package/pennyfarthing_scripts/context.py +414 -0
  69. package/pennyfarthing_scripts/patch_mode.py +449 -0
  70. package/pennyfarthing_scripts/prime/__pycache__/__init__.cpython-314.pyc +0 -0
  71. package/pennyfarthing_scripts/prime/__pycache__/cli.cpython-314.pyc +0 -0
  72. package/pennyfarthing_scripts/prime/__pycache__/loader.cpython-314.pyc +0 -0
  73. package/pennyfarthing_scripts/prime/__pycache__/models.cpython-314.pyc +0 -0
  74. package/pennyfarthing_scripts/prime/__pycache__/persona.cpython-314.pyc +0 -0
  75. package/pennyfarthing_scripts/prime/__pycache__/session.cpython-314.pyc +0 -0
  76. package/pennyfarthing_scripts/prime/__pycache__/tiers.cpython-314.pyc +0 -0
  77. package/pennyfarthing_scripts/prime/__pycache__/workflow.cpython-314.pyc +0 -0
  78. package/pennyfarthing_scripts/prime/cli.py +201 -0
  79. package/pennyfarthing_scripts/prime/models.py +9 -0
  80. package/pennyfarthing_scripts/prime/persona.py +41 -0
  81. package/pennyfarthing_scripts/prime/tiers.py +201 -0
  82. package/pennyfarthing_scripts/sprint/__pycache__/__init__.cpython-314.pyc +0 -0
  83. package/pennyfarthing_scripts/sprint/__pycache__/__main__.cpython-314.pyc +0 -0
  84. package/pennyfarthing_scripts/sprint/__pycache__/archive.cpython-314.pyc +0 -0
  85. package/pennyfarthing_scripts/sprint/__pycache__/cli.cpython-314.pyc +0 -0
  86. package/pennyfarthing_scripts/sprint/__pycache__/loader.cpython-314.pyc +0 -0
  87. package/pennyfarthing_scripts/sprint/__pycache__/status.cpython-314.pyc +0 -0
  88. package/pennyfarthing_scripts/sprint/__pycache__/work.cpython-314.pyc +0 -0
  89. package/pennyfarthing_scripts/tests/test_patch_mode.py +830 -0
  90. package/pennyfarthing_scripts/tests/test_tiers.py +1090 -0
  91. package/pennyfarthing_scripts/tests/test_token_counting.py +559 -0
  92. package/pennyfarthing-dist/scripts/hooks/__pycache__/question_reflector_check.cpython-314.pyc +0 -0
  93. package/pennyfarthing_scripts/__pycache__/__init__.cpython-311.pyc +0 -0
  94. package/pennyfarthing_scripts/__pycache__/config.cpython-314.pyc +0 -0
  95. package/pennyfarthing_scripts/__pycache__/jira.cpython-314.pyc +0 -0
  96. package/pennyfarthing_scripts/__pycache__/jira_bidirectional_sync.cpython-314.pyc +0 -0
  97. package/pennyfarthing_scripts/__pycache__/jira_epic_creation.cpython-314.pyc +0 -0
  98. package/pennyfarthing_scripts/__pycache__/jira_sync.cpython-314.pyc +0 -0
  99. package/pennyfarthing_scripts/__pycache__/jira_sync_story.cpython-314.pyc +0 -0
  100. package/pennyfarthing_scripts/__pycache__/output.cpython-314.pyc +0 -0
  101. package/pennyfarthing_scripts/__pycache__/sprint.cpython-314.pyc +0 -0
  102. package/pennyfarthing_scripts/__pycache__/workflow.cpython-311.pyc +0 -0
  103. package/pennyfarthing_scripts/__pycache__/workflow.cpython-314.pyc +0 -0
  104. package/pennyfarthing_scripts/brownfield/__pycache__/__init__.cpython-314.pyc +0 -0
  105. package/pennyfarthing_scripts/brownfield/__pycache__/__main__.cpython-314.pyc +0 -0
  106. package/pennyfarthing_scripts/brownfield/__pycache__/cli.cpython-314.pyc +0 -0
  107. package/pennyfarthing_scripts/brownfield/__pycache__/discover.cpython-314.pyc +0 -0
  108. package/pennyfarthing_scripts/git/__pycache__/__init__.cpython-314.pyc +0 -0
  109. package/pennyfarthing_scripts/git/__pycache__/create_branches.cpython-314.pyc +0 -0
  110. package/pennyfarthing_scripts/git/__pycache__/status_all.cpython-314.pyc +0 -0
  111. package/pennyfarthing_scripts/jira/__pycache__/__init__.cpython-314.pyc +0 -0
  112. package/pennyfarthing_scripts/jira/__pycache__/__main__.cpython-314.pyc +0 -0
  113. package/pennyfarthing_scripts/jira/__pycache__/bidirectional.cpython-314.pyc +0 -0
  114. package/pennyfarthing_scripts/jira/__pycache__/claim.cpython-314.pyc +0 -0
  115. package/pennyfarthing_scripts/jira/__pycache__/cli.cpython-314.pyc +0 -0
  116. package/pennyfarthing_scripts/jira/__pycache__/client.cpython-314.pyc +0 -0
  117. package/pennyfarthing_scripts/jira/__pycache__/compat.cpython-314.pyc +0 -0
  118. package/pennyfarthing_scripts/jira/__pycache__/epic.cpython-314.pyc +0 -0
  119. package/pennyfarthing_scripts/jira/__pycache__/mappings.cpython-314.pyc +0 -0
  120. package/pennyfarthing_scripts/jira/__pycache__/models.cpython-314.pyc +0 -0
  121. package/pennyfarthing_scripts/jira/__pycache__/story.cpython-314.pyc +0 -0
  122. package/pennyfarthing_scripts/jira/__pycache__/sync.cpython-314.pyc +0 -0
  123. package/pennyfarthing_scripts/preflight/__pycache__/__init__.cpython-314.pyc +0 -0
  124. package/pennyfarthing_scripts/preflight/__pycache__/__main__.cpython-314.pyc +0 -0
  125. package/pennyfarthing_scripts/preflight/__pycache__/cli.cpython-314.pyc +0 -0
  126. package/pennyfarthing_scripts/preflight/__pycache__/finish.cpython-314.pyc +0 -0
  127. package/pennyfarthing_scripts/prime/__pycache__/__main__.cpython-314.pyc +0 -0
  128. package/pennyfarthing_scripts/sprint/__pycache__/validator.cpython-314.pyc +0 -0
  129. package/pennyfarthing_scripts/story/__pycache__/__init__.cpython-314.pyc +0 -0
  130. package/pennyfarthing_scripts/story/__pycache__/__main__.cpython-314.pyc +0 -0
  131. package/pennyfarthing_scripts/story/__pycache__/cli.cpython-314.pyc +0 -0
  132. package/pennyfarthing_scripts/story/__pycache__/create.cpython-314.pyc +0 -0
  133. package/pennyfarthing_scripts/story/__pycache__/size.cpython-314.pyc +0 -0
  134. package/pennyfarthing_scripts/story/__pycache__/template.cpython-314.pyc +0 -0
  135. package/pennyfarthing_scripts/tests/__pycache__/__init__.cpython-314.pyc +0 -0
  136. package/pennyfarthing_scripts/tests/__pycache__/conftest.cpython-314-pytest-9.0.2.pyc +0 -0
  137. package/pennyfarthing_scripts/tests/__pycache__/test_brownfield.cpython-314-pytest-9.0.2.pyc +0 -0
  138. package/pennyfarthing_scripts/tests/__pycache__/test_cli_modules.cpython-314-pytest-9.0.2.pyc +0 -0
  139. package/pennyfarthing_scripts/tests/__pycache__/test_common.cpython-314-pytest-9.0.2.pyc +0 -0
  140. package/pennyfarthing_scripts/tests/__pycache__/test_git_utils.cpython-314-pytest-9.0.2.pyc +0 -0
  141. package/pennyfarthing_scripts/tests/__pycache__/test_jira_package.cpython-314-pytest-9.0.2.pyc +0 -0
  142. package/pennyfarthing_scripts/tests/__pycache__/test_package_structure.cpython-314-pytest-9.0.2.pyc +0 -0
  143. package/pennyfarthing_scripts/tests/__pycache__/test_prime.cpython-314-pytest-9.0.2.pyc +0 -0
  144. package/pennyfarthing_scripts/tests/__pycache__/test_sprint_package.cpython-314-pytest-9.0.2.pyc +0 -0
  145. package/pennyfarthing_scripts/tests/__pycache__/test_sprint_validator.cpython-314-pytest-9.0.2.pyc +0 -0
  146. package/pennyfarthing_scripts/tests/__pycache__/test_story_package.cpython-314-pytest-9.0.2.pyc +0 -0
  147. package/pennyfarthing_scripts/tests/__pycache__/test_workflow_check.cpython-314-pytest-9.0.2.pyc +0 -0
  148. package/pennyfarthing_scripts/tests/__pycache__/test_workflow_cli.cpython-314-pytest-9.0.2.pyc +0 -0
@@ -1,46 +1,11 @@
1
- # Agent Behavior Guide
2
-
3
- **For all Pennyfarthing agents.**
4
-
5
- ---
6
-
7
- ## Critical Protocols
8
-
9
- <critical>
10
- **Reflector markers:** Run `handoff-marker.sh {next_agent}` as your ABSOLUTE LAST ACTION and output the result verbatim. See `<agent-exit-protocol>` below.
11
- </critical>
12
-
13
- <critical>
14
- **Path resolution:** Scripts now self-locate via BASH_SOURCE. Invoke directly from `.pennyfarthing/scripts/`.
15
- For direct commands, use relative paths from project root (Claude Code starts there).
16
-
17
- ```bash
18
- # GOOD: Direct script invocation
19
- .pennyfarthing/scripts/workflow/check.sh
20
-
21
- # GOOD: Relative paths for simple commands
22
- just test
23
- npm run build
24
-
25
- # BAD: $CLAUDE_PROJECT_DIR doesn't exist in Bash calls
26
- $CLAUDE_PROJECT_DIR/.pennyfarthing/scripts/foo.sh # BROKEN!
27
- ```
28
- </critical>
29
-
30
1
  <critical>
31
- **Session file:** `.session/{story-id}-session.md` - extract `**Phase:**` (whose turn), `**Workflow:**`, `**Repos:**`, `**Feature Branch:**`.
32
- </critical>
2
+ **Session file:** `.session/{story-id}-session.md` - read `**Phase:**`, `**Workflow:**`, `**Repos:**`.
33
3
 
34
- <critical>
35
- **Handoff Action:** After handoff subagent returns, run `handoff-marker.sh` as LAST action, output result, EXIT.
36
- </critical>
4
+ **Tests:** Use `testing-runner` subagent, never run directly.
37
5
 
38
- <critical>
39
- **Test delegation:** Never run tests directly. Always use `testing-runner` subagent.
40
- </critical>
6
+ **Handoff:** Run `handoff-marker.sh {next_agent}` → extract marker → emit → EXIT. See `<agent-exit-protocol>`.
41
7
 
42
- <critical>
43
- **Sidecar memory:** Capture learnings BEFORE spawning handoff subagent. Don't wait until exit.
8
+ **Sidecars:** Write learnings BEFORE spawning handoff subagent.
44
9
  </critical>
45
10
 
46
11
  <critical>
@@ -60,117 +25,15 @@ $CLAUDE_PROJECT_DIR/.pennyfarthing/scripts/foo.sh # BROKEN!
60
25
  ## Reference
61
26
 
62
27
  <info>
63
- **Workflow:** SM → TEA → Dev → Reviewer (merge PR) → SM (finish). Trivial (1-2 pts) skips TEA.
64
-
65
- **Story completion:** Reviewer merges PR on approval. SM runs `finish-story.sh` to archive and update Jira. A story is NOT complete until SM runs finish.
66
-
67
- **Confidence:** HIGH=proceed, MEDIUM=ask before risky, LOW=always ask.
68
-
69
- **Skills:** `/sprint-context`, `/testing`, `/dev-patterns`, `/jira`, `/just`
70
-
71
- **Reflector:** HTML comments parsed by Cyclist UI (see below).
72
-
73
- **Turn efficiency:** Parallelize reads, batch bash with `&&`, spawn independent subagents together.
74
-
75
- **Background tasks:** Don't block unless result needed. Cyclist notifies on completion.
76
-
77
- **Sidecar location:** `.pennyfarthing/sidecars/{agent}/` with `patterns.md`, `gotchas.md`, `decisions.md`.
78
-
79
- **Subagent skills:** Include skill paths in prompts - subagents don't auto-load skills.
80
-
81
- **Worktree:** Get path from session: `WORKTREE_PATH=$(grep "^path:" "$SESSION_FILE" | cut -d' ' -f2)`
82
-
83
- **Dogfooding:** Write to `pennyfarthing-dist/` not `.claude/` (symlink permission issue).
84
- </info>
85
-
86
- ---
87
-
88
- ## Project Context
89
-
90
- <info>
91
- **Project:** Pennyfarthing - Claude Code agent orchestration (pnpm monorepo, TypeScript)
28
+ **Workflow:** SM → TEA → Dev → Reviewer → SM. Trivial skips TEA.
92
29
 
93
- **Key paths:**
94
- - `pennyfarthing-dist/` - agents, commands, skills, guides, personas
95
- - `sprint/current-sprint.yaml` - active sprint
96
- - `.session/` - active work sessions
30
+ **Skills:** `/sprint`, `/testing`, `/dev-patterns`, `/jira`, `/just`
97
31
 
98
- **Git:** Branch from `develop`, PR to `develop`, release merges to `main`.
32
+ **Efficiency:** Parallelize reads, batch bash with `&&`, spawn independent subagents together.
99
33
 
100
- **Commit:** `<type>(<scope>): <subject>` + `Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>`
34
+ **Subagents:** Include skill paths in prompts - they don't auto-load.
101
35
 
102
- **Build:** `npm run build`, `npm test`, `npm run lint`
103
- </info>
104
-
105
- ---
106
-
107
- ## Sprint YAML and Jira Interaction Rules
108
-
109
- <critical>
110
- **Never directly edit sprint YAML.** All sprint YAML modifications MUST go through dedicated scripts.
111
- </critical>
112
-
113
- <info>
114
- **Rule 1:** Use `/sprint` skill for sprint operations
115
- - `/sprint status` - View sprint
116
- - `/sprint backlog` - View available stories
117
- - `/sprint work` - Start a story
118
- - `/sprint archive` - Archive completed story
119
-
120
- **Rule 2:** Use `/story` skill for story operations
121
- - `/story finish` - Complete story (handles YAML, Jira, merge, archive)
122
- - `/story create` - Add new story to sprint
123
-
124
- **Rule 3:** Use `/jira` skill for all Jira operations
125
- - `/jira claim` - Assign and move to In Progress
126
- - `/jira move` - Transition status
127
- - `/jira view` - Check status
128
- - `/jira sync` - Sync YAML ↔ Jira
129
-
130
- **Rule 4:** All sprint YAML access goes through scripts
131
- ```bash
132
- # GOOD: Use scripts for ALL operations
133
- .pennyfarthing/scripts/sprint/get-story-field.sh X-Y workflow
134
- .pennyfarthing/scripts/sprint/get-epic-field.sh 35 jira
135
- .pennyfarthing/scripts/sprint/check-story.sh X-Y
136
-
137
- # BAD: Direct yq queries (even read-only)
138
- yq '.epics[].stories[] | ...' sprint/current-sprint.yaml
139
- ```
140
-
141
- **Script Responsibilities:**
142
- | Operation | Script | Skill |
143
- |-----------|--------|-------|
144
- | Get story field | `get-story-field.sh` | - |
145
- | Get epic field | `get-epic-field.sh` | - |
146
- | Check story/epic | `check-story.sh` | `/sprint work` |
147
- | Start story | `jira-claim-story.sh` | `/jira claim` |
148
- | Finish story | `finish-story.sh` | `/story finish` |
149
- | Archive story | `archive-story.sh --apply` | `/sprint archive` |
150
- | Sync to Jira | `sync-epic-jira.sh` | `/jira sync` |
151
- | Create epic | `create-jira-epic.sh` | `/jira create epic` |
152
- </info>
153
-
154
- ---
155
-
156
-
157
- ## Persona System
158
-
159
- <info>
160
- **Config:** `.pennyfarthing/config.local.yaml` with `theme:` field.
161
-
162
- **many themes available:** `/list-themes` to browse, `/show-theme <name>` for details, `/set-theme <name>` to change.
163
-
164
- **Categories:** TV Series, Film, Literature, Anime, Games, History/Mythology.
165
-
166
- **Attributes:** `verbosity` (low/medium/high), `formality` (formal/casual/playful), `humor` (enabled/disabled/subtle).
167
-
168
- **Per-agent override:**
169
- ```yaml
170
- overrides:
171
- reviewer:
172
- theme: discworld # Keep Granny even in Star Trek mode
173
- ```
36
+ **Dogfooding:** Write to `pennyfarthing-dist/` not `.claude/` (symlink issue).
174
37
  </info>
175
38
 
176
39
  ---
@@ -178,148 +41,50 @@ overrides:
178
41
  ## Reflector
179
42
 
180
43
  <critical>
181
- **EVERY TURN MUST END WITH A CYCLIST MARKER.** A Stop hook enforces this - you will be blocked if you forget.
182
- </critical>
183
-
184
- <info>
185
- HTML comments that agents emit to signal Cyclist UI. Format: `<!-- CYCLIST:TYPE:value -->`
186
-
187
- | Type | Value | Cyclist Action |
188
- |------|-------|----------------|
189
- | `HANDOFF` | `/agent` | Shows "Continue with /agent" button |
190
- | `CONTEXT_CLEAR` | `/agent` | Clears session, reloads with agent |
191
- | `QUESTION` | `yesno` or `open` | Shows input dialog |
192
- | `CHOICES` | `opt1,opt2,opt3` | Shows choice buttons |
193
- | `CONTINUE` | (none) | Shows "Continue" button for status updates |
194
-
195
- **Examples:**
196
- ```
197
- <!-- CYCLIST:HANDOFF:/tea -->
198
- <!-- CYCLIST:CONTEXT_CLEAR:/dev -->
199
- <!-- CYCLIST:QUESTION:yesno -->
200
- <!-- CYCLIST:QUESTION:open -->
201
- <!-- CYCLIST:CHOICES:option1,option2,option3 -->
202
- <!-- CYCLIST:CONTINUE -->
203
- ```
204
-
205
- **When to use:**
206
- - `HANDOFF` - End of phase (TEA→Dev, Dev→Reviewer)
207
- - `CONTEXT_CLEAR` - Context >80% at handoff
208
- - `QUESTION`/`CHOICES` - User input needed mid-work
209
- - `CONTINUE` - Status updates, task completion, any turn that isn't a handoff or question
210
- </info>
211
-
212
- <critical>
213
- **Marker Selection Guide:**
44
+ **EVERY TURN MUST END WITH A CYCLIST MARKER.** Stop hook enforces this.
214
45
 
215
46
  | Situation | Marker |
216
47
  |-----------|--------|
217
- | Workflow handoff to next agent | `<!-- CYCLIST:HANDOFF:/agent -->` |
218
- | Handoff with context >80% | `<!-- CYCLIST:CONTEXT_CLEAR:/agent -->` |
48
+ | Workflow handoff | `<!-- CYCLIST:HANDOFF:/agent -->` |
49
+ | Handoff + context >80% | `<!-- CYCLIST:CONTEXT_CLEAR:/agent -->` |
219
50
  | Yes/no question | `<!-- CYCLIST:QUESTION:yesno -->` |
220
51
  | Open-ended question | `<!-- CYCLIST:QUESTION:open -->` |
221
52
  | Multiple choice | `<!-- CYCLIST:CHOICES:a,b,c -->` |
222
- | Status update / task complete | `<!-- CYCLIST:CONTINUE -->` |
223
- | Providing information | `<!-- CYCLIST:CONTINUE -->` |
224
- | Reporting an error/blocker | `<!-- CYCLIST:CONTINUE -->` |
225
-
226
- **Question types requiring QUESTION/CHOICES markers:**
227
- - Direct questions ending with `?`
228
- - Implicit questions: "let me know if...", "would you like...", "should I..."
229
- - Choice offerings: "Option A or Option B"
230
- - Requests for input: "what do you think", "your preference"
231
- - Clarification requests: "could you clarify"
232
-
233
- **Exempt from question detection (but still need CONTINUE):**
234
- - Rhetorical questions you answer yourself
235
- - Questions inside code blocks or examples
236
- - Historical context ("the question was...")
53
+ | Everything else | `<!-- CYCLIST:CONTINUE -->` |
237
54
  </critical>
238
55
 
239
56
  ---
240
57
 
241
58
  <agent-exit-protocol>
242
- ## Agent Exit Protocol
243
-
244
- ### Exit Sequence
59
+ ## Exit Protocol
245
60
 
246
- 1. Write assessment to session file
247
- 2. Spawn `handoff` subagent
248
- 3. Await `HANDOFF_RESULT`
249
- 4. If `status: blocked` → report error, stop
250
- 5. **Run this as ABSOLUTE LAST ACTION:**
251
- ```bash
252
- .pennyfarthing/scripts/handoff-marker.sh {next_agent}
61
+ 1. Write assessment to session
62
+ 2. Spawn `handoff` subagent → returns `HANDOFF_RESULT: {status, next_agent}`
63
+ 3. If blocked → report error, stop
64
+ 4. Run `.pennyfarthing/scripts/core/handoff-marker.sh {next_agent}`
65
+ 5. Extract marker from YAML output, emit it:
253
66
  ```
254
- 6. **Output the script result verbatim and EXIT**
255
-
256
- ### HANDOFF_RESULT Format
257
-
258
- ```
259
- HANDOFF_RESULT:
260
- status: success|blocked
261
- next_agent: {agent_name}
262
- error: "{message}" # if blocked
263
- ```
264
-
265
- ### Script Output (emit verbatim)
67
+ <!-- CYCLIST:HANDOFF:/dev -->
266
68
 
267
- ```
268
- ---
269
- AGENT_COMMAND:
270
- marker: "<!-- CYCLIST:HANDOFF:/dev -->"
271
- fallback: "Run `/dev` to continue"
272
- ---
273
- ```
274
-
275
- **Nothing after the marker. EXIT.**
69
+ Run `/dev` to continue
70
+ ```
71
+ 6. EXIT (nothing after marker)
276
72
  </agent-exit-protocol>
277
73
 
278
74
  <wrong-phase-detection>
279
75
  ## Wrong Phase Detection
280
76
 
281
- When an agent detects the story is NOT in their phase, emit a marker immediately.
282
-
283
- ### How to Check (works with custom workflows)
284
-
285
- 1. Read `**Workflow:**` and `**Phase:**` from session file
286
- 2. Query the phase owner:
287
- ```bash
288
- OWNER=$(.pennyfarthing/scripts/workflow/phase-owner.sh {workflow} {phase})
289
- ```
290
- 3. If `$OWNER` != your agent name → story belongs to another agent
291
-
292
- ### Action When Not Your Phase
77
+ On activation, check if story phase belongs to you:
293
78
 
294
79
  ```bash
295
- .pennyfarthing/scripts/handoff-marker.sh {OWNER}
80
+ OWNER=$(.pennyfarthing/scripts/workflow/phase-owner.sh {workflow} {phase})
81
+ # If OWNER != your agent → emit handoff marker and EXIT
296
82
  ```
297
83
 
298
- Then output the result verbatim. This triggers Cyclist's handoff button.
299
-
300
- ### Example
301
-
302
- Dev reads session: `**Workflow:** tdd`, `**Phase:** review`
303
-
304
- ```bash
305
- OWNER=$(.pennyfarthing/scripts/workflow/phase-owner.sh tdd review)
306
- # Returns: reviewer
84
+ Output:
307
85
  ```
86
+ <!-- CYCLIST:HANDOFF:/{OWNER} -->
308
87
 
309
- Since "reviewer" != "dev", Dev runs:
310
- ```bash
311
- .pennyfarthing/scripts/handoff-marker.sh reviewer
88
+ Run `/{OWNER}` to continue
312
89
  ```
313
-
314
- ### Do NOT just say "run /reviewer"
315
-
316
- Wrong:
317
- > The story is in review. Run `/reviewer` to continue.
318
-
319
- Right:
320
- > The story is in review phase.
321
- >
322
- > <!-- CYCLIST:HANDOFF:/reviewer -->
323
- >
324
- > Run `/reviewer` to continue
325
90
  </wrong-phase-detection>
@@ -8,6 +8,13 @@
8
8
  #
9
9
  # Session files stored in .session/agents/<session-id> for multi-session support
10
10
 
11
+ # Find package root (where pennyfarthing_scripts lives) from script location
12
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd -P)"
13
+ PACKAGE_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd -P)"
14
+
15
+ # Set PYTHONPATH so Python can find pennyfarthing_scripts
16
+ export PYTHONPATH="${PACKAGE_ROOT}:${PYTHONPATH:-}"
17
+
11
18
  # Agents directory for multi-session support
12
19
  AGENTS_DIR="$PROJECT_ROOT/.session/agents"
13
20