skills index: cap descriptions at 100 chars; hx prefix lists skills individually
ci / check (pull_request) Canceled after 0s
ci / check (push) Canceled after 0s

This commit is contained in:
hermes committed 2026-10-01 21:21:34 +00:00
1 parent a179bebbc0
commit 2ed6fbc028
2 files changed
+60 -11

No files matched your search

+24 -5
View File
@@ -311,13 +311,34 @@ async fn main() -> Result<()> {
.map(|f| f.1.len())
.sum();
let idx = hub.system_prompt();
let skills = full.len().saturating_sub(base.len() + files);
let sk = context::skills(&home, &cwd);
let always: usize = sk
.iter()
.filter(|k| k.load == context::Load::Always)
.map(|k| k.body.len())
.sum();
let mut skill_rows: Vec<(String, usize)> = sk
.iter()
.filter(|k| k.load == context::Load::Auto)
.map(|k| {
(
format!("skill: {}", k.name),
context::skill_index_line(k).len(),
)
})
.collect();
skill_rows.sort_by_key(|r| std::cmp::Reverse(r.1));
let other = full.len().saturating_sub(
base.len() + files + always + skill_rows.iter().map(|r| r.1).sum::<usize>(),
);
let mut rows: Vec<(String, usize)> = vec![
("system: base prompt".into(), base.len()),
("system: AGENTS.md/CLAUDE.md files".into(), files),
("system: skills + cwd line".into(), skills),
("system: always-skill bodies".into(), always),
("system: cwd line + headings".into(), other),
("system: MCP index".into(), idx.len()),
];
rows.extend(skill_rows);
let mut specs = reg.specs();
specs.sort_by_key(|t| {
std::cmp::Reverse(serde_json::to_string(t).map_or(0, |s| s.len()))
@@ -332,9 +353,7 @@ async fn main() -> Result<()> {
for (k, n) in rows {
println!("{:>7} tok {k}", n / 4);
}
println!(
"{total:>7} tok total (bytes/4; skills row = remainder of the system prompt)"
);
println!("{total:>7} tok total (bytes/4)");
mgr.shutdown().await;
return Ok(());
}