Skip to content

Commit e067fbf

Browse files
suyog19claude
andcommitted
fix: use story description for file keyword scoring, not just title
Title keywords ('landing','caption') may not appear in the target file at all — the file uses 'hero-tag' and 'hero'. Description keywords ('learning','platform') match the actual text string to change and score index.html much higher than login.html or styles.css. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 62d14fb commit e067fbf

2 files changed

Lines changed: 14 additions & 5 deletions

File tree

app/claude_client.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -638,17 +638,20 @@ def summarize_repo(repo_path: str, repo_name: str, analysis: dict) -> str:
638638
return summary
639639

640640

641-
def suggest_change(repo_path: str, analysis: dict, issue_key: str = "", issue_summary: str = "", memory_context: str = "") -> dict:
641+
def suggest_change(repo_path: str, analysis: dict, issue_key: str = "", issue_summary: str = "", issue_description: str = "", memory_context: str = "") -> dict:
642642
"""Ask Claude Sonnet to suggest up to 3 code changes aligned with the Jira story.
643643
644-
Selects files by keyword overlap with the issue summary rather than a fixed entry-point
645-
list, giving Claude context most relevant to the story intent.
644+
Selects files by keyword overlap with the issue summary + description rather than a fixed
645+
entry-point list, giving Claude context most relevant to the story intent.
646646
Returns a dict with keys: changes (list of {file, description, original, replacement}), summary.
647647
"""
648648
client = _CLIENT
649649

650650
primary_language = analysis.get("primary_language", "Python")
651-
selected = _select_files_for_story(repo_path, primary_language, issue_summary)
651+
# Combine title + description for richer keyword extraction — description often contains
652+
# the exact text strings to find/change, which score the right file much more precisely.
653+
keyword_text = f"{issue_summary} {issue_description}".strip()
654+
selected = _select_files_for_story(repo_path, primary_language, keyword_text)
652655

653656
if not selected:
654657
return {

app/workflows.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1150,7 +1150,13 @@ def story_implementation(run_id: int, issue_key: str, issue_type: str, summary:
11501150
suggest_memory = f"{suggest_memory}\n\n{answer_note}" if suggest_memory else answer_note
11511151

11521152
update_run_step(run_id, "suggesting")
1153-
suggestion_result = suggest_change(repo_path, analysis, issue_key=issue_key, issue_summary=summary, memory_context=suggest_memory)
1153+
suggestion_result = suggest_change(
1154+
repo_path, analysis,
1155+
issue_key=issue_key,
1156+
issue_summary=summary,
1157+
issue_description=early_story_details.get("description") or "",
1158+
memory_context=suggest_memory,
1159+
)
11541160
changes = suggestion_result.get("changes", [])
11551161
suggestion_summary = suggestion_result.get("summary", "")
11561162
files_str = ", ".join(c.get("file", "") for c in changes)

0 commit comments

Comments
 (0)