feat(agents): add system prompt option when creating agents#215
Conversation
Add optional system_prompt parameter to agent creation in both CLI and API. When provided, the system prompt is written to AGENTS.md in the agent's workspace during provisioning, allowing agents to be configured with custom instructions at creation time. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR adds an optional Key changes:
Issues found:
Confidence Score: 3/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Client
participant API as PUT /api/agents/:id
participant Settings as settings.json
participant FS as AGENTS.md (filesystem)
Client->>API: PUT /api/agents/coder {system_prompt: "..."}
alt Agent is NEW (isNew = true)
API->>Settings: mutateSettings — saves system_prompt ✅
API->>FS: ensureAgentDirectory() — creates empty AGENTS.md
API->>FS: writeFileSync(AGENTS.md, system_prompt) ✅
API-->>Client: {ok: true, provisioned: true}
else Agent ALREADY EXISTS (isNew = false)
API->>Settings: mutateSettings — saves system_prompt ✅
Note over FS: AGENTS.md NOT updated ⚠️
API-->>Client: {ok: true, provisioned: false}
end
Client->>API: GET /api/agents/coder/system-prompt
API->>FS: readFileSync(AGENTS.md)
Note over API,FS: Returns stale value for existing agents
API-->>Client: {content: "old prompt"} ⚠️
|
Strip system_prompt from settings.json persistence to prevent stale values. Write AGENTS.md on both new and existing agent PUT requests. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Description
Add optional system_prompt parameter to agent creation in both CLI and API. When provided, the system prompt is written to AGENTS.md in the agent's workspace during provisioning, allowing agents to be configured with custom instructions at creation time.
Changes
agentAdd()workflowsystem_promptin PUT request body and write to AGENTS.md if providedTesting