Start

From anombyte93/atlas-session-lifecycle · View interactive version

Start is an AI agent skill from the GitHub repository anombyte93/atlas-session-lifecycle. Session initialization and lifecycle management: bootstraps session context, organizes files, generates CLAUDE.md, manages soul purpose lifecycle with completion protocol and active context harvesting. Use when user says /start, /init, bootstrap session, initialize session, or organize project.

How to use this skill

Skill file

Session Init & Lifecycle Skill

User runs /start. Questions upfront. Everything else silent. Then seamlessly continue working.

All session operations use atlas-session MCP tools directly (prefixed session_* and contract_*). Use ToolSearch to discover them.

Directive Capture

Capture any text after /start as DIRECTIVE. If empty, the soul purpose is the directive.

The skill NEVER finishes with "ready to go" and stops. After setup, immediately begin working.

UX Contract (MANDATORY)

  1. NEVER announce step names — no "Init Step 1", no "Wave 2"
  2. NEVER narrate internal process — no "Detecting environment..."
  3. NEVER explain what you're about to do — just ask questions, then do it silently
  4. User sees ONLY: questions and seamless continuation into work
  5. Batch questions — as few rounds as possible
  6. No "done" message that stops — after setup, immediately begin working

Hard Invariants

  1. User authority is absolute — AI NEVER closes a soul purpose. Only suggests; user decides.
  2. Zero unsolicited behavior — Skill ONLY runs when user types /start.
  3. Human-visible memory only — All state lives in files.
  4. Idempotent — Safe to run multiple times.
  5. Templates are immutable — NEVER edit bundled template files.
  6. NEVER auto-invoke doubt agent. Only offer it.
  7. Trust separation — for bounty verify, spawn a separate finality Task agent. Never the same agent that submits.
  8. AtlasCoin is optional — if the service is down, tell the user and continue without bounty tracking.

Service Availability (MANDATORY)

  1. NEVER run claude mcp list — assume atlas-session is available, handle errors on first call
  2. NEVER block on external services — log the gap and continue with degraded mode
  3. Fallback hierarchy: try tool → if error/timeout → tell user what's degraded → continue

| Service | If Unavailable | Action |

|---------|---------------|--------|

| atlas-session MCP | session_start errors/times out | STOP — required for /start |

| AtlasCoin | contract_health() fails | Continue without bounty tracking |

| Perplexity | Research queries fail | Context7 + WebSearch fallback |

| Context7 | Doc queries fail | Perplexity results only |

| Bitwarden | Vault locked/unavailable | Tell user, skip credential fetch |


INIT MODE

Triggered when session_start returns preflight.mode == "init".

Step 1: Preflight + Assessment (composite)

MCP AVAILABILITY — assume atlas-session is available (do NOT run claude mcp list):

  1. Call session_start(project_dir, DIRECTIVE) — returns combined preflight + validate + read_context + git_summary + classify_brainstorm + clutter check in ONE call.
  2. If the call errors or times out, STOP and inform user:

```

atlas-session MCP is not responding. /start requires this MCP to function.

To fix:

1. Check ~/.claude.json or project .mcp.json has atlas-session entry

2. Verify Python module: python3 -c "from atlas_session import server"

3. Restart Claude Code after fixing

```

Do NOT proceed with any other steps if session_start fails.

  1. Extract results: preflight = result["preflight"], read_context = result["read_context"], git_summary = result["git_summary"], classify_brainstorm = result["classify_brainstorm"], clutter = result["clutter"].

Step 2: Brainstorm Weight + File Organization

  1. Extract BRAINSTORM_WEIGHT from result["classify_brainstorm"]["weight"] for Step 4.

File organization (only if result["clutter"] is present and status is "cluttered"):

Present the grouped move map from result["clutter"]:

Step 3: Silent Bootstrap + CI/CD Detection

  1. Call session_init(project_dir, DIRECTIVE_OR_PENDING)
  2. Call session_ensure_governance(project_dir)
  3. Call session_cache_governance(project_dir)
  4. Run /init (Claude Code built-in — refreshes CLAUDE.md. Must run in main thread.)
  5. Call session_restore_governance(project_dir)

CI/CD Scaffold Detection (smart, zero-friction):

Use project_signals from result["preflight"] (already available from Step 1).

Determine CI/CD action based on these rules:

| Condition | Action |

|-----------|--------|

| has_ci == true | Skip — already has CI/CD |

| has_code_files == false OR is_empty_project == true | Skip — no code to test |

| Simple script only (1-2 .py/.sh files, no package manifest) | Skip — toy project |

| Has package manifest (package.json, pyproject.toml, Cargo.toml, go.mod) | Prompt user (see below) |

| 3+ code files but no package manifest | Prompt user (see below) |

Prompt when needed:

