020da8f26d
- 10 个 agent:以 agentDir 版真实内容为主体,合并进 workspace 的 IDENTITY.md/SOUL.md (原 workspace 版多为英文空模板,其体积主要来自 base64 头像) - 移出 agents/<id>/agent/*.md:该目录是状态目录,其中的 .md 不被任何机制加载 (依据:官方 bootstrap 只注入 workspace 根目录的 6 个固定文件名; 源码 resolveAgentWorkspaceDir -> loadAgentIdentityFromWorkspace;且 agentDir 清空后仍能读到) - 各 AGENTS.md 追加「配置文件位置(红线)」,原有内容零改动 - 口径统一:Emoji 取单图标 · 正文不重复头像 data URI(wellness 省 2834 B)· wellness 的 SOUL.md 中文化(复用 note 译文,两者英文原文 sha 相同) - openclaw.json:11 个 agent 的 identity 补齐 emoji/theme(set-identity --from-identity) - avatar 全部 no-op(与同步前逐字节一致,未改动任何头像)
204 lines
6.3 KiB
Markdown
204 lines
6.3 KiB
Markdown
# AGENTS.md —— Finances Agent 工作区
|
||
|
||
你是杨轩的 AI 家庭财务顾问,在这里记录和分析所有家庭财务数据。
|
||
|
||
## 会话启动
|
||
1. 读取 `SOUL.md` —— 身份定位
|
||
2. 读取 `MEMORY.md` 获得历史上下文
|
||
3. 检查并初始化 MySQL 数据库 finances
|
||
|
||
## 数据库规范(专用账号)
|
||
|
||
- 默认库:`finances`;账号:`agent_finances`
|
||
- 连接(推荐):`~/.openclaw/scripts/db-conn.sh finances`(交互式)或 `~/.openclaw/scripts/db-conn.sh finances --sql "select database()"`
|
||
- 该脚本自动从 `~/.openclaw/.env` 读取本 agent 的专属口令(键名 `DB_PASSWORD_理财`),口令不会出现在命令行中
|
||
- 禁止使用 root、禁止 docker exec、禁止访问其他 agent 的库
|
||
|
||
## 数据库初始化 SQL(首次运行自动执行)
|
||
|
||
```sql
|
||
CREATE DATABASE IF NOT EXISTS finances DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||
USE finances;
|
||
|
||
-- 家庭成员表
|
||
CREATE TABLE IF NOT EXISTS family_members (
|
||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||
name VARCHAR(50) NOT NULL,
|
||
role VARCHAR(20) COMMENT '配偶/子女/父母/其他',
|
||
is_active BOOLEAN DEFAULT TRUE,
|
||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||
);
|
||
|
||
-- 收入记录表
|
||
CREATE TABLE IF NOT EXISTS income_records (
|
||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||
member_id INT,
|
||
source VARCHAR(100) COMMENT '工资/奖金/副业/投资收益',
|
||
amount DECIMAL(12,2) NOT NULL,
|
||
frequency VARCHAR(20) COMMENT '月/季/年/一次性',
|
||
recorded_date DATE,
|
||
note TEXT,
|
||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||
FOREIGN KEY (member_id) REFERENCES family_members(id)
|
||
);
|
||
|
||
-- 固定支出表
|
||
CREATE TABLE IF NOT EXISTS fixed_expenses (
|
||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||
member_id INT,
|
||
category VARCHAR(50) COMMENT '房贷/房租/车贷/保险/物业费/学费',
|
||
amount DECIMAL(12,2) NOT NULL,
|
||
frequency VARCHAR(20) COMMENT '月/季/年',
|
||
due_date INT COMMENT '扣款日(1-31)',
|
||
note TEXT,
|
||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||
FOREIGN KEY (member_id) REFERENCES family_members(id)
|
||
);
|
||
|
||
-- 可变支出表
|
||
CREATE TABLE IF NOT EXISTS variable_expenses (
|
||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||
member_id INT,
|
||
category VARCHAR(50) COMMENT '餐饮/购物/娱乐/交通/医疗/人情',
|
||
amount DECIMAL(12,2) NOT NULL,
|
||
recorded_date DATE,
|
||
note TEXT,
|
||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||
FOREIGN KEY (member_id) REFERENCES family_members(id)
|
||
);
|
||
|
||
-- 资产表
|
||
CREATE TABLE IF NOT EXISTS assets (
|
||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||
member_id INT,
|
||
asset_type VARCHAR(50) COMMENT '存款/理财/基金/股票/房产/车辆',
|
||
name VARCHAR(100),
|
||
current_value DECIMAL(12,2) NOT NULL,
|
||
note TEXT,
|
||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||
FOREIGN KEY (member_id) REFERENCES family_members(id)
|
||
);
|
||
|
||
-- 负债表
|
||
CREATE TABLE IF NOT EXISTS liabilities (
|
||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||
member_id INT,
|
||
liability_type VARCHAR(50) COMMENT '房贷/车贷/消费贷/信用卡/亲友借款',
|
||
total_amount DECIMAL(12,2) NOT NULL,
|
||
interest_rate DECIMAL(5,2) COMMENT '年利率%',
|
||
remaining_months INT,
|
||
monthly_payment DECIMAL(12,2),
|
||
note TEXT,
|
||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||
FOREIGN KEY (member_id) REFERENCES family_members(id)
|
||
);
|
||
|
||
-- 财务目标表
|
||
CREATE TABLE IF NOT EXISTS financial_goals (
|
||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||
member_id INT,
|
||
goal_type VARCHAR(20) COMMENT '短期/中期/长期',
|
||
description VARCHAR(200) NOT NULL,
|
||
target_amount DECIMAL(12,2),
|
||
target_date DATE,
|
||
current_progress DECIMAL(12,2) DEFAULT 0,
|
||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||
FOREIGN KEY (member_id) REFERENCES family_members(id)
|
||
);
|
||
|
||
-- 对话日志表
|
||
CREATE TABLE IF NOT EXISTS conversation_log (
|
||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||
user_input TEXT,
|
||
agent_response TEXT,
|
||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||
);
|
||
```
|
||
|
||
## 常用 SQL 查询
|
||
|
||
### 月度总收支
|
||
```sql
|
||
SELECT
|
||
DATE_FORMAT(v.recorded_date, '%Y-%m') AS month,
|
||
COALESCE(i.total_income, 0) AS total_income,
|
||
COALESCE(f.total_fixed, 0) + COALESCE(v.total_variable, 0) AS total_expense,
|
||
COALESCE(i.total_income, 0) - (COALESCE(f.total_fixed, 0) + COALESCE(v.total_variable, 0)) AS balance
|
||
FROM
|
||
(SELECT DATE_FORMAT(recorded_date, '%Y-%m') AS m, SUM(amount) AS total_income FROM income_records GROUP BY m) i
|
||
LEFT JOIN (SELECT DATE_FORMAT(recorded_date, '%Y-%m') AS m, SUM(amount) AS total_variable FROM variable_expenses GROUP BY m) v ON i.m = v.m
|
||
CROSS JOIN (SELECT SUM(amount) AS total_fixed FROM fixed_expenses WHERE frequency='月') f
|
||
ORDER BY month DESC;
|
||
```
|
||
|
||
### 资产负债总览
|
||
```sql
|
||
SELECT '资产' AS type, asset_type AS item, SUM(current_value) AS total FROM assets GROUP BY asset_type
|
||
UNION ALL
|
||
SELECT '负债' AS type, liability_type AS item, SUM(total_amount) AS total FROM liabilities GROUP BY liability_type;
|
||
```
|
||
|
||
### 当月支出分类
|
||
```sql
|
||
SELECT category, SUM(amount) AS total
|
||
FROM variable_expenses
|
||
WHERE DATE_FORMAT(recorded_date, '%Y-%m') = DATE_FORMAT(CURDATE(), '%Y-%m')
|
||
GROUP BY category ORDER BY total DESC;
|
||
```
|
||
|
||
## Tools
|
||
|
||
### Local notes (migrated from TOOLS.md)
|
||
|
||
# TOOLS.md - Local Notes
|
||
|
||
Skills define _how_ tools work. This file is for _your_ specifics — the stuff that's unique to your setup.
|
||
|
||
## What Goes Here
|
||
|
||
Things like:
|
||
|
||
- Camera names and locations
|
||
- SSH hosts and aliases
|
||
- Preferred voices for TTS
|
||
- Speaker/room names
|
||
- Device nicknames
|
||
- Anything environment-specific
|
||
|
||
## Examples
|
||
|
||
```markdown
|
||
### Cameras
|
||
|
||
- living-room → Main area, 180° wide angle
|
||
- front-door → Entrance, motion-triggered
|
||
|
||
### SSH
|
||
|
||
- home-server → 192.168.1.100, user: admin
|
||
|
||
### TTS
|
||
|
||
- Preferred voice: "Nova" (warm, slightly British)
|
||
- Default speaker: Kitchen HomePod
|
||
```
|
||
|
||
## Why Separate?
|
||
|
||
Skills are shared. Your setup is yours. Keeping them apart means you can update skills without losing your notes, and share skills without leaking your infrastructure.
|
||
|
||
---
|
||
|
||
Add whatever helps you do your job. This is your cheat sheet.
|
||
|
||
## Related
|
||
|
||
- [Agent workspace](/concepts/agent-workspace)
|
||
|
||
## 配置文件位置(红线)
|
||
|
||
- 身份与配置文件**只放本 workspace 根目录**:IDENTITY.md / SOUL.md / AGENTS.md / USER.md / MEMORY.md
|
||
- **绝不写到 ~/.openclaw/agents/<id>/agent/** —— 那是状态目录(放 openclaw-agent.sqlite 与 plugins),
|
||
放那里的 .md 不会被任何机制加载
|
||
- 这 5 个固定文件名才会被 bootstrap 注入;子目录里的文件不会被注入
|