Back to Tdesktop

Perform One AI Task

.agents/skills/perform-task/SKILL.md

7.1.18.2 KB
Original Source

Perform One AI Task

When running in Grok Build, read .grok/ai-workflow-adapter.md completely before any other host-specific delegation rule and apply its substitutions.

Own exactly one task through its retained change, or a proved already-satisfied outcome, and a canonical AI Approve or exceptional Block. Do not process the inbox, split the task, drain the queue, select a follow-up, or consolidate pending tasks afterward. The continue scheduler isolates discovery routing and queue consolidation in fresh workers after this performer returns.

Read the complete engine

Read these files completely before phase work:

  • references/pipeline.md for the authoritative end-to-end runner contract;
  • references/phase-prompts.md for exact leaf prompts and retry rules;
  • .agents/shared/test-loop.md for the implementation/test state machine;
  • .agents/shared/build-lock-recovery.md for bounded exact-checkout Windows build-lock recovery;
  • references/computer-use-testing.md when UI-driver selection or operation is relevant.

The pipeline reference adapts conflicting generic test-loop mechanics for the external AI worktree and exact-path safety. Its named adapter wins at those points; retain every other test-loop rule.

Resolve the workspace and task

Run from a Telegram Desktop checkout. Use the host's Python 3 command:

bash
python3 .agents/skills/process-inbox/scripts/workspace.py resolve \
  --name <short-slug-or-full-task-id>

Use python or py -3 when appropriate. The helper reads the ignored machine tag, derives the checkout tag, synchronizes clean AI state, and resolves an exact full id, exact final path slug, or exact normalized friendly title. Prefer a unique unfinished match over approved history. Never guess among several unfinished matches; report their full ids.

An interactive invocation requires a nonempty name. If none was supplied, ask for the friendly short name or full id. A continue delegation always supplies the full id and explicit workspace values; still resolve and verify them.

If commits.slot_only is nonzero and the slot is clean, run the helper's publish command and resolve again. A dirty slot is valid only when every change belongs to this checkout's one in-progress task. Those files are local resumable phase state; never discard them. Any unrelated dirty or divergent state is a hard stop.

Acquire exactly this task

Inspect the resolved task, readiness, other_active_task, status, and owner.

  • If another task is already in-progress for this checkout, stop.

  • If this task is approved, report its completed result and stop.

  • If it is owned by another checkout, stop. Cross-checkout restart is a rare explicit human reassignment, never an implicit steal.

  • If its dependencies are unfinished, report them and stop without starting.

  • Inspect task.md for approved source-task prerequisites in addition to depends_on, then run workspace.py source-lineage --task <full-task-id> with one --require <source-task-id> for each explicit prerequisite. Require current_satisfies: true before Phase 1. For start or retry, pass the same --require arguments so claiming is machine-gated too.

  • If it is todo and either unclaimed or owned by this checkout, atomically assign and activate it:

    bash
    python3 .agents/skills/process-inbox/scripts/workspace.py start \
      --task <full-task-id>
    
  • If it is blocked and owned by this checkout, reopen it locally:

    bash
    python3 .agents/skills/process-inbox/scripts/workspace.py retry \
      --task <full-task-id>
    

    Preserve all source recovery, plans, reviews, tests, result, and evidence. Continue from the first incomplete validated boundary. This creates no Resume commit.

  • If it is already in-progress and owned by this checkout, resume it without another state commit.

Refresh with resolve after each mutation. The source pipeline begins only after the slot state shows this task in-progress for this checkout. For a new task, canonical master must already contain its Start commit.

A source-lineage mismatch found before Phase 1 is a pre-phase routing stop, not a task Block: create no phase artifacts, source edits, retained commit, or integration task. Return the lineage report to the continue scheduler, which may safely switch an existing local branch and resume. In a direct interactive invocation, report it and ask the human. If the mismatch is first discovered only after Phase 1 has completed, restore every owned/disposable source change to a clean boundary and publish a genuine blocked result naming the exact missing source task and appropriate branch evidence. Do not cherry-pick, rebase, merge, or manufacture the prerequisite. This blocker is task-local; the scheduler may continue work that does not depend on it.

Run and publish

Execute references/pipeline.md exactly. A task that changes the repository produces:

  1. one or more tested source implementation-attempt commits, each with an exact one-line subject using the pipeline's conditional [ai] prefix, blank line, and Task: <full-task-id>;
  2. local tracked phase artifacts and progress in the AI slot worktree, without phase commits;
  3. one canonical Approve <full-task-id> commit containing all final AI artifacts and state.

New and unfinished tasks use the single adaptive implement path. During assessment, select one mandatory general review, every specialist review whose failure surface is present, and a falsifiable evidence plan. The evidence loop may use static readings, commands and artifacts, unit tests, a standalone probe or component binary, a Telegram Debug build with logged assertions, an in-app overlay, Computer Use, screenshots, or any necessary combination. Do not require a portable account, Telegram executable, or desktop unless a selected check uses it. Do not weaken a runtime or visual check merely because another instrument is cheaper.

The assessment's selection is provisional until implementation exists. The general reviewer examines the complete diff and evidence plan, may require a missing specialist or stronger instrument, and cannot defer a concern to an optional reviewer. Review fixes receive targeted re-review instead of an unconditional replay of every lens. A task whose desired outcome was already present may finish without a source commit only after the same general review and evidence loop prove Outcome: already-satisfied.

Only a genuine exhausted task blocker produces a canonical Block <full-task-id> commit. Agent interruption, tool loss, and global environment stops leave the task in-progress with its task-scoped local state intact for the next invocation.

A repeated evidence setup failure is not exhausted recovery by itself. Follow the shared directness ladder: forbid the failed command, fixture, probe, or capture technique and make the next run closer to the changed surface. The configured test-run cap closes one campaign: preserve prior passes, isolate the unmet checks, and start a focused recovery campaign unless a fresh assessment proves every direct strategy exhausted. The cap and a TEST_FLAW can never by themselves publish BLOCKED; the former two-identical-signature shortcut must not be used.

A locked macOS session is not an environment stop or evidence blocker for a selected Telegram runtime check. Skip interactive Computer Use and complete the same coverage through the in-binary overlay: drive the flow, log/assert, capture widgets or windows, quit, and assess the saved artifacts. Non-app instruments are unaffected.

A Windows build-output lock is not an immediate environment stop. Follow the shared bounded recovery contract, including exact-path cleanup before builds. Only its exhausted or unsafe outcome is a global hard stop; it never becomes a task Block.

Do not report success from a source commit alone. The final AI commit must be canonical. Retry ordinary concurrent-master publication races until success. On a semantic conflict, unsafe checkout, or unreachable remote, preserve resumable state and report a hard stop.

Return a compact result with the full task id, status or hard stop, attempts, touched files, canonical final-publication confirmation, and exact evidence or unverified behavior. Never persist or report commit hashes; the full task id is the only cross-repository link.