"This project has code files but no CI/CD. Atlas-Copilot can scaffold GitHub Actions workflows (CI tests + Claude review). Enable?"

Options:

Scaffold logic (if user accepts):

Detect language/stack from project_signals:

Create .github/workflows/ directory, then:

  1. CI workflow (ci.yml): calls anombyte93/atlas-copilot/.github/workflows/reusable-ci.yml@v1 with appropriate inputs
  2. Review workflow (claude-review.yml): calls anombyte93/atlas-copilot/.github/workflows/reusable-claude-review.yml@v1

Use language-specific defaults:

| Stack | test-command | build-command | install-command |

|-------|--------------|---------------|-----------------|

| Node.js | npm test -- --coverage --ci | npm run build | npm ci |

| Python | pytest tests/ -x --tb=short | (empty) | pip install -e ".[dev]" |

| Go | go test ./... -v -race | (empty) | go mod download |

| Rust | cargo test --verbose | cargo build --verbose | (empty) |

  1. Read custom.md if it exists, follow instructions under "During Init".

Step 4: Quick Clarify + Activate + Continuation

Quick Clarify runs first (always):

Invoke skill: "quick-clarify" with the DIRECTIVE.

This asks 3 questions: deliverable type, done criteria, and size.

For Medium/Large tasks, it also runs research.

After brainstorm completes:

  1. Call session_activate(project_dir, DERIVED_SOUL_PURPOSE, DIRECTIVE_OR_PENDING) — sets soul purpose, enables stop hook, and returns feature claims in ONE call.
  2. Extract feature claims from the result for tracking.

Bounty creation (optional):

Call contract_health(). If healthy, call contract_create(project_dir, DERIVED_SOUL_PURPOSE, escrow, criteria) using contract_draft_criteria for suggestions.

Default escrow: 100. Increase for complex soul purposes at AI's discretion.

If AtlasCoin is down, tell user and continue without bounty.

Before Starting Work (MANDATORY)

  1. Count independent tasks in the soul purpose.
  2. If 2+ independent tasks:
  1. If single task: proceed without team.
  2. NEVER spawn ad-hoc background Task agents for implementation.
  3. Invoke superpowers:test-driven-development if soul purpose involves code.
  4. Invoke superpowers:writing-plans if soul purpose has 3+ steps.

Auto-Invocation of Soul Loop (MANDATORY for code tasks)

Detect if Soul Loop should be enabled:

  1. Check if soul purpose involves code — Look for keywords: "implement", "build", "fix", "add", "create", "refactor", "update", "write"
  2. Determine intensity from task size (from quick-clarify):
  1. Configure gates from project structure:

```bash

GATES="research,deterministic"

# Add E2E gate if tests/e2e/ exists

if [[ -d "$PROJECT_DIR/tests/e2e" ]]; then

GATES="$GATES,e2e"

fi

# Add Acceptance gate if config/trello-testing.json exists

if [[ -f "$PROJECT_DIR/config/trello-testing.json" ]]; then

GATES="$GATES,acceptance"

fi

```

  1. Invoke Soul Loop:

```

/soul-loop "$DERIVED_SOUL_PURPOSE" --intensity $INTENSITY --gates "$GATES"

```

This is automatic — do not ask the user. Soul Loop provides the backpressure guardrails for iterative development.

Ralph Loop Invocation (optional, for iterative work)

If iterative development is appropriate for the soul purpose, use /ralph-loop:

/ralph-loop "DERIVED_SOUL_PURPOSE" --max-iterations N --completion-promise "TEXT"

The user controls iterations and completion promises.

CRITICAL: you must call the Skill tool — not just mention it in text.

Soul Loop Invocation (backpressure-enforced iteration)

Soul Loop enforces hierarchical backpressure gates on each iteration. Use for iterative development that needs quality guardrails.

| Intensity | Invocation |

|-----------|------------|

| Small | /soul-loop "SOUL_PURPOSE" --intensity small |

| Medium | /soul-loop "SOUL_PURPOSE" --intensity medium |

| Long | First skill: "prd-taskmaster", then /soul-loop "SOUL_PURPOSE" --intensity long |

Gate Hierarchy:

To complete: Output <promise>YOUR_COMPLETION_PROMISE</promise> when done.

CRITICAL: Soul loop enforces backpressure. Test failures allow continued iteration with warnings. After 10 failures, hard block.


RECONCILE MODE

Triggered when session_start returns preflight.mode == "reconcile".

UX: Everything in Steps 1-2 is invisible to the user. First visible interaction is a question (Step 3) or seamless work continuation (Step 4).

Step 0: Sync Previous State

Before any assessment, save the current session state so context files reflect reality:

  1. Invoke /sync — updates all session-context files and MEMORY.md with current progress.
  2. This is silent — no output shown to user.

Step 1: Silent Assessment + Context Reality Check (composite)

