Logging is on by default
Every spektacular command run in a project is recorded to
.spektacular/logs/, with nothing to switch on. The folder is already
ignored by git: spektacular init adds it to .spektacular/.gitignore,
spektacular migrate adds it to projects set up by an earlier version, and
the folder holds its own .gitignore as well, so logs are never committed
by accident.
The log section of .spektacular/config.yaml controls it:
log: provider: file # the logger; only file ships today level: standard # off | standard | verbose retention: 10 # most recent workflow runs kept config: directory: logs # relative to the folder holding config.yamlNothing is recorded outside a project, so a command run in a repo’s code checkout never leaves a log behind.
What each level records
standard(the default): for each command, its name and arguments, the run it belongs to, the agent, the workflow and the step it ran in (and the step it moved the workflow to), when it started and ended, its exit status and, when it failed, the error message. It keeps no responses, so the log stays small.verbose: everythingstandardrecords, plus the command’s full response and the workflow state before and after it, as debug mode did. Use it when reporting an issue or reproducing a problem; verbose logs grow quickly.off: nothing is recorded. To switch logging off, setlog.level: offin.spektacular/config.yaml.
Where logs go
Each workflow run gets a file of its own, named for when the run started,
the agent the project is set up for, and the workflow, for example
20261024T090334.911373161Z_claude_plan_000008_debugging-docs.jsonl. Every
command of that run lands in it, across interruptions and resumes. When an
epic is planned or implemented, each spec’s workflow is its own run, so
specs worked on side by side never share a file. Restarting a workflow with
--force starts a new run and a new file.
Commands run while no workflow is in progress go to one file per day, for
example standalone_20261024.jsonl.
To write logs somewhere else, set log.config.directory. A relative path is
resolved from the folder holding config.yaml (.spektacular/); an
absolute path is used as written.
How long logs are kept
Spektacular keeps the logs of the 10 most recent workflow runs, or the
number set in log.retention, and deletes older ones when a new run starts.
Days of standalone commands are counted separately, with the same number of
most recent days kept, so a burst of standalone commands never pushes out a
workflow run’s log. A log that cannot be deleted is skipped: logging never
changes a command’s output or exit code.
Commands that are never logged
spektacular status is never logged, at any level, so editors and tools
that poll it every few seconds do not fill the log. Commands that only
report on the project or its logs are never logged either: the run
statistics reports of spektacular stats, and every form of them, leave no
record, so a report never adds to or trims the logs it reads.
The level is set in config.yaml only: there is no environment variable for
it.
Reading a record
Each line is one JSON record following the OpenTelemetry trace data model.
Here is a standard record of a spec goto:
{ "record": "span", "trace_id": "4bf92f3577b34da6a3ce929d0e0e4736", "span_id": "00f067aa0ba902b7", "name": "spec goto", "kind": "internal", "start_time": "2026-10-24T09:03:34.911373161Z", "end_time": "2026-10-24T09:03:34.934002113Z", "status": { "code": "ok" }, "attributes": { "spektacular.span.type": "command", "spektacular.agent": "claude", "spektacular.workflow.kind": "spec", "spektacular.workflow.name": "000073_log-mode", "spektacular.step": "interview", "spektacular.step.to": "overview", "process.command_args": ["spec", "goto", "--data", "{\"step\":\"overview\"}"], "process.exit_code": 0 }, "resource": { "service.name": "spektacular", "service.version": "0.21.0" }}trace_id: the run the command belongs to. Every command of one workflow run shares it; a command outside any workflow gets its own.span_id: this command’s own id.name: the command, such asspec goto.start_time/end_time: when the command started and ended, in UTC.status:ok, orerrorwith the errormessage.attributes:spektacular.agent: the agent named inconfig.yaml, orunknown.spektacular.workflow.kind/spektacular.workflow.name: the workflow, absent for a command outside one.spektacular.step: the step the command ran in.spektacular.step.to: the step it moved the workflow to, when it moved.process.command_args: the arguments the command was run with.process.exit_code: the command’s exit code.- At the
verboselevel, alsospektacular.response(the full output) andspektacular.state.before/spektacular.state.after.
A step’s duration is the time between the commands that moved the workflow onto it and off it again. Its step span, below, records the same stretch.
Spans: where the time went
A run’s log shows more than its commands. Each workflow step and each plan
task is a span, timed from the moment the workflow enters it to the moment
it leaves, and every command is recorded under the step it ran in. Agents
also mark the helper agents they start and the questions they ask the user.
A plan run reads as discovery (12 minutes) holding its commands and two
sub-agent spans, then architecture, and so on.
Span types
Every span carries a spektacular.span.type:
command: one per command, recorded automatically.step: each workflow step, from entering it to leaving it, recorded automatically.task: each plan task during implement, fromanalyzetoupdate_changelog, recorded automatically. Its step spans nest under it.sub-agent: a helper agent, marked by the agent that launched it.user-wait: time spent waiting for the user to answer, marked by the agent. It is kept apart so it can be left out of a run’s working time.work: any other stretch the agent wants to time.
Marking spans
Agents mark spans with two commands:
spektacular trace start test-writer --type sub-agent# {"span_id":"4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7", ...}spektacular trace stop 4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7spektacular trace stop <id> --status error --message "tests did not compile"trace start takes a name, a --type of sub-agent, user-wait or work
(the default), and prints the span’s id, <trace_id>-<span_id>.
trace stop takes that id and an optional --status ok or --status error
with a --message.
A span nests under the current step unless --parent <id> names another
open span. Pass a helper agent its span’s id, so the spans it starts nest
under the span that launched it, even when several helpers run at once.
Workflow instructions already tell agents when to do all this.
A mistake is refused with a message saying what to do next, and records nothing: an unknown or already closed parent, an id never started or already stopped, a step or task span (Spektacular closes those itself), or a bad name, type, id or status. The trace commands never move the workflow.
How spans end
A step ends when the workflow moves on, and the next step begins at the same
moment. A span still open when its parent ends, or when the run finishes, is
closed as abandoned. A step left open by a session that stopped is closed
as interrupted when the run resumes, at the end of its last recorded
command, together with any span still open under it; the resumed step then
gets a new span. Restarting a run with spec new --force abandons the old
run’s open spans.
With log.level: off the trace commands still succeed, and record nothing.
Span records
A span that opens in one command and closes in another is written as two
records: a span_start when it begins, and a span_end when it ends. Here
is a step opening and closing:
{ "record": "span_start", "trace_id": "4bf92f3577b34da6a3ce929d0e0e4736", "span_id": "a3ce929d0e0e4736", "name": "interview", "kind": "internal", "start_time": "2026-10-24T09:03:34.930000000Z", "attributes": { "spektacular.span.type": "step", "spektacular.agent": "claude", "spektacular.workflow.kind": "spec", "spektacular.workflow.name": "000074_trace-spans", "spektacular.step": "interview" }, "resource": { "service.name": "spektacular", "service.version": "0.22.0" }}{ "record": "span_end", "trace_id": "4bf92f3577b34da6a3ce929d0e0e4736", "span_id": "a3ce929d0e0e4736", "name": "interview", "kind": "internal", "start_time": "2026-10-24T09:03:34.930000000Z", "end_time": "2026-10-24T09:11:02.417000000Z", "status": { "code": "ok" }, "attributes": { "spektacular.span.type": "step", "spektacular.span.end_reason": "moved", "spektacular.agent": "claude", "spektacular.workflow.kind": "spec", "spektacular.workflow.name": "000074_trace-spans", "spektacular.step": "interview" }, "resource": { "service.name": "spektacular", "service.version": "0.22.0" }}record:spanfor a command,span_startandspan_endfor a span that crosses commands. Aspan_endrepeats every field of its start, so it is a complete span on its own; aspan_startwith no end is still open.parent_span_id: the span this one nests under. A command’s parent is its step; a step’s parent is its task, or none; an agent’s span’s parent is the span it named, or the current step.spektacular.span.type: one of the types above.spektacular.span.end_reason: on aspan_end, why it ended:moved,finished,stopped(an agent’strace stop),abandonedorinterrupted. An abandoned or interrupted span has statuserrorwith the reason as its message.spektacular.task.id: on a task span, the plan task’s id.
To turn these records into timings per step, task and helper, see Run statistics.
Upgrading from debug mode
Debug mode is replaced by logging. spektacular migrate turns
debug.enabled: true into log.level: verbose, and false (or no debug
setting) into standard. Old files in .spektacular/debug/ are left where
they are, untouched; delete them when you no longer need them.