Reviewer context¶
akms.task_context.review
¶
Reviewer context resolution from the actual task-local diff (A2-3).
Generates role-specific reviewer loadouts from files actually changed by a task, while reporting required lessons that appear only after the implementation diff is known.
Design rules¶
- Changed paths come from an explicit sequence or a base/head git pair. A bare single-path string is rejected (Phase 1 canonicalisation).
- Empty diffs fall back to task-derived scope without failure.
- Pre-task required nodes (scope/deliverables only) are compared with the post-diff required set so callers can surface newly mandatory lessons.
- Reviewer roles (
code_reviewer,physics_reviewer) stay distinct via the ordinary advisory query profile. - No LLM or network I/O — all work is offline and deterministic.
ReviewResolutionResult
dataclass
¶
ReviewResolutionResult(
status: Literal["ok", "error"],
role: str,
empty_diff_fallback: bool = False,
changed_paths: tuple[str, ...] = (),
pre_task_required: tuple[str, ...] = (),
post_diff_required: tuple[str, ...] = (),
post_diff_only_required: tuple[str, ...] = (),
coactivated_count: int = 0,
advisory_count: int = 0,
node_count: int = 0,
fingerprint: str | None = None,
loadout_path: str | None = None,
manifest_path: str | None = None,
graph_version: str | None = None,
route_index_hash: str | None = None,
task_id: str | None = None,
phase: int | None = None,
error: str | None = None,
error_code: str | None = None,
pre_task_result: ResolveTaskResult | None = None,
post_diff_result: ResolveTaskResult | None = None,
query_result: TaskKnowledgeQueryResult | None = None,
resolved_seeds: ResolvedSeeds | None = None,
)
Outcome of one reviewer resolution pass.
post_diff_only_required lists required node IDs that the actual diff
introduced beyond the pre-task (scope/deliverable) required set.
resolve_changed_paths_for_review
¶
resolve_changed_paths_for_review(
*,
repo_root: str | Path,
changed_paths: Mapping[str, Any]
| Sequence[str]
| str
| Path
| None = None,
base: str | None = None,
head: str | None = None,
) -> tuple[str, ...]
Resolve the task-local changed-path set for reviewer context.
Raises :class:ResolveTaskError on invalid inputs (including bare strings).
Source code in packages/akms/src/akms/task_context/review.py
resolve_reviewer_context
¶
resolve_reviewer_context(
*,
repo_root: str | Path,
task: Mapping[str, Any] | str | Path,
route_index: TaskRouteIndex
| Mapping[str, Any]
| str
| Path,
agent_role: AgentRole | str = AgentRole.CODE_REVIEWER,
changed_paths: Mapping[str, Any]
| Sequence[str]
| str
| Path
| None = None,
base: str | None = None,
head: str | None = None,
graph_path: str | Path | None = None,
loadout_path: str | Path | None = None,
manifest_path: str | Path | None = None,
mode: LoadoutMode | str = LoadoutMode.ROUTING,
available_context: int = 0,
max_depth: int = 2,
phase: int | None = None,
config: PropagationConfig | None = None,
write_artifacts: bool = True,
) -> ReviewResolutionResult
Resolve reviewer knowledge from the actual task-local diff.
Parameters¶
agent_role:
Must be code_reviewer or physics_reviewer.
changed_paths / base / head:
Source of the actual implementation diff. Empty results fall back to
the task's declared scope/deliverables without failure.
write_artifacts:
When True (default), write the post-diff reviewer loadout and
resolution manifest. Pre-task resolution is always in-memory only.
Returns¶
ReviewResolutionResult
Includes post_diff_only_required — required nodes introduced solely
by the actual diff relative to the pre-task scope resolution.
Source code in packages/akms/src/akms/task_context/review.py
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 | |