.md file to compare - side-by-side diff against phase-trace
phase-trace
description: "Triggers on prompt mention of 'phase-trace', 'show phases', 'currently running', 'happening right now'."
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.
For developers how this skill is built, graded, and how it runs
at a glance- the short version
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.
state/skills/phase-trace/SKILL.md
present
state/lib/phase-trace.ts
present
state/bin/phase-trace/
not present
state/skills/phase-trace/AGENTS.md
present
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.
This skill doesn't fix its own gaps yet.
state/log/evals.ndjson 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.
- Loading feedback rows…
how the work flows- step by step
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
- Open a trace with optional title:
import { startTrace } from "../lib/phase-trace.ts";
const t = startTrace("Charlotte execute");
- 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();
- When the tick finishes,
emit()returns the canonical payload shape:
const { phaseDisclosure } = t.emit();
// → { phases: [{ label, summary, body?, status? }, ...], title? }
- The dispatcher in
state/bin/head-screen/server.tswraps 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
- Status enum is
pending|running|done|errorexactly -parsePhaseDisclosureArgsinweb/src/tool-args.tskills any card with off-enum status. - Both
labelandsummaryare REQUIRED on every phase.bodyis optional;statusis optional (defaults handled downstream). emit()is one-shot. Call it at end of tick. Do NOT re-emit during streaming - the renderer expects one payload per trace.- Pure in-memory accumulator. Do NOT persist phase rows to disk; the eval row in
state/log/evals.ndjsonis the persistence record of record. - 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
| status | renderer dot | use for |
|---|---|---|
| pending | text-tertiary (muted gray) | queued phases not yet started |
| running | accent w/ glow | the phase happening right now |
| done | ok-green | completed phases |
| error | danger-red | actual failures only - reserve sparingly |
Trigger phrases
runningcurrently running/currently-runninghappening right now
(Dispatcher regex extended at L7029 in state/bin/head-screen/server.ts to route these to PhaseDisclosure.)
Known Pitfalls
- A phase missing
summaryfails the parser shape gate and the card is dropped silently. Always set summary, even a one-word placeholder. bodystrings 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:
- [ ] Confirm
emit()output shape matchesparsePhaseDisclosureArgs(label + summary required, status enum exact) - [ ] Confirm phase ordering is insertion order
- [ ] Confirm status enum is strictly
pending|running|done|error - [ ] Confirm
emit()is called once per tick, not per phase - [ ] Confirm trigger phrases
running/currently running/happening right nowroute toPhaseDisclosurevia 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
no recent runs logged - the eval contract is declared but nothing has been graded yet