Skip to content

cast uses wrong base path for LocalAgentSource in local mode #871

@KenKilty

Description

@KenKilty

Bug

cast reports No agents found in current session cast. in local mode even when project agents exist on disk and the interactive shell is already showing them.

Environment

  • @bradygaster/squad-cli: 0.9.4-insider.1
  • @bradygaster/squad-sdk: 0.9.1
  • @github/copilot-sdk: 0.2.1 (overridden locally to work around the known startup/import issue)
  • OS: WSL2 Ubuntu / Linux
  • Node: v22.22.1
  • npm: 10.9.4

Repro

  1. Initialize a local squad repo.
  2. Ensure there is at least one project agent directory under .squad/agents/<name>/charter.md.
  3. Ensure team.md has at least one row under ## Members.
  4. Run:
npm exec squad -- cast

Actual

cast prints:

No agents found in current session cast.

Expected

cast should list the project agents discovered from .squad/agents/.

Why this looks like a real bug

In the same repo and same install:

  • squad doctor sees the agents directory and passes health checks
  • the interactive shell starts successfully
  • the shell header shows a real project agent, e.g. Lead [IDLE]

So the project agent files exist and are visible to other parts of the runtime.

Root Cause

The local cast command appears to pass the wrong base path into LocalAgentSource.

In the published CLI:

  • dist/cli/commands/cast.js does:
const paths = resolveSquadPaths(cwd);
const projectSource = new LocalAgentSource(paths.teamDir);

But LocalAgentSource itself appends .squad/agents when resolving local agents:

const AGENT_DIRS = ['.squad/agents', '.ai-team/agents'];

In local mode, resolveSquadPaths(cwd).teamDir is already the .squad directory, so LocalAgentSource(paths.teamDir) ends up looking under:

.squad/.squad/agents

which is wrong.

Direct proof

Running this in the affected repo:

const paths = resolveSquadPaths(process.cwd());
console.log(paths.teamDir);

const fromTeamDir = new LocalAgentSource(paths.teamDir);
const fromRepoRoot = new LocalAgentSource(process.cwd());

console.log(await fromTeamDir.listAgents());
console.log(await fromRepoRoot.listAgents());

produced:

  • paths.teamDir = /tmp/.../.squad
  • fromTeamDir.listAgents() = []
  • fromRepoRoot.listAgents() = [ lead, ralph, scribe ]

Local workaround

Patching the cast command to use cwd instead of paths.teamDir fixes the command locally:

const projectSource = new LocalAgentSource(cwd);

After that patch, cast correctly listed the project agents.

Suggested fix

Change the local project-agent discovery in cast to use the repo root cwd instead of paths.teamDir, or otherwise pass a base path that LocalAgentSource expects.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggo:needs-researchNeeds investigationsquadSquad triage inbox — Lead will assign to a membersquad:fidoAssigned to FIDO (Quality Owner)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions