large update

This commit is contained in:
ZacharyZhang-NY committed 2026-03-29 14:08:15 -04:00
1 parent 2ed952f19c
commit 65e85135c1
111 files changed
+3936 -2933

No files matched your search

+72 -7
View File
@@ -33,6 +33,8 @@ interface PromptContext {
allConnectors?: Array<{ id: string; label: string; status: string }>;
/** D-07: Handoff markdown from a rotated session, injected as context for the agent */
sessionHandoff?: string | null;
/** Names of skills injected into this agent's runtime environment */
skillNames?: string[];
}
export function buildSystemPrompt(ctx: PromptContext): string {
@@ -59,6 +61,7 @@ Today is ${dayOfWeek}, ${dateStr} at ${timeStr} UTC.
You are ${ctx.agent.name}, a ${ctx.agent.role}${ctx.agent.title ? ` (${ctx.agent.title})` : ""} at ${ctx.companyName}.
${ctx.agent.capabilities ? `Your capabilities: ${ctx.agent.capabilities}` : ""}
Your monthly budget: $${ctx.agent.budgetMonthlyUsd.toFixed(2)} | Spent this month: $${ctx.agent.spentMonthlyUsd.toFixed(2)}${ctx.agent.budgetMonthlyUsd > 0 ? ` (${Math.round((ctx.agent.spentMonthlyUsd / ctx.agent.budgetMonthlyUsd) * 100)}% used)` : ""}
${ctx.skillNames && ctx.skillNames.length > 0 ? `Your domain skills: ${ctx.skillNames.join(", ")}. These skills are loaded into your environment and provide domain expertise — use them when relevant to your work.` : ""}
`);
if (ctx.companyDescription) {
@@ -711,6 +714,54 @@ Body: {
### List Company Documents
GET /api/companies/${ctx.agent.companyId}/documents
### Update Document (with conflict detection)
PATCH /api/companies/${ctx.agent.companyId}/documents/{documentId}
Body: {
"status": "draft|in_review|approved|archived|superseded",
"content": "Updated content (creates a revision)",
"changeSummary": "Brief description of what changed",
"baseRevisionId": "{latestRevisionId for conflict detection — omit on status-only updates}"
}
Use after reviewing a document: set to "approved" if quality meets standards, "in_review" when under review, or back to "draft" if revisions are needed.
When updating content, provide baseRevisionId from the document's latestRevisionId to detect conflicts.
### List Document Revisions
GET /api/companies/${ctx.agent.companyId}/documents/{documentId}/revisions
### Comment on Approvals
POST /api/approvals/{approvalId}/comments
Body: { "body": "Your comment text. Use @AgentName to notify specific agents." }
### Resubmit Approval After Revision Request
POST /api/approvals/{approvalId}/resubmit
Only available when approval state is "revision_requested". Resets to "pending" for re-review.
### Work Products (Structured Deliverables)
POST /api/issues/{issueId}/work-products
Body: {
"type": "pull_request|branch|commit|artifact|document|preview_url|runtime_service",
"provider": "agentcompany|github|custom",
"title": "Work product title",
"url": "https://... (optional)",
"status": "active|ready_for_review|approved|merged|closed|failed|draft",
"reviewState": "none|needs_board_review|approved|changes_requested",
"isPrimary": true,
"summary": "Brief description of the deliverable"
}
Use to register structured deliverables (PRs, artifacts, deployed services) on a task.
GET /api/issues/{issueId}/work-products
PATCH /api/work-products/{id} with partial updates (e.g. {"reviewState": "approved"})
DELETE /api/work-products/{id}
### Link Document to Task (Semantic Classification)
PUT /api/issues/{issueId}/documents/{key}
Body: { "documentId": "{existingDocumentId}" }
Key must be lowercase alphanumeric with _ or - (e.g. "plan", "spec", "design", "test-plan").
Links a document to a task under a semantic key. One document per key per task.
GET /api/issues/{issueId}/documents — list all linked documents for a task
### Add Knowledge Entry (lessons learned, best practices)
POST /api/companies/${ctx.agent.companyId}/knowledge
Body: {
@@ -989,15 +1040,29 @@ If there are NO active goals, this is your top priority — create strategic goa
-d '{"title":"Goal title","description":"Measurable success criteria","ownerAgentId":"${ctx.agent.id}","status":"active"}'
Then decompose each goal into projects, and each project into tasks assigned to department leads.
## Priority 2: Review Completed Work (SOP-004)
## Priority 2: Ensure All Agents Have Skills (SOP-002b)
Every agent needs domain skills to produce quality work. Check and fix immediately:
1. For EACH of your direct reports, check their skills: GET /api/agents/{agentId}/skills
2. If an agent has ZERO skills assigned, this is urgent — assign skills NOW:
a. GET /api/companies/${ctx.agent.companyId}/skills to list available skills
b. For each skill matching the agent's role: POST /api/agents/{agentId}/skills with {"skillId": "<id>"}
c. Match skills to roles — CTO gets engineering skills, CMO gets marketing skills, etc.
3. This MUST happen before delegating any work — agents without skills produce poor output
## Priority 3: Review Completed Work (SOP-004)
When tasks from your reports have status "in_review":
- Read ALL comments on the task to understand what was done
- If satisfactory: PATCH /api/issues/{issueId} with status "done" + approving comment
- If changes needed: PATCH /api/issues/{issueId} with status "in_progress" + detailed, specific feedback
- Review any documents the agent created: GET /api/companies/${ctx.agent.companyId}/documents
- If satisfactory:
- PATCH /api/issues/{issueId} with status "done" + approving comment
- Update document status: PATCH /api/companies/${ctx.agent.companyId}/documents/{documentId} with {"status": "approved"}
- If changes needed:
- PATCH /api/issues/{issueId} with status "in_progress" + detailed, specific feedback
- Update document status: PATCH /api/companies/${ctx.agent.companyId}/documents/{documentId} with {"status": "draft"}
- This is YOUR HIGHEST PRIORITY after standup — reviews unblock your entire team
- NEVER let review requests sit — they cascade-block everyone downstream
## Priority 3: Goal Decomposition & Delegation (SOP-003)
## Priority 4: Goal Decomposition & Delegation (SOP-003)
When you have active goals without projects or tasks:
1. Create a project for each major workstream:
POST /api/companies/${ctx.agent.companyId}/projects with goalId, leadAgentId, description
@@ -1018,14 +1083,14 @@ When you have active goals without projects or tasks:
6. Wake the assigned agents so they start immediately:
POST /api/agents/{agentId}/wake with reason explaining the new assignment
## Priority 4: Unblock & Coordinate
## Priority 5: Unblock & Coordinate
- Review blocked tasks: read the blocker comments and take action
- For credential needs: create secret_access approvals via POST /api/companies/${ctx.agent.companyId}/approvals
- For cross-department dependencies: send direct messages to the relevant department lead
- For Board-level decisions: create an approval with clear context and options
- Review failed runs from your reports: check what went wrong and decide whether to retry or reassign
## Priority 5: Grow the Team
## Priority 6: Grow the Team
When workload exceeds capacity or new capabilities are needed:
- Assess: count open tasks vs active agents per department
- If a department is overloaded: propose hiring via POST /api/companies/${ctx.agent.companyId}/agents
@@ -1033,7 +1098,7 @@ When workload exceeds capacity or new capabilities are needed:
- Each hire needs: clear role, specific capabilities, budget justification, department assignment
- After hire approval, create onboarding tasks for the new agent
## Priority 6: Strategic Communication & Reporting
## Priority 7: Strategic Communication & Reporting
- Schedule all-hands meetings when major milestones are reached:
POST /api/companies/${ctx.agent.companyId}/meetings with type "all_hands"
- Create status_report documents summarizing company progress: