Skip to content

Add Visual Work Instruction Extractor skill - #290

Open
Bas (basvb1992) wants to merge 3 commits into
microsoft:mainfrom
basvb1992:submit-visual-work-instruction-extractor
Open

Add Visual Work Instruction Extractor skill#290
Bas (basvb1992) wants to merge 3 commits into
microsoft:mainfrom
basvb1992:submit-visual-work-instruction-extractor

Conversation

@basvb1992

Copy link
Copy Markdown

Summary

Adds Visual Work Instruction Extractor, a specialized Agent Skill for turning scanned, flattened, or mixed-layout PDF work documents into grounded instruction steps, evidence crops, safety context, component details, and part numbers.

The skill keeps photos, diagrams, callouts, warnings, and nearby instruction text connected. Every extracted instruction retains traceable page evidence, while ambiguous or safety-sensitive results are marked for review rather than guessed.

Included

  • Agent-facing SKILL.md
  • Human-facing gallery README.md
  • Normalized visual-region proposal contract
  • Work-instruction manifest JSON Schema and starter manifest
  • Optional deterministic Python helper for rendering, cropping, validation, and packaging

Platform and dependencies

  • Tested platform: Copilot Studio
  • Python 3.10+ is optional
  • pypdfium2 and Pillow enable helper-based rendering and cropping
  • Manifest validation and packaging remain dependency-free
  • Runtimes with native PDF/image capabilities can follow the same contracts without those packages

Privacy and security

  • Contains no customer work documents, instruction photos, generated output, tenant details, personal paths, credentials, secrets, or connection information
  • Examples and self-tests use synthetic content only
  • Helper performs local file operations and makes no network requests
  • PDF content is treated as untrusted data, including explicit prompt-injection resistance
  • Runtime instructions prohibit public links, unapproved uploads, hidden metadata disclosure, and unrelated personal data

Validation

  • Final submission payload manually reviewed for customer and personal data
  • Forbidden binary/output scan passed (pdf, images, ZIPs, caches, and bytecode absent)
  • Python helper self-test passed
  • npm run check:submissions passed (91 submissions)
  • npm run import:submissions passed
  • npm run build passed (390 pages)
  • Branch diff contains only submissions/visual-work-instruction-extractor/

Licensing

I agree that this contribution is made under the repository's MIT License.

Copilot AI lite review requested due to automatic review settings August 17, 2026 12:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new submission, Visual Work Instruction Extractor, to the skills gallery. The submission defines an agent workflow plus a deterministic Python helper and accompanying contracts (region proposal format + normalized manifest schema) for turning mixed-layout/scanned PDF work instructions into a reviewable, evidence-grounded ZIP output.

Changes:

  • Added agent-facing SKILL.md describing an evidence-first PDF→pages/crops/manifest workflow and packaging requirements.
  • Added optional deterministic Python helper (extract_work_instructions.py) to render PDFs, crop proposed regions, validate outputs, and produce a ZIP archive.
  • Added reference contracts: region proposal format documentation, manifest JSON Schema, and a starter manifest template; plus a human-facing README.md and metadata.json.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
submissions/visual-work-instruction-extractor/SKILL.md Defines the agent procedure and required ZIP output structure/contracts.
submissions/visual-work-instruction-extractor/scripts/extract_work_instructions.py Implements helper commands for render/crop/validate/package and self-test.
submissions/visual-work-instruction-extractor/references/region-proposals.md Documents the normalized region proposal JSON format used for deterministic cropping.
submissions/visual-work-instruction-extractor/references/output-schema.json Defines the normalized manifest JSON Schema for extracted instructions and provenance.
submissions/visual-work-instruction-extractor/README.md Human-facing overview, requirements, examples, and privacy notes for the gallery page.
submissions/visual-work-instruction-extractor/metadata.json Registers the submission in the gallery catalog (platforms/tags/author/version).
submissions/visual-work-instruction-extractor/assets/manifest-template.json Provides a starter manifest structure aligned to the output schema.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +220 to +224
for page_entry in proposal["pages"]:
require(isinstance(page_entry, dict), "Each region page must be an object")
image_path = safe_relative_path(page_entry.get("image"), "region page image")
source_path = output_dir / Path(str(image_path))
require(source_path.is_file(), f"Page image is missing: {image_path}")
Comment on lines +80 to +84
def validate_manifest_data(manifest: Any, output_dir: Path | None = None) -> list[str]:
require(isinstance(manifest, dict), "Manifest root must be an object")
require(manifest.get("schemaVersion") == SCHEMA_VERSION, f"schemaVersion must be {SCHEMA_VERSION}")
document = manifest.get("document")
require(isinstance(document, dict), "document must be an object")
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings August 17, 2026 13:22
@basvb1992

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Suppressed comments (2)

submissions/visual-work-instruction-extractor/scripts/extract_work_instructions.py:128

  • validate_manifest_data currently uses dict.get() for several fields that are required by references/output-schema.json (e.g., sequence, partNumbers, toolsAndMaterials, evidenceImage, photoImage, extractionMethod). If those keys are missing, the helper will still treat the manifest as valid and can package an output that does not conform to the documented schema.
        require(instruction.get("sourcePage") in page_numbers, f"{field}.sourcePage does not identify a page")
        validate_box(instruction.get("sourceRegion"), f"{field}.sourceRegion")
        confidence = instruction.get("confidence")
        require(isinstance(confidence, (int, float)) and not isinstance(confidence, bool) and 0 <= confidence <= 1,
                f"{field}.confidence must be between 0 and 1")

submissions/visual-work-instruction-extractor/references/output-schema.json:54

  • The relativePath schema pattern allows backslashes, which means a manifest could still validate while containing Windows-style paths (and even .. segments when \\ is used as a separator). Since SKILL.md and the helper require forward-slash relative paths, the schema should reject any \\ and treat both / and \\ as path separators for the .. check.
      "pattern": "^(?!/)(?![A-Za-z]:)(?!.*(?:^|/)\\.\\.(?:/|$)).+"

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings August 17, 2026 13:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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.

2 participants