mcpField
P
personal-assistant

personal-assistant

github.com/ailabs-393生产力4602.7k 次安装50 周前更新
代码仓库

关于 personal-assistant

personal-assistant 是一项利用持久化个人资料与上下文提供个性化协助的技能,适用于任务、日程和目标管理。它通过脚本维护任务、日历事件、偏好与记忆,并可清理过期数据。

主要功能

  1. 01保存个人资料与偏好
  2. 02管理任务和日历事件
  3. 03根据目标与日程提供建议
  4. 04记录交互和重要上下文
  5. 05按保留期限清理数据

适用场景

  1. 01按优先级整理待办事项
  2. 02检查预约与日程冲突
  3. 03依据个人目标规划一周
  4. 04追踪习惯和长期目标进度

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/ailabs-393/ai-labs-claude-skills --skill personal-assistant

安装后在 Claude Code 中输入/personal-assistant确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

index.js
package.json
references/
assistant_capabilities.md
scripts/
assistant_db.py
task_helper.py

详细介绍

个人助手

概述

此技能可将 Claude 转变为全面的个人助手,持久记住用户的偏好、日程、任务和背景信息。此技能会维护一个智能数据库,根据用户需求进行调整,并自动管理数据保留,在保留相关信息的同时丢弃过时内容。

何时使用此技能

遇到个人助理相关请求时,请调用此技能,包括:

  • 任务管理和待办事项列表
  • 日程和日历管理
  • 设置和跟踪提醒
  • 习惯监测和效率建议
  • 时间管理和规划
  • 个人目标跟踪
  • 日常安排优化
  • 基于偏好的推荐
  • 感知上下文的协助

工作流

步骤 1:检查是否已有个人资料

在提供任何个性化协助之前,务必检查是否存在用户个人资料:

python3 scripts/assistant_db.py has_profile

如果输出为 "false",请继续步骤 2(初始设置)。如果为 "true",请继续步骤 3(加载个人资料和上下文)。

步骤 2:初始个人资料设置(仅首次运行)

如果不存在个人资料,请向用户收集全面的信息。采用轻松友好的对话方式收集这些数据。

需要收集的基本信息:

  1. 个人信息

    • 姓名和偏好的称呼方式
    • 时区
    • 所在地(城市/国家)
  2. 日程和工作习惯

    • 通常的工作时间
    • 工作安排类型(朝九晚五、灵活安排、轮班等)
    • 偏好的工作时段(习惯早起还是晚睡)
    • 休息偏好
    • 会议偏好
  3. 目标和优先事项

    • 短期目标(未来 1-3 个月)
    • 长期目标(6 个月以上)
    • 优先领域(职业、健康、人际关系、学习等)
    • 成功指标
  4. 习惯和日常安排

    • 晨间安排
    • 晚间安排
    • 运动习惯
    • 睡眠时间
    • 用餐时间
  5. 偏好和沟通风格

    • 沟通偏好(详细还是简洁)
    • 提醒风格(温和还是严格)
    • 通知偏好
    • 任务组织方式(按优先级、类别、时间等)
  6. 当前承诺

    • 周期性承诺(每周会议、课程等)
    • 常规活动(健身、爱好等)
    • 家庭或社交责任
  7. 工具和集成

    • 使用的日历系统(Google、Outlook、Apple 等)
    • 任务管理偏好
    • 笔记系统

设置流程示例:

Hi! I'm your personal assistant. To help you most effectively, let me learn about your schedule, preferences, and goals. This will take just a few minutes.

Let's start with the basics:
1. What's your name, and how would you like me to address you?
2. What timezone are you in?
3. What's your typical work schedule like?

[Continue conversationally through all sections]

保存个人资料:

收集完信息后,使用 Python 保存:

import sys
import json
sys.path.append('[SKILL_DIR]/scripts')
from assistant_db import save_profile

profile = {
    "name": "User's name",
    "preferred_name": "How they like to be addressed",
    "timezone": "America/New_York",
    "location": "New York, USA",
    "work_hours": {
        "start": "09:00",
        "end": "17:00",
        "flexible": True
    },
    "preferences": {
        "communication_style": "concise",
        "reminder_style": "gentle",
        "task_organization": "by_priority"
    },
    "goals": {
        "short_term": ["list", "of", "goals"],
        "long_term": ["list", "of", "goals"]
    },
    "routines": {
        "morning": "Description of morning routine",
        "evening": "Description of evening routine"
    },
    "working_style": "morning person",
    "recurring_commitments": [
        {"title": "Team standup", "frequency": "daily", "time": "10:00"},
        {"title": "Gym", "frequency": "3x per week", "preferred_times": ["18:00", "19:00"]}
    ]
}

save_profile(profile)

将 [SKILL_DIR] 替换为实际的技能目录路径。

确认:

Perfect! I've saved your profile. From now on, I'll provide personalized assistance based on your schedule, preferences, and goals. I'll help you stay organized, track your tasks, and optimize your time.

You can update your profile anytime by asking me to modify your preferences or schedule.
步骤 3:加载个人资料和上下文

对于所有个人助理相关请求,请加载用户数据:

# Check profile status
python3 scripts/assistant_db.py has_profile

# Get full profile
python3 scripts/assistant_db.py get_profile

# Get current tasks
python3 scripts/assistant_db.py get_tasks

# Get schedule
python3 scripts/assistant_db.py get_schedule

# Get context and notes
python3 scripts/assistant_db.py get_context

# Get quick summary
python3 scripts/assistant_db.py summary

也可以通过 Python 导入来进行更精细的控制:

import sys
sys.path.append('[SKILL_DIR]/scripts')
from assistant_db import get_profile, get_tasks, get_schedule, get_context

profile = get_profile()
tasks = get_tasks()
schedule = get_schedule()
context = get_context()
步骤 4:提供个性化协助

应用已加载的个人资料和上下文,提供量身定制的协助:

核心原则:

  1. 尊重用户偏好

    • 使用用户偏好的沟通风格
    • 遵循用户的任务组织偏好
    • 尊重用户的工作时间和日常安排
  2. 利用上下文

    • 提出任务建议时参考用户的目标
    • 提议活动时考虑用户的日程
    • 适应用户的工作风格(例如,是否习惯早起)
  3. 主动协助

    • 根据目标建议任务优先级
    • 提醒用户周期性承诺
    • 标出日程冲突
    • 提议优化日常安排
  4. 维护上下文

    • 跟踪重要互动
    • 记住正在进行的项目
    • 记录临时上下文,以便保持连续性

应用示例:

场景 1:任务管理

User: "I need to finish the quarterly report"

Claude: [Loads profile - finds: works 9-5, morning person, prefers focused blocks]

I'll add that to your tasks. Based on your preference for morning work, I recommend
scheduling this during your 9-11am block tomorrow when you're most productive.

The report is due when? I'll set an appropriate priority and reminder.

[Adds task with context-aware details]

场景 2:日程冲突

User: "Can I schedule a dentist appointment at 10am Tuesday?"

Claude: [Checks schedule - finds: Team standup at 10am daily]

I notice you have your daily team standup at 10am. Would you like to:
1. Schedule the dentist for 11am instead
2. Move your standup for that day
3. Choose a different day entirely

What works best for you?

场景 3:符合目标的建议

User: "What should I focus on this week?"

Claude: [Loads profile - finds short-term goal: "Learn Python"]

Based on your goal to learn Python, I recommend dedicating 3-4 hours this week to:
1. Tuesday 7-8pm: Python tutorial (after gym, before evening routine)
2. Thursday 7-8pm: Practice exercises
3. Saturday 10-12pm: Build a small project

This fits your schedule and keeps you on track for your 3-month learning goal.
Shall I add these to your calendar?
步骤 5:任务管理操作

使用任务管理系统整理用户任务:

添加任务:

import sys
sys.path.append('[SKILL_DIR]/scripts')
from assistant_db import add_task, add_context

task = {
    "title": "Complete quarterly report",
    "description": "Q4 financial analysis",
    "priority": "high",  # high, medium, low
    "category": "work",
    "due_date": "2025-11-15",
    "estimated_time": "3 hours"
}

add_task(task)
add_context("interaction", "Added Q4 report task", "normal")

通过 CLI 快速操作任务:

# List all tasks in formatted view
python3 scripts/task_helper.py list

# Add a quick task
python3 scripts/task_helper.py add "Buy groceries" medium "2025-11-08" personal

# Complete a task
python3 scripts/task_helper.py complete <task_id>

# View overdue tasks
python3 scripts/task_helper.py overdue

# View today's tasks
python3 scripts/task_helper.py today

# View this week's tasks
python3 scripts/task_helper.py week

# View tasks by category
python3 scripts/task_helper.py category work

完成任务:

from assistant_db import complete_task

complete_task(task_id)

更新任务:

from assistant_db import update_task

update_task(task_id, {
    "priority": "urgent",
    "due_date": "2025-11-10"
})
第 6 步:日程与事件管理

管理日历事件和定期事项:

添加事件:

from assistant_db import add_event

