Add LingTai agent event index baseline#394
Draft
feichai0017 wants to merge 2 commits into
Draft
Conversation
Signed-off-by: eric_song <songguocheng348@gmail.com>
Signed-off-by: eric_song <songguocheng348@gmail.com>
feichai0017
force-pushed
the
feature/lingtai-agent-index-baseline
branch
from
July 8, 2026 00:07
9e16bea to
e09b6e2
Compare
feichai0017
marked this pull request as draft
July 8, 2026 00:08
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
This PR adds a LingTai-facing agent event-index surface to
nokv-agentand keeps it separate from the NoKV DFS namespace tool surface. LingTailogs/events.jsonlremains the source of truth; the Holt-backed NoKV index is a rebuildable derived sidecar intended to replacetui/internal/sqlitelogquery paths, not to expose a SQL compatibility layer.Changes include:
crates/nokv-agent/src/namespace.rswhile preserving the latest main/workbench P0 tool behavior;nokv_agent::eventwith typed records, projection, codec, key layout, ingest, store trait, and Holt implementation;nokv-agent lingtai ...CLI commands for ingest, coverage, session rows, errors, molt/recent probes, TUI clear completion, notification navigation, parsed notification blocks/snapshots, lifecycle filters, facets, and tool traces;fields_jsonfor SQLite replacement semantics by externalizing oversized payloads into a Holtpayloadstree and transparently rehydrating records on read;lingtai-index-benchbenchmark;holtto0.8.1.LingTai replacement scope
The intended adapter mapping is function-level, not raw SQL-level:
QueryEventsIndexCoveragenokv-agent lingtai coverage --source-file logs/events.jsonlStreamSessionEventsnokv-agent lingtai session-rowsQueryErrorEventsnokv-agent lingtai errorsHasTUIClearCompletionEventnokv-agent lingtai clear-completion --source-offset <offset>QueryMoltSessionWindowsnokv-agent lingtai molt-windowsQueryRecentMoltTimesnokv-agent lingtai recent --type psyche_moltQueryRecentRefreshCompleteTimesnokv-agent lingtai recent --type refresh_completeQueryNotificationBlocksnokv-agent lingtai notification-blocksQueryNotificationBlockSnapshotsnokv-agent lingtai notification-block-snapshotsQueryNotificationsnokv-agent lingtai notification-eventsor lifecycle-filterednotificationsQueryNotificationByIDnokv-agent lingtai notification-by-id --event-id <id>QueryNotificationBeforenokv-agent lingtai notification-before --event-id <id>QueryNotificationAfternokv-agent lingtai notification-after --event-id <id>Current completeness details:
notification-blocksparsesnotification_pair_injectedinto the same summary/meta/source shape used by LingTaiQueryNotificationBlocks, and still returns raweventsfor diagnostics.notification-block-snapshotsparses both modern_metaenvelopes and legacypayload/metarows used byQueryNotificationBlockSnapshots, and still returns rawevents.errorsmirrors LingTai's current default types:aed_attempt,aed_exhausted, andrefresh_init_error; rows without a non-emptyerrorfield are skipped.notification-by-idfollows LingTai's current SQL and returns the row by id without requiring the type to containnotification.fields_jsonis preserved. Event records larger than Holt's single-value limit storefields_jsonin chunked payload records and rehydrate it before returning any publicEventRecordor session row.Adapter responsibilities that intentionally remain outside NoKV-agent:
nokv-agent, keep LingTai's worker-local timeout, freshness cache, and stale-on-error fallback aroundmolt-windows.Benchmark evidence
The benchmark compares four arms:
sqlite_current_v1: exported LingTailogs/log.sqlite;sqlite_projected_v1: current SQLite plus query-shape indexes;sqlite_rebuilt_from_jsonl_v1: SQLite rebuilt from the same JSONL source used by NoKV-agent;nokv_agent_index_v1: Holt-backed NoKV-agent index.On the filtered 2026-06-30 LingTai export, exported SQLite and JSONL coverage differed, so equality claims use the rebuilt SQLite arm. Rows/fingerprints matched for the public sqlitelog-shaped queries. Tool facet fingerprints intentionally differ because NoKV-agent parses stringified
tool_argsinto semantic projections while SQLite JSON expressions do not.Pre-completeness benchmark highlights, before the full-
fields_jsonchunking change:The same pre-completeness run measured NoKV-agent ingest at 7,173.482 ms and the Holt index at 5,610,024,663 bytes. Because this PR now preserves oversized
fields_jsoninstead of compacting it, index size must be remeasured before making a final storage-footprint claim. The current evidence still supports the optimization direction for coverage, semantic facets, TUI clear completion, and direct notification neighbor traversal; SQLite remains faster for several small point/page queries and full session replay.Boundary notes
nokv-agentremains transport-free and does not depend onnokv-client,nokv-protocol, ornokv-control.fields_json; rows are reconstructed from the canonical event record.Validation
Draft status
This should remain draft until the LingTai-side adapter is implemented and the benchmark is rerun after full-
fields_jsonchunking. The main open product decision is whether LingTai should call the CLI initially or link the Rust API directly.