@bitget-ai/bitget-agent-skill 3.0.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/README.md +7 -7
- package/VERSION +1 -1
- package/package.json +1 -1
- package/references/discover-guide.md +1 -1
- package/scripts/install.js +97 -76
- package/skills/agentic/SKILL.md +155 -0
- package/skills/{SKILL.md → uta/SKILL.md} +2 -4
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,15 @@ All notable changes to `bitget-agent-skill` are documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [3.2.0] - 2026-09-02
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **`bitget-agentic` skill** — OAuth-based Bitget Agentic account skill, merged into this package alongside the existing UTA skill. Install with `--skill agentic` (or `--skill all` for both); default remains the UTA skill only, unchanged for existing users.
|
|
12
|
+
- **`scripts/install.js` `--skill` flag** — selects which skill(s) to install (`uta` default, `agentic`, or `all`), independent of `--target`.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
- `skills/SKILL.md` moved to `skills/uta/SKILL.md`; the Agentic skill lives alongside it at `skills/agentic/SKILL.md`.
|
|
16
|
+
|
|
8
17
|
## [3.0.0] - 2026-06-18
|
|
9
18
|
|
|
10
19
|
Full rewrite for the **Bitget Unified Trading Account (UTA / v3)** API. The version
|
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
|
|
28
28
|
---
|
|
29
29
|
|
|
30
|
-
> **Bitget Agent Hub** is Bitget's official open-source AI Agent ecosystem. This repository is `bitget-agent-skill` — the **skill surface** that teaches terminal AI agents when and how to correctly invoke Bitget tools. Ecosystem packages: [agent-skill](https://github.com/Bitget-AI/agent-skill) (this repo), [agent-cli](https://github.com/Bitget-AI/agent-cli), [agent-mcp](https://github.com/Bitget-AI/agent-mcp), [agent-sdk](https://github.com/Bitget-AI/agent-sdk), [bitget-signal](https://github.com/Bitget-AI/bitget-signal), [
|
|
30
|
+
> **Bitget Agent Hub** is Bitget's official open-source AI Agent ecosystem. This repository is `bitget-agent-skill` — the **skill surface** that teaches terminal AI agents when and how to correctly invoke Bitget tools. Ecosystem packages: [agent-skill](https://github.com/Bitget-AI/agent-skill) (this repo), [agent-cli](https://github.com/Bitget-AI/agent-cli), [agent-mcp](https://github.com/Bitget-AI/agent-mcp), [agent-sdk](https://github.com/Bitget-AI/agent-sdk), [bitget-signal](https://github.com/Bitget-AI/bitget-signal), [agent_hub](https://github.com/Bitget-AI/agent_hub).
|
|
31
31
|
|
|
32
32
|
`@bitget-ai/bitget-agent-skill` is Bitget's official AI trading skill file, giving Claude Code, Codex, and OpenClaw the judgment to use Bitget tools correctly — knowing when to invoke Bitget, how to break your intent into the right multi-step operations, how to handle confirmation before write actions, and what to do when something goes wrong. Pure markdown, runtime-free.
|
|
33
33
|
|
|
@@ -62,7 +62,7 @@ graph LR
|
|
|
62
62
|
Without the skill, `bgc` executes one command at a time. With the skill loaded, the AI can chain your intent into a sequence of operations across modules — check positions, evaluate conditions, place the order, handle the result — all in one go.
|
|
63
63
|
|
|
64
64
|
- **Trigger recognition in English and Chinese**: whether you say "buy BTC at market" or「帮我买 BTC」, the AI recognizes it as a Bitget trading instruction and calls the right tool automatically — no need to specify command syntax
|
|
65
|
-
- **v3 grammar and full reference**: the skill file includes the `bgc` v3 grammar (`bgc <tool> --action <name>`) and an auto-generated catalog of
|
|
65
|
+
- **v3 grammar and full reference**: the skill file includes the `bgc` v3 grammar (`bgc <tool> --action <name>`) and an auto-generated catalog of every operation — the AI knows which intent verb maps to which operation and how to fill in the parameters
|
|
66
66
|
- **Multi-step workflow**: "check my positions, and if I have no BTC open a 10x long" — the AI queries first, reasons, then places the order, showing `[CAUTION]` before every write operation and waiting for your confirmation
|
|
67
67
|
- **Paper trading and error handling**: tell the AI "use demo account" to switch to Bitget's sandbox automatically; when API errors occur, the AI knows whether to retry or surface the issue to you — instead of getting stuck
|
|
68
68
|
|
|
@@ -70,12 +70,12 @@ Without the skill, `bgc` executes one command at a time. With the skill loaded,
|
|
|
70
70
|
|
|
71
71
|
## Why a Skill (vs. just installing `bgc`)
|
|
72
72
|
|
|
73
|
-
The CLI alone gives the AI
|
|
73
|
+
The CLI alone gives the AI 14 intent verbs over the Unified Trading Account (89 operations) but no semantics — the assistant doesn't know **when** to reach for Bitget, **which** verb to use, or **how** to drive it safely.
|
|
74
74
|
|
|
75
75
|
The skill adds:
|
|
76
76
|
|
|
77
77
|
- A **trigger description** so Claude Code / Codex / OpenClaw automatically invokes the skill on any Bitget-relevant request — including casual phrasings (*"buy 0.1 BTC at market"*) and Chinese (*"查看我的持仓"*).
|
|
78
|
-
- The **v3 grammar** (`bgc <tool> --action <name> --<param> <value>`) and a **discover-first** workflow, plus a complete catalog of every verb, action, and parameter
|
|
78
|
+
- The **v3 grammar** (`bgc <tool> --action <name> --<param> <value>`) and a **discover-first** workflow, plus a complete catalog of every verb, action, and parameter.
|
|
79
79
|
- **Operational guidance** for write-safety (`--dry-run` / `--confirm`), close-direction rules, demo trading, error categories, and auth setup.
|
|
80
80
|
|
|
81
81
|
Result: you say *"buy 0.1 BTC at market on Bitget"* and it actually works — the assistant composes `bgc order --action place --category SPOT --symbol BTCUSDT --side buy --orderType market --qty 0.1`, previews it with `--dry-run`, confirms with you, then runs it.
|
|
@@ -86,9 +86,9 @@ Result: you say *"buy 0.1 BTC at market on Bitget"* and it actually works — th
|
|
|
86
86
|
|
|
87
87
|
| File | Purpose |
|
|
88
88
|
|---|---|
|
|
89
|
-
| `SKILL.md` | Top-level skill definition with trigger phrases (English + Chinese) so the AI knows when to invoke, plus the v3 grammar, the
|
|
89
|
+
| `SKILL.md` | Top-level skill definition with trigger phrases (English + Chinese) so the AI knows when to invoke, plus the v3 grammar, the 14-verb map, and the write-safety workflow. |
|
|
90
90
|
| `references/commands.md` | Auto-generated static catalog — every domain, verb, action, and parameter (with enums + descriptions), from the SDK's own `discover` surface. |
|
|
91
|
-
| `references/discover-guide.md` | How to navigate the live surface with `bgc discover` (the four rungs, search, `raw
|
|
91
|
+
| `references/discover-guide.md` | How to navigate the live surface with `bgc discover` (the four rungs, search, `raw`). |
|
|
92
92
|
| `references/trading-safety.md` | Close-direction rules (one-way/hedge), TP/SL, `qty` units, cancel-all, and withdrawal safety. |
|
|
93
93
|
| `references/auth-setup.md` | How to create a Bitget API key and configure environment variables. |
|
|
94
94
|
| `references/demo-trading.md` | How to use `--paper-trading` for safe rehearsal. |
|
|
@@ -250,6 +250,6 @@ MIT-licensed and free to use.
|
|
|
250
250
|
|
|
251
251
|
---
|
|
252
252
|
|
|
253
|
-
<sub>Part of the **[Bitget Agent Hub](https://github.com/Bitget-AI/
|
|
253
|
+
<sub>Part of the **[Bitget Agent Hub](https://github.com/Bitget-AI/agent_hub)** ecosystem — the official open-source AI Agent ecosystem from Bitget.<br/>
|
|
254
254
|
Trading Stack · Skill Surface. ⚠️ Trading cryptocurrency carries risk; you are responsible for any orders your AI agent places. Use demo account to practice safely before trading with real funds.<br/>
|
|
255
255
|
Foundation: [agent-sdk](https://github.com/Bitget-AI/agent-sdk) · Execution: [agent-cli](https://github.com/Bitget-AI/agent-cli) · Desktop: [agent-mcp](https://github.com/Bitget-AI/agent-mcp) · Market signals: [bitget-signal](https://github.com/Bitget-AI/bitget-signal)</sub>
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.
|
|
1
|
+
3.2.0
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bitget-ai/bitget-agent-skill",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"packageManager": "pnpm@8.14.1",
|
|
5
5
|
"description": "Official Bitget AI skill — teaches Claude Code, Codex, and OpenClaw when and how to drive the Bitget Unified Trading Account (UTA / v3) API through the `bgc` CLI from natural language. Run `npx @bitget-ai/bitget-agent-skill` to deploy into your AI tool's skill directory.",
|
|
6
6
|
"type": "module",
|
|
@@ -73,7 +73,7 @@ bgc discover --search withdraw
|
|
|
73
73
|
|
|
74
74
|
## Widening the surface
|
|
75
75
|
|
|
76
|
-
By default the CLI exposes `--modules all` at the **intent** surface (the
|
|
76
|
+
By default the CLI exposes `--modules all` at the **intent** surface (the 14 curated
|
|
77
77
|
verbs). Two ways to see more:
|
|
78
78
|
|
|
79
79
|
- **Hidden to-B modules** (`broker`, `inst_loan`) are NOT in `all` — name them
|
package/scripts/install.js
CHANGED
|
@@ -3,13 +3,16 @@
|
|
|
3
3
|
* Bitget Skill Installer
|
|
4
4
|
*
|
|
5
5
|
* Usage (run explicitly — no postinstall side effects):
|
|
6
|
-
* npx bitget-agent-skill
|
|
7
|
-
* npx bitget-agent-skill --interactive
|
|
8
|
-
* npx bitget-agent-skill --target all
|
|
9
|
-
* npx bitget-agent-skill --target claude
|
|
10
|
-
* npx bitget-agent-skill --target codex
|
|
11
|
-
* npx bitget-agent-skill --target openclaw
|
|
12
|
-
* npx bitget-agent-skill --target claude,codex
|
|
6
|
+
* npx bitget-agent-skill # default: uta skill, Claude Code only
|
|
7
|
+
* npx bitget-agent-skill --interactive # prompt to choose targets
|
|
8
|
+
* npx bitget-agent-skill --target all # install to all supported tools
|
|
9
|
+
* npx bitget-agent-skill --target claude # Claude Code only
|
|
10
|
+
* npx bitget-agent-skill --target codex # Codex only
|
|
11
|
+
* npx bitget-agent-skill --target openclaw # OpenClaw only
|
|
12
|
+
* npx bitget-agent-skill --target claude,codex # multiple targets
|
|
13
|
+
* npx bitget-agent-skill --skill agentic # install the Agentic (OAuth) skill instead
|
|
14
|
+
* npx bitget-agent-skill --skill uta,agentic # install both skills
|
|
15
|
+
* npx bitget-agent-skill --skill all # install all skills
|
|
13
16
|
*/
|
|
14
17
|
|
|
15
18
|
import { copyFileSync, mkdirSync, existsSync, readdirSync } from "node:fs";
|
|
@@ -22,49 +25,68 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
|
22
25
|
const PKG_ROOT = join(__dirname, "..");
|
|
23
26
|
const HOME = homedir();
|
|
24
27
|
|
|
28
|
+
// Installable skills — each copies its own SKILL.md (and optional reference
|
|
29
|
+
// files) into a per-skill subdirectory under the AI tool's skills root.
|
|
30
|
+
const SKILLS = {
|
|
31
|
+
uta: {
|
|
32
|
+
label: "UTA trading (manual API key)",
|
|
33
|
+
skillSrcDir: join(PKG_ROOT, "skills", "uta"),
|
|
34
|
+
skillDirName: "bitget-agent-skill",
|
|
35
|
+
refFiles: [
|
|
36
|
+
"commands.md",
|
|
37
|
+
"discover-guide.md",
|
|
38
|
+
"trading-safety.md",
|
|
39
|
+
"error-codes.md",
|
|
40
|
+
"auth-setup.md",
|
|
41
|
+
"demo-trading.md",
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
agentic: {
|
|
45
|
+
label: "Agentic sub-account (OAuth)",
|
|
46
|
+
skillSrcDir: join(PKG_ROOT, "skills", "agentic"),
|
|
47
|
+
skillDirName: "bitget-agentic",
|
|
48
|
+
refFiles: [],
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
|
|
25
52
|
// Skill destinations per AI tool
|
|
26
53
|
const TARGETS = {
|
|
27
54
|
claude: {
|
|
28
55
|
label: "Claude Code",
|
|
29
|
-
|
|
56
|
+
skillsRoot: join(HOME, ".claude", "skills"),
|
|
30
57
|
},
|
|
31
58
|
codex: {
|
|
32
59
|
label: "Codex",
|
|
33
|
-
|
|
60
|
+
skillsRoot: join(HOME, ".codex", "skills"),
|
|
34
61
|
},
|
|
35
62
|
openclaw: {
|
|
36
63
|
label: "OpenClaw",
|
|
37
|
-
|
|
64
|
+
skillsRoot: join(HOME, ".openclaw", "skills"),
|
|
38
65
|
},
|
|
39
66
|
};
|
|
40
67
|
|
|
41
|
-
|
|
42
|
-
"commands.md",
|
|
43
|
-
"discover-guide.md",
|
|
44
|
-
"trading-safety.md",
|
|
45
|
-
"error-codes.md",
|
|
46
|
-
"auth-setup.md",
|
|
47
|
-
"demo-trading.md",
|
|
48
|
-
];
|
|
49
|
-
|
|
50
|
-
function installTo(targetKey) {
|
|
68
|
+
function installTo(targetKey, skillKey) {
|
|
51
69
|
const target = TARGETS[targetKey];
|
|
52
|
-
const
|
|
70
|
+
const skill = SKILLS[skillKey];
|
|
71
|
+
const skillDir = join(target.skillsRoot, skill.skillDirName);
|
|
72
|
+
const refsDir = join(skillDir, "references");
|
|
53
73
|
|
|
54
|
-
mkdirSync(
|
|
55
|
-
mkdirSync(refsDir, { recursive: true });
|
|
74
|
+
mkdirSync(skillDir, { recursive: true });
|
|
56
75
|
|
|
57
|
-
const skillSrc = join(
|
|
58
|
-
copyFileSync(skillSrc, join(
|
|
76
|
+
const skillSrc = join(skill.skillSrcDir, "SKILL.md");
|
|
77
|
+
copyFileSync(skillSrc, join(skillDir, "SKILL.md"));
|
|
59
78
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
79
|
+
if (skill.refFiles.length > 0) {
|
|
80
|
+
mkdirSync(refsDir, { recursive: true });
|
|
81
|
+
for (const f of skill.refFiles) {
|
|
82
|
+
const src = join(PKG_ROOT, "references", f);
|
|
83
|
+
if (existsSync(src)) {
|
|
84
|
+
copyFileSync(src, join(refsDir, f));
|
|
85
|
+
}
|
|
64
86
|
}
|
|
65
87
|
}
|
|
66
88
|
|
|
67
|
-
console.log(` ✓ ${target.label} → ${join(
|
|
89
|
+
console.log(` ✓ ${target.label} (${skill.label}) → ${join(skillDir, "SKILL.md")}`);
|
|
68
90
|
}
|
|
69
91
|
|
|
70
92
|
async function promptTargets() {
|
|
@@ -73,7 +95,7 @@ async function promptTargets() {
|
|
|
73
95
|
console.log("\nBitget Skill — choose installation targets:\n");
|
|
74
96
|
const keys = Object.keys(TARGETS);
|
|
75
97
|
keys.forEach((k, i) => {
|
|
76
|
-
console.log(` ${i + 1}. ${TARGETS[k].label} (${TARGETS[k].
|
|
98
|
+
console.log(` ${i + 1}. ${TARGETS[k].label} (${TARGETS[k].skillsRoot})`);
|
|
77
99
|
});
|
|
78
100
|
console.log(` ${keys.length + 1}. All of the above`);
|
|
79
101
|
console.log();
|
|
@@ -103,48 +125,48 @@ async function promptTargets() {
|
|
|
103
125
|
});
|
|
104
126
|
}
|
|
105
127
|
|
|
128
|
+
function parseListFlag(args, name, validKeys) {
|
|
129
|
+
const arg = args.find((a) => a.startsWith(`--${name}=`) || a === `--${name}`);
|
|
130
|
+
if (!arg) return null;
|
|
131
|
+
const value =
|
|
132
|
+
arg === `--${name}` ? args[args.indexOf(`--${name}`) + 1] : arg.split("=")[1];
|
|
133
|
+
if (!value) return null;
|
|
134
|
+
if (value === "all") return Object.keys(validKeys);
|
|
135
|
+
const keys = value
|
|
136
|
+
.split(",")
|
|
137
|
+
.map((s) => s.trim())
|
|
138
|
+
.filter((k) => k in validKeys);
|
|
139
|
+
if (keys.length === 0) {
|
|
140
|
+
console.warn(
|
|
141
|
+
`Unknown ${name}(s): ${value}. Valid: ${Object.keys(validKeys).join(", ")}, all`
|
|
142
|
+
);
|
|
143
|
+
process.exit(1);
|
|
144
|
+
}
|
|
145
|
+
return keys;
|
|
146
|
+
}
|
|
147
|
+
|
|
106
148
|
async function main() {
|
|
107
149
|
const args = process.argv.slice(2);
|
|
108
150
|
const isInteractive = args.includes("--interactive");
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
if (targetArg) {
|
|
112
|
-
if (targetArg === "--target") {
|
|
113
|
-
targetValue = args[args.indexOf("--target") + 1];
|
|
114
|
-
} else {
|
|
115
|
-
targetValue = targetArg.split("=")[1];
|
|
116
|
-
}
|
|
117
|
-
}
|
|
151
|
+
const targetValue = parseListFlag(args, "target", TARGETS);
|
|
152
|
+
const skillValue = parseListFlag(args, "skill", SKILLS);
|
|
118
153
|
|
|
119
|
-
let
|
|
154
|
+
let selectedTargetKeys;
|
|
155
|
+
const selectedSkillKeys = skillValue || ["uta"];
|
|
120
156
|
|
|
121
157
|
if (isInteractive) {
|
|
122
158
|
// Interactive mode — prompt user
|
|
123
159
|
try {
|
|
124
|
-
|
|
160
|
+
selectedTargetKeys = await promptTargets();
|
|
125
161
|
} catch {
|
|
126
|
-
|
|
162
|
+
selectedTargetKeys = ["claude"];
|
|
127
163
|
}
|
|
128
164
|
} else if (targetValue) {
|
|
129
|
-
|
|
130
|
-
if (targetValue === "all") {
|
|
131
|
-
selectedKeys = Object.keys(TARGETS);
|
|
132
|
-
} else {
|
|
133
|
-
selectedKeys = targetValue
|
|
134
|
-
.split(",")
|
|
135
|
-
.map((s) => s.trim())
|
|
136
|
-
.filter((k) => k in TARGETS);
|
|
137
|
-
if (selectedKeys.length === 0) {
|
|
138
|
-
console.warn(
|
|
139
|
-
`Unknown target(s): ${targetValue}. Valid targets: ${Object.keys(TARGETS).join(", ")}, all`
|
|
140
|
-
);
|
|
141
|
-
process.exit(1);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
165
|
+
selectedTargetKeys = targetValue;
|
|
144
166
|
} else {
|
|
145
|
-
// Default postinstall: Claude Code only, silent on failure
|
|
167
|
+
// Default postinstall: Claude Code, uta skill only, silent on failure
|
|
146
168
|
try {
|
|
147
|
-
installTo("claude");
|
|
169
|
+
installTo("claude", "uta");
|
|
148
170
|
} catch (err) {
|
|
149
171
|
console.warn("Could not auto-install skill:", err.message);
|
|
150
172
|
}
|
|
@@ -153,31 +175,30 @@ async function main() {
|
|
|
153
175
|
|
|
154
176
|
console.log("\nInstalling Bitget skill...");
|
|
155
177
|
let ok = 0;
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
178
|
+
const total = selectedTargetKeys.length * selectedSkillKeys.length;
|
|
179
|
+
for (const targetKey of selectedTargetKeys) {
|
|
180
|
+
for (const skillKey of selectedSkillKeys) {
|
|
181
|
+
try {
|
|
182
|
+
installTo(targetKey, skillKey);
|
|
183
|
+
ok++;
|
|
184
|
+
} catch (err) {
|
|
185
|
+
console.warn(` ✗ ${TARGETS[targetKey].label} (${SKILLS[skillKey].label}): ${err.message}`);
|
|
186
|
+
}
|
|
162
187
|
}
|
|
163
188
|
}
|
|
164
|
-
console.log(`\nDone — installed
|
|
189
|
+
console.log(`\nDone — installed ${ok} of ${total} target/skill combinations.`);
|
|
165
190
|
|
|
166
|
-
if (
|
|
191
|
+
if (selectedTargetKeys.includes("claude")) {
|
|
167
192
|
console.log(
|
|
168
193
|
"\nClaude Code: restart Claude Code to pick up the skill, or run:\n" +
|
|
169
194
|
" claude skills list"
|
|
170
195
|
);
|
|
171
196
|
}
|
|
172
|
-
if (
|
|
173
|
-
console.log(
|
|
174
|
-
"\nCodex: skill will be loaded automatically from ~/.codex/skills/bitget-agent-skill/"
|
|
175
|
-
);
|
|
197
|
+
if (selectedTargetKeys.includes("codex")) {
|
|
198
|
+
console.log("\nCodex: skill will be loaded automatically from ~/.codex/skills/");
|
|
176
199
|
}
|
|
177
|
-
if (
|
|
178
|
-
console.log(
|
|
179
|
-
"\nOpenClaw: skill will be loaded automatically from ~/.openclaw/skills/bitget-agent-skill/"
|
|
180
|
-
);
|
|
200
|
+
if (selectedTargetKeys.includes("openclaw")) {
|
|
201
|
+
console.log("\nOpenClaw: skill will be loaded automatically from ~/.openclaw/skills/");
|
|
181
202
|
}
|
|
182
203
|
}
|
|
183
204
|
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: bitget-agentic
|
|
3
|
+
description: >
|
|
4
|
+
Use for Bitget Agentic account (AI Agent OAuth path, not manual API keys).
|
|
5
|
+
Invoke when the user connects an Agentic account, re-authorizes, says Connect Agent,
|
|
6
|
+
reports Key invalid/expired, cannot trade, asks about MCP auth status, or trades
|
|
7
|
+
inside an Agentic account via @bitget-ai/bitget-agent-mcp — even without saying
|
|
8
|
+
"Bitget". Chinese triggers: 连接 Agent、重新授权、Agentic 账户、Agent 子账户、Agentic
|
|
9
|
+
子账户、Agent 账户、AI 账户、智能交易账户、Key 失效、连不上、Connect Agent、帮我下单、
|
|
10
|
+
查 Agentic 余额/持仓. Do NOT use for generic UTA trading
|
|
11
|
+
with env API keys (@bitget-ai/bitget-agent-skill). After OAuth, use this skill for
|
|
12
|
+
runtime auth and trading safety.
|
|
13
|
+
metadata:
|
|
14
|
+
version: 1.2.0
|
|
15
|
+
author: Bitget
|
|
16
|
+
updated: 2026-08-14
|
|
17
|
+
requires:
|
|
18
|
+
bins: ["node", "npx"]
|
|
19
|
+
node: ">=20"
|
|
20
|
+
packages:
|
|
21
|
+
mcp: "@bitget-ai/bitget-agent-mcp"
|
|
22
|
+
license: MIT
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
# Bitget Agentic · 本地 Skill
|
|
26
|
+
|
|
27
|
+
**Agentic 账户专用** · OAuth + `@bitget-ai/bitget-agent-mcp` · **不是** `@bitget-ai/bitget-agent-skill`
|
|
28
|
+
|
|
29
|
+
**分工:** 本 Skill 负责 OAuth 成功后的运行时授权状态、重新授权、交易确认与安全边界。
|
|
30
|
+
|
|
31
|
+
**Rule Priority:** Safety > 状态诚实 > 响应速度
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## 产品约束(内化即可)
|
|
36
|
+
|
|
37
|
+
- 1 MCP = 1 Agentic 账户 = 1 套凭证(OAuth 落盘,**禁止** env 手填 Key)
|
|
38
|
+
- 多 Key 并存;再 OAuth 发新 Key、不删旧 Key;本机绑定被**覆盖**(其他 Agent/设备不受影响)
|
|
39
|
+
- Web 只读 Key 数 → Agent **不得**声称知道 Web 有几把 Key
|
|
40
|
+
- 断链 / Key 失效 → **完整 OAuth**;无一键重发、无静默重链
|
|
41
|
+
- Scope 外:提币、主账户、主→子划转 → Agent **不做**
|
|
42
|
+
- OAuth 仅 MCP/SDK 监听 callback;**禁止** LLM 拼 URL / 监听端口 / 收粘贴三件套
|
|
43
|
+
- 凭证落盘后可**立即**交易,**无需重启 Agent**
|
|
44
|
+
- 未授权时行情等无需 Key 的公开能力仍可用;交易类能力不可用
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## 1. 授权状态
|
|
49
|
+
|
|
50
|
+
先 `get_auth_status`,再说话。
|
|
51
|
+
|
|
52
|
+
| 状态 | 交易 | 用户提示与下一步 |
|
|
53
|
+
|------|------|------|
|
|
54
|
+
| 未授权 | 否(`market` 除外) | 提示「需要先完成 Agentic 授权,我来打开浏览器」→ 调授权 tool |
|
|
55
|
+
| 已授权 | 是 | 确认状态与交易工具可用后再交易 |
|
|
56
|
+
| 凭证失效 | 否 | 提示「凭证已失效,需重新授权」→ 调授权 tool |
|
|
57
|
+
|
|
58
|
+
API 鉴权失败但 status 仍「已授权」→ 按**失效**处理。access token 24h 过期**不影响**已有交易 Key。
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## 2. 重新授权(核心)
|
|
63
|
+
|
|
64
|
+
**触发:** 重新授权 / Connect / Key 失效 / 连不上 / 帮我连接 Bitget
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
get_auth_status → 一句告知会替换本机绑定、Web 旧 Key 仍保留
|
|
68
|
+
→ 立即调 MCP authorize_start → 用 Bash 打开 authorizeUrl(勿只贴文本让用户复制)
|
|
69
|
+
→ 调 MCP authorize_wait → App 设备鉴权 → 确认已授权
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**打开 authorizeUrl:** 拿到 `authorize_start` 返回的 `authorizeUrl` 后,立即用 Bash 打开,不等用户手动复制粘贴:
|
|
73
|
+
- macOS: `open "<authorizeUrl>"`
|
|
74
|
+
- Linux: `xdg-open "<authorizeUrl>"`
|
|
75
|
+
- Windows: `start "" "<authorizeUrl>"`
|
|
76
|
+
|
|
77
|
+
若 Bash 打开失败(无 GUI/无浏览器/命令不存在),才回退成把链接文本发给用户自行打开。**URL 本身必须原样使用 MCP 返回值,禁止 LLM 自行拼接或修改。**
|
|
78
|
+
|
|
79
|
+
**成功判定:** 只有 MCP 明确返回已授权且凭证已保存,才算成功;打开浏览器 ≠ 授权成功。否则提示「授权未完成」。
|
|
80
|
+
|
|
81
|
+
**提示(二次 OAuth 前):** 「再次授权会更新本机凭证;Web 上旧 Key 默认保留;其他 Agent/设备不受影响。」
|
|
82
|
+
|
|
83
|
+
**禁止:** 只给说明链接/文字而不真正调 MCP 授权 tool · 让用户粘贴 Key · 承诺一键重发
|
|
84
|
+
|
|
85
|
+
**后端要点:** 成功 = MCP 已授权 + 浏览器走完;仅浏览器成功 → 再调 OAuth。Web 点「绑定更多 Agent」≠ 本机已连,须本机 MCP callback。
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## 3. 边界 Case
|
|
90
|
+
|
|
91
|
+
### 3a. 用户主动操作(用户明说即可感知,不是失败)
|
|
92
|
+
|
|
93
|
+
| 场景 | 动作 | 提示(对用户,可改写) |
|
|
94
|
+
|------|------|------------------------|
|
|
95
|
+
| H 只问行情 | `market` | 不强迫 OAuth |
|
|
96
|
+
| J 要断链 | 引导 Web 删 Key | 「请到 Agentic 账户 API 管理删 Key;先处理挂单/持仓。删除 Key 会取消该 Agent 的交易权限,不会自动平仓,也不会自动撤销挂单。」 |
|
|
97
|
+
| F 二次 OAuth | 告知 + 调 OAuth | 见 §2 |
|
|
98
|
+
|
|
99
|
+
### 3b. 失败处理(只按错误码归因,无错误码一律兜底)
|
|
100
|
+
|
|
101
|
+
**错误码 → 动作:** 调用授权/交易 tool 返回明确错误码时,按错误码处理,Agent 不需要猜背后原因:
|
|
102
|
+
|
|
103
|
+
| 错误码 | 动作 | 提示 |
|
|
104
|
+
|--------|------|------|
|
|
105
|
+
| `NOT_AUTHORIZED`(A 未授权要交易) | 调 OAuth | 「需要先完成 Agentic 授权,我来打开浏览器。」 |
|
|
106
|
+
| `AUTH_CANCELLED`(B 用户取消) | 再调 OAuth | 「这次没保存凭证,要我再试一次吗?」 |
|
|
107
|
+
| `CREDENTIALS_INVALID`(D Web 删 Key / Key 失效) | 调 OAuth | 「Key 已在服务端失效,需重新授权。」 |
|
|
108
|
+
| `RATE_LIMITED`(N 限流) | 退避 | 「请求过快,稍后再试。」**勿** OAuth |
|
|
109
|
+
| `INSUFFICIENT_BALANCE`(O 余额不足) | 引导 Web 划转 | 「请在 Web 从主账户划转到 Agentic 账户。」 |
|
|
110
|
+
| `MCP_CONNECTION_ERROR`(M MCP 未启动) | 排查 MCP | 「MCP 未运行,请检查 Node 20+ 与 MCP 配置。」 |
|
|
111
|
+
| 配额错误码(K 配额满) | Use existing | 「Agentic 账户已满,请选已有账户。」 |
|
|
112
|
+
| KYC 错误码(L KYC 未完成) | 完成后再 OAuth | 「请先完成 KYC。」 |
|
|
113
|
+
| 工具不存在 / 方法不存在(M2 MCP 未安装/未注册) | 引导安装并注册 | 「MCP 工具不存在:请运行 npm i -g @bitget-ai/bitget-agent-mcp 安装,再在客户端注册(如 Claude Code 执行 claude mcp add bitget-agentic -- npx -y @bitget-ai/bitget-agent-mcp),然后重启会话或用 /mcp 重连。」 |
|
|
114
|
+
|
|
115
|
+
**兜底(无明确错误码):** 通用失败 / 超时 / 回调未收到 / 浏览器状态不确定时,Agent 无法知道具体原因(是取消、是没点完、是页面关了),**不猜原因**,统一:
|
|
116
|
+
> 「授权未完成。请确认浏览器授权步骤已完成,要我再发起一次吗?」
|
|
117
|
+
|
|
118
|
+
并重新走一遍授权流程(§2)。
|
|
119
|
+
|
|
120
|
+
**其他错误码归因:** 设备鉴权失败 → 不发 Key → 查 App 同账号 → 再 OAuth(**不是** Key 失效);`MCP 缺失 vs 未启动`:报"工具不存在/方法不存在"是未安装或未注册(走 M2),不是未启动,两者都不是授权问题,不要引导重新授权。
|
|
121
|
+
|
|
122
|
+
### 3c. 其他状态(非错误)
|
|
123
|
+
|
|
124
|
+
| 场景 | 动作 | 说明 |
|
|
125
|
+
|------|------|------|
|
|
126
|
+
| C 浏览器成功但 MCP 未收到 | 再调 OAuth | Agent 只能看到"回调未收到",不能确认浏览器是否真成功;无明确错误码时走兜底 |
|
|
127
|
+
| E Web 有 Key 本机无 | 调 OAuth | 「Web 已连上不等于本机 Agent;请重新授权,不要复制 Key。」 |
|
|
128
|
+
| G Key 归零 | 调 OAuth | 「Agentic 账户已断链,需完整重新授权。」 |
|
|
129
|
+
| P 云端 Agent | 告知用户后结束,不触发 OAuth | 「云端流程暂未开放,`[待填:resource endpoint]` 定义中;请先使用本地客户端。」 |
|
|
130
|
+
| Q 历史户 / V Playbook / W 手填 Key / T 多 Agent / X 0 余额 | `[待填:各场景处理规则]` | 规则待补充,运行时不要自行假设处理方式 |
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## 4. 交易(已授权)
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
get_auth_status → discover → dryRun → 主网确认卡 → 用户确认「是/确认」→ 执行(高-risk + confirm)
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
**确认卡必含:** 交易对 · 方向 · 数量 · 价格类型 · 账户 · `[主网]` · 「确认执行?」
|
|
141
|
+
「直接帮我做」≠ 预授权。用户必须明确回复确认后才执行。
|
|
142
|
+
|
|
143
|
+
**要点:** 平仓先查仓 · hedge 要 posSide · Spot 市价买 qty=USDT · 持仓须带**强平价** · risk 类错误勿加仓
|
|
144
|
+
|
|
145
|
+
**首次交易:** 用户表达交易意图时先确认 Agentic 账户资金、先查余额;资金不足引导用户手动入金后再交易;Agent 不操作主账户。
|
|
146
|
+
|
|
147
|
+
**提币(必拒):** 「Agentic 账户不含提币;请 Web 主账户操作,Agentic 账户资金须先划转到主账户。」提币、主账户操作、主→子划转均需用户手动完成,Agent 不代办。
|
|
148
|
+
|
|
149
|
+
**错误 category:** auth→OAuth(D/E) · balance→O · rate→N · risk→停 · param→改参 · network→重试
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## 5. 禁止(违反即错)
|
|
154
|
+
|
|
155
|
+
静默重链 / 粘贴或 env 配 Key / 代删 Web Key / 失效仍交易 / 限流当失效 / 只给链接不调 OAuth / LLM 监听 callback / 无法确认失败原因时猜测归因
|
|
@@ -46,7 +46,7 @@ transfers, withdrawals) needs API credentials as environment variables. See
|
|
|
46
46
|
bgc <tool> [--action <name>] [--<param> <value> ...] [global flags]
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
- **One verb per call.** There are
|
|
49
|
+
- **One verb per call.** There are 14 intent verbs (e.g. `market`, `order`,
|
|
50
50
|
`position`, `account_overview`, `transfer_funds`, `withdraw`).
|
|
51
51
|
- **`--action`** picks the intent for an action-routed verb
|
|
52
52
|
(`bgc order --action place`, `bgc position --action closeAll`).
|
|
@@ -90,7 +90,7 @@ On error, branch on `error.category`: `auth`/`param` → fix the request and res
|
|
|
90
90
|
`balance`/`risk` → surface to the user (cannot self-heal); `rate`/`network` → back
|
|
91
91
|
off and retry; `config` → check account mode / credentials. See `references/error-codes.md`.
|
|
92
92
|
|
|
93
|
-
## The
|
|
93
|
+
## The 14 verbs
|
|
94
94
|
|
|
95
95
|
| Domain | Verb | Use for |
|
|
96
96
|
|--------|------|---------|
|
|
@@ -108,8 +108,6 @@ off and retry; `config` → check account mode / credentials. See `references/er
|
|
|
108
108
|
| subaccount | `subaccount` | Create/list sub-accounts, manage their API keys & assets |
|
|
109
109
|
| loan | `loan` | Crypto loans: borrow, repay, orders, collateral |
|
|
110
110
|
| tax | `tax` | Tax/transaction records |
|
|
111
|
-
| broker | `broker` | *(hidden, to-B)* Broker sub-accounts & API keys — opt in: `--modules broker` |
|
|
112
|
-
| instloan | `inst_loan` | *(hidden, to-B)* Institutional loans — opt in: `--modules instloan` |
|
|
113
111
|
|
|
114
112
|
Use `discover` for the actions and exact params of any verb.
|
|
115
113
|
|