anvil-dev-framework 0.1.6
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.
- package/README.md +719 -0
- package/VERSION +1 -0
- package/docs/ANVIL-REPO-IMPLEMENTATION-PLAN.md +441 -0
- package/docs/FIRST-SKILL-TUTORIAL.md +408 -0
- package/docs/INSTALLATION-RETRO-NOTES.md +458 -0
- package/docs/INSTALLATION.md +984 -0
- package/docs/anvil-hud.md +469 -0
- package/docs/anvil-init.md +255 -0
- package/docs/anvil-state.md +210 -0
- package/docs/boris-cherny-ralph-wiggum-insights.md +608 -0
- package/docs/command-reference.md +2022 -0
- package/docs/hooks-tts.md +368 -0
- package/docs/implementation-guide.md +810 -0
- package/docs/linear-github-integration.md +247 -0
- package/docs/local-issues.md +677 -0
- package/docs/patterns/README.md +419 -0
- package/docs/planning-responsibilities.md +139 -0
- package/docs/session-workflow.md +573 -0
- package/docs/simplification-plan-template.md +297 -0
- package/docs/simplification-principles.md +129 -0
- package/docs/specifications/CCS-RALPH-INTEGRATION-DESIGN.md +633 -0
- package/docs/specifications/CCS-RESEARCH-REPORT.md +169 -0
- package/docs/specifications/PLAN-ANV-verification-ralph-wiggum.md +403 -0
- package/docs/specifications/PLAN-parallel-tracks-anvil-memory-ccs.md +494 -0
- package/docs/specifications/SPEC-ANV-VRW/component-01-verify.md +208 -0
- package/docs/specifications/SPEC-ANV-VRW/component-02-stop-gate.md +226 -0
- package/docs/specifications/SPEC-ANV-VRW/component-03-posttooluse.md +209 -0
- package/docs/specifications/SPEC-ANV-VRW/component-04-ralph-wiggum.md +604 -0
- package/docs/specifications/SPEC-ANV-VRW/component-05-atomic-actions.md +311 -0
- package/docs/specifications/SPEC-ANV-VRW/component-06-verify-subagent.md +264 -0
- package/docs/specifications/SPEC-ANV-VRW/component-07-claude-md.md +363 -0
- package/docs/specifications/SPEC-ANV-VRW/index.md +182 -0
- package/docs/specifications/SPEC-ANV-anvil-memory.md +573 -0
- package/docs/specifications/SPEC-ANV-context-checkpoints.md +781 -0
- package/docs/specifications/SPEC-ANV-verification-ralph-wiggum.md +789 -0
- package/docs/sync.md +122 -0
- package/global/CLAUDE.md +140 -0
- package/global/agents/verify-app.md +164 -0
- package/global/commands/anvil-settings.md +527 -0
- package/global/commands/anvil-sync.md +121 -0
- package/global/commands/change.md +197 -0
- package/global/commands/clarify.md +252 -0
- package/global/commands/cleanup.md +292 -0
- package/global/commands/commit-push-pr.md +207 -0
- package/global/commands/decay-review.md +127 -0
- package/global/commands/discover.md +158 -0
- package/global/commands/doc-coverage.md +122 -0
- package/global/commands/evidence.md +307 -0
- package/global/commands/explore.md +121 -0
- package/global/commands/force-exit.md +135 -0
- package/global/commands/handoff.md +191 -0
- package/global/commands/healthcheck.md +302 -0
- package/global/commands/hud.md +84 -0
- package/global/commands/insights.md +319 -0
- package/global/commands/linear-setup.md +184 -0
- package/global/commands/lint-fix.md +198 -0
- package/global/commands/orient.md +510 -0
- package/global/commands/plan.md +228 -0
- package/global/commands/ralph.md +346 -0
- package/global/commands/ready.md +182 -0
- package/global/commands/release.md +305 -0
- package/global/commands/retro.md +96 -0
- package/global/commands/shard.md +166 -0
- package/global/commands/spec.md +227 -0
- package/global/commands/sprint.md +184 -0
- package/global/commands/tasks.md +228 -0
- package/global/commands/test-and-commit.md +151 -0
- package/global/commands/validate.md +132 -0
- package/global/commands/verify.md +251 -0
- package/global/commands/weekly-review.md +156 -0
- package/global/hooks/__pycache__/ralph_context_monitor.cpython-314.pyc +0 -0
- package/global/hooks/__pycache__/statusline_agent_sync.cpython-314.pyc +0 -0
- package/global/hooks/anvil_memory_observe.ts +322 -0
- package/global/hooks/anvil_memory_session.ts +166 -0
- package/global/hooks/anvil_memory_stop.ts +187 -0
- package/global/hooks/parse_transcript.py +116 -0
- package/global/hooks/post_merge_cleanup.sh +132 -0
- package/global/hooks/post_tool_format.sh +215 -0
- package/global/hooks/ralph_context_monitor.py +240 -0
- package/global/hooks/ralph_stop.sh +502 -0
- package/global/hooks/statusline.sh +1110 -0
- package/global/hooks/statusline_agent_sync.py +224 -0
- package/global/hooks/stop_gate.sh +250 -0
- package/global/lib/.claude/anvil-state.json +21 -0
- package/global/lib/__pycache__/agent_registry.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/claim_service.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/coderabbit_service.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/config_service.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/coordination_service.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/doc_coverage_service.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/gate_logger.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/github_service.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/hygiene_service.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/issue_models.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/issue_provider.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/linear_data_service.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/linear_provider.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/local_provider.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/quality_service.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/ralph_state.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/state_manager.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/transcript_parser.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/verification_runner.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/verify_iteration.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/verify_subagent.cpython-314.pyc +0 -0
- package/global/lib/agent_registry.py +995 -0
- package/global/lib/anvil-state.sh +435 -0
- package/global/lib/claim_service.py +515 -0
- package/global/lib/coderabbit_service.py +314 -0
- package/global/lib/config_service.py +423 -0
- package/global/lib/coordination_service.py +331 -0
- package/global/lib/doc_coverage_service.py +1305 -0
- package/global/lib/gate_logger.py +316 -0
- package/global/lib/github_service.py +310 -0
- package/global/lib/handoff_generator.py +775 -0
- package/global/lib/hygiene_service.py +712 -0
- package/global/lib/issue_models.py +257 -0
- package/global/lib/issue_provider.py +339 -0
- package/global/lib/linear_data_service.py +210 -0
- package/global/lib/linear_provider.py +987 -0
- package/global/lib/linear_provider.py.backup +671 -0
- package/global/lib/local_provider.py +486 -0
- package/global/lib/orient_fast.py +457 -0
- package/global/lib/quality_service.py +470 -0
- package/global/lib/ralph_prompt_generator.py +563 -0
- package/global/lib/ralph_state.py +1202 -0
- package/global/lib/state_manager.py +417 -0
- package/global/lib/transcript_parser.py +597 -0
- package/global/lib/verification_runner.py +557 -0
- package/global/lib/verify_iteration.py +490 -0
- package/global/lib/verify_subagent.py +250 -0
- package/global/skills/README.md +155 -0
- package/global/skills/quality-gates/SKILL.md +252 -0
- package/global/skills/skill-template/SKILL.md +109 -0
- package/global/skills/testing-strategies/SKILL.md +337 -0
- package/global/templates/CHANGE-template.md +105 -0
- package/global/templates/HANDOFF-template.md +63 -0
- package/global/templates/PLAN-template.md +111 -0
- package/global/templates/SPEC-template.md +93 -0
- package/global/templates/ralph/PROMPT.md.template +89 -0
- package/global/templates/ralph/fix_plan.md.template +31 -0
- package/global/templates/ralph/progress.txt.template +23 -0
- package/global/tests/__pycache__/test_doc_coverage.cpython-314.pyc +0 -0
- package/global/tests/test_doc_coverage.py +520 -0
- package/global/tests/test_issue_models.py +299 -0
- package/global/tests/test_local_provider.py +323 -0
- package/global/tools/README.md +178 -0
- package/global/tools/__pycache__/anvil-hud.cpython-314.pyc +0 -0
- package/global/tools/anvil-hud.py +3622 -0
- package/global/tools/anvil-hud.py.bak +3318 -0
- package/global/tools/anvil-issue.py +432 -0
- package/global/tools/anvil-memory/CLAUDE.md +49 -0
- package/global/tools/anvil-memory/README.md +42 -0
- package/global/tools/anvil-memory/bun.lock +25 -0
- package/global/tools/anvil-memory/bunfig.toml +9 -0
- package/global/tools/anvil-memory/package.json +23 -0
- package/global/tools/anvil-memory/src/__tests__/ccs/context-monitor.test.ts +535 -0
- package/global/tools/anvil-memory/src/__tests__/ccs/edge-cases.test.ts +645 -0
- package/global/tools/anvil-memory/src/__tests__/ccs/fixtures.ts +363 -0
- package/global/tools/anvil-memory/src/__tests__/ccs/index.ts +8 -0
- package/global/tools/anvil-memory/src/__tests__/ccs/integration.test.ts +417 -0
- package/global/tools/anvil-memory/src/__tests__/ccs/prompt-generator.test.ts +571 -0
- package/global/tools/anvil-memory/src/__tests__/ccs/ralph-stop.test.ts +440 -0
- package/global/tools/anvil-memory/src/__tests__/ccs/test-utils.ts +252 -0
- package/global/tools/anvil-memory/src/__tests__/commands.test.ts +657 -0
- package/global/tools/anvil-memory/src/__tests__/db.test.ts +641 -0
- package/global/tools/anvil-memory/src/__tests__/hooks.test.ts +272 -0
- package/global/tools/anvil-memory/src/__tests__/performance.test.ts +427 -0
- package/global/tools/anvil-memory/src/__tests__/test-utils.ts +113 -0
- package/global/tools/anvil-memory/src/commands/checkpoint.ts +197 -0
- package/global/tools/anvil-memory/src/commands/get.ts +115 -0
- package/global/tools/anvil-memory/src/commands/init.ts +94 -0
- package/global/tools/anvil-memory/src/commands/observe.ts +163 -0
- package/global/tools/anvil-memory/src/commands/search.ts +112 -0
- package/global/tools/anvil-memory/src/db.ts +638 -0
- package/global/tools/anvil-memory/src/index.ts +205 -0
- package/global/tools/anvil-memory/src/types.ts +122 -0
- package/global/tools/anvil-memory/tsconfig.json +29 -0
- package/global/tools/ralph-loop.sh +359 -0
- package/package.json +45 -0
- package/scripts/anvil +822 -0
- package/scripts/extract_patterns.py +222 -0
- package/scripts/init-project.sh +541 -0
- package/scripts/install.sh +229 -0
- package/scripts/postinstall.js +41 -0
- package/scripts/rollback.sh +188 -0
- package/scripts/sync.sh +623 -0
- package/scripts/test-statusline.sh +248 -0
- package/scripts/update_claude_md.py +224 -0
- package/scripts/verify.sh +255 -0
|
@@ -0,0 +1,510 @@
|
|
|
1
|
+
# /orient - Session Startup Orientation
|
|
2
|
+
|
|
3
|
+
> Quickly orient at session start by checking handoffs, git state, and ready work.
|
|
4
|
+
|
|
5
|
+
## When to Use
|
|
6
|
+
- **Always** at the start of a new session
|
|
7
|
+
- After returning from a break
|
|
8
|
+
- When context feels unclear
|
|
9
|
+
|
|
10
|
+
## Fast-Path Execution (Recommended)
|
|
11
|
+
|
|
12
|
+
First, check if the fast-path script exists:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
if [ -f "global/lib/orient_fast.py" ]; then
|
|
16
|
+
python3 global/lib/orient_fast.py
|
|
17
|
+
else
|
|
18
|
+
echo "Fast-path script not available, using manual steps"
|
|
19
|
+
fi
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
If the script exists, it runs all checks in parallel (~500ms) and outputs structured results.
|
|
23
|
+
|
|
24
|
+
Options:
|
|
25
|
+
- `--fast`: Skip Linear API calls (local checks only, ~200ms)
|
|
26
|
+
- `--json`: Output raw JSON for programmatic use
|
|
27
|
+
|
|
28
|
+
**After running orient_fast.py**, proceed to Step 7 (Interactive Session Mode Selection).
|
|
29
|
+
|
|
30
|
+
**If script doesn't exist**: Continue with Manual Execution Steps below.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Manual Execution Steps (Fallback)
|
|
35
|
+
|
|
36
|
+
Use these if orient_fast.py is unavailable (e.g., on main before PR merge).
|
|
37
|
+
|
|
38
|
+
### Step 0: Check Linear Configuration
|
|
39
|
+
|
|
40
|
+
**CRITICAL**: Before querying Linear, verify this project has a Linear team configured.
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# Check for linear.yaml
|
|
44
|
+
if [ -f ".claude/linear.yaml" ]; then
|
|
45
|
+
echo "Linear configuration found:"
|
|
46
|
+
cat .claude/linear.yaml
|
|
47
|
+
else
|
|
48
|
+
echo "⚠️ NO LINEAR CONFIGURATION"
|
|
49
|
+
echo "This project is not mapped to a Linear team."
|
|
50
|
+
echo "Run /linear-setup to configure."
|
|
51
|
+
fi
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**If no linear.yaml exists**:
|
|
55
|
+
- WARN the user prominently
|
|
56
|
+
- Offer to run `/linear-setup`
|
|
57
|
+
- Do NOT query Linear (would show wrong project's issues)
|
|
58
|
+
- Continue with git state and handoff checks only
|
|
59
|
+
|
|
60
|
+
**If linear.yaml exists**:
|
|
61
|
+
- Read the `team_key` and `team_id`
|
|
62
|
+
- Use these to filter ALL subsequent Linear queries
|
|
63
|
+
- Mention the configured team in output
|
|
64
|
+
|
|
65
|
+
### Step 1: Check for Active Agents and Claims (ANV-224)
|
|
66
|
+
|
|
67
|
+
Check the agent registry and claims service for active agents and their claimed issues:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# Check agent registry for active agents
|
|
71
|
+
python3 -c "
|
|
72
|
+
import sys
|
|
73
|
+
sys.path.insert(0, 'global/lib')
|
|
74
|
+
from agent_registry import get_registry
|
|
75
|
+
import json
|
|
76
|
+
agents = get_registry().get_all()
|
|
77
|
+
print(json.dumps(agents, indent=2))
|
|
78
|
+
"
|
|
79
|
+
|
|
80
|
+
# Check claims registry for claimed issues
|
|
81
|
+
python3 -c "
|
|
82
|
+
import sys
|
|
83
|
+
sys.path.insert(0, 'global/lib')
|
|
84
|
+
from claim_service import get_claims_summary
|
|
85
|
+
import json
|
|
86
|
+
print(json.dumps(get_claims_summary(), indent=2))
|
|
87
|
+
"
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Parse active agents from the agent registry at `~/.anvil/agents.json`:
|
|
91
|
+
- Filter to agents with recent activity (within 1 minute)
|
|
92
|
+
- Extract: codename (A1, A2), project, phase, model
|
|
93
|
+
- Cross-reference with claims to show what each is working on
|
|
94
|
+
|
|
95
|
+
If active agents exist:
|
|
96
|
+
- List them in the orientation report with their claimed issues
|
|
97
|
+
- Show codenames (A1, A2) instead of UUIDs for readability
|
|
98
|
+
|
|
99
|
+
If no active agents:
|
|
100
|
+
- Report "No other active agents" and continue
|
|
101
|
+
|
|
102
|
+
### Step 2: Check for Recent Handoff
|
|
103
|
+
```bash
|
|
104
|
+
# Look for handoffs from last 48 hours
|
|
105
|
+
find .claude/handoffs -name "*.md" -mtime -2 -type f | head -5
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
If handoff exists and is recent (<48 hours):
|
|
109
|
+
1. Read the handoff file
|
|
110
|
+
2. Note: completed work, in-progress items, recommended next task
|
|
111
|
+
3. Report key context to user
|
|
112
|
+
|
|
113
|
+
If no recent handoff:
|
|
114
|
+
- Note this and proceed to next steps
|
|
115
|
+
|
|
116
|
+
### Step 2.5: Post-Compaction Recovery Check (ANV-230)
|
|
117
|
+
|
|
118
|
+
**CRITICAL**: If the session is resuming after context compaction, verify state hasn't drifted.
|
|
119
|
+
|
|
120
|
+
**Detection signals** (any of these suggest post-compaction):
|
|
121
|
+
- Session context mentions "continued from previous conversation"
|
|
122
|
+
- Session context mentions "ran out of context" or "summarized"
|
|
123
|
+
- Handoff file exists with timestamp close to current time
|
|
124
|
+
- `.claude/anvil-state.json` shows work in progress but no recent activity
|
|
125
|
+
|
|
126
|
+
**If post-compaction is detected, run the Triple-Check:**
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
# Triple-Check: Verify actual state matches expected state
|
|
130
|
+
echo "=== POST-COMPACTION STATE VERIFICATION ==="
|
|
131
|
+
|
|
132
|
+
# 1. Current branch
|
|
133
|
+
echo "Branch: $(git branch --show-current)"
|
|
134
|
+
|
|
135
|
+
# 2. Working directory status
|
|
136
|
+
echo "Status:"
|
|
137
|
+
git status --short
|
|
138
|
+
|
|
139
|
+
# 3. Last commit (verify we're where we think we are)
|
|
140
|
+
echo "Last commit: $(git log -1 --oneline)"
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
**Determining expected state** (check in this order):
|
|
144
|
+
1. **Session summary**: If compacted, read the summary provided at session start for branch/task info
|
|
145
|
+
2. **Handoff file**: Check `.claude/handoffs/` for recent handoff with branch and task details
|
|
146
|
+
3. **anvil-state.json**: Check `.claude/anvil-state.json` for `activeIssue` and `phase`
|
|
147
|
+
4. **Linear**: Query for issues in "In Progress" state assigned to this branch
|
|
148
|
+
|
|
149
|
+
**Report format for post-compaction:**
|
|
150
|
+
```
|
|
151
|
+
## ⚠️ Post-Compaction State Check
|
|
152
|
+
|
|
153
|
+
**Expected** (from handoff/context):
|
|
154
|
+
- Branch: feature/ANV-XX-something
|
|
155
|
+
- Working on: [task description]
|
|
156
|
+
- Source: [handoff file / session summary / anvil-state.json]
|
|
157
|
+
|
|
158
|
+
**Actual**:
|
|
159
|
+
- Branch: [actual branch]
|
|
160
|
+
- Status: [clean/dirty]
|
|
161
|
+
- Last commit: [commit message]
|
|
162
|
+
|
|
163
|
+
**Match**: ✅ State consistent / ❌ State mismatch detected
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**If state mismatch detected:**
|
|
167
|
+
1. STOP and report the discrepancy prominently
|
|
168
|
+
2. Show what was expected vs what was found
|
|
169
|
+
3. Suggest recovery actions:
|
|
170
|
+
- If wrong branch: `git checkout [expected-branch]`
|
|
171
|
+
- If uncommitted changes exist: Review with `git diff`
|
|
172
|
+
- If commits missing: Check `git reflog`
|
|
173
|
+
4. Do NOT proceed with work until user confirms state is correct
|
|
174
|
+
|
|
175
|
+
**If state matches:**
|
|
176
|
+
- Note "Post-compaction check passed" and continue normally
|
|
177
|
+
|
|
178
|
+
### Step 2.6: PR State Verification (ANV-230)
|
|
179
|
+
|
|
180
|
+
**When to check**: If handoff or context mentions working on PR review feedback.
|
|
181
|
+
|
|
182
|
+
Before committing any code related to PR feedback:
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
# Check if PR is still open
|
|
186
|
+
gh pr view [PR_NUMBER] --json state,mergedAt,title
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
**If PR state is MERGED:**
|
|
190
|
+
```
|
|
191
|
+
## ⚠️ PR Already Merged
|
|
192
|
+
|
|
193
|
+
PR #[NUMBER] "[title]" was merged at [mergedAt].
|
|
194
|
+
|
|
195
|
+
**Do NOT commit to the feature branch.**
|
|
196
|
+
|
|
197
|
+
**Recovery options:**
|
|
198
|
+
1. Create follow-up PR from main with your changes
|
|
199
|
+
2. Cherry-pick commits to a new branch
|
|
200
|
+
3. Discard changes if they were already included in merge
|
|
201
|
+
|
|
202
|
+
Recommended: `git checkout main && git pull && git checkout -b fix/[description]`
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
**If PR state is OPEN:**
|
|
206
|
+
- Continue normally with feedback implementation
|
|
207
|
+
|
|
208
|
+
**If PR state is CLOSED (not merged):**
|
|
209
|
+
- Warn that PR was closed without merging
|
|
210
|
+
- Suggest reopening or creating new PR
|
|
211
|
+
|
|
212
|
+
### Step 3: Check Git State
|
|
213
|
+
```bash
|
|
214
|
+
git status
|
|
215
|
+
git branch --show-current
|
|
216
|
+
git log --oneline -3
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
Report:
|
|
220
|
+
- Current branch
|
|
221
|
+
- Whether there are uncommitted changes
|
|
222
|
+
- Last few commits for context
|
|
223
|
+
|
|
224
|
+
### Step 4: Check Linear for In-Progress Work
|
|
225
|
+
|
|
226
|
+
**Only if linear.yaml exists and has team_key configured.**
|
|
227
|
+
|
|
228
|
+
Use Linear MCP or CLI filtered to the configured team:
|
|
229
|
+
|
|
230
|
+
```
|
|
231
|
+
Query Linear for issues where:
|
|
232
|
+
- Team key = [team_key from linear.yaml]
|
|
233
|
+
- Status = "In Progress"
|
|
234
|
+
- Limit to 10 results
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
If the team is not configured, skip this step and note "Linear not configured for this project."
|
|
238
|
+
|
|
239
|
+
Report any work already marked as in-progress.
|
|
240
|
+
|
|
241
|
+
### Step 5: Calculate Ready Work
|
|
242
|
+
|
|
243
|
+
**Only if linear.yaml exists.**
|
|
244
|
+
|
|
245
|
+
Run the `/ready` command logic, filtered to configured team:
|
|
246
|
+
- Query active issues for THIS team only
|
|
247
|
+
- Filter to those with no blocking dependencies
|
|
248
|
+
- Sort by priority, then age
|
|
249
|
+
- Report top 3-5 ready items
|
|
250
|
+
|
|
251
|
+
### Step 6: Report Context Summary
|
|
252
|
+
|
|
253
|
+
First, output a summary of the gathered context:
|
|
254
|
+
|
|
255
|
+
```
|
|
256
|
+
## Session Context
|
|
257
|
+
|
|
258
|
+
**Linear Team**: [team_key] - [team_name]
|
|
259
|
+
|
|
260
|
+
**Active Agents**: [count or "None"]
|
|
261
|
+
**Handoff**: [Found / None]
|
|
262
|
+
**Git**: [branch] ([clean/uncommitted])
|
|
263
|
+
**Ready Work**: [count] items
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### Step 7: Interactive Session Mode Selection (AskUserQuestion)
|
|
267
|
+
|
|
268
|
+
**Use AskUserQuestion to let the user choose their session mode:**
|
|
269
|
+
|
|
270
|
+
If a recent handoff exists, first confirm acknowledgment:
|
|
271
|
+
```typescript
|
|
272
|
+
AskUserQuestion({
|
|
273
|
+
questions: [{
|
|
274
|
+
header: "Handoff",
|
|
275
|
+
question: "A handoff from [date] recommends: '[recommended task]'. How do you want to proceed?",
|
|
276
|
+
multiSelect: false,
|
|
277
|
+
options: [
|
|
278
|
+
{ label: "Continue recommended (Recommended)", description: "Pick up where last session left off" },
|
|
279
|
+
{ label: "New task", description: "Choose a different task from backlog" },
|
|
280
|
+
{ label: "Explore first", description: "Review codebase before deciding" }
|
|
281
|
+
]
|
|
282
|
+
}]
|
|
283
|
+
})
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
If NO handoff exists:
|
|
287
|
+
```typescript
|
|
288
|
+
AskUserQuestion({
|
|
289
|
+
questions: [{
|
|
290
|
+
header: "Session",
|
|
291
|
+
question: "What would you like to work on this session?",
|
|
292
|
+
multiSelect: false,
|
|
293
|
+
options: [
|
|
294
|
+
{ label: "Pick from backlog (Recommended)", description: "Select a ready task from Linear" },
|
|
295
|
+
{ label: "Continue in-progress", description: "Resume existing work" },
|
|
296
|
+
{ label: "Explore codebase", description: "Discovery before committing to work" },
|
|
297
|
+
{ label: "Custom task", description: "Describe what you want to work on" }
|
|
298
|
+
]
|
|
299
|
+
}]
|
|
300
|
+
})
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
### Step 8: Contextual Follow-up Based on Selection
|
|
304
|
+
|
|
305
|
+
**If "Pick from backlog" or "New task" selected:**
|
|
306
|
+
|
|
307
|
+
Present a task picker from ready work:
|
|
308
|
+
```typescript
|
|
309
|
+
AskUserQuestion({
|
|
310
|
+
questions: [{
|
|
311
|
+
header: "Task",
|
|
312
|
+
question: "Which task would you like to work on?",
|
|
313
|
+
multiSelect: false,
|
|
314
|
+
options: [
|
|
315
|
+
// Dynamically populate from ready work (top 3-4)
|
|
316
|
+
{ label: "[ANV-XX]: [Short title]", description: "Priority: P1 | [brief context]" },
|
|
317
|
+
{ label: "[ANV-YY]: [Short title]", description: "Priority: P2 | [brief context]" },
|
|
318
|
+
{ label: "[ANV-ZZ]: [Short title]", description: "Priority: P2 | [brief context]" }
|
|
319
|
+
// "Other" option automatically available for custom selection
|
|
320
|
+
]
|
|
321
|
+
}]
|
|
322
|
+
})
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
**If "Continue in-progress" selected:**
|
|
326
|
+
|
|
327
|
+
If multiple in-progress items, present picker:
|
|
328
|
+
```typescript
|
|
329
|
+
AskUserQuestion({
|
|
330
|
+
questions: [{
|
|
331
|
+
header: "Resume",
|
|
332
|
+
question: "Which in-progress work do you want to continue?",
|
|
333
|
+
multiSelect: false,
|
|
334
|
+
options: [
|
|
335
|
+
// Dynamically populate from in-progress work
|
|
336
|
+
{ label: "[ANV-XX]: [Title]", description: "Branch: [branch] | Last: [time ago]" }
|
|
337
|
+
]
|
|
338
|
+
}]
|
|
339
|
+
})
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
**If "Explore codebase" selected:**
|
|
343
|
+
- Output: "Ready for exploration. What would you like to explore?"
|
|
344
|
+
- Don't use AskUserQuestion here—let user describe freely
|
|
345
|
+
|
|
346
|
+
**If "Custom task" selected:**
|
|
347
|
+
- Output: "Describe the task you'd like to work on."
|
|
348
|
+
- Don't use AskUserQuestion—user provides description
|
|
349
|
+
|
|
350
|
+
### Step 9: Branch Selection (Contextual)
|
|
351
|
+
|
|
352
|
+
After task is selected, determine branch action:
|
|
353
|
+
|
|
354
|
+
**If selected task has existing branch:**
|
|
355
|
+
```typescript
|
|
356
|
+
AskUserQuestion({
|
|
357
|
+
questions: [{
|
|
358
|
+
header: "Branch",
|
|
359
|
+
question: "Task [ANV-XX] has existing branch 'feature/ANV-XX-[slug]'. What would you like to do?",
|
|
360
|
+
multiSelect: false,
|
|
361
|
+
options: [
|
|
362
|
+
{ label: "Switch to it (Recommended)", description: "Checkout existing feature branch" },
|
|
363
|
+
{ label: "Stay on current", description: "Stay on [current branch]" },
|
|
364
|
+
{ label: "Create new branch", description: "Start fresh with new branch" }
|
|
365
|
+
]
|
|
366
|
+
}]
|
|
367
|
+
})
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
**If selected task has NO existing branch:**
|
|
371
|
+
```typescript
|
|
372
|
+
AskUserQuestion({
|
|
373
|
+
questions: [{
|
|
374
|
+
header: "Branch",
|
|
375
|
+
question: "Create a new branch for [ANV-XX]?",
|
|
376
|
+
multiSelect: false,
|
|
377
|
+
options: [
|
|
378
|
+
{ label: "Yes, create branch (Recommended)", description: "Create feature/ANV-XX-[slug]" },
|
|
379
|
+
{ label: "No, stay on current", description: "Work on [current branch]" }
|
|
380
|
+
]
|
|
381
|
+
}]
|
|
382
|
+
})
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
### Step 10: Execute and Confirm
|
|
386
|
+
|
|
387
|
+
Based on selections:
|
|
388
|
+
1. Switch/create branch if requested
|
|
389
|
+
2. Update Linear issue status to "In Progress" if applicable
|
|
390
|
+
3. Output final confirmation:
|
|
391
|
+
|
|
392
|
+
```
|
|
393
|
+
## Session Ready
|
|
394
|
+
|
|
395
|
+
**Task**: [ANV-XX]: [Title]
|
|
396
|
+
**Branch**: feature/ANV-XX-[slug]
|
|
397
|
+
**Status**: In Progress
|
|
398
|
+
|
|
399
|
+
Ready to begin. Run `/explore` if this is a new feature, or describe what you'd like to do first.
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
---
|
|
403
|
+
|
|
404
|
+
## Output Format (Legacy - for non-interactive fallback)
|
|
405
|
+
|
|
406
|
+
If AskUserQuestion is unavailable or user prefers text-based interaction:
|
|
407
|
+
|
|
408
|
+
Output format (WITH Linear configured):
|
|
409
|
+
```
|
|
410
|
+
## Session Orientation
|
|
411
|
+
|
|
412
|
+
**Linear Team**: [team_key] - [team_name]
|
|
413
|
+
|
|
414
|
+
**Active Agents** (ANV-224):
|
|
415
|
+
| Agent | Project | Claimed Issues | Phase |
|
|
416
|
+
|-------|---------|----------------|-------|
|
|
417
|
+
| A1 | anvil-dev-framework | ANV-22 | implement |
|
|
418
|
+
| A2 | anvil-dev-framework | ANV-30, ANV-31 | plan |
|
|
419
|
+
|
|
420
|
+
[Or if no other agents: "No other active agents detected."]
|
|
421
|
+
|
|
422
|
+
**Handoff Status**: [Found recent handoff / No recent handoff]
|
|
423
|
+
[If found: Key context summary]
|
|
424
|
+
|
|
425
|
+
**Git State**:
|
|
426
|
+
- Branch: [branch name]
|
|
427
|
+
- Status: [clean / uncommitted changes]
|
|
428
|
+
|
|
429
|
+
**In-Progress Work** ([team_key]):
|
|
430
|
+
[List any in-progress Linear issues for THIS team]
|
|
431
|
+
|
|
432
|
+
**Ready Work** (top 5 from [team_key]):
|
|
433
|
+
1. [Issue key]: [Title] (Priority: [P0-P3]) [Claimed by A1 / Available]
|
|
434
|
+
2. ...
|
|
435
|
+
|
|
436
|
+
**Recommended Next Action**: [Based on handoff or highest priority UNCLAIMED ready work]
|
|
437
|
+
[If issues are claimed: Recommend unclaimed issues to avoid conflicts]
|
|
438
|
+
|
|
439
|
+
Awaiting your direction.
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
Output format (WITHOUT Linear configured):
|
|
443
|
+
```
|
|
444
|
+
## Session Orientation
|
|
445
|
+
|
|
446
|
+
**⚠️ Linear Not Configured**
|
|
447
|
+
This project is not mapped to a Linear team.
|
|
448
|
+
Run `/linear-setup` to associate with a team.
|
|
449
|
+
|
|
450
|
+
**Active Agents** (ANV-224):
|
|
451
|
+
| Agent | Project | Claimed Issues | Phase |
|
|
452
|
+
|-------|---------|----------------|-------|
|
|
453
|
+
| A1 | anvil-dev-framework | (ad-hoc work) | implement |
|
|
454
|
+
|
|
455
|
+
[Or if no other agents: "No other active agents detected."]
|
|
456
|
+
|
|
457
|
+
**Handoff Status**: [Found recent handoff / No recent handoff]
|
|
458
|
+
[If found: Key context summary]
|
|
459
|
+
|
|
460
|
+
**Git State**:
|
|
461
|
+
- Branch: [branch name]
|
|
462
|
+
- Status: [clean / uncommitted changes]
|
|
463
|
+
|
|
464
|
+
**Linear**: Skipped (not configured)
|
|
465
|
+
|
|
466
|
+
**Recommended Next Action**: Run `/linear-setup` to configure Linear integration.
|
|
467
|
+
[If other agents active: Check claims before starting work]
|
|
468
|
+
|
|
469
|
+
Awaiting your direction.
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
## Key Behaviors
|
|
473
|
+
- **ALWAYS** check agent registry and claims first (ANV-224)
|
|
474
|
+
- **ALWAYS** check linear.yaml before querying Linear
|
|
475
|
+
- **ALWAYS** run post-compaction triple-check if session is resuming from compaction (ANV-230)
|
|
476
|
+
- **ALWAYS** verify PR state before committing review feedback (ANV-230)
|
|
477
|
+
- Do NOT show issues from other teams/projects
|
|
478
|
+
- Do NOT start working without explicit direction
|
|
479
|
+
- Do NOT proceed after compaction if state mismatch detected
|
|
480
|
+
- Report findings clearly and concisely
|
|
481
|
+
- Surface any blockers or concerns
|
|
482
|
+
- If handoff recommends specific task, highlight it
|
|
483
|
+
- If issues are claimed, recommend unclaimed alternatives
|
|
484
|
+
|
|
485
|
+
## State Sync (ANV-176)
|
|
486
|
+
|
|
487
|
+
After completing orientation, update the session state:
|
|
488
|
+
|
|
489
|
+
```bash
|
|
490
|
+
python3 global/lib/state_manager.py orient
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
This updates `.claude/anvil-state.json` with:
|
|
494
|
+
- `phase: "orient"`
|
|
495
|
+
- Clears `activeIssue` (starting fresh)
|
|
496
|
+
- Sets `lastCommand: "/orient"`
|
|
497
|
+
|
|
498
|
+
And syncs to the agent registry for statusline visibility.
|
|
499
|
+
|
|
500
|
+
## Integration Points
|
|
501
|
+
- Uses: `global/lib/agent_registry.py` for active agent detection (ANV-222/223)
|
|
502
|
+
- Uses: `global/lib/claim_service.py` for issue claims (ANV-224)
|
|
503
|
+
- Uses: `~/.anvil/agents.json` (agent registry)
|
|
504
|
+
- Uses: `~/.anvil/claims.json` (claims registry)
|
|
505
|
+
- Uses: `.claude/linear.yaml` for team configuration
|
|
506
|
+
- Uses: `.claude/handoffs/` directory
|
|
507
|
+
- Uses: Linear MCP (filtered by team)
|
|
508
|
+
- Uses: Git for repository state
|
|
509
|
+
- Calls: `/ready` logic internally
|
|
510
|
+
- Updates: `.claude/anvil-state.json` via state_manager.py
|