Skip to content

feat: teach learn workflow to create deepschemas and deepreview rules#327

Open
nhorton wants to merge 16 commits intomainfrom
feat/learn-prevention-automation
Open

feat: teach learn workflow to create deepschemas and deepreview rules#327
nhorton wants to merge 16 commits intomainfrom
feat/learn-prevention-automation

Conversation

@nhorton
Copy link
Copy Markdown
Contributor

@nhorton nhorton commented Apr 1, 2026

Summary

  • Learn workflow prevention automation: The learn workflow now evaluates whether DeepSchemas or DeepReview rules could prevent issues encountered during a session, and creates them as outputs (deepschemas/deepreviews step arguments, new Step 7, "Prevention Opportunities Evaluated" process requirement)
  • claude_settings DeepSchema: New named schema with vendored JSON Schema for .claude/settings.json validation — enforces bash wildcard word boundaries, read/edit path prefixes, no secrets in shared settings, etc.
  • JSON Schema First guidance: Updated deepschema SKILL.md to prioritize structural validation via json_schema_path over requirements, with SchemaStore vendoring instructions
  • requirements_file built-in schema: New standard schema for RFC 2119 requirement spec files (*REQ-*.md) — enforces keyword usage, sequential numbering, unique IDs, testability
  • Formal specs: Added JOBS-REQ-012 (learn workflow prevention) and DW-REQ-011.10 (requirement quality constraints), with anonymous deepschemas for validation
  • Review improvements: Requirements traceability rule now prefers anonymous DeepSchemas over tests for single-file requirements; fixed multi-keyword requirements in DW-REQ-011

Test plan

  • All DeepWork reviews pass (requirements_traceability, suggest_new_reviews, deepreview_config_quality, prompt_best_practices, requirement_file_format, deepschema compliance)
  • uv run pytest passes
  • Learn workflow correctly prompts for prevention opportunities when run

🤖 Generated with Claude Code

nhorton and others added 7 commits March 31, 2026 18:46
Rules with strategy all_changed_files or matches_together and a **/*
matcher now get git diff main..HEAD pre-fetched and injected into the
review instruction file. The diff is sorted by filepath to group files
by directory, reducing reviewer turn count. Diff is scoped to the
rule's source_dir so subdirectory .deepreview files get narrower diffs.

Also streamlines the /review skill to skip the get_configured_reviews
call and go straight to get_review_instructions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The learn workflow now evaluates whether deepschemas or deepreview rules
could prevent issues encountered during a session, covering both process
mistakes and the substance of the work. Adds a "Preventable" classification,
a new Step 7 with actionable instructions for creating anonymous/named
deepschemas and deepreview rules, and a process requirement ensuring
prevention opportunities are always evaluated.

Also adds a filesystem-verifiable requirement to the deepschema meta-schema,
ensuring all deepschema requirements can be checked from filesystem assets.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…quirements

- Add .deepwork/schemas/claude_settings/ with deepschema.yml (semantic
  requirements) and vendored SchemaStore JSON Schema for structural validation
- Add no-structural-requirements rule to deepschema standard schema: requirements
  must not restate what json_schema_path already enforces
- Update /deepschema skill with JSON Schema First guidance: maximize structural
  validation, check SchemaStore for existing schemas, vendor local copies

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…utomation

The learn workflow now evaluates prevention opportunities and creates
DeepSchemas and DeepReview rules. Updated three sections in architecture.md
to document this capability.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Requirements about author understanding (sandbox path semantics, automode
defaults replacement, attribution deprecation, sandbox write paths) are not
filesystem-verifiable. Moved them to the instructions section and kept only
requirements that can be checked by examining file contents.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@nhorton nhorton enabled auto-merge April 2, 2026 00:08
@nhorton nhorton added this pull request to the merge queue Apr 2, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 2, 2026
@nhorton nhorton added this pull request to the merge queue Apr 2, 2026
…ements

- Add built-in requirements_file deepschema for RFC 2119 spec files
- Add JOBS-REQ-012 spec for learn workflow prevention automation
- Add DW-REQ-011.10 requirement quality constraints for deepschemas
- Add anonymous deepschemas validating JOBS-REQ-012 and DW-REQ-011.10
- Improve requirements_traceability review to prefer anonymous deepschemas
  for single-file requirements over tests
- Fix multi-keyword requirements in DW-REQ-011 (011.6.3, 011.7.3, 011.8.7)
- Fix REVIEW-REQ-005.7 sequential ordering
- Fix job_schema_instruction_compatibility description accuracy

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@nhorton nhorton removed this pull request from the merge queue due to a manual request Apr 2, 2026
nhorton and others added 2 commits April 2, 2026 14:31
…n main)

The review agent moved section 005.7 to the end for sequential ordering,
but this section exists on main already — the reorder was out of scope.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds test_returns_both_named_and_anonymous to TestGetSchemasForFileFast,
confirming that when a file matches both a named schema (via glob) and
an anonymous schema (via co-located .deepschema file), both are returned.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
nhorton and others added 5 commits April 2, 2026 14:44
Move from .deepwork/schemas/ (project-local) to
src/deepwork/standard_schemas/ so it ships with the package
and is auto-discovered for all users.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Call out that verification commands serve the same structural enforcement
role as json_schema_path for non-JSON files (markdown, shell, etc.).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file's only branch change was reformatting git-diff code that
already exists on main — not relevant to this PR.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The git_diff_output feature on ReviewTask (REVIEW-REQ-004.11,
REVIEW-REQ-005.7) added complexity without sufficient benefit.
Removes the field, helper functions, spec requirements, and tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@nhorton nhorton added this pull request to the merge queue Apr 2, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 2, 2026
The e2e test was running claude without the plugin, so the
deepschema_write PostToolUse hook never fired. This meant invalid
job.yml files got no immediate validation feedback, wasting turns.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@nhorton nhorton enabled auto-merge April 2, 2026 22:18
@nhorton nhorton added this pull request to the merge queue Apr 2, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant