feat(review): review_depth: lightweight annotation to skip preamble for low-risk steps#411
Merged
Merged
Conversation
…low-risk steps Adds a `review_depth: lightweight` annotation to review blocks in job.yml step outputs and .deepreview rules. When set, the workflow's common_job_info preamble (## Job Context) is omitted from review instruction files, reducing token overhead for trivial or reversible intermediate steps. Step inputs and review criteria are always included regardless of depth. - Parser: ReviewBlock gains review_depth field - Config: ReviewRule and ReviewTask carry review_depth through the pipeline - Matcher: review_depth threaded from rule to task for all three strategies - QualityGate: _build_preamble() conditionally omits Job Context when lightweight - Schemas: review_depth enum ["lightweight"] added to job.schema.json and deepreview_schema.json - Tests: 1299 passing, coverage at 98.07% Closes #86 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds an optional review_depth: lightweight annotation to review blocks in both job.yml step outputs and .deepreview rules. When set, the workflow's common_job_info preamble (## Job Context) is omitted from generated review instruction files to reduce token usage for low-risk/reversible intermediate steps. Step inputs and review criteria are always included, and process-requirements (PQA) reviews always use standard depth.
Changes:
- Plumbs a new
review_depth: str | Nonefield from parsers (ReviewBlock,ReviewRule) through the matcher (ReviewTask) and into_build_preamble, which now skips## Job Contextwhen the value is"lightweight". - Adds a
review_depthenum (["lightweight"]) to bothjob.schema.jsonanddeepreview_schema.json. - Adds parser, matcher, and quality-gate tests covering lightweight behaviour, depth defaulting, and step-input retention.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/deepwork/jobs/parser.py |
Adds review_depth field to ReviewBlock and populates it from input dict |
src/deepwork/review/config.py |
Adds review_depth field to ReviewRule and ReviewTask; parses it from .deepreview data |
src/deepwork/review/matcher.py |
Threads review_depth from rule to task in all three strategies |
src/deepwork/jobs/mcp/quality_gate.py |
_build_preamble takes review_depth; suppresses ## Job Context for lightweight; PQA preamble always standard |
src/deepwork/jobs/job.schema.json |
Adds review_depth enum to review block schema |
src/deepwork/schemas/deepreview_schema.json |
Same enum added to .deepreview review block schema |
CHANGELOG.md |
Records the new review_depth: lightweight feature |
tests/unit/jobs/test_parser.py |
Tests for parsing review_depth and defaulting to None |
tests/unit/jobs/mcp/test_quality_gate.py |
Tests lightweight suppression, standard inclusion, step-input retention, and related coverage |
tests/unit/review/test_matcher.py |
Tests for glob path-relative skip cases and all_changed_files + subsequent rule |
…-output test - deepreview_schema.json: note that review_depth has no effect in .deepreview rules since they are not associated with a workflow and receive no common_job_info - test_quality_gate.py: add test for build_string_output_review_tasks with review_depth: lightweight to confirm common_job_info is suppressed on string outputs Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
nhorton
approved these changes
May 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
review_depth: lightweightannotation to review blocks injob.ymlstep outputs and.deepreviewrulescommon_job_infopreamble (## Job Context) is omitted from review instruction files — typically 300–800 tokens per reviewNOTE: This only adds the review_depth capability, it is utilized in a deepwork-frontend PR https://github.com/Unsupervisedcom/deepwork-frontend/pull/106
Implementation
parser.pyReviewBlockgainsreview_depth: str | Nonefieldconfig.pyReviewRuleandReviewTaskcarryreview_depththrough the pipelinematcher.pyreview_depththreaded from rule to task for all three strategiesquality_gate.py_build_preamble()conditionally omits Job Context whenlightweightjob.schema.jsonreview_depthenum["lightweight"]added toreview_blockdeepreview_schema.json.deepreviewrule review blocks; description clarifies this field is a no-op in.deepreviewrules (nocommon_job_infoto suppress there)Test plan
test_from_dict_with_review_depth_lightweight,test_from_dict_review_depth_defaults_to_noneTestReviewDepthLightweight(3 tests) verifying Job Context is suppressed, standard depth includes it, and step inputs are always presenttest_lightweight_review_depth_omits_common_job_infoonbuild_string_output_review_tasks(string output path)test_all_changed_files_strategy_with_subsequent_rule, defensive path tests for_find_unchanged_matching_filesVerification
To confirm omitting
## Job Contextdoesn't reduce review quality, twodeepwork:revieweragents were run in parallel against the same real analysis report — one with the full preamble (standard), one without (lightweight):## Job Context(business background for salman.io: nature writing pivot, newsletter open rate gap, digital garden CTR advantage)Both returned PASS on all five criteria with the same findings and the same supporting evidence. The lightweight reviewer was marginally more critical on criterion 5 (missed opportunities), surfacing a minor gap the standard reviewer did not. This makes sense for reports that are self-contained: when the artifact under review carries its own context, the preamble is redundant. For reviews of opaque artifacts (raw code, schema files) that don't carry product context, standard depth remains appropriate.
Closes Unsupervisedcom/deepwork-frontend#86
🤖 Generated with Claude Code