feat(trace): persist per-prompt traces to SQLite + query API#233
Open
a-yeyang wants to merge 6 commits into
Open
feat(trace): persist per-prompt traces to SQLite + query API#233a-yeyang wants to merge 6 commits into
a-yeyang wants to merge 6 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Per-prompt agent traces (previously written only to
.siclaw/traces/*.json) arenow also persisted to a local SQLite DB, with a Gateway-served query API. Enables
cross-session retrospective and slow-task audits without scanning files.
What's added
.siclaw/traces.sqlite— standalonenode:sqlitestore (lazy-loaded; onNode <22.13 without
--experimental-sqlite, gracefully degrades to file-only).INTEGER PRIMARY KEY AUTOINCREMENTclustered id +trace_key TEXT UNIQUE(business key, matches the on-disk filename stem).Beijing-time TEXT columns
started_at/ended_at/created_at(
YYYY-MM-DD HH:mm:ss.SSS). Indexes on(user_id, started_at),(started_at),(session_id, prompt_idx).PRAGMA user_version(v1 → v2 → v3), in-place,preserves all existing rows.
:3000, eager-start — no AgentBox spawn needed):GET /api/traces— filters:username,userId,lastHours,lastDays,from,to,minDurationMs,outcome,limit. Keyset pagination viacursorStartedAt+cursorId.GET /api/traces/:traceKey— full JSON body (byte-identical to disk file).Usage