Add AgentDiff context workflow#8
Conversation
Preserve structured context in traces, surface it in reports and file-scoped context, and add a Cursor skill installer so agents can use the workflow consistently.
Greptile SummaryThis PR adds the Confidence Score: 5/5Safe to merge; all remaining findings are P2 style suggestions with no impact on correctness or data integrity. No P0 or P1 issues found. The two flagged items are an unlikely-in-practice early-exit in an error path and a minor flag-consistency gap between markdown and JSON formats. Core logic for context storage, filtering, and PR comment fallback is correct and well-tested. src/commands/report.rs — find_merge_base loop and --context/JSON inconsistency Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[agentdiff report] --> B{post-pr-comment?}
B -- yes --> C[current_branch_commits]
C --> D[filter_traces_by_commit_set]
D --> E[markdown_trace_report include_context=true]
E --> F[post_pr_comment try edit-last first]
F --> G{edit succeeded?}
G -- yes --> H[Done]
G -- no --> I[gh pr comment create new]
I --> J{create succeeded?}
J -- yes --> H
J -- no --> K[bail with both stderrs]
B -- no --> L{format?}
L -- markdown with context --> M[markdown_trace_report]
L -- markdown no context --> N[markdown_report legacy]
L -- json --> O[context_json_report always includes context]
L -- text --> P[run_text]
L -- annotations --> Q[format_annotations]
L -- jsonl --> R[export jsonl]
Reviews (1): Last reviewed commit: "feat: add AgentDiff context workflow" | Re-trigger Greptile |
| for branch in candidates { | ||
| let out = std::process::Command::new("git") | ||
| .args(["merge-base", "HEAD", &branch]) | ||
| .current_dir(repo_root) | ||
| .output() | ||
| .ok()?; | ||
| if out.status.success() { | ||
| let sha = String::from_utf8(out.stdout).ok()?.trim().to_string(); | ||
| if !sha.is_empty() { | ||
| return Some(sha); | ||
| } | ||
| } | ||
| } | ||
| None |
There was a problem hiding this comment.
? exits the function on spawn failure in find_merge_base loop
The ? operator on .ok()? causes the entire find_merge_base function to return None if any Command::output() call produces an IO error (e.g. ENOENT for a missing git binary). The intended behavior is to continue iterating over the remaining candidates. In practice this is a no-op since if git can't spawn nothing else works, but the same early exit applies to the String::from_utf8(...).ok()? on the success path, where garbage output from an unusual git build could prematurely drop the remaining candidates.
| metadata: Some(serde_json::json!({ | ||
| "agentdiff": { | ||
| "intent": "security hardening", | ||
| "prompt_excerpt": "add route guard", | ||
| "files_read": ["src/auth.rs"], |
There was a problem hiding this comment.
Move the installable Cursor skill into a packaged template, keep generated project skill files out of the AgentDiff repository, and address PR comment review nits.
AgentDiff ReportSummary
Files Modified
|
Summary
agentdiff context, andagentdiff install-skillfor project/global Cursor skill installation.ghversions and filter PR comments to current-branch traces.Test plan
cargo testpython3 -m unittest discover scripts/testsagentdiff install-skill --scope projectsmoke test~/roam/monorepovalidation PR: https://github.com/codeprakhar25/roam-agentdiff/pull/6Monorepo validation
agentdiff pushwith 2 new traces: 5.09sagentdiff pushwith no local traces: 0.00sagentdiff report --format markdown --context: 0.02sagentdiff report --format json --context: 0.02sagentdiff context agentdiff-context-validation.md --json: 0.01s