Skip to main content
Guide

Phase 0 - Init & Clarify

Classify the request, assess risk, assign complexity, and clarify only decision blockers.

Purpose

Shallow, non-delegable classification using only the request and supplied evidence - no repository inspection, no delegation to improve confidence.


What Happens

1. Load Configuration & Memory

  • Reads .gem-team.yaml if present
  • Loads continuity memory (repo + session)

2. Normalize Request

Extracts and validates:

FieldValuesRequired
plan_idExact string (YYYYMMDD-slug)For continue_plan/extend
request_statenew_task | continue_plan | extendYes
intentexecute | debug | research | discuss | challengeYes

3. Intent Priority Resolution

When multiple intents could apply, highest wins:

challenge > debug > research > execute > discuss

Ties → ask once. discuss only if explicitly requested.

4. Risk Signal Matching

Matches explicit or strongly implied signals from supplied evidence:

Signal CategoryExamples
Architecturearchitecture, contract_change, breaking_change, api_change, schema_change
Securityauth_change, security_sensitive, data_flow_change
Irreversiblemigration, irreversible, shared_state
Cross-Domaincross_domain_impact

Critical: Only matches from supplied evidence. Does NOT inspect repository.

NO REPO INSPECTIONPhase 0 never inspects the repository. Risk signals come only from the request and supplied context.

5. Provisional Complexity Assignment

One-time assignment based on evidence only:

ComplexityCriteria
TRIVIALOne bounded change, no runtime/dep/contract risk
LOWSmall, reversible, single domain
MEDIUMMultiple dependent tasks/files/components, no high-risk
HIGHAny high-risk signal match
COMPLEXITY DRIVES PROCESSTRIVIAL/LOW → Fast path or in-memory plan. MEDIUM/HIGH → Persistent plan.yaml with full workflow.

Evidence may raise complexity during planning, but Phase 0 never lowers it.

6. Clarification (Only If Blocked)

Asks only when missing info blocks a routing decision (decision_blocker). Otherwise records one bounded assumption and routes immediately.


Input Requirements by Intent

execute (Most Common)

objective: "Add user search endpoint with filtering and pagination"
acceptance_criteria:
  - "GET /api/users/search?q=... returns filtered results"
  - "Pagination with page/limit params"
  - "OpenAPI documentation"
constraints:
  - "Follow existing API conventions in src/api/"
  - "Use Prisma for database queries"

debug

failure: "Tests failing in CI after auth refactor"
expected_behavior: "All auth tests pass"
evidence:
  - "CI logs: authentication.test.ts:42 - token validation error"
  - "Recent changes: src/auth/token.ts refactored"

research

research_question: "How does the current caching layer work?"
expected_deliverable: "Architecture diagram + key interfaces + invalidation strategy"

challenge

proposal: "Replace Redis with in-memory cache for session storage"
decision_needed: "Approve or reject with tradeoffs"

discuss

topic: "Model routing strategy"
question: "Should we use different models for planning vs implementation?"

Output: Phase 0 State

phase_0_state:
  plan_id: "20261121-user-search-api"
  request_state: "new_task"
  intent: "execute"
  objective: "Add user search endpoint..."
  acceptance_criteria: [...]
  constraints: [...]
  provisional_complexity: "MEDIUM"
  high_risk_signals: ["api_change", "contract_change"]
  critic_signals: []
  clarification_needed: false
  assumptions:
    - "Existing user model has name/email fields"
    - "Pagination helper available in src/utils/pagination.ts"

Concrete Classification Examples

RequestIntentComplexityRisk SignalsPath
"Fix typo in README"executeTRIVIALnoneFast path
"Extract validation helper"executeLOWnoneFast path
"Add /api/users/search endpoint"executeMEDIUMapi_changeFull plan
"Migrate auth to OAuth2"executeHIGHauth_change, breaking_changeFull plan + critic review
"How does caching work?"researchLOWnoneResearcher → Phase 4
"Should we use Redis or DB?"challengeMEDIUMarchitectureReviewer critic → Phase 4
"Continue plan 20261121-user-search"continue_planMEDIUMexisting planPhase 3 resume

Edge Cases

SituationHandling
discuss intentPhase 4 direct answer, no plan, no delegation
research standalonegem-researcher → Phase 4; no plan unless promoted via plan_follow_up
challenge intentgem-reviewer critic mode → Phase 4; read-only decision review
continue_plan without valid plan_idBlock; request exact ID; no fuzzy matching or inference
Missing acceptance criteria on MEDIUM taskPlanner cannot emit plan; ask once for criteria
High-risk signal on TRIVIAL taskComplexity raised to MEDIUM; persistent plan required
extend with no scope changeTreats as continue_plan (execution-only) → Phase 3

Key Rules

  1. No exploration - Uses only request + supplied context + continuity memory
  2. Classify once - No re-classification, no confidence-seeking
  3. Ask once - Only for true decision blockers
  4. Route immediately - To Phase 1 with normalized state

Common Mistakes

MistakeCorrect Approach
Inspecting repo to "be sure"Use only supplied evidence
Asking clarifying questions preemptivelyOnly ask if decision blocked
Lowering complexity to avoid planningLet evidence raise it; never lower
Inferring plan_id for continuationRequire exact explicit plan_id

Next Phase

→ Phase 1: Route - Determines execution path based on classification