AGENT TASK SYSTEM

Comprehensive guidelines for AI-assisted development within the Editor platform

🤖 AI Agent Task System - Activation Guide

CRITICAL: This Document MUST Be Read by AI Assistants

Purpose: This document instructs AI assistants (Claude, Cursor AI, etc.) on how to use GoGrab's AI Agent Task System to create a self-learning, continuously improving AI development experience.


📋 Table of Contents

  1. System Overview
  2. For AI Assistants: How to Use This System
  3. Integration Points
  4. Decision Logging Protocol
  5. Self-Learning Loop
  6. API Reference

System Overview

GoGrab Space has a sophisticated AI Agent Task System that tracks:

Architecture

User Request → Task Created → AI Decomposes → Sessions Execute Steps
                                                      │
                                                      ▼
                                              Log Every Decision
                                                      │
                                                      ▼
                                              User Provides Feedback
                                                      │
                                                      ▼
                                              Training Data Export
                                                      │
                                                      ▼
                                              Model Fine-Tuning → Better AI

Database Location


For AI Assistants: How to Use This System

🚨 MANDATORY PROTOCOL

When working on any significant task in GoGrab Space, AI assistants MUST:

  1. Create a Task at the start of significant work
  2. Start a Session for each work period
  3. Log Decisions for every non-trivial choice
  4. Complete Sessions with handoff notes
  5. Request Feedback after task completion

When to Create a Task

Create a task when the user requests:

When NOT to Create a Task

Skip task creation for:


Integration Points

1. Backend API Endpoints

Base URL: /api/ai-agents

// Create Task
POST /api/ai-agents/tasks
Body: {
  type: 'vibe-coding' | 'content-generation' | 'data-operation' | 'custom',
  goal: string,
  description?: string,
  priority?: 'low' | 'medium' | 'high' | 'critical',
  tags?: string[]
}

// Start Session
POST /api/ai-agents/tasks/:taskId/sessions
Body: {
  agentType: 'initializer' | 'planner' | 'executor' | 'reviewer' | 'specialist',
  specialization?: 'ui' | 'api' | 'database' | 'testing' | 'documentation' | 'security'
}

// Log Decision
POST /api/ai-agents/tasks/:taskId/sessions/:sessionId/decisions
Body: {
  type: 'task-decomposition' | 'implementation-choice' | 'error-recovery' | 'other',
  agentType: string,
  question: string,      // What decision was being made
  options: string[],     // What alternatives were considered
  chosen: string,        // What was selected
  reasoning: string,     // WHY (most important!)
  confidence: number     // 0-1 confidence score
}

// Complete Session
PUT /api/ai-agents/tasks/:taskId/sessions/:sessionId/complete
Body: {
  handoffNotes: string,          // Summary for next session
  nextRecommendations: string[]  // What should be done next
}

2. Frontend Integration

The frontend library @libs-ai/agent-orchestrator provides:

import { AgentApiService, AgentMonitorService } from '@libs-ai/agent-orchestrator';

// In your component/service
private agentApi = inject(AgentApiService);
private agentMonitor = inject(AgentMonitorService);

// Create task
this.agentApi.createTask({
  type: 'vibe-coding',
  goal: 'Build user profile page',
  priority: 'high'
}).subscribe(task => {
  this.currentTaskId = task.id;
});

// Real-time monitoring
this.agentMonitor.connect(userId);
this.agentMonitor.subscribeToTask(taskId).subscribe();
this.agentMonitor.getTaskStatusUpdates(taskId).subscribe(update => {
  // Update UI with progress
});

Decision Logging Protocol

Types of Decisions to Log

Decision Type When to Log Example
task-decomposition Breaking goal into steps "Split 'build auth' into 5 steps"
implementation-choice Choosing approach/library "Use Zod over Yup for validation"
step-selection Choosing next step "Start with API before UI"
error-recovery Handling errors "Retry with different approach"
context-prioritization Choosing what context to include "Focus on auth files, skip tests"
quality-assessment Evaluating work quality "Code meets requirements"

Decision Log Format

{
  type: 'implementation-choice',
  agentType: 'executor',
  question: 'Which state management approach should I use for the user profile?',
  options: [
    'Angular Signals (local state)',
    'RxJS BehaviorSubject',
    'NGXS store',
    'Component input/output'
  ],
  chosen: 'Angular Signals (local state)',
  reasoning: 'User profile is component-local state, not shared across modules. ' +
             'Signals provide simpler reactivity and better performance than RxJS. ' +
             'NGXS would be overkill for non-global state per project guidelines.',
  confidence: 0.9
}

