# cyijun/china-financial-services architecture

> Architecture diagram of the GitHub repository cyijun/china-financial-services, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cyijun/china-financial-services
- Repository: https://github.com/cyijun/china-financial-services

## Overview

#### Purpose and Entry Points
This is a marketplace of AI-agent plugins for China A-share research and financial modeling, targeting Codex, Claude Code, and local Kimi CLI. Marketplace entry points are `.agents/plugins/marketplace.json`, `.claude-plugin/marketplace.json`, and `kimi-marketplace.json`. Individual plugin metadata is distributed per runtime, e.g. `plugins/china-market-researcher/.codex-plugin/plugin.json` and `plugins/china-model-builder/.claude-plugin/plugin.json`.

#### Plugin Topology
Three shared-source plugins define reusable methodology, modeling, and coverage capabilities: `plugins/china-research-methodology/skills/`, `plugins/financial-analysis/skills/`, and `plugins/equity-research/skills/`. Two self-contained workflow bundles vendor relevant skills and expose agent roles: `plugins/china-market-researcher/agents/china-market-researcher.md` and `plugins/china-model-builder/agents/china-model-builder.md`. Shared sources are synchronized into these bundles via `scripts/sync-agent-skills.py`.

#### Research Workflow
The market-researcher workflow combines market data, industry/ETF analysis, competition, underwriting, earnings changes, factor checks, thesis tracking, and red-team review. Its orchestration instructions are in `plugins/china-market-researcher/skills/china-market-researcher/SKILL.md`; industry ETF work has explicit snapshot generation and report validation at `plugins/china-market-researcher/skills/industry-etf-research/scripts/build_industry_etf_snapshot.py` and `plugins/china-market-researcher/skills/industry-etf-research/scripts/validate_industry_etf_report.py`.

#### Modeling Workflow
The model-builder workflow produces three-statement models, DCFs, trading comps, valuation triangulation, and auditable Excel deliverables. Key boundaries are the workflow skill at `plugins/china-model-builder/skills/china-model-builder/SKILL.md`, executable DCF logic at `plugins/china-model-builder/skills/china-dcf-model/scripts/dcf_model.py`, and workbook authoring/audit skills at `plugins/china-model-builder/skills/xlsx-author/SKILL.md` and `plugins/china-model-builder/skills/audit-xls/SKILL.md`.

#### Data, Evidence, and Controls
Tushare Pro is the primary structured-data provider; AKShare is a controlled supplement, particularly for public-web and ETF-history routes. Provider routing, point-in-time constraints, and yield-curve guidance live in `plugins/china-research-methodology/skills/china-market-data/SKILL.md` and its references. Evidence manifests, source rules, and thesis records establish reviewable research boundaries through `plugins/china-research-methodology/skills/a-share-research-evidence/scripts/build_evidence_manifest.py` and `plugins/china-research-methodology/skills/a-share-thesis-tracker/scripts/append_thesis_record.py`. Web search and company announcements provide qualitative and audited-source inputs.

#### Validation and Delivery Boundaries
Offline structural, manifest, and Python checks are centralized in `scripts/check.py` and exercised by `.github/workflows/ci.yml`. `scripts/preflight.py` verifies runtime and credentials before data-dependent work. Read-only live acceptance is intentionally separated from offline validation for Tushare and AKShare in `scripts/tushare_live_acceptance.py`, `scripts/akshare_live_acceptance.py`, and their manually dispatched workflows. Sanitized live evidence is retained under `docs/validation/`; example analyst outputs are versioned in `out/`.

