Project
cortex
Description
The app-server custom agent API uses a different storage layout from the rest of Cortex:
POST /api/v1/agents with scope=project writes to .factory/agents
POST /api/v1/agents with scope=user writes to ~/.factory/agents
But the standard agent loaders and UIs do not scan .factory/agents at all. They scan:
.agents
.agent
.cortex/agents
~/.cortex/agents
~/.config/cortex/agents
So an agent created through the app-server API can be written successfully but still remain invisible to the standard loader used by the rest of Cortex.
Error Message
No explicit error is shown. The bug is a silent storage mismatch: create succeeds, but discovery never finds the created agent.
Debug Logs
CARGO_HOME=/tmp/cargo-home-rsproxy cargo test -p cortex-app-server project_agent_created_via_api_is_not_discoverable_by_standard_loader --manifest-path /tmp/cortex-upstream/Cargo.toml -- --test-threads=1 --nocapture
running 1 test
factory_path=/tmp/.../.factory/agents/factory-only-agent.md
loader_paths=[project/.agents, project/.agent, project/.cortex/agents, HOME/.cortex/agents, XDG_CONFIG_HOME/cortex/agents]
loaded_names=[]
ok
System Information
macOS Darwin 25.x (Apple Silicon)
Cortex v0.0.7 source checkout
Rust toolchain: cargo 1.95.0 / rustc 1.95.0
Screenshots

Steps to Reproduce
- Use the app-server custom agent creation path with
scope=project.
- Observe the created file is written under
.factory/agents/<name>.md.
- Run the standard custom agent loader for the same project root.
- Observe that the loader only scans
.agents, .agent, .cortex/agents, ~/.cortex/agents, and ~/.config/cortex/agents.
- The agent that was just created by the API is not discovered.
The targeted proof command above demonstrates the mismatch directly and prints both:
- the path where the app-server wrote the new agent
- the exact directories searched by the standard loader
Expected Behavior
Agents created via the app-server API should be stored in a directory that the standard Cortex agent loaders also scan, so the created agent becomes discoverable and usable immediately across the rest of the product.
Actual Behavior
The API writes custom agents to .factory/agents / ~/.factory/agents, but the standard loaders never scan those directories. The created agent exists on disk but is effectively invisible to the rest of Cortex.
Additional Context
Relevant code paths:
src/cortex-app-server/src/api/agents.rs
- project agents:
.factory/agents
- user agents:
~/.factory/agents
src/cortex-agents/src/custom/loader.rs
- scans
.agents, .agent, .cortex/agents, ~/.cortex/agents, ~/.config/cortex/agents
src/cortex-tui/src/interactive/builders/agents.rs
- uses
.cortex/agents and ~/.config/cortex/agents
src/cortex-commands/src/builtin/agents_cmd.rs
- documents
.cortex/agents/ and ~/.config/cortex/agents/
This is not just a path-style inconsistency. It creates a functional mismatch where app-server-created agents are not discoverable by the standard loader and therefore do not participate in the normal custom-agent flow.
Project
cortex
Description
The app-server custom agent API uses a different storage layout from the rest of Cortex:
POST /api/v1/agentswithscope=projectwrites to.factory/agentsPOST /api/v1/agentswithscope=userwrites to~/.factory/agentsBut the standard agent loaders and UIs do not scan
.factory/agentsat all. They scan:.agents.agent.cortex/agents~/.cortex/agents~/.config/cortex/agentsSo an agent created through the app-server API can be written successfully but still remain invisible to the standard loader used by the rest of Cortex.
Error Message
Debug Logs
System Information
macOS Darwin 25.x (Apple Silicon) Cortex v0.0.7 source checkout Rust toolchain: cargo 1.95.0 / rustc 1.95.0Screenshots
Steps to Reproduce
scope=project..factory/agents/<name>.md..agents,.agent,.cortex/agents,~/.cortex/agents, and~/.config/cortex/agents.The targeted proof command above demonstrates the mismatch directly and prints both:
Expected Behavior
Agents created via the app-server API should be stored in a directory that the standard Cortex agent loaders also scan, so the created agent becomes discoverable and usable immediately across the rest of the product.
Actual Behavior
The API writes custom agents to
.factory/agents/~/.factory/agents, but the standard loaders never scan those directories. The created agent exists on disk but is effectively invisible to the rest of Cortex.Additional Context
Relevant code paths:
src/cortex-app-server/src/api/agents.rs.factory/agents~/.factory/agentssrc/cortex-agents/src/custom/loader.rs.agents,.agent,.cortex/agents,~/.cortex/agents,~/.config/cortex/agentssrc/cortex-tui/src/interactive/builders/agents.rs.cortex/agentsand~/.config/cortex/agentssrc/cortex-commands/src/builtin/agents_cmd.rs.cortex/agents/and~/.config/cortex/agents/This is not just a path-style inconsistency. It creates a functional mismatch where app-server-created agents are not discoverable by the standard loader and therefore do not participate in the normal custom-agent flow.