MCP AVAILABILITY — assume atlas-session is available (do NOT run claude mcp list):

  1. Call session_start(project_dir, DIRECTIVE) — returns combined assessment in one call.
  2. If the call errors or times out, STOP and inform user (same message as Init Mode). Do NOT proceed.
  3. Extract: preflight, validate, read_context, git_summary, classify_brainstorm, clutter from the result.
  4. Call session_cache_governance(project_dir)
  5. Run /init in main thread.
  6. Call session_restore_governance(project_dir)
  7. Compare read_context against git_summary: if context is stale (commits exist that aren't reflected in active context), update session-context/CLAUDE-activeContext.md with real progress.
  8. Check capability inventory: call session_capability_inventory(project_dir) and check response.
  1. Read CLAUDE-capability-inventory.md if it exists. Extract untested code, security claims, and feature claims with gaps.
  2. Check bounty: if session-context/BOUNTY_ID.txt exists, call contract_get_status(project_dir).
  3. Read custom.md if it exists, follow instructions under "During Reconcile".

Root Cleanup

If result["clutter"] is present and status is "cluttered", present move map to user (same flow as Init Step 2).

Step 2: Directive + Features + Self-Assessment

If DIRECTIVE is non-empty (3+ words) AND status_hint is no_purpose:

If DIRECTIVE is non-empty (3+ words) AND soul purpose exists:

Otherwise (no directive):

  1. Call session_features_read(project_dir) — check feature claim status.
  2. Using read_context + features_read + git_summary, classify:

Step 3: User Interaction (conditional)

If clearly_incomplete: No questions. Skip to Step 4.

If probably_complete or uncertain:

Ask ONE question: "Soul purpose: '[text]'. [1-2 sentence assessment]. [Bounty: active/none]. What would you like to do?"

Step 4: Continuation

Transition directly into work. No "session reconciled" message.

Before Starting Work (MANDATORY)

  1. Count independent tasks in the soul purpose.
  2. If 2+ independent tasks:
  1. If single task: proceed without team.
  2. NEVER spawn ad-hoc background Task agents for implementation.
  3. Invoke superpowers:test-driven-development if soul purpose involves code.
  4. Invoke superpowers:writing-plans if soul purpose has 3+ steps.

Ralph Loop Check (Reconcile)

Check if a Ralph Loop is already active:

test -f ~/.claude/ralph-loop.local.md && echo "active" || echo "inactive"

Note: Ralph Loop is no longer auto-invoked. User can manually start it with /ralph-loop if needed for iterative work.


SETTLEMENT FLOW

Triggered when user chooses "Close" in Reconcile Step 3.

Read custom.md if it exists, follow instructions under "During Settlement".

Step 1: Harvest + Promote + Feature Verification (composite)

  1. Call session_close(project_dir) — returns combined harvest + features_read + hook_deactivate in ONE call.
  2. Extract harvest = result["harvest"], features = result["features"], hook = result["hook"].
  3. If promotable content exists in harvest, assess what to promote (decisions need rationale, patterns must be reusable, troubleshooting must have verified solutions). Present to user for approval.
  4. After approval, append promoted content to target files via Edit tool.
  5. If pending features exist in features, run their proofs (shell commands, file checks).
  6. Update feature status in CLAUDE-features.md.

Step 2: Code Review Gate

  1. Invoke superpowers:verification-before-completion — run doubt review on recent changes.
  2. If critical issues found, present to user: "Fix issues first" / "Close anyway" / "Continue working".
  3. Invoke superpowers:requesting-code-review before PR creation.

Step 3: PR Creation

  1. Push current branch: git push -u origin HEAD
  2. Create PR: gh pr create --title "..." --body "..." with review summary.
  3. Return PR URL to user.

Step 4: Bounty Settlement (if bounty exists)

  1. Call contract_run_tests(project_dir) — execute all criteria.
  2. If tests pass, call contract_submit(project_dir).
  3. Spawn a single finality Task agent: Task(subagent_type: "general-purpose", prompt: "You are finality-agent. Verify bounty [ID] independently. Call contract_verify. Report pass/fail.")
  4. Wait for finality result.
  5. If verified: call contract_settle(project_dir). Tell user tokens earned.
  6. If failed: present to user — "Fix and re-verify" / "Close anyway (forfeit)" / "Continue working".

Step 5: Archive + Cleanup

  1. Call session_archive(project_dir, OLD_PURPOSE, NEW_PURPOSE) — archive soul purpose, reset active context.
  2. Remove Ralph Loop indicator: rm -f ~/.claude/ralph-loop.local.md
  3. Tell user: "Session closed. Soul purpose '[text]' archived." (Include token info if bounty settled.)

Customizations

Create or edit custom.md in the plugin root directory.

The AI reads custom.md at each lifecycle phase:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.