Main entry points: [`plugins/china-market-researcher/skills/china-market-researcher/SKILL.md`](https://github.com/cyijun/china-financial-services/blob/main/plugins/china-market-researcher/skills/china-market-researcher/SKILL.md) (Research orchestration), [`scripts/sync-agent-skills.py`](https://github.com/cyijun/china-financial-services/blob/main/scripts/sync-agent-skills.py) (Skill synchronizer), [`plugins/china-model-builder/skills/china-model-builder/SKILL.md`](https://github.com/cyijun/china-financial-services/blob/main/plugins/china-model-builder/skills/china-model-builder/SKILL.md) (Modeling workflow), [`.agents/plugins/marketplace.json`](https://github.com/cyijun/china-financial-services/blob/main/.agents/plugins/marketplace.json) (Runtime marketplaces)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_distribution["Distribution"]
  node_marketplaces["Runtime marketplaces<br/>plugin catalogs<br/>[marketplace.json]"]
  node_skill_sync{{"Skill synchronizer<br/>sync script"}}
end

subgraph group_research["Research workflow"]
  node_shared_methodology["Research methodology<br/>shared skills"]
  node_shared_equity_research["Equity research<br/>shared skills"]
  node_market_agent["Market researcher agent<br/>agent role"]
  node_market_orchestrator["Research orchestration<br/>workflow skill<br/>[SKILL.md]"]
  node_etf_snapshot["Industry ETF snapshot<br/>snapshot generator"]
  node_etf_report_validation{{"ETF report validation<br/>report validator"}}
end

subgraph group_modeling["Modeling workflow"]
  node_shared_financial_analysis["Financial analysis<br/>shared skills"]
  node_model_agent["Model builder agent<br/>agent role"]
  node_model_workflow["Modeling workflow<br/>workflow skill<br/>[SKILL.md]"]
  node_dcf_engine{{"DCF engine<br/>model script<br/>[dcf_model.py]"}}
  node_workbook_authoring["Workbook authoring<br/>Excel skill<br/>[SKILL.md]"]
  node_workbook_audit{{"Workbook audit<br/>Excel audit skill<br/>[SKILL.md]"}}
end

subgraph group_governance["Data and validation"]
  node_provider_routing["Provider routing<br/>data policy<br/>[SKILL.md]"]
  node_data_providers[("Market data providers<br/>external data")]
  node_qualitative_sources["Qualitative sources<br/>external evidence"]
  node_evidence_manifest["Evidence manifest<br/>evidence control"]
  node_thesis_tracker["Thesis records<br/>research control"]
  node_preflight{{"Runtime preflight<br/>environment check<br/>[preflight.py]"}}
  node_offline_ci{{"Offline CI checks<br/>validation pipeline<br/>[check.py]"}}
  node_live_acceptance{{"Live acceptance<br/>manual validation"}}
  node_deliverables["Versioned outputs<br/>analyst deliverables"]
end

node_marketplaces -->|"exposes"| node_market_agent
node_marketplaces -->|"exposes"| node_model_agent
node_shared_methodology -->|"source skills"| node_skill_sync
node_shared_financial_analysis -->|"source skills"| node_skill_sync
node_shared_equity_research -->|"source skills"| node_skill_sync
node_skill_sync -->|"vendors skills into"| node_market_orchestrator
node_skill_sync -->|"vendors skills into"| node_model_workflow
node_market_agent -->|"runs"| node_market_orchestrator
node_model_agent -->|"runs"| node_model_workflow
node_provider_routing -->|"governs use of"| node_data_providers
node_preflight -->|"authorizes access"| node_data_providers
node_data_providers -->|"structured data"| node_market_orchestrator
node_qualitative_sources -->|"research inputs"| node_market_orchestrator
node_market_orchestrator -->|"generates"| node_etf_snapshot
node_etf_snapshot -->|"validated by"| node_etf_report_validation
node_market_orchestrator -->|"builds"| node_evidence_manifest
node_market_orchestrator -->|"updates"| node_thesis_tracker
node_data_providers -->|"financial inputs"| node_model_workflow
node_model_workflow -->|"executes"| node_dcf_engine
node_model_workflow -->|"authors"| node_workbook_authoring
node_workbook_authoring -->|"audited by"| node_workbook_audit
node_workbook_audit -->|"releases"| node_deliverables
node_offline_ci -.->|"validates repository outputs"| node_deliverables
node_live_acceptance -.->|"read-only acceptance"| node_data_providers

click node_marketplaces "https://github.com/cyijun/china-financial-services/blob/main/.agents/plugins/marketplace.json"
click node_skill_sync "https://github.com/cyijun/china-financial-services/blob/main/scripts/sync-agent-skills.py"
click node_market_agent "https://github.com/cyijun/china-financial-services/blob/main/plugins/china-market-researcher/agents/china-market-researcher.md"
click node_market_orchestrator "https://github.com/cyijun/china-financial-services/blob/main/plugins/china-market-researcher/skills/china-market-researcher/SKILL.md"
click node_etf_snapshot "https://github.com/cyijun/china-financial-services/blob/main/plugins/china-market-researcher/skills/industry-etf-research/scripts/build_industry_etf_snapshot.py"
click node_etf_report_validation "https://github.com/cyijun/china-financial-services/blob/main/plugins/china-market-researcher/skills/industry-etf-research/scripts/validate_industry_etf_report.py"
click node_model_agent "https://github.com/cyijun/china-financial-services/blob/main/plugins/china-model-builder/agents/china-model-builder.md"
click node_model_workflow "https://github.com/cyijun/china-financial-services/blob/main/plugins/china-model-builder/skills/china-model-builder/SKILL.md"
click node_dcf_engine "https://github.com/cyijun/china-financial-services/blob/main/plugins/china-model-builder/skills/china-dcf-model/scripts/dcf_model.py"
click node_workbook_authoring "https://github.com/cyijun/china-financial-services/blob/main/plugins/china-model-builder/skills/xlsx-author/SKILL.md"
click node_workbook_audit "https://github.com/cyijun/china-financial-services/blob/main/plugins/china-model-builder/skills/audit-xls/SKILL.md"
click node_provider_routing "https://github.com/cyijun/china-financial-services/blob/main/plugins/china-research-methodology/skills/china-market-data/SKILL.md"
click node_evidence_manifest "https://github.com/cyijun/china-financial-services/blob/main/plugins/china-research-methodology/skills/a-share-research-evidence/scripts/build_evidence_manifest.py"
click node_thesis_tracker "https://github.com/cyijun/china-financial-services/blob/main/plugins/china-research-methodology/skills/a-share-thesis-tracker/scripts/append_thesis_record.py"
click node_preflight "https://github.com/cyijun/china-financial-services/blob/main/scripts/preflight.py"
click node_offline_ci "https://github.com/cyijun/china-financial-services/blob/main/scripts/check.py"
click node_live_acceptance "https://github.com/cyijun/china-financial-services/blob/main/scripts/tushare_live_acceptance.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_marketplaces,node_skill_sync toneBlue
class node_shared_methodology,node_shared_equity_research,node_market_agent,node_market_orchestrator,node_etf_snapshot,node_etf_report_validation toneAmber
class node_shared_financial_analysis,node_model_agent,node_model_workflow,node_dcf_engine,node_workbook_authoring,node_workbook_audit toneMint
class node_provider_routing,node_data_providers,node_qualitative_sources,node_evidence_manifest,node_thesis_tracker,node_preflight,node_offline_ci,node_live_acceptance,node_deliverables toneRose
```

## Components

### Distribution

- [Runtime marketplaces](https://github.com/cyijun/china-financial-services/blob/main/.agents/plugins/marketplace.json): plugin catalogs · Catalogs expose plugins to Codex, Claude Code, and Kimi CLI. · `.agents/plugins/marketplace.json`
- [Skill synchronizer](https://github.com/cyijun/china-financial-services/blob/main/scripts/sync-agent-skills.py): sync script · Copies shared capabilities into self-contained workflow bundles. · `scripts/sync-agent-skills.py`

### Research workflow

- **Research methodology**: shared skills · Reusable data, evidence, and thesis methodology.
- **Equity research**: shared skills
- [Market researcher agent](https://github.com/cyijun/china-financial-services/blob/main/plugins/china-market-researcher/agents/china-market-researcher.md): agent role · `plugins/china-market-researcher/agents/china-market-researcher.md`
- [Research orchestration](https://github.com/cyijun/china-financial-services/blob/main/plugins/china-market-researcher/skills/china-market-researcher/SKILL.md): workflow skill · Coordinates market, industry, competition, underwriting, factors, thesis, and review. · `plugins/china-market-researcher/skills/china-market-researcher/SKILL.md`
- [Industry ETF snapshot](https://github.com/cyijun/china-financial-services/blob/main/plugins/china-market-researcher/skills/industry-etf-research/scripts/build_industry_etf_snapshot.py): snapshot generator · `plugins/china-market-researcher/skills/industry-etf-research/scripts/build_industry_etf_snapshot.py`
- [ETF report validation](https://github.com/cyijun/china-financial-services/blob/main/plugins/china-market-researcher/skills/industry-etf-research/scripts/validate_industry_etf_report.py): report validator · `plugins/china-market-researcher/skills/industry-etf-research/scripts/validate_industry_etf_report.py`

### Modeling workflow

- **Financial analysis**: shared skills
- [Model builder agent](https://github.com/cyijun/china-financial-services/blob/main/plugins/china-model-builder/agents/china-model-builder.md): agent role · `plugins/china-model-builder/agents/china-model-builder.md`
- [Modeling workflow](https://github.com/cyijun/china-financial-services/blob/main/plugins/china-model-builder/skills/china-model-builder/SKILL.md): workflow skill · Builds three-statement models, DCFs, comps, and valuation triangulation. · `plugins/china-model-builder/skills/china-model-builder/SKILL.md`
- [DCF engine](https://github.com/cyijun/china-financial-services/blob/main/plugins/china-model-builder/skills/china-dcf-model/scripts/dcf_model.py): model script · `plugins/china-model-builder/skills/china-dcf-model/scripts/dcf_model.py`
- [Workbook authoring](https://github.com/cyijun/china-financial-services/blob/main/plugins/china-model-builder/skills/xlsx-author/SKILL.md): Excel skill · `plugins/china-model-builder/skills/xlsx-author/SKILL.md`
- [Workbook audit](https://github.com/cyijun/china-financial-services/blob/main/plugins/china-model-builder/skills/audit-xls/SKILL.md): Excel audit skill · `plugins/china-model-builder/skills/audit-xls/SKILL.md`

### Data and validation

- [Provider routing](https://github.com/cyijun/china-financial-services/blob/main/plugins/china-research-methodology/skills/china-market-data/SKILL.md): data policy · Routes point-in-time data primarily to Tushare Pro and controlled AKShare supplements. · `plugins/china-research-methodology/skills/china-market-data/SKILL.md`
- **Market data providers**: external data · Tushare Pro is primary; AKShare supports public-web and ETF-history routes.
- **Qualitative sources**: external evidence · Web search and company announcements provide qualitative and audited inputs.
- [Evidence manifest](https://github.com/cyijun/china-financial-services/blob/main/plugins/china-research-methodology/skills/a-share-research-evidence/scripts/build_evidence_manifest.py): evidence control · `plugins/china-research-methodology/skills/a-share-research-evidence/scripts/build_evidence_manifest.py`
- [Thesis records](https://github.com/cyijun/china-financial-services/blob/main/plugins/china-research-methodology/skills/a-share-thesis-tracker/scripts/append_thesis_record.py): research control · `plugins/china-research-methodology/skills/a-share-thesis-tracker/scripts/append_thesis_record.py`
- [Runtime preflight](https://github.com/cyijun/china-financial-services/blob/main/scripts/preflight.py): environment check · Verifies runtime and credentials before data-dependent work. · `scripts/preflight.py`
- [Offline CI checks](https://github.com/cyijun/china-financial-services/blob/main/scripts/check.py): validation pipeline · Runs structural, manifest, and Python checks. · `scripts/check.py`
- [Live acceptance](https://github.com/cyijun/china-financial-services/blob/main/scripts/tushare_live_acceptance.py): manual validation · Read-only Tushare and AKShare acceptance remains separate from offline checks. · `scripts/tushare_live_acceptance.py`
- **Versioned outputs**: analyst deliverables · Example analyst outputs and sanitized live validation evidence are retained.

## Connections

- Runtime marketplaces → Market researcher agent: exposes
- Runtime marketplaces → Model builder agent: exposes
- Research methodology → Skill synchronizer: source skills
- Financial analysis → Skill synchronizer: source skills
- Equity research → Skill synchronizer: source skills
- Skill synchronizer → Research orchestration: vendors skills into
- Skill synchronizer → Modeling workflow: vendors skills into
- Market researcher agent → Research orchestration: runs
- Model builder agent → Modeling workflow: runs
- Provider routing → Market data providers: governs use of
- Runtime preflight → Market data providers: authorizes access
- Market data providers → Research orchestration: structured data
- Qualitative sources → Research orchestration: research inputs
- Research orchestration → Industry ETF snapshot: generates
- Industry ETF snapshot → ETF report validation: validated by
- Research orchestration → Evidence manifest: builds
- Research orchestration → Thesis records: updates
- Market data providers → Modeling workflow: financial inputs
- Modeling workflow → DCF engine: executes
- Modeling workflow → Workbook authoring: authors
- Workbook authoring → Workbook audit: audited by
- Workbook audit → Versioned outputs: releases
- Offline CI checks → Versioned outputs: validates repository outputs
- Live acceptance → Market data providers: read-only acceptance