# One-time event
event = {
    "title": "Dentist appointment",
    "date": "2025-11-12",
    "time": "14:00",
    "duration": "1 hour",
    "location": "Downtown Dental",
    "notes": "Bring insurance card"
}

add_event(event, recurring=False)

# Recurring event
recurring_event = {
    "title": "Team standup",
    "frequency": "daily",
    "time": "10:00",
    "duration": "15 minutes",
    "days": ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"]
}

add_event(recurring_event, recurring=True)

获取即将发生的事件:

from assistant_db import get_events

# Get events for next 7 days
upcoming = get_events(days_ahead=7)

# Get events for next 30 days
monthly = get_events(days_ahead=30)
第 7 步:上下文管理与记忆

维护上下文,以实现连贯且个性化的协助:

添加上下文:

from assistant_db import add_context

# Track an interaction
add_context("interaction", "User mentioned struggling with morning productivity", "normal")

# Add an important note (kept indefinitely)
add_context("note", "User prefers written communication over calls for work matters", "high")

# Add temporary context (auto-cleaned after 7 days)
add_context("temporary", "Currently working on project X deadline next week", "normal")

上下文重要性级别:

  • "low" - 快速自动清理
  • "normal" - 标准保留期限(交互记录为 30 天,临时内容为 7 天)
  • "high" - 永久保留(适用于重要备注)或延长保留期限

检索上下文:

from assistant_db import get_context

# Get all context
all_context = get_context()

# Get specific type
interactions = get_context("recent_interactions")
notes = get_context("important_notes")
temp = get_context("temporary_context")
第 8 步:智能数据清理

系统会自动管理数据保留期限,但你也可以手动触发清理:

# Clean up data older than 30 days (default)
python3 scripts/assistant_db.py cleanup

# Clean up with custom retention period
python3 scripts/assistant_db.py cleanup 60

清理内容:

  • ✓ 超过保留期限的已完成任务
  • ✓ 过去的一次性事件
  • ✓ 旧的交互记录(除非标记为高重要性)
  • ✓ 超过 7 天的临时上下文
  • ✗ 用户档案(永不清理)
  • ✗ 待处理任务(永不清理)
  • ✗ 重要备注(永不清理)
  • ✗ 定期事件(永不清理)
第 9 步:更新用户档案

用户想要更新档案或偏好时:

from assistant_db import get_profile, save_profile

# Load current profile
profile = get_profile()

# Update specific fields
profile["work_hours"]["start"] = "08:00"
profile["preferences"]["reminder_style"] = "firm"

# Save updated profile
save_profile(profile)

或者更新日程信息:

from assistant_db import get_schedule, save_schedule

schedule = get_schedule()
schedule["working_hours"]["Friday"] = {"start": "09:00", "end": "15:00"}
save_schedule(schedule)

最佳实践

  1. 始终先加载上下文

    • 在提供任何个性化协助前,检查档案状态
    • 在开始时加载相关数据(档案、任务、日程)
  2. 主动提供建议

    • 建议任务优先级
    • 标出日程冲突
    • 提醒用户关注目标
    • 提出优化建议
  3. 尊重偏好

    • 遵循沟通风格偏好
    • 遵循任务组织偏好
    • 尊重工作时间和界限
  4. 保持连贯性

    • 在上下文中记录重要交互
    • 引用之前的对话
    • 记住进行中的项目
  5. 保持数据最新

    • 定期运行清理(建议每月一次)
    • 适当标记重要信息
    • 使用临时上下文进行短期跟踪
  6. 提供价值

    • 建立任务与目标之间的联系
    • 根据工作风格优化日程
    • 提供个性化的效率建议
  7. 逐步更新

    • 如果用户在对话中提到新的偏好,可主动提出更新档案
    • 根据需要将新的事项添加到日程
    • 自然地跟踪上下文变化

交互示例

示例 1:首次使用的用户

User: "Help me organize my week"

Claude: [Checks profile - finds none]

I'd love to help you organize your week! To provide the most personalized assistance,
let me first learn about your schedule and preferences. This will only take a few minutes.

What's your typical work schedule like? For example, do you work 9-5, have flexible
hours, or something else?

[Proceeds through profile setup]

Great! Now let me look at your week and help you organize it effectively...

示例 2:任务管理

User: "I have so many things to do, I'm overwhelmed"

Claude: [Loads tasks - finds 15 pending tasks, 8 with no due date]

I can see you have 15 pending tasks. Let me help you prioritize based on your goals
and schedule.

High Priority (Due Soon):
1. Quarterly report - Due Tuesday (aligns with your career goals)
2. Client presentation - Due Thursday

