feat: add template system for role contexts and messages
Implements gt-u1j.20: Prompt templates using go:embed. - Add internal/templates package with embedded .md.tmpl files - Role templates: mayor, witness, refinery, polecat, crew - Message templates: spawn, nudge, escalation, handoff - Update gt prime to use templates with fallback to hardcoded output - Add crew role detection for <rig>/crew/<name>/ paths - Include Gas Town architecture overview in all role contexts 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
29
internal/templates/messages/escalation.md.tmpl
Normal file
29
internal/templates/messages/escalation.md.tmpl
Normal file
@@ -0,0 +1,29 @@
|
||||
# Escalation: {{ .Polecat }} stuck on {{ .Issue }}
|
||||
|
||||
## Summary
|
||||
|
||||
Polecat **{{ .Polecat }}** appears stuck and has not responded to {{ .NudgeCount }} nudges.
|
||||
|
||||
## Details
|
||||
|
||||
- **Issue**: {{ .Issue }}
|
||||
- **Reason**: {{ .Reason }}
|
||||
- **Last known status**: {{ .LastStatus }}
|
||||
- **Nudges sent**: {{ .NudgeCount }}
|
||||
|
||||
## Possible Actions
|
||||
|
||||
{{ range .Suggestions }}
|
||||
- {{ . }}
|
||||
{{ end }}
|
||||
|
||||
## Witness Assessment
|
||||
|
||||
The polecat may need:
|
||||
- Manual intervention to unblock
|
||||
- Session restart to recover from bad state
|
||||
- Issue reassignment to a different worker
|
||||
|
||||
Please advise on how to proceed.
|
||||
|
||||
—Witness
|
||||
33
internal/templates/messages/handoff.md.tmpl
Normal file
33
internal/templates/messages/handoff.md.tmpl
Normal file
@@ -0,0 +1,33 @@
|
||||
# 🤝 HANDOFF: {{ .Role }} Session
|
||||
|
||||
## Current State
|
||||
|
||||
**Role**: {{ .Role }}
|
||||
**Working on**: {{ .CurrentWork }}
|
||||
**Status**: {{ .Status }}
|
||||
|
||||
{{ if .GitBranch }}
|
||||
**Git branch**: {{ .GitBranch }}
|
||||
{{ if .GitDirty }}⚠️ Working tree has uncommitted changes{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ if .PendingMail }}
|
||||
**Pending mail**: {{ .PendingMail }} messages in inbox
|
||||
{{ end }}
|
||||
|
||||
## Next Steps
|
||||
|
||||
{{ range $i, $step := .NextSteps }}
|
||||
{{ $i }}. {{ $step }}
|
||||
{{ end }}
|
||||
|
||||
{{ if .Notes }}
|
||||
## Notes
|
||||
|
||||
{{ .Notes }}
|
||||
{{ end }}
|
||||
|
||||
---
|
||||
|
||||
This handoff was generated automatically. Read the above carefully and continue
|
||||
where the previous session left off.
|
||||
33
internal/templates/messages/nudge.md.tmpl
Normal file
33
internal/templates/messages/nudge.md.tmpl
Normal file
@@ -0,0 +1,33 @@
|
||||
# Nudge: Check-in on {{ .Issue }}
|
||||
|
||||
Hey {{ .Polecat }},
|
||||
|
||||
This is nudge **{{ .NudgeCount }}/{{ .MaxNudges }}** for your current work.
|
||||
|
||||
## Reason
|
||||
|
||||
{{ .Reason }}
|
||||
|
||||
## Current Status
|
||||
|
||||
Issue: {{ .Issue }}
|
||||
Status: {{ .Status }}
|
||||
|
||||
## Action Needed
|
||||
|
||||
Please either:
|
||||
|
||||
1. **If making progress**: Continue working and signal when done with `gt done`
|
||||
2. **If blocked**: File a blocking issue with `bd create --title="Blocked: <reason>" --type=task`
|
||||
3. **If done**: Make sure to run:
|
||||
- `bd close {{ .Issue }}`
|
||||
- `bd sync`
|
||||
- `gt done`
|
||||
|
||||
## Important
|
||||
|
||||
After {{ .MaxNudges }} nudges without progress, this will be escalated to the Mayor.
|
||||
|
||||
Please respond or take action.
|
||||
|
||||
—Witness
|
||||
33
internal/templates/messages/spawn.md.tmpl
Normal file
33
internal/templates/messages/spawn.md.tmpl
Normal file
@@ -0,0 +1,33 @@
|
||||
# Work Assignment
|
||||
|
||||
You have been assigned to work on the following issue:
|
||||
|
||||
## Issue: {{ .Issue }}
|
||||
|
||||
**Title**: {{ .Title }}
|
||||
**Priority**: P{{ .Priority }}
|
||||
**Branch**: {{ .Branch }}
|
||||
|
||||
{{ if .Description }}
|
||||
## Description
|
||||
|
||||
{{ .Description }}
|
||||
{{ end }}
|
||||
|
||||
## Your Task
|
||||
|
||||
1. Review the issue details with `bd show {{ .Issue }}`
|
||||
2. Work in your clone at `{{ .RigName }}/polecats/{{ .Polecat }}/`
|
||||
3. Commit changes regularly with clear messages
|
||||
4. When complete, run:
|
||||
- `bd close {{ .Issue }}`
|
||||
- `bd sync`
|
||||
- `gt done`
|
||||
|
||||
## Need Help?
|
||||
|
||||
- File blocking issues: `bd create --title="Blocked: <reason>" --type=task`
|
||||
- Ask Witness: `gt mail send {{ .RigName }}/witness -s "Question" -m "..."`
|
||||
- Escalate: The Witness will escalate if you're stuck
|
||||
|
||||
Good luck!
|
||||
Reference in New Issue
Block a user