You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
v0.38.0: fleet workflows — token-pilot owns the workflow boundary (#33)
Implements the fleet design note (Phase 1+2) with the dependency
inverted. The original blocker was "does Claude Code's /workflow
propagate a workflow-id env var?" — inspecting the installed 2.1.131
bundle confirmed it does NOT. Rather than build against an interface
that may never exist (the v0.34.0-args trap), token-pilot OWNS the
workflow boundary: `workflow start/end` sets TOKEN_PILOT_WORKFLOW_ID
itself, so the feature works under any orchestration and composes
with CC's /workflow if it ever sets CLAUDE_CODE_WORKFLOW_ID.
New: src/core/workflow.ts
- WorkflowEnvelope persisted to .token-pilot/workflows/<id>.json
- startWorkflow / endWorkflow / loadWorkflow / listWorkflows
- computeWorkflowStatus (pure) + workflowStatus (I/O)
- isWorkflowNearBudget, activeWorkflowId, makeWorkflowId, formatters
Event tagging
- HookEvent gains optional workflow_id
- appendEvent auto-tags from TOKEN_PILOT_WORKFLOW_ID /
CLAUDE_CODE_WORKFLOW_ID, so every existing call site (task,
denied, diagnostic) participates with zero change
CLI: `token-pilot workflow <start|end|status|list>`
- start "<goal>" [--budget=N] [--max-parallel=N] → prints an
`export TOKEN_PILOT_WORKFLOW_ID=<id>` line for eval
- status/end default to the active env id
- registered in typo-guard KNOWN_COMMANDS
Budget guard (advisory, never hard-blocks)
- PreToolUse:Task appends a wind-down note + logs a
workflow_near_budget diagnostic at >=90% of ceiling
- renderPreTaskOutput gains an optional trailing append arg
Workflow-aware sessionTitle
- SessionStart title switches to `[TP] wf · N tasks · X%` when a
workflow is active
Verified end-to-end against the built dist: start → tagged Task event
→ status (4k used / 40% of 10k ceiling, also confirming the v0.37.0
totalTokens extraction) → list → end.
Deliberately NOT built (still gated on real data): fleet memory
rendezvous + ast-index cross-worker cache (SessionCache already
dedups within a process; no data yet on cross-worker duplication),
and a WorkflowComplete polyfill.
Docs: README "Fleet workflows" section; design note Decision updated
to "implemented, dependency inverted".
Tests: 1316/1316 pass (+17 workflow + typo-guard).
Build: clean (25 agents under 0.38.0).
0 commit comments