End-to-end session close-out: scan repo artifacts, create/update Linear issues, sync to Asana with sprint dates, commit all changes, create PR, wait for CI, merge to main. Use when the user says "roadmap", "sync ideas to linear", "push enhancements", "aggregate ideas", "update linear backlog", "update roadmap", or when closing out a session.
Scan the repo for artifact files, review the current session's work, deduplicate against existing Linear issues, create/update Linear issues, and always sync to Asana with sprint sections and dated tasks for Gantt chart view.
Run this FIRST before any other phase. Verify all required tool connections are live. If any fail, report the failure and ask the user how to proceed before continuing.
Call mcp__linear__list_teams (or mcp__linear__list_issues with limit: 1).
Linear: Connected (team: <team_name>)Linear: DISCONNECTED — cannot sync issues. Check MCP server config. → Ask user whether to continue without Linear sync or abort.Asana is synced via asana_sync.py (REST API), not via MCP. Check for the script in this priority order:
scripts/asana_sync.py in the current repo~/Github/claude-hub/scripts/asana_sync.py (canonical copy, always present after sync-machines)Run: python scripts/asana_sync.py --help 2>&1 || python ~/Github/claude-hub/scripts/asana_sync.py --help 2>&1
Asana: REST script ready (<path>)Asana: DISCONNECTED — asana_sync.py not found in repo or claude-hub. → Ask user whether to continue without Asana sync or abort.Also verify ASANA_PAT is set: doppler secrets get ASANA_PAT --project claude-code --config prd --plain 2>/dev/null
doppler run --project claude-code --config prd -- python <script_path> --jsonASANA_PAT directly; if missing, warn and skip Asana sync.Run gh auth status via Bash.
GitHub: Authenticated as <username>GitHub: NOT AUTHENTICATED — git diff will still work but PR operations won't. (non-blocking, continue)Read .claude/roadmap.json. Validate all required fields exist.
Config: Loaded (<linear_project> → <asana_project_name>)Print a summary block:
Pre-flight check:
Linear: OK
Asana: OK
GitHub: OK
Config: Loaded
Proceeding with full sync.
If any critical tool (Linear or Asana) is disconnected, stop and resolve before proceeding.
Required config structure:
{
"linear_team": "<team name>",
"linear_project": "<project name>",
"asana_project_name": "<asana project name>",
"artifact_dirs": ["Docs/", "output/"],
"artifact_extensions": [".html", ".md", ".txt", ".docx", ".pptx"],
"priority_labels": {
"P0": "P0 Critical",
"P1": "P1 High",
"P2": "P2 Medium",
"P3": "P3 Low"
},
"sprint_duration_weeks": {
"Sprint 1": 2,
"Sprint 2": 4,
"Sprint 3": 4,
"Backlog": 8
}
}
Glob to find files in the configured artifact_dirs matching artifact_extensions.<title> tag content or first <h1> text as the artifact title.# heading as the artifact title.{path, title, type, modified_date}Plan_ or containing "plan"Analysis_ or containing "analysis", "gap", "research"Found X artifacts (Y Plans, Z Analysis, ...)mcp__linear__list_issues with project: <config.linear_project>, limit: 250.{normalized_title -> {id, identifier, title, labels, description}}
[P0-1] style prefixes, strip leading/trailing whitespace.Found X existing issues in Linear project "<name>"git diff --name-only to see files changed (unstaged + staged).git diff --cached --name-only for staged-only changes.artifact_dirs)..py files, new dashboard pages).title: short descriptive namepriority: P0/P1/P2/P3 (based on urgency, executive mention, transcript frequency)type: Feature / Improvement / Bugdescription: what it is and why it matterseffort: S/M/L/XLsource: where the idea came from (conversation, transcript, code observation)artifacts: list of related artifact file paths from Phase 2deliverables: expected file paths, DB tables, etc.dependencies: what it depends on or blocksFor each idea from Phase 4:
mcp__linear__save_issue with the existing issue id to update:
---
### Update from Terminal Session (YYYY-MM-DD)
**Source:** <where this came from>
**Additional context:** <new information>
**New artifacts linked:**
- [artifact_title](artifact_path)
Merged into IVA-XXX (existing: "<title>")mcp__linear__save_issue with:
team: from configproject: from configtitle: [P#] <Short descriptive title>labels: ["<priority_label>", "<type_label>"]
P0 Critical, P1 High, P2 Medium, P3 Low (from config)Feature, Improvement, Bug (these must already exist in Linear)priority: 1 (P0 Urgent), 2 (P1 High), 3 (P2 Normal), 4 (P3 Low)description: Use this template:
## <Title>
**Source:** <where this idea came from>
**Effort:** S (1 session) | M (2-3 sessions) | L (4-5 sessions) | XL (6+ sessions)
**Terminal:** <terminal identifier or session description>
### What
<1-3 sentences describing the enhancement and why it matters>
### Builds On
<List existing pages, pipelines, or components this leverages. "None (greenfield)" if new.>
### Deliverables
- <file paths, DB tables, new pages>
### Dependencies
- Depends on: <other enhancements or infrastructure needed first>
- Blocks: <what can't start until this is done>
### Linked Artifacts
- [<artifact_title>](<relative_path>) — <brief description>
blocks or relatedTo params.Created IVA-XXX: "<title>"| Action | Issue | Title |
|--------|-------|-------|
| Created | IVA-XXX | [P1] New Enhancement |
| Merged into | IVA-YYY | [P0-3] Existing Enhancement |
| Created | IVA-ZZZ | [P2] Another Idea |
Always execute this phase. Asana is synced exclusively via asana_sync.py (REST API). Do NOT use Asana MCP tools.
Use whichever path exists (check in this order):
scripts/asana_sync.py (current repo)~/Github/claude-hub/scripts/asana_sync.py (canonical, always present)Run command: doppler run --project claude-code --config prd -- python <script_path> --json <file.json>
Sprint 1: today → today + sprint_duration_weeks["Sprint 1"] weeks
Sprint 2: Sprint 1 end + 1 day → + sprint_duration_weeks["Sprint 2"] weeks
Sprint 3: Sprint 2 end + 1 day → + sprint_duration_weeks["Sprint 3"] weeks
Backlog: Sprint 3 end + 1 day → + sprint_duration_weeks["Backlog"] weeks
"high", P2 → "medium", P3 → "low".asana_sync.py schema:
{
"project_name": "<config.asana_project_name>",
"sections": [
{
"name": "Sprint 1 — P0 Critical",
"tasks": [
{
"name": "[P0] <title>",
"description": "<Linear issue description>",
"start_date": "YYYY-MM-DD",
"due_date": "YYYY-MM-DD",
"assignee": "me",
"priority": "high"
}
]
}
]
}
/tmp/asana_sync_<timestamp>.json).doppler run --project claude-code --config prd -- python <script_path> --json /tmp/asana_sync_<timestamp>.json
The script handles create-or-update idempotently — safe to re-run. It will:
Parse stdout from the script for the summary line and project URL. Print:
Asana Sync Complete:
Project: "<name>"
Created: X tasks
Updated: Y tasks
URL: https://app.asana.com/0/<project_gid>
Asana Sync Complete:
Project: "<name>" (GID: <gid>)
Updated: X tasks
Created: Y tasks
Unchanged: Z tasks
Orphaned: W tasks (no Linear match)
URL: <project_url>
Print a complete summary to the screen:
## Roadmap Sync Complete
### Linear
| Action | Count |
|--------|-------|
| Issues Created | X |
| Issues Updated (Merged) | Y |
| Total in Project | Z |
### Artifacts
| Type | Count |
|------|-------|
| Plans | X |
| Analysis | Y |
| Reference | Z |
| Reports | W |
| Total Linked | N |
### Asana
| Action | Count |
|--------|-------|
| Tasks Updated | X |
| Tasks Created | Y |
| Tasks Unchanged | Z |
| Orphaned | W |
| Project URL | <url> |
Before committing and merging, ask the user to review the roadmap changes:
Print a summary block:
========================================
ROADMAP SYNC COMPLETE — READY TO COMMIT?
========================================
Linear Issues:
Created: X
Merged: Y
Total in project: Z
Asana Tasks:
Created: X
Updated: Y
Project URL: <url>
Artifacts Linked: X files
Files to Commit:
- WorkDoneSummary.md
- Any new artifacts in docs/output/
- Any .claude/roadmap.json updates
Ready to:
1. Commit changes
2. Create PR
3. Wait for CI
4. Merge to main
5. Return to main & pull latest
Proceed? (y/n)
Wait for user input. If user types anything other than y or yes:
Commit cancelled. Changes are still staged. You can review and commit manually later.If user confirms (y/yes):
Only execute if user confirmed in Phase 8.
git add WorkDoneSummary.md
git add .claude/roadmap.json (if it was created/updated)
git add docs/ (if new artifacts exist)
git commit -m "$(cat <<'EOF'