# How Output Directories Are Structured in the Patent Disclosure Skill Project

> Discover how handsomestWei patent disclosure skill organizes output directories. Artifacts are neatly structured in outputs/ with timestamped subfolders for isolated skill management.

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

---

**All generated artifacts are written to a top-level `outputs/` directory in the user's working directory, with each skill maintaining its own isolated subfolder under consistent timestamped naming conventions.**

The `handsomestWei/patent-disclosure-skill` repository organizes generated artifacts under a centralized `outputs/` folder located in the user's working directory, strictly outside the skill package itself. This architecture ensures patent search reports, reader extractions, and application drafts remain isolated from source code while supporting environment-based overrides. Understanding this **output directory structure** is critical for automating patent workflows and retrieving specific artifacts generated by the six specialized sub-skills.

## Top-Level Output Organization

The project enforces a strict separation between source code and generated content. All skills write to an **`outputs/`** directory created at the user's working directory level, never inside the skill package repository. This path is universally excluded from version control via `.gitignore`, ensuring that PDFs, markdown reports, and intermediate processing files never pollute the git history.

Each sub-skill receives its own dedicated subdirectory beneath `outputs/`, following a predictable pattern that combines the skill name with optional case identifiers or timestamps. This isolation prevents collisions between different operations and allows users to locate results quickly without parsing complex nested paths.

## Skill-Specific Directory Layout

### Patent Search Reports

The **Patent Search** skill writes markdown search reports to `outputs/patent-search/`. According to [`skills/patent-search/tools/emit_search_report.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-search/tools/emit_search_report.py) at line 6, this location serves as the default destination for files named `SEARCH‑YYYYMMDD‑HHMMSS.md`. These reports contain consolidated search results from CNIPA and other patent databases.

### Patent Reader Pipeline

The **Patent Reader** skill uses `outputs/patent_reader/` as its base directory, or `outputs/patent_reader/${RUN}` when executing specific processing runs. As implemented in [`skills/patent-reader/tools/shared/common.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-reader/tools/shared/common.py) at line 367, the tool checks for the environment variable `PATENT_READER_OUTPUT_DIR` before falling back to the default path.

This directory stores all intermediate artifacts from the reading pipeline, including downloaded PDFs, extracted text files, parsed figures, lint files, and optional Obsidian vault notes. The `${RUN}` subfolder convention keeps multiple processing executions separate, preventing overwrites when handling batch patent analysis.

### Patent Application Packages

The **Patent Application** skill generates complete application packages under `outputs/patent-application/{CASE_ID}_{TIMESTAMP}/`. Documented in [`skills/patent-application/SKILL.md`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-application/SKILL.md) at line 22, this structure contains invention figures, claim drafts, supporting documentation, and the final generated Word document. The timestamped naming ensures chronological ordering when browsing case history.

### Exam Policy Briefs

For **Exam-Policy Brief** generation, outputs land in `outputs/exam-policy/` as noted in [`skills/patent-exam-policy/SKILL.md`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-exam-policy/SKILL.md) at line 14. Files follow the pattern `POLICY‑YYYYMMDD‑HHmm.md`, containing markdown-formatted policy analysis and examination guidelines for specific patent classifications.

### Office Action Replies

The **Office Action (OA) Reply** skill organizes drafts under `outputs/oa/{CASE}/`. According to [`skills/patent-oa/tools/emit_opinion_docx.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-oa/tools/emit_opinion_docx.py) at line 7, this directory stores both intermediate opinion statements (saved as `意见陈述_时间戳.md`) and the final generated DOCX files ready for submission to patent offices.

### Docket and Case Management

**Docket and Case Files** are maintained under `outputs/docket/{CASE_ID}/`, as defined in [`skills/patent-docket/tools/docket_paths.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-docket/tools/docket_paths.py) at line 2. This location houses YAML docket files, case trackers, and related metadata that coordinate workflow state across the various patent processing stages.

## Configuration and Environment Overrides

Each skill supports optional environment variables that override the default `outputs/` locations:

- `PATENT_SEARCH_OUTPUT_DIR` – Redirects patent search reports
- `PATENT_READER_OUTPUT_DIR` – Changes the reader pipeline base path (implemented in [`common.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/common.py))
- Similar patterns exist for application, OA, and docket skills

This flexibility allows users to store results on network drives or external storage without modifying source code. For skills that may be invoked repeatedly, such as the patent reader, the system automatically creates **run-specific sub-folders** using timestamp variables (`${RUN}`), keeping each execution's artifacts isolated while maintaining a predictable parent directory structure.

## Working with Output Directories

The following examples demonstrate practical interaction with the output structure:

```bash

# Override the search report location during execution

python skills/patent-search/tools/cnipa_search.py "AI-driven camera" \
    --output-dir outputs/patent-search

```

```bash

# Execute the patent reader with a specific run ID to isolate outputs

RUN_ID=$(date +%Y%m%d%H%M%S)
python skills/patent-reader/tools/extract/extract_patent_text.py \
    -i CN119961390A.pdf -o outputs/patent_reader/$RUN_ID

```

```bash

# Access generated application files for case auditing

python skills/patent-application/tools/audit_claims.py \
    outputs/patent-application/XYZ123_20231101/claim_drafts.md

```

## Summary

- The **`outputs/`** directory lives in the working directory, not the repository, and is git-ignored by default
- Each skill receives a dedicated subdirectory: `patent-search/`, `patent_reader/`, `patent-application/`, `exam-policy/`, `oa/`, and `docket/`
- **Environment variables** like `PATENT_READER_OUTPUT_DIR` allow relocation of output roots without code changes
- **Timestamped filenames** (e.g., `SEARCH‑YYYYMMDD‑HHMMSS.md`) and run-specific subfolders prevent overwrites and enable chronological sorting
- Source definitions reside in specific files including [`emit_search_report.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/emit_search_report.py), [`common.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/common.py), [`SKILL.md`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/SKILL.md) files, [`emit_opinion_docx.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/emit_opinion_docx.py), and [`docket_paths.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/docket_paths.py)

## Frequently Asked Questions

### Where are patent search reports saved by default?

By default, search reports are written to `outputs/patent-search/` as markdown files named `SEARCH‑YYYYMMDD‑HHMMSS.md`. This location is hardcoded in [`skills/patent-search/tools/emit_search_report.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-search/tools/emit_search_report.py) at line 6, though you can override it using the `--output-dir` argument.

### Can I change the default output location for all skills?

Yes, though each skill uses a specific environment variable. For example, set `PATENT_READER_OUTPUT_DIR` to redirect the reader pipeline, or use analogous variables for other skills. If not set, each tool falls back to its default `outputs/` subdirectory as documented in the respective source files.

### How does the patent reader handle multiple execution runs?

The reader creates run-specific subdirectories under `outputs/patent_reader/${RUN}/` when a run identifier is provided. This pattern, handled in [`skills/patent-reader/tools/shared/common.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-reader/tools/shared/common.py) at line 367, isolates artifacts from different processing sessions while maintaining a consistent base directory structure.

### Is the outputs directory tracked in git?

No. The `outputs/` tree is explicitly excluded via `.gitignore` to prevent generated artifacts—such as PDFs, Word documents, and intermediate processing files—from polluting the repository history. This ensures only source code and configuration files remain under version control.