Quest

From KjellKod/quest · View interactive version

Quest is an AI agent skill from the GitHub repository KjellKod/quest. Multi-agent workflow for planning, reviewing, building, and fixing features through coordinated agent handoffs.

How to use this skill

Skill file

Quest Orchestration Skill

Multi-agent workflow for planning, reviewing, building, and fixing features through coordinated agent handoffs.

Usage

/quest "Add a loading skeleton to the candidate list"
$quest "Add a loading skeleton to the candidate list"
/quest "Implement the transparency audit plan"
/quest transparency-v2_2026-02-02__1831
/quest transparency-v2_2026-02-02__1831 "now review the code"
/quest status

Procedure

When starting, say: "Now I understand the Quest." Then proceed.

Step 1: Resume Check

If the user provides a quest ID matching either supported Quest ID format (<slug>_YYYY-MM-DD__HHMM or YYYY-MM-DD_HHMM__<slug>):

  1. Read .quest/<id>/state.json and resume from the recorded phase. If that file does not exist but .quest/archive/<id>/ does, the quest is complete and archived — tell the user so (pointing at the journal entry in docs/quest-journal/) instead of failing; archived quests are not resumable.

1a. Orchestration config migration. On resume, run quest_runtime.orchestration.migrate_from_snapshot before dispatch (it is tested; keep the behavior in one place):

  1. Delegate to delegation/workflow.md

If the user says /quest status or $quest status, handle as a utility command (see delegation/workflow.md Utility Commands).

Step 2: Classify Input (New Quest)

If no quest ID is provided:

  1. Read delegation/router.md
  2. Evaluate the user's input against the 7 substance dimensions
  3. Produce the routing decision JSON: {route, confidence (0.0-1.0), risk_level, complexity, ui_work, ui_work_evidence, reason, missing_information}

Step 2b: Second Model Availability Probe (New Quest Only)

Claude role readiness is separate from the orchestrator identity. Before accepting default or overridden assignments in step 8.5, if any active role selects Claude, run scripts/quest_preflight.sh --probe claude from the target workspace using the absolute installation path. Reuse a fresh Claude transport result already obtained by Codex-led Step 2b. Cache it as claude_transport_available separately from Codex readiness. Claude-led sessions require this probe too, including Claude-only continuation. If it fails, show its warnings and stop before dispatch; native Claude tasks are not a fallback. After remediation, rerun the probe. An explicit bridge selection must be carried into this probe and saved as claude_role_transport: "bridge".

MANDATORY, run before Step 3. Resolve Codex auth before checking readiness: explicit session/user choice via --codex-auth wins, otherwise .ai/allowlist.json codex_auth_mode, otherwise cached. Validate cached|api-key; a present key alone never selects billing. An API-key-only user can select api-key in the allowlist or startup request before this probe, without a cached login.

Run the preflight script from the installation root, or invoke it by absolute installed path when target cwd differs:

./scripts/quest_preflight.sh --orchestrator claude --codex-auth <resolved-mode>   # if you are Claude
./scripts/quest_preflight.sh --orchestrator codex    # if you are Codex

The script is under the installation root (scripts/quest_preflight.sh), NOT inside the skill directory. Target cwd remains the intended workspace.

  1. Parse the JSON output. Cache available as a boolean for the session. For Claude-led probes, retain the resolved checks.codex_auth_mode through routing for the per-quest orchestration chooser (Quest Folder Creation, step 8.5), together with these exact checks: codex_cli_installed, codex_exec_supported, codex_runner_available, codex_auth_mode, codex_auth_ready, codex_auth_kind, codex_auth_reason. available requires CLI, exec, helper and selected-auth readiness; inference_verified: false means no model call was made. API-key readiness does not prove key validity. MCP registration does not contribute to readiness.
  2. If available is false:

```

Second-model setup is not currently available.

Options:

1. Fix it now and rerun preflight (recommended)

2. Use the Claude bridge for this run (API-metered) — Codex-led sessions only

3. Continue with a single-model quest for this run

4. Cancel

```

  1. If available is true, proceed normally.
  2. For Codex-led sessions, if the JSON includes runtime_requirement: "host_context", treat that as authoritative:

This result carries into workflow.md — do not re-probe there.

Step 3: Route

Based on the router decision:

If route = "questioner":

  1. Read delegation/questioner.md
  2. Follow the questioning procedure (1-3 questions at a time, max 10 total)
  3. Collect the structured summary
  4. Re-run router (Step 2) with enriched input (original prompt + summary)
  5. If route is now "workflow", "solo", or "manual": proceed to the matching handler below
  6. If route is still "questioner": allow one more short questioning pass (10-question total cap still applies), then proceed to workflow regardless

If route = "manual":

  1. Present the routing classification with override options:

```

Quest Assessment:

Risk: <risk_level>

Complexity: <complexity>

Recommended: manual (no pipeline)

Options:

1. Just do it (recommended) — no quest pipeline

2. Run as solo quest — single reviewer, lightweight

3. Run as full quest — dual reviews, arbiter

4. Cancel

```

  1. If user selects "just do it": exit quest system. No quest folder is created. The user works directly.
  2. If user selects "solo" or "full": proceed to the matching handler below with the overridden route.
  3. If user selects "cancel": exit quest system immediately. No quest folder, journaling, or celebration.

If route = "solo":

  1. Present the routing classification with override options:

```

Quest Assessment:

Risk: <risk_level>

Complexity: <complexity>

Recommended route: solo (lightweight quest)

Options:

1. Run as solo quest (recommended) — single plan review, single code review

2. Run as full quest — dual reviews, arbiter, the works

3. Cancel

```

  1. If user selects "solo": create quest folder with quest_mode: "solo", proceed to workflow
  2. If user selects "full": create quest folder with quest_mode: "workflow", proceed to workflow
  3. If user selects "cancel": exit quest system immediately. No quest folder, journaling, or celebration.

If route = "workflow":

  1. Present the routing classification with override options:

```

Quest Assessment:

Risk: <risk_level>

Complexity: <complexity>

Recommended route: full quest

Options:

1. Run as full quest (recommended)

2. Run as solo quest (lighter) — single reviewer

3. Cancel

```

  1. If user selects "full": create quest folder with quest_mode: "workflow", proceed to workflow
  2. If user selects "solo": create quest folder with quest_mode: "solo", proceed to workflow
  3. If user selects "cancel": exit quest system immediately. No quest folder, journaling, or celebration.

After route selection (solo or workflow):

  1. Present the routing classification to the user (see Risk Visibility below)
  2. Create quest folder (see Quest Folder Creation below)
  3. Read delegation/workflow.md
  4. Begin at workflow Step 1 (Precondition Check)

Risk Visibility

Before creating the quest folder, present the routing classification to the user:

  1. Display the risk level and confidence:
  1. Display the UI classification:
  1. If the quest went through the questioner path, note this: "Questioning phase completed — gaps addressed before planning."
  2. Wait for user acknowledgment before proceeding (for high risk only). For medium and low, display and continue.

Quest Folder Structure

.quest/ contains:

Quest Folder Creation

  1. Generate a slug (lowercase, hyphenated, 2-5 words) and inform the user
  2. Ask the user which workspace mode to use for this quest. Present these options:

If already on a non-default branch, inform the user and skip the prompt — the quest will use the current branch.

If the current workspace is not inside a git repository, skip the prompt — Quest must stay in the current workspace with vcs_available: false.

  1. Run quest startup branch preparation with the user's choice:
  1. Read quest_id_format from .ai/allowlist.json using quest_runtime.quest_ids.load_quest_id_format; missing config defaults to slug-first.
  2. Create the Quest ID with quest_runtime.quest_ids.format_quest_id(slug, datetime.now(), quest_id_format). Pass a datetime.datetime object, not a preformatted timestamp string; the helper formats date/time internally.
  1. Create .quest/<id>/ with subfolders:

phase_01_plan/, phase_02_implementation/, phase_03_review/, logs/

  1. Write quest brief to .quest/<id>/quest_brief.md including:
  1. Copy .ai/allowlist.json to .quest/<id>/logs/allowlist_snapshot.json

8.5. Per-quest orchestration chooser. Display the active models and effort blocks from .ai/allowlist.json, showing each supported role's effort beside its model (Gemini: not applicable). For each role unused in the chosen quest_mode (e.g., plan-reviewer-b, arbiter, code-reviewer-b, and review-arbiter in solo mode), append (unused in this mode) after the model name. Then prompt:

```

Quest orchestration for <slug> (<mode>):

planner <model> effort=<effort>

plan-reviewer-a <model> effort=<effort>

plan-reviewer-b <model> effort=<effort> (unused in this mode) [solo only]

arbiter <model> effort=<effort> (unused in this mode) [solo only]

builder <model> effort=<effort>

code-reviewer-a <model> effort=<effort>

code-reviewer-b <model> effort=<effort> (unused in this mode) [solo only]

review-arbiter <model> effort=<effort> (unused in this mode) [solo only]

fixer <model> effort=<effort>

Use these defaults? [Y/n]

```

On Y (default; single Enter): before writing, validate every active-role model from the expanded default block against the Step 2b preflight result using the same availability rules as overrides below. If Step 2b was healthy, reject any unavailable active-role model as malformed config and stop before dispatch. If the user explicitly chose the single-model continuation after Step 2b failed, remap unavailable active-role models to the explicitly chosen single runtime (claude for Claude-led sessions only after its background transport probe succeeds, CODEX_NATIVE_FALLBACK_MODEL from quest_runtime.orchestration for Codex-led sessions) before writing so orchestration.json only contains runnable active-role assignments. After remapping, validate the existing effort pins against the resulting runtime. If a pin is unsupported or missing, show the affected role and supported values, request an explicit compatible effort, and retry validation before writing. Never silently substitute an effort default. Then write .quest/<id>/orchestration.json with:

On N: present the shorthand override prompt:

```

Enter overrides as comma- or newline-separated role=model pairs or a JSON models object.

Roles: planner, plan-reviewer-a, plan-reviewer-b, arbiter, builder, code-reviewer-a, code-reviewer-b, review-arbiter, fixer

Models: any model name your preflight reports as available (use the IDs displayed above or supported by your account)

Pair example: planner=<codex-model-id>, builder=<claude-model-id>

JSON example: {"models":{"planner":"<codex-model-id>","builder":"<claude-model-id>"}}

(empty input = no overrides, equivalent to Y)

Overrides:

```

If the override submission is empty after trimming, follow the On Y default writer above. Do not write source: "overridden", do not add overridden_roles, and do not count the empty submission as a rejected attempt.

Parse contract (each full override submission is one attempt; cap re-prompts at 3, abort on the 4th rejection): Run python3 scripts/quest_parse_overrides.py, send the complete submission unchanged on stdin, and consume its JSON envelope. Exit 0 returns {"ok": true, "overrides": [...]}; exit 2 returns {"ok": false, "error": "..."} on stderr and counts as one rejected attempt. Do not manually parse or rewrite JSON into pairs. quest_runtime.orchestration.parse_override_input is the canonical API; parse_override_line remains a compatibility wrapper.

1. Detect format. Input beginning with { is JSON. A copied "models": {...} fragment without outer braces is also accepted. JSON may be either {"models": {<role>: <model>}} or a direct {<role>: <model>} map. All JSON role keys and model values must be strings; model values must be non-empty. A models wrapper cannot have sibling top-level keys. Other input uses the pair format below.

2. Tokenize pairs. Split pair input on commas, LF newlines, or CRLF newlines and trim each piece. Empty pieces are silently skipped, so trailing separators and blank lines are allowed. Each non-empty piece must contain exactly one = character. Reject pieces with zero or multiple = characters using Override syntax error: '<piece>' (expected role=model). Re-enter overrides.

3. Role name. Trim, normalize to lowercase, then exact-match against the canonical role list (planner, plan-reviewer-a, plan-reviewer-b, arbiter, builder, code-reviewer-a, code-reviewer-b, review-arbiter, fixer). Reject unknown names with Unknown role: <input> (valid: planner, plan-reviewer-a, plan-reviewer-b, arbiter, builder, code-reviewer-a, code-reviewer-b, review-arbiter, fixer). Reject duplicate normalized roles in either syntax with Duplicate role: <role>. Re-enter overrides. rather than silently choosing the last value.

4. Model name. Trim the pair RHS or JSON string value. It must be non-empty and cannot contain commas, =, or line breaks in either syntax, so JSON and pair inputs accept the same model tokens. Example: codex-fake-model, claude-fake-model, gemini-fake-model and similar tokens are accepted at the parser level.

5. Unused-in-mode roles (plan-reviewer-b, arbiter, code-reviewer-b, and review-arbiter in solo). Warn Role <name> is unused in <mode> mode — override ignored. and skip the override; do not record it in overridden_roles.

6. Availability check. Classify Claude-family model names as claude and claude-* (including concrete Claude model IDs); Gemini-family model names (gemini, gemini-*) as Antigravity-backed; every other model name is Codex-backed. Antigravity-backed models require antigravity_available from scripts/quest_preflight.sh --probe antigravity (see the workflow's Antigravity preflight section) in either session type. In either session type, Claude-family models require claude_transport_available from --probe claude (or the fresh Codex-led Step 2b transport result). In Claude-led sessions, Codex-backed models require the top-level available boolean for the auth mode Step 2b resolved. Do not read orchestration.json here: it has not yet been written. This is setup readiness, not verification of a particular model. In Codex-led sessions, Codex-backed models are available and Claude-family models require the top-level available boolean from the Step 2b preflight result, which represents Claude transport availability (background-agent or bridge — the transport field says which). If the relevant cache/result is missing or stale (older than the preflight TTL), rerun the matching preflight once and reuse the fresh result: scripts/quest_preflight.sh --probe claude for Claude transport availability, scripts/quest_preflight.sh --orchestrator claude --codex-auth <Step-2b-resolved-mode> for Claude-led Codex readiness, scripts/quest_preflight.sh --probe antigravity for antigravity_available (they are separate modes and cannot be combined). Reject unavailable models with the preflight warning text and re-prompt the override submission.

7. Re-prompt cap. An "attempt" is one full override submission, not one role=model pair. Three rejected attempts in a row abort startup with Override validation failed after 3 attempts — quest startup cancelled.

Once all overrides pass validation, build the merged models block (the expanded startup block returned by build_default_models, overlaid with the validated overrides — overridden_roles excludes ignored-because-unused entries) and write .quest/<id>/orchestration.json with:

  1. Initialize state.json:

```json

{

"quest_id": "<id>",

"slug": "<slug>",

"phase": "plan",

"status": "pending",

"quest_mode": "workflow",

"vcs_available": true,

"branch": "quest/<slug> or current branch",

"branch_mode": "branch | worktree | none",

"worktree_path": "/absolute/path/to/worktree (worktree mode only)",

"quest_symlink": "created | present | migrated | conflict | n/a",

"plan_iteration": 0,

"fix_iteration": 0,

"created_at": "<timestamp>",

"updated_at": "<timestamp>"

}

```

Set quest_mode to the user's final selection: "workflow" (default) or "solo". This field is read by workflow.md to determine agent dispatch and by quest_validate-quest-state.sh for artifact checks.

vcs_available must be copied directly from scripts/quest_startup_branch.py output. Do not infer it from branch_mode.

branch_mode records the actual startup mode used for this quest run after no-op handling. If Quest starts on an existing feature branch, set branch_mode to "none" and record that branch in branch.

quest_symlink must be copied directly from scripts/quest_startup_branch.py output. Do not infer it from branch_mode or worktree_path.

UI Work Propagation

When the recorded router classification has ui_work: true, downstream dispatch must load the UX skills:

The agent files in .skills/quest/agents/ enforce this — the orchestrator's job is to preserve the full router JSON in the brief so each agent can read it.

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.