Skip to main content
Glama

overseer.run_phase

Execute project phases by reading task files, checking completion status, and generating TODO items for incomplete tasks to maintain structured workflow progress.

Instructions

Execute a specific phase of a project. Reads tasks from PHASE-XX.md, checks completion status, and creates TODOs/stubs for incomplete tasks.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_rootYesRoot path of the repository
phase_idYesPhase ID (e.g., "01", "02")
aggression_levelNoHow aggressively to create files and make changesnormal

Implementation Reference

  • Main execution handler for overseer.run_phase tool. Processes PHASE-XX.md, checks/completes tasks, creates stubs/TODOs based on aggression_level, updates status and checklists.
    export async function handleRunPhase(
      args: {
        repo_root: string;
        phase_id: string;
        aggression_level?: 'bossmode' | 'normal' | 'conservative';
      },
      phaseManager: PhaseManager
    ): Promise<{
      success: boolean;
      message: string;
      phase_id: string;
      completed_tasks: Array<{
        task: string;
        type: 'deliverable' | 'done_criterion';
        evidence: string;
      }>;
      pending_tasks: Array<{
        task: string;
        type: 'deliverable' | 'done_criterion';
        action_taken: string;
      }>;
      changed_files: string[];
      status: 'in_progress' | 'potentially_complete';
    }> {
      const completedTasks: Array<{ task: string; type: 'deliverable' | 'done_criterion'; evidence: string }> = [];
      const pendingTasks: Array<{ task: string; type: 'deliverable' | 'done_criterion'; action_taken: string }> = [];
      const changedFiles: string[] = [];
    
      try {
        // Resolve repo path
        let repoPath = args.repo_root;
        if (!repoPath.startsWith('/')) {
          repoPath = join(homedir(), 'dev', repoPath);
        }
        repoPath = FSUtils.expandPath(repoPath);
    
        const phaseId = args.phase_id.padStart(2, '0');
        const aggressionLevel = args.aggression_level || 'normal';
    
        // Read PHASES.md using absolute path (handles paths with spaces)
        const repoName = repoPath.split('/').pop() || 'unknown';
        const repoHandler = new RepoHandler();
        const projectPhases = repoHandler.readPhasesIndexFromPath(repoPath);
    
        if (!projectPhases) {
          return {
            success: false,
            message: 'Project not found. Run plan_project first.',
            phase_id: phaseId,
            completed_tasks: [],
            pending_tasks: [],
            changed_files: [],
            status: 'in_progress',
          };
        }
    
        // Find the phase
        const phase = projectPhases.phases.find(p => p.id === phaseId);
        if (!phase) {
          return {
            success: false,
            message: `Phase ${phaseId} not found`,
            phase_id: phaseId,
            completed_tasks: [],
            pending_tasks: [],
            changed_files: [],
            status: 'in_progress',
          };
        }
    
        // Read PHASE-XX.md (handles paths with spaces)
        const phaseFilePath = repoHandler.getPhaseFileByIdFromPath(repoPath, phaseId);
        if (!FSUtils.fileExists(phaseFilePath)) {
          return {
            success: false,
            message: `Phase file PHASE-${phaseId}.md not found`,
            phase_id: phaseId,
            completed_tasks: [],
            pending_tasks: [],
            changed_files: [],
            status: 'in_progress',
          };
        }
    
        let phaseContent = FSUtils.readFile(phaseFilePath);
    
        // Parse deliverables and done_criteria from phase file
        const deliverables: string[] = [];
        const doneCriteria: string[] = [];
    
        // Extract deliverables
        const deliverablesMatch = phaseContent.match(/## Deliverables\s*\n((?:- \[[ x]\] .+\n?)+)/);
        if (deliverablesMatch) {
          const items = deliverablesMatch[1].match(/- \[[ x]\] (.+)/g);
          if (items) {
            items.forEach(item => {
              const text = item.replace(/- \[[ x]\] /, '').trim();
              if (text) deliverables.push(text);
            });
          }
        }
    
        // Extract done criteria
        const doneCriteriaMatch = phaseContent.match(/## Done Criteria\s*\n((?:- \[[ x]\] .+\n?)+)/);
        if (doneCriteriaMatch) {
          const items = doneCriteriaMatch[1].match(/- \[[ x]\] (.+)/g);
          if (items) {
            items.forEach(item => {
              const text = item.replace(/- \[[ x]\] /, '').trim();
              if (text) doneCriteria.push(text);
            });
          }
        }
    
        // Check each deliverable
        for (const deliverable of deliverables) {
          const checked = checkTaskCompletion(deliverable, repoPath, aggressionLevel);
          
          if (checked.completed) {
            completedTasks.push({
              task: deliverable,
              type: 'deliverable',
              evidence: checked.evidence,
            });
            // Update checklist in phase file
            phaseContent = updateChecklistItem(phaseContent, deliverable, true, 'Deliverables');
          } else {
            pendingTasks.push({
              task: deliverable,
              type: 'deliverable',
              action_taken: checked.actionTaken,
            });
            // Create stub/TODO if aggression level allows
            if (aggressionLevel !== 'conservative' && checked.filePath) {
              createStubFile(checked.filePath, deliverable, aggressionLevel);
              changedFiles.push(checked.filePath);
            }
            // Update checklist in phase file
            phaseContent = updateChecklistItem(phaseContent, deliverable, false, 'Deliverables');
          }
        }
    
        // Check each done criterion
        for (const criterion of doneCriteria) {
          const checked = checkTaskCompletion(criterion, repoPath, aggressionLevel);
          
          if (checked.completed) {
            completedTasks.push({
              task: criterion,
              type: 'done_criterion',
              evidence: checked.evidence,
            });
            phaseContent = updateChecklistItem(phaseContent, criterion, true, 'Done Criteria');
          } else {
            pendingTasks.push({
              task: criterion,
              type: 'done_criterion',
              action_taken: checked.actionTaken,
            });
            phaseContent = updateChecklistItem(phaseContent, criterion, false, 'Done Criteria');
          }
        }
    
        // Update phase status to in_progress if not already
        if (phase.status === 'pending') {
          phase.status = 'in_progress';
          phase.started_at = new Date().toISOString();
          repoHandler.writePhasesIndexToPath(repoPath, projectPhases);
          changedFiles.push(join(repoPath, 'PHASES.md'));
        }
    
        // Update phase file
        phaseContent = updatePhaseStatus(phaseContent, 'in_progress');
        FSUtils.writeFile(phaseFilePath, phaseContent);
        changedFiles.push(phaseFilePath);
    
        // Determine overall status
        const allComplete = completedTasks.length === deliverables.length + doneCriteria.length;
        const status = allComplete ? 'potentially_complete' : 'in_progress';
    
        return {
          success: true,
          message: `Phase ${phaseId} execution completed. ${completedTasks.length} tasks complete, ${pendingTasks.length} pending.`,
          phase_id: phaseId,
          completed_tasks: completedTasks,
          pending_tasks: pendingTasks,
          changed_files: changedFiles,
          status,
        };
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        return {
          success: false,
          message: `Failed to run phase: ${errorMessage}`,
          phase_id: args.phase_id,
          completed_tasks: [],
          pending_tasks: [],
          changed_files: [],
          status: 'in_progress',
        };
      }
    }
  • Tool schema definition including name, description, and input schema parameters for overseer.run_phase.
    export function createRunPhaseTool(phaseManager: PhaseManager): Tool {
      return {
        name: 'overseer.run_phase',
        description: 'Execute a specific phase of a project. Reads tasks from PHASE-XX.md, checks completion status, and creates TODOs/stubs for incomplete tasks.',
        inputSchema: {
          type: 'object',
          required: ['repo_root', 'phase_id'],
          properties: {
            repo_root: {
              type: 'string',
              description: 'Root path of the repository',
            },
            phase_id: {
              type: 'string',
              description: 'Phase ID (e.g., "01", "02")',
            },
            aggression_level: {
              type: 'string',
              enum: ['bossmode', 'normal', 'conservative'],
              default: 'normal',
              description: 'How aggressively to create files and make changes',
            },
          },
        },
      };
    }
  • Registration of overseer.run_phase tool via createRunPhaseTool in the tools array returned by createTools.
    export function createTools(context: ToolContext): Tool[] {
      return [
        // Planning tools
        createPlanProjectTool(context.phaseManager),
        createInferPhasesTool(context.configLoader),
        createUpdatePhasesTool(context.phaseManager),
        // Execution tools
        createRunPhaseTool(context.phaseManager),
        createAdvancePhaseTool(context.phaseManager),
        createStatusTool(context.phaseManager),
        // QA tools
        createLintRepoTool(context.configLoader),
        createSyncDocsTool(context.phaseManager),
        createCheckComplianceTool(context.phaseManager),
        // Environment tools
        createEnvMapTool(context.phaseManager),
        createGenerateCiTool(context.phaseManager),
        createSecretsTemplateTool(context.phaseManager),
      ];
    }
  • Dispatcher in handleToolCall that routes 'overseer.run_phase' calls to the handleRunPhase function.
    export async function handleToolCall(
      name: string,
      args: any,
      context: ToolContext
    ): Promise<any> {
      switch (name) {
        // Planning tools
        case 'overseer.plan_project':
          return await handlePlanProject(args, context.phaseManager);
        case 'overseer.infer_phases':
          return await handleInferPhases(args, context.configLoader);
        case 'overseer.update_phases':
          return await handleUpdatePhases(args, context.phaseManager);
        // Execution tools
        case 'overseer.run_phase':
          return await handleRunPhase(args, context.phaseManager);
        case 'overseer.advance_phase':
          return await handleAdvancePhase(args, context.phaseManager);
        case 'overseer.status':
          return await handleStatus(args, context.phaseManager);
        // QA tools
        case 'overseer.lint_repo':
          return await handleLintRepo(args, context.configLoader);
        case 'overseer.sync_docs':
          return await handleSyncDocs(args, context.phaseManager);
        case 'overseer.check_compliance':
          return await handleCheckCompliance(args, context.phaseManager);
        // Environment tools
        case 'overseer.env_map':
          return await handleEnvMap(args, context.phaseManager);
        case 'overseer.generate_ci':
          return await handleGenerateCi(args, context.phaseManager);
        case 'overseer.secrets_template':
          return await handleSecretsTemplate(args, context.phaseManager);
        default:
          throw new Error(`Unknown tool: ${name}`);
      }
    }
  • Supporting helper functions for task checking, file stubbing, checklist updates, etc.
    }
    
    function checkTaskCompletion(
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions reading files, checking status, and creating files/TODOs, which implies mutation and file system operations, but doesn't specify permissions needed, side effects, error handling, or output format. This is inadequate for a tool that modifies files and creates stubs.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, well-structured sentence that efficiently conveys the tool's purpose and key actions without unnecessary words. It's front-loaded with the main action and follows with implementation details, making it easy for an agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (executing phases with file operations) and lack of annotations or output schema, the description is incomplete. It covers the high-level process but omits critical details like what the output looks like, error conditions, or how it interacts with sibling tools. This leaves gaps for an agent to operate effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description doesn't add any meaning beyond what the schema provides (e.g., it doesn't explain how 'aggression_level' affects file creation or what 'phase_id' corresponds to in practice). Baseline 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Execute a specific phase of a project') and the mechanism ('Reads tasks from PHASE-XX.md, checks completion status, and creates TODOs/stubs for incomplete tasks'). It distinguishes this tool from siblings like 'overseer.advance_phase' or 'overseer.status' by focusing on execution rather than planning or checking.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage when needing to run a project phase with task management, but it doesn't explicitly state when to use this tool versus alternatives like 'overseer.advance_phase' or 'overseer.update_phases'. No exclusions or prerequisites are mentioned, leaving some ambiguity for the agent.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/freqkflag/PROJECT-OVERSEER-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server