Skip to content

feat: Add 'sage' CLI command for Q&A, task decomposition, and agent routing #40

@jbdevprimary

Description

@jbdevprimary

Summary

The Analyzer class has quickTriage() which provides fast assessment, but we need a dedicated "Sage" mode for:

  1. Q&A - Answering questions about the codebase
  2. Task Decomposition - Breaking down complex tasks into subtasks with agent assignments
  3. Agent Routing - Determining which agent (Cursor/Jules/Human) should handle work
  4. Unblocking - Helping stuck agents/developers

Proposed Changes

1. CLI Command: agentic sage

# Answer a question
agentic sage "How do I add a new API endpoint?"

# Decompose a task
agentic sage --decompose "Implement user authentication"

# Route to agent
agentic sage --route "Fix the failing tests in ci.yml"

# With repo context
agentic sage --repo owner/repo "What does the Fleet class do?"

2. New Analyzer Method: sage()

interface SageOptions {
  mode: 'question' | 'decompose' | 'route' | 'unblock';
  context?: {
    repo?: string;
    issue?: number;
    files?: string[];
  };
}

async sage(query: string, options?: SageOptions): Promise<SageResult>

3. Schemas (in triage or local)

const SageResponseSchema = z.object({
  answer: z.string(),
  queryType: z.enum(['QUESTION', 'REVIEW', 'FIX', 'IMPLEMENT', 'REFACTOR', 'DECOMPOSE', 'UNBLOCK', 'GENERAL']),
  confidence: z.number().min(0).max(1),
  references: z.array(z.string()).optional(),
  followUp: z.string().optional(),
  agentRecommendation: z.object({
    agent: z.enum(['CURSOR', 'JULES', 'OLLAMA', 'HUMAN']),
    reason: z.string(),
  }).optional(),
});

const TaskDecompositionSchema = z.object({
  subtasks: z.array(z.object({
    title: z.string(),
    description: z.string(),
    agent: z.enum(['CURSOR', 'JULES', 'HUMAN']),
    priority: z.number().min(1).max(10),
    estimatedEffort: z.enum(['small', 'medium', 'large']),
  })),
  dependencies: z.array(z.object({
    from: z.string(),
    to: z.string(),
  })).optional(),
});

4. Action Extension

Add to actions/agentic-sage/action.yml:

name: 'Agentic Sage'
description: 'AI advisor for Q&A, task decomposition, and agent routing'
inputs:
  query:
    description: 'The question or task'
    required: true
  mode:
    description: 'question, decompose, route, unblock'
    default: 'question'
  context_repo:
    description: 'Repository for context'
    required: false

Usage in control-center

Once implemented, ecosystem-sage.yml becomes:

- name: Run Sage
  uses: agentic-dev-library/control/actions/agentic-sage@v1
  with:
    query: ${{ inputs.query }}
    mode: 'question'
    context_repo: ${{ inputs.context_repo }}
    github_token: ${{ secrets.CI_GITHUB_TOKEN }}
  env:
    OLLAMA_API_KEY: ${{ secrets.OLLAMA_API_KEY }}

Benefits

  1. DRY - No more duplicated logic in control-center
  2. Testable - Proper unit tests in the OSS packages
  3. Reusable - Any org can use agentic sage from npm
  4. Maintainable - Single source of truth

Related

  • agentic-dev-library/triage#74 (Sage primitives)
  • jbcom/control-center ecosystem-sage workflow

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions