# Step 1: Project Understanding and Material Collection

## MANDATORY EXECUTION RULES (READ FIRST)

- 🛑 Do NOT start mining patent candidates yet. The goal of this step is global understanding only.
- ✅ Read documents and code; do not skim filenames alone.
- 📋 Output of this step is a project cognition memo — keep it private (in working memory or scratch file), do not append to the final disclosure yet.
- 🚫 Forbidden to advance to step-02 until the project memo has been produced and verified with the user.

## YOUR TASK

Establish a complete mental model of the target software project so that step-02 can recognize what is genuinely novel and what is generic. The target project root is `context_file` if provided, otherwise the current working directory.

## EXECUTION SEQUENCE

### 1.1 Scan project structure

Pick the right scanning tools by stack:

- Source files: `Glob` patterns like `**/*.java`, `**/*.py`, `**/*.ts`, `**/*.go`, `**/*.rs`
- Build manifests: `pom.xml`, `build.gradle*`, `package.json`, `pyproject.toml`, `Cargo.toml`, `go.mod`
- Infra: `Dockerfile`, `docker-compose*.yml`, `**/*.tf`, k8s manifests
- DB schema: `**/migrations/**`, `**/*.sql`, ORM model files

### 1.2 Read documentation in priority order

1. README and top-level project notes
2. Architecture / high-level design docs (`docs/architecture*`, `docs/design*`)
3. Requirements / PRDs
4. Database design docs (DDL, ER description)
5. API / interface docs

### 1.3 Analyze core code

Focus on the layers most likely to contain inventions:

- Core business logic (Service / Domain)
- Custom algorithms and strategy implementations
- Middleware integration and self-built components
- Distributed coordination, caching strategy, message handling
- Complex DB logic (stored procedures, non-trivial SQL)
- Exception handling and fault tolerance

### 1.4 Optional prior-art lookup

If `WebSearch` or `Tavily` MCP is available, run a quick scan for public patents and well-known designs in the same problem space. Use this to **rule out** candidates that obviously already exist, not to copy from.

### 1.5 Produce the project cognition memo

Summarize:

- Technical domain (e.g., "supply-chain finance", "industrial IoT gateway")
- Overall architecture pattern (monolith / microservices / event-driven / batch pipeline)
- Tech stack inventory
- Core business flows (3–7 bullets)
- External integrations
- Anything that looks unusual, custom, or non-standard — these are the **leads** for step-02

## OUTPUT

A short memo (in chat, or written to a scratch file under `{patent_output_folder}/.cache/project-memo-{date}.md` if available) covering the five bullets above.

## NEXT STEP

After confirming the memo with the user, load `./step-02-patent-mining.md`.
