Project
Repository: CortexLM/cortex
Version: v0.0.7
Component: cortex agent list — hidden count display (src/cortex-cli/src/agent_cmd/handlers/list.rs)
Description
When using cortex agent list --filter <pattern>, the footer message incorrectly reports the number of "hidden" agents. The hidden count is computed as:
// src/cortex-cli/src/agent_cmd/handlers/list.rs:131-135
let hidden_count = if !args.all {
agents.len() - filtered.len() // BUG: counts ALL non-displayed agents as "hidden"
} else {
0
};
agents.len() is the total of ALL agents. filtered.len() is agents after all filters (hidden flag + mode + pattern). So agents.len() - filtered.len() includes both:
- Truly hidden agents (have
hidden: true)
- Visible agents that simply don't match the
--filter pattern
The footer then prints this inflated count as "N hidden", misleading users into thinking N agents exist but are hidden, when in reality most of them are visible agents that just don't match the search pattern.
CLI Output Demonstrating the Bug
With 6 agents total (4 visible, 2 hidden), running cortex agent list --filter foo:
$ cortex agent list --filter foo
Name Mode Source Description
----------------------------------------------------------------------------------
foo-analyzer primary local Analyzes foo files
foo-reviewer subagent local Reviews foo code
Showing 2 agents (2 primary, 1 subagents, 4 hidden - use --all to show all)
^^^^^^^^
WRONG: only 1 hidden agent matches "foo"
The other 3 are visible agents that don't
match the pattern
Expected output:
Showing 2 agents (2 primary, 1 subagents, 1 hidden - use --all to show all)
Steps to Reproduce
- Have a workspace with multiple agents, some hidden and some visible, with varying names
- Run
cortex agent list --filter <pattern> where the pattern matches fewer agents than the total
- Observe the
N hidden count in the footer is inflated — it includes visible agents that don't match the filter
Expected Behavior
hidden_count should only count truly hidden agents (those not shown because of hidden: true), not agents that are merely excluded by the --filter pattern.
Fix: Compute hidden count independently of the pattern filter:
let hidden_count = if !args.all {
agents.iter().filter(|a| a.hidden).count()
} else {
0
};
Actual Behavior
hidden_count = agents.len() - filtered.len() counts all non-displayed agents as "hidden", including visible ones excluded by --filter.
Environment
- OS: Linux
- Version: v0.0.7
- File:
src/cortex-cli/src/agent_cmd/handlers/list.rs, lines 131–135
Project
Repository: CortexLM/cortex
Version: v0.0.7
Component:
cortex agent list— hidden count display (src/cortex-cli/src/agent_cmd/handlers/list.rs)Description
When using
cortex agent list --filter <pattern>, the footer message incorrectly reports the number of "hidden" agents. The hidden count is computed as:agents.len()is the total of ALL agents.filtered.len()is agents after all filters (hidden flag + mode + pattern). Soagents.len() - filtered.len()includes both:hidden: true)--filterpatternThe footer then prints this inflated count as
"N hidden", misleading users into thinking N agents exist but are hidden, when in reality most of them are visible agents that just don't match the search pattern.CLI Output Demonstrating the Bug
With 6 agents total (4 visible, 2 hidden), running
cortex agent list --filter foo:Expected output:
Steps to Reproduce
cortex agent list --filter <pattern>where the pattern matches fewer agents than the totalN hiddencount in the footer is inflated — it includes visible agents that don't match the filterExpected Behavior
hidden_countshould only count truly hidden agents (those not shown because ofhidden: true), not agents that are merely excluded by the--filterpattern.Fix: Compute hidden count independently of the pattern filter:
Actual Behavior
hidden_count = agents.len() - filtered.len()counts all non-displayed agents as "hidden", including visible ones excluded by--filter.Environment
src/cortex-cli/src/agent_cmd/handlers/list.rs, lines 131–135