Files
wehub-resource-sync 26382a7ac6
CI / Clippy (push) Failing after 15m13s
CI / Test (ubuntu-latest) (push) Failing after 16m1s
CI / Test (macos-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Build (no embeddings / no ORT) (push) Has been cancelled
CI / Format (push) Has been cancelled
CI / Cookbook (Node) (push) Has been cancelled
CI / Pi Extension (Node) (push) Has been cancelled
CI / Rust SDK (lean-ctx-client) (push) Has been cancelled
CI / Embed SDK (lean-ctx-sdk) (push) Has been cancelled
CI / Python SDK (leanctx) (push) Has been cancelled
CI / Hermes Plugin (Python) (push) Has been cancelled
CI / SDK Conformance Matrix (push) Has been cancelled
CI / Coverage (push) Has been cancelled
CI / cargo-deny (push) Has been cancelled
CI / Adversarial Safety (push) Has been cancelled
CI / Benchmarks (push) Has been cancelled
CI / Output-Quality Gate (eval A/B) (push) Has been cancelled
CI / Documentation (push) Has been cancelled
CI / CI Green (push) Has been cancelled
JetBrains Plugin / Actionlint (push) Has been cancelled
CodeQL / Analyze (actions) (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
CodeQL / Analyze (rust) (push) Has been cancelled
JetBrains Plugin / Validation (push) Has been cancelled
JetBrains Plugin / Build (push) Has been cancelled
JetBrains Plugin / Test (push) Has been cancelled
Security Check / Security Scan (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:35:30 +08:00

47 lines
2.4 KiB
Rust

use lean_ctx::core::tokens::count_tokens;
use lean_ctx::server::build_instructions_for_test;
use lean_ctx::tools::CrpMode;
fn main() {
let home = std::env::var("HOME").unwrap_or_else(|_| "/tmp".to_string());
let path = format!("{home}/.lean-ctx/token_impact.txt");
let old_proactive = "PROACTIVE: ctx_overview(task) at start | ctx_preload(task) for focused context | ctx_compress when context grows | ctx_session load on new chat\n\nOTHER TOOLS: ctx_session (memory), ctx_knowledge (project facts), ctx_agent (coordination), ctx_metrics, ctx_analyze, ctx_benchmark, ctx_cache, ctx_wrapped, ctx_compress";
let new_autonomy = "AUTONOMY: lean-ctx auto-runs ctx_overview, ctx_preload, ctx_dedup, ctx_compress behind the scenes.\nFocus on: ctx_read, ctx_shell, ctx_search, ctx_tree. Use ctx_session for memory, ctx_knowledge for project facts.";
let wrapper = "--- AUTO CONTEXT ---\n--- END AUTO CONTEXT ---\n\n";
let overview =
"§overview project\nsrc/ (5 files, ~120L)\n main.rs lib.rs utils.rs auth.rs config.rs";
let preload = "§preload [task: fix auth]\nLoaded 3 files: auth.rs (full, 45L), utils.rs (map, 8 exports)\nRelevant: middleware.rs (0.8)";
let h3 = "[related: auth.rs, middleware.rs, config.rs]";
let h2 = "[related: utils.rs, types.rs]";
let h1 = "[related: helper.rs]";
let sh1 = "[hint: ctx_search is more token-efficient for code search]";
let sh2 = "[hint: ctx_read provides cached, compressed file access]";
let full_off = build_instructions_for_test(CrpMode::Off);
let full_compact = build_instructions_for_test(CrpMode::Compact);
let full_tdd = build_instructions_for_test(CrpMode::Tdd);
let mut out = String::new();
let data = [
("old_proactive", count_tokens(old_proactive)),
("new_autonomy", count_tokens(new_autonomy)),
("wrapper", count_tokens(wrapper)),
("overview", count_tokens(overview)),
("preload", count_tokens(preload)),
("hint_3", count_tokens(h3)),
("hint_2", count_tokens(h2)),
("hint_1", count_tokens(h1)),
("shell_hint_search", count_tokens(sh1)),
("shell_hint_read", count_tokens(sh2)),
("full_off", count_tokens(&full_off)),
("full_compact", count_tokens(&full_compact)),
("full_tdd", count_tokens(&full_tdd)),
];
for (name, val) in &data {
out.push_str(&format!("{name}={val}\n"));
}
std::fs::write(&path, &out).expect("write");
}