Confidence Score Guidelines

Score Meaning When to Use
0.9-1.0 Very confident Clear best practice, explicit requirement
0.7-0.9 Confident Good solution, some alternatives viable
0.5-0.7 Moderate Multiple valid approaches, made judgment call
0.3-0.5 Uncertain Limited information, best guess
0.0-0.3 Low confidence Experimental, needs review

Self-Learning Loop

How the System Learns

  1. Decision Collection

    • Every AI decision logged with reasoning
    • Stored in agent_decisions collection
    • Indexed by type, confidence, outcome
  2. User Feedback

    • User rates completed tasks (1-5)
    • Records if modifications were made
    • Captures what worked and what didn't
  3. Training Data Export

    POST /api/ai-agents/export
    {
      minQualityRating: 4,    // Only high-quality tasks
      includeDecisions: true,
      format: 'jsonl'
    }
    
  4. Pattern Analysis

    • Identify successful decision patterns
    • Find common failure modes
    • Track which reasoning leads to best outcomes
  5. Model Improvement

    • Export high-confidence, user-approved decisions
    • Use for fine-tuning or prompt engineering
    • Feed back improved patterns to AI instructions

Metrics Dashboard

Access at /api/ai-agents/metrics:

{
  totalTasks: number,
  completedTasks: number,
  averageQualityScore: number,
  topDecisionPatterns: [
    { type: 'implementation-choice', successRate: 0.92 },
    { type: 'error-recovery', successRate: 0.78 }
  ]
}

API Reference

Task Lifecycle

1. CREATE TASK
   POST /api/ai-agents/tasks
   
2. AI DECOMPOSES (auto or manual)
   POST /api/ai-agents/tasks/:id/decomposition
   
3. START SESSION
   POST /api/ai-agents/tasks/:id/sessions
   
4. LOG DECISIONS (multiple)
   POST /api/ai-agents/tasks/:id/sessions/:sessionId/decisions
   
5. COMPLETE SESSION
   PUT /api/ai-agents/tasks/:id/sessions/:sessionId/complete
   
6. REPEAT 3-5 until all steps done
   
7. TASK COMPLETES AUTOMATICALLY
   
8. GET USER FEEDBACK
   POST /api/ai-agents/tasks/:id/feedback

Example: Full Task Flow

// 1. Create task
const task = await api.post('/api/ai-agents/tasks', {
  type: 'vibe-coding',
  goal: 'Create a responsive navigation component',
  priority: 'high'
});

// 2. Start session
const session = await api.post(`/api/ai-agents/tasks/${task.id}/sessions`, {
  agentType: 'executor',
  specialization: 'ui'
});

// 3. Log decisions as you work
await api.post(`/api/ai-agents/tasks/${task.id}/sessions/${session.id}/decisions`, {
  type: 'implementation-choice',
  agentType: 'executor',
  question: 'How should I handle responsive breakpoints?',
  options: ['CSS media queries', 'Tailwind breakpoints', 'BreakpointObserver'],
  chosen: 'BreakpointObserver',
  reasoning: 'Angular Material BreakpointObserver integrates with Angular change detection and allows programmatic response to breakpoints',
  confidence: 0.85
});

// 4. Complete session
await api.put(`/api/ai-agents/tasks/${task.id}/sessions/${session.id}/complete`, {
  handoffNotes: 'Navigation component created with responsive behavior. Mobile menu implemented with slide-in animation.',
  nextRecommendations: [
    'Add keyboard navigation for accessibility',
    'Implement active link highlighting',
    'Add unit tests for breakpoint changes'
  ]
});

Implementation Checklist

To fully activate the AI Agent Task System:

Backend (Complete ✅)

Frontend Library (Complete ✅)

Integration (TODO 🔴)

AI Instructions (In Progress 🟡)


Quick Start for AI Assistants

When starting a coding task:

  1. Announce: "I'm creating an AI task to track this work for learning purposes."

  2. Create Task (mentally or via API if integrated):

    Task: [User's goal]
    Type: vibe-coding
    Priority: [based on urgency]
    
  3. Decompose into steps

  4. For each decision, note:

    • What choice was made
    • What alternatives existed
    • Why this was chosen
    • Confidence level
  5. On completion, summarize:

    • What was accomplished
    • What should be done next
    • Any blockers or concerns
  6. Request feedback: "How would you rate this work? (1-5)"


Last Updated: December 2025 Status: Foundation Complete, Integration Pending