Skill v1.0.0
currentAutomated scan100/100description: Define and reconcile the portable .current-epic runtime state for Jira Epic execution in Polytoken. Use before bootstrapping, resuming, spawning task workers, merging task branches, closing an Epic, or handing the Epic to another runtime. polytoken: tags: [jira-epic, workflow] metadata: version: "1.0.0"
Jira Epic State
Use this skill whenever you inspect, create, reconcile, or update .current-epic/ for Jira Epic execution.
The state rule is:
A Polytoken session must be able to reconstruct the Epic run from.current-epic/plus git history.
Chat memory, todos, running job ids, and subagent claims are not durable truth. They are convenience state only.
Naming
Jira project keys such as ABC-73 identify Jira issues. Do not name Epic branches or worktrees abc-73; that shape reads like a task branch. Name Epic branches and worktrees with the Epic role:
epic-73epic-73-task-Aepic-73-task-B
When the Jira Epic key is not numeric, choose a short branch-safe slug that starts with epic- and records the Jira key in manifest.txt.
Directory Layout
The parent orchestrator works from the Epic worktree. The portable state lives in that Epic worktree:
.current-epic/manifest.txtdependencies.dotworkflow.dottask-state.jsonmerge-gate.jsonevents.logtask-<prefix>.mdplan-<prefix>.mdfindings-<scope>.jsonldeferrals.jsonlruntime/polytoken/jobs.jsonactive-worktrees.jsonsubagent-results/planner-<prefix>.jsonimplementor-<prefix>.jsonreviewer-<prefix>.json
Portable files:
manifest.txtdependencies.dotworkflow.dottask-state.jsonmerge-gate.jsonevents.logtask-<prefix>.mdplan-<prefix>.mdfindings-<scope>.jsonl, where<scope>is a task prefix such asA, a docs lane such asdocs-A, orepicfor final branch reviewdeferrals.jsonl, the durable register of every accepted deferral, accepted risk, out-of-scope decision, skipped test tier, or follow-up that is not fixed in the Epic branch before closeout. Every entry must have survived the plan deferral skeptic gate. Entries that were not skeptic-approved are invalid and must be removed (and the work done instead).
Runtime-local files:
- everything under
.current-epic/runtime/polytoken/
Do not delete runtime-local files during reconciliation. They are advisory evidence for the next Polytoken session.
Per-Task Context Bundles
Before spawning an implementor or task reviewer, copy the task's local contract into the task worktree:
.current-task/task.mdplan.mdmanifest.txtdependency-summary.md
The parent creates and updates .current-task/. Worker subagents may read it, but they must not treat it as the source of global coordination state. The parent remains the only writer of .current-epic/task-state.json, .current-epic/merge-gate.json, and .current-epic/events.log.
Manifest Contract
Write .current-epic/manifest.txt as plain text:
Flavor: polytoken-parallelEpic-Key: ABC-73Epic-URL: https://<site>.atlassian.net/browse/ABC-73Project: <PROJECT_KEY>Epic-branch: epic-73Epic-worktree: .worktrees/epic-73Base-branch: mainTasks:A ABC-81 https://<site>.atlassian.net/browse/ABC-81 Implement durable session indexB ABC-82 https://<site>.atlassian.net/browse/ABC-82 Update CLI help text
The task line schema is:
<prefix> <jira-key> <jira-url> <title...>
Do not encode task classes or concrete model names in manifest.txt. Epic task execution uses one standard review intensity for every task. Concrete Polytoken model choices belong in the orchestrator's subagent calls, .current-epic/runtime/polytoken/jobs.json, or the parent transcript.
Dependency Graph
dependencies.dot is Graphviz DOT. An edge A -> B means Task A must complete before Task B starts.
Build this graph from Jira issue links such as Blocks / is blocked by. If Jira contains contradictory dependency links, stop and surface the conflicting issue keys.
Use the graph, task-state.json, and git trailers to compute task eligibility. Do not rely on in-context memory.
Task State
task-state.json is the portable status checkpoint. It is advisory when it disagrees with git history. Git trailers win for completion.
Schema:
{"schema_version": 1,"updated_at": "2026-06-21T12:00:00Z","updated_by": "polytoken","epic": {"jira_key": "ABC-73","jira_url": "https://<site>.atlassian.net/browse/ABC-73","branch": "epic-73","worktree": ".worktrees/epic-73","base_branch": "main"},"tasks": {"A": {"phase": "pending","jira_key": "ABC-81","jira_url": "https://<site>.atlassian.net/browse/ABC-81","title": "Task title","branch": "epic-73-task-A","worktree": ".worktrees/epic-73-task-A","task_cache": ".current-epic/task-A.md","plan_path": ".current-epic/plan-A.md","task_context_dir": ".worktrees/epic-73-task-A/.current-task","job_id": null,"commit": null,"last_error": null}}}
Allowed phase values:
pendingplanner-spawnedplan-authoredimplementor-spawnedin-progressawaiting-reviewreview-blockedawaiting-mergemergingcompletedblocked-failureplan-authored-halted
Skeptic gates and the orchestrator test gate do not have separate phase values; they run between existing phases (after review-clean, before the next phase) and hold the task in its current phase until they pass. Dynamic tasks appended by the orchestrator use phase: "pending" and are processed identically to original tasks.
When reconstructing missing state, derive task records from manifest.txt, dependencies.dot, existing plan-*.md files, merge-gate.json, and git log trailers.
Merge Gate
Use .current-epic/merge-gate.json to serialize task branch merges into the Epic branch:
{"holder": null,"queue": []}
The holder should be implementor-<prefix> or task-<prefix>. The merge gate is separate from the repository-level .merge-lock, which only protects final merges to main.
Grant order:
- Verify the holder is null.
- Write
merge-gate.jsonwith the new holder. - Update
task-state.jsonphase tomerging. - Append
merge-grantedtoevents.log.
Release order:
- Verify the task commit exists on the Epic branch with matching trailers.
- Update
task-state.jsontocompletedand record the commit. - Release the holder.
- Append
task-mergedtoevents.log.
Deferral Register
deferrals.jsonl is portable JSONL and is the durable source of truth for work that is consciously not fixed before Epic closeout. Chat messages, todos, Jira comments, and reviewer summaries are not enough. If the parent accepts a follow-up, skips a relevant test tier, narrows a task scope, carries an accepted risk, or decides not to fix a review finding in the Epic branch, it must append a record immediately. However, deferrals are only permitted when something is computationally impossible. Every deferral must survive the plan deferral skeptic gate (a general-purpose subagent with @mg:arch using hostile/skeptical prompting). The skeptic's verdict is binding. A deferral record that has not been skeptic-approved is invalid.
{"schema_version":1,"deferral_id":"ABC-73-D001","created_at":"2026-06-21T12:00:00Z","scope":"G","jira_key":"ABC-88","kind":"test-tier-skipped","severity":"high","summary":"Compaction-before-continuation was not covered by provider double.","reason":"No deterministic provider double compaction harness exists yet.","operator_decision":"approved","skeptic_approved":true,"skeptic_verdict":"The provider double compaction harness requires daemon API surface changes that are computationally impossible within this task scope.","evidence":[".current-epic/findings-G.jsonl:G-plan-2-F5"],"follow_up":"Create a dedicated compaction harness task before release.","status":"open"}
Required fields: schema_version, deferral_id, created_at, scope, kind, severity, summary, reason, operator_decision, skeptic_approved, and status. When skeptic_approved is true, include skeptic_verdict with the skeptic's reasoning. Use stable deferral_id values and append updates rather than rewriting history. Allowed status values are open, closed, and superseded. Allowed kind values include accepted-risk, scope-deferral, test-tier-skipped, docs-deferral, follow-up, and operator-decision. Critical/high deferrals require an explicit operator decision note; do not invent approval. A deferral with skeptic_approved: false or missing skeptic_approved is invalid and the work must be done instead.
At closeout, every open deferral must be surfaced in the Jira summary and final operator message. If an open deferral is discovered during reconciliation but is not in deferrals.jsonl, append it before continuing.
Events Log
events.log is JSONL. Append one line per state transition:
{"ts":"2026-06-21T12:00:00Z","runtime":"polytoken","event":"plan-authored","task_prefix":"A","details":{"plan_path":".current-epic/plan-A.md"}}
Use this event vocabulary when possible:
bootstrap-startedbootstrap-completedplan-spawnedplan-authoredimplementor-spawnedimplementation-startedreview-spawnedreview-completedmerge-requestedmerge-grantedtask-mergedtask-blockedruntime-handoffclosing-startedclosing-completed
The log is audit evidence, not the current-state source of truth.
Commit Trailers
Every task merge commit on the Epic branch must include Jira keys:
Epic: ABC-73Task: ABC-81
Task completion is true only when the Epic branch contains a commit between Base-branch..HEAD with the matching Task: trailer. If task-state.json says completed but no matching trailer exists, mark the task blocked and surface the corruption.
Epic-level fix commits made during closeout include only the Epic trailer:
Epic: ABC-73
Reconciliation Procedure
When bootstrapping, resuming, or handing off:
- Read
manifest.txt. - Read
dependencies.dot. - Read
task-state.jsonif present. - Read
merge-gate.jsonif present; otherwise create{"holder": null, "queue": []}. - Scan
.current-epic/plan-*.md. - Scan
.current-epic/findings-*.jsonland reconstruct the latest finding disposition for each stable finding id. These files cover task plan/implementation reviews, docs lane reviews, and final Epic branch review. If two records share afinding_idbut disagree onscopeorphase, stop and surface state corruption. - Scan
.current-epic/deferrals.jsonlif present and reconstruct open/closed/superseded deferrals. If an accepted-risk finding, skipped relevant test tier, narrowed scope, or follow-up appears in portable findings or review summaries but has no matching deferral record, append one before continuing. Critical/high deferrals require an explicit operator decision note. - Defensively scan completed review results under
.current-epic/runtime/polytoken/subagent-results/. If a completed review generation has findings absent from the matching portable finding log, append them to the portable log asopenbefore applying gates. Runtime files remain advisory after this fold-in step. - Run
git log --format=%H%n%B <base>..HEADon the Epic branch. - For each manifest task:
- If git has the task trailer, set
phase = completedand record the commit. - Else if a plan exists and phase is missing, set
phase = plan-authored. - Else preserve the existing non-completed phase if plausible.
- Else set
phase = pending.
- If a task has open critical/high plan findings, keep it at
review-blockedrather thanplan-authored. If a task has open critical/high implementation findings, keep it atreview-blockedrather thanawaiting-mergeorcompletedunless git already has the matchingTask:trailer. Iffindings-epic.jsonlor anyfindings-docs-*.jsonlfile has open critical/high findings, do not consider closeout clean on resume. - If
merge-gate.json.holderreferences a completed task, release it after verifying the trailer. - Append
runtime-handoff,bootstrap-completed, or another appropriate event.
Handoff Rules
Before a long pause or runtime handoff:
- Stop spawning new work.
- Let in-flight merges finish or explicitly mark them blocked.
- Reconcile
task-state.jsonagainst git trailers. - Write
merge-gate.json. - Append
runtime-handoffwith the outgoing runtime and known active task/job ids. - Leave
.current-epic/in place.
Never delete .current-epic/ during handoff.