Conversation
Extract the core logic out of the ccft binary into standalone workspace crates, keeping the binary as a thin re-export/glue layer: - ccft-ledger: Record/TailReader/parse_range/percentile/coverage, top-N/window/state-event readers (range.rs + tail.rs) - ccft-session: hyper HeaderMap+body -> session-id extraction - ccft-lex: lexical_stats, content_bigrams, novelty_fraction, strip_system_blocks, clean_user_text - ccft-brainrot: Aggregate/ingest_into, classify_turns, fit_gap_mixture, Baseline::from_records, driver/bot scores, score_breakdown, diagnosis, compute_signal/VLPV - ccft-sse: generic hyper Body tap (SseTap/TapMeta/TapReport) that parses SSE/JSON into a provider-agnostic report; the bin wires it to the write-side ledger via a callback Binary re-export layer: - src/ledger_read.rs: ccft-specific path glue + thin pub use - src/session.rs, src/brainrot/aggregate.rs: thin pub use re-exports - src/sse_tap.rs: FlowMeta->TapMeta adapter + ledger write callback Fixes along the way: percentile re-export, UNIX_EPOCH import, iter_records now takes Vec<PathBuf> by value (self-contained 'static iterator), Default derive on TailReader, corrected ccft-lex test, clippy-clean across all 5 crates. 23 tests pass across workspace; build green.
Root ccft is now both a binary and a library. src/lib.rs re-exports
ccft_ledger/ccft_session/ccft_lex/ccft_brainrot/ccft_sse as
ccft::{ledger, session, lex, brainrot, sse} so downstream Rust code can
use ccft::… without depending on each crate. Adds a facade smoke test
(1 new test; workspace 24 pass).
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.
What
Extract the reusable, generic logic out of the
ccftbinary into five cratified sub-crates, and turn the rootccftinto both a binary and a library facade that re-exports them.Crates
ccft-ledger— append/tail/range-read a growing JSONL ledger (Record,TailReader,parse_range,percentile, coverage)ccft-session— session-id extraction from hyper headers + JSON metadata bodiesccft-lex— pure text fingerprinting: lexical stats, content bigrams, novelty, system-block strippingccft-brainrot— agentic turn classification, EM gap mixture, baseline fingerprint, driver/bot scoringccft-sse— generic hyperBodytap for OpenAI/Anthropic SSE + non-stream JSON token/usage accountingLibrary facade
src/lib.rsre-exports the five crates so downstream Rust code canuse ccft::{ledger, lex, sse};without depending on each crate individually:The binary's own modules (handler/config/lifecycle/…) stay ccft-specific and are not part of the library surface.
Verification
cargo build --workspacegreen