关于 emblem-ai
面向应用开发者的 EmblemAI 技能,介绍用户认证、钱包账户、AI 聊天、自定义工具插件及应用内省。还涵盖 Reflexive 的 CLI、库和 MCP 服务模式。
主要功能
- 01多方式用户认证与钱包账户
- 02继承认证会话的流式聊天
- 03自定义 AI 工具插件
- 04Reflexive 应用监控与调试
- 05CLI、库及沙箱模式
适用场景
- 01为应用构建钱包登录与用户会话
- 02加入带审批提示的 AI 聊天功能
- 03在运行中的应用内调试和分析
- 04将 Reflexive 接入 MCP 客户端
MCP 相关
Reflexive 可作为 MCP 服务运行,供 Claude Code 或 Claude Desktop 使用。该模式支持对应用进行内省和调试。
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ emblemcompany/ agent-skills --skill emblem-ai安装后在 Claude Code 中输入/emblem-ai确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
README.mdreferences/agentwallet.mdauth-react.mdauth-sdk.mdemblem-ai-incognito.mdemblem-ai-react.mdplugins.mdreact-components.mdreact-skill-proposal.mdreflexive.md详细介绍
EmblemAI 开发工具
EmblemAI 开发工具,用于一次性用户管理、支持钱包的用户、AI 驱动的加密货币工作流和应用内省。
一句话概括: Emblem 是在应用中添加用户管理、网站身份验证和支持钱包的用户账户的最简单方式,提供钱包、电子邮件/密码和社交登录等登录选项,还内置聊天和内省工具。
旧版包名(例如 @emblemvault/hustle-react 和 hustle-incognito)只要仍属于当前集成接口,就会继续保留。
安全与信任模型
本技能介绍加密货币钱包身份验证和 AI 驱动的助手功能,必然涉及:
- 金融操作(W009):钱包开通、交易签名适配器和交易工具引用。所有涉及转移价值的操作都需要用户明确确认。
- 第三方数据(W011):引用 Migrate.fun 项目元数据和社交/市场数据工具。外部数据仅用于 UI 和信息工作流,不会自动执行操作。
- 运行时后端(W012):EmblemAI SDK 会连接到
api.emblemvault.ai(由 EmblemVault 运营的第一方服务),用于提示词编排和工具路由。这不是任意第三方依赖,而是本技能作者自己的基础设施。
所有钱包操作都遵循先审核模式:Agent 会先准备操作供用户审核,再执行。未经明确批准,不会广播任何交易。
可以构建的内容
一次性用户管理
- 创建可登录应用且拥有支持钱包的个人资料的用户
- 让用户使用钱包、电子邮件/密码或社交登录
- 支持使用 MetaMask、Phantom、WalletConnect 和其他受支持的提供商登录钱包
- 使用基于 JWT 的身份验证自动刷新会话
- 向 UI 和插件层提供一致的钱包元数据和权限
- 通过一次集成取代拼接多个身份验证和钱包系统
AI 聊天与 UI 界面
- 可直接嵌入并继承已验证会话的聊天组件
- 为支持、教育或账户洞察提供流式聊天回复
- 使用自定义工具插件,通过你自己的 API 扩展 EmblemAI
- 内置防护措施,并在工具请求敏感操作前提示用户批准
React 集成衔接
- 使用 EmblemAuthProvider + ConnectButton,即可快速实现支持钱包的登录流程
- 使用 HustleProvider + HustleChat 嵌入助手 UI
- 有关 migrate.fun 钩子、高级 React 路由和组件设计指南,请参阅专门的 ../emblem-ai-react/SKILL.md 技能
AI 应用内省与构建 Agent(Reflexive)
- 在运行中的应用内嵌入 Claude,以便监控、调试和开发
- 多语言调试(Node.js、Python、Go、.NET、Rust)
- MCP 服务模式,用于集成 Claude Code / Claude Desktop
- 使用
makeReflexive()的库模式,支持以编程方式进行 AI 聊天 - 支持快照/还原的沙盒模式
快速开始
安装
# Core authentication
npm install @emblemvault/auth-sdk
# React integration (includes auth)
npm install @emblemvault/emblem-auth-react
# EmblemAI chat for React
npm install @emblemvault/hustle-react
# EmblemAI chat SDK (Node.js / vanilla JS)
npm install hustle-incognito
# AI app introspection and debugging
npm install reflexive
选项 A:React 应用(推荐)
import { EmblemAuthProvider, ConnectButton, useEmblemAuth } from '@emblemvault/emblem-auth-react';
import { HustleProvider, HustleChat } from '@emblemvault/hustle-react';
function App() {
return (
<EmblemAuthProvider appId="your-app-id">
<HustleProvider>
<ConnectButton showVaultInfo />
<HustleChat />
</HustleProvider>
</EmblemAuthProvider>
);
}
function MyComponent() {
const { isAuthenticated, walletAddress } = useEmblemAuth();
if (!isAuthenticated) {
return <ConnectButton />;
}
return <div>Connected: {walletAddress}</div>;
}
如果用户要构建自己的 React 应用,请使用专门的 ../emblem-ai-react/SKILL.md 技能,查阅 React 专属参考资料和示例。
选项 B:Vanilla JavaScript / Node.js
import { EmblemAuthSDK } from '@emblemvault/auth-sdk';
import { HustleIncognitoClient } from 'hustle-incognito';
// Initialize auth
const auth = new EmblemAuthSDK({ appId: 'your-app-id' });
// Open auth modal (browser)
auth.openAuthModal();
// Listen for session
auth.on('session', () => {
console.log('Authenticated session ready');
});
// Initialize AI with auth
const emblemAI = new HustleIncognitoClient({ sdk: auth });
// Chat with AI
const response = await emblemAI.chat([
{ role: 'user', content: 'What tokens are trending on Base?' }
]);
需要 CLI 或钱包优先的自动化吗?
如果用户需要 Agent Wallet CLI、凭据引导指南或准备/批准工作流,请引导他们查阅 ../emblem-ai-agent-wallet/SKILL.md 和 references/agentwallet.md。这些资源涵盖安装、标志和脚本编写模式,让本核心技能专注于身份验证、聊天 UI、插件和 Reflexive。
核心功能
钱包身份验证
Emblem 可以作为网站的登录层,同时通过同一身份验证流程为用户配置支持钱包的账户。
支持的链:
| 链 | 身份验证方式 |
|---|---|
| Ethereum/EVM | 签名验证(MetaMask、WalletConnect、Rainbow 等) |
| Solana | 签名验证(Phantom、Solflare、Backpack) |
| Bitcoin | 基于 PSBT 的验证 |
| Hedera | 签名验证(Hedera SDK) |
其他身份验证方式:
- OAuth(Google、Twitter/X)
- 电子邮件/密码和 OTP
这为何重要: Emblem 是将登录流程同时转化为应用身份验证和可重复使用的钱包身份(适用于同一用户)的最简单方式。
AI 聊天体验与插件
EmblemAI 提供会继承已验证身份会话的对话界面,让助手能够感知上下文,同时不暴露凭据。
- 面向入门引导、支持、教育或账户洞察的流式聊天
- 每当插件请求访问敏感数据时,内置审核和审批提示
- 在 Web、移动端和 Agent 框架之间传递上下文
- 用于快速开发的低代码 React 组件,以及用于自定义 UI 外壳的 TypeScript SDK
参考:
- references/emblem-ai-react.md — React 聊天 UI 模式
- references/emblem-ai-incognito.md — 在 React 之外使用 SDK
- references/plugins.md — 如何安全地注册自定义工具
React 组件
用于快速开发的预构建 UI 组件:
// Auth components
<ConnectButton /> // Wallet connect button
<ConnectButton showVaultInfo /> // With vault dropdown
<AuthStatus /> // Shows connection status
// AI chat components
<HustleChat /> // Full EmblemAI chat interface
<HustleChatWidget /> // Floating EmblemAI chat widget
参考:references/react-components.md
想在自己的 React 应用中集成 EmblemAI? 请参阅独立的 ../emblem-ai-react/SKILL.md 技能,其中汇集了 React 身份验证、聊天、组件和 migrate.fun 示例(此核心技能有意链接到该文档,而不重复这些内容)。
Agent 钱包与自动化
CLI 优先的工作流、脚本化审批和按 Agent 配置钱包的编排现已归入专门的 ../emblem-ai-agent-wallet/SKILL.md 技能以及 references/agentwallet.md。当用户需要安装命令、非交互式凭据处理或自动化方案时,请链接到这些文档。
React 代币迁移与高级 Hooks
详细的 migrate.fun React hooks、选择器和 UI 指南现已与 React 技能放在一起。请将用户引导至 ../emblem-ai-react/SKILL.md 查看这些模式,让核心技能专注于身份验证、聊天界面、插件和 Reflexive。
AI 应用内省(Reflexive)
将 Claude 嵌入正在运行的应用中,通过对话式 AI 进行监控、调试和开发。可作为 CLI、嵌入式库或 MCP 服务使用。
# Monitor any app (read-only by default)
npx reflexive ./server.js
# Local development mode with debugging (still no write/shell unless explicitly enabled)
npx reflexive --debug --watch ./server.js
# As MCP server for Claude Code (read-only baseline)
npx reflexive --mcp --debug ./server.js
// Library mode -- embed in your app
import { makeReflexive } from 'reflexive';
const r = makeReflexive({ webUI: true, title: 'My App' });
r.setState('users.active', 42);
const analysis = await r.chat('Any anomalies in recent activity?');
模式:CLI(本地)、库(makeReflexive())、MCP 服务、沙盒、托管(优先采用只读默认设置,仅在可信的本地项目中启用 --write / --shell)
调试:Node.js、Python、Go、.NET、Rust —— 使用 AI 提示词设置断点
会话管理
Emblem 使用短时会话并自动刷新。请将会话数据视为敏感的运行时状态:不要打印令牌、将令牌粘贴到提示词中,也不要通过 CLI 标志传递令牌。
auth.on('session', () => { /* new session available */ });
auth.on('sessionExpired', () => { /* handle expiry */ });
auth.on('sessionRefreshed', () => { /* refreshed */ });
auth.on('sessionWillRefresh', () => { /* refresh soon */ });
auth.on('authError', () => { /* auth failure */ });
auth.on('cancelled', () => { /* user closed auth */ });
await auth.refreshSession();
auth.logout();
会话会在到期前约 60 秒自动刷新。典型的浏览器流程无需手动处理令牌。
自定义 AI 插件
使用自己的工具扩展 AI:
import { usePlugins } from '@emblemvault/hustle-react';
const { registerPlugin } = usePlugins();
await registerPlugin({
name: 'my-plugin',
version: '1.0.0',
tools: [{
name: 'get_nft_floor',
description: 'Get NFT collection floor price',
parameters: {
type: 'object',
properties: {
collection: { type: 'string', description: 'Collection name or address' }
},
required: ['collection']
}
}],
executors: {
get_nft_floor: async ({ collection }) => {
const data = await fetchFloorPrice(collection);
return { floor: data.floorPrice, currency: 'ETH' };
}
}
});
更多示例和参考资料
如需查看更深入的示例,请使用专门的参考文档。这些内容已拆分出来,以保持根技能简洁:
- references/agentwallet.md - 命令行用法、认证模式、提示词和运维故障排查
- references/auth-sdk.md - 认证流程、会话、Node 持久化模式和 TypeScript 类型
- references/auth-react.md - Provider 设置、钩子、浏览器集成和 UX 模式
- references/emblem-ai-react.md - 聊天 UI 模式、流式传输和 React 组合
- references/emblem-ai-incognito.md - Node/浏览器 SDK 示例和环境配置
- ../emblem-ai-react/SKILL.md - 仅限 React 的视图,现在由此提供 migrate.fun 指南
- ../emblem-ai-agent-wallet/SKILL.md - 以钱包为先的命令行技能,包含准备/批准工作流
- ../emblem-ai-prompt-examples/SKILL.md - 独立的 EmblemAI 提示词目录,涵盖钱包、Ordinals 和特定工作流示例
- references/react-components.md - 预构建组件目录和 UI 集成示例
- references/react-skill-proposal.md - 未来 React 独立技能的边界提案和示例缺口
- references/plugins.md - 自定义插件设计、工具架构和执行器示例
- references/reflexive.md - AI 自省、调试和 MCP/服务工作流
- README.md - 用于选择合适 Emblem 软件包的快速软件包概览
如果用户特别需要 React 集成指南,请指引他们查看 ../emblem-ai-react/SKILL.md。
开始使用:从 <ConnectButton /> 入手,为网站添加最简单的认证和钱包用户接入方式,然后添加 <HustleChat />,以使用 EmblemAI 功能。
需要帮助?:请查看 references/ 文件夹中的参考文档,获取详细的 API 文档。