Medication Manager

Data & APIs

Family medication management skill using file-based storage (no database required). Supports medication entry via photo/image (prescription, medicine box), text description, or voice input. Manages medication inventory, batch tracking, expiry alerts, and member health records. Works with any reminder platform (Feishu, Telegram, QQ, etc.). Use when: (1) user sends photos of prescriptions or medicine boxes, (2) user describes medications to record, (3) checking medication inventory or expiry, (4) reviewing medication history, (5) logging medication intake, (6) managing family health records.

Install

openclaw skills install medication-manager

Medication Manager

Family medication management with file-based storage. No database required — works anywhere.

Overview

FeatureHow
Medication catalogMarkdown files in data/medications/
Member profilesMarkdown files in data/members/
Batch trackingEmbedded in medication files
Expiry alertsscripts/check_expiry.py or manual scan
RemindersYour platform's cron/reminder system (configurable)
NotificationsOpenClaw cron, webhooks, email, local OS — you choose
Media archivedata/media/ with date-based folders

Quick Start

Step 1: Set Up Family Member Profiles

This is always the first step. Before recording any medications, create profiles for each family member.

See references/member-profile.md for the complete template, role-specific fields, and data collection guide.

Setup flow (follow this every time):

  1. Ask about family members: "家里有几位成员?分别是谁?(大人/小孩/老人)"
  2. For each member, collect minimum info:
    • 姓名 — who is this person?
    • 角色 — 成人 / 儿童 / 老人
    • 出生日期 — for age calculation (儿童: calculate exact months)
    • 体重 (kg) — ⚠️ 儿童必填,用药剂量按体重计算
    • 过敏史 — ⚠️ 最重要的安全问题 — "有没有什么药物过敏?"
  3. For children, additionally ask:
    • 疫苗接种情况
    • 近期是否生病/用药
  4. For adults/elderly, additionally ask:
    • 慢性病(高血压、糖尿病等)
    • 长期服用的药物
  5. Create data/members/{name}.md for each member
  6. Confirm the profiles with the user before proceeding

Minimal profile (user can fill in details later):

# {姓名}

| Field | Value |
|-------|-------|
| Name | {姓名} |
| Role | 成人 / 儿童 / 老人 |
| Birth Date | YYYY-MM-DD |
| Weight | {kg} |
| Allergies | {list or "无已知过敏"} |

Step 2: Configure Notifications

Before setting reminders, configure how the user wants to be notified.

This skill does not hardcode any notification channel. The user chooses their own method.

Option A: OpenClaw Built-in Cron (Recommended for OpenClaw users)

If running on OpenClaw, the cron system supports all configured channels automatically.

# Example: daily 8am reminder via current channel
openclaw cron add \
  --name "med-{member}-{drug}" \
  --schedule "0 8 * * *" \
  --agent-id your-agent \
  --message "⏰ 用药提醒\n\n💊 {药品名}\n剂量:{剂量}\n\n请按时服药!"

Supported channels (via --target):

ChannelTarget FormatExample
Feishufeishu:{open_id}feishu:ou_xxxxx
Telegramtelegram:{chat_id}telegram:-1001234567
QQ Botqqbot:c2c:{openid}qqbot:c2c:xxxxx
Discorddiscord:{channel_id}discord:123456789
Signalsignal:{phone}signal:+86138xxxx

Tip: Omit --target to send to the current conversation (auto-detected).

Option B: Webhook (DingTalk, WeChat Work, Slack, etc.)

If the user has a webhook URL, send a POST request with the reminder message. See references/notifications.md for full templates.

See references/notifications.md for:

  • All notification options with full examples
  • Notification content templates
  • Agent implementation guide
  • Troubleshooting

What the agent should do:

  1. Detect the user's current channel from conversation context
  2. Ask: "你希望通过什么方式接收用药提醒?" and offer options
  3. If OpenClaw → use cron with auto-detected target
  4. If webhook → ask for the webhook URL
  5. Store the notification config in the member profile
  6. Always test — send one test notification to confirm it works

Step 3: Set Up Data Directory

Create the storage structure:

data/
├── medications/        # One .md per medication
├── members/            # One .md per family member (created in Step 1)
├── prescriptions/      # Prescription records (optional)
├── logs/               # Medication intake logs (YYYY-MM-DD.md)
├── config/             # Optional: notification config
│   └── notifications.yaml
└── media/              # Photos of prescriptions/boxes
    └── YYYY-MM-DD/

Step 4: Add Medications

When a user describes or sends a photo of a medication:

  1. Analyze with vision model (if photo)
  2. Extract: generic name, brand name, spec, manufacturer, batch no, expiry, dosage
  3. Confirm details with user
  4. Create a markdown file: data/medications/{generic_name}.md
  5. Set up reminders if requested (using configured notification method)

Medication File Template

# {Generic Name} ({Brand Name})

