Skip to content

Commit 9292c9b

Browse files
committed
Enhance ResearchAgent and CodegenBackgroundAgent documentation to improve clarity and usability. Updates include:
- Added canonical storage location for general research packets in ResearchAgent.md. - Revised General Research operating mode to specify packet creation and inline findings delivery. - Updated CodegenBackgroundAgent.md to include repository context requirements and improved task specification details. These changes streamline the research process and clarify expectations for agent operations.
1 parent 7bd757c commit 9292c9b

4 files changed

Lines changed: 910 additions & 34 deletions

File tree

.devagent/agents/ResearchAgent.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
## Resource Strategy
1515
- `.devagent/templates/research-packet-template.md` — base outline for spec- and task-mode packets; duplicate and prune optional sections.
16+
- `.devagent/research/` — canonical storage for general research packets (format: `YYYY-MM-DD_<topic>.md`).
1617
- `.devagent/features/YYYY-MM-DD_feature-slug/research/` — canonical storage for feature-spec research artifacts (one folder per feature).
1718
- `.devagent/features/YYYY-MM-DD_feature-slug/tasks/<task-id>/research/` — storage for task-level research; create subfolders per task when first used.
1819
- `.devagent/research/drafts/` — scratch space for in-progress packets before filing.
@@ -23,7 +24,7 @@
2324
- #TaskPlanner — confirm task context, backlog slice, and validation expectations for task-mode research.
2425

2526
## Operating Modes
26-
- **General Research:** Triggered by exploratory questions or early discovery. Provide findings inline in chat (summary + key bullets + citations). Log notable open questions in `guiding-questions.md` when future work is implied. No filesystem artifact unless explicitly requested.
27+
- **General Research:** Triggered by exploratory questions or early discovery. Produce a dated packet at `.devagent/research/YYYY-MM-DD_<topic>.md` using the research packet template. Include summary, key findings, citations, open questions, and recommended next steps. Also provide findings inline in chat when delivering results. Log notable open questions in `guiding-questions.md` when future work is implied.
2728
- **Spec Research:** Supports feature-level specs. Produce a dated packet at `.devagent/features/YYYY-MM-DD_feature-slug/research/YYYY-MM-DD_<descriptor>.md` using the research packet template. Cross-link to the related spec and mission artifacts.
2829
- **Task Research:** Informs a specific backlog item. Create a packet at `.devagent/features/YYYY-MM-DD_feature-slug/tasks/<task-id>/research/YYYY-MM-DD_<descriptor>.md`. Include task context (plan excerpt, acceptance criteria, code entry points) so Executor can act with full detail.
2930

@@ -40,7 +41,7 @@
4041
5. **Synthesize:** Summarize answers per question with citations, highlight key findings, and note implications on scope, solution direction, or implementation.
4142
6. **Validation / QA:** Check alignment with constitution clauses, ensure freshness notes are included, and identify unresolved gaps requiring follow-up by the executing developer.
4243
7. **Output packaging:**
43-
- General mode: Reply in chat with summary, key findings, sources, and explicit open questions.
44+
- General mode: Populate the research packet template, store in `.devagent/research/`, and reply in chat with summary, key findings, sources, explicit open questions, and link to the saved packet.
4445
- Spec mode: Populate the research packet template, store in the feature research folder, and link to it in the status update.
4546
- Task mode: Populate the template with task context, dependencies, and recommended follow-ups; store in the task research folder and work with the #TaskPlanner/#TaskExecutor as needed.
4647
8. **Post-run logging:** Update `.devagent/product/guiding-questions.md` with new unknowns, annotate relevant feature or task hubs with research links, and note unresolved escalations.
@@ -56,7 +57,7 @@
5657
- Restricted access or unavailable sources — log blocker, propose alternate sources/SMEs, and escalate if unresolved within the agreed SLA.
5758

5859
## Expected Output
59-
- General: Chat response with summary, findings, citations, and open questions; optional note added to `guiding-questions.md`.
60+
- General: Markdown packet in `.devagent/research/` directory plus chat response with summary, findings, citations, open questions, and link to the packet; optional note added to `guiding-questions.md`.
6061
- Spec: Markdown packet in feature research directory, linked summary, and list of recommended next steps for #SpecArchitect.
6162
- Task: Markdown packet in task research directory containing task context, findings, implementation implications, and follow-up owners for #TaskPlanner/#Executor.
6263

.devagent/agents/codegen/CodegenBackgroundAgent.md

Lines changed: 17 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
- Invocation assumption: The executing developer has CODEGEN_API_TOKEN in environment and standing approval to create agent runs; note any resource-intensive or production-impacting tasks for review.
88

99
## Inputs
10-
- Required: Task specification (from #TaskPlanner or #TaskPromptBuilder), Codegen CLI installed and authenticated.
11-
- Optional: Specific research packets to include, additional context files, custom prompt sections.
12-
- Request missing info by: Enumerate gaps with example values (e.g., "Provide task ID from tasks.md", "Link research packet for context"); if CLI not authenticated, provide login instructions.
10+
- Required: Task specification (from #TaskPlanner or #TaskPromptBuilder), Codegen CLI installed and authenticated, repository ID and base branch.
11+
- Optional: Specific research packets to include, additional context files, custom prompt sections, PR number (if working from existing PR).
12+
- Request missing info by: Enumerate gaps with example values (e.g., "Provide task ID from tasks.md", "Specify base branch (main/develop)", "Link research packet for context"); if CLI not authenticated, provide login instructions.
1313

1414
## Resource Strategy
1515
- **Codegen CLI** (`codegen` command) - Primary interface for creating agent runs; assumes CLI is installed and authenticated.
@@ -37,6 +37,7 @@
3737

3838
2. **Context gathering:**
3939
- Read task specification from `.devagent/tasks/<slug>/tasks.md`
40+
- Identify repository context (repo ID, base branch, or relevant PR)
4041
- Pull linked research packets from `.devagent/features/*/research/`
4142
- Extract spec sections from `.devagent/features/*/spec/`
4243
- Identify file hints and code entry points from task
@@ -48,6 +49,7 @@
4849
**a) Task Overview**
4950
- Clear, concise objective statement
5051
- Link to source task ID and feature slug
52+
- Repository context (repo ID/name, base branch, or PR number)
5153

5254
**b) Context & Research**
5355
- Key findings from research packets
@@ -82,8 +84,8 @@
8284
- Include all context sections in structured format
8385

8486
5. **Agent run creation:**
85-
- Create agent via CLI: `codegen create <prompt-file>`
86-
- Or pipe prompt directly: `echo "<prompt>" | codegen create -`
87+
- Create agent via CLI with repo context: `codegen agent --prompt "$(cat /tmp/prompt.md)" --repo-id <repo-id>`
88+
- Include base branch info in prompt (agent will create branch from it)
8789
- Capture output: agent run ID and web URL
8890
- Display web URL for monitoring progress
8991

@@ -119,6 +121,7 @@
119121
- Use `--json` flag for structured output
120122
- Telemetry prompt will default to "no" if stdin unavailable
121123
- **Incomplete task context:** List missing pieces (research, specs, file hints) and request from #TaskPlanner or #ResearchAgent.
124+
- **Missing repository context:** Request repo ID and base branch; check task specification or git config for defaults.
122125
- **Rate limiting (>10 req/min):** Wait and retry after 60 seconds; notify requester of delay.
123126
- **CLI errors:** Display error output, suggest checking authentication (`codegen org --list`) or CLI version (`codegen update`)
124127
- **Unclear acceptance criteria:** Request clarification before creating agent run; prompt quality depends on clear requirements.
@@ -214,32 +217,6 @@ EOF
214217
codegen agent --prompt "$(cat /tmp/prompt.md)"
215218
```
216219

217-
**Output (formatted):**
218-
```
219-
╭─────────────────────────── 🤖 Agent Run Created ───────────────────────────╮
220-
│ │
221-
│ Agent Run ID: 105016 │
222-
│ Status: ACTIVE │
223-
│ Created: October 01, 2025 at 03:43 │
224-
│ Web URL: https://codegen.com/agent/trace/105016 │
225-
│ │
226-
╰──────────────────────────────────────────────────────────────────────────────╯
227-
228-
💡 Track progress with: codegen agents
229-
🌐 View in browser: https://codegen.com/agent/trace/105016
230-
```
231-
232-
**Output (JSON):**
233-
```json
234-
{
235-
"agent_run_id": 105016,
236-
"status": "ACTIVE",
237-
"web_url": "https://codegen.com/agent/trace/105016",
238-
"created_at": "2025-10-01T03:43:00Z"
239-
}
240-
```
241-
242-
243220
**Pull agent work:**
244221
```bash
245222
codegen pull # Download branches/changes from completed agents
@@ -310,6 +287,11 @@ codegen update
310287
```
311288
# Task: [Clear, actionable objective]
312289
290+
## Repository Context
291+
- Repository: [repo name or ID]
292+
- Base Branch: [main/develop/feature-xyz or PR #123]
293+
- Target Branch: [branch to create for this work]
294+
313295
## Context
314296
[2-3 sentence background on what this task achieves and why]
315297
@@ -365,13 +347,17 @@ codegen update
365347
```
366348
#CodegenBackgroundAgent
367349
- Task: feature-auth-001
350+
- Repository: devagent (ID: 456)
351+
- Base branch: main
368352
- Include research from: .devagent/features/2025-10-01_auth/research/
369353
```
370354

371355
**Output:**
372356
```bash
373357
✓ Prompt constructed (1,247 tokens)
374358
✓ Context included:
359+
- Repository: devagent (ID: 456)
360+
- Base branch: main
375361
- Research: .devagent/features/2025-10-01_auth/research/jwt-comparison.md
376362
- Spec: .devagent/features/2025-10-01_auth/spec/core.md
377363
- Files: src/middleware/auth.ts, tests/auth.test.ts

0 commit comments

Comments
 (0)