feat(task-023): improve generated context quality

This commit is contained in:
2026-06-04 09:42:05 +01:00
parent c72ad6995e
commit 152096d433
9 changed files with 191 additions and 17 deletions
+9 -5
View File
@@ -27,6 +27,8 @@ CONTEXT_MAP = {
],
"Q-002": [ # Who is the user?
("context/product-brief.md", "## Users", "body"),
("context/company-context.md", "## Customers / Users", "body"),
("context/company-context.md", "## Key Stakeholders", "body"),
("context/development-context.md", "## IDEs and Editors", "body"),
],
"Q-003": [ # What does success look like?
@@ -53,7 +55,7 @@ CONTEXT_MAP = {
],
"Q-009": [ # How will we test it?
("context/development-context.md", "## Build & Test", "body"),
("context/project-brief.md", "## Timeline & Milestones", "body"),
("context/agent-guidelines.md", "## Testing Preferences", "append"),
],
"Q-010": [ # How will it be deployed?
("context/architecture.md", "## Deployment Architecture", "body"),
@@ -61,11 +63,13 @@ CONTEXT_MAP = {
],
"Q-011": [ # Who owns and directs the project, and what are its organisational goals?
("context/company-context.md", "## Mission", "body"),
("context/company-context.md", "## Products & Services", "body"),
("context/project-brief.md", "## Target Audience", "body"),
],
"Q-012": [ # What is the technology stack, repository structure, and architecture approach?
("context/development-context.md", "## Tech Stack", "body"),
("context/development-context.md", "## Coding Standards", "body"),
("context/repository-context.md", "## Dependencies", "body"),
("context/architecture.md", "## Overview", "body"),
("context/architecture.md", "## Core Components", "body"),
],
@@ -140,7 +144,7 @@ def _write_section(root, file_path, section_name, format_type, answer, rules):
if format_type == "table":
_write_table_row(target, section_name, answer)
elif format_type == "append":
_append_new_section(target, answer, rules)
_append_new_section(target, answer, rules, file_path)
else:
# body text type
existing = target.read_text(encoding="utf-8") if target.exists() else ""
@@ -245,13 +249,13 @@ def _write_table_row(target, section_header, answer):
target.write_text(existing + "\n" + row, encoding="utf-8")
def _append_new_section(target, answer, rules):
def _append_new_section(target, answer, rules, file_path):
"""Append a new section to the end of an existing file."""
existing = target.read_text(encoding="utf-8") if target.exists() else ""
display_name = None
for _, sec, _ in rules:
if sec and sec.startswith("## "):
for fpath, sec, _ in rules:
if fpath == file_path and sec and sec.startswith("## "):
display_name = sec
break
if not display_name:
+9 -5
View File
@@ -156,7 +156,7 @@ TBD — How to build, test, and run the codebase locally.
## Dependencies
TDB — External services, databases, and third-party APIs required.
TBD — External services, databases, and third-party APIs required.
""",
"context/infrastructure-context.md": """# Infrastructure Context
@@ -178,7 +178,7 @@ TBD — Tools used for monitoring, logging, and alerting.
## Security
TDB — Authentication, data protection, and access control measures.
TBD — Authentication, data protection, and access control measures.
""",
"context/agent-guidelines.md": """# Agent Guidelines
@@ -188,7 +188,11 @@ TBD — What should agents know about working with this project?
## Preferred Tools
TDB — Recommended editors, debuggers, testing frameworks, and CLI tools.
TBD — Recommended editors, debuggers, testing frameworks, and CLI tools.
## Testing Preferences
TBD — How the team prefers tests to be written, run, and verified.
## Common Tasks
@@ -206,7 +210,7 @@ TBD — What problem does this project solve?
## Target Audience
TDB — Who is the intended audience?
TBD — Who is the intended audience?
## Key Features (MVP)
@@ -232,7 +236,7 @@ TBD — Key modules, services, and their responsibilities.
## Data Flow
TDB — How data moves through the system (APIs, queues, databases).
TBD — How data moves through the system (APIs, queues, databases).
## External Integrations