# Workflow

## 1. Model Extraction Workflow

For detailed model extraction gates, see `docs/MODEL_EXTRACTION_WORKFLOW.md`.

The project follows this flow:

```text
Original article / representative text
-> source article record
-> source evidence excerpts
-> human-readable model card
-> machine-readable model JSON
-> regression cases
-> selector examples
-> validation report
```

## 2. Development Workflow

For each task:

1. Read `README.md` and `AGENTS.md`.
2. Check `docs/PROJECT_BRIEF.md`.
3. Modify the smallest necessary set of files.
4. Keep JSON and Markdown versions consistent.
5. Run or update validation.
6. Update reports or handoff notes.
7. Do not expand scope without confirmation.

## 3. Model Addition Workflow

When adding a new model:

1. Create a model JSON file in `models/`.
2. Create a human-readable card in `cards/`.
3. Add source article records.
4. Add source evidence excerpts.
5. Add regression cases.
6. Add selector examples if relevant.
7. Run `python scripts\rebuild_indexes.py --write`.
8. Run validation.
9. Update documentation.

## 4. Stabilization Workflow

If a model is unstable:

1. Mark `needs_stabilization: true`.
2. Add risks in `stability_profile.main_risks`.
3. Add boundary and misuse regression cases.
4. Do not upgrade to stability level A until tests pass.

## 5. Handoff Workflow

For ChatGPT-specific handoff rules, see `docs/CHATGPT_HANDOFF_RULES.md`.

At the end of each work session:

1. Summarize what changed.
2. List created and modified files.
3. Record validation status.
4. Separate assumptions from verified facts.
5. List questions that require product or CCRA judgment.
6. Suggest the smallest useful next tasks.

If the owner is going from Codex to ChatGPT, create a `reports/ChatGPT交接文档_<topic>_<YYYY-MM-DD>.md` file before ending the work session.

Before handoff, run:

```powershell
python scripts\rebuild_indexes.py --check
python scripts\validate_model_library.py
```

## 5.1 Review Bundle Zip Workflow

When creating optional raw changed-file zips for GPT / CCRA review bundles, use the installed `bundle-zip` Skill instead of ad hoc PowerShell or Python compression.

Required properties:

1. Provide an explicit file list.
2. Use the repository root marker, for example `the-mindscape-of-bro-tsong`.
3. Preserve source-relative paths inside the zip.
4. Verify the zip by reading it back.
5. Keep the `bundle-zip` JSON summary with the review bundle when useful.

Do not use `Compress-Archive` for review raw zips where directory paths matter; it can flatten file-list paths.

## 6. Supplier Request Workflow

When this repository needs a capability owned by a neighboring repository:

1. Classify the need.
2. Use `requirements/ccpe/` for expert-agent, runtime, model-governance, invocation, evaluation, or integration-registration needs.
3. Use `requirements/skills-vault/` for deterministic automation, reusable scripts, validation helpers, extraction helpers, or installable Skill needs.
4. Write one request file per missing capability.
5. Pause the dependent model extraction or implementation step unless the project owner explicitly says to solve the need locally.
6. Resume after the supplier artifact, installed Skill, or owner decision is available.

## 7. Duplex Model Extraction Workflow

Model extraction has two concurrent tracks:

```text
Workflow/tooling track -> request or build the process and supporting capabilities.
Content-processing track -> use available capabilities to extract, validate, and stabilize models.
```

Do not let the content-processing track silently absorb missing tooling work.

If a tool gap appears, record it as a supplier request and stop the blocked extraction step.

## 8. Framework Adoption Workflow

Third-party agentic frameworks such as CrewAI or LangGraph may be introduced only for concrete product implementation.

Before adoption:

1. Record the product reason.
2. Identify whether CCPE needs to supply an Agent Spec, Runtime Spec, authority rule, evaluation rule, or integration registration.
3. Identify whether skills-vault needs to supply reusable deterministic helpers.
4. Keep framework adapters, state, deployment, and product-specific behavior in this repository.
5. Record the boundary decision in `docs/DECISIONS.md`.

## 9. Knowledge Asset Workflow

For long-term reusable knowledge rules, see `docs/KNOWLEDGE_ASSET_RULES.md`.

When a rule, model map, schema explanation, workflow summary, or product context becomes stable enough to reuse across sessions, create or update a file under `knowledge_assets/`.

Do not leave durable knowledge only in temporary reports.

For repository-wide file identity rules, including canonical files, generated reports, review archives, and temporary files, see `docs/FILE_TAXONOMY.md`.
