OR Key
drop another .md file to compare - side-by-side diff against phase-trace

phase-trace

Shows the steps of a long task as your assistant works through them.
description: "Triggers on prompt mention of 'phase-trace', 'show phases', 'currently running', 'happening right now'."
personal 2 files

What it does for you

Shows the steps of a long task as your assistant works through them.

What it produces

A recent result, so you can see the kind of work it returns.

loading…

How to get it

These run inside the Snappy workspace. Want this working in your business? I set skills like this up with you, in one focused week.

Work with me
For developers how this skill is built, graded, and how it runs

at a glance- the short version

eval modeshape
stages2

what's inside - the parts that make up a skill 3/4 present

A skill is just a few plain-text files. Only the main one is required. The rest are optional, added as the work needs them. This is what the skill is made of; how it runs is just below.

The skill
state/skills/phase-trace/SKILL.md present
the skill itself, in plain text
The main file. It says what the skill is and lays out the steps in plain English.
Code
state/lib/phase-trace.ts present
code the skill can run
Reusable code this skill can call when it needs to.
Scripts
state/bin/phase-trace/ not present
helper scripts
Optional. Added when a skill has a few commands to run.
Loader
state/skills/phase-trace/AGENTS.md present
what the AI loads on the fly
Loaded automatically the moment this skill is needed. Kept short on purpose.

how it runs - the shared frame every skill uses 2/5 present

Every skill runs the same way. One part does the work, a separate part checks it, and a short loader hands the AI exactly what it needs for the job. Anything this skill doesn't use shows a one-line note saying why, on purpose, not by accident.

