feat: resumable phase state + artifact-by-reference for lfg/slfg#53
Merged
Conversation
Emulates two Claude Code Dynamic Workflow features for the markdown-skill system: phase-completion markers for resumability and passing phase outputs by reference, keeping the orchestrator's context lean. - New tiny Node helper (.github/hooks/scripts/lfg-state.js, shipped via templates) storing run state under .atv/runs/<run-id>/ as an immutable meta.json plus atomic per-phase sentinels. Mirrors observe.js; zero new dependencies. Two-stage run identity, path sanitization, atomic writes. - lfg/slfg gain a Run State section: derive/resume run-id, skip done phases, mark phases done with artifact paths, thread run:<id>, parent-only writes in slfg's parallel phase. - ce-plan/ce-work/ce-review recognize-and-strip run:<run-id>; ce-work adds mode:orchestrated for resume-safe execution (no PR/ship, reconciles state). - .gitignore: .atv/runs/ (ephemeral, local-only). - 40 tests (18 helper unit + 22 skill-contract); regenerated plugins/. Plan: docs/plans/2026-06-01-001-feat-lfg-slfg-resumability-plan.md Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
ATV Starter Kit targets GitHub Copilot; the plan's motivation no longer names Claude Code Dynamic Workflows and instead refers to generic workflow-runtime engines. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds resumable run-state tracking and artifact-by-reference wiring to the markdown-skill orchestrators (/lfg and /slfg) by introducing a tiny Node helper that persists phase completion sentinels under a gitignored .atv/runs/<run-id>/ directory, and threads run:<RUN_ID> through sub-skills.
Changes:
- Introduces
lfg-state.jshelper (dogfood + template) to init/bind runs and mark phases done with optional artifact paths. - Updates
lfg/slfgskills (dogfood + template + generated plugin/pack copies) to resume by skipping done phases and to pass artifacts by reference. - Updates
ce-plan/ce-work/ce-reviewskill docs to recognize/striprun:<run-id>and addsmode:orchestratedguidance for resume-safece-work.
Reviewed changes
Copilot reviewed 30 out of 31 changed files in this pull request and generated 19 comments.
Show a summary per file
| File | Description |
|---|---|
| plugins/atv-skill-slfg/skills/slfg/SKILL.md | Documents resumable SLFG orchestration and run-state protocol in the plugin copy. |
| plugins/atv-skill-lfg/skills/lfg/SKILL.md | Documents resumable LFG orchestration and run-state protocol in the plugin copy. |
| plugins/atv-skill-ce-work/skills/ce-work/SKILL.md | Documents run:<id> + mode:orchestrated orchestration tokens for ce-work. |
| plugins/atv-skill-ce-review/skills/ce-review/SKILL.md | Documents run:<id> token recognition/stripping for ce-review. |
| plugins/atv-skill-ce-plan/skills/ce-plan/SKILL.md | Documents run:<id> token recognition/stripping for ce-plan. |
| plugins/atv-pack-shipping/skills/slfg/SKILL.md | Propagates SLFG resumability/artifact-by-reference docs into shipping pack copy. |
| plugins/atv-pack-shipping/skills/lfg/SKILL.md | Propagates LFG resumability/artifact-by-reference docs into shipping pack copy. |
| plugins/atv-pack-shipping/skills/ce-work/SKILL.md | Propagates ce-work orchestration token docs into shipping pack copy. |
| plugins/atv-pack-review/skills/ce-review/SKILL.md | Propagates ce-review run:<id> token docs into review pack copy. |
| plugins/atv-pack-planning/skills/ce-plan/SKILL.md | Propagates ce-plan run:<id> token docs into planning pack copy. |
| plugins/atv-everything/skills/slfg/SKILL.md | Propagates SLFG resumability/artifact-by-reference docs into “everything” bundle copy. |
| plugins/atv-everything/skills/lfg/SKILL.md | Propagates LFG resumability/artifact-by-reference docs into “everything” bundle copy. |
| plugins/atv-everything/skills/ce-work/SKILL.md | Propagates ce-work orchestration token docs into “everything” bundle copy. |
| plugins/atv-everything/skills/ce-review/SKILL.md | Propagates ce-review run:<id> token docs into “everything” bundle copy. |
| plugins/atv-everything/skills/ce-plan/SKILL.md | Propagates ce-plan run:<id> token docs into “everything” bundle copy. |
| pkg/scaffold/templates/skills/slfg/SKILL.md | Updates SLFG scaffold template to be resumable and pass artifacts by reference. |
| pkg/scaffold/templates/skills/lfg/SKILL.md | Updates LFG scaffold template to be resumable and pass artifacts by reference. |
| pkg/scaffold/templates/skills/ce-work/SKILL.md | Updates ce-work scaffold template docs for orchestration tokens. |
| pkg/scaffold/templates/skills/ce-review/SKILL.md | Updates ce-review scaffold template docs for run:<id> token. |
| pkg/scaffold/templates/skills/ce-plan/SKILL.md | Updates ce-plan scaffold template docs for run:<id> token. |
| pkg/scaffold/templates/hooks/scripts/lfg-state.js | Adds scaffolded Node helper implementing run-state persistence and CLI commands. |
| docs/plans/2026-06-01-001-feat-lfg-slfg-resumability-plan.md | Adds implementation plan documenting the design and delivered test scenarios. |
| .gitignore | Ignores .atv/runs/ run-state directory. |
| .github/skills/slfg/SKILL.md | Updates dogfood SLFG skill with resumability/artifact-by-reference protocol. |
| .github/skills/lfg/SKILL.md | Updates dogfood LFG skill with resumability/artifact-by-reference protocol. |
| .github/skills/ce-work/SKILL.md | Updates dogfood ce-work docs for orchestration tokens and orchestrated mode. |
| .github/skills/ce-review/SKILL.md | Updates dogfood ce-review docs to recognize/strip run:<id>. |
| .github/skills/ce-plan/SKILL.md | Updates dogfood ce-plan docs to recognize/strip run:<id>. |
| .github/hooks/scripts/tests/skill-contract.test.js | Adds contract tests ensuring dogfood/template skills adopt the new protocol. |
| .github/hooks/scripts/tests/lfg-state.test.js | Adds unit tests for the run-state helper’s pure and fs-backed behaviors. |
| .github/hooks/scripts/lfg-state.js | Adds dogfood Node helper implementing run-state persistence and CLI commands. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
- lfg-state.js (template): is-done CLI now honors --phase (was ignoring it and reading positional[0] only), matching the dogfood copy. - lfg/slfg SKILL.md (dogfood + template): use the full 'node .github/hooks/scripts/lfg-state.js ...' path for every runnable helper invocation so commands are copy-paste executable (resolves the bare 'lfg-state.js ...' / bare 'done ...' review threads). - Regenerate plugins/ so the slfg plugin copies match the templates, fixing the failing 'Plugin marketplace drift check' CI step. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Brings two workflow-runtime capabilities into ATV's markdown-skill
lfg/slfgorchestrators:/lfgor/slfgskips already-completed phases instead of restarting the turn.The consumer is an LLM (cost = tokens + tool round-trips, not disk speed), so this deliberately avoids SQLite/a runtime in favor of small JSON files mutated by a tiny Node helper — zero new dependencies (Node is already a hook dependency, mirroring
observe.js).How it works
State lives under
.atv/runs/<run-id>/(gitignored, local-only):Per-phase sentinels eliminate read-modify-write races (important for SLFG's parallel phase); each sentinel's
artifactfield is the by-reference pointer — one structure solves both (A) and (B).Changes
.github/hooks/scripts/lfg-state.js(+ shipped template copy):init,bind-plan,done,is-done,status,run-id-from-plan. Pure functions exported for tests; CLI guarded byrequire.main.lfg/slfg(dogfood + template): Run State section — derive/resume run-id, skipdonephases, mark done with artifact path, threadrun:<RUN_ID>, parent-only writes in SLFG.ce-plan/ce-work/ce-review: recognize-and-striprun:<run-id>;ce-workaddsmode:orchestrated(resume-safe — no PR/ship, reconciles existing git diff/checkboxes/todos)..gitignore:.atv/runs/.plugins/from templates (parity check clean).Design refinements (from a rubber-duck critique pass)
plan_pathafter planning).mode:orchestratedsoce-workreconciles instead of blindly restarting.run:parsed before threading so an unknown token is never mis-read as a PR/branch arg.Testing
ce-plan+ce-work→statusresumes atce-review; re-initpreserves meta.Scope / non-goals
Plan:
docs/plans/2026-06-01-001-feat-lfg-slfg-resumability-plan.md