Documentation
¶
Index ¶
- Constants
- func BlockTask(teamName, taskID, agentHandle, agentID, reason string) error
- func BridgeMode(cfg BridgeConfig) string
- func ClaimTask(teamName, taskID, agentID string) error
- func ClaudeTasksDir() string
- func ClaudeTeamsDir() string
- func CompleteTask(teamName, taskID, agentHandle, agentID string, evidence map[string]any) error
- func FailTask(teamName, taskID, agentHandle, agentID, reason string) error
- func NewExternalAgentID(handle string) string
- func RegisterMember(teamName string, member Member) error
- func RunBridge(ctx context.Context, cfg BridgeConfig) error
- func TeamConfigPath(team string) string
- func TeamTasksDir(team string) string
- func UnregisterMember(teamName, agentID string) error
- type BridgeConfig
- type BridgeEvent
- type Member
- type Task
- type TeamConfig
- type TeamSummary
Constants ¶
const ( TaskStatusPending = "pending" TaskStatusInProgress = "in_progress" TaskStatusCompleted = "completed" TaskStatusFailed = "failed" TaskStatusBlocked = "blocked" )
Task status constants. pending/in_progress/completed match Claude Code Agent Teams; failed and blocked are AMQ extensions for richer lifecycle tracking.
const ( AgentTypeClaudeCode = "claude-code" AgentTypeCodex = "codex" AgentTypeExternal = "external" )
AgentType constants for team member classification.
Variables ¶
This section is empty.
Functions ¶
func BlockTask ¶ added in v0.21.0
BlockTask marks an in-progress task as blocked and records the blocking reason.
func BridgeMode ¶
func BridgeMode(cfg BridgeConfig) string
BridgeMode returns "fsnotify" or "polling" based on cfg.UsePoll.
func ClaimTask ¶
ClaimTask assigns a task to an agent. It checks dependency gating: all depends_on tasks must have status "completed". Tasks with failed or blocked dependencies remain unclaimable.
func ClaudeTasksDir ¶
func ClaudeTasksDir() string
ClaudeTasksDir returns the path to ~/.claude/tasks/.
func ClaudeTeamsDir ¶
func ClaudeTeamsDir() string
ClaudeTeamsDir returns the path to ~/.claude/teams/.
func CompleteTask ¶
CompleteTask marks a task as completed, optionally attaching proof-of-work evidence.
func FailTask ¶ added in v0.21.0
FailTask marks an in-progress task as failed and records the failure reason.
func NewExternalAgentID ¶
NewExternalAgentID generates an agent ID for external (non-Claude-Code) agents. Format: ext_{handle}_{timestamp}_{nanoseconds}_pid{pid}_{randhex}
func RegisterMember ¶
RegisterMember adds a new member to the team config and writes it back. Returns an error if a member with the same agent_id already exists. Uses raw JSON round-tripping to preserve unknown fields in CC's config.
func RunBridge ¶
func RunBridge(ctx context.Context, cfg BridgeConfig) error
RunBridge starts the bridge process that syncs between Agent Teams tasks and AMQ messages. Uses fsnotify by default, falling back to polling on error or when cfg.UsePoll is set.
func TeamConfigPath ¶
TeamConfigPath returns the path to a team's config.json.
func TeamTasksDir ¶
TeamTasksDir returns the path to a team's tasks directory.
func UnregisterMember ¶
UnregisterMember removes a member by agent_id from the team config. Uses raw JSON round-tripping to preserve unknown fields in CC's config.
Types ¶
type BridgeConfig ¶
type BridgeConfig struct {
TeamName string
AgentHandle string // AMQ handle for the external agent (e.g., "codex")
AgentID string // Agent Teams agent_id
AMQRoot string // AMQ root directory
PollInterval time.Duration // How often to check for task changes (polling mode)
UsePoll bool // Force polling instead of fsnotify
}
BridgeConfig holds configuration for the swarm bridge process.
type BridgeEvent ¶
type BridgeEvent struct {
Type string `json:"type"` // "task_added", "task_updated", "task_assigned", "task_unblocked", "task_completed", "task_failed", "task_blocked"
TaskID string `json:"task_id"`
Title string `json:"title"`
Status string `json:"status"`
Details string `json:"details,omitempty"`
Reason string `json:"reason,omitempty"`
Evidence map[string]any `json:"evidence,omitempty"`
}
BridgeEvent represents a task change detected by the bridge.
type Member ¶
type Member struct {
Name string `json:"name"`
AgentID string `json:"agent_id"`
AgentType string `json:"agent_type"`
}
Member represents a teammate in a Claude Code Agent Team.
type Task ¶
type Task struct {
ID string `json:"id"`
Title string `json:"title"`
Description string `json:"description,omitempty"`
Status string `json:"status"`
AssignedTo string `json:"assigned_to,omitempty"`
DependsOn []string `json:"depends_on,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
UpdatedAt string `json:"updated_at,omitempty"`
Evidence map[string]any `json:"evidence,omitempty"`
FailureReason string `json:"failure_reason,omitempty"`
BlockReason string `json:"block_reason,omitempty"`
}
Task represents a work item in the shared task list. Used for reading; writes go through map[string]any to preserve unknown fields.
type TeamConfig ¶
type TeamConfig struct {
Name string `json:"name"`
Lead string `json:"lead,omitempty"`
Members []Member `json:"members"`
}
TeamConfig represents the team configuration stored at ~/.claude/teams/{team-name}/config.json.
func LoadTeam ¶
func LoadTeam(name string) (TeamConfig, error)
LoadTeam reads and parses a team's config.json.
func (*TeamConfig) FindMember ¶
func (tc *TeamConfig) FindMember(agentID string) *Member
FindMember returns the member with the given agent ID, or nil if not found.
func (*TeamConfig) FindMemberByName ¶
func (tc *TeamConfig) FindMemberByName(name string) *Member
FindMemberByName returns the member with the given name, or nil if not found.
type TeamSummary ¶
type TeamSummary struct {
Name string `json:"name"`
MemberCount int `json:"member_count"`
ConfigPath string `json:"config_path"`
}
TeamSummary provides a brief overview of a team for listing.
func DiscoverTeams ¶
func DiscoverTeams() ([]TeamSummary, error)
DiscoverTeams lists all teams found in ~/.claude/teams/.