@raquezha/notrace
Zero-dependency, local-first interactive HTML Trace Viewer for the Pi Coding Agent
Package details
Install @raquezha/notrace from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@raquezha/notrace- Package
@raquezha/notrace- Version
0.4.8- Published
- Sep 8, 2026
- Downloads
- 1,244/mo · 57/wk
- Author
- raquezha
- License
- MIT
- Types
- extension
- Size
- 3.2 MB
- Dependencies
- 0 dependencies · 1 peer
Pi manifest JSON
{
"extensions": [
"extensions"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
notrace
Traces in, lessons out.
notrace is a local-first retrospective engine for the Pi Coding Agent.
It captures session evidence, writes a versioned notrace.json run record, renders a human-readable HTML report, and supports review/compare flows for workflow R&D.
What notrace owns
When enabled, notrace is the durable retrospective layer for a session.
It aggregates:
- core Pi session telemetry
- workflow/task context
- optional dynamic extension telemetry
Today, Pi is the first harness adapter. The canonical run schema is designed so other harness adapters can be added later, but multi-harness support is not implemented in this package yet.
What notrace does not own
notrace is not:
- the live Pi footer
- the Pi resume/session-switch UX
- a scraper of terminal status strings
Live footer output, resume hints, and extension footer badges may appear near notrace output during shutdown, but they are separate producers.
Retrospective spine
- Capture evidence:
notrace.json - Inspect:
notrace.html - Review outcome:
notrace.review.json - Compare attempts:
compare:notrace
Storage
.notrace/
index.json
index.html
sessions/
<session-id>/
notrace.json
notrace.html
notrace.review.json
Index rules:
index.jsonstays compact: one summary entry per session, not duplicated event payloads- each entry links both
artifacts.htmlandartifacts.record - per-session
notrace.htmllinks back to the shared index/viewer and to its canonicalnotrace.json index.json.lockprotects read-modify-write; if the lock cannot be acquired, notrace keeps the session artifacts and skips only the index update
Canonical run model
Generated notrace.json is the source of truth for runtime output, HTML rendering, and downstream tooling.
The record is versioned and centers on:
kindschemaVersiontraceIdrepositorysessiontaskcorrelation(optional Nochestra correlation fields)captureModeconditionsactivitytelemetryevents
Key rule:
- consumed tokens and saved tokens are separate metric families
- optimization telemetry belongs under
telemetry.extensions.* - presentation-only UI strings are not canonical evidence
Dynamic extension telemetry
notrace can include optional structured telemetry from dynamic extensions.
Current first target is noheadroom.
If an extension is absent, notrace should still succeed.
If an extension is present, it can contribute a structured summary such as:
- loaded / enabled / active state
- status:
absent,loaded-disabled,loaded-inactive,active, orunknown - optimization attempts
- tokens saved
- last applied compression summary
Example noheadroom detail fields:
attemptsappliedguardSkipstokensSavedlast
Capture modes
Default capture mode is redacted.
pi --extension ./packages/notrace
Optional modes:
NOTRACE_CAPTURE=redacted pi --extension ./packages/notrace
NOTRACE_CAPTURE=metadata pi --extension ./packages/notrace
NOTRACE_CAPTURE=full pi --extension ./packages/notrace
Mode meanings:
redacted: captured payloads with common secret-like values redacted; defaultmetadata: minimal capture, no prompt/tool bodiesfull: full captured payloads; best for local debugging; highest sensitivity
Capture mode benchmark evidence
Trace sizes measured on a 25-turn synthetic session (prompt/tool payloads, assistant outputs, usage, context metrics):
| Capture Mode | Trace Size | Storage Reduction | Payload Bodies | Secret Redaction |
|---|---|---|---|---|
full |
276 KB (100%) | Baseline | Included | Off |
redacted |
275 KB (~100%) | <1% reduction | Included | Best-effort |
metadata |
24 KB (~8.8%) | ~91% reduction | Omitted | N/A (omitted) |
Default mode remains redacted so payload histories are available for local debugging by default. Any change to metadata as default remains deferred pending stakeholder review of body availability needs vs storage savings.
Report/runtime invariants
- Missing or invalid
NOTRACE_CAPTUREfalls back toredacted. - Non-ghost sessions emit both
notrace.json(canonical event record) andnotrace.html(compact summary). - Dashboard/index entries carry both
artifacts.htmlandartifacts.record. - Dashboard links prefer per-session HTML summaries which link to
notrace.jsonand the shared dashboard viewer (index.html?session=<id>), avoiding duplicated trace event content across files. - Static reports allow only local relative navigation links; scheme URLs are blocked.
Phase 5 report renderer contract
notrace.json defines the 7 canonical report sections. Generated per-session notrace.html currently renders the compact canonical summary view; the older full retrospective renderer still uses Run Summary and Timeline labels for the same underlying data.
Canonical sections:
- Session Summary:
traceId,repository(name,branch),session(id,startedAt,endedAt,durationMs,shutdownReason),conditions(harness,models,providers,extensions),captureMode. - Usage Metrics: Consumed tokens (
inputTokens,outputTokens,cacheReadTokens,cacheWriteTokens,totalTokens) andtotalCostUsd; saved tokens stay under extension telemetry. - Activity Metrics: Turn count, LLM call count, tool call count, tool error count, session duration.
- Dynamic Extension Telemetry:
telemetry.extensions.*cards withstatus,summary, anddetails. Absent extensions render clean empty states without throwing. - Timeline / Events: Event stream timeline and model switch breakdown.
- Workflow / Task Attachments: Task context (
workflow,id,path,dir,role) and optional correlation identifiers (runId,workItemId,workerId,parentSessionId,sessionId,epochId). Nochestra correlation fields are optional. - Review Status: Judgment record from
notrace.review.json(outcome,friction,lesson,nextChange,runRecord). Default status is "Unreviewed" when missing.
Nochestra evidence fields render when present:
- worker sessions:
sessionId,workerId,role,route,command,modelTier,status - epoch boundaries:
epochId, optional localcheckpointRef - remediation/blocker events:
type,description,status - context quarantine savings:
parentPromptTokens,parentContextTokens,boundedHandoffTokens,quarantineSavingsTokens,quarantineSavingsPercent
Report links pass through safeHref: local relative links are allowed, scheme URLs and protocol-relative URLs are blocked.
Security warning: full reports can contain prompts, tool arguments, tool outputs, local paths, model payloads, and secrets returned by tools. redacted mode removes common secret-shaped values and sensitive keys, but redaction is best-effort and can miss project-specific secrets. metadata mode is safest for sharing because prompt/tool bodies are omitted, but reports can still reveal repository names, paths, timing, models, providers, and workflow metadata. Do not publish generated reports without review.
Cleanup
Inspect current local usage:
cd packages/notrace
npm run cleanup -- --dry-run --json
npm run cleanup -- --dir ~/.notrace --dry-run --json
Preview explicit retention by age or size:
npm run cleanup -- --dry-run --max-age-days 30 --json
npm run cleanup -- --dry-run --max-total-mb 500 --json
npm run cleanup -- --dry-run --max-total-bytes 524288000 --json
Apply cleanup only when you mean it:
npm run cleanup -- --apply --max-age-days 30
Flags:
--dir <path>chooses a trace directory; default is$NOTRACE_DIRor~/.notrace--dry-runpreviews candidates--applydeletes candidates--jsonemits machine-readable output--max-age-days <n>deletes sessions older thanndays--max-total-mb <n>or--max-total-bytes <n>enforces a total size budget--help/-hprints usage
Rules:
- nothing is deleted unless you pass explicit retention flags with
--apply - preserved sessions are skipped when their session directory contains
.preserve - stale
index.json.lockand*.tmpartifacts are eligible for cleanup when old enough - age/size retention uses run/index timestamps when available, then falls back to filesystem mtime
Manual recovery / rollback:
- use
--dry-runfirst and review candidate paths before--apply - if cleanup was too aggressive, restore removed session directories from your filesystem backup or Time Machine;
notracedoes not rewrite historical traces or keep a trash folder - remove retention flags from your command and go back to inspection-only mode
Review
From this monorepo:
npm run review:notrace -- \
.notrace/sessions/<id>/notrace.json \
--outcome partial \
--friction high \
--lesson "Headroom reduced tokens but needed manual steering." \
--next-change "Try same task with RepoScry enabled."
From an installed package:
npx -p @raquezha/notrace notrace-review \
.notrace/sessions/<id>/notrace.json \
--outcome partial \
--friction high \
--lesson "Headroom reduced tokens but needed manual steering." \
--next-change "Try same task with RepoScry enabled."
Review fields:
outcome:success,partial,failed,abandoned,inconclusivefriction:low,medium,highlessonnextChange
Compare
From this monorepo:
npm run compare:notrace -- \
.notrace/sessions/<baseline-id>/notrace.json \
.notrace/sessions/<candidate-id>/notrace.json
From an installed package:
npx -p @raquezha/notrace notrace-compare \
.notrace/sessions/<baseline-id>/notrace.json \
.notrace/sessions/<candidate-id>/notrace.json
Templates
HTML source-of-truth lives in templates/:
dashboard.sample.jsonsession.sample.jsondashboard.sample.htmlsession.sample.html
Refresh previews after renderer changes:
cd packages/notrace
npm run render:samples
Build
cd packages/notrace
npm install
npm run build
Output lands in dist/.