# caichen2333/wondertoken-userskill architecture

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

- Interactive diagram: https://gitdiagram.com/caichen2333/wondertoken-userskill
- Repository: https://github.com/caichen2333/wondertoken-userskill

## Overview

WonderToken is a local Agent Skill for a virtual pet-travel game backed by a remote game service. The main workflow is: a player gives an Agent a game instruction; the Skill’s client sends game-tool requests, and the Agent presents results. Local identity, Tokscale usage collection, pet-image import, and offline progress support that journey. README documents server-side travel, wallet, Soul, encounters, achievements, archives, and media capabilities, but the server implementation is not in this tree. Some capability nodes therefore point to the Skill directory; edges are limited to documented or indexed relationships.

Main entry points: [`skills/wondertoken/scripts/client.mjs`](https://github.com/caichen2333/wondertoken-userskill/blob/main/skills/wondertoken/scripts/client.mjs) (Tool client), [`skills/wondertoken`](https://github.com/caichen2333/wondertoken-userskill/tree/main/skills/wondertoken) (Travel and economy), [`skills/wondertoken/scripts/progress-workflow.mjs`](https://github.com/caichen2333/wondertoken-userskill/blob/main/skills/wondertoken/scripts/progress-workflow.mjs) (Progress workflow), [`skills/wondertoken/scripts/local.mjs`](https://github.com/caichen2333/wondertoken-userskill/blob/main/skills/wondertoken/scripts/local.mjs) (Local config)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Agent interaction"]
  node_agent["Agent host"]
  node_skill["Skill instructions<br/>[SKILL.md]"]
  node_client["Tool client<br/>[client.mjs]"]
end

subgraph group_local["Local player services"]
  node_localconfig["Local config<br/>[local.mjs]"]
  node_identity["Player identity<br/>[identity.mjs]"]
  node_usage["Tokscale snapshot"]
  node_offline[("Offline queue<br/>[offline-travel.mjs]")]
end

subgraph group_journey["Travel progress"]
  node_progressrun["Progress runner<br/>[progress-run.mjs]"]
  node_workflow["Progress workflow"]
  node_validation["Progress validation"]
  node_intent["Progress intent"]
  node_travelgame{{"Travel and economy"}}
end

subgraph group_companions["Pet and media"]
  node_petoptions["Pet choices<br/>[pet-options.mjs]"]
  node_petvisual["Pet visual import<br/>[pet-visual.mjs]"]
  node_media["Media upload<br/>[media-upload.mjs]"]
  node_world{{"Soul and world"}}
  node_archive["Archives and growth"]
end

node_player(("Player"))
node_service{{"Game service"}}

node_player -->|"gives instructions"| node_agent
node_agent -->|"uses"| node_skill
node_skill -.->|"invokes"| node_client
node_client -->|"calls tools"| node_service
node_client -->|"loads config"| node_localconfig
node_identity -->|"uses state"| node_localconfig
node_usage -->|"settles usage"| node_client
node_usage -->|"uses state"| node_localconfig
node_progressrun -->|"reconciles offline"| node_workflow
node_progressrun -->|"calls tools"| node_client
node_workflow -->|"syncs events"| node_offline
node_workflow -->|"calls tools"| node_client
node_validation -.->|"validates progress"| node_travelgame
node_intent -.->|"guides requests"| node_travelgame
node_client -->|"requests game actions"| node_travelgame
node_petoptions -->|"selects visuals"| node_petvisual
node_petvisual -->|"uploads image"| node_media
node_media -->|"posts media"| node_service
node_service -->|"supports encounters and Soul"| node_world
node_service -->|"stores journey records"| node_archive
node_service -->|"enforces travel rules"| node_travelgame
node_agent -->|"presents results"| node_archive

click node_skill "https://github.com/caichen2333/wondertoken-userskill/blob/main/skills/wondertoken/SKILL.md"
click node_client "https://github.com/caichen2333/wondertoken-userskill/blob/main/skills/wondertoken/scripts/client.mjs"
click node_localconfig "https://github.com/caichen2333/wondertoken-userskill/blob/main/skills/wondertoken/scripts/local.mjs"
click node_identity "https://github.com/caichen2333/wondertoken-userskill/blob/main/skills/wondertoken/scripts/identity.mjs"
click node_usage "https://github.com/caichen2333/wondertoken-userskill/blob/main/skills/wondertoken/scripts/tokscale-snapshot.mjs"
click node_offline "https://github.com/caichen2333/wondertoken-userskill/blob/main/skills/wondertoken/scripts/offline-travel.mjs"
click node_progressrun "https://github.com/caichen2333/wondertoken-userskill/blob/main/skills/wondertoken/scripts/progress-run.mjs"
click node_workflow "https://github.com/caichen2333/wondertoken-userskill/blob/main/skills/wondertoken/scripts/progress-workflow.mjs"
click node_validation "https://github.com/caichen2333/wondertoken-userskill/blob/main/skills/wondertoken/scripts/progress-validation.mjs"
click node_intent "https://github.com/caichen2333/wondertoken-userskill/blob/main/skills/wondertoken/scripts/progress-intent.mjs"
click node_travelgame "https://github.com/caichen2333/wondertoken-userskill/tree/main/skills/wondertoken"
click node_petoptions "https://github.com/caichen2333/wondertoken-userskill/blob/main/skills/wondertoken/scripts/pet-options.mjs"
click node_petvisual "https://github.com/caichen2333/wondertoken-userskill/blob/main/skills/wondertoken/scripts/pet-visual.mjs"
click node_media "https://github.com/caichen2333/wondertoken-userskill/blob/main/skills/wondertoken/scripts/media-upload.mjs"
click node_world "https://github.com/caichen2333/wondertoken-userskill/tree/main/skills/wondertoken"
click node_archive "https://github.com/caichen2333/wondertoken-userskill/tree/main/skills/wondertoken"

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_agent,node_skill,node_client toneBlue
class node_localconfig,node_identity,node_usage,node_offline toneAmber
class node_progressrun,node_workflow,node_validation,node_intent,node_travelgame toneMint
class node_petoptions,node_petvisual,node_media,node_world,node_archive toneRose
class node_player,node_service toneIndigo
```

## Components

### Agent interaction

- **Agent host**
- [Skill instructions](https://github.com/caichen2333/wondertoken-userskill/blob/main/skills/wondertoken/SKILL.md): `skills/wondertoken/SKILL.md`
- [Tool client](https://github.com/caichen2333/wondertoken-userskill/blob/main/skills/wondertoken/scripts/client.mjs): `skills/wondertoken/scripts/client.mjs`

### Local player services

- [Local config](https://github.com/caichen2333/wondertoken-userskill/blob/main/skills/wondertoken/scripts/local.mjs): `skills/wondertoken/scripts/local.mjs`
- [Player identity](https://github.com/caichen2333/wondertoken-userskill/blob/main/skills/wondertoken/scripts/identity.mjs): `skills/wondertoken/scripts/identity.mjs`
- [Tokscale snapshot](https://github.com/caichen2333/wondertoken-userskill/blob/main/skills/wondertoken/scripts/tokscale-snapshot.mjs): `skills/wondertoken/scripts/tokscale-snapshot.mjs`
- [Offline queue](https://github.com/caichen2333/wondertoken-userskill/blob/main/skills/wondertoken/scripts/offline-travel.mjs): `skills/wondertoken/scripts/offline-travel.mjs`

### Travel progress

- [Progress runner](https://github.com/caichen2333/wondertoken-userskill/blob/main/skills/wondertoken/scripts/progress-run.mjs): `skills/wondertoken/scripts/progress-run.mjs`
- [Progress workflow](https://github.com/caichen2333/wondertoken-userskill/blob/main/skills/wondertoken/scripts/progress-workflow.mjs): `skills/wondertoken/scripts/progress-workflow.mjs`
- [Progress validation](https://github.com/caichen2333/wondertoken-userskill/blob/main/skills/wondertoken/scripts/progress-validation.mjs): `skills/wondertoken/scripts/progress-validation.mjs`
- [Progress intent](https://github.com/caichen2333/wondertoken-userskill/blob/main/skills/wondertoken/scripts/progress-intent.mjs): `skills/wondertoken/scripts/progress-intent.mjs`
- [Travel and economy](https://github.com/caichen2333/wondertoken-userskill/tree/main/skills/wondertoken): `skills/wondertoken`

### Pet and media

- [Pet choices](https://github.com/caichen2333/wondertoken-userskill/blob/main/skills/wondertoken/scripts/pet-options.mjs): `skills/wondertoken/scripts/pet-options.mjs`
- [Pet visual import](https://github.com/caichen2333/wondertoken-userskill/blob/main/skills/wondertoken/scripts/pet-visual.mjs): `skills/wondertoken/scripts/pet-visual.mjs`
- [Media upload](https://github.com/caichen2333/wondertoken-userskill/blob/main/skills/wondertoken/scripts/media-upload.mjs): `skills/wondertoken/scripts/media-upload.mjs`
- [Soul and world](https://github.com/caichen2333/wondertoken-userskill/tree/main/skills/wondertoken): `skills/wondertoken`
- [Archives and growth](https://github.com/caichen2333/wondertoken-userskill/tree/main/skills/wondertoken): `skills/wondertoken`

### Other components

- **Player**
- **Game service**

## Connections

- Player → Agent host: gives instructions (evidence: `README.md`)
- Agent host → Skill instructions: uses (evidence: `README.md`)
- Skill instructions → Tool client: invokes
- Tool client → Game service: calls tools (evidence: `README.md`)
- Tool client → Local config: loads config (evidence: `skills/wondertoken/scripts/client.mjs`)
- Player identity → Local config: uses state (evidence: `skills/wondertoken/scripts/identity.mjs`)
- Tokscale snapshot → Tool client: settles usage (evidence: `skills/wondertoken/scripts/tokscale-snapshot.mjs`)
- Tokscale snapshot → Local config: uses state (evidence: `skills/wondertoken/scripts/tokscale-snapshot.mjs`)
- Progress runner → Progress workflow: reconciles offline (evidence: `skills/wondertoken/scripts/progress-run.mjs`)
- Progress runner → Tool client: calls tools (evidence: `skills/wondertoken/scripts/progress-run.mjs`)
- Progress workflow → Offline queue: syncs events (evidence: `skills/wondertoken/scripts/progress-workflow.mjs`)
- Progress workflow → Tool client: calls tools (evidence: `skills/wondertoken/scripts/progress-workflow.mjs`)
- Progress validation → Travel and economy: validates progress (evidence: `skills/wondertoken/scripts/progress-validation.mjs`)
- Progress intent → Travel and economy: guides requests (evidence: `skills/wondertoken/scripts/progress-workflow.mjs`)
- Tool client → Travel and economy: requests game actions (evidence: `README.md`)
- Pet choices → Pet visual import: selects visuals (evidence: `skills/wondertoken/scripts/pet-options.mjs`)
- Pet visual import → Media upload: uploads image (evidence: `skills/wondertoken/scripts/pet-visual.mjs`)
- Media upload → Game service: posts media (evidence: `skills/wondertoken/scripts/media-upload.mjs`)
- Game service → Soul and world: supports encounters and Soul (evidence: `README.md`)
- Game service → Archives and growth: stores journey records (evidence: `README.md`)
- Game service → Travel and economy: enforces travel rules (evidence: `README.md`)
- Agent host → Archives and growth: presents results (evidence: `README.md`)
