# What Is the Patent-OA Skill? Automating Patent Office Action Responses

> Discover the patent-oa skill that automates patent office action responses. Parse notices, query cases, and generate draft responses for efficient filing.

- Repository: [handsomestWei/patent-disclosure-skill](https://github.com/handsomestWei/patent-disclosure-skill)
- Tags: how-to-guide
- Published: 2026-09-08

---

**The patent-oa skill automates the creation of patent office action response drafts by parsing examiner notices, querying a knowledge base of historical cases, and rendering finalized Word documents for filing.**

The patent-oa skill serves as the dedicated "exam-office-action" module within the `handsomestWei/patent-disclosure-skill` repository, part of the broader *中国专利.skill* suite. It converts raw Office Action notifications (审查意见) into structured legal responses through a pipeline that integrates document intelligence with optional retrieval-augmented generation (RAG).

## Core Capabilities of the Patent-OA Skill

The skill architecture centers on three tightly integrated capabilities that transform examiner criticisms into filing-ready documents.

### Answer Drafting

The skill interrogates incoming Office Action PDFs to identify rejection grounds, prompts users for missing technical facts, and generates a structured **意见陈述** (opinion statement) in Markdown format. Once validated, [`md_to_docx.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/md_to_docx.py) converts the draft automatically into a standard Word document suitable for direct submission to the patent office.

### Knowledge Distillation

Historical office action cases and examination guidelines are pre-ingested into an Obsidian vault. When processing new notices, the skill retrieves relevant precedents—such as similar claim rejections or successful rebuttal strategies—to enrich the current draft with legally robust arguments and improved completeness.

### Vector Retrieval (Optional RAG)

By installing `sqlite-vec`, the skill enables semantic similarity search across the distilled knowledge base. This vector retrieval capability matches examiner language even when exact keywords differ, significantly improving precedent relevance compared to traditional keyword matching.

## Technical Architecture and File Structure

The patent-oa skill orchestrates its workflow through specific modules in `skills/patent-oa/tools/`:

- **[`config.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/config.py)** (lines 194–205): Loads YAML configuration, validates dependencies (PyYAML, sqlite-vec), and initializes the RAG pipeline.
- **[`store.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/store.py)** (line 35): Persists raw notices, parsed sections, and draft Markdown in SQLite for audit trails and revision history.
- **[`pdf_text.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/pdf_text.py)** (line 27): Extracts raw text from examiner PDFs for downstream processing.
- **[`emit_opinion_docx.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/emit_opinion_docx.py)**: Orchestrates the final document emission step.
- **[`md_to_docx.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/md_to_docx.py)** (line 9): Converts generated Markdown drafts into filing-ready Word documents (`意见陈述.docx`).
- **[`embed.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/embed.py)** & **[`rebuild_vectors.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/rebuild_vectors.py)**: Build and query the semantic vector store for enhanced retrieval.

## The Patent-OA Skill Workflow

When a user invokes the skill via the **"审查答复"** (examination response) intent, the system executes a five-stage pipeline:

1. **Input Ingestion**: Accepts the path to the examiner's Office Action PDF or text file.
2. **Document Parsing**: [`pdf_text.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/pdf_text.py) extracts raw text content from the source document.
3. **RAG Retrieval**: If enabled, the vector index queries relevant historical precedents using [`embed.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/embed.py).
4. **Draft Generation**: [`emit_opinion_docx.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/emit_opinion_docx.py) creates a Markdown draft at `outputs/oa/案/意见陈述_YYYYMMDDHHMMSS.md`.
5. **Document Conversion**: [`md_to_docx.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/md_to_docx.py) renders the final Word file for attorney review and submission.

This workflow automates the *answer-the-office-action* loop while preserving human oversight for factual verification.

## How to Invoke the Patent-OA Skill

### Python API

Use the `SkillRunner` class to programmatically generate response drafts:

```python
from agentskills import SkillRunner

runner = SkillRunner()

# Generate draft from Office Action PDF

response = runner.run(
    skill="patent-oa",
    intent="审查答复",
    params={"notice_path": "inputs/office_action.pdf"}
)

print(response["draft_markdown"])

# Convert to Word document

runner.run(
    skill="patent-oa",
    intent="emit_opinion_docx",
    params={
        "input_md": response["draft_path"],
        "output_docx": "outputs/response.docx"
    }
)

```

### Command Line Interface

Execute the skill directly from the AgentSkills console:

```bash

# Generate Markdown draft

$ agentskill "审查答复" --notice_path inputs/oa_notice.pdf

# Output: outputs/oa/案/意见陈述_20260903120000.md

# Convert to final Word document

$ agentskill "emit_opinion_docx" \
    -i outputs/oa/案/意见陈述_20260903120000.md \
    -o reply.docx

```

## Summary

- The **patent-oa skill** automates patent Office Action responses through structured drafting, knowledge retrieval, and document conversion.
- It operates as part of the `handsomestWei/patent-disclosure-skill` repository, specifically within the `skills/patent-oa/` directory.
- **Configuration management** in [`config.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/config.py) validates dependencies and wires the RAG pipeline.
- **Data persistence** via [`store.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/store.py) maintains SQLite records of all case artifacts for compliance and revision.
- **Document processing** flows from PDF extraction ([`pdf_text.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/pdf_text.py)) through Markdown draft generation to final Word output ([`md_to_docx.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/md_to_docx.py)).
- **Optional vector search** using `sqlite-vec` enhances precedent matching for complex rejection scenarios.

## Frequently Asked Questions

### What file formats does the patent-oa skill accept as input?

The skill primarily accepts PDF files containing the examiner's Office Action. The [`pdf_text.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/pdf_text.py) module extracts raw text from these documents for processing. Text-based inputs are also supported for parsed examiner notices.

### How does the patent-oa skill ensure response quality?

The skill leverages **knowledge distillation** from an Obsidian vault of historical cases and **vector retrieval** via `sqlite-vec` to inject relevant precedents and successful rebuttal strategies into each draft. Human verification remains the final step before filing.

### Can the patent-oa skill function without the vector database?

Yes. Vector retrieval is optional. Without `sqlite-vec` installed, the skill still performs answer drafting and document conversion using rule-based parsing and manual knowledge base references, though semantic matching capabilities will be unavailable.

### Where are the intermediate drafts stored during processing?

All artifacts persist in a SQLite database managed by [`store.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/store.py), including raw notices, parsed sections, and Markdown drafts. Final Word documents emit to configurable output paths, typically `outputs/oa/案/` for drafts and user-specified locations for final `意见陈述.docx` files.