makes the work The worker
inferred
import { startTrace from the run command
No worker is named directly, so the command this skill runs is treated as the worker.
checks the work The reviewer
inferred
shape gate an automatic check
The check is an automatic pass or fail on the shape of the result, run separately from the work itself.
frame
learns Self-correction
not present

This skill doesn't fix its own gaps yet.

tidies up Background fixes
present
queued for rewrite runs in the background
Bigger fixes that can't be made on the spot get queued and rewritten in the background later.
remembers Run history
present
state/log/evals.ndjson shape runs
Every run is written down here, so the next time this skill is used it already knows how the last runs went.
Critical rules the things this skill must not get wrong
No must-not-break rules called out for this skill. Anything important lives in the writeup below.

what it has learned - fixes written back in over time sample

When a run hits something this skill didn't handle, the fix gets written back into the skill so it doesn't happen again. FIXED means it was corrected on the spot. LOGGED means it's queued for a bigger rewrite. Either way, the skill gets a little better and never makes the same mistake twice.

  1. Loading feedback rows…

how the work flows- step by step

1 generator
invoke
`import { startTrace } from "../lib/phase-trace.ts"`
2 data
eval log
`state/log/evals.ndjson` (skill: "phase-trace", eval_mode: shape)

SKILL.md- the skill, written out in plain English

phase-trace

state/lib/phase-trace.ts - pure in-memory accumulator. Pairs with the PhaseDisclosure shape registered in web/src/components/phase-disclosure.tsx (snappy-os). One trace per tick, many phases per trace, optional body per phase.

The disclosure pattern matches Claude Desktop's "Cowork" layout (cd-23 in the design references): a vertical stack of rows, each with a chevron, status dot, mono label, and a one-line summary. Click any row to expand the multi-paragraph body underneath.

Steps

  1. Open a trace with optional title:
   import { startTrace } from "../lib/phase-trace.ts";
   const t = startTrace("Charlotte execute");
  1. Add phases as the work progresses. Each .phase(label, opts) returns

a fluent handle:

   const p = t.phase("Loaded tools", { summary: "Probing connectors", status: "running" });
   p.body("Now let me probe the actual connector data shapes...");
   p.done();
  1. When the tick finishes, emit() returns the canonical payload shape:
   const { phaseDisclosure } = t.emit();
   // → { phases: [{ label, summary, body?, status? }, ...], title? }
  1. The dispatcher in state/bin/head-screen/server.ts wraps the payload

in a TOOL_CALL_* triple keyed PhaseDisclosure and the snappy-os surface renders the disclosure rows inline.

Status enum

pending | running | done | error. The renderer maps each to a colored status dot (text-tertiary / accent w/ glow / ok-green / danger-red).

Eval

Shape gate. The actor is startTrace().emit() and the auditor is the parser parsePhaseDisclosureArgs in web/src/tool-args.ts. A row passes if every phase has both label and summary strings and the status (when present) is in the four-value enum.

AGENTS.md- what the AI loads when this skill comes up

phase-trace - loader

Per-turn rules for the phase-trace skill. Full reference: state/skills/phase-trace/SKILL.md.

phase-trace is the builder API long-running snappy-os skills use to accumulate phase rows (label + summary + body + status) as they work, then emit one canonical PhaseDisclosure payload at end of tick. The snappy-os generative UI renders that payload inline as a vertical stack of collapsible disclosure rows - chevron + status dot + mono label + one-line summary, expanding to multi-paragraph body. Visual pattern matches Claude Desktop's "Cowork" layout (cd-23 in design references). Pure in-memory accumulator. Pairs with web/src/components/phase-disclosure.tsx in snappy-os. Lib: state/lib/phase-trace.ts.

Critical Rules

  1. Status enum is pending|running|done|error exactly - parsePhaseDisclosureArgs in web/src/tool-args.ts kills any card with off-enum status.
  2. Both label and summary are REQUIRED on every phase. body is optional; status is optional (defaults handled downstream).
  3. emit() is one-shot. Call it at end of tick. Do NOT re-emit during streaming - the renderer expects one payload per trace.
  4. Pure in-memory accumulator. Do NOT persist phase rows to disk; the eval row in state/log/evals.ndjson is the persistence record of record.
  5. Phase ordering = insertion order. Sort upstream of t.phase() calls if you want a different display order.

Commands

| ui model | live composition via compose_inline, persisted as artifact lang_body, reopened with OpenArtifact | |invoke: import { startTrace } from "../lib/phase-trace.ts" |usage: const t = startTrace("Charlotte execute"); const p = t.phase("Loaded tools", {summary:"Probing connectors", status:"running"}); p.body("...long body..."); p.done(); ... t.emit() returns {phaseDisclosure: {phases: [...], title?}} |dispatcher: state/bin/head-screen/server.ts - regex matcher + emitTriple("PhaseDisclosure", payload.phaseDisclosure) |trigger phrases (matched in dispatcher regex, extended at L7029): running / currently-running / happening right now |eval log: state/log/evals.ndjson (skill: "phase-trace", eval_mode: shape) |tested: 2026-04-29 end-to-end with shape PhaseDisclosure paired against snappy-os renderer; parser roundtrip OK; dispatcher routing hooked

Status enum

statusrenderer dotuse for
pendingtext-tertiary (muted gray)queued phases not yet started
runningaccent w/ glowthe phase happening right now
doneok-greencompleted phases
errordanger-redactual failures only - reserve sparingly

Trigger phrases

  • running
  • currently running / currently-running
  • happening right now

(Dispatcher regex extended at L7029 in state/bin/head-screen/server.ts to route these to PhaseDisclosure.)

Known Pitfalls

  • A phase missing summary fails the parser shape gate and the card is dropped silently. Always set summary, even a one-word placeholder.
  • body strings can be long (multi-paragraph) - the renderer truncates inside the closed disclosure row; full text appears on expand. Don't pre-truncate upstream.
  • status:"error" paints a red dot. Reserve it for actual failures; using it for "warning" or "skipped" misleads the cockpit reader.

Self-Test

An agent reading this should correctly:

  1. [ ] Confirm emit() output shape matches parsePhaseDisclosureArgs (label + summary required, status enum exact)
  2. [ ] Confirm phase ordering is insertion order
  3. [ ] Confirm status enum is strictly pending|running|done|error
  4. [ ] Confirm emit() is called once per tick, not per phase
  5. [ ] Confirm trigger phrases running / currently running / happening right now route to PhaseDisclosure via the dispatcher regex

Found a gap? Edit this file. <!-- footer-injection-point -->

api.ts- the code it can call

#!/usr/bin/env npx tsx
/**
 * state/lib/phase-trace.ts -- builder API for accumulating phase rows
 * during a long-running snappy-os tick, emitted as a PhaseDisclosure
 * payload that the snappy-chat generative UI renders inline.
 *
 * Pairs with the renderer at web/src/components/phase-disclosure.tsx
 * (snappy-chat). A "phase" is one collapsible row: short label + one-line
 * summary (visible collapsed) + multi-paragraph body (visible expanded)
 * + status enum.
 *
 *   import { startTrace } from "../lib/phase-trace.ts";
 *   const t = startTrace("Charlotte execute");
 *   const p1 = t.phase("Loaded tools", { status: "running", summary: "..." });
 *   p1.body("Now let me probe the actual connector data shapes...");
 *   p1.done();
 *   const p2 = t.phase("Used Krisp integration");
 *   p2.body("The meeting/action-item connector returned empty...");
 *   p2.done();
 *   const { phaseDisclosure } = t.emit();
 *
 * Pure in-memory accumulator. Never writes to disk. The dispatcher emits
 * the resulting payload as TOOL_CALL_* events; the chat surface picks up
 * the registry name "PhaseDisclosure" and renders the disclosure rows.
 *
 * Consumed by:
 *   - state/bin/head-screen/server.ts (intent matcher for "what is X
 *     doing" / "trace the agent run") via state/lib/agent-recap.ts.
 */

export type PhaseStatus = "pending" | "running" | "done" | "error";

export interface PhaseRow {
  label: string;
  summary: string;
  body?: string;
  status?: PhaseStatus;
}

export interface PhaseDisclosurePayload {
  phases: PhaseRow[];
  title?: string;
}

export interface PhaseHandle {
  body(text: string): PhaseHandle;
  summary(text: string): PhaseHandle;
  status(s: PhaseStatus): PhaseHandle;
  done(): PhaseHandle;
  error(): PhaseHandle;
}

export interface TraceHandle {
  phase(label: string, opts?: { status?: PhaseStatus; summary?: string }): PhaseHandle;
  emit(): { phaseDisclosure: PhaseDisclosurePayload };
}

/**
 * Open a new trace. `title` is optional; when set it shows above the
 * disclosure rows (e.g. "Charlotte execute" in cd-23-artifacts.png).
 */
export function startTrace(title?: string): TraceHandle {
  const phases: PhaseRow[] = [];

  function makeHandle(row: PhaseRow): PhaseHandle {
    const h: PhaseHandle = {
      body(text: string) { row.body = text; return h; },
      summary(text: string) { row.summary = text; return h; },
      status(s: PhaseStatus) { row.status = s; return h; },
      done() { row.status = "done"; return h; },
      error() { row.status = "error"; return h; }
    };
    return h;
  }

  return {
    phase(label, opts) {
      const row: PhaseRow = {
        label,
        summary: opts?.summary ?? "",
        status: opts?.status ?? "pending"
      };
      phases.push(row);
      return makeHandle(row);
    },
    emit() {
      // Filter empty phases (no label) just in case.
      const cleaned = phases.filter(p => p.label && p.label.length > 0);
      return {
        phaseDisclosure: {
          phases: cleaned,
          ...(title ? { title } : {})
        }
      };
    }
  };
}

// ── CLI smoke test ───────────────────────────────────────────────────
if (import.meta.url === `file://${process.argv[1]}`) {
  const t = startTrace("Charlotte execute");
  t.phase("Loaded tools", { status: "done" })
    .summary("Probing connector data shapes in parallel")
    .body("Now let me probe the actual connector data shapes in parallel — I'll look at action items, upcoming meetings, recent activities, and check for any existing status page.");
  t.phase("Used Krisp integration, used a tool", { status: "done" })
    .summary("Meeting connector returned empty (04:15 UTC — too early)")
    .body("The meeting/action-item connector returned empty (it's 04:15 UTC — likely too early in the user's day for meetings to have populated). Let me check Charlotte and see what plugins/connectors are actually installed before building.");
  t.phase("Used charlotte-mcp integration", { status: "done" })
    .summary("Charlotte has 190 tools — probing needs-attention shapes")
    .body("Charlotte has 190 tools — that's the core engine here. Let me probe the key 'needs-attention' data sources in parallel: overdue actions, pending actions, today's calendar, smart inbox, knowledge graph attention items, and outstanding invoices.");
  t.phase("Charlotte execute", { status: "running" })
    .summary("Thinking…");
  const out = t.emit();
  process.stdout.write(JSON.stringify(out, null, 2) + "\n");
}

scripts- helper scripts it can run

prose-only skill - no sidecar under state/bin/ yet. Steps, if any, are described in SKILL.md.

how we check it- the checks, plus the last 10 runs

rubric shape schema-shape check (no inline rubric)
recent no runs actor/auditor: unverifiable
deps none declared

no recent runs logged - the eval contract is declared but nothing has been graded yet