S209 Agent Prompt
Documentation for Sessions
S209 Agent Prompt
Copy everything below this line and paste it as the first message to the agent.
Session 209: Agent Lifecycle E2E + Command Center + Intelligence Wiring
Adopt a senior engineer mindset. Prioritize correctness and clarity over politeness. Be candid and specific: call out risks, gaps, and weak designs, but avoid nitpicking. Propose solutions that are practical, high-quality, and easy to operate. Use strong logic and sound business judgment. Be inventive where it creates real leverage. Do not guess or invent facts; if uncertain, state assumptions and what to verify. Be genuinely critical — don't soften feedback to be polite. What are the real weaknesses? What edge cases might I be missing? But also tell me if something is actually fine. Make sure you constantly leverage our codebase's infrastructure, including our mcp-gograb-ai's tools.
MCP Workflow (MANDATORY)
Before ANY implementation work:
preflight({ task: "S209 agent lifecycle + command center", sessionNumber: 209 })find_similar({ query: "agent training pipeline sub-agent execution" })for past decisionsconvention({ action: "get" })for current conventions
For every non-trivial decision:
intelligence({ action: "simulate", simulateAction: "...", context: "...", alternatives: [...] })if multiple approaches existintelligence({ action: "calibrate", rawConfidence: X, domain: "..." })— only proceed if calibrated >= 0.9log_decision({ type, question, chosen, reasoning, confidence, files })immediately after deciding
After each phase completes:
outcome({ action: "report", decisionId: "...", wasSuccessful: true/false, feedback: "..." })intelligence({ action: "reflect", taskSummary: "...", outcome: "...", lessonsLearned: [...] })for complex phases
Context: What S208 Built (DO NOT re-research — this is authoritative)
App reorganization (DONE):
- Top nav:
Home | Operations | Command | Vitto /operations— 5 tabs: Agents, System, Sandbox, Failures, Specialization (OperationsPanelComponent)/command— 5 tabs: Mission Control, Approvals, Audit, Trust, Costs (CommandPanelComponent)- 10 backward-compat redirects from
/observatory/* - Vitto sidebar: 6 groups (Mind, Identity, Capabilities, Connections, Developer, Settings)
- Key files:
apps/gograb-ai/src/app/app.routes.ts,app.component.html,vitto-unified-shell.component.ts
Metacognition (DONE but UNTESTED):
/vitto/conscience— user-specific SSE inner monologue (VittoConscienceComponent + VittoConscienceService)/vitto/introspection— admin global SSE god-view (VittoIntrospectionComponent + VittoIntrospectionService)- Backend:
VittoNarrativeServiceemits conscience/introspection events, wired into VittoEngineService SSE stream - New SSE endpoint:
@Sse('events/conscience/:userId')on VittoController - Emission points: ContextAssemblyService (context + dossier), SkillRetrievalService (skills), VittoEngineService (queue)
- Types:
ConscienceEventType+IntrospectionEventTypeinvitto.types.ts
libs-ai cleanup (DONE):
- Removed 10 dead directories (~20K lines), 8 stale tsconfig paths
- Kept active aliases: @libs-ai/module-patterns, @libs-ai/outcome-tracker → ai-module-intelligence
Agent pipeline status (60% built — THIS IS WHAT S209 COMPLETES):
| Component | Status | File |
|---|---|---|
| Agent Seeding (4 system agents) | WORKING | backend-vitto-api/.../engine/agent-seed.service.ts |
| Agent Definitions CRUD | WORKING | backend-vitto-api/.../engine/sub-agent.service.ts |
| Decision Capture (12K+) | WORKING | backend-ai-api/.../command-center/ |
| Context Injection (patterns→prompts) | WORKING | backend-vitto-api/.../engine/sub-agent.service.ts:buildSystemPrompt() |
| Command Center WebSocket (30+ events) | WORKING but OFFLINE in UI | backend-ai-api/.../command-center/command-center.gateway.ts |
| Training Pipeline | STUB — mock OpenAI calls | backend-ai-api/.../platform-ai/services/training-pipeline.service.ts:122-150 |
| Platform Intelligence UI | HARDCODED — shows 0% success | @libs-ai/ai-agents-training-center training-center.component.ts |
| Sub-Agent Self-Execution | MISSING | backend-vitto-api/.../engine/sub-agent.service.ts |
Your 6 Phases (in execution order)
Phase 1: Fix Command Center OFFLINE (15 min)
libs/libs-ai/ai-command-panel/src/lib/services/command-center-client.service.tsline ~443- Problem: injects
API_BASE_URL(port 3000) but WebSocket gateway is on backend-ai-api (port 3001) - Fix: change to
AI_API_URLfrom@libs-foundational/api-config - Validate: browser DevTools → Network → WebSocket should connect to
ws://localhost:3001/command-center
Phase 2: Fix Platform Intelligence hardcoded values (1-2 hrs)
- Training center component hardcodes
status: 'training',successRate: 0 - Replace with real data from
GET /vitto-api/engine/definitions(VITTO_API_URL, port 3003) - Agent definitions have
performance.avgQualityScore,performance.successfulExecutions,performance.totalExecutions,status
Phase 3: Verify conscience + introspection work E2E (1-2 hrs)
- Start backend-vitto-api (port 3003) + gograb-ai (port 6400)
- Navigate to
/vitto/conscience, verify SSE connects to/engine/events/conscience/{userId} - Send a chat message, verify narrative events appear
- Check
/vitto/introspectionshows global events (admin-only) - Fix any CORS, connection, or rendering issues found
Phase 4: Replace mock training with few-shot injection (2-3 hrs)
backend-ai-api/.../platform-ai/services/training-pipeline.service.tslines 122-150 = TODO mock- Option B (recommended): few-shot prompt injection. Already partially works —
SubAgentService.buildSystemPrompt()injects last 10 training examples. The "Train" button just needs to validate examples, mark as active, updatelastTrainedAt TrainingDataServiceatbackend-ai-api/.../platform-ai/services/training-data.service.tshandles data access- Option A (future): real OpenAI fine-tuning via
POST /v1/fine_tuning/jobs(OPENAI_API_KEY already in env)
Phase 5: Migrate key pages from gograb-dev to gograb-ai (2-3 hrs)
/intelligence/memory-map→/vitto/memory-visualization(VisualMemoryMapComponent from @libs-ai/gograb-ai-lib)/intelligence/pyramid→ part of/vitto/intelligence(IntelligencePyramidComponent)/intelligence/mesh→/operations/agent-topology(AgentMeshVisualizationComponent)/agents/knowledge→/vitto/learning(AgentKnowledgeViewerComponent from @libs-ai/ai-agent-knowledge)- Add routes to
vitto-hub.routes.ts(VittoUnifiedChildRoutes) andapp.routes.ts - Add sidebar items to
vitto-unified-shell.component.ts
Phase 6: Wire sub-agent self-execution (4-6 hrs)
backend-vitto-api/.../engine/sub-agent.service.ts— addexecuteTask()method- Use
ProviderFactoryfrombackend-vitto-api/.../llm/to get LLM provider - Call provider with sub-agent's system prompt (built by existing
buildSystemPrompt()) - Wire
CostGuardfor per-execution budget enforcement - Track execution metrics: update agent's
performance.totalExecutions,performance.successfulExecutions - Sub-agents should NOT have file system tools — only: recall_memory, search_decisions, query_docs, http_request
- Delegate file operations via
DelegationManagerService(handoff to external agents)
Port Reference (CRITICAL — wrong port = silent 404)
| Token | Import | Port | Use For |
|---|---|---|---|
API_BASE_URL |
@libs-foundational/core-angular |
3000 | Users, auth, CRUD |
AI_API_URL |
@libs-foundational/api-config |
3001 | Chat, AI, Command Center WebSocket |
DOCS_API_URL |
@libs-foundational/api-config |
3002 | Documentation |
VITTO_API_URL |
@libs-foundational/api-config |
3003 | Vitto engine, SSE, agent definitions |
Code Standards (enforced)
| Rule | Standard |
|---|---|
| Components | Angular 20+, standalone, OnPush, inject() |
| State | Signals (local) → RxJS (async) → NGXS (global only) |
| Async | RxJS Observables ONLY — no Promises, no setTimeout |
| Files | Separate .ts, .html, .scss — no inline |
| Types | In models/ directory — never locally in components |
any |
Use SafeAny only if absolutely necessary |
Git Protocol
- Branch:
session-209 - Commits:
[S209.N] type: description(e.g.,[S209.1] fix: Command Center WebSocket URL) - Stage specific files:
git add <files>— NEVERgit add .
Intelligence v2 Spec (reference, not for this session)
Full spec at docs/superpowers/specs/2026-03-12-vitto-intelligence-v2-design.md covers Skills Closed Loop, Proactive Intelligence, Dossier Enhancement, Golden Path Tests, Cost Improvements. S209 focuses on completing the agent pipeline that this spec depends on.
Documentation created in S208 (read these for deep context if needed)
docs/english/Plans/S209-agent-lifecycle-command-center.plan.md— detailed 6-phase plan with fix stepsdocs/english/Progress/S208-progress-report.md— non-developer progress reportdocs/english/sessions/S208/S208-technical-summary.md— technical deep-dive of S208 changes