Content
# Dida Todo Agent
Dida365 MCP Server + Agent Skill, enabling AI Agents to manage your to-do list using natural language.
The core is a **rule engine**: through configurable routing rules, automatically assign natural language tasks to the correct project, set priorities and labels, and avoid AI freewheeling leading to classification chaos.
## Core Features
### 🎯 Rule Engine-Driven Task Routing
No longer rely on AI's "intuition" to categorize tasks. Define clear rules through [Routing Profile](skill/references/routing-profile-guide.md):
- **Project Routing**: Define purpose, positive examples, negative examples, and priority for each Dida365 project, using semantic matching + priority arbitration
- **Priority Strategy**: Set priority (0/1/3/5) based on deadline, blocking, critical delivery, etc., independent of project name
- **Label Management**: Automatically match existing labels, new labels must be confirmed by the user to create
- **Routing Lock**: Each write operation must carry the current routing revision, automatically re-read when configuration expires, to prevent incorrect classification
Example routing configuration:
```
Classification order:
1. Personal affairs and life reminders → Personal Reminders project
2. Work that affects results, leader requirements, or critical deliveries → Important Work project
3. Non-urgent work with no recent deadline → Non-Urgent Work project
4. Other daily work → General Work project
Priority rules (independent of project):
- Urgent, blocking, or critical delivery within 24 hours = 5
- Recent regular delivery = 3
- Postponable planning = 1
- Daily life reminders = 0
```
### 🔒 Secure Write Process
All state change operations go through two-step confirmation:
1. **Prepare**: Server returns a 5-minute valid, binding request parameter one-time confirmation token
2. **Confirm**: User explicitly confirms, then Agent submits the operation using the token
Applicable to: completing tasks, deleting tasks, creating labels, saving routing configurations, etc.
### 🔐 Credential Isolation
Client Secret and OAuth Token are stored in OS Keyring only, no disk storage, no logging, no chat records.
## Architecture
```
┌─────────────────────────────────────────────┐
│ Agent Framework │
│ (OpenClaw / Claude Desktop / Cursor / ...) │
├─────────────────────────────────────────────┤
│ Skill (dida-todo-agent) │
│ Natural Language Understanding · Rule Matching · Confirmation Interaction │
├─────────────────────────────────────────────┤
│ MCP Server (dida365-mcp) │
│ OAuth · Credential · Routing Verification · Task CRUD │
│ Confirmation Token · Operation Log · Concurrency Conflict Detection │
├─────────────────────────────────────────────┤
│ Dida365 Open API │
│ api.dida365.com/open/v1 │
└─────────────────────────────────────────────┘
```
- **MCP Server**: The execution layer of the rule engine. Responsible for OAuth, credential storage, routing configuration verification, task read/write, confirmation token, operation log, and concurrency conflict detection. Communicates with the host Agent through the standard stdio MCP protocol.
- **Agent Skill**: The decision-making layer of the rule engine. Responsible for natural language understanding, project routing matching, priority determination, label matching, and user confirmation interaction. Adapts to any Agent framework that supports MCP.
## Quick Start
### 1. Installation
```bash
cd dida-todo-agent
uv sync --frozen --extra dev
```
### 2. Configure Dida365 Application Credentials
```bash
.venv/bin/dida365-mcp-admin configure-app
```
Enter Client ID and Client Secret of Dida365 Open Platform as prompted. Credentials are stored in OS Keyring only.
### 3. OAuth Authorization
Call `start_oauth` after starting MCP Server, and the tool returns the authorization URL. Open the URL in the browser to complete authorization, then call `auth_status` to verify.
### 4. Register MCP Server in Host Agent
Standard stdio startup configuration:
```json
{
"command": "<path-to-project>/.venv/bin/python",
"args": ["-m", "dida365_mcp.server"],
"cwd": "<path-to-project>"
}
```
### 5. Register Agent Skill
Copy the `skill/` directory to the skill directory of the Agent framework. For example, with OpenClaw:
```bash
cp -r skill/ ~/.openclaw/skills/dida-todo-agent/
```
### 6. Configure Routing Rules
Refer to [Routing Profile Guide](skill/references/routing-profile-guide.md) to write your routing configuration and write it through the `save_routing_profile` tool. Routing configuration defines project purpose, priority strategy, and label rules.
## Project Structure
```
dida-todo-agent/
├── src/dida365_mcp/ # MCP Server
│ ├── server.py # MCP tool entry + _parse JSON fix
│ ├── credentials.py # OS Keyring credential storage
│ ├── oauth.py # OAuth 2.0 callback process
│ ├── dida_client.py # Dida365 API client
│ ├── routing.py # Routing configuration verification
│ ├── confirmations.py # Confirmation token management
│ ├── ledger.py # Operation log
│ └── ...
├── skill/ # Agent Skill
│ ├── SKILL.md # Skill definition (routing decision, confirmation process)
│ └── references/ # Adapter contract, behavior use case, routing guide
├── tests/ # Test suite
└── scripts/ # OAuth authorization auxiliary script
```
## Development
```bash
uv run pytest -q # Run tests
uv run ruff check src tests # Code check
uv run mypy src # Type check
```
## License
MIT