## Basic Info
| Field | Value |
|-------|-------|
| Generic Name | {name} |
| Brand Name | {name} |
| Specification | {spec} |
| Manufacturer | {manufacturer} |
| Approval No | {批准文号} |
| Drug Type | 处方药 / OTC / 外用药 |
| Category | 抗生素 / 感冒药 / 退烧药 / etc. |
| Indications | {适应症} |
| Contraindications | {禁忌} |
| Storage | {储存条件} |

## Batches
| Batch No | Mfg Date | Expiry | Qty | Unit | Location | Status |
|----------|----------|--------|-----|------|----------|--------|
| {batch} | {date} | {date} | {n} | 盒/支/瓶 | {location} | active |

## Usage Notes
- Adult dose: {dosage}
- Child dose: {dosage by weight}
- Food: before/after meals
- Special notes: {warnings}

## History
| Date | Member | Action | Notes |
|------|--------|--------|-------|
| YYYY-MM-DD | {name} | added/prescribed | {source} |

Notification Settings

Core Workflows

Photo Entry (prescription / medicine box)

User sends image → Analyze with vision model → Extract medication info
→ Confirm with user → Create/update medication .md file → Set reminders if requested

Steps:

  1. Use your platform's image analysis tool to read the photo
  2. Extract: generic name, brand name, spec, manufacturer, batch no, expiry, dosage
  3. Confirm details with user (especially for prescriptions)
  4. Save photo to data/media/YYYY-MM-DD/
  5. Create or update the medication markdown file
  6. Ask if reminders are needed → use configured notification method

Text Entry

User describes medication → Parse → Confirm → Create .md file

Use structured extraction from user's text description. Always confirm before creating.

Set Reminder

Get member + medication + schedule → Check notification config
→ Create platform-specific reminder → Record in member file → Test it
  1. Read member file for notification settings
  2. If no notification config exists → ask the user to configure first (see Step 2)
  3. Query medication file for drug info
  4. Determine reminder schedule based on dosage instructions
  5. Create reminder using the configured method:
    • OpenClaw cron: openclaw cron add --name "..." --schedule "..." --message "..."
    • Webhook: POST JSON to the webhook URL
  6. Test — send one notification immediately to confirm delivery
  7. Record the reminder details in the member's notification settings
  8. Confirm with the user: "提醒已设置,{时间}会收到通知"

Expiry Check

python3 /path/to/medication-manager/scripts/check_expiry.py /path/to/data/medications/

Or manually scan medication files for expiry dates. Alert levels:

LevelThresholdAction
🔴 ExpiredPast dateNotify immediately, mark as expired
⚠️ 7 daysWithin 7 daysDaily reminder to use or dispose
🟡 30 daysWithin 30 daysWeekly reminder
🔶 90 daysWithin 90 daysMonthly review

Query Inventory

Scan all files in data/medications/ for:

  • Active batches with quantity > 0
  • Sort by expiry date (soonest first)
  • Filter by category if requested

Log Medication Intake

When a family member takes a medication:

  1. Append entry to data/logs/YYYY-MM-DD.md:
    | Time | Member | Medication | Dose | Status | Notes |
    |------|--------|-----------|------|--------|-------|
    | 08:15 | 张三 | 氨氯地平 | 5mg | ✅ taken | 饭后 |
    
  2. Update batch quantity in the medication file (decrement)
  3. Flag if dose was missed or skipped

Reference Data

ReferencePathPurpose
Member profilesreferences/member-profile.mdTemplate & collection guide
Notificationsreferences/notifications.mdAll notification options & templates
Storage layoutreferences/storage-layout.mdFile organization & naming
Drug interactionsreferences/drug-interactions.mdCheck when multiple drugs prescribed
Pediatric dosagereferences/pediatric-dosage.mdCalculate child doses by weight
Setup guidereferences/setup.mdInstallation & first use

Important Rules

  • Always confirm medication details before saving
  • Configure notifications first — reminders are useless if they can't reach the user
  • Test notifications — always send a test notification after setup
  • Children dosing: always verify weight and age, ask about allergies
  • Expiry alerts: proactively notify when drugs expire or near expiry
  • Antibiotics: flag prescription antibiotics, remind about completing full course
  • Drug interactions: check reference when multiple drugs prescribed together
  • Special drugs: flag controlled substances (精二药品, etc.)
  • Privacy: do not share personal health information

Platform Adapters

This skill is platform-agnostic. The notification layer adapts to whatever the user has:

PlatformMethodSetup
OpenClaw (any channel)Built-in cronAuto-detected, no config needed
Feishumessage tool or cronSet --target "feishu:{open_id}"
TelegramBot API or cronSet --target "telegram:{chat_id}"
QQ Botqqbot_remind / qqbot_cronSet target via cron
WebhookPOST JSONProvide webhook URL

Full details: references/notifications.md

Data Migration

If you have existing medication data (e.g., from a spreadsheet or another system):

  1. Convert each medication to the markdown template above
  2. Place files in data/medications/
  3. Run the expiry check script to validate dates