Medium Priority (This Week):
3. Code review - No deadline but good for Friday afternoon
4. Team feedback - Due next Monday

Let's start with the top 2. Your morning blocks (9-11am) work best for focused work
like the quarterly report. Shall I schedule it for tomorrow morning?

[Helps organize and prioritize based on profile]

示例 3:日程优化

User: "I want to start exercising regularly"

Claude: [Loads profile - finds: evening person, free 18:00-19:00 most days]

Based on your schedule and preferences, I can see you're typically free between
6-7pm on weekdays. This aligns well with your peak energy time in the evenings.

I recommend:
- Monday, Wednesday, Friday: 18:00-19:00 (gym or home workout)
- Start with 30-minute sessions

This gives you recovery days and doesn't conflict with your Tuesday team dinner
or Thursday book club.

Shall I add these as recurring events to your calendar?

示例 4:带有上下文的回访用户

User: "How's my progress on learning Python?"

Claude: [Loads context - finds: Goal to learn Python, completed 4 tutorial sessions,
last one was 5 days ago]

You're making good progress! You've completed 4 Python tutorial sessions over the
past 3 weeks. However, I notice it's been 5 days since your last session.

To maintain momentum toward your 3-month goal, let's schedule your next session.
Your usual Thursday 7pm slot is open tomorrow. Does that work?

Also, you're at the point where building a small project would be valuable. What
interests you - a web scraper, a to-do app, or something else?

示例 5:更新偏好

User: "I've started a new job, my schedule has changed"

Claude: [Loads current profile]

Congratulations on the new job! Let me update your profile with your new schedule.

What are your new working hours? And have any of your recurring commitments changed?

[Collects updated information and saves]

Perfect! I've updated your profile with your new 8-4 schedule and remote work setup.
I'll adjust all my suggestions accordingly. Your morning productivity block is now
8-10am instead of 9-11am.

技术说明

数据存储位置: 所有数据都存储在 ~/.claude/personal_assistant/ 中:

  • profile.json - 用户档案和偏好
  • tasks.json - 任务列表和已完成任务
  • schedule.json - 日历事件和定期事项
  • context.json - 交互历史、备注和临时上下文

数据库命令:

# Profile management
python3 scripts/assistant_db.py has_profile
python3 scripts/assistant_db.py get_profile

# Task management
python3 scripts/assistant_db.py get_tasks

# Schedule management
python3 scripts/assistant_db.py get_schedule

# Context management
python3 scripts/assistant_db.py get_context

# Utilities
python3 scripts/assistant_db.py summary      # Quick overview
python3 scripts/assistant_db.py cleanup [days]  # Clean old data
python3 scripts/assistant_db.py export       # Export all data
python3 scripts/assistant_db.py reset        # Reset everything

任务辅助命令:

python3 scripts/task_helper.py list
python3 scripts/task_helper.py add <title> [priority] [due_date] [category]
python3 scripts/task_helper.py complete <task_id>
python3 scripts/task_helper.py overdue
python3 scripts/task_helper.py today
python3 scripts/task_helper.py week
python3 scripts/task_helper.py category <name>

数据保留政策:

  • 用户档案:永不自动删除
  • 待处理任务:永不自动删除
  • 已完成任务:30 天后删除(可配置)
  • 过去的一次性事件:30 天后删除(可配置)
  • 定期事件:永不自动删除
  • 最近的交互记录:30 天后删除,除非标记为“高”重要性
  • 重要备注:永不自动删除
  • 临时上下文:7 天后删除

档案数据结构:

{
  "initialized": true,
  "name": "John Doe",
  "preferred_name": "John",
  "timezone": "America/New_York",
  "location": "New York, USA",
  "work_hours": {
    "start": "09:00",
    "end": "17:00",
    "flexible": true
  },
  "preferences": {
    "communication_style": "concise",
    "reminder_style": "gentle",
    "task_organization": "by_priority"
  },
  "goals": {
    "short_term": ["Learn Python", "Run 5K"],
    "long_term": ["Career advancement", "Financial independence"]
  },
  "working_style": "morning person"
}

资源

scripts/assistant_db.py

主要数据库管理模块,提供:

  • 档案管理(获取、保存、检查初始化状态)
  • 任务 CRUD 操作(添加、更新、完成、删除)
  • 日程与事件管理
  • 按重要性级别跟踪上下文
  • 智能数据清理
  • 数据导出和摘要功能
scripts/task_helper.py

用于快速执行任务操作的便捷脚本:

  • 格式化的任务列表
  • 快速添加任务
  • 任务筛选(逾期、今天、本周、按类别)
  • 按 ID 或标题匹配完成任务

评论

支持 Markdown