feat(task-018): add role-based context selection
This commit is contained in:
@@ -109,7 +109,7 @@ def update_task_status(root: Path, task_id: str, new_status: str) -> bool:
|
||||
return False
|
||||
|
||||
|
||||
CONTEXT_FILES_TO_READ = [
|
||||
DEFAULT_CONTEXT_FILES = [
|
||||
"README.md",
|
||||
"TASKS.md",
|
||||
"PROJECT_STATE.md",
|
||||
@@ -117,6 +117,38 @@ CONTEXT_FILES_TO_READ = [
|
||||
"context/agent-guidelines.md",
|
||||
]
|
||||
|
||||
ROLE_CONTEXT_FILES: dict[str, list[str]] = {
|
||||
"Architecture Agent": [
|
||||
"README.md",
|
||||
"TASKS.md",
|
||||
"PROJECT_STATE.md",
|
||||
"context/architecture.md",
|
||||
"context/product-brief.md",
|
||||
"context/decisions.md",
|
||||
],
|
||||
"Implementation Agent": [
|
||||
"README.md",
|
||||
"TASKS.md",
|
||||
"PROJECT_STATE.md",
|
||||
"AGENT_HANDOFF.md",
|
||||
"context/agent-guidelines.md",
|
||||
"CLAUDE.md",
|
||||
],
|
||||
"Documentation Agent": [
|
||||
"README.md",
|
||||
"TASKS.md",
|
||||
"PROJECT_STATE.md",
|
||||
"AGENT_HANDOFF.md",
|
||||
"context/agent-guidelines.md",
|
||||
"TEST_PLAN.md",
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
def _context_files_for_role(role: str) -> list[str]:
|
||||
"""Return the context file list for a given role, falling back to default."""
|
||||
return ROLE_CONTEXT_FILES.get(role, DEFAULT_CONTEXT_FILES)
|
||||
|
||||
TEST_CMD_SECTION_RE = re.compile(
|
||||
r"^##\s*Test Commands\s*\n([\s\S]*?)(?=^##|\Z)",
|
||||
re.MULTILINE,
|
||||
@@ -186,6 +218,7 @@ def generate_agent_prompt(root: Path) -> str:
|
||||
return "No Todo task found."
|
||||
|
||||
role_text, article = task.role(root)
|
||||
context_files = _context_files_for_role(role_text)
|
||||
|
||||
sections = [
|
||||
f"You are {article} {role_text.lower()}.",
|
||||
@@ -194,13 +227,15 @@ def generate_agent_prompt(root: Path) -> str:
|
||||
"",
|
||||
"# Read these files first",
|
||||
"",
|
||||
f"""- README.md
|
||||
- TASKS.md
|
||||
- PROJECT_STATE.md
|
||||
- AGENT_HANDOFF.md""",
|
||||
"",
|
||||
"- context/agent-guidelines.md",
|
||||
"",
|
||||
]
|
||||
for i, f in enumerate(context_files):
|
||||
line = f"- {f}"
|
||||
if i == len(context_files) - 1:
|
||||
sections.append(line)
|
||||
else:
|
||||
sections.append(line)
|
||||
|
||||
sections.extend([
|
||||
"---",
|
||||
"",
|
||||
"# Task",
|
||||
@@ -210,7 +245,7 @@ def generate_agent_prompt(root: Path) -> str:
|
||||
f"Status: {task.status}",
|
||||
"",
|
||||
f"Goal:\n{task.goal(root)}",
|
||||
]
|
||||
])
|
||||
|
||||
gap = task.implementation_gap(root)
|
||||
if gap:
|
||||
|
||||
Reference in New Issue
Block a user