Metadata-Version: 2.4
Name: my-heart-health
Version: 1.0.2
Summary: 心理打卡 Agent — 记录睡眠/压力/情绪日记，每周自动复盘，帮用户看到情绪波动规律、触发事件，输出问题总结
Author: my-heart-health
License: MIT
Project-URL: Homepage, https://github.com/
Keywords: mental-health,mood-tracking,agent,acps-sdk
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: End Users/Desktop
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: acps-sdk<3,>=2.1.0
Requires-Dist: click>=8.0

# my-heart-health

心理打卡 Agent 🔒 — 记录睡眠 / 压力 / 情绪日记，每周自动把日志批量交给复盘 Agent，帮你看到情绪波动规律、触发事件，输出简单总结。**不做诊断**。

依赖 [acps-sdk 2.1.0](https://pypi.org/project/acps-sdk/) 实现智能体互联（AIP + ACS）。

## 设计

```
┌─────────────────────┐       AIP RPC (acps-sdk)        ┌─────────────────────┐
│  Tracker Agent       │ ──── week JSON ───────────────► │  Reviewer Agent      │
│  (Leader, CLI)       │ ◄── summary text ─────────────  │  (Partner, FastAPI)  │
│                      │                                  │                      │
│  - record            │                                  │  - 接收一周日志       │
│  - list / week       │                                  │  - 趋势/触发因素统计   │
│  - review (联网)     │                                  │  - 返回总结 Product   │
└─────────────────────┘                                  └─────────────────────┘
           │                                                     │
           ▼                                                     ▼
   ~/.my-heart-health/journal.json                        纯 Python 算法
   （本地 JSON 日志，离线可查）                             （不调 LLM / 不联网）
```

## 快速上手

```bash
# 1. 安装（本地开发）
pip install -e .
# 或从源码构建 wheel
pip install build && python -m build
pip install dist/my_heart_health-1.0.2-py3-none-any.whl

# 2. 启动复盘 Agent（另开一个终端）
my-heart-health-reviewer
# 监听 http://127.0.0.1:8765/aip/rpc

# 3. 打卡
my-heart-health record --sleep 7.5 --stress 3 --mood 平静 --mood 满足 --trigger 工作 --diary "今天效率不错"
my-heart-health list              # 看历史
my-heart-health week              # 看本周本地统计（不联网）
my-heart-health review            # 上周日志发给复盘 Agent
```

## 项目结构

```
my_heart_health/
├── __init__.py
├── cli.py               # click CLI 入口
├── agent/
│   ├── tracker.py       # 打卡 Agent（Leader，AipRpcClient 调用复盘）
│   └── reviewer.py      # 复盘 Agent（Partner，FastAPI + AIP RPC Server）
├── models/entries.py    # MoodEntry / WeekLog 数据模型
├── storage/journal.py   # 本地 JSON 存储
└── analysis/patterns.py # 周模式分析（趋势、触发因素、文本总结）
```

## 关于"每周自动"

推荐用系统自带的 **cron** / **launchd** / **任务计划程序** 每周一早上触发：

```bash
# macOS / Linux 示例：每周一 09:00 自动把上一周日志发给复盘 Agent
0 9 * * 1  my-heart-health review >> ~/.my-heart-health/review.log 2>&1
```

本包本身不内置定时器，避免引入复杂依赖。

## 免责声明

本工具仅帮助你整理自主记录的睡眠、压力、情绪数据的**统计趋势**，不构成任何医学诊断。如有持续困扰，请咨询专业人士。
